Agnus and Buddy

Agnus and Buddy – a bank switching RAM expansion for the SMD2000!

Note the change in github username and url.

Background

The files for this project can be found at my github https://github.com/amigalisa/Agnus-Buddy

Official discussion thread can be found here https://www.amigaretro.com/index.php/topic,505.0.html.

About a year ago BirdHandler asked me if it was possible to expand the Amiga’s chip ram “like the BBC Micro”; that is, using bank switching.  My answer was “of course not, it’d be done already”.  Well, over the next few days I thought about it and decided my initial reaction was wrong, and that the Amiga could actually be expanded in this way.

It so happened that this was shortly after I finished the SMD2000 prototype.  On the SMD2000 the Agnus is on a separate board to the motherboard.  This was a design decision so that the same motherboard got built regardless of which machine was the donor, and at the time I had the idea that I wouldn’t have to build a new motherboard if someone ever made an 8 MB Agnus.  This also presented a unique opportunity – I have an Amiga that is perfect for development of a chip ram expansion!  One thing led to another and next thing I know I was into my next project.

After designing the PCB, having it made, and assembling it, I put the project on the shelf and pursued some other non-related projects (coming soon), until a couple of weeks ago when I saw GadgetUK’s Amber card.  This inspired me to get it off the shelf and complete it.

This expansion only has two switchable banks and is really only for proof of concept, but there is no reason it could not be up to 64 switchable banks in a future edition.  It was only possible to make this card on the cheap due to the modular design of the SMD2000, although I have an idea for an A500+ version.

Special thanks to BirdHandler for dreaming up this idea and to Retroswim who helped me with testing the card and making the video (still to come), and of course to Intangibles for making the ARB homepage.

The Design

There is nothing clever in this design. Bank switching has been around for over 50 years, but as far as I am aware it has never been applied to the Amiga.
A CPLD is added to the Agnus card; in the spirit of the Amiga I have named this chip Buddy, because she’s Agnus’s little buddy.  This CPLD contains three new registers for the Amiga, one is a write only register which controls the bank switching.  There are three instructions controllable by the register: connect a bank, connect and reset proof a bank, and disconnect all banks.  The other two registers are read only registers (it was going to be one 16 bit register but I ran out of space on the CPLD); one reads back the current status of the expansion (i.e. which instruction and which bank is connected), and the other one reads a configuration byte from the expansion.  I don’t want this article to be too technical, so if you want to know more details check out the github.

The lower 1 MB of ram is always connected, and at power on AmigaOS will see an unexpaneded A500+/A600.

When the instruction to connect a bank is written to the register the CPLD connects a bank to the addresses where the second megabyte would be (the trapdoor expansion in the A500+/A600).  When it receives an instruction to connect a different bank it disconnects that bank and connects a new one.  If the Amiga is reset the bank is disconnected.

There is also a reset-proof instruction.  If this is written to the register the bank stays connected during reset so the OS can detect it, turning the Amiga into a 2 mb machine.

The register is in the address space of the custom chip registers and should be addressable by the Copper as well as the CPU.  This means it should be able to be changed mid-frame using an instruction in the copper list.  I don’t know anything about how to write a copper list, so I’d appreciate it if a programmer can confirm this.

Where to from here?

This section is really an appeal to the Amiga community for people who know stuff.  I can’t make it a mature project on my own.  That’s not to say I won’t pursue these ideas but I could certainly use some assistance getting the project matured.

I think the next step is to make a version for a real Amiga, and probably the A500+.  This will allow more people to access it with their existing computers, since not everyone wants to build a new computer just for a ram expansion.  At this stage it would a small board to break out the clocks and RGA bus from one of the custom chips (one of the DIP chips would be easier than Agnus), while the rest of the expansion would be in the trapdoor.

I’d really like to make another expansion with lots more RAM but using only one or two RAM ICs, and a new Buddy CPLD containing the RAM controller for it.

I’d also love to see some demos or games written using all this extra chip ram. I’ve made the expansion, now it’s up to the programmers to find uses for it.

It would be cool to incorporate the bank switching into the OS somehow. I’m not a programmer and don’t know how to do that, but I was thinking that it might be easier to write a driver for P96 than to change the (closed source) AmigaOS.

Challenges

While the concept is pretty simple, I faced a few major hurdles.  I’ve never done a comprehensive design for a computer project before, everything up to now has been modifying or rehashing someone else’s work.  I had only a vague idea about how RAM works, no idea about how timing inside a computer works let alone how the Amiga custom chip registers are read and written to, and I struggled to find detailed information about how to hack a register into the Amiga’s register space (probably because nobody outside Commodore has done it before).  Before last Monday I had never written a line of Verilog and tbh I was a bit scared of it – I almost did the entire thing in discrete logic.  I’m not scared of Verilog any more.