;ENHANCED FILE TRANSFER PROGRAM FOR 5/8 AND 8/5 DISCS. ;DEBUGGED AND ENHANCED BY ROD HART WA3MEZ ; AUGUST 14, 1980 ; ; Further debugged and modified by W6BSK: 10 Dec 81 ; ; To use, bring up the destination system first; ; then use DDT (or another method) to call the source system. ; ;The program requires that one system be at some low location ;(such as 20k) and the other be at a high location (such as 48k.) ;Both must be up at the same time. The proper loading procedure ;is to cold boot (or otherwise come up on) the destination system ;first, then use DDT to cold boot the source system.The source ;system will thereby be in the base page and the destination ;system will be called by the program. ; System equates: 0001 = TRUE EQU 1 FFFE = FALSE EQU NOT TRUE 0001 = X5TO8 EQU TRUE ;SET TRUE if 5" to 8" transfer. FFFE = X8TO5 EQU FALSE ;SET TRUE if 8" to 5" transfer. 001A = VT EQU 1AH ;VIO-C CLEAR SCREEN 0005 = BDOS EQU 5 ; BDOS entry point. IF X8TO5 REBDOS EQU 3506H ;DESTINATION ENTRY POINT. ENDIF ;Current value for 20k system IF X5TO8 C506 = REBDOS EQU 0C506H ;Current value for 56k system ENDIF ;Change these values as needed. 005C = DEFFCB EQU 5CH ;Default file control block. 000F = OPEN EQU 15 ;Open the file. 001A = SETBUF EQU 26 ;Set the buffer. 0013 = DELETE EQU 19 ;Delete the file. 0016 = MAKE EQU 22 ;Write to directory. 0014 = READ EQU 20 ;Read the disk. 0015 = WRITE EQU 21 ;Write the disk. 0010 = CLOSE EQU 16 ;Close the file. 0009 = PRINT EQU 9 ;Output a message. 007C = FCBCR EQU DEFFCB+32 ;Source file control block. 0000 = WBOOT EQU 0 ;Warmboot. 0100 ORG 100H 0100 112C03 LXI D,MSG5 ;PROGRAM STATEMENT MESSAGE. 0103 0E09 MVI C,PRINT 0105 CD0500 CALL BDOS 0108 210000 START LXI H,00 010B 39 DAD SP 010C 22AC02 SHLD OLDSP 010F 31B503 LXI SP,STACK 0112 0620 MVI B,20H ;Set counter and move 0114 115C00 LXI D,DEFFCB 0117 216802 LXI H,NFCB ;Move file name to the new control 011A 1A LOOP1 LDAX D ;block at NFCB 011B 77 MOV M,A 011C 23 INX H 011D 13 INX D 011E 05 DCR B 011F C21A01 JNZ LOOP1 0122 115C00 LXI D,DEFFCB ;Point to the default FCB 0125 0E0F MVI C,OPEN ;and use this to open the file 0127 CD0500 CALL BDOS ;to be transmitted. 012A FEFF CPI 255 012C C25701 JNZ OPNOK 012F CD5702 CALL ERROR ;Bad file or nonexistent. 0132 46696C6520 DB 'File not present on the source disc.$' 0157 11AE02 OPNOK LXI D,MSG1 ;File properly opened. 015A 0E09 MVI C,PRINT 015C CD0500 CALL BDOS 015F AF XRA A 0160 327C00 STA FCBCR ;Put a zero in the first FCB cells. 0163 328802 STA NFCB+32 0166 116802 LXI D,NFCB 0169 0E13 MVI C,DELETE ;Delete the file if on destination 016B CD06C5 CALL REBDOS ;disc. 016E 116802 LXI D,NFCB 0171 0E16 MVI C,MAKE ;Write a new entry into the directory of 0173 CD06C5 CALL REBDOS ;the destination disc. 0176 F29E01 JP OKOPN 0179 CD5702 CALL ERROR 017C 43616E6E6F DB 'Cannot open the destination file.$' 019E 11C602 OKOPN LXI D,MSG2 ;Reading a sector from the n" disc. 01A1 0E09 MVI C,PRINT 01A3 CD0500 CALL BDOS 01A6 CD1602 CALL READIT ;Read the source sector. 01A9 FE00 CPI 0 01AB CADA01 JZ HERE ;Good read. 01AE FE01 CPI 1 ;Last sector? 01B0 CA4402 JZ DONE ;Yes. 01B3 CD5702 CALL ERROR 01B6 5468657265 DB 'There was an error in calling BDOS.$' 01DA 11EB02 HERE LXI D,MSG3 ;Writing a sector to the n" disc. 01DD 0E09 MVI C,PRINT 01DF CD0500 CALL BDOS 01E2 CD2D02 CALL WRITIT ;Write the sector to the destination disc. 01E5 FE02 CPI 2 ;Good write? 01E7 C29E01 JNZ OKOPN ;Yes, get the next. 01EA CD5702 CALL ERROR ;No- 01ED 4469736320 DB 'Disc full; no further transfer possible.$' 0216 C5 READIT PUSH B ;Push all. 0217 D5 PUSH D 0218 E5 PUSH H 0219 0E1A MVI C,SETBUF ;Set the address to the normal 021B 118000 LXI D,0080H ;FCB at 0080. 021E CD0500 CALL BDOS 0221 0E14 MVI C,READ 0223 115C00 LXI D,DEFFCB ;Do a sequential read to the 0226 CD0500 CALL BDOS ;default buffer at 005c. 0229 E1 POP H 022A D1 POP D 022B C1 POP B ;Restore the registers. 022C C9 RET 022D C5 WRITIT PUSH B ;Push all. 022E D5 PUSH D 022F E5 PUSH H 0230 0E1A MVI C,SETBUF ;Set the address to 0232 118000 LXI D,0080H ;the standard FCB. 0235 CD06C5 CALL REBDOS 0238 0E15 MVI C,WRITE ;Write the buffer to the destination 023A 116802 LXI D,NFCB ;disc. 023D CD06C5 CALL REBDOS 0240 E1 POP H 0241 D1 POP D 0242 C1 POP B ;Restore the registers. 0243 C9 RET 0244 111003 DONE LXI D,MSG4 ;The file is being closed. 0247 0E09 MVI C,PRINT 0249 CD0500 CALL BDOS 024C 0E10 MVI C,CLOSE ;Do the actual closing. 024E 116802 LXI D,NFCB 0251 CD06C5 CALL REBDOS 0254 C30000 JMP WBOOT ;Now go home 0257 D1 ERROR POP D 0258 0E09 MVI C,PRINT ;Print error routine. 025A CD0500 CALL BDOS 025D 118802 LXI D,ERASE ;Get FCB for $$$.SUB 0260 0E13 MVI C,DELETE ;and delete it. 0262 CD0500 CALL BDOS 0265 C30000 JMP WBOOT 0268 NFCB DS 32 ;New file control block area. 0288 0024242420ERASE DB 000H,'$$$ SUB' 0294 DS 24 ;ERASE file control block. 02AC OLDSP DS 2 02AE 46696C6520MSG1 DB 'File properly opened.' 02C3 0A0D24 DB 0AH,0DH,'$' MSG2 IF X8TO5 DB 'Reading a sector from the 8" disc.' ENDIF IF X5TO8 02C6 5265616469 DB 'Reading a sector from the 5" disc.' ENDIF 02E8 0A0D24 DB 0AH,0DH,'$' MSG3 IF X5TO8 02EB 5772697469 DB 'Writing a sector to the 8" disc.' ENDIF IF X8TO5 DB 'Writing a sector to the 5" disc.' ENDIF 030D 0A0D24 DB 0AH,0DH,'$' 0310 5468652066MSG4 DB 'The file is being closed.' 0329 0A0D24 DB 0AH,0DH,'$' MSG5 IF X8TO5 DB VT,0AH,0DH,'8" to 5" File Transfer Program:' ENDIF IF X5TO8 032C 1A0A0D3522 DB VT,0AH,0DH,'5" to 8" File Transfer Program:' ENDIF 034E 0A0D24 DB 0AH,0DH,'$' 03B5 = STACK EQU $+100 0351 END