1
2
3 :
4 name$="MODE/COM":start%=&100
5 :
6 BDOS=5:OSWRCH=&FFEE:FCB=&5C:bdos_string=9
7 :
8 DIM mcode% &100
9 FOR P=0 TO 1
10 O%=mcode%:P%=start%
11 [OPT P*3+4
12 JP Start
13 .msgSyntax
14 DEFB 13:DEFB 10:DEFM "Syntax: MODE <num>":DEFB 13:DEFB 10:DEFM "$"
15 .msgBadNumber
16 DEFB 13:DEFB 10:DEFM "Bad number":DEFB 13:DEFB 10:DEFM "$"
17 :
18 .errBadNumber
19 LD DE,msgBadNumber:JR errAbort
20 .errSyntax
21 LD DE,msgSyntax
22 .errAbort
23 LD C,bdos_string:JP BDOS
24 :
25 .Start
26 LD DE,FCB+1:LD A,(DE)
27 CP ASC" ":JR Z,errSyntax
28 CALL ReadDec:JR C,errBadNumber
29 LD A,22:CALL OSWRCH
30 LD A,C:JP OSWRCH
31 :
32 .ReadDec
33 XOR A
34 .ReadDecLp
35 LD C,A:LD A,(DE)
36 CP ASC"!":CCF:RET NC :\ NC=Ok
37 INC DE:CP ASC":":CCF:RET C :\ C=Bad Number
38 SUB ASC"0":RET C :\ C=Bad Number
39 LD B,10
40 .ReadDecAdd
41 ADD A,C:RET C :\ C=Bad Number
42 DJNZ ReadDecAdd:JR ReadDecLp
43 :
44 ]
45 NEXT
46 A$="*SAVE "+name$+" "+STR$~mcode%+" "+STR$~O%
47 PRINTA$