ô > GETSYS/SRC 4ô Copy system tracks on Acorn CPM disk to a file : A%=0:X%=1:os%=(º&FFF4 € &FF00)256:ç os%=6 € >&8000:ñ"Running Z80...":È™ "OS_GetEnv" ¸ A$:ÿ"Z80 "+ÁA$,§A$," ",1+§A$," "))):à $unix%=os%=8:quit%=?&80<>0:?&80=0 î … ö:ñ" at line ";:à )Ş mcode% &800:start%=&100:ver$="0.01" : 7OSWORD=&FFF1:CLICOM=&FFB9:PRTEXT=&FFB3:OSNEWL=&FFE7 7PRHEX=&FFAA:PR2HEX=&FFAD:OSNEWL=&FFE7:DISKACC=&FFA4 : ô CPM Entries: DRIVE=4:bdos=5 ,bdos_string=9:bdos_open=15:bdos_close=16 ?bdos_delete=19:bdos_make=22:bdos_writeseq=21:bdos_setdma=26 : ô Memory locations: FCB1=&5C:FCB2=&6C:DMA=&80 : òassem("GETCCP",8,&800,0) òassem("GETBDOS",16,&E00,0) !òassem("GETBIOS",0,&800,&800) !òassem("GETSYS",0,&1E00,&800) ç quit%:*Quit à : 7ݤopt(A%,B%):A%=(P%-B%)€A%:P%=P%-A%:O%=O%-A%:=P*3+4 (İòassem(name$,sector%,length%,move%) Cs1%=0:n1%=0:s2%=0:n2%=0:s3%=0:n3%=0:s0%=sector%:n0%=length%256 Kç(s0%ƒ10)+n0%>10:s1%=10*(s0%10)+10:n1%=n0%:n0%=10-(s0%ƒ10):n1%=n1%-n0% Kç(s1%ƒ10)+n1%>10:s2%=10*(s1%10)+10:n2%=n1%:n1%=10-(s1%ƒ10):n2%=n2%-n1% Gç length%=&1E00:s0%=8:n0%=2:s1%=10:n2%=10:s2%=20:n2%=10:s3%=0:n3%=8 !: " ã P=0 ¸ 1 #P%=start%:O%=mcode% $[OPT P*3+4 % JP Start &.msgSyntax 'JİB 13:İB 10:İM "Syntax: "+name$+" filename ()":İB 13:İB 10:İM "$" (.msgBadName )4İB 13:İB 10:İM "Bad filename":İB 13:İB 10:İM "$" *.msgCantSave +6İB 13:İB 10:İM "Directory full":İB 13:İB 10:İM "$" ,.msgDiskFull -1İB 13:İB 10:İM "Disk full":İB 13:İB 10:İM "$" .: /.errDiskFull 0#LD DE,msgDiskFull:JR ErrorAbort 1.errCantSave 2#LD DE,msgCantSave:JR ErrorAbort 3.errBadName 4"LD DE,msgBadName:JR ErrorAbort 5.errSyntax 6LD DE,msgSyntax 7.ErrorAbort 8LD C,bdos_string:JP bdos 9: : .Start ;LD HL,FCB1+1 <:LD A,(HL):CP —" ":JR Z,errSyntax :\ No parameters = LD B,11 >.CheckFilename ?HLD A,(HL):CP —"?":JR Z,errBadName :\ Ensure unambiguous filename @INC HL:DJNZ CheckFilename A: B>LD A,(DRIVE):€ 15:LD B,A :\ Get current drive CRLD A,(FCB2+0):€ A:JR Z,SetDrive :\ No drive specified, use current drive DDEC A:LD B,A E .SetDrive FELD A,B:CP 2:JR NC,errSyntax :\ Only drive 0/1 allowed GJLD (Disk_0),A :\ Set drive in control blocks H(.z%:LD (Disk_1),A:OPT ¤opt(n1%=0,z%) I(.z%:LD (Disk_2),A:OPT ¤opt(n2%=0,z%) J(.z%:LD (Disk_3),A:OPT ¤opt(n3%=0,z%) K: L=LD HL,Disk_0 ;\ Read from disk M1.z%:Ö DISKACC:LD HL,Disk_1:OPT ¤opt(n1%=0,z%) N1.z%:Ö DISKACC:LD HL,Disk_2:OPT ¤opt(n2%=0,z%) O1.z%:Ö DISKACC:LD HL,Disk_3:OPT ¤opt(n3%=0,z%) P Ö DISKACC Q: R.DiskBuffer S!LD HL,Buffer+length%-move%+16 TLD DE,Buffer+length%-move% UILD BC,240:LDIR :\ Move down first DFS sector V%LD HL,Buffer+length%-move%+256+16 WOLD BC,move%-256-16:LDIR :\ Move down past second DFS sector XIOPT ¤opt(move%=0,DiskBuffer) :\ Snip out if not saving BIOS Y: Z:LD DE,FCB1:LD C,bdos_delete:Ö bdos :\ Ensure no file [=LD DE,FCB1:LD C,bdos_make:Ö bdos :\ Create a new file \INC A:JP Z,errCantSave ]: ^ .SaveLoop _3LD DE,(Addr):LD C,bdos_setdma:Ö bdos :\ Set DMA `;LD DE,FCB1:LD C,bdos_writeseq:Ö bdos :\ Write from file a„ A:JP NZ,errDiskFull b LD DE,&80 c=LD HL,(Addr):ADD HL,DE:LD (Addr),HL :\ Update address d