[ Disclaimer | Preparation | Parts | Building | Testing | EPROM | Installation | Usage | Home ]
Greg Cook, 19/Sep/2008
This page describes how to add 128 KB of paged RAM plus 128 KB of paged ROM to the BBC model A or B.
This project is intended for those who are competent at PCB reworking. You will need a pair of crimpers or pliers, plus common soldering tools such as a wire stripper, a pair of side cutters, electronics solder, a damp sponge, a soldering iron and a desoldering pump. In the description below, the verb ‘solder’ implies cleaning the iron, stripping, tinning, desoldering where necessary as well as soldering proper.
While handling the ICs or doing work on the BBC Micro wear an antistatic wristband connected via a 4.4 megohm resistor to an earthed metal object such as a water pipe.
Some ICs will need to be set aside temporarily; you will need a 5 x 10 cm piece of antistatic foam (no longer sold at Maplin) to push them into until they are needed.
To program the custom EPROM you will need an EPROM programmer, or to make use of a commercial programming service. Alternatively, the upgrade will work with existing pre-programmed EPROMs.
The upgrade consists of the following parts. Here is a list drawn up according to the Maplin Electronics Spring/Summer 2005 catalogue:
Catalogue no. | Description | Quantity | Unit price (£) | Price (£) |
---|---|---|---|---|
N40BA | UT621024PC-70LL 128Kx8 SRAM(*) | 1 | 2.99 | 2.99 |
AW34M | M27C1001-10F1 128Kx8 EPROM | 1 | 2.99 | 2.99 |
FZ65V | 0.6in 32 pin socket (Turned) | 2 | 0.79 | 1.58 |
FZ63T | 0.6in 28 pin socket (Turned) | 2 | 0.79 | 1.58 |
HB59P | PCB latch housing 2-way | 1 | 0.19 | 0.19 |
YW25C | 10off 0.1in Socket Terminals | 1 | 0.59 | 0.59 |
BL07H | 7/0.2mm Wire 10m Red | 1 | 0.99 | 0.99 |
Total | 10.91 | |||
(BL21X) | (DIL Socket 28-pin (Stamped))(**) | (2) | (0.14) | (0.28) |
(*) Not found on Maplin Electronics Web site, try your local store. Alternative source is Farnell 3345932, @ £3.83 ea + VAT (19/Sep/2005) or 1488952, @ £1.66 ea + VAT (19/Sep/2008; found by Michael Firth).
(**) In this build, the headers PL1 and PL2 were stamped pin sockets, for fear that turned pins would bend the contacts on the BBC motherboard. It turns out that this type of socket is mechanically unsuitable for dry work. The pins are thin enough that they let the header come out of the mobo socket whenever the ROM is changed, and when it is pushed back in the pins may bend easily under the moulding without resistance to warn you.
Therefore turned pin sockets are a better option for this project, at the slightly increased risk of the motherboard sockets not accepting ROMs again. Turned pins are close to the dimensions of genuine IC legs.
To confirm successful installation the RAM should be tested. At this point the BBC Micro can be used as normal, except we have traded one of the 4 physical ROM sockets for 4 pages of RAM. The motherboard will look something like this:
The following program will perform a simple test. Type it in, then save it on disc (and also on cassette if possible, for use later on). Press CTRL-BREAK, then enter CHAIN "MEMTST". Warning: Do not use MEMTST while a GoMMC board is installed.
10 REM >MEMTST 20 REM Greg Cook 10/May/2005 30 REM WARNING - Do not use while GoMMC is installed 40 X%=RND(-TIME) 50 addr=&70 60 mos_current_rom=&F4 70 : 80 DIM code% 128, buf% 511 90 buf%=(buf%+255) AND NOT 255 100 : 110 FOR pass%=0 TO 2 STEP 2 120 P%=code% 130 [OPT pass% 140 .write LDY #0:STY addr:STA addr+1 150 .write_loop DEY:TXA 160 EOR addr+1:EOR buf%,Y 170 PHP:SEI:STX &FE30 180 STA (addr),Y 190 LDA mos_current_rom:STA &FE30:PLP 200 CPY #0:BNE write_loop 210 RTS 220 : 230 .read LDY #0:STY addr:STA addr+1 240 .read_loop TXA 250 EOR addr+1:EOR buf%,Y 260 PHP:SEI:STX &FE30 270 CMP (addr),Y:BNE read_unlock_exit 280 LDA mos_current_rom:STA &FE30:PLP 290 INY:BNE read_loop 300 CLC:RTS 310 .read_unlock_exit 320 \A=expected value, X=rom (discard), y=offset (store in addr) 330 \Return A=actual value, X=expected value, y=clobbered 340 TAX:LDA (addr),Y 350 STY addr 360 LDY mos_current_rom:STY &FE30:PLP 370 SEC:RTS 380 ] 390 NEXT 400 : 410 FOR X%=0 TO 255 STEP 4:buf%!X%=RND:NEXT 420 FOR Y%=0 TO 1 430 PRINT"Pass ";Y%'"Writing" 440 FOR X%=15 TO 0 STEP -1 450 PRINT"Page ";:IF X%<10 PRINT" ";:IF 0 ELSE PRINT ;X%; 460 IF X%?&2A1=0 FOR A%=&BF TO &80 STEP -1:CALLwrite:NEXT: PRINT" . done":NEXTELSEPRINT" - in use, not writing":NEXT 470 : 480 PRINT"Decay wait..."; 490 Z%=TIME:REPEAT UNTIL TIME-Z%>=1000 500 PRINT'"Reading" 510 FOR X%=0 TO 15 520 PRINT"Page ";:IF X%<10 PRINT" ";:IF 0 ELSE PRINT ;X%; 530 IF X%?&2A1<>0 PRINT" - in use, not testing":NEXT:NEXT:END 540 FORA%=&80 TO &BF 550 Z%=USR(read) 560 IF Z% AND &1000000 PRINT" X Test failed at "; ~(!addr AND&FFFF);": ";~Z%AND&FF;"<>"; ~(Z%AND&FF00)DIV&100:A%=&100 570 NEXT:IF A%<&100 PRINT" . RAM test okay" 580 NEXT 590 FOR X%=0 TO 255 STEP 4:buf%!X%=NOT buf%!X%:NEXT 600 NEXT
If everything is working correctly, MEMTST
should report RAM test okay
for pages 3, 7, 11 and 15. The appearance of RAM test failed
for other pages is normal, as it means some of the paged ROM slots are unoccupied.
Paged ROM space on the BBC Micro consists of a 16K window in main memory, which can be mapped to one of sixteen logical ‘ROM slots.’ On Models A and B there are four physical sockets, that each supply 16 KB of paged ROM content. By taking the unused outputs of the ROMSEL latch as extra address lines, we can increase this to 64 KB per socket. (The Model B+ has 6 sockets that accept 32 KB ROMs without modification.) The mapping is as laid out in the table below:
IC 52 | IC 88 | IC 100 | IC 101 |
---|---|---|---|
ROM 12 | ROM 13 | ROM 14 | ROM 15 |
ROM 8 | ROM 9 | ROM 10 | ROM 11 |
ROM 4 | ROM 5 | ROM 6 | ROM 7 |
ROM 0 | ROM 1 | ROM 2 | ROM 3 |
Our RAM and ROM chips each carry 128 KB, and to make full use of them we need more address space per socket. We do this by repurposing QA, the low bit of the ROMSEL latch. It now goes to provide a third extended address line, and its previous duty of selecting the ROM is suspended. Input A of IC20, the quad decoder is tied to +5V, so that only IC88 and IC101 receive a /CS low signal. The result is as follows:
IC 52 | IC 88 | IC 100 | IC 101 | ||
---|---|---|---|---|---|
n/a | ROM 12 | ROM 13 | n/a | ROM 14 | ROM 15 |
ROM 8 | ROM 9 | ROM 10 | ROM 11 | ||
ROM 4 | ROM 5 | ROM 6 | ROM 7 | ||
ROM 0 | ROM 1 | ROM 2 | ROM 3 |
As can be seen, the other two sockets are no longer serviceable. To allow the GoMMC board or an original ROM release to be fitted later, socket redirection is achieved by a flying lead so as to be reversible.
U2 can accept 28 or 32 pin ROMs. Any size of device can be used; up to 64 KB of it will be mapped to paged ROM space, or up to 128 KB if socket redirection is enabled. Because of this, 128 KB devices will be mapped in non-ascending order:
The contents of smaller devices will be duplicated until they fill the 128 KB address space.
As stated in the User Guide, ROMs in a higher numbered slot will be given priority of ROM calls, *
commands, language selection on startup, and so on. The MOS will ignore a ROM that is an identical copy of one in a higher slot.
For devices up to 64 KB, it is simply a matter of placing low priority ROM images first (in the low addresses) and higher priority ROM images, such as filing systems, last (in the high addresses). Place each image on a 16 KB boundary.
For 128 KB devices, it is more complicated since the first four ROM slots (those with even numbers) may become unavailable if socket redirection is disabled. The filing system usually insists on having highest priority; therefore it goes at the end of the ROM, in slot 13. BASIC could go in slot 9, so as always to be available. But if another occasionally-used language is placed in slot 12, halfway through the ROM, it will take control on power-up instead of BASIC, which appears at a higher chip address.
Personally, I have found it more flexible to place BASIC at the end of the ROM. It claims no *
commands, and adds minimal delay to service calls as it has no service entry. It means that languages can be placed anywhere else in the ROM.
If the device is larger than required, only the last (highest) addresses need to be programmed.
A conflict between ROM images has the potential to hang the BBC Micro on startup. *
commands can be claimed by the wrong ROM (note that changing the order does not always resolve hijacked *
commands, since they are offered to all ROMs via service call 4, then to the current filing system via OSFSC 3.)
If you have a BBC Micro emulator available, it is wise to test the arrangement of paged ROMs before programming the custom EPROM.
The computer should look something like this:
Press CTRL-BREAK and enter *BASIC followed by CHAIN "MEMTST". If BASIC is the only ROM installed (in U2) then socket redirection can be enabled, and MEMTST can be loaded from cassette or serial link, or typed in again. The successful result is that pages 2, 3, 6, 7, 10, 11, 14 and 15 will indicate RAM test okay
. Again, disregard the failure reports for other pages. When the sockets are not redirected then the result should be as described in Intermediate testing above.
Enter *HELP. Check that the applications are listed in the desired order, the highest priority entries coming first. Some ROMs do not give a *HELP
entry. Some utilities are able to list all ROMs, so try entering *ROMS.
This upgrade has been designed to provide paged RAM in the two highest slots, so that firmware that needs top priority service can be installed there.
The syntax to load ROM images into paged RAM varies. *HELP SRLOAD may give clues. Under Opus EDOS simply enter *OPT 9,<slot number> followed by *LOAD IMAGE 8000. After installation press CTRL-BREAK so the MOS will recognise the ROM.
To protect against piracy many commercial ROM titles attempt to overwrite themselves to see if they are installed in genuine read-only memory. The RAM installed in this upgrade is unconditionally writeable, and such titles loaded there will either deliberately malfunction or refuse to run.
The ADE Plus 1.0 assembler and other utility ROMs search for paged RAM and allocate it as a printer buffer. It may also be possible to configure ADE to use it as workspace for assembling code.
There exists on the World Wide Web a version of BAS128 that will run on a Model B+, or on a Model B by overwriting most of the display. It loads from cassette or disc, runs in main memory and uses paged RAM to store the BASIC program, variables and stack. With this memory upgrade 64 KB are available to the user. Note that BAS128 maintains a virtual address space starting from &10000, and memory blocks allocated by DIM
are not recognised by the MOS or accessible to *LOAD
, *SAVE
, or machine code programs.
>REM To invoke BAS128 on a Model B+ >*/BAS128 >REM To invoke BAS128 on a Model B (from the serial port) >MODE 7: VDU 28,32,24,39,24: */BasObj >REM The memory space can be tested with the following BAS128 program: >LIST 10 L%=&FDFF 20 DIM F% L%, A% -1 30 PRINT~PAGE,~TOP,~LOMEM,~HIMEM,~F%,~A% 40 N%=TIME 50 X%=RND(-N%) 60 FORX%=0 TO L% STEP 4:F%!X%=RND:NEXT 70 X%=RND(-N%) 80 FORX%=0 TO L% STEP 4:IFF%!X%<>RND PRINT~X%,~F%!X%:STOP ELSENEXT 90 PRINT "BAS128 test okay" >RUN 10000 100C5 100C5 20000 100C5 1FEC5 BAS128 test okay >
When the BBC Micro reports this error and hangs, it means one or more of the following:
The data contained in paged RAM is, of course, retained until the machine is powered down. In the event that a ROM image hangs the machine when BREAK is pressed, turn the computer off for 30 seconds so that the image decays.
Alternatively, there may be a conflict in the custom EPROM.
In most cases, this is normal. Pages 0, 1, 4, 5, 8, 9, 12 and 13 will ordinarily fail the RAM test. When socket redirection is disabled, RAM will neither be found in pages 2, 6, 10 or 14.
Note this chart gives rough estimates, and a firm diagnosis will require more thorough testing.
<>
) = &80
okay
Every effort has been made to ensure accuracy, however there may be occasional errors or omissions. Pricing, availability and specification of components are subject to change without notice. The code and documentation included in this document (including, but not limited to parts lists, instructions, program listings, tables, diagrams and digital images) are supplied without warranty, not even the implied warranties of merchantability or fitness for a particular purpose. In no event shall the author or his suppliers be liable for any loss, damage, injury or death, of any nature and howsoever caused, arising from the use of, or failure, inability or unwillingness to use, this software or documentation.
Greg Cook,[ Top of page ]