Retro computing: BBC Micro goldmine

Typical BBC computer setup of 1980's

Introdution

Micro User archive This page is dedicated to the BBC Microcomputer, a home computer dating from the early 1980's, on which the foundations of my computer-knowledge were built. Also to all those who wrote the extremely helpful books and magazines at that time, particularly to the contributers of "Micro User" magazine.

What you may not know is that there are some great BBC emulators around, which let you run all your favorite BBC programs and games from the comfort of your IBM PC. I strongly recommend pcBBC (or at the ?newer?, but less pretty site at pcBBC), written by Stuart McConnachie of Nottingham. See also the BBC Lives website for lots of links to BEEB-related stuff.

Backup and File transfer

Odds are that if you've got a BBC computer, you have a pile of 5.25" floppy disks which are taking up space, and gradually decomposing. Probably the best way of preserving that data for the future is to copy the disks to your PC while you can (assuming you still have an operational BBC micro to hand).

The pcBBC emulator -- and most of the others apparently -- require a "disk image" file: this is just one big PC file which contains literally all the data from a BBC floppy disk. This kind of file preserves all the LOAD, RUN, and EXECUTE addresses of files (which many applications require), and can faithfully reproduce the extra information used by many special disk formats used by games for anti-piracy measures.

Although I have included details of a minimal file-transfer system below, there are probably better ones elsewhere on the net.


BBC-disk-image-on-PC to native PC filesystem transfer

BBC disk-content-extractor My main contribution to the BBC-on-PC field at present is a Windows 95/98/NT based "BBC disk-image content extractor" - a program to extract individual files from those ubiquitous BBC-disk-images to your PC filesystem. The program works with both DFS and ADFS disk images. When I get time, I should enable it to de-tokenise BASIC programs, and display BBC screen dumps and AMX Art pictures. In the mean time, if you need listings of BBC BASIC programs as PC text files, you should run an emulator such as pcBBC, LOAD the file you want to list, type *SPOOL txtfile, LIST, *SPOOL -this will write a text listing to the BBC disk-image, which you can then extract using my program.

Downloads

Download the BBC Disk-content extractor: bbcdisk.exe (268kB) [Win95/98/NT only].
As always, by downloading software from my website, you consent to my DISCLAIMER (see elsewhere on my site) - basically that all programs are supplied in good faith, but that you accept the full risk: I am liable for nothing in the event that anything goes amiss.

BBC-to-PC disk transfer

If you've got this far, you are probably familiar with the BBC microcomputer! As I mentioned before, there are probably better systems elsewhere on the net. However, if you have the programmer mentality (as most BEEB affictionados do), the material here should be enough to get you started.

What you need

BBC "send" programs

Type the program(s) into your BBC micro, and save to its disk (if you have any left).

For standard BBC B DFS-format disks


   10 REM Program to transfer images (of DFS) BBC computer disks to a PC
   20 REM via the serial port, for archival storage.
   30 REM (C) W.A.Steer 1998
   40 REM
   50 *KEY0 OSCLI"FX8,8":OSCLI"FX7,8":OSCLI"FX3,1":OSCLI"FX181,0":OSCLI"FX2,1"|M
   60 addr=&70
   70 check=&74
   80 DIM D% 10240
   90 PROCassem
  100 MODE7
  110 *FX21,0
  120 PROCinitdiscs
  130 PROClm
  140 PROCcopy
  150 GOTO100
  160 END
  170 :
  180 DEFPROCinitdiscs
  190 INPUT''"DFS Source drive: "SO%
  200 :
  210 PRINT''"Please put SOURCE disc into drive ";SO%
  220 PRINT"and press any key";:A=GET:PRINT
  230 A%=&7E:X%=&70:Y%=&09:CALL&FFF1
  240 ?&973=0
  250 TR%=!&970 DIV 2560
  260 ENDPROC
  270 :
  280 DEFPROClm
  290 PRINT''"Ensure drive is set to ";
  300 IF TR%=40 THEN PRINT "40"; ELSE PRINT"80";
  310 PRINT" tracks."
  320 VDU28,0,24,39,10
  330 PRINT''"Now start PC going, and press a key";
  340 A=GET:PRINT
  350 ENDPROC
  360 :
  370 DEFPROCcopy
  380 *FX7,8
  390 *FX8,8
  400 !check=0 :REM Initialise checksum
  410 FOR T%=0 TO TR%-1
  420 PROCaccess(T%,SO%,&57,D%)
  460 PRINT"Sending track ";T%;
  470 *FX3,7
  480 !addr=D%
  490 CALL send
  500 *FX3
  501 PRINT"   ";~!check
  510 NEXT
  520 PRINT"Disc transferred."
  530 PRINT"Check: ";~((!check) AND &FFFF)
  540 PRINT'"Press any key";:A=GET
  550 ENDPROC
  560 :
  570 DEFPROCassem
  580 FOR T%=0 TO 3 STEP 3
  590 P%=&C00
  600 [OPT T%
  610 .send
  620 SEI
  630 LDX#&0A \ Send 2560 bytes (&0A00)
  640 LDY#0
  650 .loop
  660 LDA (addr),Y
  670 JSR &FFEE
  680 CLC:ADC check:STA check:LDA#0:ADC check+1:STA check+1
  690 INY
  700 BNE loop
  710 INC addr+1
  720 DEX
  730 BNE loop
  740 CLI
  750 RTS
  760 ]
  770 NEXT
  780 ENDPROC
  790 :
  800 DEFPROCaccess(t%,dr%,rw%,ad%)
  810 ?&970=dr%
  820 ?&971=ad% MOD 256
  830 ?&972=ad% DIV 256
  840 ?&973=&FF
  850 ?&974=&FF
  860 ?&975=3
  870 ?&976=rw%
  880 ?&977=t%
  890 ?&978=0
  900 ?&979=&2A : REM 10sectors (1 trk)
  910 A%=&7F:X%=&70:Y%=&09:CALL&FFF1
  920 ENDPROC

   

For ADFS format disks (mainly seen on the BBC Master series)

   10 REM Program to transfer images (of ADFS) BBC computer disks to a PC
   20 REM via the serial port, for archival storage.
   30 REM (C) W.A.Steer 1997
   40 REM
   50 *KEY0 OSCLI"FX8,8":OSCLI"FX7,8":OSCLI"FX3,1":OSCLI"FX181,0":OSCLI"FX2,1"|M
   60 addr=&70
   70 check=&74
   80 DIM D% 16384
   90 *DIR :0
  100 PROCassem
  110 MODE7
  120 *FX21,0
  130 PROCinitdiscs
  140 PROClm
  150 PROCcopy
  160 GOTO110
  170 END
  180:
  190 DEFPROCinitdiscs
  200 INPUT''"Source drive: "SO%
  210:
  220 PRINT''"Please put SOURCE disc into drive ";SO%
  230 PRINT"and press any key";:A=GET:PRINT
  240 PROCaccess(0,1,SO%,&08, D%)
  250 TR%=((D%!&FC AND &FFFFFF) DIV 16)
  260 ENDPROC
  270:
  280 DEFPROClm
  290 PRINT''"Ensure drive is set to ";
  300 IF TR%=40 THEN PRINT "40"; ELSE PRINT"80";
  310 PRINT" tracks."
  320 VDU28,0,24,39,10
  330 PRINT''"Now start PC going, and press a key";
  340 A=GET:PRINT
  350 ENDPROC
  360:
  370 DEFPROCcopy
  380 *FX7,8
  390 *FX8,8
  400 !check=0 :REM Initialise checksum
  410 FOR T%=0 TO TR%-1 STEP 4
  420 PROCaccess(T%,64,SO%,&08,D%)
  430 PRINT"Sending track ";T%;
  440 *FX3,7
  450 !addr=D%
  460 CALL send
  470 *FX3
  475 PRINT"   ";~!check
  480 NEXT
  490 PRINT"Disc transferred."
  500 PRINT"Check: ";~((!check) AND &FFFF)
  510 PRINT'"Press any key";:A=GET
  520 ENDPROC
  530:
  540 DEFPROCaccess(t%,ns%,dr%,rw%,ad%)
  550 s%=t%*16
  560 DIM B% 32
  570 B%?0=0
  580 B%!1=ad%
  590 B%?5=rw%
  600 B%?6=(s% DIV 65536)+(dr%*32)
  610 B%?7=(s% MOD 65536) DIV 256
  620 B%?8=s% MOD 256
  630 B%?9=ns%
  640 B%?10=0
  650 B%!11=0
  660 A%=&72
  670 X%=B% MOD 256:Y%=B% DIV 256:CALL&FFF1
  680 IF ?B%<>0 THEN PRINT"Error ";?B%
  690 ENDPROC
  700:
  710 DEFPROCassem
  720 FOR T%=0 TO 3 STEP 3
  730 P%=&C00
  740 [OPT T%
  750 .send
  760 SEI
  770 LDX#64
  780 LDY#0
  790 .loop
  800 LDA (addr),Y
  810 JSR &FFEE
  820 CLC:ADC check:STA check:LDA#0:ADC check+1:STA check+1
  830 INY
  840 BNE loop
  850 INC addr+1
  860 DEX
  870 BNE loop
  880 CLI
  890 RTS
  900 ]
  910 NEXT
  920 ENDPROC
   

Explanation of programs

Line 80, DIM D% .... reserves space for a one-track buffer.
PROCassem assembles the machine-code routines for sending the data (m/c for speed).
PROCinitdiscs reads the first track of the disk and determines the disc size. In the case of special Acorn/Superior "dual format" 40/80-track disks, you might have to temporarily insert a line 255 which reads
 255 TR%=40 
to force 40-track behaviour.
PROClm prompts the user to set the drive switch to 40/80 tracks, as appropriate.
PROCcopy steps through the tracks, calling PROCaccess to read the track, then CALLs the machine code to send it down the serial lead to the PC..
PROCaccess sets up a parameter-block, then calls a file-system OSWORD (&FFF1) routine to read a disk-track into the memory reserved by D%.
The machine-code routine "send" simply steps through the memory, "printing" each byte to the default output stream (the *FX3,7 makes RS423 default) via a call to &FFEE (OSWRCH - Operating System WRite CHaracter - for those who've forgotten!).

PC "receive" program

This is especially primitive, but just about does the job!
Download this program and save to disk bbcbkup.exe. It is a text-mode program which runs under Windows 3.1 or later.
For those of you not using COM1 and 80-track DFS disks, or who have time to do a better job, the C++ source code (requires Windows libraries) is available: getbbcd4.cpp.

When you run it, you need to enter the full path and name where you want to store the disk image. [eg c:\bbcdisks\disk1.img ] Please only use 8-letter directory and filenames - the program was written for 16-bit windows!
Note that the pcBBC emulator expects ADFS disk images to have the extension ".adf" and DFS ones ".img".

When the file has transferred, a checksum figure is displayed on both machines. It is up to YOU to see that these tally. If they don't, your only option is to re-send the disk until it does.

Failing all that, the full version (£10) of pcBBC incorporates some file-transfer programs -- which I haven't tried myself.

RS232/423 cable

Details to follow.

You ought to put resistive droppers in the cable on the signal lines driven by your PC. This prevents possible damage to your trusty BEEB, and may be required in order for the transfer to work anyway!


Last modified: 5 December 1999
Source: http://www.ucl.ac.uk/~ucapwas/bbc/

© William Andrew Steer
email: w.steer@ucl.ac.uk