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

!BBCTape/BBCLDiscBT

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/BBCLDiscBT
Read OK:
File size: 1824 bytes
Load address: 0000
Exec address: 0000
File contents
MODE 7
20REM
30REM BBC end of !BBCTape application
40REM
50REM (C) S. Burke, 26/2/91
60REM
70REM The next few lines define where the buffers are, where the
80REM code goes and where the file loads to.
90REM
100REM This version might work with discs, but I can't test it!
110REM It fits in pages B and C with 0 bytes spare!
120REM
130:
140name       = &0B00
150name_high  = &0B
160name_low   = &00
170block      = &0B10
180block_high = &0B
190block_low  = &10
200code_start = &0B30
210load_page  = PAGE DIV &100
220:
230osfind = &FFCE
240osbget = &FFD7
250osfile = &FFDD  :REM Page 335 of the Advanced User Guide is wrong!
260osbyte = &FFF4
270:
280FOR opt%=0 TO 3 STEP 3
290P% = code_start
300[OPT opt%
310.go
320LDX #0
330LDA #2
340JSR osbyte        \ disable RS423
350LDX #0
360LDA #15
370JSR osbyte        \ flush all buffers
380LDX #2
390TXA
400JSR osbyte        \ enable RS423 receive
410.mainloop
420LDA #&0D
430STA name          \ null name
440JSR handshake
450:
460JSR get           \ get command
470CPY #&C0
480BEQ end           \ quit
490:
500CPY #&30
510BNE load
520JSR put_ok        \ confirm command
530JSR get_name      \ get filename
540JSR handshake
550JSR get
560.load
570CPY #&0C
580BNE load_byte
590JSR put_ok        \ confirm command
600JSR load_file
610JSR send_file
620JMP mainloop
630.load_byte
640CPY #&03
650BNE command_error
660JSR put_ok        \ confirm command
670JSR load_file
680JSR send_file
690JMP mainloop
700.command_error
710LDA #0
720JSR put           \ command error
730JMP mainloop
740.end
750RTS
760.load_file
770LDA #name_low     \ set up parameter block
780STA block
790LDA #name_high
800STA block+1
810LDA #0
820STA block+2
830STA block+6
840LDA #load_page
850STA block+3
860LDA #&FF
870STA block+4
880STA block+5
890LDX #block_low
900LDY #block_high
910JSR osfile        \ load file
920LDA block+10
930STA &71
940LDA block+11
950STA &72           \ put file length in &71, &72
960JSR read_load_exec\ get load/exec address and name
970.read_name
980LDX #&FF
990.nameloop
1000INX
1010CPX #&C
1020BEQ too_far
1030\         LDA &3B2,X        ! pull filename out of cassette workspace
1040LDA #0            \ don't know where to get it for a disc system
1050STA name,X        \ see AUG p. 279
1060BNE nameloop
1070.too_far
1080LDA #&0D
1090STA name,X
1100RTS
1110.get_name
1120LDX #&FF
1130STX &81           \ "get" corrupts registers
1140.get_char
1150CPX #&B
1160BEQ too_far
1170JSR get           \ get filename from Arc
1180TYA
1190INC &81   
1200LDX &81
1210STA name,X
1220CMP #&0D
1230BNE get_char
1240RTS
1250.read_load_exec
1260LDX #8
1270.load_exec_loop
1280LDA &3BD,X        \ load/exec address from cassette workspace
1290STA &81,X
1300DEX
1310BNE load_exec_loop
1320RTS
1330.handshake
1340LDA #ASC("S")
1350JSR put
1360LDA #ASC("B")
1370JSR put           \ send "SB" ...
1380JSR get
1390CPY #ASC("s")
1400BNE handshake
1410JSR get
1420CPY #ASC("b")
1430BNE handshake     \ ... and receive "sb" to handshake
1440RTS
1450.send_file
1460LDA &71
1470JSR put
1480LDA &72
1490JSR put           \ send file length
1500:
1510LDA #load_page
1520STA &74
1530LDA #0 
1540STA &73           \ reset load address
1550DEC &72           \ need this for test below
1560BMI last_block    \ file length < 256 bytes?
1570STA &80           \ block length = 0 ( = 256)
1580.send_block
1590JSR put_ok        \ not eof
1600LDA #3            \ send length 3 times
1610STA &76           \ use CRC low byte as counter
1620.lenout
1630LDA &80
1640JSR put           \ output block length
1650DEC &76
1660BNE lenout        \ CRC low byte zero at exit
1670LDY #0
1680STY &75           \ initialise CRC high byte
1690.send_byte
1700STY &70           \ save offset
1710LDA (&73),Y       \ load next byte ...
1720PHA
1730JSR put
1740PLA               \ get character back
1750JSR crc           \ update crc
1760LDY &70
1770INY               \ increment offset
1780CPY &80
1790BNE send_byte     \ end of block?
1800:
1810LDA &75
1820JSR put           \ output CRC high byte
1830LDA &76
1840JSR put           \ output CRC low byte
1850:
1860JSR get           \ look for confirmation
1870TYA
1880BEQ send_block    \ zero means error, so do again
1890:
1900INC &74           \ increment address high byte
1910DEC &72           \ decrement length high byte
1920BPL send_block    \ are we finished?
1930.last_block
1940LDY #0
1950LDA &71           \ length of last block
1960STY &71           \ set length to zero
1970STA &80
1980BNE send_block    \ output if non-zero
1990LDA #0
2000JSR put           \ zero marks eof
2010JSR put_load_exec \ send the load/exec adress
2020.put_name                   \ fall through to put_name ...
2030LDX #&FF
2040STX &81           \ "put" corrupts registers
2050.put_char                   \ output file name
2060INC &81
2070LDX &81
2080LDA name,X
2090PHA
2100JSR put
2110PLA
2120CMP #&0D
2130BNE put_char
2140RTS
2150.put_load_exec              \ put out load/exec address
2160LDX #0
2170STX &81           \ "put" corrupts registers
2180.put_load_exec_loop
2190LDA &82,X
2200JSR put
2210INC &81
2220LDX &81
2230CPX #8
2240BNE put_load_exec_loop
2250RTS
2260.put_ok
2270LDA #&FF
2280.put
2290PHA               \ save value to output
2300JSR escape
2310LDX #&FD
2320LDA #&80
2330JSR osbyte        \ get # empty bytes in RS423 output buffer
2340CPX #9
2350PLA
2360BCC put           \ if < 9 bytes remain, wait ...
2370:
2380LDX #2
2390TAY
2400LDA #&8A
2410JMP osbyte        \ ... and send it
2420.get
2430JSR escape
2440LDX #1
2450LDA #&91
2460JSR osbyte        \ read a byte
2470BCS get
2480RTS
2490.crc
2500EOR &75           \ calculate CRC in &75, &76
2510STA &75           \ algorithm from Advanced User Guide
2520LDX #8            \ I hope it's right!
2530.crc_loop
2540LDA &75
2550ROL A
2560BCC b7z
2570LDA &75
2580EOR #8
2590STA &75
2600LDA &76
2610EOR #&10
2620STA &76
2630.b7z
2640ROL &76
2650ROL &75
2660DEX
2670BNE crc_loop
2680RTS
2690.escape
2700LDA &FF
2710BMI error
2720RTS
2730.error
2740LDA #&7E
2750JSR osbyte        \ acknowledge escape
2760LDX #0
2770LDY #0
2780LDA #0
2790JSR &FFCE         \ close all files
2800BRK
2810]
2820?P% = &11
2830P%  = P% + 1
2840$P% = "Escape" + CHR$0
2850NEXT opt%
*OPT 1,2
RUN
CALL go
00000000  4d 4f 44 45 20 37 0d 32  30 52 45 4d 0d 33 30 52  |MODE 7.20REM.30R|
00000010  45 4d 20 42 42 43 20 65  6e 64 20 6f 66 20 21 42  |EM BBC end of !B|
00000020  42 43 54 61 70 65 20 61  70 70 6c 69 63 61 74 69  |BCTape applicati|
00000030  6f 6e 0d 34 30 52 45 4d  0d 35 30 52 45 4d 20 28  |on.40REM.50REM (|
00000040  43 29 20 53 2e 20 42 75  72 6b 65 2c 20 32 36 2f  |C) S. Burke, 26/|
00000050  32 2f 39 31 0d 36 30 52  45 4d 0d 37 30 52 45 4d  |2/91.60REM.70REM|
00000060  20 54 68 65 20 6e 65 78  74 20 66 65 77 20 6c 69  | The next few li|
00000070  6e 65 73 20 64 65 66 69  6e 65 20 77 68 65 72 65  |nes define where|
00000080  20 74 68 65 20 62 75 66  66 65 72 73 20 61 72 65  | the buffers are|
00000090  2c 20 77 68 65 72 65 20  74 68 65 0d 38 30 52 45  |, where the.80RE|
000000a0  4d 20 63 6f 64 65 20 67  6f 65 73 20 61 6e 64 20  |M code goes and |
000000b0  77 68 65 72 65 20 74 68  65 20 66 69 6c 65 20 6c  |where the file l|
000000c0  6f 61 64 73 20 74 6f 2e  0d 39 30 52 45 4d 0d 31  |oads to..90REM.1|
000000d0  30 30 52 45 4d 20 54 68  69 73 20 76 65 72 73 69  |00REM This versi|
000000e0  6f 6e 20 6d 69 67 68 74  20 77 6f 72 6b 20 77 69  |on might work wi|
000000f0  74 68 20 64 69 73 63 73  2c 20 62 75 74 20 49 20  |th discs, but I |
00000100  63 61 6e 27 74 20 74 65  73 74 20 69 74 21 0d 31  |can't test it!.1|
00000110  31 30 52 45 4d 20 49 74  20 66 69 74 73 20 69 6e  |10REM It fits in|
00000120  20 70 61 67 65 73 20 42  20 61 6e 64 20 43 20 77  | pages B and C w|
00000130  69 74 68 20 30 20 62 79  74 65 73 20 73 70 61 72  |ith 0 bytes spar|
00000140  65 21 0d 31 32 30 52 45  4d 0d 31 33 30 3a 0d 31  |e!.120REM.130:.1|
00000150  34 30 6e 61 6d 65 20 20  20 20 20 20 20 3d 20 26  |40name       = &|
00000160  30 42 30 30 0d 31 35 30  6e 61 6d 65 5f 68 69 67  |0B00.150name_hig|
00000170  68 20 20 3d 20 26 30 42  0d 31 36 30 6e 61 6d 65  |h  = &0B.160name|
00000180  5f 6c 6f 77 20 20 20 3d  20 26 30 30 0d 31 37 30  |_low   = &00.170|
00000190  62 6c 6f 63 6b 20 20 20  20 20 20 3d 20 26 30 42  |block      = &0B|
000001a0  31 30 0d 31 38 30 62 6c  6f 63 6b 5f 68 69 67 68  |10.180block_high|
000001b0  20 3d 20 26 30 42 0d 31  39 30 62 6c 6f 63 6b 5f  | = &0B.190block_|
000001c0  6c 6f 77 20 20 3d 20 26  31 30 0d 32 30 30 63 6f  |low  = &10.200co|
000001d0  64 65 5f 73 74 61 72 74  20 3d 20 26 30 42 33 30  |de_start = &0B30|
000001e0  0d 32 31 30 6c 6f 61 64  5f 70 61 67 65 20 20 3d  |.210load_page  =|
000001f0  20 50 41 47 45 20 44 49  56 20 26 31 30 30 0d 32  | PAGE DIV &100.2|
00000200  32 30 3a 0d 32 33 30 6f  73 66 69 6e 64 20 3d 20  |20:.230osfind = |
00000210  26 46 46 43 45 0d 32 34  30 6f 73 62 67 65 74 20  |&FFCE.240osbget |
00000220  3d 20 26 46 46 44 37 0d  32 35 30 6f 73 66 69 6c  |= &FFD7.250osfil|
00000230  65 20 3d 20 26 46 46 44  44 20 20 3a 52 45 4d 20  |e = &FFDD  :REM |
00000240  50 61 67 65 20 33 33 35  20 6f 66 20 74 68 65 20  |Page 335 of the |
00000250  41 64 76 61 6e 63 65 64  20 55 73 65 72 20 47 75  |Advanced User Gu|
00000260  69 64 65 20 69 73 20 77  72 6f 6e 67 21 0d 32 36  |ide is wrong!.26|
00000270  30 6f 73 62 79 74 65 20  3d 20 26 46 46 46 34 0d  |0osbyte = &FFF4.|
00000280  32 37 30 3a 0d 32 38 30  46 4f 52 20 6f 70 74 25  |270:.280FOR opt%|
00000290  3d 30 20 54 4f 20 33 20  53 54 45 50 20 33 0d 32  |=0 TO 3 STEP 3.2|
000002a0  39 30 50 25 20 3d 20 63  6f 64 65 5f 73 74 61 72  |90P% = code_star|
000002b0  74 0d 33 30 30 5b 4f 50  54 20 6f 70 74 25 0d 33  |t.300[OPT opt%.3|
000002c0  31 30 2e 67 6f 0d 33 32  30 4c 44 58 20 23 30 0d  |10.go.320LDX #0.|
000002d0  33 33 30 4c 44 41 20 23  32 0d 33 34 30 4a 53 52  |330LDA #2.340JSR|
000002e0  20 6f 73 62 79 74 65 20  20 20 20 20 20 20 20 5c  | osbyte        \|
000002f0  20 64 69 73 61 62 6c 65  20 52 53 34 32 33 0d 33  | disable RS423.3|
00000300  35 30 4c 44 58 20 23 30  0d 33 36 30 4c 44 41 20  |50LDX #0.360LDA |
00000310  23 31 35 0d 33 37 30 4a  53 52 20 6f 73 62 79 74  |#15.370JSR osbyt|
00000320  65 20 20 20 20 20 20 20  20 5c 20 66 6c 75 73 68  |e        \ flush|
00000330  20 61 6c 6c 20 62 75 66  66 65 72 73 0d 33 38 30  | all buffers.380|
00000340  4c 44 58 20 23 32 0d 33  39 30 54 58 41 0d 34 30  |LDX #2.390TXA.40|
00000350  30 4a 53 52 20 6f 73 62  79 74 65 20 20 20 20 20  |0JSR osbyte     |
00000360  20 20 20 5c 20 65 6e 61  62 6c 65 20 52 53 34 32  |   \ enable RS42|
00000370  33 20 72 65 63 65 69 76  65 0d 34 31 30 2e 6d 61  |3 receive.410.ma|
00000380  69 6e 6c 6f 6f 70 0d 34  32 30 4c 44 41 20 23 26  |inloop.420LDA #&|
00000390  30 44 0d 34 33 30 53 54  41 20 6e 61 6d 65 20 20  |0D.430STA name  |
000003a0  20 20 20 20 20 20 20 20  5c 20 6e 75 6c 6c 20 6e  |        \ null n|
000003b0  61 6d 65 0d 34 34 30 4a  53 52 20 68 61 6e 64 73  |ame.440JSR hands|
000003c0  68 61 6b 65 0d 34 35 30  3a 0d 34 36 30 4a 53 52  |hake.450:.460JSR|
000003d0  20 67 65 74 20 20 20 20  20 20 20 20 20 20 20 5c  | get           \|
000003e0  20 67 65 74 20 63 6f 6d  6d 61 6e 64 0d 34 37 30  | get command.470|
000003f0  43 50 59 20 23 26 43 30  0d 34 38 30 42 45 51 20  |CPY #&C0.480BEQ |
00000400  65 6e 64 20 20 20 20 20  20 20 20 20 20 20 5c 20  |end           \ |
00000410  71 75 69 74 0d 34 39 30  3a 0d 35 30 30 43 50 59  |quit.490:.500CPY|
00000420  20 23 26 33 30 0d 35 31  30 42 4e 45 20 6c 6f 61  | #&30.510BNE loa|
00000430  64 0d 35 32 30 4a 53 52  20 70 75 74 5f 6f 6b 20  |d.520JSR put_ok |
00000440  20 20 20 20 20 20 20 5c  20 63 6f 6e 66 69 72 6d  |       \ confirm|
00000450  20 63 6f 6d 6d 61 6e 64  0d 35 33 30 4a 53 52 20  | command.530JSR |
00000460  67 65 74 5f 6e 61 6d 65  20 20 20 20 20 20 5c 20  |get_name      \ |
00000470  67 65 74 20 66 69 6c 65  6e 61 6d 65 0d 35 34 30  |get filename.540|
00000480  4a 53 52 20 68 61 6e 64  73 68 61 6b 65 0d 35 35  |JSR handshake.55|
00000490  30 4a 53 52 20 67 65 74  0d 35 36 30 2e 6c 6f 61  |0JSR get.560.loa|
000004a0  64 0d 35 37 30 43 50 59  20 23 26 30 43 0d 35 38  |d.570CPY #&0C.58|
000004b0  30 42 4e 45 20 6c 6f 61  64 5f 62 79 74 65 0d 35  |0BNE load_byte.5|
000004c0  39 30 4a 53 52 20 70 75  74 5f 6f 6b 20 20 20 20  |90JSR put_ok    |
000004d0  20 20 20 20 5c 20 63 6f  6e 66 69 72 6d 20 63 6f  |    \ confirm co|
000004e0  6d 6d 61 6e 64 0d 36 30  30 4a 53 52 20 6c 6f 61  |mmand.600JSR loa|
000004f0  64 5f 66 69 6c 65 0d 36  31 30 4a 53 52 20 73 65  |d_file.610JSR se|
00000500  6e 64 5f 66 69 6c 65 0d  36 32 30 4a 4d 50 20 6d  |nd_file.620JMP m|
00000510  61 69 6e 6c 6f 6f 70 0d  36 33 30 2e 6c 6f 61 64  |ainloop.630.load|
00000520  5f 62 79 74 65 0d 36 34  30 43 50 59 20 23 26 30  |_byte.640CPY #&0|
00000530  33 0d 36 35 30 42 4e 45  20 63 6f 6d 6d 61 6e 64  |3.650BNE command|
00000540  5f 65 72 72 6f 72 0d 36  36 30 4a 53 52 20 70 75  |_error.660JSR pu|
00000550  74 5f 6f 6b 20 20 20 20  20 20 20 20 5c 20 63 6f  |t_ok        \ co|
00000560  6e 66 69 72 6d 20 63 6f  6d 6d 61 6e 64 0d 36 37  |nfirm command.67|
00000570  30 4a 53 52 20 6c 6f 61  64 5f 66 69 6c 65 0d 36  |0JSR load_file.6|
00000580  38 30 4a 53 52 20 73 65  6e 64 5f 66 69 6c 65 0d  |80JSR send_file.|
00000590  36 39 30 4a 4d 50 20 6d  61 69 6e 6c 6f 6f 70 0d  |690JMP mainloop.|
000005a0  37 30 30 2e 63 6f 6d 6d  61 6e 64 5f 65 72 72 6f  |700.command_erro|
000005b0  72 0d 37 31 30 4c 44 41  20 23 30 0d 37 32 30 4a  |r.710LDA #0.720J|
000005c0  53 52 20 70 75 74 20 20  20 20 20 20 20 20 20 20  |SR put          |
000005d0  20 5c 20 63 6f 6d 6d 61  6e 64 20 65 72 72 6f 72  | \ command error|
000005e0  0d 37 33 30 4a 4d 50 20  6d 61 69 6e 6c 6f 6f 70  |.730JMP mainloop|
000005f0  0d 37 34 30 2e 65 6e 64  0d 37 35 30 52 54 53 0d  |.740.end.750RTS.|
00000600  37 36 30 2e 6c 6f 61 64  5f 66 69 6c 65 0d 37 37  |760.load_file.77|
00000610  30 4c 44 41 20 23 6e 61  6d 65 5f 6c 6f 77 20 20  |0LDA #name_low  |
00000620  20 20 20 5c 20 73 65 74  20 75 70 20 70 61 72 61  |   \ set up para|
00000630  6d 65 74 65 72 20 62 6c  6f 63 6b 0d 37 38 30 53  |meter block.780S|
00000640  54 41 20 62 6c 6f 63 6b  0d 37 39 30 4c 44 41 20  |TA block.790LDA |
00000650  23 6e 61 6d 65 5f 68 69  67 68 0d 38 30 30 53 54  |#name_high.800ST|
00000660  41 20 62 6c 6f 63 6b 2b  31 0d 38 31 30 4c 44 41  |A block+1.810LDA|
00000670  20 23 30 0d 38 32 30 53  54 41 20 62 6c 6f 63 6b  | #0.820STA block|
00000680  2b 32 0d 38 33 30 53 54  41 20 62 6c 6f 63 6b 2b  |+2.830STA block+|
00000690  36 0d 38 34 30 4c 44 41  20 23 6c 6f 61 64 5f 70  |6.840LDA #load_p|
000006a0  61 67 65 0d 38 35 30 53  54 41 20 62 6c 6f 63 6b  |age.850STA block|
000006b0  2b 33 0d 38 36 30 4c 44  41 20 23 26 46 46 0d 38  |+3.860LDA #&FF.8|
000006c0  37 30 53 54 41 20 62 6c  6f 63 6b 2b 34 0d 38 38  |70STA block+4.88|
000006d0  30 53 54 41 20 62 6c 6f  63 6b 2b 35 0d 38 39 30  |0STA block+5.890|
000006e0  4c 44 58 20 23 62 6c 6f  63 6b 5f 6c 6f 77 0d 39  |LDX #block_low.9|
000006f0  30 30 4c 44 59 20 23 62  6c 6f 63 6b 5f 68 69 67  |00LDY #block_hig|
00000700  68 0d 39 31 30 4a 53 52  20 6f 73 66 69 6c 65 20  |h.910JSR osfile |
00000710  20 20 20 20 20 20 20 5c  20 6c 6f 61 64 20 66 69  |       \ load fi|
00000720  6c 65 0d 39 32 30 4c 44  41 20 62 6c 6f 63 6b 2b  |le.920LDA block+|
00000730  31 30 0d 39 33 30 53 54  41 20 26 37 31 0d 39 34  |10.930STA &71.94|
00000740  30 4c 44 41 20 62 6c 6f  63 6b 2b 31 31 0d 39 35  |0LDA block+11.95|
00000750  30 53 54 41 20 26 37 32  20 20 20 20 20 20 20 20  |0STA &72        |
00000760  20 20 20 5c 20 70 75 74  20 66 69 6c 65 20 6c 65  |   \ put file le|
00000770  6e 67 74 68 20 69 6e 20  26 37 31 2c 20 26 37 32  |ngth in &71, &72|
00000780  0d 39 36 30 4a 53 52 20  72 65 61 64 5f 6c 6f 61  |.960JSR read_loa|
00000790  64 5f 65 78 65 63 5c 20  67 65 74 20 6c 6f 61 64  |d_exec\ get load|
000007a0  2f 65 78 65 63 20 61 64  64 72 65 73 73 20 61 6e  |/exec address an|
000007b0  64 20 6e 61 6d 65 0d 39  37 30 2e 72 65 61 64 5f  |d name.970.read_|
000007c0  6e 61 6d 65 0d 39 38 30  4c 44 58 20 23 26 46 46  |name.980LDX #&FF|
000007d0  0d 39 39 30 2e 6e 61 6d  65 6c 6f 6f 70 0d 31 30  |.990.nameloop.10|
000007e0  30 30 49 4e 58 0d 31 30  31 30 43 50 58 20 23 26  |00INX.1010CPX #&|
000007f0  43 0d 31 30 32 30 42 45  51 20 74 6f 6f 5f 66 61  |C.1020BEQ too_fa|
00000800  72 0d 31 30 33 30 5c 20  20 20 20 20 20 20 20 20  |r.1030\         |
00000810  4c 44 41 20 26 33 42 32  2c 58 20 20 20 20 20 20  |LDA &3B2,X      |
00000820  20 20 21 20 70 75 6c 6c  20 66 69 6c 65 6e 61 6d  |  ! pull filenam|
00000830  65 20 6f 75 74 20 6f 66  20 63 61 73 73 65 74 74  |e out of cassett|
00000840  65 20 77 6f 72 6b 73 70  61 63 65 0d 31 30 34 30  |e workspace.1040|
00000850  4c 44 41 20 23 30 20 20  20 20 20 20 20 20 20 20  |LDA #0          |
00000860  20 20 5c 20 64 6f 6e 27  74 20 6b 6e 6f 77 20 77  |  \ don't know w|
00000870  68 65 72 65 20 74 6f 20  67 65 74 20 69 74 20 66  |here to get it f|
00000880  6f 72 20 61 20 64 69 73  63 20 73 79 73 74 65 6d  |or a disc system|
00000890  0d 31 30 35 30 53 54 41  20 6e 61 6d 65 2c 58 20  |.1050STA name,X |
000008a0  20 20 20 20 20 20 20 5c  20 73 65 65 20 41 55 47  |       \ see AUG|
000008b0  20 70 2e 20 32 37 39 0d  31 30 36 30 42 4e 45 20  | p. 279.1060BNE |
000008c0  6e 61 6d 65 6c 6f 6f 70  0d 31 30 37 30 2e 74 6f  |nameloop.1070.to|
000008d0  6f 5f 66 61 72 0d 31 30  38 30 4c 44 41 20 23 26  |o_far.1080LDA #&|
000008e0  30 44 0d 31 30 39 30 53  54 41 20 6e 61 6d 65 2c  |0D.1090STA name,|
000008f0  58 0d 31 31 30 30 52 54  53 0d 31 31 31 30 2e 67  |X.1100RTS.1110.g|
00000900  65 74 5f 6e 61 6d 65 0d  31 31 32 30 4c 44 58 20  |et_name.1120LDX |
00000910  23 26 46 46 0d 31 31 33  30 53 54 58 20 26 38 31  |#&FF.1130STX &81|
00000920  20 20 20 20 20 20 20 20  20 20 20 5c 20 22 67 65  |           \ "ge|
00000930  74 22 20 63 6f 72 72 75  70 74 73 20 72 65 67 69  |t" corrupts regi|
00000940  73 74 65 72 73 0d 31 31  34 30 2e 67 65 74 5f 63  |sters.1140.get_c|
00000950  68 61 72 0d 31 31 35 30  43 50 58 20 23 26 42 0d  |har.1150CPX #&B.|
00000960  31 31 36 30 42 45 51 20  74 6f 6f 5f 66 61 72 0d  |1160BEQ too_far.|
00000970  31 31 37 30 4a 53 52 20  67 65 74 20 20 20 20 20  |1170JSR get     |
00000980  20 20 20 20 20 20 5c 20  67 65 74 20 66 69 6c 65  |      \ get file|
00000990  6e 61 6d 65 20 66 72 6f  6d 20 41 72 63 0d 31 31  |name from Arc.11|
000009a0  38 30 54 59 41 0d 31 31  39 30 49 4e 43 20 26 38  |80TYA.1190INC &8|
000009b0  31 20 20 20 0d 31 32 30  30 4c 44 58 20 26 38 31  |1   .1200LDX &81|
000009c0  0d 31 32 31 30 53 54 41  20 6e 61 6d 65 2c 58 0d  |.1210STA name,X.|
000009d0  31 32 32 30 43 4d 50 20  23 26 30 44 0d 31 32 33  |1220CMP #&0D.123|
000009e0  30 42 4e 45 20 67 65 74  5f 63 68 61 72 0d 31 32  |0BNE get_char.12|
000009f0  34 30 52 54 53 0d 31 32  35 30 2e 72 65 61 64 5f  |40RTS.1250.read_|
00000a00  6c 6f 61 64 5f 65 78 65  63 0d 31 32 36 30 4c 44  |load_exec.1260LD|
00000a10  58 20 23 38 0d 31 32 37  30 2e 6c 6f 61 64 5f 65  |X #8.1270.load_e|
00000a20  78 65 63 5f 6c 6f 6f 70  0d 31 32 38 30 4c 44 41  |xec_loop.1280LDA|
00000a30  20 26 33 42 44 2c 58 20  20 20 20 20 20 20 20 5c  | &3BD,X        \|
00000a40  20 6c 6f 61 64 2f 65 78  65 63 20 61 64 64 72 65  | load/exec addre|
00000a50  73 73 20 66 72 6f 6d 20  63 61 73 73 65 74 74 65  |ss from cassette|
00000a60  20 77 6f 72 6b 73 70 61  63 65 0d 31 32 39 30 53  | workspace.1290S|
00000a70  54 41 20 26 38 31 2c 58  0d 31 33 30 30 44 45 58  |TA &81,X.1300DEX|
00000a80  0d 31 33 31 30 42 4e 45  20 6c 6f 61 64 5f 65 78  |.1310BNE load_ex|
00000a90  65 63 5f 6c 6f 6f 70 0d  31 33 32 30 52 54 53 0d  |ec_loop.1320RTS.|
00000aa0  31 33 33 30 2e 68 61 6e  64 73 68 61 6b 65 0d 31  |1330.handshake.1|
00000ab0  33 34 30 4c 44 41 20 23  41 53 43 28 22 53 22 29  |340LDA #ASC("S")|
00000ac0  0d 31 33 35 30 4a 53 52  20 70 75 74 0d 31 33 36  |.1350JSR put.136|
00000ad0  30 4c 44 41 20 23 41 53  43 28 22 42 22 29 0d 31  |0LDA #ASC("B").1|
00000ae0  33 37 30 4a 53 52 20 70  75 74 20 20 20 20 20 20  |370JSR put      |
00000af0  20 20 20 20 20 5c 20 73  65 6e 64 20 22 53 42 22  |     \ send "SB"|
00000b00  20 2e 2e 2e 0d 31 33 38  30 4a 53 52 20 67 65 74  | ....1380JSR get|
00000b10  0d 31 33 39 30 43 50 59  20 23 41 53 43 28 22 73  |.1390CPY #ASC("s|
00000b20  22 29 0d 31 34 30 30 42  4e 45 20 68 61 6e 64 73  |").1400BNE hands|
00000b30  68 61 6b 65 0d 31 34 31  30 4a 53 52 20 67 65 74  |hake.1410JSR get|
00000b40  0d 31 34 32 30 43 50 59  20 23 41 53 43 28 22 62  |.1420CPY #ASC("b|
00000b50  22 29 0d 31 34 33 30 42  4e 45 20 68 61 6e 64 73  |").1430BNE hands|
00000b60  68 61 6b 65 20 20 20 20  20 5c 20 2e 2e 2e 20 61  |hake     \ ... a|
00000b70  6e 64 20 72 65 63 65 69  76 65 20 22 73 62 22 20  |nd receive "sb" |
00000b80  74 6f 20 68 61 6e 64 73  68 61 6b 65 0d 31 34 34  |to handshake.144|
00000b90  30 52 54 53 0d 31 34 35  30 2e 73 65 6e 64 5f 66  |0RTS.1450.send_f|
00000ba0  69 6c 65 0d 31 34 36 30  4c 44 41 20 26 37 31 0d  |ile.1460LDA &71.|
00000bb0  31 34 37 30 4a 53 52 20  70 75 74 0d 31 34 38 30  |1470JSR put.1480|
00000bc0  4c 44 41 20 26 37 32 0d  31 34 39 30 4a 53 52 20  |LDA &72.1490JSR |
00000bd0  70 75 74 20 20 20 20 20  20 20 20 20 20 20 5c 20  |put           \ |
00000be0  73 65 6e 64 20 66 69 6c  65 20 6c 65 6e 67 74 68  |send file length|
00000bf0  0d 31 35 30 30 3a 0d 31  35 31 30 4c 44 41 20 23  |.1500:.1510LDA #|
00000c00  6c 6f 61 64 5f 70 61 67  65 0d 31 35 32 30 53 54  |load_page.1520ST|
00000c10  41 20 26 37 34 0d 31 35  33 30 4c 44 41 20 23 30  |A &74.1530LDA #0|
00000c20  20 0d 31 35 34 30 53 54  41 20 26 37 33 20 20 20  | .1540STA &73   |
00000c30  20 20 20 20 20 20 20 20  5c 20 72 65 73 65 74 20  |        \ reset |
00000c40  6c 6f 61 64 20 61 64 64  72 65 73 73 0d 31 35 35  |load address.155|
00000c50  30 44 45 43 20 26 37 32  20 20 20 20 20 20 20 20  |0DEC &72        |
00000c60  20 20 20 5c 20 6e 65 65  64 20 74 68 69 73 20 66  |   \ need this f|
00000c70  6f 72 20 74 65 73 74 20  62 65 6c 6f 77 0d 31 35  |or test below.15|
00000c80  36 30 42 4d 49 20 6c 61  73 74 5f 62 6c 6f 63 6b  |60BMI last_block|
00000c90  20 20 20 20 5c 20 66 69  6c 65 20 6c 65 6e 67 74  |    \ file lengt|
00000ca0  68 20 3c 20 32 35 36 20  62 79 74 65 73 3f 0d 31  |h < 256 bytes?.1|
00000cb0  35 37 30 53 54 41 20 26  38 30 20 20 20 20 20 20  |570STA &80      |
00000cc0  20 20 20 20 20 5c 20 62  6c 6f 63 6b 20 6c 65 6e  |     \ block len|
00000cd0  67 74 68 20 3d 20 30 20  28 20 3d 20 32 35 36 29  |gth = 0 ( = 256)|
00000ce0  0d 31 35 38 30 2e 73 65  6e 64 5f 62 6c 6f 63 6b  |.1580.send_block|
00000cf0  0d 31 35 39 30 4a 53 52  20 70 75 74 5f 6f 6b 20  |.1590JSR put_ok |
00000d00  20 20 20 20 20 20 20 5c  20 6e 6f 74 20 65 6f 66  |       \ not eof|
00000d10  0d 31 36 30 30 4c 44 41  20 23 33 20 20 20 20 20  |.1600LDA #3     |
00000d20  20 20 20 20 20 20 20 5c  20 73 65 6e 64 20 6c 65  |       \ send le|
00000d30  6e 67 74 68 20 33 20 74  69 6d 65 73 0d 31 36 31  |ngth 3 times.161|
00000d40  30 53 54 41 20 26 37 36  20 20 20 20 20 20 20 20  |0STA &76        |
00000d50  20 20 20 5c 20 75 73 65  20 43 52 43 20 6c 6f 77  |   \ use CRC low|
00000d60  20 62 79 74 65 20 61 73  20 63 6f 75 6e 74 65 72  | byte as counter|
00000d70  0d 31 36 32 30 2e 6c 65  6e 6f 75 74 0d 31 36 33  |.1620.lenout.163|
00000d80  30 4c 44 41 20 26 38 30  0d 31 36 34 30 4a 53 52  |0LDA &80.1640JSR|
00000d90  20 70 75 74 20 20 20 20  20 20 20 20 20 20 20 5c  | put           \|
00000da0  20 6f 75 74 70 75 74 20  62 6c 6f 63 6b 20 6c 65  | output block le|
00000db0  6e 67 74 68 0d 31 36 35  30 44 45 43 20 26 37 36  |ngth.1650DEC &76|
00000dc0  0d 31 36 36 30 42 4e 45  20 6c 65 6e 6f 75 74 20  |.1660BNE lenout |
00000dd0  20 20 20 20 20 20 20 5c  20 43 52 43 20 6c 6f 77  |       \ CRC low|
00000de0  20 62 79 74 65 20 7a 65  72 6f 20 61 74 20 65 78  | byte zero at ex|
00000df0  69 74 0d 31 36 37 30 4c  44 59 20 23 30 0d 31 36  |it.1670LDY #0.16|
00000e00  38 30 53 54 59 20 26 37  35 20 20 20 20 20 20 20  |80STY &75       |
00000e10  20 20 20 20 5c 20 69 6e  69 74 69 61 6c 69 73 65  |    \ initialise|
00000e20  20 43 52 43 20 68 69 67  68 20 62 79 74 65 0d 31  | CRC high byte.1|
00000e30  36 39 30 2e 73 65 6e 64  5f 62 79 74 65 0d 31 37  |690.send_byte.17|
00000e40  30 30 53 54 59 20 26 37  30 20 20 20 20 20 20 20  |00STY &70       |
00000e50  20 20 20 20 5c 20 73 61  76 65 20 6f 66 66 73 65  |    \ save offse|
00000e60  74 0d 31 37 31 30 4c 44  41 20 28 26 37 33 29 2c  |t.1710LDA (&73),|
00000e70  59 20 20 20 20 20 20 20  5c 20 6c 6f 61 64 20 6e  |Y       \ load n|
00000e80  65 78 74 20 62 79 74 65  20 2e 2e 2e 0d 31 37 32  |ext byte ....172|
00000e90  30 50 48 41 0d 31 37 33  30 4a 53 52 20 70 75 74  |0PHA.1730JSR put|
00000ea0  0d 31 37 34 30 50 4c 41  20 20 20 20 20 20 20 20  |.1740PLA        |
00000eb0  20 20 20 20 20 20 20 5c  20 67 65 74 20 63 68 61  |       \ get cha|
00000ec0  72 61 63 74 65 72 20 62  61 63 6b 0d 31 37 35 30  |racter back.1750|
00000ed0  4a 53 52 20 63 72 63 20  20 20 20 20 20 20 20 20  |JSR crc         |
00000ee0  20 20 5c 20 75 70 64 61  74 65 20 63 72 63 0d 31  |  \ update crc.1|
00000ef0  37 36 30 4c 44 59 20 26  37 30 0d 31 37 37 30 49  |760LDY &70.1770I|
00000f00  4e 59 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |NY              |
00000f10  20 5c 20 69 6e 63 72 65  6d 65 6e 74 20 6f 66 66  | \ increment off|
00000f20  73 65 74 0d 31 37 38 30  43 50 59 20 26 38 30 0d  |set.1780CPY &80.|
00000f30  31 37 39 30 42 4e 45 20  73 65 6e 64 5f 62 79 74  |1790BNE send_byt|
00000f40  65 20 20 20 20 20 5c 20  65 6e 64 20 6f 66 20 62  |e     \ end of b|
00000f50  6c 6f 63 6b 3f 0d 31 38  30 30 3a 0d 31 38 31 30  |lock?.1800:.1810|
00000f60  4c 44 41 20 26 37 35 0d  31 38 32 30 4a 53 52 20  |LDA &75.1820JSR |
00000f70  70 75 74 20 20 20 20 20  20 20 20 20 20 20 5c 20  |put           \ |
00000f80  6f 75 74 70 75 74 20 43  52 43 20 68 69 67 68 20  |output CRC high |
00000f90  62 79 74 65 0d 31 38 33  30 4c 44 41 20 26 37 36  |byte.1830LDA &76|
00000fa0  0d 31 38 34 30 4a 53 52  20 70 75 74 20 20 20 20  |.1840JSR put    |
00000fb0  20 20 20 20 20 20 20 5c  20 6f 75 74 70 75 74 20  |       \ output |
00000fc0  43 52 43 20 6c 6f 77 20  62 79 74 65 0d 31 38 35  |CRC low byte.185|
00000fd0  30 3a 0d 31 38 36 30 4a  53 52 20 67 65 74 20 20  |0:.1860JSR get  |
00000fe0  20 20 20 20 20 20 20 20  20 5c 20 6c 6f 6f 6b 20  |         \ look |
00000ff0  66 6f 72 20 63 6f 6e 66  69 72 6d 61 74 69 6f 6e  |for confirmation|
00001000  0d 31 38 37 30 54 59 41  0d 31 38 38 30 42 45 51  |.1870TYA.1880BEQ|
00001010  20 73 65 6e 64 5f 62 6c  6f 63 6b 20 20 20 20 5c  | send_block    \|
00001020  20 7a 65 72 6f 20 6d 65  61 6e 73 20 65 72 72 6f  | zero means erro|
00001030  72 2c 20 73 6f 20 64 6f  20 61 67 61 69 6e 0d 31  |r, so do again.1|
00001040  38 39 30 3a 0d 31 39 30  30 49 4e 43 20 26 37 34  |890:.1900INC &74|
00001050  20 20 20 20 20 20 20 20  20 20 20 5c 20 69 6e 63  |           \ inc|
00001060  72 65 6d 65 6e 74 20 61  64 64 72 65 73 73 20 68  |rement address h|
00001070  69 67 68 20 62 79 74 65  0d 31 39 31 30 44 45 43  |igh byte.1910DEC|
00001080  20 26 37 32 20 20 20 20  20 20 20 20 20 20 20 5c  | &72           \|
00001090  20 64 65 63 72 65 6d 65  6e 74 20 6c 65 6e 67 74  | decrement lengt|
000010a0  68 20 68 69 67 68 20 62  79 74 65 0d 31 39 32 30  |h high byte.1920|
000010b0  42 50 4c 20 73 65 6e 64  5f 62 6c 6f 63 6b 20 20  |BPL send_block  |
000010c0  20 20 5c 20 61 72 65 20  77 65 20 66 69 6e 69 73  |  \ are we finis|
000010d0  68 65 64 3f 0d 31 39 33  30 2e 6c 61 73 74 5f 62  |hed?.1930.last_b|
000010e0  6c 6f 63 6b 0d 31 39 34  30 4c 44 59 20 23 30 0d  |lock.1940LDY #0.|
000010f0  31 39 35 30 4c 44 41 20  26 37 31 20 20 20 20 20  |1950LDA &71     |
00001100  20 20 20 20 20 20 5c 20  6c 65 6e 67 74 68 20 6f  |      \ length o|
00001110  66 20 6c 61 73 74 20 62  6c 6f 63 6b 0d 31 39 36  |f last block.196|
00001120  30 53 54 59 20 26 37 31  20 20 20 20 20 20 20 20  |0STY &71        |
00001130  20 20 20 5c 20 73 65 74  20 6c 65 6e 67 74 68 20  |   \ set length |
00001140  74 6f 20 7a 65 72 6f 0d  31 39 37 30 53 54 41 20  |to zero.1970STA |
00001150  26 38 30 0d 31 39 38 30  42 4e 45 20 73 65 6e 64  |&80.1980BNE send|
00001160  5f 62 6c 6f 63 6b 20 20  20 20 5c 20 6f 75 74 70  |_block    \ outp|
00001170  75 74 20 69 66 20 6e 6f  6e 2d 7a 65 72 6f 0d 31  |ut if non-zero.1|
00001180  39 39 30 4c 44 41 20 23  30 0d 32 30 30 30 4a 53  |990LDA #0.2000JS|
00001190  52 20 70 75 74 20 20 20  20 20 20 20 20 20 20 20  |R put           |
000011a0  5c 20 7a 65 72 6f 20 6d  61 72 6b 73 20 65 6f 66  |\ zero marks eof|
000011b0  0d 32 30 31 30 4a 53 52  20 70 75 74 5f 6c 6f 61  |.2010JSR put_loa|
000011c0  64 5f 65 78 65 63 20 5c  20 73 65 6e 64 20 74 68  |d_exec \ send th|
000011d0  65 20 6c 6f 61 64 2f 65  78 65 63 20 61 64 72 65  |e load/exec adre|
000011e0  73 73 0d 32 30 32 30 2e  70 75 74 5f 6e 61 6d 65  |ss.2020.put_name|
000011f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001200  20 20 20 5c 20 66 61 6c  6c 20 74 68 72 6f 75 67  |   \ fall throug|
00001210  68 20 74 6f 20 70 75 74  5f 6e 61 6d 65 20 2e 2e  |h to put_name ..|
00001220  2e 0d 32 30 33 30 4c 44  58 20 23 26 46 46 0d 32  |..2030LDX #&FF.2|
00001230  30 34 30 53 54 58 20 26  38 31 20 20 20 20 20 20  |040STX &81      |
00001240  20 20 20 20 20 5c 20 22  70 75 74 22 20 63 6f 72  |     \ "put" cor|
00001250  72 75 70 74 73 20 72 65  67 69 73 74 65 72 73 0d  |rupts registers.|
00001260  32 30 35 30 2e 70 75 74  5f 63 68 61 72 20 20 20  |2050.put_char   |
00001270  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001280  5c 20 6f 75 74 70 75 74  20 66 69 6c 65 20 6e 61  |\ output file na|
00001290  6d 65 0d 32 30 36 30 49  4e 43 20 26 38 31 0d 32  |me.2060INC &81.2|
000012a0  30 37 30 4c 44 58 20 26  38 31 0d 32 30 38 30 4c  |070LDX &81.2080L|
000012b0  44 41 20 6e 61 6d 65 2c  58 0d 32 30 39 30 50 48  |DA name,X.2090PH|
000012c0  41 0d 32 31 30 30 4a 53  52 20 70 75 74 0d 32 31  |A.2100JSR put.21|
000012d0  31 30 50 4c 41 0d 32 31  32 30 43 4d 50 20 23 26  |10PLA.2120CMP #&|
000012e0  30 44 0d 32 31 33 30 42  4e 45 20 70 75 74 5f 63  |0D.2130BNE put_c|
000012f0  68 61 72 0d 32 31 34 30  52 54 53 0d 32 31 35 30  |har.2140RTS.2150|
00001300  2e 70 75 74 5f 6c 6f 61  64 5f 65 78 65 63 20 20  |.put_load_exec  |
00001310  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 70 75  |            \ pu|
00001320  74 20 6f 75 74 20 6c 6f  61 64 2f 65 78 65 63 20  |t out load/exec |
00001330  61 64 64 72 65 73 73 0d  32 31 36 30 4c 44 58 20  |address.2160LDX |
00001340  23 30 0d 32 31 37 30 53  54 58 20 26 38 31 20 20  |#0.2170STX &81  |
00001350  20 20 20 20 20 20 20 20  20 5c 20 22 70 75 74 22  |         \ "put"|
00001360  20 63 6f 72 72 75 70 74  73 20 72 65 67 69 73 74  | corrupts regist|
00001370  65 72 73 0d 32 31 38 30  2e 70 75 74 5f 6c 6f 61  |ers.2180.put_loa|
00001380  64 5f 65 78 65 63 5f 6c  6f 6f 70 0d 32 31 39 30  |d_exec_loop.2190|
00001390  4c 44 41 20 26 38 32 2c  58 0d 32 32 30 30 4a 53  |LDA &82,X.2200JS|
000013a0  52 20 70 75 74 0d 32 32  31 30 49 4e 43 20 26 38  |R put.2210INC &8|
000013b0  31 0d 32 32 32 30 4c 44  58 20 26 38 31 0d 32 32  |1.2220LDX &81.22|
000013c0  33 30 43 50 58 20 23 38  0d 32 32 34 30 42 4e 45  |30CPX #8.2240BNE|
000013d0  20 70 75 74 5f 6c 6f 61  64 5f 65 78 65 63 5f 6c  | put_load_exec_l|
000013e0  6f 6f 70 0d 32 32 35 30  52 54 53 0d 32 32 36 30  |oop.2250RTS.2260|
000013f0  2e 70 75 74 5f 6f 6b 0d  32 32 37 30 4c 44 41 20  |.put_ok.2270LDA |
00001400  23 26 46 46 0d 32 32 38  30 2e 70 75 74 0d 32 32  |#&FF.2280.put.22|
00001410  39 30 50 48 41 20 20 20  20 20 20 20 20 20 20 20  |90PHA           |
00001420  20 20 20 20 5c 20 73 61  76 65 20 76 61 6c 75 65  |    \ save value|
00001430  20 74 6f 20 6f 75 74 70  75 74 0d 32 33 30 30 4a  | to output.2300J|
00001440  53 52 20 65 73 63 61 70  65 0d 32 33 31 30 4c 44  |SR escape.2310LD|
00001450  58 20 23 26 46 44 0d 32  33 32 30 4c 44 41 20 23  |X #&FD.2320LDA #|
00001460  26 38 30 0d 32 33 33 30  4a 53 52 20 6f 73 62 79  |&80.2330JSR osby|
00001470  74 65 20 20 20 20 20 20  20 20 5c 20 67 65 74 20  |te        \ get |
00001480  23 20 65 6d 70 74 79 20  62 79 74 65 73 20 69 6e  |# empty bytes in|
00001490  20 52 53 34 32 33 20 6f  75 74 70 75 74 20 62 75  | RS423 output bu|
000014a0  66 66 65 72 0d 32 33 34  30 43 50 58 20 23 39 0d  |ffer.2340CPX #9.|
000014b0  32 33 35 30 50 4c 41 0d  32 33 36 30 42 43 43 20  |2350PLA.2360BCC |
000014c0  70 75 74 20 20 20 20 20  20 20 20 20 20 20 5c 20  |put           \ |
000014d0  69 66 20 3c 20 39 20 62  79 74 65 73 20 72 65 6d  |if < 9 bytes rem|
000014e0  61 69 6e 2c 20 77 61 69  74 20 2e 2e 2e 0d 32 33  |ain, wait ....23|
000014f0  37 30 3a 0d 32 33 38 30  4c 44 58 20 23 32 0d 32  |70:.2380LDX #2.2|
00001500  33 39 30 54 41 59 0d 32  34 30 30 4c 44 41 20 23  |390TAY.2400LDA #|
00001510  26 38 41 0d 32 34 31 30  4a 4d 50 20 6f 73 62 79  |&8A.2410JMP osby|
00001520  74 65 20 20 20 20 20 20  20 20 5c 20 2e 2e 2e 20  |te        \ ... |
00001530  61 6e 64 20 73 65 6e 64  20 69 74 0d 32 34 32 30  |and send it.2420|
00001540  2e 67 65 74 0d 32 34 33  30 4a 53 52 20 65 73 63  |.get.2430JSR esc|
00001550  61 70 65 0d 32 34 34 30  4c 44 58 20 23 31 0d 32  |ape.2440LDX #1.2|
00001560  34 35 30 4c 44 41 20 23  26 39 31 0d 32 34 36 30  |450LDA #&91.2460|
00001570  4a 53 52 20 6f 73 62 79  74 65 20 20 20 20 20 20  |JSR osbyte      |
00001580  20 20 5c 20 72 65 61 64  20 61 20 62 79 74 65 0d  |  \ read a byte.|
00001590  32 34 37 30 42 43 53 20  67 65 74 0d 32 34 38 30  |2470BCS get.2480|
000015a0  52 54 53 0d 32 34 39 30  2e 63 72 63 0d 32 35 30  |RTS.2490.crc.250|
000015b0  30 45 4f 52 20 26 37 35  20 20 20 20 20 20 20 20  |0EOR &75        |
000015c0  20 20 20 5c 20 63 61 6c  63 75 6c 61 74 65 20 43  |   \ calculate C|
000015d0  52 43 20 69 6e 20 26 37  35 2c 20 26 37 36 0d 32  |RC in &75, &76.2|
000015e0  35 31 30 53 54 41 20 26  37 35 20 20 20 20 20 20  |510STA &75      |
000015f0  20 20 20 20 20 5c 20 61  6c 67 6f 72 69 74 68 6d  |     \ algorithm|
00001600  20 66 72 6f 6d 20 41 64  76 61 6e 63 65 64 20 55  | from Advanced U|
00001610  73 65 72 20 47 75 69 64  65 0d 32 35 32 30 4c 44  |ser Guide.2520LD|
00001620  58 20 23 38 20 20 20 20  20 20 20 20 20 20 20 20  |X #8            |
00001630  5c 20 49 20 68 6f 70 65  20 69 74 27 73 20 72 69  |\ I hope it's ri|
00001640  67 68 74 21 0d 32 35 33  30 2e 63 72 63 5f 6c 6f  |ght!.2530.crc_lo|
00001650  6f 70 0d 32 35 34 30 4c  44 41 20 26 37 35 0d 32  |op.2540LDA &75.2|
00001660  35 35 30 52 4f 4c 20 41  0d 32 35 36 30 42 43 43  |550ROL A.2560BCC|
00001670  20 62 37 7a 0d 32 35 37  30 4c 44 41 20 26 37 35  | b7z.2570LDA &75|
00001680  0d 32 35 38 30 45 4f 52  20 23 38 0d 32 35 39 30  |.2580EOR #8.2590|
00001690  53 54 41 20 26 37 35 0d  32 36 30 30 4c 44 41 20  |STA &75.2600LDA |
000016a0  26 37 36 0d 32 36 31 30  45 4f 52 20 23 26 31 30  |&76.2610EOR #&10|
000016b0  0d 32 36 32 30 53 54 41  20 26 37 36 0d 32 36 33  |.2620STA &76.263|
000016c0  30 2e 62 37 7a 0d 32 36  34 30 52 4f 4c 20 26 37  |0.b7z.2640ROL &7|
000016d0  36 0d 32 36 35 30 52 4f  4c 20 26 37 35 0d 32 36  |6.2650ROL &75.26|
000016e0  36 30 44 45 58 0d 32 36  37 30 42 4e 45 20 63 72  |60DEX.2670BNE cr|
000016f0  63 5f 6c 6f 6f 70 0d 32  36 38 30 52 54 53 0d 32  |c_loop.2680RTS.2|
00001700  36 39 30 2e 65 73 63 61  70 65 0d 32 37 30 30 4c  |690.escape.2700L|
00001710  44 41 20 26 46 46 0d 32  37 31 30 42 4d 49 20 65  |DA &FF.2710BMI e|
00001720  72 72 6f 72 0d 32 37 32  30 52 54 53 0d 32 37 33  |rror.2720RTS.273|
00001730  30 2e 65 72 72 6f 72 0d  32 37 34 30 4c 44 41 20  |0.error.2740LDA |
00001740  23 26 37 45 0d 32 37 35  30 4a 53 52 20 6f 73 62  |#&7E.2750JSR osb|
00001750  79 74 65 20 20 20 20 20  20 20 20 5c 20 61 63 6b  |yte        \ ack|
00001760  6e 6f 77 6c 65 64 67 65  20 65 73 63 61 70 65 0d  |nowledge escape.|
00001770  32 37 36 30 4c 44 58 20  23 30 0d 32 37 37 30 4c  |2760LDX #0.2770L|
00001780  44 59 20 23 30 0d 32 37  38 30 4c 44 41 20 23 30  |DY #0.2780LDA #0|
00001790  0d 32 37 39 30 4a 53 52  20 26 46 46 43 45 20 20  |.2790JSR &FFCE  |
000017a0  20 20 20 20 20 20 20 5c  20 63 6c 6f 73 65 20 61  |       \ close a|
000017b0  6c 6c 20 66 69 6c 65 73  0d 32 38 30 30 42 52 4b  |ll files.2800BRK|
000017c0  0d 32 38 31 30 5d 0d 32  38 32 30 3f 50 25 20 3d  |.2810].2820?P% =|
000017d0  20 26 31 31 0d 32 38 33  30 50 25 20 20 3d 20 50  | &11.2830P%  = P|
000017e0  25 20 2b 20 31 0d 32 38  34 30 24 50 25 20 3d 20  |% + 1.2840$P% = |
000017f0  22 45 73 63 61 70 65 22  20 2b 20 43 48 52 24 30  |"Escape" + CHR$0|
00001800  0d 32 38 35 30 4e 45 58  54 20 6f 70 74 25 0d 2a  |.2850NEXT opt%.*|
00001810  4f 50 54 20 31 2c 32 0d  52 55 4e 0d 43 41 4c 4c  |OPT 1,2.RUN.CALL|
00001820  20 67 6f 0d                                       | go.|
00001824