MAME: Internal ROM/RAM expansion boards

want to talk about MESS/model b/beebem/b-em/electrem/elkulator? do it here!
Post Reply
User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

MAME: Internal ROM/RAM expansion boards

Post by Pernod » Fri Oct 11, 2019 12:53 pm

I'm currently looking at adding the many internal RAM/ROM expansion boards that were available.

My aim is to implement the following, some are already done:
- Aries-B12 ROM expansion
- Aries-B20 RAM expansion
- Aries-B32 RAM expansion
- ATPL Sidewise ROM/RAM expansion
- Computech Integra-B
- Computer Village CVX16
- GCC Romex13
- Peartree MR3000
- Peartree MR4200
- Peartree MR4300
- Peartree MR4800
- Ramamp Computers Sideways RAM/ROM board
- Raven-20 RAM expansion
- Solidisk TwoMeg 128K
- Solidisk FourMeg 32K
- Solidisk FourMeg 256K
- Solidisk SWR16
- Solidisk SWR32
- Solidisk SWR64
- Solidisk SWR128
- Solidisk SWR256
- Watford Electronics 12 ROM board
- Watford Electronics 13 ROM board
- Watford Electronics RAM/ROM board
- Watford Electronics Apex Control Card (http://chrisacorns.computinghistory.org ... _Apex.html)
- Watford Electronics Eureka 64K (need ROM from http://www.computinghistory.org.uk/det/ ... ureka-64K/)
- Watford Electronics Delta card (advert only, no information)
- Watford Electronics 32K Shadow RAM

For the B+:
- ATPL Sidewise+ ROM expansion

For the Master:
- Morley Master Board 'AA'
- Vine Micros OS Overlay Board
- Master Replay

Are there anymore that I'm not aware of?

My first query is regarding the Solidisk SWR boards. To write to them you have to set the DDRB register with ?&FE62=15, then select the bank to write to with ?&FE60=bank. Looking at the installation guide for these boards shows only 3 wires connected to the VIA port B, so cannot fully decode values 8-15.
So if anyone has one of these SWR boards fitted could they test whether writing ?&FE60=6 will write to bank 14?
Last edited by Pernod on Tue Oct 22, 2019 4:31 pm, edited 20 times in total.
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Sat Oct 12, 2019 6:31 pm

Pernod wrote:
Fri Oct 11, 2019 12:53 pm
My first query is regarding the Solidisk SWR boards. To write to them you have to set the DDRB register with ?&FE62=15, then select the bank to write to with ?&FE60=bank. Looking at the installation guide for these boards shows only 3 wires connected to the VIA port B, so cannot fully decode values 8-15.
So if anyone has one of these SWR boards fitted could they test whether writing ?&FE60=6 will write to bank 14?
This seems to be confirmed by Wouter at http://wouter.bbcmicro.net/bbc/hardware ... k/swr.html

Moving on to the shadow RAM implementations, there's not much documented about them, apart from the Integra.

The Watford 32K Shadow RAM board manual states:
A write to &FFFF will select the Watford
RAM and a write to &FFFE will select the BBC RAM. This
applies for memory locations &3000 to &7FFF. To swap the
whole memory write to &FFFC. This is a crude method and not
normally advised as there are problems doing this - you must
disable interrupts, and you can only do this from a sideways
ROM.
When writing to &FFFC has anyone determined how much RAM is actually swapped? Swapping the whole 32K &0000-&7FFF doesn't make sense as it'd lose the 6502 stack. I'm basically having to use trial and error here to find what actually works without hanging the emulated machine.
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Sun Oct 13, 2019 2:38 am

The Aries-B20 seems simple enough.

Enabled with a write to &FFFF and disabled with a write to &FFFE.
0110.png
Last edited by Pernod on Sun Oct 13, 2019 12:20 pm, edited 1 time in total.
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Sun Oct 13, 2019 12:20 pm

The Raven-20 is 20K shadow RAM from &3000-&7FFF.

Enabled with a write to &D000 and disabled with a write to &C000.
0114.png
0116.png
0115.png
The ROM also supports a FAST mode with *FRON, which isn't mentioned in the manual, so a little more investigation is required.
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Sun Oct 13, 2019 5:23 pm

Has anyone reverse engineered the Aries-B32 (would save me a task)?

Can't find any technical info for it but implements features on writes to &FE30, &FE36, &FE3A, &FE3E, &FE3F.
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Mon Oct 14, 2019 5:25 pm

Does anyone have Solidisk Manager 128 ROM, specifically for the Solidisk Twomeg 128 board? All the copies I've found are identical and incomplete, such as http://bbc.nvg.org/rom/SoliDisk/util/

There are many variants of the Manager ROM out there but none for the 128 board. As usual with Solidisk ROMs they use the same name for versions intended for use with different boards. The version I'd like should identify itself as Manager 128.
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
KenLowe
Posts: 707
Joined: Mon Oct 18, 2004 4:35 pm
Location: Scotland
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by KenLowe » Mon Oct 14, 2019 8:42 pm

Unfortunately, I'm not able to help with any of your queries, but watching this thread with interest as you continue to develop your emulator. Great work so far. =D> =D> =D>

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Mon Oct 14, 2019 9:08 pm

KenLowe wrote:
Mon Oct 14, 2019 8:42 pm
Unfortunately, I'm not able to help with any of your queries, but watching this thread with interest as you continue to develop your emulator. Great work so far. =D> =D> =D>
Thanks, nice to know someone's interested. I'm surprised other emulators haven't implemented the Aries boards or the Watford 32K RAM board, as they were quite popular. Most of the other boards are simply adding ROM sockets and banks of RAM so not too interesting, except the Watford RAM/ROM which implements software write protect.

As usual, anything Solidisk is confusing with their masses of ROM versions without any real indication of expected hardware.
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
1024MAK
Posts: 9236
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by 1024MAK » Mon Oct 14, 2019 9:22 pm

Oh there are other interested people watching. Myself (apart from being rather busy at the moment, so very little time for hobbies), don’t have any of the rare beasts you need information on, hence it’s hard to help.

But please do keep at it. Your hard work is appreciated :D

Mark

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Tue Oct 15, 2019 12:53 pm

Looks like the STL Toolkit is intended for use with their SWR16-128 boards. Solidisk adverts don't really say much about this.

So I now automatically install the STL Toolkit with any STL SWR board, and 1.3 seems to be the latest for these boards. There is a version 1.4 out there that adds support for the 256K boards.

This is running with the SWR128 board fitted:
0117.png
Last edited by Pernod on Tue Oct 15, 2019 1:29 pm, edited 1 time in total.
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
CMcDougall
Posts: 6796
Joined: Wed Feb 02, 2005 3:13 pm
Location: Shadow in a Valley of Scotland
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by CMcDougall » Tue Oct 15, 2019 1:11 pm

the Watford 144k ram /rom board rocks, what I had BITD, and installed that also myself at 10yr old :D
the disc for it & scan is here :
viewtopic.php?f=3&t=8755&p=97191&hilit=watford#p96318

I have a Aries B32 & B12 too, with manuals, but can be found on net anyways.
plus the extra B12 ROM board I have does not play ball at mo...... :cry:
ImageImageImage

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Tue Oct 15, 2019 4:30 pm

CMcDougall wrote:
Tue Oct 15, 2019 1:11 pm
the Watford 144k ram /rom board rocks, what I had BITD, and installed that also myself at 10yr old :D
the disc for it & scan is here :
viewtopic.php?f=3&t=8755&p=97191&hilit=watford#p96318
Thanks, it was probably your floppy image that I used to test the implementation.
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Tue Oct 15, 2019 6:55 pm

A little progress on the Solidisk Twomeg 128 board:
0119.png
This is just implementing the sideways RAM, no shadow RAM yet. It's also supposed to work with the SideAid128 ROM from CaTs, see http://www.computinghistory.org.uk/det/ ... ade-Board/, but hangs when jumping to invalid code at &8000 in the ROM. There's only a single version of SideAid128 out there, does anyone have it to verify the dump?

The RAM bank selection is a little confusing, the *TESTRAM only selects banks with &FE30, and the board detects the full 128K using only this latch. But the Solidisk MENU expects RAM banks to be selected with either the old style &FE60 userport as used with the SWR boards, or &FE32. Either the MENU program is not compatible with this board or there's more to it.

The board has also been reverse engineered over at viewtopic.php?f=3&t=6603&p=171568#p148003, which has been very helpful =D>
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Thu Oct 17, 2019 9:26 am

Found a floppy image for the Peartree MR4200 at http://archive.retro-kit.co.uk/bbc.nvg. ... aysRAM.zip, all seems to work as expected:
0120.png
0121.png
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Fri Oct 18, 2019 5:09 pm

The Morley Master 'AA' Board is quite intriguing.

It provides 8x16K and 4x32K ROM sockets which can be selected to replace the RAM in banks 4/5 and/or banks 6/7.

It adds the MASTERboard control ROM in bank 8:
0025.png
0029.png
The board is populated with various ROMs. The 16K sockets are paired into 32K banks 0-3, and the 32K sockets are banks 4-7 which are repeated as they contain 16K ROMs.
0026.png
With *RB you can view and select what you want enabled. Here I have E and H selected (the selected letters flash):
0028.png
Which puts Inter-Chart/ADT into banks 4/5 and ATS/Inter-Word into banks 6/7:
0027.png
Technically it's quite simple, it implements a write only latch at &BF00 when the control ROM is selected (ROMSEL=8). This latch determines which bank 0-7 (or RAM) is paged into LO sockets 4/5 and HI sockets 6/7.
- bits 0,1,2 select bank in LO
- bits 3,4,7 select bank in HI
- bit 5 selects RAM in LO
- bit 6 selects RAM in HI

And an added bonus is the file copy program:
0030.png
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Fri Oct 18, 2019 9:09 pm

The Vine Micros 'Master' OS Overlay board is very simple in that it allows you to overlay any ROM in the 1Mbit MOS ROM.

The board takes upto 3 ROMs and for example I've inserted ADT, Inter-Word, and Master ROM. The links are set to overlay the following:
overlay_conf.PNG
Which overlays the specified banks with the additional ROMs:
0032.png
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Sat Oct 19, 2019 7:02 pm

I've been continually updating the first post in the thread indicating what's emulated and what's known to do. There are also some marked in red that require technical details and/or ROMs. Can anyone help with any of those?

This is my definitive list of internal expansion boards so if there are any others not listed that are worthy of emulation then please let me know.
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Mon Oct 21, 2019 9:05 pm

Finally, the Computech Integra-B. This would've appeared much sooner if I'd known about having to reset it to avoid the 'Language?' error.
0130.png
0131.png
0126.png
0129.png
Any good test cases for this board?
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
KenLowe
Posts: 707
Joined: Mon Oct 18, 2004 4:35 pm
Location: Scotland
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by KenLowe » Mon Oct 21, 2019 9:51 pm

Pernod wrote:
Mon Oct 21, 2019 9:05 pm
Finally, the Computech Integra-B. This would've appeared much sooner if I'd known about having to reset it to avoid the 'Language?' error.
Awesome. This is the one I've been waiting for :D. ...and, yes, the Initialisation instructions that you would have been looking for are away at the end of the User Guide:

Code: Select all

To enable the computer to acknowledge the INTEGRA-β Expansion on the first switch-on you must hold down the '@' key whilst switching on at the computer.
I think I also provided some guidance about this IBOS initialisation requirement in a stand alone readme file for the BeebEm release.
Pernod wrote:
Mon Oct 21, 2019 9:05 pm
Any good test cases for this board?
The fact you've got to the 'NLE' on an Integra reset, have been able to *CONF. a language, and run Integra Windows is a good sign. This has tested RTC user RAM area, some of the Private RAM (0x8000 - 0xAFFF), and both the shadow (0x3000 - 0x7FFF) & sideways RAM. If you can run some of the Level 9 graphic adventure games (eg Lancelot) in graphics mode, that is also a good test of the shadow / sideways RAM.

I assume you're also emulating the RTC? If so, it might be worth using my patched IBOS, which sets the default century to 2000 instead of 1900. This means that when entering the year in two digit format, it will assume 20xx instead of 19xx. Also, once you've carried out an initial IBOS reset, do subsequent IBOS resets [CTRL-@-BREAK] work? If not, then you will need to reset a couple of the RTC registers when the BREAK key is pressed. Both these points are discussed in the B-Em Windows thread here

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Tue Oct 22, 2019 12:00 pm

KenLowe wrote:
Mon Oct 21, 2019 9:51 pm
Also, once you've carried out an initial IBOS reset, do subsequent IBOS resets [CTRL-@-BREAK] work? If not, then you will need to reset a couple of the RTC registers when the BREAK key is pressed.
It didn't, but it does now that I reset the board on BREAK.

I'm having trouble with the RTC year, with both original and patched IBOS. The century is always 00 :?
0132.png
A hard reset also always resets OSMODE to 0, is this expected?
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
KenLowe
Posts: 707
Joined: Mon Oct 18, 2004 4:35 pm
Location: Scotland
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by KenLowe » Tue Oct 22, 2019 12:24 pm

Edit: Removed incorrect information about RTC registers. Corrected information in post below.
Pernod wrote:
Tue Oct 22, 2019 12:00 pm
KenLowe wrote:
Mon Oct 21, 2019 9:51 pm
Also, once you've carried out an initial IBOS reset, do subsequent IBOS resets [CTRL-@-BREAK] work? If not, then you will need to reset a couple of the RTC registers when the BREAK key is pressed.
It didn't, but it does now that I reset the board on BREAK.
You don't want to reset the whole board on BREAK. Only the RTC; and then, only the bits / flags as detailed in the datasheet:

Code: Select all

The nRESET pin has no effect on the clock, calendar, or RAM
functions. On power-up, the nRESET pin must be held low for
the specified time tRLH in order to allow the power supply to
stabilize. Figure 13 shows a typical representation of the
nRESET pin circuit.

When RESET is low the following occurs:
 a) Periodic Interrupt Enable (PIE) bit is cleared to zero.
 b) Alarm Interrupt Enable (AIE) bit is cleared to zero.
 c) Update ended Interrupt Enable (UIE) bit is cleared to zero.
 d) Update ended Interrupt flag (UF) bit is cleared to zero.
 e) Interrupt Request status flag (IRQF) bit is cleared to zero.
 f) Periodic Interrupt flag (PF) bit is cleared to zero.
 g) Alarm Interrupt flag (AF) bit is cleared to zero.
 h) nIRQ pin is in the high-impedance state, and
 i) Square Wave output Enable (SQWE) bit is cleared to zero.
B-Em does this by:

Code: Select all

void cmos_reset(void)
{
    cmos[0xb] &= 0x87; /* clear bits in register B */
    cmos[0xc] = 0;
}
Last edited by KenLowe on Tue Oct 22, 2019 2:37 pm, edited 2 times in total.

User avatar
KenLowe
Posts: 707
Joined: Mon Oct 18, 2004 4:35 pm
Location: Scotland
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by KenLowe » Tue Oct 22, 2019 1:46 pm

Pernod wrote:
Tue Oct 22, 2019 12:00 pm
I'm having trouble with the RTC year, with both original and patched IBOS. The century is always 00 :?

A hard reset also always resets OSMODE to 0, is this expected?
A Ctrl-Break (if that's what you mean by a hard reset) shouldn't change the OSMODE.

The Century and OSMODE parameters are both stored in Private RAM &83xx, so it looks like this memory is not being correctly selected. Below is some relevant info from my partial IBOS disassembly:

Code: Select all

\\lookup table for IntegraB defaults - Address (X) / Data (A)
\\Read by code at &8834
\\For data at addresses &00-&31, data is stored in RTC RAM at location Addr + &0E (RTC RAM &0E-&3F)
\\For data at addresses &32 and above, data is stored in private RAM at location &8300 + Addr OR &80.
.intDefault	EQUB &06,&FF							;*INSERT status for ROMS &0F to &08. Default: &FF (All 8 ROMS enabled)
		EQUB &07,&FF							;*INSERT status for ROMS &07 to &00. Default: &FF (All 8 ROMS enabled)
		EQUB &0A,&17							;0-2: MODE / 3: SHADOW / 4: TV Interlace / 5-7: TV screen shift
		EQUB &0B,&20							;0-2: FDRIVE / 3-5: CAPS. Default was &23. Changed to &20
		EQUB &0C,&19							;0-7: Keyboard Delay
		EQUB &0D,&05							;0-7: Keyboard Repeat
		EQUB &0E,&0A							;0-7: Printer Ignore
		EQUB &0F,&2D							;0: Tube / 2-4: BAUD / 5-7: Printer
		EQUB &10,&A1							;0: File system / 4: Boot / 5-7: Data. Default was &A0. Changed to &A1
		EQUB &32,&04							;0-2: OSMODE / 3: SHX
		EQUB &35,&14							;Century - Default was &13 (1900). Changed to &14 (2000)
		EQUB &38,&FF
		EQUB &39,&FF
		EQUB &3A,&90
		EQUB &7F,&0F							;Bit set if RAM located in 32k bank. Clear if ROM is located in bank. Default is &0F (lowest 4 x 32k banks).

Here's the code that selects either Private RAM or RTC RAM depending on the address:

Code: Select all

\\Read data from RTC RAM or Private RAM 0x83xx. X=Addr, A=Data
\\For X between &00 and &31, read from RTC + &0E
\\For X between &32 and &79, read from Private RAM &83xx + &80
.rdData	    CPX #&80
            BCS L8863								;Invalid if Address >=&80
            CPX #&32
            BCS rdPrivate							;Read from Private RAM if Address >&32 and <&80
            PHA
            CLC
            TXA
            ADC #&0E								;Increment address by &0E bytes. First &0E bytes are for the RTC data
            TAX
            PLA
            JSR rdRTCRAM							;Read data from RTC memory location X into A
            JMP L885B

\\Write data to RTC RAM or Private RAM 0x83xx. X=Addr, A=Data
\\For X between &00 and &31, write to RTC + &0E
\\For X between &32 and &79, write to Private RAM &83xx + &80
.wrData	    CPX #&80
            BCS L8863								;Invalid if Address >=&80
            CPX #&32
            BCS wrPrivate							;Write to Private RAM if Address >&32 and <&80
            PHA
            CLC
            TXA
            ADC #&0E								;Increment address by &0E bytes. First &0E bytes are for the RTC data
            TAX
            PLA
            JSR wrRTCRAM							;Write data from A to RTC memory location X
			
.L885B      PHA
            TXA
            SEC
            SBC #&0E								;Restore address by reducing address by &0E bytes. First &0E bytes are for the RTC data
            TAX
            PLA
            CLC
.L8863      RTS

...and here's the code that reads from / writes to Private RAM &83xx

Code: Select all

\\Condition then read from Private RAM &83xx (Addr = X, Data = A)
.rdPrivate  JSR L882D								;Set msb of Addr (Addr = Addr OR &80)
            JSR L8870								;read data from Private RAM &83xx (Addr = X, Data = A)
            JMP L8826								;Clear msb of Addr (Addr = Addr & &7F)
			
\\Condition then write to Private RAM &83xx (Addr = X, Data = A)
.wrPrivate  JSR L882D								;Set msb of Addr (Addr = Addr OR &80)
            JSR L8864								;write data to Private RAM &83xx (Addr = X, Data = A)

\\Clear msb of Addr (Addr = Addr & &7F)			
.L8826      PHA
            TXA
            AND #&7F
            TAX
            PLA
            RTS		

\\Set msb of Addr (Addr = Addr OR &80)
.L882D      PHA
            TXA
            ORA #&80
            TAX
            PLA
            RTS		

\\write data to Private RAM &83xx (Addr = X, Data = A)
.L8864      PHP
            SEI
            JSR L887C								;switch in Private RAM
            STA prv83,X								;write data to Private RAM (Addr = X, Data = A)
            PHA
            JMP L8890								;switch out Private RAM

\\read data from Private RAM &83xx (Addr = X, Data = A)
.L8870      PHP
            SEI
            JSR L887C								;switch in Private RAM
            LDA prv83,X								;read data from Private RAM (Addr = X, Data = A)
            PHA
            JMP L8890								;switch out Private RAM
			
\\Switch in Private RAM
.L887C      PHA
            LDA &037F
            AND #&80
            ORA #&40
            STA SHEILA+&34							;retain value of &037F so it can be restored after read / write operation complete
            LDA &F4
            ORA #&40
            STA SHEILA+&30							;retain value of &F4 so it can be restored after read / write operation complete
            PLA
            RTS		

\\Switch out Private RAM
.L8890      LDA &F4
            STA SHEILA+&30							;restore using value retained in &F4
            LDA &037F
            STA SHEILA+&34							;restore using value retained in &037F
            PLA
            PLP
            PHA
            PLA
            RTS		

...and finally the code that reads from / writes to the RTC RAM:

Code: Select all

\\read from RTC RAM (Addr = X, Data = A)
.rdRTCRAM   PHP
            SEI
            JSR LA66C								;Set RTC address according to X
            LDA SHEILA+&3C							;Strobe out data
            JSR LA664
            PLP
            RTS
			
\\write to RTC RAM (Addr = X, Data = A)
.wrRTCRAM   PHP
            JSR LA66C								;Set RTC address according to X
            STA SHEILA+&3C							;Strobe in data
            JSR LA664
            PLP
            RTS
			
.LA660      NOP
.LA661      NOP
            NOP
            RTS
			
.LA664      PHA
            LDA #&0D								
            JSR LA66C
            PLA
            RTS
			
.LA66C      SEI
            JSR LA661								;2 x NOP delay
            STX SHEILA+&38							;Strobe in address
            JMP LA660								;3 x NOP delay
Please also be aware that there is an error in the original User Guide relating to the selection of paged Private memory, which is discussed here. I have corrected this in my latest guide. A copy of the relevent section can be found here.

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Tue Oct 22, 2019 4:14 pm

KenLowe wrote:
Tue Oct 22, 2019 1:46 pm
The Century and OSMODE parameters are both stored in Private RAM &83xx, so it looks like this memory is not being correctly selected.
This was the clue, I hadn't battery-backed the Private RAM. Both time and OSMODE are now correctly restored on a power cycle (hard reset) :D
0133.png
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
KenLowe
Posts: 707
Joined: Mon Oct 18, 2004 4:35 pm
Location: Scotland
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by KenLowe » Tue Oct 22, 2019 4:24 pm

Pernod wrote:
Tue Oct 22, 2019 4:14 pm
KenLowe wrote:
Tue Oct 22, 2019 1:46 pm
The Century and OSMODE parameters are both stored in Private RAM &83xx, so it looks like this memory is not being correctly selected.
This was the clue, I hadn't battery-backed the Private RAM. Both time and OSMODE are now correctly restored on a power cycle (hard reset) :D
Ah, yes. The 32k RAM module that provides 20k shadow and 12k private RAM is battery backed.

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Tue Oct 22, 2019 4:25 pm

The Watford 32K Shadow RAM board is now fully understood.

It performs the paging on any writes to:
&FFFC - pages in whole Watford RAM &0000-&7FFF
&FFFE - pages in BBC RAM &0000-&2FFF, and BBC RAM &3000-&7FFF
&FFFF - pages in BBC RAM &0000-&2FFF, and Watford RAM &3000-&7FFF

The startup banner is only shown after the board successfully initialises by doing a quick RAM test.

From the manual:
A write to &FFFF will select the Watford RAM and a write to &FFFE will select the BBC RAM. This applies for memory locations &3000 to &7FFF. To swap the whole memory write to &FFFC.
I was interpreting the 'swap whole memory' as a toggle rather than always page in whole memory, and a write to &FFFF must always page in the lower 12K BBC RAM too.
This board should be 100% compatible with the Aries-B20 as it uses the same memory addresses.
0136.png
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
KenLowe
Posts: 707
Joined: Mon Oct 18, 2004 4:35 pm
Location: Scotland
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by KenLowe » Tue Oct 22, 2019 4:59 pm

Out of interest, are you going to emulate an unexpanded model b, where ROM banks 0..3 are repeated at banks 4..7, 8..11 & 12..15?

User avatar
Pernod
Posts: 1662
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: MAME: Internal ROM/RAM expansion boards

Post by Pernod » Tue Oct 22, 2019 5:05 pm

KenLowe wrote:
Tue Oct 22, 2019 4:59 pm
Out of interest, are you going to emulate an unexpanded model b, where ROM banks 0..3 are repeated at banks 4..7, 8..11 & 12..15?
That's how it is at the moment (and has been since forever), you just have the 4 romslots that you can plug whatever you want into (overwriting the default BASIC/DFS). All these expansion boards will be slot devices, I've implemented a new slot interface called internal where you can select any of these boards to upgrade the machine.

The aim is to allow any configuration that is possible on a real machine, you can mix and choose any selection of internal boards and external peripherals from all ports.
slot_devices.PNG
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

Post Reply