Home » Archimedes archive » Zipped Apps » BBC Tape » !BBCTape/Technical
!BBCTape/Technical
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/Technical |
Read OK: | ✔ |
File size: | 1EED bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
!BBCTape - technical details. The protocol ============ The transfer protocol is fairly simple. The Beeb sends "SB" and waits for "sb" to come back, as a handshake. If it gets anything else it just tries again. The Arc then sends a command: either &C0 (stop), &30 (read file name), &0C (load file) or &3 (load using BGET). Stop is unused at the moment (you can just hit <escape> on the Beeb keyboard). The codes are chosen to have the maximum difference in bit patterns. If the command is recognised the Beeb sends &FF; if not it sends 0, which the Arc announces as a protocol error. For <read file name> the Beeb expects a <cr>-terminated name, < 11 characters long, and then goes back to the handshake phase (but will flag anything except a load command as an error). If not sent a file name it just uses a <cr>, which loads the next file on the tape. The reason for the OSBGET load option is that initially I couldn't get OSFILE to work; this turned out to be because my copy of the Advanced User Guide (page 335) says that OSFILE is at &FFCE, whereas it should say &FFDD. Having written the code I decided I might as well leave it in, although I don't know of any case where it would make a difference (it does help a bit in debugging to have two different versions). It would help if you wanted, say, to use sideways RAM to let you load files longer than 27.5 K. It does essentially the same as the OSFILE load, except that it counts the bytes as it reads them rather than taking the file length from the OSFILE parameter block. However the file is loaded, the load/execution addresses and file name are read from the block header stored at &3B2-&3D0 (see AUG p. 279). The file length is then output, low byte first; this is only used as a check for load errors. The file is output in 256-byte blocks. Each block starts with &FF, followed by the block length, which is sent three times to guard against corruption. The block itself is then sent, followed by a two-byte cyclic redundancy check (CRC). This is supposedly the same as the one used by the cassette filing system, as given in the AUG on p. 348. I've never actually seen any errors, so I don't know how good it is. The Arc has an ARM-code version of this, as the Basic version took over 2 seconds, which was almost as long as it took to transmit the block! The ARM version takes about 5 ms, which shows that Basic isn't always the best solution. If the CRC matches, the Arc sends back &FF and the next block is sent; if the Arc replies with 0 the block is re-sent. Finally, a 0 byte marks the end-of-file (instead of the &FF block-start code). The Beeb then sends the load and execution addresses, followed by the file name terminated by a <cr>. It then goes back to the handshake phase to wait for a new command. The Arc program =============== I initially wrote the Arc end as a normal Basic program. Turning it into a multi-tasking Wimp application was harder than I expected. The normal program knew where it was in the protocol by its position in the code, but you can't do that with a Wimp program. It's therefore implemented as a state machine, with a state transition whenever a phase of the protocol is completed. To some extent any Wimp program will be like that, as you have to remember what you were doing for any process which persists over a call to Wimp_Poll. However, this application has a particularly large number of distinct states, as the whole thing is driven by the asynchronous arrival of bytes in the serial buffer, so you can't just sit in a loop waiting for data to arrive. I think the program is fairly robust against errors, and you can always use <Reset> to put the state machine back to its initial state, but making changes is not trivial! I'm afraid the program isn't too well commented; this is partly laziness, partly to avoid making it any larger, partly because the structure and long variable names make it fairly self-commenting, and partly because the nature of the program makes explanations rather complicated. Changes to the protocols tend to have ramifications all over the place, so if you change anything make sure you know what you're doing! The loaded file is stored in a permanently reserved block 32K long. As Beeb files can't be very long this seemed simpler than any form of dynamic memory management, and it makes in-memory transfer extremely simple to implement. One general point; note that if a DataLoad goes unacknowledged, the program deletes the actual file it saved, not <Wimp$Scrap> as it says in the PRM; I think this is safer. Type-guessing ============= The type-guessing algorithm is rather trivial, and would be easy to improve (I'm sure I've seen an algorithm in a magazine, but I can't find it). The only thing it should get consistently right is a Basic file, which is taken to have an execution address between &8000 and &BFFF amd a load address in RAM. The relevant routine is PROCguess_type; it currently just looks at the load and execution addresses, stored in load% and exec%, but you could also look at the file itself, stored from file_block% to file_ptr%-1, and the original file name, stored in (surprise, surprise) original_file_name$. The Beeb program ================ The Beeb end of the link is a machine-code program which lives in pages &B, &C and the start of &D, so you lose function keys, user-defined characters and the NMI code (see below for use with discs). The source code is stored in readable form in BBCLoad, and BBCLoadBT is a version with line numbers (obtained by putting it through a Basic to Text converter twice) and which has been CR<>LFed in !Edit. Note that the first three and last three lines should not have line numbers. The first few lines give the addresses of data areas used by the program. It normally loads files to &E00 to give the maximum possible space, but can load to any page boundary. Disc systems ============ This program should be able to copy from tape on a Beeb with disc drives, as it selects *TAPE and does PAGE=&E00 at the beginning, which should leave it looking like a tape-based system. Loading files from disc is a bit more problematic; it would be better done with a dedicated program, but it's probably possible with this program. The main problem is that the code occupies part of page &D, which is used by the disc system. There is a version of the loader in the !BBCTape directory called BBCLDisc (with a downloadable version BBCLDiscBT) which will probably work, although I obviously can't test it. It has had the OSBGET option removed (it just uses the OSFILE load), and fits in pages &B and &C with zero bytes to spare! The load/execution addresses and file name aren't returned, as I don't know where they're stored in a disc system. In any case, you can't use a null file name with a disc, so if you don't give one you'll get an error. This also means that the autoload option won't work. Other computers =============== It should be fairly easy to produce a loader program for another computer, as the protocol doesn't need any knowledge of the filing system apart from the file name (the load/exec addresses are transmitted, but not used). Of course, that would only let you transfer programs to the Arc, unless you implemented the inverse protocol in the Arc program. I didn't see much point in doing this for the Beeb; the loader program only just fits, and Basic and text files are fairly easy to transfer anyway - just do *FX 2,1 on the Beeb, and on the Arc type "Filer_OpenDir serial:" at the command line. This opens a filer window for the serial port, and files dragged into it will be typed into Basic or your favorite wordprocessor. Would that it were that easy in the other direction! Another possibility would be to use the Beeb as a very slow tape streamer for hard disc backup, but that would be a completely different program (and would you trust it?).
00000000 0a 21 42 42 43 54 61 70 65 20 2d 20 74 65 63 68 |.!BBCTape - tech| 00000010 6e 69 63 61 6c 20 64 65 74 61 69 6c 73 2e 0a 0a |nical details...| 00000020 54 68 65 20 70 72 6f 74 6f 63 6f 6c 0a 3d 3d 3d |The protocol.===| 00000030 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 20 20 54 68 65 |=========.. The| 00000040 20 74 72 61 6e 73 66 65 72 20 70 72 6f 74 6f 63 | transfer protoc| 00000050 6f 6c 20 69 73 20 66 61 69 72 6c 79 20 73 69 6d |ol is fairly sim| 00000060 70 6c 65 2e 20 54 68 65 20 42 65 65 62 20 73 65 |ple. The Beeb se| 00000070 6e 64 73 20 22 53 42 22 20 61 6e 64 20 77 61 69 |nds "SB" and wai| 00000080 74 73 20 66 6f 72 0a 22 73 62 22 20 74 6f 20 63 |ts for."sb" to c| 00000090 6f 6d 65 20 62 61 63 6b 2c 20 61 73 20 61 20 68 |ome back, as a h| 000000a0 61 6e 64 73 68 61 6b 65 2e 20 49 66 20 69 74 20 |andshake. If it | 000000b0 67 65 74 73 20 61 6e 79 74 68 69 6e 67 20 65 6c |gets anything el| 000000c0 73 65 20 69 74 20 6a 75 73 74 20 74 72 69 65 73 |se it just tries| 000000d0 0a 61 67 61 69 6e 2e 20 54 68 65 20 41 72 63 20 |.again. The Arc | 000000e0 74 68 65 6e 20 73 65 6e 64 73 20 61 20 63 6f 6d |then sends a com| 000000f0 6d 61 6e 64 3a 20 65 69 74 68 65 72 20 26 43 30 |mand: either &C0| 00000100 20 28 73 74 6f 70 29 2c 20 26 33 30 20 28 72 65 | (stop), &30 (re| 00000110 61 64 20 66 69 6c 65 0a 6e 61 6d 65 29 2c 20 26 |ad file.name), &| 00000120 30 43 20 28 6c 6f 61 64 20 66 69 6c 65 29 20 6f |0C (load file) o| 00000130 72 20 26 33 20 28 6c 6f 61 64 20 75 73 69 6e 67 |r &3 (load using| 00000140 20 42 47 45 54 29 2e 20 53 74 6f 70 20 69 73 20 | BGET). Stop is | 00000150 75 6e 75 73 65 64 20 61 74 20 74 68 65 20 6d 6f |unused at the mo| 00000160 6d 65 6e 74 0a 28 79 6f 75 20 63 61 6e 20 6a 75 |ment.(you can ju| 00000170 73 74 20 68 69 74 20 3c 65 73 63 61 70 65 3e 20 |st hit <escape> | 00000180 6f 6e 20 74 68 65 20 42 65 65 62 20 6b 65 79 62 |on the Beeb keyb| 00000190 6f 61 72 64 29 2e 20 54 68 65 20 63 6f 64 65 73 |oard). The codes| 000001a0 20 61 72 65 20 63 68 6f 73 65 6e 20 74 6f 0a 68 | are chosen to.h| 000001b0 61 76 65 20 74 68 65 20 6d 61 78 69 6d 75 6d 20 |ave the maximum | 000001c0 64 69 66 66 65 72 65 6e 63 65 20 69 6e 20 62 69 |difference in bi| 000001d0 74 20 70 61 74 74 65 72 6e 73 2e 20 49 66 20 74 |t patterns. If t| 000001e0 68 65 20 63 6f 6d 6d 61 6e 64 20 69 73 20 72 65 |he command is re| 000001f0 63 6f 67 6e 69 73 65 64 0a 74 68 65 20 42 65 65 |cognised.the Bee| 00000200 62 20 73 65 6e 64 73 20 26 46 46 3b 20 69 66 20 |b sends &FF; if | 00000210 6e 6f 74 20 69 74 20 73 65 6e 64 73 20 30 2c 20 |not it sends 0, | 00000220 77 68 69 63 68 20 74 68 65 20 41 72 63 20 61 6e |which the Arc an| 00000230 6e 6f 75 6e 63 65 73 20 61 73 20 61 20 70 72 6f |nounces as a pro| 00000240 74 6f 63 6f 6c 0a 65 72 72 6f 72 2e 20 46 6f 72 |tocol.error. For| 00000250 20 3c 72 65 61 64 20 66 69 6c 65 20 6e 61 6d 65 | <read file name| 00000260 3e 20 74 68 65 20 42 65 65 62 20 65 78 70 65 63 |> the Beeb expec| 00000270 74 73 20 61 20 3c 63 72 3e 2d 74 65 72 6d 69 6e |ts a <cr>-termin| 00000280 61 74 65 64 20 6e 61 6d 65 2c 20 3c 20 31 31 0a |ated name, < 11.| 00000290 63 68 61 72 61 63 74 65 72 73 20 6c 6f 6e 67 2c |characters long,| 000002a0 20 61 6e 64 20 74 68 65 6e 20 67 6f 65 73 20 62 | and then goes b| 000002b0 61 63 6b 20 74 6f 20 74 68 65 20 68 61 6e 64 73 |ack to the hands| 000002c0 68 61 6b 65 20 70 68 61 73 65 20 28 62 75 74 20 |hake phase (but | 000002d0 77 69 6c 6c 20 66 6c 61 67 0a 61 6e 79 74 68 69 |will flag.anythi| 000002e0 6e 67 20 65 78 63 65 70 74 20 61 20 6c 6f 61 64 |ng except a load| 000002f0 20 63 6f 6d 6d 61 6e 64 20 61 73 20 61 6e 20 65 | command as an e| 00000300 72 72 6f 72 29 2e 20 49 66 20 6e 6f 74 20 73 65 |rror). If not se| 00000310 6e 74 20 61 20 66 69 6c 65 20 6e 61 6d 65 20 69 |nt a file name i| 00000320 74 20 6a 75 73 74 0a 75 73 65 73 20 61 20 3c 63 |t just.uses a <c| 00000330 72 3e 2c 20 77 68 69 63 68 20 6c 6f 61 64 73 20 |r>, which loads | 00000340 74 68 65 20 6e 65 78 74 20 66 69 6c 65 20 6f 6e |the next file on| 00000350 20 74 68 65 20 74 61 70 65 2e 0a 0a 20 20 54 68 | the tape... Th| 00000360 65 20 72 65 61 73 6f 6e 20 66 6f 72 20 74 68 65 |e reason for the| 00000370 20 4f 53 42 47 45 54 20 6c 6f 61 64 20 6f 70 74 | OSBGET load opt| 00000380 69 6f 6e 20 69 73 20 74 68 61 74 20 69 6e 69 74 |ion is that init| 00000390 69 61 6c 6c 79 20 49 20 63 6f 75 6c 64 6e 27 74 |ially I couldn't| 000003a0 20 67 65 74 0a 4f 53 46 49 4c 45 20 74 6f 20 77 | get.OSFILE to w| 000003b0 6f 72 6b 3b 20 74 68 69 73 20 74 75 72 6e 65 64 |ork; this turned| 000003c0 20 6f 75 74 20 74 6f 20 62 65 20 62 65 63 61 75 | out to be becau| 000003d0 73 65 20 6d 79 20 63 6f 70 79 20 6f 66 20 74 68 |se my copy of th| 000003e0 65 20 41 64 76 61 6e 63 65 64 20 55 73 65 72 0a |e Advanced User.| 000003f0 47 75 69 64 65 20 28 70 61 67 65 20 33 33 35 29 |Guide (page 335)| 00000400 20 73 61 79 73 20 74 68 61 74 20 4f 53 46 49 4c | says that OSFIL| 00000410 45 20 69 73 20 61 74 20 26 46 46 43 45 2c 20 77 |E is at &FFCE, w| 00000420 68 65 72 65 61 73 20 69 74 20 73 68 6f 75 6c 64 |hereas it should| 00000430 20 73 61 79 20 26 46 46 44 44 2e 0a 48 61 76 69 | say &FFDD..Havi| 00000440 6e 67 20 77 72 69 74 74 65 6e 20 74 68 65 20 63 |ng written the c| 00000450 6f 64 65 20 49 20 64 65 63 69 64 65 64 20 49 20 |ode I decided I | 00000460 6d 69 67 68 74 20 61 73 20 77 65 6c 6c 20 6c 65 |might as well le| 00000470 61 76 65 20 69 74 20 69 6e 2c 20 61 6c 74 68 6f |ave it in, altho| 00000480 75 67 68 20 49 0a 64 6f 6e 27 74 20 6b 6e 6f 77 |ugh I.don't know| 00000490 20 6f 66 20 61 6e 79 20 63 61 73 65 20 77 68 65 | of any case whe| 000004a0 72 65 20 69 74 20 77 6f 75 6c 64 20 6d 61 6b 65 |re it would make| 000004b0 20 61 20 64 69 66 66 65 72 65 6e 63 65 20 28 69 | a difference (i| 000004c0 74 20 64 6f 65 73 20 68 65 6c 70 20 61 20 62 69 |t does help a bi| 000004d0 74 0a 69 6e 20 64 65 62 75 67 67 69 6e 67 20 74 |t.in debugging t| 000004e0 6f 20 68 61 76 65 20 74 77 6f 20 64 69 66 66 65 |o have two diffe| 000004f0 72 65 6e 74 20 76 65 72 73 69 6f 6e 73 29 2e 20 |rent versions). | 00000500 49 74 20 77 6f 75 6c 64 20 68 65 6c 70 20 69 66 |It would help if| 00000510 20 79 6f 75 20 77 61 6e 74 65 64 2c 0a 73 61 79 | you wanted,.say| 00000520 2c 20 74 6f 20 75 73 65 20 73 69 64 65 77 61 79 |, to use sideway| 00000530 73 20 52 41 4d 20 74 6f 20 6c 65 74 20 79 6f 75 |s RAM to let you| 00000540 20 6c 6f 61 64 20 66 69 6c 65 73 20 6c 6f 6e 67 | load files long| 00000550 65 72 20 74 68 61 6e 20 32 37 2e 35 20 4b 2e 20 |er than 27.5 K. | 00000560 49 74 20 64 6f 65 73 0a 65 73 73 65 6e 74 69 61 |It does.essentia| 00000570 6c 6c 79 20 74 68 65 20 73 61 6d 65 20 61 73 20 |lly the same as | 00000580 74 68 65 20 4f 53 46 49 4c 45 20 6c 6f 61 64 2c |the OSFILE load,| 00000590 20 65 78 63 65 70 74 20 74 68 61 74 20 69 74 20 | except that it | 000005a0 63 6f 75 6e 74 73 20 74 68 65 20 62 79 74 65 73 |counts the bytes| 000005b0 20 61 73 0a 69 74 20 72 65 61 64 73 20 74 68 65 | as.it reads the| 000005c0 6d 20 72 61 74 68 65 72 20 74 68 61 6e 20 74 61 |m rather than ta| 000005d0 6b 69 6e 67 20 74 68 65 20 66 69 6c 65 20 6c 65 |king the file le| 000005e0 6e 67 74 68 20 66 72 6f 6d 20 74 68 65 20 4f 53 |ngth from the OS| 000005f0 46 49 4c 45 20 70 61 72 61 6d 65 74 65 72 0a 62 |FILE parameter.b| 00000600 6c 6f 63 6b 2e 20 48 6f 77 65 76 65 72 20 74 68 |lock. However th| 00000610 65 20 66 69 6c 65 20 69 73 20 6c 6f 61 64 65 64 |e file is loaded| 00000620 2c 20 74 68 65 20 6c 6f 61 64 2f 65 78 65 63 75 |, the load/execu| 00000630 74 69 6f 6e 20 61 64 64 72 65 73 73 65 73 20 61 |tion addresses a| 00000640 6e 64 20 66 69 6c 65 0a 6e 61 6d 65 20 61 72 65 |nd file.name are| 00000650 20 72 65 61 64 20 66 72 6f 6d 20 74 68 65 20 62 | read from the b| 00000660 6c 6f 63 6b 20 68 65 61 64 65 72 20 73 74 6f 72 |lock header stor| 00000670 65 64 20 61 74 20 26 33 42 32 2d 26 33 44 30 20 |ed at &3B2-&3D0 | 00000680 28 73 65 65 20 41 55 47 20 70 2e 20 32 37 39 29 |(see AUG p. 279)| 00000690 2e 0a 0a 20 20 54 68 65 20 66 69 6c 65 20 6c 65 |... The file le| 000006a0 6e 67 74 68 20 69 73 20 74 68 65 6e 20 6f 75 74 |ngth is then out| 000006b0 70 75 74 2c 20 6c 6f 77 20 62 79 74 65 20 66 69 |put, low byte fi| 000006c0 72 73 74 3b 20 74 68 69 73 20 69 73 20 6f 6e 6c |rst; this is onl| 000006d0 79 20 75 73 65 64 20 61 73 20 61 0a 63 68 65 63 |y used as a.chec| 000006e0 6b 20 66 6f 72 20 6c 6f 61 64 20 65 72 72 6f 72 |k for load error| 000006f0 73 2e 20 20 54 68 65 20 66 69 6c 65 20 69 73 20 |s. The file is | 00000700 6f 75 74 70 75 74 20 69 6e 20 32 35 36 2d 62 79 |output in 256-by| 00000710 74 65 20 62 6c 6f 63 6b 73 2e 20 45 61 63 68 20 |te blocks. Each | 00000720 62 6c 6f 63 6b 0a 73 74 61 72 74 73 20 77 69 74 |block.starts wit| 00000730 68 20 26 46 46 2c 20 66 6f 6c 6c 6f 77 65 64 20 |h &FF, followed | 00000740 62 79 20 74 68 65 20 62 6c 6f 63 6b 20 6c 65 6e |by the block len| 00000750 67 74 68 2c 20 77 68 69 63 68 20 69 73 20 73 65 |gth, which is se| 00000760 6e 74 20 74 68 72 65 65 20 74 69 6d 65 73 20 74 |nt three times t| 00000770 6f 0a 67 75 61 72 64 20 61 67 61 69 6e 73 74 20 |o.guard against | 00000780 63 6f 72 72 75 70 74 69 6f 6e 2e 20 54 68 65 20 |corruption. The | 00000790 62 6c 6f 63 6b 20 69 74 73 65 6c 66 20 69 73 20 |block itself is | 000007a0 74 68 65 6e 20 73 65 6e 74 2c 20 66 6f 6c 6c 6f |then sent, follo| 000007b0 77 65 64 20 62 79 20 61 0a 74 77 6f 2d 62 79 74 |wed by a.two-byt| 000007c0 65 20 63 79 63 6c 69 63 20 72 65 64 75 6e 64 61 |e cyclic redunda| 000007d0 6e 63 79 20 63 68 65 63 6b 20 28 43 52 43 29 2e |ncy check (CRC).| 000007e0 20 54 68 69 73 20 69 73 20 73 75 70 70 6f 73 65 | This is suppose| 000007f0 64 6c 79 20 74 68 65 20 73 61 6d 65 20 61 73 20 |dly the same as | 00000800 74 68 65 0a 6f 6e 65 20 75 73 65 64 20 62 79 20 |the.one used by | 00000810 74 68 65 20 63 61 73 73 65 74 74 65 20 66 69 6c |the cassette fil| 00000820 69 6e 67 20 73 79 73 74 65 6d 2c 20 61 73 20 67 |ing system, as g| 00000830 69 76 65 6e 20 69 6e 20 74 68 65 20 41 55 47 20 |iven in the AUG | 00000840 6f 6e 20 70 2e 20 33 34 38 2e 20 49 27 76 65 0a |on p. 348. I've.| 00000850 6e 65 76 65 72 20 61 63 74 75 61 6c 6c 79 20 73 |never actually s| 00000860 65 65 6e 20 61 6e 79 20 65 72 72 6f 72 73 2c 20 |een any errors, | 00000870 73 6f 20 49 20 64 6f 6e 27 74 20 6b 6e 6f 77 20 |so I don't know | 00000880 68 6f 77 20 67 6f 6f 64 20 69 74 20 69 73 2e 20 |how good it is. | 00000890 54 68 65 20 41 72 63 20 68 61 73 0a 61 6e 20 41 |The Arc has.an A| 000008a0 52 4d 2d 63 6f 64 65 20 76 65 72 73 69 6f 6e 20 |RM-code version | 000008b0 6f 66 20 74 68 69 73 2c 20 61 73 20 74 68 65 20 |of this, as the | 000008c0 42 61 73 69 63 20 76 65 72 73 69 6f 6e 20 74 6f |Basic version to| 000008d0 6f 6b 20 6f 76 65 72 20 32 20 73 65 63 6f 6e 64 |ok over 2 second| 000008e0 73 2c 20 77 68 69 63 68 0a 77 61 73 20 61 6c 6d |s, which.was alm| 000008f0 6f 73 74 20 61 73 20 6c 6f 6e 67 20 61 73 20 69 |ost as long as i| 00000900 74 20 74 6f 6f 6b 20 74 6f 20 74 72 61 6e 73 6d |t took to transm| 00000910 69 74 20 74 68 65 20 62 6c 6f 63 6b 21 20 54 68 |it the block! Th| 00000920 65 20 41 52 4d 20 76 65 72 73 69 6f 6e 20 74 61 |e ARM version ta| 00000930 6b 65 73 0a 61 62 6f 75 74 20 35 20 6d 73 2c 20 |kes.about 5 ms, | 00000940 77 68 69 63 68 20 73 68 6f 77 73 20 74 68 61 74 |which shows that| 00000950 20 42 61 73 69 63 20 69 73 6e 27 74 20 61 6c 77 | Basic isn't alw| 00000960 61 79 73 20 74 68 65 20 62 65 73 74 20 73 6f 6c |ays the best sol| 00000970 75 74 69 6f 6e 2e 20 49 66 20 74 68 65 0a 43 52 |ution. If the.CR| 00000980 43 20 6d 61 74 63 68 65 73 2c 20 74 68 65 20 41 |C matches, the A| 00000990 72 63 20 73 65 6e 64 73 20 62 61 63 6b 20 26 46 |rc sends back &F| 000009a0 46 20 61 6e 64 20 74 68 65 20 6e 65 78 74 20 62 |F and the next b| 000009b0 6c 6f 63 6b 20 69 73 20 73 65 6e 74 3b 20 69 66 |lock is sent; if| 000009c0 20 74 68 65 20 41 72 63 0a 72 65 70 6c 69 65 73 | the Arc.replies| 000009d0 20 77 69 74 68 20 30 20 74 68 65 20 62 6c 6f 63 | with 0 the bloc| 000009e0 6b 20 69 73 20 72 65 2d 73 65 6e 74 2e 20 46 69 |k is re-sent. Fi| 000009f0 6e 61 6c 6c 79 2c 20 61 20 30 20 62 79 74 65 20 |nally, a 0 byte | 00000a00 6d 61 72 6b 73 20 74 68 65 20 65 6e 64 2d 6f 66 |marks the end-of| 00000a10 2d 66 69 6c 65 0a 28 69 6e 73 74 65 61 64 20 6f |-file.(instead o| 00000a20 66 20 74 68 65 20 26 46 46 20 62 6c 6f 63 6b 2d |f the &FF block-| 00000a30 73 74 61 72 74 20 63 6f 64 65 29 2e 0a 0a 20 20 |start code)... | 00000a40 54 68 65 20 42 65 65 62 20 74 68 65 6e 20 73 65 |The Beeb then se| 00000a50 6e 64 73 20 74 68 65 20 6c 6f 61 64 20 61 6e 64 |nds the load and| 00000a60 20 65 78 65 63 75 74 69 6f 6e 20 61 64 64 72 65 | execution addre| 00000a70 73 73 65 73 2c 20 66 6f 6c 6c 6f 77 65 64 20 62 |sses, followed b| 00000a80 79 20 74 68 65 20 66 69 6c 65 0a 6e 61 6d 65 20 |y the file.name | 00000a90 74 65 72 6d 69 6e 61 74 65 64 20 62 79 20 61 20 |terminated by a | 00000aa0 3c 63 72 3e 2e 20 49 74 20 74 68 65 6e 20 67 6f |<cr>. It then go| 00000ab0 65 73 20 62 61 63 6b 20 74 6f 20 74 68 65 20 68 |es back to the h| 00000ac0 61 6e 64 73 68 61 6b 65 20 70 68 61 73 65 20 74 |andshake phase t| 00000ad0 6f 20 77 61 69 74 0a 66 6f 72 20 61 20 6e 65 77 |o wait.for a new| 00000ae0 20 63 6f 6d 6d 61 6e 64 2e 0a 0a 54 68 65 20 41 | command...The A| 00000af0 72 63 20 70 72 6f 67 72 61 6d 0a 3d 3d 3d 3d 3d |rc program.=====| 00000b00 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 49 20 69 6e |==========..I in| 00000b10 69 74 69 61 6c 6c 79 20 77 72 6f 74 65 20 74 68 |itially wrote th| 00000b20 65 20 41 72 63 20 65 6e 64 20 61 73 20 61 20 6e |e Arc end as a n| 00000b30 6f 72 6d 61 6c 20 42 61 73 69 63 20 70 72 6f 67 |ormal Basic prog| 00000b40 72 61 6d 2e 20 54 75 72 6e 69 6e 67 20 69 74 20 |ram. Turning it | 00000b50 69 6e 74 6f 20 61 0a 6d 75 6c 74 69 2d 74 61 73 |into a.multi-tas| 00000b60 6b 69 6e 67 20 57 69 6d 70 20 61 70 70 6c 69 63 |king Wimp applic| 00000b70 61 74 69 6f 6e 20 77 61 73 20 68 61 72 64 65 72 |ation was harder| 00000b80 20 74 68 61 6e 20 49 20 65 78 70 65 63 74 65 64 | than I expected| 00000b90 2e 20 54 68 65 20 6e 6f 72 6d 61 6c 0a 70 72 6f |. The normal.pro| 00000ba0 67 72 61 6d 20 6b 6e 65 77 20 77 68 65 72 65 20 |gram knew where | 00000bb0 69 74 20 77 61 73 20 69 6e 20 74 68 65 20 70 72 |it was in the pr| 00000bc0 6f 74 6f 63 6f 6c 20 62 79 20 69 74 73 20 70 6f |otocol by its po| 00000bd0 73 69 74 69 6f 6e 20 69 6e 20 74 68 65 20 63 6f |sition in the co| 00000be0 64 65 2c 20 62 75 74 0a 79 6f 75 20 63 61 6e 27 |de, but.you can'| 00000bf0 74 20 64 6f 20 74 68 61 74 20 77 69 74 68 20 61 |t do that with a| 00000c00 20 57 69 6d 70 20 70 72 6f 67 72 61 6d 2e 20 49 | Wimp program. I| 00000c10 74 27 73 20 74 68 65 72 65 66 6f 72 65 20 69 6d |t's therefore im| 00000c20 70 6c 65 6d 65 6e 74 65 64 20 61 73 20 61 20 73 |plemented as a s| 00000c30 74 61 74 65 0a 6d 61 63 68 69 6e 65 2c 20 77 69 |tate.machine, wi| 00000c40 74 68 20 61 20 73 74 61 74 65 20 74 72 61 6e 73 |th a state trans| 00000c50 69 74 69 6f 6e 20 77 68 65 6e 65 76 65 72 20 61 |ition whenever a| 00000c60 20 70 68 61 73 65 20 6f 66 20 74 68 65 20 70 72 | phase of the pr| 00000c70 6f 74 6f 63 6f 6c 20 69 73 0a 63 6f 6d 70 6c 65 |otocol is.comple| 00000c80 74 65 64 2e 20 54 6f 20 73 6f 6d 65 20 65 78 74 |ted. To some ext| 00000c90 65 6e 74 20 61 6e 79 20 57 69 6d 70 20 70 72 6f |ent any Wimp pro| 00000ca0 67 72 61 6d 20 77 69 6c 6c 20 62 65 20 6c 69 6b |gram will be lik| 00000cb0 65 20 74 68 61 74 2c 20 61 73 20 79 6f 75 20 68 |e that, as you h| 00000cc0 61 76 65 20 74 6f 0a 72 65 6d 65 6d 62 65 72 20 |ave to.remember | 00000cd0 77 68 61 74 20 79 6f 75 20 77 65 72 65 20 64 6f |what you were do| 00000ce0 69 6e 67 20 66 6f 72 20 61 6e 79 20 70 72 6f 63 |ing for any proc| 00000cf0 65 73 73 20 77 68 69 63 68 20 70 65 72 73 69 73 |ess which persis| 00000d00 74 73 20 6f 76 65 72 20 61 20 63 61 6c 6c 20 74 |ts over a call t| 00000d10 6f 0a 57 69 6d 70 5f 50 6f 6c 6c 2e 20 48 6f 77 |o.Wimp_Poll. How| 00000d20 65 76 65 72 2c 20 74 68 69 73 20 61 70 70 6c 69 |ever, this appli| 00000d30 63 61 74 69 6f 6e 20 68 61 73 20 61 20 70 61 72 |cation has a par| 00000d40 74 69 63 75 6c 61 72 6c 79 20 6c 61 72 67 65 20 |ticularly large | 00000d50 6e 75 6d 62 65 72 20 6f 66 0a 64 69 73 74 69 6e |number of.distin| 00000d60 63 74 20 73 74 61 74 65 73 2c 20 61 73 20 74 68 |ct states, as th| 00000d70 65 20 77 68 6f 6c 65 20 74 68 69 6e 67 20 69 73 |e whole thing is| 00000d80 20 64 72 69 76 65 6e 20 62 79 20 74 68 65 20 61 | driven by the a| 00000d90 73 79 6e 63 68 72 6f 6e 6f 75 73 20 61 72 72 69 |synchronous arri| 00000da0 76 61 6c 20 6f 66 0a 62 79 74 65 73 20 69 6e 20 |val of.bytes in | 00000db0 74 68 65 20 73 65 72 69 61 6c 20 62 75 66 66 65 |the serial buffe| 00000dc0 72 2c 20 73 6f 20 79 6f 75 20 63 61 6e 27 74 20 |r, so you can't | 00000dd0 6a 75 73 74 20 73 69 74 20 69 6e 20 61 20 6c 6f |just sit in a lo| 00000de0 6f 70 20 77 61 69 74 69 6e 67 20 66 6f 72 20 64 |op waiting for d| 00000df0 61 74 61 0a 74 6f 20 61 72 72 69 76 65 2e 20 49 |ata.to arrive. I| 00000e00 20 74 68 69 6e 6b 20 74 68 65 20 70 72 6f 67 72 | think the progr| 00000e10 61 6d 20 69 73 20 66 61 69 72 6c 79 20 72 6f 62 |am is fairly rob| 00000e20 75 73 74 20 61 67 61 69 6e 73 74 20 65 72 72 6f |ust against erro| 00000e30 72 73 2c 20 61 6e 64 20 79 6f 75 20 63 61 6e 0a |rs, and you can.| 00000e40 61 6c 77 61 79 73 20 75 73 65 20 3c 52 65 73 65 |always use <Rese| 00000e50 74 3e 20 74 6f 20 70 75 74 20 74 68 65 20 73 74 |t> to put the st| 00000e60 61 74 65 20 6d 61 63 68 69 6e 65 20 62 61 63 6b |ate machine back| 00000e70 20 74 6f 20 69 74 73 20 69 6e 69 74 69 61 6c 20 | to its initial | 00000e80 73 74 61 74 65 2c 20 62 75 74 0a 6d 61 6b 69 6e |state, but.makin| 00000e90 67 20 63 68 61 6e 67 65 73 20 69 73 20 6e 6f 74 |g changes is not| 00000ea0 20 74 72 69 76 69 61 6c 21 0a 0a 20 20 49 27 6d | trivial!.. I'm| 00000eb0 20 61 66 72 61 69 64 20 74 68 65 20 70 72 6f 67 | afraid the prog| 00000ec0 72 61 6d 20 69 73 6e 27 74 20 74 6f 6f 20 77 65 |ram isn't too we| 00000ed0 6c 6c 20 63 6f 6d 6d 65 6e 74 65 64 3b 20 74 68 |ll commented; th| 00000ee0 69 73 20 69 73 20 70 61 72 74 6c 79 20 6c 61 7a |is is partly laz| 00000ef0 69 6e 65 73 73 2c 0a 70 61 72 74 6c 79 20 74 6f |iness,.partly to| 00000f00 20 61 76 6f 69 64 20 6d 61 6b 69 6e 67 20 69 74 | avoid making it| 00000f10 20 61 6e 79 20 6c 61 72 67 65 72 2c 20 70 61 72 | any larger, par| 00000f20 74 6c 79 20 62 65 63 61 75 73 65 20 74 68 65 20 |tly because the | 00000f30 73 74 72 75 63 74 75 72 65 20 61 6e 64 0a 6c 6f |structure and.lo| 00000f40 6e 67 20 76 61 72 69 61 62 6c 65 20 6e 61 6d 65 |ng variable name| 00000f50 73 20 6d 61 6b 65 20 69 74 20 66 61 69 72 6c 79 |s make it fairly| 00000f60 20 73 65 6c 66 2d 63 6f 6d 6d 65 6e 74 69 6e 67 | self-commenting| 00000f70 2c 20 61 6e 64 20 70 61 72 74 6c 79 20 62 65 63 |, and partly bec| 00000f80 61 75 73 65 20 74 68 65 0a 6e 61 74 75 72 65 20 |ause the.nature | 00000f90 6f 66 20 74 68 65 20 70 72 6f 67 72 61 6d 20 6d |of the program m| 00000fa0 61 6b 65 73 20 65 78 70 6c 61 6e 61 74 69 6f 6e |akes explanation| 00000fb0 73 20 72 61 74 68 65 72 20 63 6f 6d 70 6c 69 63 |s rather complic| 00000fc0 61 74 65 64 2e 20 43 68 61 6e 67 65 73 20 74 6f |ated. Changes to| 00000fd0 0a 74 68 65 20 70 72 6f 74 6f 63 6f 6c 73 20 74 |.the protocols t| 00000fe0 65 6e 64 20 74 6f 20 68 61 76 65 20 72 61 6d 69 |end to have rami| 00000ff0 66 69 63 61 74 69 6f 6e 73 20 61 6c 6c 20 6f 76 |fications all ov| 00001000 65 72 20 74 68 65 20 70 6c 61 63 65 2c 20 73 6f |er the place, so| 00001010 20 69 66 20 79 6f 75 0a 63 68 61 6e 67 65 20 61 | if you.change a| 00001020 6e 79 74 68 69 6e 67 20 6d 61 6b 65 20 73 75 72 |nything make sur| 00001030 65 20 79 6f 75 20 6b 6e 6f 77 20 77 68 61 74 20 |e you know what | 00001040 79 6f 75 27 72 65 20 64 6f 69 6e 67 21 0a 0a 20 |you're doing!.. | 00001050 20 54 68 65 20 6c 6f 61 64 65 64 20 66 69 6c 65 | The loaded file| 00001060 20 69 73 20 73 74 6f 72 65 64 20 69 6e 20 61 20 | is stored in a | 00001070 70 65 72 6d 61 6e 65 6e 74 6c 79 20 72 65 73 65 |permanently rese| 00001080 72 76 65 64 20 62 6c 6f 63 6b 20 33 32 4b 20 6c |rved block 32K l| 00001090 6f 6e 67 2e 20 41 73 0a 42 65 65 62 20 66 69 6c |ong. As.Beeb fil| 000010a0 65 73 20 63 61 6e 27 74 20 62 65 20 76 65 72 79 |es can't be very| 000010b0 20 6c 6f 6e 67 20 74 68 69 73 20 73 65 65 6d 65 | long this seeme| 000010c0 64 20 73 69 6d 70 6c 65 72 20 74 68 61 6e 20 61 |d simpler than a| 000010d0 6e 79 20 66 6f 72 6d 20 6f 66 20 64 79 6e 61 6d |ny form of dynam| 000010e0 69 63 0a 6d 65 6d 6f 72 79 20 6d 61 6e 61 67 65 |ic.memory manage| 000010f0 6d 65 6e 74 2c 20 61 6e 64 20 69 74 20 6d 61 6b |ment, and it mak| 00001100 65 73 20 69 6e 2d 6d 65 6d 6f 72 79 20 74 72 61 |es in-memory tra| 00001110 6e 73 66 65 72 20 65 78 74 72 65 6d 65 6c 79 20 |nsfer extremely | 00001120 73 69 6d 70 6c 65 20 74 6f 0a 69 6d 70 6c 65 6d |simple to.implem| 00001130 65 6e 74 2e 0a 0a 20 20 4f 6e 65 20 67 65 6e 65 |ent... One gene| 00001140 72 61 6c 20 70 6f 69 6e 74 3b 20 6e 6f 74 65 20 |ral point; note | 00001150 74 68 61 74 20 69 66 20 61 20 44 61 74 61 4c 6f |that if a DataLo| 00001160 61 64 20 67 6f 65 73 20 75 6e 61 63 6b 6e 6f 77 |ad goes unacknow| 00001170 6c 65 64 67 65 64 2c 20 74 68 65 0a 70 72 6f 67 |ledged, the.prog| 00001180 72 61 6d 20 64 65 6c 65 74 65 73 20 74 68 65 20 |ram deletes the | 00001190 61 63 74 75 61 6c 20 66 69 6c 65 20 69 74 20 73 |actual file it s| 000011a0 61 76 65 64 2c 20 6e 6f 74 20 3c 57 69 6d 70 24 |aved, not <Wimp$| 000011b0 53 63 72 61 70 3e 20 61 73 20 69 74 20 73 61 79 |Scrap> as it say| 000011c0 73 0a 69 6e 20 74 68 65 20 50 52 4d 3b 20 49 20 |s.in the PRM; I | 000011d0 74 68 69 6e 6b 20 74 68 69 73 20 69 73 20 73 61 |think this is sa| 000011e0 66 65 72 2e 0a 0a 54 79 70 65 2d 67 75 65 73 73 |fer...Type-guess| 000011f0 69 6e 67 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d |ing.============| 00001200 3d 0a 0a 54 68 65 20 74 79 70 65 2d 67 75 65 73 |=..The type-gues| 00001210 73 69 6e 67 20 61 6c 67 6f 72 69 74 68 6d 20 69 |sing algorithm i| 00001220 73 20 72 61 74 68 65 72 20 74 72 69 76 69 61 6c |s rather trivial| 00001230 2c 20 61 6e 64 20 77 6f 75 6c 64 20 62 65 20 65 |, and would be e| 00001240 61 73 79 20 74 6f 20 69 6d 70 72 6f 76 65 0a 28 |asy to improve.(| 00001250 49 27 6d 20 73 75 72 65 20 49 27 76 65 20 73 65 |I'm sure I've se| 00001260 65 6e 20 61 6e 20 61 6c 67 6f 72 69 74 68 6d 20 |en an algorithm | 00001270 69 6e 20 61 20 6d 61 67 61 7a 69 6e 65 2c 20 62 |in a magazine, b| 00001280 75 74 20 49 20 63 61 6e 27 74 20 66 69 6e 64 20 |ut I can't find | 00001290 69 74 29 2e 20 54 68 65 0a 6f 6e 6c 79 20 74 68 |it). The.only th| 000012a0 69 6e 67 20 69 74 20 73 68 6f 75 6c 64 20 67 65 |ing it should ge| 000012b0 74 20 63 6f 6e 73 69 73 74 65 6e 74 6c 79 20 72 |t consistently r| 000012c0 69 67 68 74 20 69 73 20 61 20 42 61 73 69 63 20 |ight is a Basic | 000012d0 66 69 6c 65 2c 20 77 68 69 63 68 20 69 73 20 74 |file, which is t| 000012e0 61 6b 65 6e 0a 74 6f 20 68 61 76 65 20 61 6e 20 |aken.to have an | 000012f0 65 78 65 63 75 74 69 6f 6e 20 61 64 64 72 65 73 |execution addres| 00001300 73 20 62 65 74 77 65 65 6e 20 26 38 30 30 30 20 |s between &8000 | 00001310 61 6e 64 20 26 42 46 46 46 20 61 6d 64 20 61 20 |and &BFFF amd a | 00001320 6c 6f 61 64 20 61 64 64 72 65 73 73 20 69 6e 0a |load address in.| 00001330 52 41 4d 2e 0a 0a 20 20 54 68 65 20 72 65 6c 65 |RAM... The rele| 00001340 76 61 6e 74 20 72 6f 75 74 69 6e 65 20 69 73 20 |vant routine is | 00001350 50 52 4f 43 67 75 65 73 73 5f 74 79 70 65 3b 20 |PROCguess_type; | 00001360 69 74 20 63 75 72 72 65 6e 74 6c 79 20 6a 75 73 |it currently jus| 00001370 74 20 6c 6f 6f 6b 73 20 61 74 20 74 68 65 0a 6c |t looks at the.l| 00001380 6f 61 64 20 61 6e 64 20 65 78 65 63 75 74 69 6f |oad and executio| 00001390 6e 20 61 64 64 72 65 73 73 65 73 2c 20 73 74 6f |n addresses, sto| 000013a0 72 65 64 20 69 6e 20 6c 6f 61 64 25 20 61 6e 64 |red in load% and| 000013b0 20 65 78 65 63 25 2c 20 62 75 74 20 79 6f 75 20 | exec%, but you | 000013c0 63 6f 75 6c 64 20 61 6c 73 6f 0a 6c 6f 6f 6b 20 |could also.look | 000013d0 61 74 20 74 68 65 20 66 69 6c 65 20 69 74 73 65 |at the file itse| 000013e0 6c 66 2c 20 73 74 6f 72 65 64 20 66 72 6f 6d 20 |lf, stored from | 000013f0 66 69 6c 65 5f 62 6c 6f 63 6b 25 20 74 6f 20 66 |file_block% to f| 00001400 69 6c 65 5f 70 74 72 25 2d 31 2c 20 61 6e 64 20 |ile_ptr%-1, and | 00001410 74 68 65 0a 6f 72 69 67 69 6e 61 6c 20 66 69 6c |the.original fil| 00001420 65 20 6e 61 6d 65 2c 20 73 74 6f 72 65 64 20 69 |e name, stored i| 00001430 6e 20 28 73 75 72 70 72 69 73 65 2c 20 73 75 72 |n (surprise, sur| 00001440 70 72 69 73 65 29 20 6f 72 69 67 69 6e 61 6c 5f |prise) original_| 00001450 66 69 6c 65 5f 6e 61 6d 65 24 2e 0a 0a 54 68 65 |file_name$...The| 00001460 20 42 65 65 62 20 70 72 6f 67 72 61 6d 0a 3d 3d | Beeb program.==| 00001470 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a |==============..| 00001480 20 20 54 68 65 20 42 65 65 62 20 65 6e 64 20 6f | The Beeb end o| 00001490 66 20 74 68 65 20 6c 69 6e 6b 20 69 73 20 61 20 |f the link is a | 000014a0 6d 61 63 68 69 6e 65 2d 63 6f 64 65 20 70 72 6f |machine-code pro| 000014b0 67 72 61 6d 20 77 68 69 63 68 20 6c 69 76 65 73 |gram which lives| 000014c0 20 69 6e 20 70 61 67 65 73 0a 26 42 2c 20 26 43 | in pages.&B, &C| 000014d0 20 61 6e 64 20 74 68 65 20 73 74 61 72 74 20 6f | and the start o| 000014e0 66 20 26 44 2c 20 73 6f 20 79 6f 75 20 6c 6f 73 |f &D, so you los| 000014f0 65 20 66 75 6e 63 74 69 6f 6e 20 6b 65 79 73 2c |e function keys,| 00001500 20 75 73 65 72 2d 64 65 66 69 6e 65 64 0a 63 68 | user-defined.ch| 00001510 61 72 61 63 74 65 72 73 20 61 6e 64 20 74 68 65 |aracters and the| 00001520 20 4e 4d 49 20 63 6f 64 65 20 28 73 65 65 20 62 | NMI code (see b| 00001530 65 6c 6f 77 20 66 6f 72 20 75 73 65 20 77 69 74 |elow for use wit| 00001540 68 20 64 69 73 63 73 29 2e 20 54 68 65 20 73 6f |h discs). The so| 00001550 75 72 63 65 20 63 6f 64 65 0a 69 73 20 73 74 6f |urce code.is sto| 00001560 72 65 64 20 69 6e 20 72 65 61 64 61 62 6c 65 20 |red in readable | 00001570 66 6f 72 6d 20 69 6e 20 42 42 43 4c 6f 61 64 2c |form in BBCLoad,| 00001580 20 61 6e 64 20 42 42 43 4c 6f 61 64 42 54 20 69 | and BBCLoadBT i| 00001590 73 20 61 20 76 65 72 73 69 6f 6e 20 77 69 74 68 |s a version with| 000015a0 20 6c 69 6e 65 0a 6e 75 6d 62 65 72 73 20 28 6f | line.numbers (o| 000015b0 62 74 61 69 6e 65 64 20 62 79 20 70 75 74 74 69 |btained by putti| 000015c0 6e 67 20 69 74 20 74 68 72 6f 75 67 68 20 61 20 |ng it through a | 000015d0 42 61 73 69 63 20 74 6f 20 54 65 78 74 20 63 6f |Basic to Text co| 000015e0 6e 76 65 72 74 65 72 20 74 77 69 63 65 29 20 61 |nverter twice) a| 000015f0 6e 64 0a 77 68 69 63 68 20 68 61 73 20 62 65 65 |nd.which has bee| 00001600 6e 20 43 52 3c 3e 4c 46 65 64 20 69 6e 20 21 45 |n CR<>LFed in !E| 00001610 64 69 74 2e 20 4e 6f 74 65 20 74 68 61 74 20 74 |dit. Note that t| 00001620 68 65 20 66 69 72 73 74 20 74 68 72 65 65 20 61 |he first three a| 00001630 6e 64 20 6c 61 73 74 20 74 68 72 65 65 0a 6c 69 |nd last three.li| 00001640 6e 65 73 20 73 68 6f 75 6c 64 20 6e 6f 74 20 68 |nes should not h| 00001650 61 76 65 20 6c 69 6e 65 20 6e 75 6d 62 65 72 73 |ave line numbers| 00001660 2e 20 54 68 65 20 66 69 72 73 74 20 66 65 77 20 |. The first few | 00001670 6c 69 6e 65 73 20 67 69 76 65 20 74 68 65 20 61 |lines give the a| 00001680 64 64 72 65 73 73 65 73 0a 6f 66 20 64 61 74 61 |ddresses.of data| 00001690 20 61 72 65 61 73 20 75 73 65 64 20 62 79 20 74 | areas used by t| 000016a0 68 65 20 70 72 6f 67 72 61 6d 2e 20 49 74 20 6e |he program. It n| 000016b0 6f 72 6d 61 6c 6c 79 20 6c 6f 61 64 73 20 66 69 |ormally loads fi| 000016c0 6c 65 73 20 74 6f 20 26 45 30 30 20 74 6f 20 67 |les to &E00 to g| 000016d0 69 76 65 0a 74 68 65 20 6d 61 78 69 6d 75 6d 20 |ive.the maximum | 000016e0 70 6f 73 73 69 62 6c 65 20 73 70 61 63 65 2c 20 |possible space, | 000016f0 62 75 74 20 63 61 6e 20 6c 6f 61 64 20 74 6f 20 |but can load to | 00001700 61 6e 79 20 70 61 67 65 20 62 6f 75 6e 64 61 72 |any page boundar| 00001710 79 2e 0a 0a 44 69 73 63 20 73 79 73 74 65 6d 73 |y...Disc systems| 00001720 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 54 |.============..T| 00001730 68 69 73 20 70 72 6f 67 72 61 6d 20 73 68 6f 75 |his program shou| 00001740 6c 64 20 62 65 20 61 62 6c 65 20 74 6f 20 63 6f |ld be able to co| 00001750 70 79 20 66 72 6f 6d 20 74 61 70 65 20 6f 6e 20 |py from tape on | 00001760 61 20 42 65 65 62 20 77 69 74 68 20 64 69 73 63 |a Beeb with disc| 00001770 20 64 72 69 76 65 73 2c 20 61 73 0a 69 74 20 73 | drives, as.it s| 00001780 65 6c 65 63 74 73 20 2a 54 41 50 45 20 61 6e 64 |elects *TAPE and| 00001790 20 64 6f 65 73 20 50 41 47 45 3d 26 45 30 30 20 | does PAGE=&E00 | 000017a0 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 |at the beginning| 000017b0 2c 20 77 68 69 63 68 20 73 68 6f 75 6c 64 20 6c |, which should l| 000017c0 65 61 76 65 20 69 74 0a 6c 6f 6f 6b 69 6e 67 20 |eave it.looking | 000017d0 6c 69 6b 65 20 61 20 74 61 70 65 2d 62 61 73 65 |like a tape-base| 000017e0 64 20 73 79 73 74 65 6d 2e 20 4c 6f 61 64 69 6e |d system. Loadin| 000017f0 67 20 66 69 6c 65 73 20 66 72 6f 6d 20 64 69 73 |g files from dis| 00001800 63 20 69 73 20 61 20 62 69 74 20 6d 6f 72 65 0a |c is a bit more.| 00001810 70 72 6f 62 6c 65 6d 61 74 69 63 3b 20 69 74 20 |problematic; it | 00001820 77 6f 75 6c 64 20 62 65 20 62 65 74 74 65 72 20 |would be better | 00001830 64 6f 6e 65 20 77 69 74 68 20 61 20 64 65 64 69 |done with a dedi| 00001840 63 61 74 65 64 20 70 72 6f 67 72 61 6d 2c 20 62 |cated program, b| 00001850 75 74 20 69 74 27 73 0a 70 72 6f 62 61 62 6c 79 |ut it's.probably| 00001860 20 70 6f 73 73 69 62 6c 65 20 77 69 74 68 20 74 | possible with t| 00001870 68 69 73 20 70 72 6f 67 72 61 6d 2e 20 54 68 65 |his program. The| 00001880 20 6d 61 69 6e 20 70 72 6f 62 6c 65 6d 20 69 73 | main problem is| 00001890 20 74 68 61 74 20 74 68 65 20 63 6f 64 65 0a 6f | that the code.o| 000018a0 63 63 75 70 69 65 73 20 70 61 72 74 20 6f 66 20 |ccupies part of | 000018b0 70 61 67 65 20 26 44 2c 20 77 68 69 63 68 20 69 |page &D, which i| 000018c0 73 20 75 73 65 64 20 62 79 20 74 68 65 20 64 69 |s used by the di| 000018d0 73 63 20 73 79 73 74 65 6d 2e 20 54 68 65 72 65 |sc system. There| 000018e0 20 69 73 20 61 0a 76 65 72 73 69 6f 6e 20 6f 66 | is a.version of| 000018f0 20 74 68 65 20 6c 6f 61 64 65 72 20 69 6e 20 74 | the loader in t| 00001900 68 65 20 21 42 42 43 54 61 70 65 20 64 69 72 65 |he !BBCTape dire| 00001910 63 74 6f 72 79 20 63 61 6c 6c 65 64 20 42 42 43 |ctory called BBC| 00001920 4c 44 69 73 63 20 28 77 69 74 68 20 61 0a 64 6f |LDisc (with a.do| 00001930 77 6e 6c 6f 61 64 61 62 6c 65 20 76 65 72 73 69 |wnloadable versi| 00001940 6f 6e 20 42 42 43 4c 44 69 73 63 42 54 29 20 77 |on BBCLDiscBT) w| 00001950 68 69 63 68 20 77 69 6c 6c 20 70 72 6f 62 61 62 |hich will probab| 00001960 6c 79 20 77 6f 72 6b 2c 20 61 6c 74 68 6f 75 67 |ly work, althoug| 00001970 68 20 49 0a 6f 62 76 69 6f 75 73 6c 79 20 63 61 |h I.obviously ca| 00001980 6e 27 74 20 74 65 73 74 20 69 74 2e 20 49 74 20 |n't test it. It | 00001990 68 61 73 20 68 61 64 20 74 68 65 20 4f 53 42 47 |has had the OSBG| 000019a0 45 54 20 6f 70 74 69 6f 6e 20 72 65 6d 6f 76 65 |ET option remove| 000019b0 64 20 28 69 74 20 6a 75 73 74 20 75 73 65 73 0a |d (it just uses.| 000019c0 74 68 65 20 4f 53 46 49 4c 45 20 6c 6f 61 64 29 |the OSFILE load)| 000019d0 2c 20 61 6e 64 20 66 69 74 73 20 69 6e 20 70 61 |, and fits in pa| 000019e0 67 65 73 20 26 42 20 61 6e 64 20 26 43 20 77 69 |ges &B and &C wi| 000019f0 74 68 20 7a 65 72 6f 20 62 79 74 65 73 20 74 6f |th zero bytes to| 00001a00 20 73 70 61 72 65 21 20 54 68 65 0a 6c 6f 61 64 | spare! The.load| 00001a10 2f 65 78 65 63 75 74 69 6f 6e 20 61 64 64 72 65 |/execution addre| 00001a20 73 73 65 73 20 61 6e 64 20 66 69 6c 65 20 6e 61 |sses and file na| 00001a30 6d 65 20 61 72 65 6e 27 74 20 72 65 74 75 72 6e |me aren't return| 00001a40 65 64 2c 20 61 73 20 49 20 64 6f 6e 27 74 20 6b |ed, as I don't k| 00001a50 6e 6f 77 0a 77 68 65 72 65 20 74 68 65 79 27 72 |now.where they'r| 00001a60 65 20 73 74 6f 72 65 64 20 69 6e 20 61 20 64 69 |e stored in a di| 00001a70 73 63 20 73 79 73 74 65 6d 2e 20 49 6e 20 61 6e |sc system. In an| 00001a80 79 20 63 61 73 65 2c 20 79 6f 75 20 63 61 6e 27 |y case, you can'| 00001a90 74 20 75 73 65 20 61 20 6e 75 6c 6c 0a 66 69 6c |t use a null.fil| 00001aa0 65 20 6e 61 6d 65 20 77 69 74 68 20 61 20 64 69 |e name with a di| 00001ab0 73 63 2c 20 73 6f 20 69 66 20 79 6f 75 20 64 6f |sc, so if you do| 00001ac0 6e 27 74 20 67 69 76 65 20 6f 6e 65 20 79 6f 75 |n't give one you| 00001ad0 27 6c 6c 20 67 65 74 20 61 6e 20 65 72 72 6f 72 |'ll get an error| 00001ae0 2e 20 54 68 69 73 0a 61 6c 73 6f 20 6d 65 61 6e |. This.also mean| 00001af0 73 20 74 68 61 74 20 74 68 65 20 61 75 74 6f 6c |s that the autol| 00001b00 6f 61 64 20 6f 70 74 69 6f 6e 20 77 6f 6e 27 74 |oad option won't| 00001b10 20 77 6f 72 6b 2e 0a 0a 4f 74 68 65 72 20 63 6f | work...Other co| 00001b20 6d 70 75 74 65 72 73 0a 3d 3d 3d 3d 3d 3d 3d 3d |mputers.========| 00001b30 3d 3d 3d 3d 3d 3d 3d 0a 0a 49 74 20 73 68 6f 75 |=======..It shou| 00001b40 6c 64 20 62 65 20 66 61 69 72 6c 79 20 65 61 73 |ld be fairly eas| 00001b50 79 20 74 6f 20 70 72 6f 64 75 63 65 20 61 20 6c |y to produce a l| 00001b60 6f 61 64 65 72 20 70 72 6f 67 72 61 6d 20 66 6f |oader program fo| 00001b70 72 20 61 6e 6f 74 68 65 72 20 63 6f 6d 70 75 74 |r another comput| 00001b80 65 72 2c 0a 61 73 20 74 68 65 20 70 72 6f 74 6f |er,.as the proto| 00001b90 63 6f 6c 20 64 6f 65 73 6e 27 74 20 6e 65 65 64 |col doesn't need| 00001ba0 20 61 6e 79 20 6b 6e 6f 77 6c 65 64 67 65 20 6f | any knowledge o| 00001bb0 66 20 74 68 65 20 66 69 6c 69 6e 67 20 73 79 73 |f the filing sys| 00001bc0 74 65 6d 20 61 70 61 72 74 20 66 72 6f 6d 0a 74 |tem apart from.t| 00001bd0 68 65 20 66 69 6c 65 20 6e 61 6d 65 20 28 74 68 |he file name (th| 00001be0 65 20 6c 6f 61 64 2f 65 78 65 63 20 61 64 64 72 |e load/exec addr| 00001bf0 65 73 73 65 73 20 61 72 65 20 74 72 61 6e 73 6d |esses are transm| 00001c00 69 74 74 65 64 2c 20 62 75 74 20 6e 6f 74 20 75 |itted, but not u| 00001c10 73 65 64 29 2e 20 4f 66 0a 63 6f 75 72 73 65 2c |sed). Of.course,| 00001c20 20 74 68 61 74 20 77 6f 75 6c 64 20 6f 6e 6c 79 | that would only| 00001c30 20 6c 65 74 20 79 6f 75 20 74 72 61 6e 73 66 65 | let you transfe| 00001c40 72 20 70 72 6f 67 72 61 6d 73 20 74 6f 20 74 68 |r programs to th| 00001c50 65 20 41 72 63 2c 20 75 6e 6c 65 73 73 20 79 6f |e Arc, unless yo| 00001c60 75 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 20 74 68 |u.implemented th| 00001c70 65 20 69 6e 76 65 72 73 65 20 70 72 6f 74 6f 63 |e inverse protoc| 00001c80 6f 6c 20 69 6e 20 74 68 65 20 41 72 63 20 70 72 |ol in the Arc pr| 00001c90 6f 67 72 61 6d 2e 20 49 20 64 69 64 6e 27 74 20 |ogram. I didn't | 00001ca0 73 65 65 20 6d 75 63 68 20 70 6f 69 6e 74 0a 69 |see much point.i| 00001cb0 6e 20 64 6f 69 6e 67 20 74 68 69 73 20 66 6f 72 |n doing this for| 00001cc0 20 74 68 65 20 42 65 65 62 3b 20 74 68 65 20 6c | the Beeb; the l| 00001cd0 6f 61 64 65 72 20 70 72 6f 67 72 61 6d 20 6f 6e |oader program on| 00001ce0 6c 79 20 6a 75 73 74 20 66 69 74 73 2c 20 61 6e |ly just fits, an| 00001cf0 64 20 42 61 73 69 63 20 61 6e 64 0a 74 65 78 74 |d Basic and.text| 00001d00 20 66 69 6c 65 73 20 61 72 65 20 66 61 69 72 6c | files are fairl| 00001d10 79 20 65 61 73 79 20 74 6f 20 74 72 61 6e 73 66 |y easy to transf| 00001d20 65 72 20 61 6e 79 77 61 79 20 2d 20 6a 75 73 74 |er anyway - just| 00001d30 20 64 6f 20 2a 46 58 20 32 2c 31 20 6f 6e 20 74 | do *FX 2,1 on t| 00001d40 68 65 20 42 65 65 62 2c 0a 61 6e 64 20 6f 6e 20 |he Beeb,.and on | 00001d50 74 68 65 20 41 72 63 20 74 79 70 65 20 22 46 69 |the Arc type "Fi| 00001d60 6c 65 72 5f 4f 70 65 6e 44 69 72 20 73 65 72 69 |ler_OpenDir seri| 00001d70 61 6c 3a 22 20 61 74 20 74 68 65 20 63 6f 6d 6d |al:" at the comm| 00001d80 61 6e 64 20 6c 69 6e 65 2e 20 54 68 69 73 20 6f |and line. This o| 00001d90 70 65 6e 73 0a 61 20 66 69 6c 65 72 20 77 69 6e |pens.a filer win| 00001da0 64 6f 77 20 66 6f 72 20 74 68 65 20 73 65 72 69 |dow for the seri| 00001db0 61 6c 20 70 6f 72 74 2c 20 61 6e 64 20 66 69 6c |al port, and fil| 00001dc0 65 73 20 64 72 61 67 67 65 64 20 69 6e 74 6f 20 |es dragged into | 00001dd0 69 74 20 77 69 6c 6c 20 62 65 20 74 79 70 65 64 |it will be typed| 00001de0 0a 69 6e 74 6f 20 42 61 73 69 63 20 6f 72 20 79 |.into Basic or y| 00001df0 6f 75 72 20 66 61 76 6f 72 69 74 65 20 77 6f 72 |our favorite wor| 00001e00 64 70 72 6f 63 65 73 73 6f 72 2e 20 57 6f 75 6c |dprocessor. Woul| 00001e10 64 20 74 68 61 74 20 69 74 20 77 65 72 65 20 74 |d that it were t| 00001e20 68 61 74 20 65 61 73 79 20 69 6e 0a 74 68 65 20 |hat easy in.the | 00001e30 6f 74 68 65 72 20 64 69 72 65 63 74 69 6f 6e 21 |other direction!| 00001e40 20 41 6e 6f 74 68 65 72 20 70 6f 73 73 69 62 69 | Another possibi| 00001e50 6c 69 74 79 20 77 6f 75 6c 64 20 62 65 20 74 6f |lity would be to| 00001e60 20 75 73 65 20 74 68 65 20 42 65 65 62 20 61 73 | use the Beeb as| 00001e70 20 61 20 76 65 72 79 0a 73 6c 6f 77 20 74 61 70 | a very.slow tap| 00001e80 65 20 73 74 72 65 61 6d 65 72 20 66 6f 72 20 68 |e streamer for h| 00001e90 61 72 64 20 64 69 73 63 20 62 61 63 6b 75 70 2c |ard disc backup,| 00001ea0 20 62 75 74 20 74 68 61 74 20 77 6f 75 6c 64 20 | but that would | 00001eb0 62 65 20 61 20 63 6f 6d 70 6c 65 74 65 6c 79 0a |be a completely.| 00001ec0 64 69 66 66 65 72 65 6e 74 20 70 72 6f 67 72 61 |different progra| 00001ed0 6d 20 28 61 6e 64 20 77 6f 75 6c 64 20 79 6f 75 |m (and would you| 00001ee0 20 74 72 75 73 74 20 69 74 3f 29 2e 0a | trust it?)..| 00001eed