17.01.2013 Views

AmstradCPC6128-hypertext-en-Sinewalker

AmstradCPC6128-hypertext-en-Sinewalker

AmstradCPC6128-hypertext-en-Sinewalker

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

250 y=0:b=150:GOSUB 400<br />

260 x=575:a=-240:y=400:b=-150:GOSUB 400<br />

270 y=0:b=150:GOSUB 400<br />

280 gp=2:GRAPHICS PEN gp:w=40<br />

290 a=240:x=-40:y=400:b=-150:GOSUB 400<br />

300 x=0:y=0:b=150:GOSUB 400<br />

310 a=-240:x=640:y=0:b=150:GOSUB 400<br />

320 x=600:y=400:b=-150:GOSUB 400<br />

330 ORIGIN 0,0,256,380,0,400:CLG 1<br />

340 ORIGIN 0,0,0,640,150,250:CLG 1<br />

350 ORIGIN 0,0,280,352,0,400:CLG 2<br />

360 ORIGIN 0,0,0,640,168,230:CLG 2<br />

370 SAVE dumpfi Le$,b,&C000,&4000<br />

380 DATA 2,26,6<br />

390 END<br />

400 MOVE x,y:DRAWR a,b:DRAWR w,0:DRAWR -a,-b<br />

410 MOVE x+a/2+w/2,y+b/2:FILL gp<br />

420 RETURN<br />

430 errnum=ERR:RESUME NEXT<br />

run<br />

Note the use of • D A T and. SRN filetypes. These filetypes are used to remind us of<br />

what is in the file, rather than because they have any inher<strong>en</strong>t significance. The file<br />

PAR A M • D A T will be an ASCII data file without a header, whilst F LA G DUM P • SRN<br />

is an AMSDOS binary file with a header.<br />

Note how the program deliberately tries to read from the file PAR A M • D A T before<br />

writing to it, in order to establish if the file already exists. If the file does NOT exist,<br />

th<strong>en</strong> an error is reported by BASIC; the error is trapped by the program, and<br />

execution proceeds without interruption. If the file DOES already exist, th<strong>en</strong> no error<br />

is reported, and the program automatically asks if you wish to overwrite the existing<br />

file.<br />

The particulars of the scre<strong>en</strong> dump, namely the scre<strong>en</strong> mode, palette colours and<br />

name of file containing the actual information, are saved into a parameter file. This<br />

illustrates the use of a data file to W RI T E program variables (d u m p f i L e $) and<br />

constants ( 1 ), saving them for use by another program.<br />

AMSDOS and CPIM Chapter 5 Page 7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!