Home » Archimedes archive » Zipped Apps » BBC Tape » !BBCTape/BBCLoadBT

!BBCTape/BBCLoadBT

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Zipped Apps » BBC Tape
Filename: !BBCTape/BBCLoadBT
Read OK:
File size: 1B5E bytes
Load address: 0000
Exec address: 0000
File contents
MODE 7
*TAPE
PAGE = &E00
40REM
50REM BBC end of !BBCTape application
60REM
70REM (C) S. Burke, 26/2/91
80REM
90REM The next few lines define where the buffers are, where the
100REM code goes and where the file loads to.
110REM
120:
130name       = &0B00
140name_high  = &0B
150name_low   = &00
160block      = &0B10
170block_high = &0B
180block_low  = &10
190code_start = &0B30
200load_page  = &0E
210:
220osfind = &FFCE
230osbget = &FFD7
240osfile = &FFDD  :REM Page 335 of the Advanced User Guide is wrong!
250osbyte = &FFF4
260:
270FOR opt%=0 TO 3 STEP 3
280P% = code_start
290[OPT opt%
300.go
310LDX #0
320LDA #2
330JSR osbyte        \ disable RS423
340LDX #0
350LDA #15
360JSR osbyte        \ flush all buffers
370LDX #2
380TXA
390JSR osbyte        \ enable RS423 receive
400.mainloop
410LDA #&0D
420STA name          \ null name
430JSR handshake
440:
450JSR get           \ get command
460CPY #&C0
470BEQ end           \ quit
480:
490CPY #&30
500BNE load
510JSR put_ok        \ confirm command
520JSR get_name      \ get filename
530JSR handshake
540JSR get
550.load
560CPY #&0C
570BNE load_byte
580JSR put_ok        \ confirm command
590JSR load_file
600JSR send_file
610JMP mainloop
620.load_byte
630CPY #&03
640BNE command_error
650JSR put_ok        \ confirm command
660JSR load_bget
670JSR send_file
680JMP mainloop
690.command_error
700LDA #0
710JSR put           \ command error
720JMP mainloop
730.end
740RTS
750.load_file
760LDA #name_low     \ set up parameter block
770STA block
780LDA #name_high
790STA block+1
800LDA #0
810STA block+2
820STA block+6
830LDA #load_page
840STA block+3
850LDA #&FF
860STA block+4
870STA block+5
880LDX #block_low
890LDY #block_high
900JSR osfile        \ load file
910LDA block+10
920STA &71
930LDA block+11
940STA &72           \ put file length in &71, &72
950JSR read_load_exec
960JMP read_name     \ get load/exec address and name
970.load_bget
980LDA #0
990STA &71:STA &72   \ file length in &71, &72
1000STA &73
1010LDA #load_page
1020STA &74           \ load address in &73, &74
1030:
1040LDX #name_low
1050LDY #name_high
1060LDA #&40
1070JSR osfind        \ open file
1080CMP #0
1090BEQ end           \ open failed?
1100STA &70           \ file handle
1110LDY #0
1120.loop
1130JSR escape        \ check for escape
1140TYA:TAX           \ no TYX instruction!
1150LDY &70
1160JSR osbget        \ get byte
1170PHA:TXA:TAY:PLA   \ just TXY!
1180BCS eof           \ end of file?
1190STA (&73),Y       \ can't use X register
1200INY
1210BNE loop          \ done 256 bytes?
1220INC &72:LDA #23:CMP &72:BCS loop:INC &74
1230BPL loop          \ should always be taken
1240.eof
1250STY &71:STY &73   \ set low bytes of counters
1260JSR read_load_exec
1270JSR read_name     \ get load/exec address and name
1280LDY &70
1290LDA #0
1300JMP osfind        \ close file
1310.read_name
1320LDX #&FF
1330.nameloop
1340INX
1350CPX #&C
1360BEQ too_far
1370LDA &3B2,X        \ pull filename out of cassette workspace
1380STA name,X        \ see AUG p. 279
1390BNE nameloop
1400.too_far
1410LDA #&0D
1420STA name,X
1430RTS
1440.get_name
1450LDX #&FF
1460STX &81           \ "get" corrupts registers
1470.get_char
1480CPX #&B
1490BEQ too_far
1500JSR get           \ get filename from Arc
1510TYA
1520INC &81   
1530LDX &81
1540STA name,X
1550CMP #&0D
1560BNE get_char
1570RTS
1580.read_load_exec
1590LDX #8
1600.load_exec_loop
1610LDA &3BD,X        \ load/exec address from cassette workspace
1620STA &81,X
1630DEX
1640BNE load_exec_loop
1650RTS
1660.handshake
1670LDA #ASC("S")
1680JSR put
1690LDA #ASC("B")
1700JSR put           \ send "SB" ...
1710JSR get
1720CPY #ASC("s")
1730BNE handshake
1740JSR get
1750CPY #ASC("b")
1760BNE handshake     \ ... and receive "sb" to handshake
1770RTS
1780.send_file
1790LDA &71
1800JSR put
1810LDA &72
1820JSR put           \ send file length
1830:
1840LDA #load_page
1850STA &74
1860LDA #0 
1870STA &73           \ reset load address
1880DEC &72           \ need this for test below
1890BMI last_block    \ file length < 256 bytes?
1900STA &80           \ block length = 0 ( = 256)
1910.send_block
1920JSR put_ok        \ not eof
1930LDA #3            \ send length 3 times
1940STA &76           \ use CRC low byte as counter
1950.lenout
1960LDA &80
1970JSR put           \ output block length
1980DEC &76
1990BNE lenout        \ CRC low byte zero at exit
2000LDY #0
2010STY &75           \ initialise CRC high byte
2020.send_byte
2030STY &70           \ save offset
2040LDA (&73),Y       \ load next byte ...
2050PHA
2060JSR put
2070PLA               \ get character back
2080JSR crc           \ update crc
2090LDY &70
2100INY               \ increment offset
2110CPY &80
2120BNE send_byte     \ end of block?
2130:
2140LDA &75
2150JSR put           \ output CRC high byte
2160LDA &76
2170JSR put           \ output CRC low byte
2180:
2190JSR get           \ look for confirmation
2200TYA
2210BEQ send_block    \ zero means error, so do again
2220:
2230INC &74           \ increment address high byte
2240DEC &72           \ decrement length high byte
2250BPL send_block    \ are we finished?
2260.last_block
2270LDY #0
2280LDA &71           \ length of last block
2290STY &71           \ set length to zero
2300STA &80
2310BNE send_block    \ output if non-zero
2320LDA #0
2330JSR put           \ zero marks eof
2340JSR put_load_exec \ send the load/exec adress
2350.put_name                   \ fall through to put_name ...
2360LDX #&FF
2370STX &81           \ "put" corrupts registers
2380.put_char                   \ output file name
2390INC &81
2400LDX &81
2410LDA name,X
2420PHA
2430JSR put
2440PLA
2450CMP #&0D
2460BNE put_char
2470RTS
2480.put_load_exec              \ put out load/exec address
2490LDX #0
2500STX &81           \ "put" corrupts registers
2510.put_load_exec_loop
2520LDA &82,X
2530JSR put
2540INC &81
2550LDX &81
2560CPX #8
2570BNE put_load_exec_loop
2580RTS
2590.put_ok
2600LDA #&FF
2610.put
2620PHA               \ save value to output
2630JSR escape
2640LDX #&FD
2650LDA #&80
2660JSR osbyte        \ get # empty bytes in RS423 output buffer
2670CPX #9
2680PLA
2690BCC put           \ if < 9 bytes remain, wait ...
2700:
2710LDX #2
2720TAY
2730LDA #&8A
2740JMP osbyte        \ ... and send it
2750.get
2760JSR escape
2770LDX #1
2780LDA #&91
2790JSR osbyte        \ read a byte
2800BCS get
2810RTS
2820.crc
2830EOR &75           \ calculate CRC in &75, &76
2840STA &75           \ algorithm from Advanced User Guide
2850LDX #8            \ I hope it's right!
2860.crc_loop
2870LDA &75
2880ROL A
2890BCC b7z
2900LDA &75
2910EOR #8
2920STA &75
2930LDA &76
2940EOR #&10
2950STA &76
2960.b7z
2970ROL &76
2980ROL &75
2990DEX
3000BNE crc_loop
3010RTS
3020.escape
3030LDA &FF
3040BMI error
3050RTS
3060.error
3070LDA #&7E
3080JSR osbyte        \ acknowledge escape
3090LDX #0
3100LDA #&0F
3110JSR osbyte        \ flush buffers (just in case)
3120LDY #0
3130LDA #0
3140JSR &FFCE         \ close all files
3150BRK
3160]
3170?P% = &11
3180P%  = P% + 1
3190$P% = "Escape" + CHR$0
3200NEXT opt%
*OPT 1,2
RUN
CALL go
00000000  4d 4f 44 45 20 37 0d 2a  54 41 50 45 0d 50 41 47  |MODE 7.*TAPE.PAG|
00000010  45 20 3d 20 26 45 30 30  0d 34 30 52 45 4d 0d 35  |E = &E00.40REM.5|
00000020  30 52 45 4d 20 42 42 43  20 65 6e 64 20 6f 66 20  |0REM BBC end of |
00000030  21 42 42 43 54 61 70 65  20 61 70 70 6c 69 63 61  |!BBCTape applica|
00000040  74 69 6f 6e 0d 36 30 52  45 4d 0d 37 30 52 45 4d  |tion.60REM.70REM|
00000050  20 28 43 29 20 53 2e 20  42 75 72 6b 65 2c 20 32  | (C) S. Burke, 2|
00000060  36 2f 32 2f 39 31 0d 38  30 52 45 4d 0d 39 30 52  |6/2/91.80REM.90R|
00000070  45 4d 20 54 68 65 20 6e  65 78 74 20 66 65 77 20  |EM The next few |
00000080  6c 69 6e 65 73 20 64 65  66 69 6e 65 20 77 68 65  |lines define whe|
00000090  72 65 20 74 68 65 20 62  75 66 66 65 72 73 20 61  |re the buffers a|
000000a0  72 65 2c 20 77 68 65 72  65 20 74 68 65 0d 31 30  |re, where the.10|
000000b0  30 52 45 4d 20 63 6f 64  65 20 67 6f 65 73 20 61  |0REM code goes a|
000000c0  6e 64 20 77 68 65 72 65  20 74 68 65 20 66 69 6c  |nd where the fil|
000000d0  65 20 6c 6f 61 64 73 20  74 6f 2e 0d 31 31 30 52  |e loads to..110R|
000000e0  45 4d 0d 31 32 30 3a 0d  31 33 30 6e 61 6d 65 20  |EM.120:.130name |
000000f0  20 20 20 20 20 20 3d 20  26 30 42 30 30 0d 31 34  |      = &0B00.14|
00000100  30 6e 61 6d 65 5f 68 69  67 68 20 20 3d 20 26 30  |0name_high  = &0|
00000110  42 0d 31 35 30 6e 61 6d  65 5f 6c 6f 77 20 20 20  |B.150name_low   |
00000120  3d 20 26 30 30 0d 31 36  30 62 6c 6f 63 6b 20 20  |= &00.160block  |
00000130  20 20 20 20 3d 20 26 30  42 31 30 0d 31 37 30 62  |    = &0B10.170b|
00000140  6c 6f 63 6b 5f 68 69 67  68 20 3d 20 26 30 42 0d  |lock_high = &0B.|
00000150  31 38 30 62 6c 6f 63 6b  5f 6c 6f 77 20 20 3d 20  |180block_low  = |
00000160  26 31 30 0d 31 39 30 63  6f 64 65 5f 73 74 61 72  |&10.190code_star|
00000170  74 20 3d 20 26 30 42 33  30 0d 32 30 30 6c 6f 61  |t = &0B30.200loa|
00000180  64 5f 70 61 67 65 20 20  3d 20 26 30 45 0d 32 31  |d_page  = &0E.21|
00000190  30 3a 0d 32 32 30 6f 73  66 69 6e 64 20 3d 20 26  |0:.220osfind = &|
000001a0  46 46 43 45 0d 32 33 30  6f 73 62 67 65 74 20 3d  |FFCE.230osbget =|
000001b0  20 26 46 46 44 37 0d 32  34 30 6f 73 66 69 6c 65  | &FFD7.240osfile|
000001c0  20 3d 20 26 46 46 44 44  20 20 3a 52 45 4d 20 50  | = &FFDD  :REM P|
000001d0  61 67 65 20 33 33 35 20  6f 66 20 74 68 65 20 41  |age 335 of the A|
000001e0  64 76 61 6e 63 65 64 20  55 73 65 72 20 47 75 69  |dvanced User Gui|
000001f0  64 65 20 69 73 20 77 72  6f 6e 67 21 0d 32 35 30  |de is wrong!.250|
00000200  6f 73 62 79 74 65 20 3d  20 26 46 46 46 34 0d 32  |osbyte = &FFF4.2|
00000210  36 30 3a 0d 32 37 30 46  4f 52 20 6f 70 74 25 3d  |60:.270FOR opt%=|
00000220  30 20 54 4f 20 33 20 53  54 45 50 20 33 0d 32 38  |0 TO 3 STEP 3.28|
00000230  30 50 25 20 3d 20 63 6f  64 65 5f 73 74 61 72 74  |0P% = code_start|
00000240  0d 32 39 30 5b 4f 50 54  20 6f 70 74 25 0d 33 30  |.290[OPT opt%.30|
00000250  30 2e 67 6f 0d 33 31 30  4c 44 58 20 23 30 0d 33  |0.go.310LDX #0.3|
00000260  32 30 4c 44 41 20 23 32  0d 33 33 30 4a 53 52 20  |20LDA #2.330JSR |
00000270  6f 73 62 79 74 65 20 20  20 20 20 20 20 20 5c 20  |osbyte        \ |
00000280  64 69 73 61 62 6c 65 20  52 53 34 32 33 0d 33 34  |disable RS423.34|
00000290  30 4c 44 58 20 23 30 0d  33 35 30 4c 44 41 20 23  |0LDX #0.350LDA #|
000002a0  31 35 0d 33 36 30 4a 53  52 20 6f 73 62 79 74 65  |15.360JSR osbyte|
000002b0  20 20 20 20 20 20 20 20  5c 20 66 6c 75 73 68 20  |        \ flush |
000002c0  61 6c 6c 20 62 75 66 66  65 72 73 0d 33 37 30 4c  |all buffers.370L|
000002d0  44 58 20 23 32 0d 33 38  30 54 58 41 0d 33 39 30  |DX #2.380TXA.390|
000002e0  4a 53 52 20 6f 73 62 79  74 65 20 20 20 20 20 20  |JSR osbyte      |
000002f0  20 20 5c 20 65 6e 61 62  6c 65 20 52 53 34 32 33  |  \ enable RS423|
00000300  20 72 65 63 65 69 76 65  0d 34 30 30 2e 6d 61 69  | receive.400.mai|
00000310  6e 6c 6f 6f 70 0d 34 31  30 4c 44 41 20 23 26 30  |nloop.410LDA #&0|
00000320  44 0d 34 32 30 53 54 41  20 6e 61 6d 65 20 20 20  |D.420STA name   |
00000330  20 20 20 20 20 20 20 5c  20 6e 75 6c 6c 20 6e 61  |       \ null na|
00000340  6d 65 0d 34 33 30 4a 53  52 20 68 61 6e 64 73 68  |me.430JSR handsh|
00000350  61 6b 65 0d 34 34 30 3a  0d 34 35 30 4a 53 52 20  |ake.440:.450JSR |
00000360  67 65 74 20 20 20 20 20  20 20 20 20 20 20 5c 20  |get           \ |
00000370  67 65 74 20 63 6f 6d 6d  61 6e 64 0d 34 36 30 43  |get command.460C|
00000380  50 59 20 23 26 43 30 0d  34 37 30 42 45 51 20 65  |PY #&C0.470BEQ e|
00000390  6e 64 20 20 20 20 20 20  20 20 20 20 20 5c 20 71  |nd           \ q|
000003a0  75 69 74 0d 34 38 30 3a  0d 34 39 30 43 50 59 20  |uit.480:.490CPY |
000003b0  23 26 33 30 0d 35 30 30  42 4e 45 20 6c 6f 61 64  |#&30.500BNE load|
000003c0  0d 35 31 30 4a 53 52 20  70 75 74 5f 6f 6b 20 20  |.510JSR put_ok  |
000003d0  20 20 20 20 20 20 5c 20  63 6f 6e 66 69 72 6d 20  |      \ confirm |
000003e0  63 6f 6d 6d 61 6e 64 0d  35 32 30 4a 53 52 20 67  |command.520JSR g|
000003f0  65 74 5f 6e 61 6d 65 20  20 20 20 20 20 5c 20 67  |et_name      \ g|
00000400  65 74 20 66 69 6c 65 6e  61 6d 65 0d 35 33 30 4a  |et filename.530J|
00000410  53 52 20 68 61 6e 64 73  68 61 6b 65 0d 35 34 30  |SR handshake.540|
00000420  4a 53 52 20 67 65 74 0d  35 35 30 2e 6c 6f 61 64  |JSR get.550.load|
00000430  0d 35 36 30 43 50 59 20  23 26 30 43 0d 35 37 30  |.560CPY #&0C.570|
00000440  42 4e 45 20 6c 6f 61 64  5f 62 79 74 65 0d 35 38  |BNE load_byte.58|
00000450  30 4a 53 52 20 70 75 74  5f 6f 6b 20 20 20 20 20  |0JSR put_ok     |
00000460  20 20 20 5c 20 63 6f 6e  66 69 72 6d 20 63 6f 6d  |   \ confirm com|
00000470  6d 61 6e 64 0d 35 39 30  4a 53 52 20 6c 6f 61 64  |mand.590JSR load|
00000480  5f 66 69 6c 65 0d 36 30  30 4a 53 52 20 73 65 6e  |_file.600JSR sen|
00000490  64 5f 66 69 6c 65 0d 36  31 30 4a 4d 50 20 6d 61  |d_file.610JMP ma|
000004a0  69 6e 6c 6f 6f 70 0d 36  32 30 2e 6c 6f 61 64 5f  |inloop.620.load_|
000004b0  62 79 74 65 0d 36 33 30  43 50 59 20 23 26 30 33  |byte.630CPY #&03|
000004c0  0d 36 34 30 42 4e 45 20  63 6f 6d 6d 61 6e 64 5f  |.640BNE command_|
000004d0  65 72 72 6f 72 0d 36 35  30 4a 53 52 20 70 75 74  |error.650JSR put|
000004e0  5f 6f 6b 20 20 20 20 20  20 20 20 5c 20 63 6f 6e  |_ok        \ con|
000004f0  66 69 72 6d 20 63 6f 6d  6d 61 6e 64 0d 36 36 30  |firm command.660|
00000500  4a 53 52 20 6c 6f 61 64  5f 62 67 65 74 0d 36 37  |JSR load_bget.67|
00000510  30 4a 53 52 20 73 65 6e  64 5f 66 69 6c 65 0d 36  |0JSR send_file.6|
00000520  38 30 4a 4d 50 20 6d 61  69 6e 6c 6f 6f 70 0d 36  |80JMP mainloop.6|
00000530  39 30 2e 63 6f 6d 6d 61  6e 64 5f 65 72 72 6f 72  |90.command_error|
00000540  0d 37 30 30 4c 44 41 20  23 30 0d 37 31 30 4a 53  |.700LDA #0.710JS|
00000550  52 20 70 75 74 20 20 20  20 20 20 20 20 20 20 20  |R put           |
00000560  5c 20 63 6f 6d 6d 61 6e  64 20 65 72 72 6f 72 0d  |\ command error.|
00000570  37 32 30 4a 4d 50 20 6d  61 69 6e 6c 6f 6f 70 0d  |720JMP mainloop.|
00000580  37 33 30 2e 65 6e 64 0d  37 34 30 52 54 53 0d 37  |730.end.740RTS.7|
00000590  35 30 2e 6c 6f 61 64 5f  66 69 6c 65 0d 37 36 30  |50.load_file.760|
000005a0  4c 44 41 20 23 6e 61 6d  65 5f 6c 6f 77 20 20 20  |LDA #name_low   |
000005b0  20 20 5c 20 73 65 74 20  75 70 20 70 61 72 61 6d  |  \ set up param|
000005c0  65 74 65 72 20 62 6c 6f  63 6b 0d 37 37 30 53 54  |eter block.770ST|
000005d0  41 20 62 6c 6f 63 6b 0d  37 38 30 4c 44 41 20 23  |A block.780LDA #|
000005e0  6e 61 6d 65 5f 68 69 67  68 0d 37 39 30 53 54 41  |name_high.790STA|
000005f0  20 62 6c 6f 63 6b 2b 31  0d 38 30 30 4c 44 41 20  | block+1.800LDA |
00000600  23 30 0d 38 31 30 53 54  41 20 62 6c 6f 63 6b 2b  |#0.810STA block+|
00000610  32 0d 38 32 30 53 54 41  20 62 6c 6f 63 6b 2b 36  |2.820STA block+6|
00000620  0d 38 33 30 4c 44 41 20  23 6c 6f 61 64 5f 70 61  |.830LDA #load_pa|
00000630  67 65 0d 38 34 30 53 54  41 20 62 6c 6f 63 6b 2b  |ge.840STA block+|
00000640  33 0d 38 35 30 4c 44 41  20 23 26 46 46 0d 38 36  |3.850LDA #&FF.86|
00000650  30 53 54 41 20 62 6c 6f  63 6b 2b 34 0d 38 37 30  |0STA block+4.870|
00000660  53 54 41 20 62 6c 6f 63  6b 2b 35 0d 38 38 30 4c  |STA block+5.880L|
00000670  44 58 20 23 62 6c 6f 63  6b 5f 6c 6f 77 0d 38 39  |DX #block_low.89|
00000680  30 4c 44 59 20 23 62 6c  6f 63 6b 5f 68 69 67 68  |0LDY #block_high|
00000690  0d 39 30 30 4a 53 52 20  6f 73 66 69 6c 65 20 20  |.900JSR osfile  |
000006a0  20 20 20 20 20 20 5c 20  6c 6f 61 64 20 66 69 6c  |      \ load fil|
000006b0  65 0d 39 31 30 4c 44 41  20 62 6c 6f 63 6b 2b 31  |e.910LDA block+1|
000006c0  30 0d 39 32 30 53 54 41  20 26 37 31 0d 39 33 30  |0.920STA &71.930|
000006d0  4c 44 41 20 62 6c 6f 63  6b 2b 31 31 0d 39 34 30  |LDA block+11.940|
000006e0  53 54 41 20 26 37 32 20  20 20 20 20 20 20 20 20  |STA &72         |
000006f0  20 20 5c 20 70 75 74 20  66 69 6c 65 20 6c 65 6e  |  \ put file len|
00000700  67 74 68 20 69 6e 20 26  37 31 2c 20 26 37 32 0d  |gth in &71, &72.|
00000710  39 35 30 4a 53 52 20 72  65 61 64 5f 6c 6f 61 64  |950JSR read_load|
00000720  5f 65 78 65 63 0d 39 36  30 4a 4d 50 20 72 65 61  |_exec.960JMP rea|
00000730  64 5f 6e 61 6d 65 20 20  20 20 20 5c 20 67 65 74  |d_name     \ get|
00000740  20 6c 6f 61 64 2f 65 78  65 63 20 61 64 64 72 65  | load/exec addre|
00000750  73 73 20 61 6e 64 20 6e  61 6d 65 0d 39 37 30 2e  |ss and name.970.|
00000760  6c 6f 61 64 5f 62 67 65  74 0d 39 38 30 4c 44 41  |load_bget.980LDA|
00000770  20 23 30 0d 39 39 30 53  54 41 20 26 37 31 3a 53  | #0.990STA &71:S|
00000780  54 41 20 26 37 32 20 20  20 5c 20 66 69 6c 65 20  |TA &72   \ file |
00000790  6c 65 6e 67 74 68 20 69  6e 20 26 37 31 2c 20 26  |length in &71, &|
000007a0  37 32 0d 31 30 30 30 53  54 41 20 26 37 33 0d 31  |72.1000STA &73.1|
000007b0  30 31 30 4c 44 41 20 23  6c 6f 61 64 5f 70 61 67  |010LDA #load_pag|
000007c0  65 0d 31 30 32 30 53 54  41 20 26 37 34 20 20 20  |e.1020STA &74   |
000007d0  20 20 20 20 20 20 20 20  5c 20 6c 6f 61 64 20 61  |        \ load a|
000007e0  64 64 72 65 73 73 20 69  6e 20 26 37 33 2c 20 26  |ddress in &73, &|
000007f0  37 34 0d 31 30 33 30 3a  0d 31 30 34 30 4c 44 58  |74.1030:.1040LDX|
00000800  20 23 6e 61 6d 65 5f 6c  6f 77 0d 31 30 35 30 4c  | #name_low.1050L|
00000810  44 59 20 23 6e 61 6d 65  5f 68 69 67 68 0d 31 30  |DY #name_high.10|
00000820  36 30 4c 44 41 20 23 26  34 30 0d 31 30 37 30 4a  |60LDA #&40.1070J|
00000830  53 52 20 6f 73 66 69 6e  64 20 20 20 20 20 20 20  |SR osfind       |
00000840  20 5c 20 6f 70 65 6e 20  66 69 6c 65 0d 31 30 38  | \ open file.108|
00000850  30 43 4d 50 20 23 30 0d  31 30 39 30 42 45 51 20  |0CMP #0.1090BEQ |
00000860  65 6e 64 20 20 20 20 20  20 20 20 20 20 20 5c 20  |end           \ |
00000870  6f 70 65 6e 20 66 61 69  6c 65 64 3f 0d 31 31 30  |open failed?.110|
00000880  30 53 54 41 20 26 37 30  20 20 20 20 20 20 20 20  |0STA &70        |
00000890  20 20 20 5c 20 66 69 6c  65 20 68 61 6e 64 6c 65  |   \ file handle|
000008a0  0d 31 31 31 30 4c 44 59  20 23 30 0d 31 31 32 30  |.1110LDY #0.1120|
000008b0  2e 6c 6f 6f 70 0d 31 31  33 30 4a 53 52 20 65 73  |.loop.1130JSR es|
000008c0  63 61 70 65 20 20 20 20  20 20 20 20 5c 20 63 68  |cape        \ ch|
000008d0  65 63 6b 20 66 6f 72 20  65 73 63 61 70 65 0d 31  |eck for escape.1|
000008e0  31 34 30 54 59 41 3a 54  41 58 20 20 20 20 20 20  |140TYA:TAX      |
000008f0  20 20 20 20 20 5c 20 6e  6f 20 54 59 58 20 69 6e  |     \ no TYX in|
00000900  73 74 72 75 63 74 69 6f  6e 21 0d 31 31 35 30 4c  |struction!.1150L|
00000910  44 59 20 26 37 30 0d 31  31 36 30 4a 53 52 20 6f  |DY &70.1160JSR o|
00000920  73 62 67 65 74 20 20 20  20 20 20 20 20 5c 20 67  |sbget        \ g|
00000930  65 74 20 62 79 74 65 0d  31 31 37 30 50 48 41 3a  |et byte.1170PHA:|
00000940  54 58 41 3a 54 41 59 3a  50 4c 41 20 20 20 5c 20  |TXA:TAY:PLA   \ |
00000950  6a 75 73 74 20 54 58 59  21 0d 31 31 38 30 42 43  |just TXY!.1180BC|
00000960  53 20 65 6f 66 20 20 20  20 20 20 20 20 20 20 20  |S eof           |
00000970  5c 20 65 6e 64 20 6f 66  20 66 69 6c 65 3f 0d 31  |\ end of file?.1|
00000980  31 39 30 53 54 41 20 28  26 37 33 29 2c 59 20 20  |190STA (&73),Y  |
00000990  20 20 20 20 20 5c 20 63  61 6e 27 74 20 75 73 65  |     \ can't use|
000009a0  20 58 20 72 65 67 69 73  74 65 72 0d 31 32 30 30  | X register.1200|
000009b0  49 4e 59 0d 31 32 31 30  42 4e 45 20 6c 6f 6f 70  |INY.1210BNE loop|
000009c0  20 20 20 20 20 20 20 20  20 20 5c 20 64 6f 6e 65  |          \ done|
000009d0  20 32 35 36 20 62 79 74  65 73 3f 0d 31 32 32 30  | 256 bytes?.1220|
000009e0  49 4e 43 20 26 37 32 3a  4c 44 41 20 23 32 33 3a  |INC &72:LDA #23:|
000009f0  43 4d 50 20 26 37 32 3a  42 43 53 20 6c 6f 6f 70  |CMP &72:BCS loop|
00000a00  3a 49 4e 43 20 26 37 34  0d 31 32 33 30 42 50 4c  |:INC &74.1230BPL|
00000a10  20 6c 6f 6f 70 20 20 20  20 20 20 20 20 20 20 5c  | loop          \|
00000a20  20 73 68 6f 75 6c 64 20  61 6c 77 61 79 73 20 62  | should always b|
00000a30  65 20 74 61 6b 65 6e 0d  31 32 34 30 2e 65 6f 66  |e taken.1240.eof|
00000a40  0d 31 32 35 30 53 54 59  20 26 37 31 3a 53 54 59  |.1250STY &71:STY|
00000a50  20 26 37 33 20 20 20 5c  20 73 65 74 20 6c 6f 77  | &73   \ set low|
00000a60  20 62 79 74 65 73 20 6f  66 20 63 6f 75 6e 74 65  | bytes of counte|
00000a70  72 73 0d 31 32 36 30 4a  53 52 20 72 65 61 64 5f  |rs.1260JSR read_|
00000a80  6c 6f 61 64 5f 65 78 65  63 0d 31 32 37 30 4a 53  |load_exec.1270JS|
00000a90  52 20 72 65 61 64 5f 6e  61 6d 65 20 20 20 20 20  |R read_name     |
00000aa0  5c 20 67 65 74 20 6c 6f  61 64 2f 65 78 65 63 20  |\ get load/exec |
00000ab0  61 64 64 72 65 73 73 20  61 6e 64 20 6e 61 6d 65  |address and name|
00000ac0  0d 31 32 38 30 4c 44 59  20 26 37 30 0d 31 32 39  |.1280LDY &70.129|
00000ad0  30 4c 44 41 20 23 30 0d  31 33 30 30 4a 4d 50 20  |0LDA #0.1300JMP |
00000ae0  6f 73 66 69 6e 64 20 20  20 20 20 20 20 20 5c 20  |osfind        \ |
00000af0  63 6c 6f 73 65 20 66 69  6c 65 0d 31 33 31 30 2e  |close file.1310.|
00000b00  72 65 61 64 5f 6e 61 6d  65 0d 31 33 32 30 4c 44  |read_name.1320LD|
00000b10  58 20 23 26 46 46 0d 31  33 33 30 2e 6e 61 6d 65  |X #&FF.1330.name|
00000b20  6c 6f 6f 70 0d 31 33 34  30 49 4e 58 0d 31 33 35  |loop.1340INX.135|
00000b30  30 43 50 58 20 23 26 43  0d 31 33 36 30 42 45 51  |0CPX #&C.1360BEQ|
00000b40  20 74 6f 6f 5f 66 61 72  0d 31 33 37 30 4c 44 41  | too_far.1370LDA|
00000b50  20 26 33 42 32 2c 58 20  20 20 20 20 20 20 20 5c  | &3B2,X        \|
00000b60  20 70 75 6c 6c 20 66 69  6c 65 6e 61 6d 65 20 6f  | pull filename o|
00000b70  75 74 20 6f 66 20 63 61  73 73 65 74 74 65 20 77  |ut of cassette w|
00000b80  6f 72 6b 73 70 61 63 65  0d 31 33 38 30 53 54 41  |orkspace.1380STA|
00000b90  20 6e 61 6d 65 2c 58 20  20 20 20 20 20 20 20 5c  | name,X        \|
00000ba0  20 73 65 65 20 41 55 47  20 70 2e 20 32 37 39 0d  | see AUG p. 279.|
00000bb0  31 33 39 30 42 4e 45 20  6e 61 6d 65 6c 6f 6f 70  |1390BNE nameloop|
00000bc0  0d 31 34 30 30 2e 74 6f  6f 5f 66 61 72 0d 31 34  |.1400.too_far.14|
00000bd0  31 30 4c 44 41 20 23 26  30 44 0d 31 34 32 30 53  |10LDA #&0D.1420S|
00000be0  54 41 20 6e 61 6d 65 2c  58 0d 31 34 33 30 52 54  |TA name,X.1430RT|
00000bf0  53 0d 31 34 34 30 2e 67  65 74 5f 6e 61 6d 65 0d  |S.1440.get_name.|
00000c00  31 34 35 30 4c 44 58 20  23 26 46 46 0d 31 34 36  |1450LDX #&FF.146|
00000c10  30 53 54 58 20 26 38 31  20 20 20 20 20 20 20 20  |0STX &81        |
00000c20  20 20 20 5c 20 22 67 65  74 22 20 63 6f 72 72 75  |   \ "get" corru|
00000c30  70 74 73 20 72 65 67 69  73 74 65 72 73 0d 31 34  |pts registers.14|
00000c40  37 30 2e 67 65 74 5f 63  68 61 72 0d 31 34 38 30  |70.get_char.1480|
00000c50  43 50 58 20 23 26 42 0d  31 34 39 30 42 45 51 20  |CPX #&B.1490BEQ |
00000c60  74 6f 6f 5f 66 61 72 0d  31 35 30 30 4a 53 52 20  |too_far.1500JSR |
00000c70  67 65 74 20 20 20 20 20  20 20 20 20 20 20 5c 20  |get           \ |
00000c80  67 65 74 20 66 69 6c 65  6e 61 6d 65 20 66 72 6f  |get filename fro|
00000c90  6d 20 41 72 63 0d 31 35  31 30 54 59 41 0d 31 35  |m Arc.1510TYA.15|
00000ca0  32 30 49 4e 43 20 26 38  31 20 20 20 0d 31 35 33  |20INC &81   .153|
00000cb0  30 4c 44 58 20 26 38 31  0d 31 35 34 30 53 54 41  |0LDX &81.1540STA|
00000cc0  20 6e 61 6d 65 2c 58 0d  31 35 35 30 43 4d 50 20  | name,X.1550CMP |
00000cd0  23 26 30 44 0d 31 35 36  30 42 4e 45 20 67 65 74  |#&0D.1560BNE get|
00000ce0  5f 63 68 61 72 0d 31 35  37 30 52 54 53 0d 31 35  |_char.1570RTS.15|
00000cf0  38 30 2e 72 65 61 64 5f  6c 6f 61 64 5f 65 78 65  |80.read_load_exe|
00000d00  63 0d 31 35 39 30 4c 44  58 20 23 38 0d 31 36 30  |c.1590LDX #8.160|
00000d10  30 2e 6c 6f 61 64 5f 65  78 65 63 5f 6c 6f 6f 70  |0.load_exec_loop|
00000d20  0d 31 36 31 30 4c 44 41  20 26 33 42 44 2c 58 20  |.1610LDA &3BD,X |
00000d30  20 20 20 20 20 20 20 5c  20 6c 6f 61 64 2f 65 78  |       \ load/ex|
00000d40  65 63 20 61 64 64 72 65  73 73 20 66 72 6f 6d 20  |ec address from |
00000d50  63 61 73 73 65 74 74 65  20 77 6f 72 6b 73 70 61  |cassette workspa|
00000d60  63 65 0d 31 36 32 30 53  54 41 20 26 38 31 2c 58  |ce.1620STA &81,X|
00000d70  0d 31 36 33 30 44 45 58  0d 31 36 34 30 42 4e 45  |.1630DEX.1640BNE|
00000d80  20 6c 6f 61 64 5f 65 78  65 63 5f 6c 6f 6f 70 0d  | load_exec_loop.|
00000d90  31 36 35 30 52 54 53 0d  31 36 36 30 2e 68 61 6e  |1650RTS.1660.han|
00000da0  64 73 68 61 6b 65 0d 31  36 37 30 4c 44 41 20 23  |dshake.1670LDA #|
00000db0  41 53 43 28 22 53 22 29  0d 31 36 38 30 4a 53 52  |ASC("S").1680JSR|
00000dc0  20 70 75 74 0d 31 36 39  30 4c 44 41 20 23 41 53  | put.1690LDA #AS|
00000dd0  43 28 22 42 22 29 0d 31  37 30 30 4a 53 52 20 70  |C("B").1700JSR p|
00000de0  75 74 20 20 20 20 20 20  20 20 20 20 20 5c 20 73  |ut           \ s|
00000df0  65 6e 64 20 22 53 42 22  20 2e 2e 2e 0d 31 37 31  |end "SB" ....171|
00000e00  30 4a 53 52 20 67 65 74  0d 31 37 32 30 43 50 59  |0JSR get.1720CPY|
00000e10  20 23 41 53 43 28 22 73  22 29 0d 31 37 33 30 42  | #ASC("s").1730B|
00000e20  4e 45 20 68 61 6e 64 73  68 61 6b 65 0d 31 37 34  |NE handshake.174|
00000e30  30 4a 53 52 20 67 65 74  0d 31 37 35 30 43 50 59  |0JSR get.1750CPY|
00000e40  20 23 41 53 43 28 22 62  22 29 0d 31 37 36 30 42  | #ASC("b").1760B|
00000e50  4e 45 20 68 61 6e 64 73  68 61 6b 65 20 20 20 20  |NE handshake    |
00000e60  20 5c 20 2e 2e 2e 20 61  6e 64 20 72 65 63 65 69  | \ ... and recei|
00000e70  76 65 20 22 73 62 22 20  74 6f 20 68 61 6e 64 73  |ve "sb" to hands|
00000e80  68 61 6b 65 0d 31 37 37  30 52 54 53 0d 31 37 38  |hake.1770RTS.178|
00000e90  30 2e 73 65 6e 64 5f 66  69 6c 65 0d 31 37 39 30  |0.send_file.1790|
00000ea0  4c 44 41 20 26 37 31 0d  31 38 30 30 4a 53 52 20  |LDA &71.1800JSR |
00000eb0  70 75 74 0d 31 38 31 30  4c 44 41 20 26 37 32 0d  |put.1810LDA &72.|
00000ec0  31 38 32 30 4a 53 52 20  70 75 74 20 20 20 20 20  |1820JSR put     |
00000ed0  20 20 20 20 20 20 5c 20  73 65 6e 64 20 66 69 6c  |      \ send fil|
00000ee0  65 20 6c 65 6e 67 74 68  0d 31 38 33 30 3a 0d 31  |e length.1830:.1|
00000ef0  38 34 30 4c 44 41 20 23  6c 6f 61 64 5f 70 61 67  |840LDA #load_pag|
00000f00  65 0d 31 38 35 30 53 54  41 20 26 37 34 0d 31 38  |e.1850STA &74.18|
00000f10  36 30 4c 44 41 20 23 30  20 0d 31 38 37 30 53 54  |60LDA #0 .1870ST|
00000f20  41 20 26 37 33 20 20 20  20 20 20 20 20 20 20 20  |A &73           |
00000f30  5c 20 72 65 73 65 74 20  6c 6f 61 64 20 61 64 64  |\ reset load add|
00000f40  72 65 73 73 0d 31 38 38  30 44 45 43 20 26 37 32  |ress.1880DEC &72|
00000f50  20 20 20 20 20 20 20 20  20 20 20 5c 20 6e 65 65  |           \ nee|
00000f60  64 20 74 68 69 73 20 66  6f 72 20 74 65 73 74 20  |d this for test |
00000f70  62 65 6c 6f 77 0d 31 38  39 30 42 4d 49 20 6c 61  |below.1890BMI la|
00000f80  73 74 5f 62 6c 6f 63 6b  20 20 20 20 5c 20 66 69  |st_block    \ fi|
00000f90  6c 65 20 6c 65 6e 67 74  68 20 3c 20 32 35 36 20  |le length < 256 |
00000fa0  62 79 74 65 73 3f 0d 31  39 30 30 53 54 41 20 26  |bytes?.1900STA &|
00000fb0  38 30 20 20 20 20 20 20  20 20 20 20 20 5c 20 62  |80           \ b|
00000fc0  6c 6f 63 6b 20 6c 65 6e  67 74 68 20 3d 20 30 20  |lock length = 0 |
00000fd0  28 20 3d 20 32 35 36 29  0d 31 39 31 30 2e 73 65  |( = 256).1910.se|
00000fe0  6e 64 5f 62 6c 6f 63 6b  0d 31 39 32 30 4a 53 52  |nd_block.1920JSR|
00000ff0  20 70 75 74 5f 6f 6b 20  20 20 20 20 20 20 20 5c  | put_ok        \|
00001000  20 6e 6f 74 20 65 6f 66  0d 31 39 33 30 4c 44 41  | not eof.1930LDA|
00001010  20 23 33 20 20 20 20 20  20 20 20 20 20 20 20 5c  | #3            \|
00001020  20 73 65 6e 64 20 6c 65  6e 67 74 68 20 33 20 74  | send length 3 t|
00001030  69 6d 65 73 0d 31 39 34  30 53 54 41 20 26 37 36  |imes.1940STA &76|
00001040  20 20 20 20 20 20 20 20  20 20 20 5c 20 75 73 65  |           \ use|
00001050  20 43 52 43 20 6c 6f 77  20 62 79 74 65 20 61 73  | CRC low byte as|
00001060  20 63 6f 75 6e 74 65 72  0d 31 39 35 30 2e 6c 65  | counter.1950.le|
00001070  6e 6f 75 74 0d 31 39 36  30 4c 44 41 20 26 38 30  |nout.1960LDA &80|
00001080  0d 31 39 37 30 4a 53 52  20 70 75 74 20 20 20 20  |.1970JSR put    |
00001090  20 20 20 20 20 20 20 5c  20 6f 75 74 70 75 74 20  |       \ output |
000010a0  62 6c 6f 63 6b 20 6c 65  6e 67 74 68 0d 31 39 38  |block length.198|
000010b0  30 44 45 43 20 26 37 36  0d 31 39 39 30 42 4e 45  |0DEC &76.1990BNE|
000010c0  20 6c 65 6e 6f 75 74 20  20 20 20 20 20 20 20 5c  | lenout        \|
000010d0  20 43 52 43 20 6c 6f 77  20 62 79 74 65 20 7a 65  | CRC low byte ze|
000010e0  72 6f 20 61 74 20 65 78  69 74 0d 32 30 30 30 4c  |ro at exit.2000L|
000010f0  44 59 20 23 30 0d 32 30  31 30 53 54 59 20 26 37  |DY #0.2010STY &7|
00001100  35 20 20 20 20 20 20 20  20 20 20 20 5c 20 69 6e  |5           \ in|
00001110  69 74 69 61 6c 69 73 65  20 43 52 43 20 68 69 67  |itialise CRC hig|
00001120  68 20 62 79 74 65 0d 32  30 32 30 2e 73 65 6e 64  |h byte.2020.send|
00001130  5f 62 79 74 65 0d 32 30  33 30 53 54 59 20 26 37  |_byte.2030STY &7|
00001140  30 20 20 20 20 20 20 20  20 20 20 20 5c 20 73 61  |0           \ sa|
00001150  76 65 20 6f 66 66 73 65  74 0d 32 30 34 30 4c 44  |ve offset.2040LD|
00001160  41 20 28 26 37 33 29 2c  59 20 20 20 20 20 20 20  |A (&73),Y       |
00001170  5c 20 6c 6f 61 64 20 6e  65 78 74 20 62 79 74 65  |\ load next byte|
00001180  20 2e 2e 2e 0d 32 30 35  30 50 48 41 0d 32 30 36  | ....2050PHA.206|
00001190  30 4a 53 52 20 70 75 74  0d 32 30 37 30 50 4c 41  |0JSR put.2070PLA|
000011a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
000011b0  20 67 65 74 20 63 68 61  72 61 63 74 65 72 20 62  | get character b|
000011c0  61 63 6b 0d 32 30 38 30  4a 53 52 20 63 72 63 20  |ack.2080JSR crc |
000011d0  20 20 20 20 20 20 20 20  20 20 5c 20 75 70 64 61  |          \ upda|
000011e0  74 65 20 63 72 63 0d 32  30 39 30 4c 44 59 20 26  |te crc.2090LDY &|
000011f0  37 30 0d 32 31 30 30 49  4e 59 20 20 20 20 20 20  |70.2100INY      |
00001200  20 20 20 20 20 20 20 20  20 5c 20 69 6e 63 72 65  |         \ incre|
00001210  6d 65 6e 74 20 6f 66 66  73 65 74 0d 32 31 31 30  |ment offset.2110|
00001220  43 50 59 20 26 38 30 0d  32 31 32 30 42 4e 45 20  |CPY &80.2120BNE |
00001230  73 65 6e 64 5f 62 79 74  65 20 20 20 20 20 5c 20  |send_byte     \ |
00001240  65 6e 64 20 6f 66 20 62  6c 6f 63 6b 3f 0d 32 31  |end of block?.21|
00001250  33 30 3a 0d 32 31 34 30  4c 44 41 20 26 37 35 0d  |30:.2140LDA &75.|
00001260  32 31 35 30 4a 53 52 20  70 75 74 20 20 20 20 20  |2150JSR put     |
00001270  20 20 20 20 20 20 5c 20  6f 75 74 70 75 74 20 43  |      \ output C|
00001280  52 43 20 68 69 67 68 20  62 79 74 65 0d 32 31 36  |RC high byte.216|
00001290  30 4c 44 41 20 26 37 36  0d 32 31 37 30 4a 53 52  |0LDA &76.2170JSR|
000012a0  20 70 75 74 20 20 20 20  20 20 20 20 20 20 20 5c  | put           \|
000012b0  20 6f 75 74 70 75 74 20  43 52 43 20 6c 6f 77 20  | output CRC low |
000012c0  62 79 74 65 0d 32 31 38  30 3a 0d 32 31 39 30 4a  |byte.2180:.2190J|
000012d0  53 52 20 67 65 74 20 20  20 20 20 20 20 20 20 20  |SR get          |
000012e0  20 5c 20 6c 6f 6f 6b 20  66 6f 72 20 63 6f 6e 66  | \ look for conf|
000012f0  69 72 6d 61 74 69 6f 6e  0d 32 32 30 30 54 59 41  |irmation.2200TYA|
00001300  0d 32 32 31 30 42 45 51  20 73 65 6e 64 5f 62 6c  |.2210BEQ send_bl|
00001310  6f 63 6b 20 20 20 20 5c  20 7a 65 72 6f 20 6d 65  |ock    \ zero me|
00001320  61 6e 73 20 65 72 72 6f  72 2c 20 73 6f 20 64 6f  |ans error, so do|
00001330  20 61 67 61 69 6e 0d 32  32 32 30 3a 0d 32 32 33  | again.2220:.223|
00001340  30 49 4e 43 20 26 37 34  20 20 20 20 20 20 20 20  |0INC &74        |
00001350  20 20 20 5c 20 69 6e 63  72 65 6d 65 6e 74 20 61  |   \ increment a|
00001360  64 64 72 65 73 73 20 68  69 67 68 20 62 79 74 65  |ddress high byte|
00001370  0d 32 32 34 30 44 45 43  20 26 37 32 20 20 20 20  |.2240DEC &72    |
00001380  20 20 20 20 20 20 20 5c  20 64 65 63 72 65 6d 65  |       \ decreme|
00001390  6e 74 20 6c 65 6e 67 74  68 20 68 69 67 68 20 62  |nt length high b|
000013a0  79 74 65 0d 32 32 35 30  42 50 4c 20 73 65 6e 64  |yte.2250BPL send|
000013b0  5f 62 6c 6f 63 6b 20 20  20 20 5c 20 61 72 65 20  |_block    \ are |
000013c0  77 65 20 66 69 6e 69 73  68 65 64 3f 0d 32 32 36  |we finished?.226|
000013d0  30 2e 6c 61 73 74 5f 62  6c 6f 63 6b 0d 32 32 37  |0.last_block.227|
000013e0  30 4c 44 59 20 23 30 0d  32 32 38 30 4c 44 41 20  |0LDY #0.2280LDA |
000013f0  26 37 31 20 20 20 20 20  20 20 20 20 20 20 5c 20  |&71           \ |
00001400  6c 65 6e 67 74 68 20 6f  66 20 6c 61 73 74 20 62  |length of last b|
00001410  6c 6f 63 6b 0d 32 32 39  30 53 54 59 20 26 37 31  |lock.2290STY &71|
00001420  20 20 20 20 20 20 20 20  20 20 20 5c 20 73 65 74  |           \ set|
00001430  20 6c 65 6e 67 74 68 20  74 6f 20 7a 65 72 6f 0d  | length to zero.|
00001440  32 33 30 30 53 54 41 20  26 38 30 0d 32 33 31 30  |2300STA &80.2310|
00001450  42 4e 45 20 73 65 6e 64  5f 62 6c 6f 63 6b 20 20  |BNE send_block  |
00001460  20 20 5c 20 6f 75 74 70  75 74 20 69 66 20 6e 6f  |  \ output if no|
00001470  6e 2d 7a 65 72 6f 0d 32  33 32 30 4c 44 41 20 23  |n-zero.2320LDA #|
00001480  30 0d 32 33 33 30 4a 53  52 20 70 75 74 20 20 20  |0.2330JSR put   |
00001490  20 20 20 20 20 20 20 20  5c 20 7a 65 72 6f 20 6d  |        \ zero m|
000014a0  61 72 6b 73 20 65 6f 66  0d 32 33 34 30 4a 53 52  |arks eof.2340JSR|
000014b0  20 70 75 74 5f 6c 6f 61  64 5f 65 78 65 63 20 5c  | put_load_exec \|
000014c0  20 73 65 6e 64 20 74 68  65 20 6c 6f 61 64 2f 65  | send the load/e|
000014d0  78 65 63 20 61 64 72 65  73 73 0d 32 33 35 30 2e  |xec adress.2350.|
000014e0  70 75 74 5f 6e 61 6d 65  20 20 20 20 20 20 20 20  |put_name        |
000014f0  20 20 20 20 20 20 20 20  20 20 20 5c 20 66 61 6c  |           \ fal|
00001500  6c 20 74 68 72 6f 75 67  68 20 74 6f 20 70 75 74  |l through to put|
00001510  5f 6e 61 6d 65 20 2e 2e  2e 0d 32 33 36 30 4c 44  |_name ....2360LD|
00001520  58 20 23 26 46 46 0d 32  33 37 30 53 54 58 20 26  |X #&FF.2370STX &|
00001530  38 31 20 20 20 20 20 20  20 20 20 20 20 5c 20 22  |81           \ "|
00001540  70 75 74 22 20 63 6f 72  72 75 70 74 73 20 72 65  |put" corrupts re|
00001550  67 69 73 74 65 72 73 0d  32 33 38 30 2e 70 75 74  |gisters.2380.put|
00001560  5f 63 68 61 72 20 20 20  20 20 20 20 20 20 20 20  |_char           |
00001570  20 20 20 20 20 20 20 20  5c 20 6f 75 74 70 75 74  |        \ output|
00001580  20 66 69 6c 65 20 6e 61  6d 65 0d 32 33 39 30 49  | file name.2390I|
00001590  4e 43 20 26 38 31 0d 32  34 30 30 4c 44 58 20 26  |NC &81.2400LDX &|
000015a0  38 31 0d 32 34 31 30 4c  44 41 20 6e 61 6d 65 2c  |81.2410LDA name,|
000015b0  58 0d 32 34 32 30 50 48  41 0d 32 34 33 30 4a 53  |X.2420PHA.2430JS|
000015c0  52 20 70 75 74 0d 32 34  34 30 50 4c 41 0d 32 34  |R put.2440PLA.24|
000015d0  35 30 43 4d 50 20 23 26  30 44 0d 32 34 36 30 42  |50CMP #&0D.2460B|
000015e0  4e 45 20 70 75 74 5f 63  68 61 72 0d 32 34 37 30  |NE put_char.2470|
000015f0  52 54 53 0d 32 34 38 30  2e 70 75 74 5f 6c 6f 61  |RTS.2480.put_loa|
00001600  64 5f 65 78 65 63 20 20  20 20 20 20 20 20 20 20  |d_exec          |
00001610  20 20 20 20 5c 20 70 75  74 20 6f 75 74 20 6c 6f  |    \ put out lo|
00001620  61 64 2f 65 78 65 63 20  61 64 64 72 65 73 73 0d  |ad/exec address.|
00001630  32 34 39 30 4c 44 58 20  23 30 0d 32 35 30 30 53  |2490LDX #0.2500S|
00001640  54 58 20 26 38 31 20 20  20 20 20 20 20 20 20 20  |TX &81          |
00001650  20 5c 20 22 70 75 74 22  20 63 6f 72 72 75 70 74  | \ "put" corrupt|
00001660  73 20 72 65 67 69 73 74  65 72 73 0d 32 35 31 30  |s registers.2510|
00001670  2e 70 75 74 5f 6c 6f 61  64 5f 65 78 65 63 5f 6c  |.put_load_exec_l|
00001680  6f 6f 70 0d 32 35 32 30  4c 44 41 20 26 38 32 2c  |oop.2520LDA &82,|
00001690  58 0d 32 35 33 30 4a 53  52 20 70 75 74 0d 32 35  |X.2530JSR put.25|
000016a0  34 30 49 4e 43 20 26 38  31 0d 32 35 35 30 4c 44  |40INC &81.2550LD|
000016b0  58 20 26 38 31 0d 32 35  36 30 43 50 58 20 23 38  |X &81.2560CPX #8|
000016c0  0d 32 35 37 30 42 4e 45  20 70 75 74 5f 6c 6f 61  |.2570BNE put_loa|
000016d0  64 5f 65 78 65 63 5f 6c  6f 6f 70 0d 32 35 38 30  |d_exec_loop.2580|
000016e0  52 54 53 0d 32 35 39 30  2e 70 75 74 5f 6f 6b 0d  |RTS.2590.put_ok.|
000016f0  32 36 30 30 4c 44 41 20  23 26 46 46 0d 32 36 31  |2600LDA #&FF.261|
00001700  30 2e 70 75 74 0d 32 36  32 30 50 48 41 20 20 20  |0.put.2620PHA   |
00001710  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 73 61  |            \ sa|
00001720  76 65 20 76 61 6c 75 65  20 74 6f 20 6f 75 74 70  |ve value to outp|
00001730  75 74 0d 32 36 33 30 4a  53 52 20 65 73 63 61 70  |ut.2630JSR escap|
00001740  65 0d 32 36 34 30 4c 44  58 20 23 26 46 44 0d 32  |e.2640LDX #&FD.2|
00001750  36 35 30 4c 44 41 20 23  26 38 30 0d 32 36 36 30  |650LDA #&80.2660|
00001760  4a 53 52 20 6f 73 62 79  74 65 20 20 20 20 20 20  |JSR osbyte      |
00001770  20 20 5c 20 67 65 74 20  23 20 65 6d 70 74 79 20  |  \ get # empty |
00001780  62 79 74 65 73 20 69 6e  20 52 53 34 32 33 20 6f  |bytes in RS423 o|
00001790  75 74 70 75 74 20 62 75  66 66 65 72 0d 32 36 37  |utput buffer.267|
000017a0  30 43 50 58 20 23 39 0d  32 36 38 30 50 4c 41 0d  |0CPX #9.2680PLA.|
000017b0  32 36 39 30 42 43 43 20  70 75 74 20 20 20 20 20  |2690BCC put     |
000017c0  20 20 20 20 20 20 5c 20  69 66 20 3c 20 39 20 62  |      \ if < 9 b|
000017d0  79 74 65 73 20 72 65 6d  61 69 6e 2c 20 77 61 69  |ytes remain, wai|
000017e0  74 20 2e 2e 2e 0d 32 37  30 30 3a 0d 32 37 31 30  |t ....2700:.2710|
000017f0  4c 44 58 20 23 32 0d 32  37 32 30 54 41 59 0d 32  |LDX #2.2720TAY.2|
00001800  37 33 30 4c 44 41 20 23  26 38 41 0d 32 37 34 30  |730LDA #&8A.2740|
00001810  4a 4d 50 20 6f 73 62 79  74 65 20 20 20 20 20 20  |JMP osbyte      |
00001820  20 20 5c 20 2e 2e 2e 20  61 6e 64 20 73 65 6e 64  |  \ ... and send|
00001830  20 69 74 0d 32 37 35 30  2e 67 65 74 0d 32 37 36  | it.2750.get.276|
00001840  30 4a 53 52 20 65 73 63  61 70 65 0d 32 37 37 30  |0JSR escape.2770|
00001850  4c 44 58 20 23 31 0d 32  37 38 30 4c 44 41 20 23  |LDX #1.2780LDA #|
00001860  26 39 31 0d 32 37 39 30  4a 53 52 20 6f 73 62 79  |&91.2790JSR osby|
00001870  74 65 20 20 20 20 20 20  20 20 5c 20 72 65 61 64  |te        \ read|
00001880  20 61 20 62 79 74 65 0d  32 38 30 30 42 43 53 20  | a byte.2800BCS |
00001890  67 65 74 0d 32 38 31 30  52 54 53 0d 32 38 32 30  |get.2810RTS.2820|
000018a0  2e 63 72 63 0d 32 38 33  30 45 4f 52 20 26 37 35  |.crc.2830EOR &75|
000018b0  20 20 20 20 20 20 20 20  20 20 20 5c 20 63 61 6c  |           \ cal|
000018c0  63 75 6c 61 74 65 20 43  52 43 20 69 6e 20 26 37  |culate CRC in &7|
000018d0  35 2c 20 26 37 36 0d 32  38 34 30 53 54 41 20 26  |5, &76.2840STA &|
000018e0  37 35 20 20 20 20 20 20  20 20 20 20 20 5c 20 61  |75           \ a|
000018f0  6c 67 6f 72 69 74 68 6d  20 66 72 6f 6d 20 41 64  |lgorithm from Ad|
00001900  76 61 6e 63 65 64 20 55  73 65 72 20 47 75 69 64  |vanced User Guid|
00001910  65 0d 32 38 35 30 4c 44  58 20 23 38 20 20 20 20  |e.2850LDX #8    |
00001920  20 20 20 20 20 20 20 20  5c 20 49 20 68 6f 70 65  |        \ I hope|
00001930  20 69 74 27 73 20 72 69  67 68 74 21 0d 32 38 36  | it's right!.286|
00001940  30 2e 63 72 63 5f 6c 6f  6f 70 0d 32 38 37 30 4c  |0.crc_loop.2870L|
00001950  44 41 20 26 37 35 0d 32  38 38 30 52 4f 4c 20 41  |DA &75.2880ROL A|
00001960  0d 32 38 39 30 42 43 43  20 62 37 7a 0d 32 39 30  |.2890BCC b7z.290|
00001970  30 4c 44 41 20 26 37 35  0d 32 39 31 30 45 4f 52  |0LDA &75.2910EOR|
00001980  20 23 38 0d 32 39 32 30  53 54 41 20 26 37 35 0d  | #8.2920STA &75.|
00001990  32 39 33 30 4c 44 41 20  26 37 36 0d 32 39 34 30  |2930LDA &76.2940|
000019a0  45 4f 52 20 23 26 31 30  0d 32 39 35 30 53 54 41  |EOR #&10.2950STA|
000019b0  20 26 37 36 0d 32 39 36  30 2e 62 37 7a 0d 32 39  | &76.2960.b7z.29|
000019c0  37 30 52 4f 4c 20 26 37  36 0d 32 39 38 30 52 4f  |70ROL &76.2980RO|
000019d0  4c 20 26 37 35 0d 32 39  39 30 44 45 58 0d 33 30  |L &75.2990DEX.30|
000019e0  30 30 42 4e 45 20 63 72  63 5f 6c 6f 6f 70 0d 33  |00BNE crc_loop.3|
000019f0  30 31 30 52 54 53 0d 33  30 32 30 2e 65 73 63 61  |010RTS.3020.esca|
00001a00  70 65 0d 33 30 33 30 4c  44 41 20 26 46 46 0d 33  |pe.3030LDA &FF.3|
00001a10  30 34 30 42 4d 49 20 65  72 72 6f 72 0d 33 30 35  |040BMI error.305|
00001a20  30 52 54 53 0d 33 30 36  30 2e 65 72 72 6f 72 0d  |0RTS.3060.error.|
00001a30  33 30 37 30 4c 44 41 20  23 26 37 45 0d 33 30 38  |3070LDA #&7E.308|
00001a40  30 4a 53 52 20 6f 73 62  79 74 65 20 20 20 20 20  |0JSR osbyte     |
00001a50  20 20 20 5c 20 61 63 6b  6e 6f 77 6c 65 64 67 65  |   \ acknowledge|
00001a60  20 65 73 63 61 70 65 0d  33 30 39 30 4c 44 58 20  | escape.3090LDX |
00001a70  23 30 0d 33 31 30 30 4c  44 41 20 23 26 30 46 0d  |#0.3100LDA #&0F.|
00001a80  33 31 31 30 4a 53 52 20  6f 73 62 79 74 65 20 20  |3110JSR osbyte  |
00001a90  20 20 20 20 20 20 5c 20  66 6c 75 73 68 20 62 75  |      \ flush bu|
00001aa0  66 66 65 72 73 20 28 6a  75 73 74 20 69 6e 20 63  |ffers (just in c|
00001ab0  61 73 65 29 0d 33 31 32  30 4c 44 59 20 23 30 0d  |ase).3120LDY #0.|
00001ac0  33 31 33 30 4c 44 41 20  23 30 0d 33 31 34 30 4a  |3130LDA #0.3140J|
00001ad0  53 52 20 26 46 46 43 45  20 20 20 20 20 20 20 20  |SR &FFCE        |
00001ae0  20 5c 20 63 6c 6f 73 65  20 61 6c 6c 20 66 69 6c  | \ close all fil|
00001af0  65 73 0d 33 31 35 30 42  52 4b 0d 33 31 36 30 5d  |es.3150BRK.3160]|
00001b00  0d 33 31 37 30 3f 50 25  20 3d 20 26 31 31 0d 33  |.3170?P% = &11.3|
00001b10  31 38 30 50 25 20 20 3d  20 50 25 20 2b 20 31 0d  |180P%  = P% + 1.|
00001b20  33 31 39 30 24 50 25 20  3d 20 22 45 73 63 61 70  |3190$P% = "Escap|
00001b30  65 22 20 2b 20 43 48 52  24 30 0d 33 32 30 30 4e  |e" + CHR$0.3200N|
00001b40  45 58 54 20 6f 70 74 25  0d 2a 4f 50 54 20 31 2c  |EXT opt%.*OPT 1,|
00001b50  32 0d 52 55 4e 0d 43 41  4c 4c 20 67 6f 0d        |2.RUN.CALL go.|
00001b5e