Examples Of Using Amsdos Commands In A Program; Saving Variables And Performing A Screen Dump - AMSTRAD cpc 6128 User Instruction

Integrated computer/disc system
Hide thumbs Also See for cpc 6128:
Table of Contents

Advertisement

Examples of using AMSDOS commands in a
program
To give you a good understanding of the AMSDOS commands, we recommend that
you work through the examples, referring to the relevant sections in the rest of this
chapter as you go. DO NOT type in, or run, these programs with one of your original
Master
CP/M
system discs installed.
Saving variables and performing a screen dump
The following example program writes to the disc, and you will therefore need a
blank (formatted) disc or working disc inserted in the drive to run the program. The
program draws a Union Jack flag, and then saves the whole screen to disc.
10 dumpfi Le$="fLagdump.srn"
20 MODE 1:BORDER 0
30 DIM coLour(2)
40 FOR i=0 TO 2
50
READ coLour(i): REM get coLours from DATA statement
60
INK i,coLour(i)
70 NEXT
80 ON ERROR GOTO 430
90 OPENIN "param.dat"
I
test if fi Le exists
100 CLOSEIN:ON ERROR GOTO 0
110 IF errnum=32 AND DERR=146 THEN CLS:
GOTO 160
I
fiLe doesnt exist
120 CURSOR 1:PRINT liDo you want to overwrite
oLd fi Le? Y/N ";
130 a$=INKEY$:ON INSTR(" YN",UPPER$(a$»
GOTO 130,150,140:GOTO 130
140 PRINT a$:PRINT "Program abandoned":END
150 PRINT a$:CURSOR 0
160 OPENOUT "param.dat"
170 WRITE #9,dumpfi Le$,1: REM save fi Lename and mode
180 FOR i=0 TO 2
190 WRITE #9,coLour(i): REM save coLours
200 NEXT i
210 CLOSEOUT
220 CLS
230 gp=1:GRAPHICS PEN gp:w=125
240 x=-65:a=240:y=400:b=-150:GOSUB 400
continued on the next page
Chapter 5 Page 6
AMSDOS and CPIM

Advertisement

Table of Contents
loading

Table of Contents