REM > BDOS/SRC REM Source for ZNOS BDOS code REM REM v0.01 JGH: Initial source code recreated : OS_CLI=&FFF7:OSBYTE=&FFF4:OSWORD=&FFF1:OSWRCH=&FFEE OSASCI=&FFE3:OSGBPB=&FFD1:OSNEWL=&FFE7:OSFILE=&FFDD : : DIM mcode% &1300 FORP=0TO1 O%=mcode%:P%=&E000 [OPT P*3+4 .BDOS_BASE :NOP:NOP:NOP:\ Base address of BDOS .BDOS_RESET:JP &0000 :\ Jump to warm reboot .BDOS_ENTRY:JP LE012 :\ Perform BDOS function call .BDOS_XXXX :JP LE012 :\ Perform BDOS function call .BDOS_COLD :JP LE04A :\ Called by BIOS Cold Start .BDOS_WARM :JP LEA05 :\ Called by BIOS Warm Start \ ---------------------- \ BDOS function dispatch \ ---------------------- .LE012 LD A,C :\ Get function code to A LD (LE109),SP :\ Save stack pointer CP &0E:JR C,LE028 :\ Functions 0-13, jump past LD SP,LE15B :\ Use internal stack LD A,&05:CALL LE495 :\ Ensure NetFS selected for file access functions LD A,C :\ Get function code back to A LD SP,(LE109) :\ Get stack pointer back .LE028 CP &29:LD HL,LE07E :\ Point to CP/M function table JR C,LE03F :\ If function<&29, use CP/M table and internal stack SUB A,&40:JR C,LE079 :\ If function &29-&3F, exit quickly CP &1B:JR NC,LE079 :\ If function>&5A, exit quickly LD HL,LE0D0 :\ Point to ZNOS function table and use external stack .LE03A CALL LE54D :\ Get entry from function table LD C,E:JP (HL) :\ Pass E to C and jump to routine .LE03F :\ For CP/M functions, use internal stack LD SP,LE15B :\ Use internal stack CALL LE03A :\ Call function routine LD SP,(LE109):RET :\ Get SP back and return \ Called by BIOS Cold Start \ ------------------------- .LE04A CALL LEFAD :\ Copy start of BDOS CALL LE471 :\ Intercept OSCLI and select NetFS CALL LE508 :\ Calls a RET CALL LE317 :\ Clears some workspace CALL LE508 :\ Calls a RET XOR A LD (LF1E1),A LD DE,LE10B LD (DE),A JP LE3BB :\ Get station number and return \ ------------------------------------------ \ ZNOS call &4A - Return ZNOS version string \ ------------------------------------------ \ On exit, A = &00 \ HL=>version string .LE064 LD HL,LE50B :\ Point to version string \ ----------------------------------- \ BDOS call &19 - Return current disk \ ----------------------------------- .LE067 XOR A :\ A=&00 - Drive A: selected \ --------------------------------- \ BDOS calls not relevant to NetFS \ BDOS call &0D - Reset Disk System \ BDOS call &0E - Select Disk \ --------------------------------- .LE068 RET \ ------------------------------ \ BDOS call &0C - Return version \ ------------------------------ .LE069 LD HL,&0022 :\ &0022 - CP/M 2.2 compatible .LE06C LD A,L:LD B,H:RET \ ----------------------------------- \ BDOS call &18 - Return login vector \ ----------------------------------- .LE06F LD HL,&0001:JR LE06C :\ &0001 - Drive A logged in \ ------------------------------- \ BDOS call &1A - Set DMA Address \ ------------------------------- .LE074 LD (LE107),DE:RET :\ Set DMA address \ --------------------------- \ Exit unimplemented function \ ------------------------------ \ BDOS call &1D - Get R/O vector \ BDOS call &20 - Get/Set User Code \ BDOS call &25 - Reset Drive \ BDOS call &26 - unsupported \ BDOS call &27 - unsupported \ ------------------------------ .LE079 XOR A:LD L,A:LD H,A :\ A=B=HL=0 LD B,A:RET \ --------------------------------- \ Function table for CP/M functions \ --------------------------------- .LE07E DEFW &0000 :\ &00 -- WBOOT DEFW LE15B :\ &01 -- Console Input DEFW LE16A :\ &02 -- Console Output DEFW LE1CD :\ &03 -- Reader Input DEFW LE1D0 :\ &04 -- Punch Input DEFW LE1D3 :\ &05 -- List Output DEFW LE1D6 :\ &06 - Direct Console I/O DEFW LE1E0 :\ &07 -- Get I/O Byte DEFW LE1E4 :\ &08 -- Set I/O Byte DEFW LE1E9 :\ &09 - Print String DEFW LE1F3 :\ &0A - Read Console Buffer DEFW LE276 :\ &0B - Get Console Status DEFW LE069 :\ &0C -- Get Version Number DEFW LE068 :\ &0D -- Reset Disk System DEFW LE068 :\ &0E -- Select Disk DEFW LE704 :\ &0F - Open File DEFW LE9C1 :\ &10 - Close File DEFW LEA26 :\ &11 - Search For First DEFW LEA95 :\ &12 - Search For Next DEFW LECE3 :\ &13 -- Delete File DEFW LE575 :\ &14 -- Read Sequential DEFW LE562 :\ &15 -- Write Sequential DEFW LE718 :\ &16 -- Make File DEFW LEC1B :\ &17 -- Rename File DEFW LE06F :\ &18 -- Return Login Vector DEFW LE067 :\ &19 -- Return Current Disk DEFW LE074 :\ &1A -- Set DMA Address DEFW LF072 :\ &1B -- Get Allocation Vector DEFW LF071 :\ &1C -- Write Protect Drive DEFW LE079 :\ &1D -- Get RO vector DEFW LEBB9 :\ &1E -- Get File Attributes DEFW LF06E :\ &1F -- Get Disk Parameter Block DEFW LE079 :\ &20 -- Get/Set User Code DEFW LE570 :\ &21 -- Read Random DEFW LE55D :\ &22 -- Write Random DEFW LE864 :\ &23 -- Compute File Size (=EXT) DEFW LE6BE :\ &24 -- Set Random Record (PTR=) DEFW LE079 :\ &25 -- Reset Drive DEFW LE079 :\ &26 -- Unsupported MP/M DEFW LE079 :\ &27 -- Unsupported MP/M DEFW LE55D :\ &28 -- Write Random with Zero Fill .LE0D0 :\ Function table for ZNOS functions DEFW LEFC3 :\ &40 -- Start Transmit DEFW LEF3A :\ &41 -- Poll Transmit DEFW LE3E8 :\ &42 -- Open Receive Block DEFW LE3D9 :\ &43 -- Poll Receive DEFW LE3D3 :\ &44 -- Delete Receive Block DEFW LE3FA :\ &45 -- Read Argument Block DEFW LE3CD :\ &46 -- Read/Write NetFS info (OSWORD &13) DEFW LEDF4 :\ &47 -- Make NetFS_Op call DEFW LE400 :\ &48 -- OSCLI DEFW LE3F5 :\ &49 -- ROFF DEFW LE064 :\ &4A -- Return ZNOS version string DEFW LEF6D :\ &4B -- Delete all receive blocks DEFW LE079 :\ &4C -- Unsupported DEFW LE079 :\ &4D -- Unsupported DEFW LE079 :\ &4E -- Unsupported DEFW LE079 :\ &4F -- Unsupported DEFW LE079 :\ &50 -- Unsupported DEFW LE079 :\ &51 -- Unsupported DEFW LE079 :\ &52 -- Unsupported DEFW LE079 :\ &53 -- Unsupported DEFW LE079 :\ &54 -- Unsupported DEFW LE079 :\ &55 -- Unsupported DEFW LE079 :\ &56 -- Unsupported DEFW LE079 :\ &57 -- Unsupported DEFW LE56B :\ &58 -- FCB DEFW LE558 :\ &59 - Save file DEFW LE362 :\ &5A -- Load file .LE106:DEFB &21 .LE107:DEFW &0000 :\ DMA Address .LE109:DEFW &0000 :\ Stack pointer store .LE10B:DEFB &00 NOP :\ Internal stack NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP \ Top of internal stack \ ----------------------------- \ BDOS call &01 - Console Input \ ----------------------------- .LE15B CALL LE2E0 :\ Get character from console CALL LE306:JR Z,LE15B :\ Check and loop until not Ctrl-P PUSH AF LD E,A:CALL LE16A :\ Echo to Console POP AF:RET :\ Return character in A \ ------------------------------ \ BDOS call &02 - Console Output \ ------------------------------ .LE16A CALL LE2EC CP &13 JR NZ,LE177 CALL LE2E5 :\ Set typeahead character to zero JP LE2E0 .LE177 LD A,E CP &09 JR NZ,LE189 .LE17C LD A,&20 CALL LE197 LD A,(LE313) AND &07 JR NZ,LE17C RET .LE189 CP &08 JR NZ,LE197 CALL LE197 LD A,&20 CALL LE197 LD A,&08 .LE197 LD C,A PUSH BC CALL &F20C POP BC LD A,(LE314 OR A PUSH BC CALL NZ,&F20F POP BC LD A,C CP &0D JR Z,LE1C8 CP &08 JR Z,LE1B6 CP &20 RET C CP &7F JR NZ,LE1C0 .LE1B6 LD A,(LE313 OR A RET Z DEC A LD (LE313),A RET .LE1C0 LD A,(LE313 INC A LD (LE313),A RET .LE1C8 SUB A,A LD (LE313),A RET \ ---------------------------- \ BDOS call &03 - Reader Input \ ---------------------------- .LE1CD JP &F215 :\ Jump to BIOS_ReaderInput \ --------------------------- \ BDOS call &04 - Punch Input \ --------------------------- .LE1D0 JP &F212 :\ Jump to BIOS_PunchInput \ ---------------------------- \ BDOS call &05 - Punch Output \ ---------------------------- .LE1D3 JP &F20F :\ Jump to BIOS_PunchOutput \ ------------------------------------- \ BDOS call &06 - Direct Console Output \ ------------------------------------- .LE1D6 INC E:JP NZ,&F20C :\ If E<>&FF, jump to BIOS_ConOut CALL LE2EC JP LE2E5 :\ Jump to set typeahead to zero \ ---------------------------- \ BDOS call &07 - Get I/O Byte \ ---------------------------- .LE1E0 LD A,(&0003):RET :\ Get I/O Byte and return \ ---------------------------- \ BDOS call &08 - Set I/O Byte \ ---------------------------- .LE1E4 LD A,E:LD (&0003),A :\ Set I/O Byte RET \ ----------------------------- \ BDOS call &09 - Output String \ ----------------------------- .LE1E9 LD A,(DE) CP &24 RET Z CALL LE2B1 INC DE JR LE1E9 LD A,(LE313 LD (LE316),A LD H,D LD L,E LD B,(HL) INC HL LD (HL),&00 INC DE INC DE .LE201 CALL LE2E0 CP &7F JR Z,LE252 CP &08 JR Z,LE252 CP &18 JR Z,LE24D CP &15 JR Z,LE233 CALL LE306 JR Z,LE201 CALL LE28A CP &03 JR NZ,LE227 LD C,A LD A,(HL) OR A JP Z,&0000 LD A,C .LE227 CP &0D RET Z CP &0A RET Z LD (DE),A INC (HL) INC DE DJNZ LE201 RET .LE233 LD A,&23 CALL LE28A CALL LE27D CALL LE26D PUSH BC LD A,(LE316) LD B,A LD A,&20 .LE245 CALL LE2B1 DJNZ LE245 POP BC JR LE201 .LE24D CALL LE26D JR LE259 .LE252 LD A,(HL) OR A JR Z,LE201 INC B DEC DE DEC (HL) .LE259 CALL LE2BE LD B,A LD A,(LE313 SUB A,B JR Z,LE201 LD B,A LD A,&08 .LE266 CALL LE28A DJNZ LE266 JR LE201 .LE26D LD A,B ADD A,(HL) LD B,A LD D,H LD E,L INC DE LD (HL),&00 RET CALL LE2EC RET Z LD A,&FF RET .LE27D PUSH AF LD A,&0D CALL LE28A LD A,&0A CALL LE28A POP AF RET .LE28A CP &20 JR NC,LE2B1 CP &09 JR Z,LE2B1 CP &0A JR Z,LE2B1 CP &0D JR Z,LE2B1 CP &10 JR Z,LE2B1 CP &08 JR Z,LE2B1 PUSH AF LD A,&5E CALL LE2B1 POP AF PUSH AF OR &40 CALL LE2B1 POP AF RET .LE2B1 PUSH AF PUSH BC PUSH DE PUSH HL LD E,A CALL LE16A POP HL POP DE POP BC POP AF RET .LE2BE LD A,(HL) OR A LD A,(LE316 RET Z PUSH BC PUSH HL LD B,(HL) LD C,A .LE2C8 INC HL LD A,(HL) INC C CP &20 JR NC,LE2DA INC C CP &09 JR NZ,LE2DA LD A,&06 ADD A,C AND &F8 LD C,A .LE2DA DJNZ LE2C8 LD A,C POP HL POP BC RET \ --------------------------------------- \ Get character from typeahead or console \ --------------------------------------- .LE2E0 CALL LE2EC:JR Z,LE2E0 :\ Loop until character returned .LE2E5 PUSH AF SUB A,A:LD (LE315),A :\ Set typeahead character to zero POP AF:RET :\ Return character .LE2EC PUSH BC:PUSH DE:PUSH HL :\ Save registers LD A,(LE315) :\ Get typeahead character OR A:JR NZ,LE302 :\ Nonzero, return it CALL &F206 :\ Get Console Status OR A:JR Z,LE302 :\ Nothing waiting, exit CALL &F209 :\ Get character from console LD (LE315),A:OR A :\ Set as typeahead character .LE302 POP HL:POP DE:POP BC :\ Restore registers RET \ Toggle Ctrl-P flag .LE306 CP &10:RET NZ :\ Exit if not Ctrl-P PUSH AF:LD A,(LE314) :\ Get Ctrl-P flag CPL:LD (LE314),A:POP AF :\ Toggle it RET .LE313:NOP .LE314:NOP :\ Ctrl-P flag .LE315:NOP :\ Typeahead character .LE316:NOP .LE317 SUB A,A LD L,A LD H,A LD (LF168),HL JP LE950 \ Abort with error .LE320 LD SP,&0080 :\ Reset stack PUSH HL :\ Save error pointer CALL LEF19 :\ Print inline text DEFB 13:DEFB 10:DEFM "JNOS error: " NOP POP HL :\ Get error pointer back LD B,&0D CALL LEF10 :\ Print message until CALL LEF20 :\ Print CR,LF JP &0000 :\ Jump to Warm Restart : .LE342 ADD A,ASC"A" :\ Convert to drive letter CALL LEF2B :\ Print it LD A,ASC"}" CALL LEF2B :\ Print it JP &0000 :\ Jump to Warm Restart .LE34F PUSH IX POP HL LD B,A LD A,(HL) CALL LEEF7 LD (HL),A LD A,B CALL LE4C8 :\ Set up error handler CALL OSGBPB JP LE4F4 :\ Restore error handler, and return OK \ ------------------------------- \ ZNOS call &5A - Load whole file \ ------------------------------- \ On entry, DE =>FCB \ DMA=address to load to \ On exit, A =&00 loaded ok \ HL =address after end of file \ A =&FF file not found .LE362 LD HL,LF108 :\ HL=>filename LD (LF11C),HL :\ Store in OSFILE block EX DE,HL CALL LED7E :\ Convert filename LD HL,(LE107) :\ Get DMA address LD (LF11E),HL :\ Load.Lo=supplied address LD HL,&0000 LD (LF120),HL :\ Load.Hi=&0000 LD (LF122),HL :\ Exec.Lo=&0000 - load to supplied address LD HL,LF11C :\ HL=>OSFILE block CALL LE38C :\ Load file INC A :\ &00->&01 CP &01:RET Z :\ Return if file loaded ok SUB A,&D7 JP NZ,LE320 :\ If not FileNotFound, abort with error DEC A:RET :\ Return A=&FF, file not found .LE38C CALL LE4C8 :\ Set up error handler LD A,&FF :\ &FF=Load CALL OSFILE :\ Load file .LE394 LD HL,(LF126) :\ Get file length LD DE,(LE107) :\ Get DMA address ADD HL,DE :\ HL=start+length = end address JP LE4F4 :\ Restore error handler, return HL=end, A=0 .LE39F LD B,(HL) .LE3A0 LD (HL),B LD A,&10 CALL OSWORD LD A,(HL) OR A JR Z,LE3A0 RET .LE3AB LD A,&32 CALL OSBYTE LD A,L OR A SCF RET M OR A BIT 6,A RET NZ SET 7,A RET : \ Read station number \ ------------------- .LE3BB LD DE,LF15E :\ DE=>workspace LD A,&08:LD (DE),A :\ X%?0=8 INC DE XOR A:LD (DE),A :\ X%?1=0 DEC DE:CALL LE3CD :\ Call OSWORD &13 LD A,(LF15F) :\ Get station number OR A:RET :\ Return Z=no NetFS .LE3CD EX DE,HL:LD A,&13:JP OSWORD .LE3D3 LD L,E:LD A,&34:JP OSBYTE .LE3D9 LD L,E LD A,&33 CALL OSBYTE LD A,L OR A SCF RET Z SRA A RLA CCF RET .LE3E8 EX DE,HL INC HL LD (HL),&7F DEC HL LD A,&11 CALL OSWORD LD A,(HL) OR A RET .LE3F5 LD A,&35:JP OSBYTE :\ Do ROFF, disconnect remote connection .LE3FA EX DE,HL LD A,&12 JP OSWORD \ ----------------------------------------------- \ ZNOS call &48 - Make non-intercepted OSCLI call \ ----------------------------------------------- \ On entry, DE =>command line \ On exit, A =&00 ok, <>&00 error .LE400 LD A,&05:CALL LE495 :\ Ensure NetFS selected CALL LE4C8 :\ Set up error handler EX DE,HL:CALL LE46A :\ Call MOS OSCLI JP LE4F4 :\ Restore error handler, return OK \ Veneer to OSCLI \ --------------- .LE40F PUSH AF:CALL LE461 :\ Remove OSCLI intercept LD A,(LF160):CALL LE495 :\ Ensure current filing system selected LD (LF164),SP:LD SP,&FF80 :\ Save current SP, point to temporary stack PUSH HL LD HL,(&FFFA):LD (LF162),HL :\ Save BRKV LD HL,LE44B:LD (&FFFA),HL :\ Point BRKV to error handler POP HL:CALL LE46A :\ Call original OSCLI LD SP,(LF164) :\ Restore stack CALL LE458 :\ Set up OSCLI intercept CALL LE4F4 :\ Restore error handler CALL LE440 :\ Read current filing system POP AF:RET .LE440 PUSH HL:CALL LE4FE :\ Find current filing system LD H,A:LD L,A :\ H=L=filing system LD (LF160),HL :\ Set filing system number POP HL:RET .LE44B CALL LE458 CALL LE4F4 :\ Restore error handler CALL LE440 LD HL,(&FFFA) JP (HL) .LE458 PUSH HL LD HL,LE40F LD (OSCLI+1),HL POP HL RET .LE461 PUSH HL:LD HL,(LE46E+1) LD (OSCLI+1),HL POP HL:RET .LE46A XOR A:LD (LF1E1),A .LE46E JP &0000 :\ Redirected to OSCLI .LE471 LD HL,(OSCLI+1) :\ Save current OSCLI handler LD (LE46E+1),HL CALL LE458 :\ Intercept OSCLI LD HL,&0505 LD (LF160),HL :\ Set current filing system LD L,&12:LD A,&8F JP OSBYTE :\ Select NetFS via Service Call .LE487 PUSH AF CP &10 LD A,&05 JR Z,LE490 LD A,&04 .LE490 CALL LE495 POP AF RET \ ----------------------------- \ Ensure filing system selected \ A=fsid to ensure \ ----------------------------- .LE495 PUSH HL:LD H,A :\ Save HL and save fsid in H CALL LE4FE :\ Get current filing system CP H:JR Z,LE4C6 :\ Filing system already selected, exit LD A,H:CP &04:JR C,LE4AB :\ TAPE and ROM use a different selection method LD L,&12:LD A,&8F:CALL OSBYTE :\ Select filing system JR LE4C6 :\ Jump to restore HL and return \ ------------------------- \ Select FS<4, TAPE and ROM \ ------------------------- .LE4AB OR A:JR Z,LE4C6 :\ fsid=0, nothing to do, return HL and exit CP &03:JR NZ,LE4B9 :\ Not ROM, jump forward to check for TAPE LD A,&8D:CALL OSBYTE :\ Select ROM filing system JR LE4C6 :\ Restore HL and return \ ----------- \ Select TAPE \ ----------- .LE4B9 LD L,&03 :\ Prepare for TAPE3 CP &02:JR Z,LE4C1 :\ fsid=2, jump to select TAPE3 LD L,&00 :\ fsid=1, prepare for TAPE/TAPE12 .LE4C1 LD A,&8C:CALL OSBYTE :\ Select TAPE filing system .LE4C6 POP HL:RET :\ Restore HL and return \ Set up error handler \ -------------------- .LE4C8 LD (LF164),SP:PUSH HL :\ Save SP LD HL,(&FFFA):LD (LF162),HL :\ Save BRKV LD HL,LE4DB:LD (&FFFA),HL :\ Point BRKV to LE4DB POP HL:RET \ Error handler \ ------------- .LE4DB LD SP,(LF164):POP HL :\ Restore SP LD HL,(&FF82):PUSH HL :\ Get FAULT, pointer to error INC HL:SUB A,A :\ Step past error number LD BC,&FFFF:CPIR :\ Find zero terminator DEC HL:LD (HL),&0D :\ Replace with terminator POP HL:LD A,(HL):INC HL :\ Get error number, point to text OR A:JR LE4F5 :\ Set Z if error=0 \ Restore previous error handler \ ------------------------------ .LE4F4 XOR A :\ Force error to zero .LE4F5 PUSH HL LD HL,(LF162):LD (&FFFA),HL :\ Restore BRKV POP HL:RET :\ Return, HL=>error text, A=ERR, Z=(ERR=0) \ ------------------------- \ Get current filing system \ ------------------------- .LE4FE PUSH DE:XOR A:LD E,A :\ Save DE, set A=E=0 CALL OSARGS:POP DE:RET :\ Get current FS, restore DE, return .LE506 LD A,&03 .LE508 RET .LE509 LD C,D INC BC \ Version string \ -------------- .LE50B DEFM "SJ Econet ver 3.4Az$" .LE51F CP &1E JP Z,LEBB9 :\ Get file attributes CP &21 JR C,LE52A SUB A,&09 .LE52A SUB A,&0F LD HL,LE533 :\ =>dispatch table CALL LE54D JP (HL) \ Dispatch table .LE533 INC B RST &20 POP BC JP (HL) LD H,&EA SUB A,L JP PE,LECE3 LD (HL),L PUSH HL LD H,D PUSH HL JR LE52A DEC DE CALL PE,LE570 LD E,L PUSH HL LD H,H RET PE CP (HL) DEFB &E6 .LE54D ADD A,A:ADD A,L:LD L,A :\ HL=HL+A*2 - index into table JR NC,LE553:INC H .LE553 LD A,(HL):INC HL :\ Get low byte LD H,(HL):LD L,A :\ Get high byte RET \ ------------------------------- \ ZNOS call &59 - Save whole file \ ------------------------------- \ On entry, IX =number of 128-byte blocks \ DE =>FCB \ DMA=address to save from \ On exit, A =&00 loaded ok \ HL =address after end of file \ A =&FF file not found .LE558 PUSH IX:POP HL :\ HL=size to save JR LE565 : .LE55D CALL LE6E3 JR LE567 LD HL,&0001 : .LE565 LD B,&01 .LE567 LD A,&01 JR LE57C : \ ------------- \ ZNOS call &58 \ ------------- .LE56B PUSH IX:POP HL JR LE578 .LE570 CALL LE6E3 JR LE57A LD HL,&0001 .LE578 LD B,&01 .LE57A LD A,&03 : .LE57C PUSH IX PUSH IY PUSH DE:POP IY :\ IY=>FCB PUSH AF PUSH HL LD C,A LD A,&01 LD (LF0B8),A JR LE5AF : .LE58D RES 7,(IY+6) LD A,C CP &03 JR NZ,LE59A SET 7,(IY+6) .LE59A PUSH BC PUSH DE LD A,(LF0B8 DEC A LD (LF0B8,A JR Z,LE5AA CALL LEA05 POP DE PUSH DE .LE5AA CALL LE71C POP DE POP BC .LE5AF LD A,(IY+16) INC A JR Z,LE58D LD L,(IY+19) LD H,(IY+20) INC HL LD (LF0B9),HL INC HL LD A,(HL) CP (IY+21) JR NZ,LE58D INC HL LD A,(HL) CP (IY+22) JR NZ,LE58D LD HL,(LF0B9 LD A,(HL) OR A CALL NZ,LE981 LD A,C CP &01 JR NZ,LE5EA PUSH HL POP IX BIT 7,(IX+8) JR Z,LE5EA DEC HL LD A,(HL) CALL LEA1C JR LE58D .LE5EA POP HL POP AF ADD HL,HL SRL L LD (LF0BC,A LD IX,LF0C4 LD A,B LD (LF0BB,A SUB A,A LD (LF0BD,A LD A,L OR H JP Z,LE6B9 LD A,L ADD A,(IY+32) LD E,A RES 7,E RLCA LD A,H ADC A,(IY+12) LD D,A LD A,(IY+18) CP D JR C,LE61E JR NZ,LE638 LD A,(IY+17) CP E JR NC,LE638 .LE61E LD A,(LF0BC CP &03 JR Z,LE62D LD (IY+18),D LD (IY+17),E JR LE638 .LE62D LD D,(IY+18) LD E,(IY+17) LD A,&01 LD (LF0BD,A .LE638 LD HL,LF0C4 LD B,&0D .LE63D LD (HL),&00 INC HL DJNZ LE63D LD L,(IY+32) LD A,(IY+12) SLA L ADC A,&00 LD H,A SRL H RR L PUSH HL SRL H RR L RR (IX+9) LD (LF0CE,HL LD HL,(LE107 LD (LF0C5,HL POP HL PUSH DE SLA E SRL D RR E EX DE,HL SCF SBC HL,DE LD A,&01 POP DE JR C,LE6B9 INC HL SRL H RR L RR (IX+5) LD (LF0CA,HL LD A,(IY+16) LD (IX+0),A LD A,(LF0BC PUSH DE CALL LE34F POP DE OR A JR Z,LE6A0 CP &C6 JP NZ,LE320 PUSH IY POP DE CALL LE9C1 LD A,&01 JR LE6B9 .LE6A0 LD A,(LF0BB OR A JR Z,LE6B6 LD A,E OR A JR NZ,LE6B0 OR D JR Z,LE6B0 LD E,&80 DEC D .LE6B0 LD (IY+32),E LD (IY+12),D .LE6B6 LD A,(LF0BD .LE6B9 POP IY POP IX RET PUSH IX PUSH DE POP IX LD L,(IX+32) LD H,(IX+12) SLA L LD A,L OR H JR Z,LE6D0 DEC HL .LE6D0 SRL H RR L LD (IX+33),L LD (IX+34),H LD (IX+35),&00 POP IX LD A,&FF .LE6E2 RET .LE6E3 PUSH IX PUSH DE POP IX LD L,(IX+33) LD H,(IX+34) ADD HL,HL SRL L LD (IX+32),L LD (IX+12),H POP IX LD HL,&0001 LD B,&00 RET .LE6FF DEFM "CDIR " \ ------------------------- \ BDOS call &0F - Open File \ ------------------------- .LE704 PUSH IX:PUSH IY:PUSH DE :\ Save registers CALL LE889 POP IY :\ Get FCB to IY LD (IY+16),&FF :\ Set first alloc byte to &FF JP NZ,LE839 :\ If ok, set FCB and return JP LE85F :\ Restore registers and return \ ------------------------- \ BDOS call &16 - Make file \ ------------------------- .LE718 LD B,&00:JR LE71E .LE71C LD B,&01 .LE71E PUSH IX PUSH IY LD (LF0B8),DE PUSH DE POP IY LD IX,LF0BF LD (IX+3),&06 LD (IX+7),B CALL LE8AE JP C,LE7EF LD A,(IY+6) RLCA AND &01 LD (IX+8),A SUB A,A LD (LF0BB,A LD HL,LF0C8 EX DE,HL LD C,&07 CALL LED7E LD (IX+1),C .LE753 SUB A,A LD (LF0BE),A CALL LE8E4 .LE75A LD A,&FF LD (LF166),A LD IX,LF0BF LD IY,LF0DF CALL LEDDD LD (LF0BA),A OR A JR Z,LE7E5 CP &C0 JR Z,LE78A CP &C2 JR Z,LE78A SUB A,&D6 OR (IX+7) JR NZ,LE7CA LD A,(LF0BB OR A JR Z,LE79B LD A,&02 JP LE342 .LE78A LD A,(LF0BE) OR A JP NZ,LE320 CALL LEA05 LD A,&FF LD (LF0BE),A JR LE75A .LE79B LD A,&FF LD (LF0BB),A LD B,&04 LD DE,LF0C8 LD HL,LF0D9 .LE7A8 LD A,(DE) INC HL INC DE CP &2E JR Z,LE7B7 LD (HL),A DJNZ LE7A8 LD A,&01 JP LE342 .LE7B7 LD (HL),&0D LD DE,LF0D5 PUSH DE CALL LE8A5 POP DE CALL LE400 LD (LF0BA),A OR A JR Z,LE753 .LE7CA LD A,(LF0BA) BIT 0,(IX+7) JR Z,LE7DD CP &D6 .LE7D5 JP NZ,LE320 LD A,&FF JP LE85F .LE7DD CP &C6 JR Z,LE7D5 CP &B3 JR LE7D5 .LE7E5 LD A,(LF0E1) LD DE,(LF0B8) CALL LE90E .LE7EF LD IX,(LF0B8) LD D,B LD B,&10 .LE7F6 LD (IX+16),&00 INC IX DJNZ LE7F6 LD (IX+0),A LD (IX+3),L LD (IX+4),H LD (IX+5),C LD (IX+6),D LD IX,LF0BF LD (IX+1),&07 LD (IX+3),&0C LD (IX+7),A LD (IX+8),&01 LD IY,LF0DF CALL LEDDD OR A JR Z,LE82F LD A,&03 JP LE342 .LE82F LD IY,(LF0B8) LD A,(LF0E1) LD HL,(LF0E2) \ IY=>FCB .LE839 LD BC,&0000 ADD A,&7F ADC HL,BC RLCA ADC HL,HL SLA L RL H SRL L LD (IY+17),L:LD (IY+18),H :\ Put HL in Alloc 1,2 LD (IY+0),&10 :\ Set Drive to &10 LD A,(IY+12) :\ Get EX CP H:JR Z,LE85B LD L,&80 .LE85B LD (IY+15),L :\ Set RC SUB A,A :\ Return A=0 - OK .LE85F POP IY:POP IX:RET :\ Restore registers and return \ --------------------------------- \ BDOS call &23 - Compute File Size \ --------------------------------- .LE864 PUSH IX:PUSH IY:PUSH DE POP IX:CALL LE889 JR Z,LE884 ADD A,&7F RLCA ADC HL,HL LD (IX+35),&00 RL (IX+35) LD (IX+34),H LD (IX+33),L SUB A,A .LE884 POP IX POP IY RET \ called by Open File and Compute File Size \ DE=>FCB .LE889 EX DE,HL :\ HL=>FCB LD A,&05:LD IY,LF0DF :\ IY=>workspace CALL LEC9E :\ ReadInfo5 - Get object info LD A,&FF:RET Z :\ XOR (IY+14):BIT 5,A :\ Is S2 bit5 set? LD A,&FF:RET Z :\ If S2 bit5 set, return Z, &FF, not found LD A,(LF0EA) :\ Get ?? LD HL,(LF0EB) RET .LE8A5 LD HL,LE6FF LD BC,&0005 LDIR RET .LE8AE LD HL,LF16A LD C,&05 .LE8B3 PUSH DE PUSH HL LD A,(HL) INC A JR Z,LE8D9 INC HL INC HL LD A,(HL) LD (LF0BC,A INC HL LD A,(HL) LD (LF0BD,A LD B,&0B .LE8C6 INC HL INC DE LD A,(DE) XOR (HL) AND &7F JR NZ,LE8D9 DJNZ LE8C6 POP HL POP DE SCF LD BC,(LF0BC LD A,(HL) RET .LE8D9 LD DE,&000F POP HL ADD HL,DE POP DE DEC C JR NZ,LE8B3 SUB A,A RET .LE8E4 CALL LE98E PUSH AF PUSH BC PUSH DE PUSH HL LD B,&05 LD DE,&000F LD HL,LF16B LD A,&04 .LE8F5 BIT 7,(HL) JR NZ,LE909 CP (HL) JR Z,LE904 ADD HL,DE DJNZ LE8F5 LD A,&04 JP LE342 .LE904 DEC HL LD A,(HL) CALL LEA1C .LE909 POP HL POP DE POP BC POP AF RET .LE90E CALL LE98E PUSH AF PUSH DE .LE913 LD B,&05 LD DE,&000F LD HL,LF16B .LE91B BIT 7,(HL) JR NZ,LE92C ADD HL,DE DJNZ LE91B CALL LE950 LD A,&FF LD (LF166,A JR LE913 .LE92C POP DE POP AF INC DE DEC HL PUSH HL LD (HL),A INC HL CALL LE96A LD (HL),&00 INC HL LD BC,(LF168 INC BC LD (LF168,BC PUSH BC LD (HL),C INC HL LD (HL),B INC HL EX DE,HL LD BC,&000B LDIR POP BC POP HL RET : .LE950 PUSH BC PUSH HL PUSH AF SUB A,A LD (LF166),A LD A,&40 LD (LF167),A POP AF LD B,&4B LD HL,LF16A .LE962 LD (HL),&FF INC HL DJNZ LE962 POP HL POP BC RET : .LE96A PUSH BC PUSH DE PUSH HL LD DE,&000F LD HL,LF16B LD B,&05 .LE975 BIT 7,(HL) JR NZ,LE97A INC (HL) .LE97A ADD HL,DE DJNZ LE975 POP HL POP DE POP BC RET .LE981 CALL LE96A LD (HL),&00 LD A,(LF167 DEC A LD (LF167,A RET P .LE98E PUSH AF PUSH BC PUSH DE PUSH HL LD A,&40 LD (LF167,A LD A,&FF LD C,A .LE99A INC C .LE99B LD B,&05 LD HL,LF16B INC A LD E,&00 .LE9A3 CP A BIT 7,(HL) JR NZ,LE9AE CP (HL) JR NZ,LE9AE LD (HL),C JR LE99A .LE9AE RL E PUSH DE LD DE,&000F ADD HL,DE POP DE DJNZ LE9A3 DEC E INC E JR NZ,LE99B POP HL POP DE POP BC POP AF RET .LE9C1 PUSH HL PUSH IX PUSH IY PUSH DE POP IY LD A,(IY+16) LD (LF10F,A INC A JR Z,LE9FF CALL LE8AE JR NC,LE9FF LD (IY+16),&FF .LE9DB LD A,&FF LD (HL),A INC HL LD (HL),A INC HL .LE9E1 LD (HL),A INC HL LD (HL),A CALL LE98E .LE9E7 LD IX,LF108 LD (IX+1),&06 LD (IX+3),&07 LD IY,LF110 PUSH DE CALL LEDDD POP DE JP NZ,LE320 .LE9FF POP IY POP IX POP HL RET \ Warm Start warning \ ------------------ .LEA05 LD A,(LF166) OR A:RET Z :\ Return if zero CALL LE950 :\ Reset some workspace PUSH HL PUSH IX PUSH IY SUB A,A LD (LF10F),A JR LE9E7 .LEA18 CALL LE8AE RET NC .LEA1C PUSH HL PUSH IX PUSH IY LD (LF10F,A JR LE9DB \ -------------------------------- \ BDOS call &11 - Search For First \ -------------------------------- .LEA26 CALL LED70 :\ Check if any '?' in filename JR NC,LEA60 :\ Ambiguous filename, jump to... PUSH IY:PUSH HL LD A,&FF LD (LF1B7),A LD A,&05 LD IY,LF108 CALL LEC9E POP DE CPL JR Z,LEA5D LD HL,(LE107) :\ Get DMA address LD (HL),&00 EX DE,HL INC HL INC DE LD BC,&000B LDIR LD C,(IY+14) LD A,(IY+11) LD L,(IY+12) LD H,(IY+13) CALL LEBDB SUB A,A .LEA5D POP IY RET \ Search for First with ambiguous filename \ ---------------------------------------- .LEA60 LD (LF1B5),HL :\ Save pointer to filename in FCB LD D,H:LD E,L :\ DE=>FCB LD BC,9:ADD HL,BC :\ HL=>extension EX DE,HL:LD B,&03 :\ DE=>extension, B=3 for three characters .LEA6C LD A,(DE):INC DE :\ Get character from extension CP &3F:JR Z,LEA86 :\ If '?', jump... DJNZ LEA6C :\ Loop for three characters PUSH HL:CALL LEBAD :\ Copy a control block to &F1C3 POP HL:LD DE,LF1CD :\ DE=>filename in control block CALL LED9F :\ Copy ext.filename to control block LD A,&0D:LD (DE),A :\ Put terminating in LD A,&02:JR LEA92 :\ Continue into SearchNext \ Ambiguous extension \ ------------------- .LEA86 LD HL,LEC0D :\ Copy NetFS_Examine control block to &F1B8 LD DE,LF1B8 LD BC,&000B LDIR SUB A,A :\ Set flag to &00 .LEA92 LD (LF1B7),A \ 0 - SearchFirst with ambiguous extension \ 2 - SearchFirst with ambiguous filename \ Search For Next .LEA95 LD A,(LF1B7) :\ Get flag OR A:RET M :\ Return if b7 set PUSH IX:PUSH IY :\ Save registers .LEA9E LD A,(LF1B7) OR A:JR NZ,LEB04 :\ Jump if not ambiguous extension .LEAA4 LD A,(LF1B7) CP &02:JP Z,LEBA6 :\ Jump for ambiguous filename \ Ambiguous extension \ ------------------- LD IX,LF1B8:LD IY,LF108 :\ IX=>control block, IY=? CALL LEDDD OR A:JP NZ,LE320 INC (IX+8) LD A,(IY+2) OR A JP Z,LEBA6 BIT 5,(IY+22) JR NZ,LEAE8 LD HL,LF10C LD DE,(LE107) :\ DMA Address SUB A,A LD (DE),A INC DE LD BC,&0008 LDIR LD A,(HL) CP &20 JR NZ,LEAA4 LD B,&03 .LEAE1 LD (DE),A INC DE DJNZ LEAE1 SUB A,A JR LEB51 .LEAE8 CALL LEBAD LD HL,LF1CD LD DE,LF10C LD B,&03 .LEAF3 LD (HL),&0D LD A,(DE) CP &20 JR Z,LEB04 LD (HL),A INC HL INC DE DJNZ LEAF3 LD A,(DE) CP &20 JR NZ,LEAA4 .LEB04 LD IX,LF1C3 LD (IX+1),&0C LD IY,LF108 CALL LEDDD CP &D6 JP Z,LEBA6 OR A JP NZ,LE320 INC (IX+8) LD A,(IY+2) OR A JP Z,LEAA4 BIT 5,(IY+22) JR NZ,LEB04 LD HL,LF10C LD DE,(LE107 SUB A,A LD (DE),A INC DE LD BC,&0008 LDIR LD A,(HL) CP &20 JR NZ,LEB04 LD HL,LF1CD LD BC,&0003 LDIR LD A,(LF1B7 CP &02 JR Z,LEB51 LD A,&01 .LEB51 LD (LF1B7,A EX DE,HL LD (HL),&00 LD B,&0B LD HL,(LE107 .LEB5C INC HL LD A,(HL) LD C,A AND &5F CP &41 JR C,LEB6A CP &5B JR NC,LEB6A LD (HL),A .LEB6A LD A,C CP &21 JR NZ,LEB71 LD (HL),&24 .LEB71 CP &0D JR Z,LEB79 DJNZ LEB5C JR LEB7E .LEB79 LD (HL),&20 INC HL DJNZ LEB79 .LEB7E LD HL,(LE107 LD DE,(LF1B5 LD B,&0B .LEB87 INC HL INC DE LD A,(DE) CP &3F JR Z,LEB92 CP (HL) JP NZ,LEA9E .LEB92 DJNZ LEB87 LD L,(IY+29) LD H,(IY+30) LD A,(IY+28) LD C,(IY+22) CALL LEBDB SUB A,A JR LEBA8 .LEBA6 LD A,&FF .LEBA8 POP IY POP IX RET \ Copy a control block .LEBAD LD HL,LEC0D LD DE,LF1C3 LD BC,&000E LDIR RET \ Get File Attributes \ ------------------- .LEBB9 PUSH IX PUSH DE POP IX EX DE,HL LD A,&0D BIT 7,(IX+9) JR Z,LEBC9 LD A,&15 .LEBC9 LD (LF110,A LD IX,LF108 LD C,&07 LD A,&04 CALL LEC92 POP IX CPL RET .LEBDB PUSH IX LD IX,(LE107 LD B,&10 .LEBE3 RES 7,(IX+0) LD (IX+16),&00 INC IX DJNZ LEBE3 BIT 3,C JR NZ,LEBF7 SET 7,(IX-7) .LEBF7 LD BC,&0000 ADD A,&7F ADC HL,BC RLCA ADC HL,HL ADD HL,HL SRL L LD (IX-4),H LD (IX-1),L POP IX RET \ Control block to do NetFS_Examine \ --------------------------------- .LEC0D EQUB &00:EQUB &09:EQUB &00:EQUB &03 :\ Size=9, Function=Examine EQUB &00:EQUB &00:EQUB &00 :\ Space for context DEFB &00 :\ ARG DEFB &00 :\ Index DEFB &01 :\ Number DEFB &0D :\ Directory name DEFB &00 DEFB &00:DEFB &0D .LEC1B LD (LF0B8),DE PUSH DE CALL LEA18 LD HL,LECDC LD DE,LF0BC LD BC,&0007 LDIR POP HL PUSH HL CALL LED7E LD A,&20 LD (DE),A INC DE LD (LF0BA,DE POP HL LD BC,&0010 ADD HL,BC CALL LED7E .LEC43 LD DE,LF0BC CALL LE400 OR A RET Z CP &C4 JR Z,LEC69 CP &D6 JP NZ,LE320 LD DE,LF0DD CALL LE8A5 LD HL,(LF0BA .LEC5D LD A,(HL) LD (DE),A CP &2E JR Z,LEC6C INC HL INC DE CP &0D JR NZ,LEC5D .LEC69 LD A,&FF RET .LEC6C LD A,&0D LD (DE),A LD HL,(LF0B8 CALL LEC84 JR Z,LEC69 LD DE,LF0DD CALL LE400 OR A JP NZ,LE320 JP LEC43 .LEC84 PUSH IY LD IY,LF0A9 LD A,&04 CALL LEC9E POP IY RET .LEC92 LD B,&13 PUSH IX PUSH IY LD IY,LF0A9 JR LECAA \ Called by Open File \ HL=>FCB, A=Arg .LEC9E LD B,&12:LD C,&06 :\ &12=ReadInfo, &06=offset to filename-2 PUSH IX:PUSH IY LD IX,LF090 .LECAA LD (IX+0),&00 :\ Net_FSOp LD (IX+3),B :\ Function LD (IX+7),A :\ Arg EX DE,HL :\ DE=>FCB LD B,&00 :\ Set BC to &00xx PUSH IX:POP HL :\ HL=>Net_FSOp control block ADD HL,BC :\ HL=>Net_FSOp control block+num INC HL:INC HL :\ Plus two more - Offset to filename EX DE,HL :\ DE=>where filename to be copied to, HL=>FCB CALL LED7E :\ Translate filename into Net_FSOp control block LD (IX+1),C :\ Store control block length CALL LEDDD CP &D6:JR NZ,LECCE SUB A,A:JR LECD6 .LECCE OR A JP NZ,LE320 SUB A,(IY+2) SBC A,A .LECD6 POP IY:POP IX:OR A:RET .LECDC LD D,D LD B,L LD C,(HL) LD B,C LD C,L LD B,L JR NZ,LECD1 LD D,E CP B RET P CALL LED70 JR NC,LED23 .LECEC PUSH IX PUSH IY EX DE,HL PUSH DE CALL LEA18 POP HL LD C,&05 LD DE,LF0C1 CALL LED7E LD IX,LF0BA LD IY,LF0D3 LD (IX+0),&00 LD (IX+1),C LD (IX+3),&14 CALL LEDDD OR A JR Z,LED1E CP &D6 JP NZ,LE320 LD A,&FF .LED1E POP IY POP IX RET .LED23 LD HL,(LE107 PUSH HL LD HL,LF0E2 LD (LE107,HL LD DE,(LF0B8 CALL LEA26 OR A JP M,LED6B .LED38 LD HL,LF0E2 CALL LECEC INC A LD A,&0A JP Z,LE342 LD A,(LF1B7 OR A JR Z,LED57 LD A,(LF1CB DEC A JP M,LED61 LD (LF1CB,A JP LED61 .LED57 LD A,(LF1C0 DEC A JP M,LED61 LD (LF1C0,A .LED61 LD DE,(LF0B8 CALL LEA95 INC A JR NZ,LED38 .LED6B POP HL LD (LE107,HL RET \ Check for '?' in filename .LED70 LD L,E:LD H,D :\ HL=DE=>FCB LD B,&0B :\ Prepare to check 11 characters .LED74 INC DE:LD A,(DE) :\ Get filename character CP &3F:JR Z,LED7D :\ Exit if '?' SCF:DJNZ LED74 :\ Loop for all characters .LED7D RET :\ Return C=no '?' found, NC='?' found \ HL=>FCB \ DE=>filename store in FSOp control block .LED7E PUSH HL:PUSH BC :\ Save regs LD BC,8:ADD HL,BC :\ HL=>extension-1 POP BC:CALL LEDAF :\ Get and convert character JR Z,LED94 :\ If space, jump forward LD B,&03:CALL LEDA9 :\ Copy up to 3 characters LD A,&2E:LD (DE),A :\ Store '.' directory seperator INC DE:INC C :\ Inc DE and counter .LED94 POP HL :\ Get HL=>FCB back LD B,&08:CALL LEDA5 :\ Store up to 8 filename characters LD A,&0D:LD (DE),A :\ Store at end INC C:RET :\ Increment count for .LED9F LD BC,&0008 ADD HL,BC LD B,&03 .LEDA5 CALL LEDAF:RET Z :\ Return if .LEDA9 LD (DE),A:INC DE:INC C :\ Store character, increment DE DJNZ LEDA5:RET :\ Loop for up to 'B' characters .LEDAF INC HL :\ Point to character LD A,(HL):AND &7F :\ Get character without b7 CP ASC".":JR Z,LEDDA :\ '.', return unchanged CP &30:JR C,LEDBF :\ <'0', check if letter CP &3A:JR C,LEDDA :\ '0'-'9', return unchanged .LEDBF CP ASC"A":JR C,LEDC7 :\ <'A', check lower case CP ASC"Z"+1:JR C,LEDDA :\ 'A'-'Z', return unchanged .LEDC7 CP ASC"a":JR C,LEDCF :\ <'a', CP ASC"z"+1:JR C,LEDDA :\ 'a'-'z', return unchanged .LEDCF CP &20:RET Z :\ If ' ', return unchanged BIT 3,A:LD A,ASC"-" :\ ()*+,-/:;<=>?[\]^_{|}~ changed to '-' JR NZ,LEDDA:LD A,ASC"!":\ !"#$%&'@` changed to '!' .LEDDA CP &20:RET \ IX=> control block \ IY=> .LEDDD XOR A:LD (IX+2),A:LD (IX+4),A :\ Set reply to zero XOR A:LD (IX+5),A:LD (IX+6),A :\ Set context to zero PUSH IX:POP HL:INC HL :\ HL=>block size LD D,(HL):INC D:INC D :\ D=block size+2 JR LEE01 :\ Jump to... .LEDF4 PUSH IX:POP HL LD A,(HL) INC HL CP &01 JP Z,LEE91 OR A RET NZ LD D,(HL) .LEE01 PUSH DE :\ Save block size LD A,(LF1E1):OR A PUSH HL CALL Z,LEECA :\ Get context and translate to bitmask POP HL:INC HL LD (LF1D7),HL LD A,(HL) OR A:JR NZ,LEE15 LD (HL),&90 .LEE15 INC HL:INC HL LD B,&03 LD DE,LF1E3 .LEE1C LD A,(HL) OR A:JR NZ,LEE22 LD A,(DE) LD (HL),A .LEE22 INC HL INC DE DJNZ LEE1C POP DE PUSH DE CALL LEE7D POP AF LD E,A LD D,&00 PUSH IX POP HL ADD HL,DE LD (LF1DB,HL LD HL,LF1D3 LD DE,&40C0 CALL LEFC6 JR C,LEE78 LD H,(IX+2) CALL LEE85 PUSH IY POP HL LD (LF1D7),HL INC H LD (LF1DB),HL LD DE,LF1D2 XOR A LD (DE),A CALL LE3E8 PUSH IX LD DE,&7530 LD IX,LF1D2 CALL LEF3A POP IX JR C,LEE78 PUSH IY POP DE LD HL,(LF1DB) SBC HL,DE LD B,L EX DE,HL INC HL LD A,(HL) INC HL OR A RET .LEE78 AND &0F OR &A0 RET .LEE7D LD HL,&9980 DEC E INC E JR Z,LEE85 INC L .LEE85 LD (LF1D3,HL CALL LEFA0 LD (LF1D5,HL JP LEEBF .LEE91 LD E,(HL) INC HL LD D,(HL) INC HL EX DE,HL LD (LF1D5,HL LD HL,&0085 LD (LF1D3,HL CALL LEEBF .LEEA2 LD A,(DE) OR A RET Z SUB A,&0D RET Z EX DE,HL LD (LF1D7,HL INC HL LD (LF1DB,HL PUSH HL LD DE,&40C0 LD HL,LF1D3 CALL LEFC6 POP DE JR NC,LEEA2 JR LEE78 .LEEBF LD HL,LF1D9 SUB A,A LD B,&08 .LEEC5 LD (HL),A INC HL DJNZ LEEC5 RET .LEECA LD HL,LF1E1:LD (HL),&FF INC HL:LD (HL),&06 EX DE,HL:CALL LE3CD :\ Read context LD HL,LF1E3 PUSH BC:PUSH HL LD B,&03 .LEEDD LD A,(HL) CALL LEF03 LD (HL),A INC HL DJNZ LEEDD POP HL POP BC RET PUSH BC PUSH HL LD B,&03 .LEEEC LD A,(HL) CALL LEEF7 LD (HL),A INC HL DJNZ LEEEC POP HL POP BC RET .LEEF7 PUSH BC LD B,&1F .LEEFA INC B RRCA JR Z,LEF00 JR NC,LEEFA .LEF00 LD A,B POP BC RET .LEF03 PUSH BC SUB A,&1F LD B,A XOR A SCF .LEF09 RLA DJNZ LEF09 POP BC RET LD B,&0D .LEF10 LD A,(HL) INC HL CP B RET Z CALL LEF2B JR LEF10 .LEF19 POP HL LD B,&00 CALL LEF10 JP (HL) .LEF20 LD A,&0D CALL LEF2B LD A,&0A JR LEF2B LD A,&20 .LEF2B PUSH AF PUSH BC PUSH DE PUSH HL LD E,A LD C,&02 CALL &0005 POP HL POP DE POP BC POP AF RET .LEF3A LD B,&19 .LEF3C PUSH BC PUSH DE LD E,(IX+0) CALL LE3D9 POP DE POP BC JR NC,LEF5C DJNZ LEF3C DEC DE LD A,D OR E JR NZ,LEF3A LD E,(IX+0) CALL LE3D3 LD A,&05 LD HL,LEF64 SCF RET .LEF5C PUSH IX POP DE CALL LE3E8 OR A RET .LEF64 LD C,(HL) LD L,A JR NZ,LEFDA LD H,L LD (HL),B LD L,H LD A,C DEC C .LEF6D LD A,E CP &04 JR NC,LEF79 LD HL,LEF7C :\ => dispatch table CALL LE54D JP (HL) .LEF79 SUB A,&02 :\ Returns A=A-2 RET \ Dispatch table .LEF7C DEFW LEF84 :\ Delete all receive blocks DEFW LEF8F :\ Returns A=(LE106) = &21 DEFW LE067 :\ Returns A=0 DEFW LE506 :\ Returns A=3 \ Delete all receive blocks .LEF84 LD E,&10 .LEF86 PUSH DE CALL LE3D3 :\ Delete receive block POP DE DEC E JR NZ,LEF86 RET .LEF8F LD A,(LE106) RET .LEF93 LD HL,(&FFFC) INC DE LD A,D OR E DEC DE RET Z LD (&FFFC),DE RET .LEFA0 LD A,&00 LD DE,LF1E6 LD (DE),A CALL LE3CD LD HL,(LF1E7 RET .LEFAD LD HL,(&0001) LD DE,LF1E9 LD BC,&000F LDIR RET .LEFB9 LD HL,(&0001) LD L,A LD E,(HL) LD (HL),C INC HL LD D,(HL) LD (HL),B RET \ ------------- \ ZNOS call &40 \ ------------- .LEFC3 PUSH IX:POP HL .LEFC6 LD C,&05 .LEFC8 PUSH BC PUSH DE PUSH HL CALL LF065 POP HL POP DE POP BC OR A RET M AND &0F JR Z,LEFED CP &03 JR Z,LEFED CP &04 JR Z,LEFED CP &09 JR NZ,LEFE8 DEC C JR Z,LEFED JR LEFEA .LEFE8 LD C,&05 .LEFEA DEC E JR NZ,LEFEF .LEFED JR LF000 .LEFEF PUSH BC LD B,D .LEFF1 LD C,&FA .LEFF3 DEC C JR NZ,LEFF3 DJNZ LEFF1 POP BC LD A,D OR A JR Z,LEFC8 INC D JR LEFC8 .LF000 AND &0F PUSH AF CP &01 JR Z,LF014 CP &05 JR NC,LF014 LD HL,LF022 CALL LE54D .LF011 POP AF SCF RET .LF014 LD HL,LF058 ADD A,&90 DAA ADC A,&40 DAA LD (LF063,A JR LF011 .LF022 INC L RET P JR C,LF016 JR C,LF018 LD B,(HL) RET P LD C,A RET P LD C,H LD L,C LD L,(HL) LD H,L JR NZ,LF09C LD H,C LD L,L LD L,L LD H,L LD H,H DEC C LD C,(HL) LD L,A LD (HL),H JR NZ,LF0A9 LD L,C LD (HL),E LD (HL),H LD H,L LD L,(HL) LD L,C LD L,(HL) LD H,A DEC C LD C,(HL) LD L,A JR NZ,LF0AD LD L,H LD L,A LD H,E LD L,E DEC C LD B,D LD H,C LD H,H JR NZ,LF0A8 LD A,B LD H,E LD H,D DEC C .LF058 LD C,(HL) LD H,L LD (HL),H JR NZ,LF0C2 LD (HL),D LD (HL),D LD L,A LD (HL),D JR NZ,LF086 .LF063 NOP DEC C .LF065 CALL LE39F .LF068 CALL LE3AB JR C,LF068 RET LD HL,LF076 RET LD HL,LF076 RET .LF076 INC D NOP INC B RRCA LD BC,&00C3 LD A,A NOP RET NZ LD (HL),H LD L,B LD H,C LD (HL),H JR NZ,LF0FF .LF086 LD L,A LD (HL),L JR NZ,LF0EE LD L,A JR NZ,LF0FB LD L,A LD (HL),H JR NZ,LF0F5 LD L,A JR NZ,LF107 LD L,A JR NZ,LF0FD LD L,A LD (HL),D JR NZ,LF10B LD (HL),D .LF09C LD L,A LD H,(HL) LD L,C LD (HL),H DEC C LD L,A LD (HL),D JR NZ,LF117 LD H,L LD L,L LD L,A .LF0A8 HALT .LF0A9 LD H,L JR NZ,LF120 LD L,B .LF0AD LD L,C LD (HL),E JR NZ,LF11E LD H,L LD (HL),E LD (HL),E LD H,C LD H,A LD H,L LD L,&0D .LF0B9 DEC C .LF0BA JR Z,LF113 .LF0BC LD H,L .LF0BD JR NZ,LF123 .LF0BF LD L,A JR NZ,LF12A .LF0C2 LD H,C HALT .LF0C4 LD H,L .LF0C5 JR NZ,LF13B LD L,A .LF0C8 JR NZ,LF12D .LF0CA LD L,B LD H,C LD (HL),D LD H,A .LF0CE LD H,L JR NZ,LF137 LD L,A LD (HL),D .LF0D3 JR NZ,LF136 .LF0D5 LD L,(HL) LD (HL),E LD (HL),A LD H,L .LF0D9 LD (HL),D LD L,C LD L,(HL) LD H,A .LF0DD DEC C LD (HL),A \ Workspace for open .LF0DF LD (HL),D LD L,C .LF0E1 LD (HL),H .LF0E2 LD (HL),H LD H,L LD L,(HL) JR NZ,LF14C LD L,(HL) LD (HL),C LD (HL),L .LF0EA LD L,C .LF0EB LD (HL),D LD L,C LD H,L .LF0EE LD (HL),E JR NZ,LF152 LD H,D LD L,A LD (HL),L LD (HL),H .LF0F5 JR NZ,LF151 LD C,(HL) LD C,A LD D,E INC L .LF0FB JR NZ,LF15E .LF0FD LD L,(HL) LD H,H .LF0FF JR NZ,LF178 LD H,L DEC C LD H,E LD H,C LD L,(HL) LD L,(HL) .LF107 LD L,A \ -------------------------- \ Filename buffer for OSFILE \ -------------------------- .LF108 LD (HL),H JR NZ,LF16C .LF10B LD L,(HL) .LF10C LD (HL),E LD (HL),A LD H,L .LF10F LD (HL),D .LF110 JR NZ,LF186 LD H,L .LF113 LD L,H LD H,L LD (HL),B LD L,B .LF117 LD L,A LD L,(HL) LD H,L JR NZ,LF18D \ -------------------- \ OSFILE Control Block \ -------------------- .LF11C LD (HL),L:LD H,L :\ =>filename .LF11E LD (HL),D:LD L,C :\ Load Address lo .LF120 LD H,L:LD (HL),E :\ Load Address hi .LF122 LD L,&29 :\ Exec Address lo DEC C:DEC C :\ Exec Address hi .LF126 LD C,C:LD H,(HL) :\ Length/Start lo JR NZ,LF1A3 :\ Length/Start hi .LF12A LD L,A:LD (HL),L :\ Attr/End lo JR NZ,LF196 :\ Attr/End hi LD H,C HALT LD H,L JR NZ,LF199 LD L,A LD (HL),L LD L,(HL) .LF136 LD H,H .LF137 JR NZ,LF1AD LD L,B LD L,C .LF13B LD (HL),E JR NZ,LF190 LD C,A LD C,L JR NZ,LF1B7 LD (HL),E LD H,L LD H,(HL) LD (HL),L LD L,H INC L DEC C LD (HL),B LD L,H LD H,L .LF14C LD H,C LD (HL),E LD H,L JR NZ,LF1C4 .LF151 LD L,B .LF152 LD L,A LD (HL),A JR NZ,LF1CF LD L,A LD (HL),L LD (HL),D JR NZ,LF1BC LD (HL),B LD (HL),B LD (HL),D : \ OSWORD 13,8 control block .LF15E LD H,L .LF15F LD H,E :\ My station number .LF160 EQUB &69 :\ Current filing system EQUB &61 :\ Current filing system .LF162 LD (HL),H LD L,C .LF164 LD L,A LD L,(HL) .LF166 JR NZ,LF1CA .LF168 LD A,C DEC C .LF16A LD (HL),E .LF16B LD H,L .LF16C LD L,(HL) LD H,H LD L,C LD L,(HL) LD H,A JR NZ,LF1D4 JR NZ,LF1D9 LD L,A LD L,(HL) LD H,C .LF178 LD (HL),H LD L,C LD L,A LD L,(HL) JR NZ,LF1F2 LD L,A LD A,(&0D0D) LD D,E LD C,D JR NZ,LF1D8 .LF186 LD H,L LD (HL),E LD H,L LD H,C LD (HL),D LD H,E LD L,B .LF18D JR NZ,LF1DB LD (HL),H .LF190 LD H,H DEC C LD SP,&3830 JR NZ,LF1E4 LD L,C LD L,H .LF199 LD L,H JR NZ,LF1EE LD L,A LD H,C LD H,H INC L JR NZ,LF1E5 LD H,C .LF1A3 LD L,L LD H,D LD (HL),D LD L,C LD H,H LD H,A LD H,L JR NZ,LF1EF LD B,D .LF1AD LD SP,&3220 LD B,D LD B,H DEC C DEC C LD D,B .LF1B5 LD L,H LD H,L .LF1B7 LD H,C .LF1B8 LD (HL),E LD H,L JR NZ,&F21F .LF1BC LD (HL),D LD L,A LD (HL),E LD (HL),E .LF1C0 JR NZ,&F225 LD L,B .LF1C3 LD H,L .LF1C4 LD (HL),C LD (HL),L LD H,L LD (HL),E JR NZ,LF1EC .LF1CA LD B,(HL) .LF1CB LD (HL),D LD H,L .LF1CD LD H,L LD (HL),A .LF1CF LD H,C LD (HL),D LD H,L .LF1D2 JR NZ,&F215 .LF1D4 CPL .LF1D5 LD B,E LD (&540D),HL .LF1D9 LD L,B LD H,C .LF1DB LD L,(HL) LD L,E JR NZ,&F258 LD L,A LD (HL),L .LF1E1 JR NZ,&F249 .LF1E3 LD L,A .LF1E4 LD (HL),D .LF1E5 JR NZ,&F260 .LF1E7 LD L,A LD (HL),L \ First 15 bytes of BDOS copied to here .LF1E9 LD (HL),D JR NZ,&F25F .LF1EC LD (HL),L LD (HL),B .LF1EE LD (HL),B .LF1EF LD L,A LD (HL),D LD (HL),H .LF1F2 LD L,&0D NOP INC B NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP ]:NEXT PRINT" *SAVE ZNOS_BD ";~mcode%;" ";~O%;" FFFF0000 FFFBBC00"