Amstrad CPC ROM emulation using an STM32F4 – Part 2

So in part 1 (Amstrad CPC ROM emulation using an STM32F4) the code I had for emulating a ROM (and some IO) with a cheap STM32F4 board for the Amstrad CPC 464 ran in a continuous polling loop. The code just watched  _ROMEN and _IORQ going high and low, and acted appropriately. The (sort of cheating) way I was able to load a disk image from an SD card was to load the disk image during the Amstrad _RESET.

It bugged me that I was unable to interact with the STM32F4 SDIO interface after boot, as that would interrupt the polling loop. The main way of being able to use the SDIO interface would be to use interrupts for the _ROMEN and _IORQ lines, and then interact with the SDIO using the main thread of the program. I had discounted using interrupts for _ROMEN and _IORQ in the past, but I thought I would have another go at it.

Read the rest of this entry »

Amstrad CPC ROM emulation using an STM32F4

UPDATE: There is a ‘part 2‘ to this article. In that I use interrupts, instead of the polling technique shown below

So, in emulating a hardware ROM in real time with an STM32F4 I hooked up a cheap US$10 STM32F4 board to my Acorn Electron to act as both a sideways ROM board and a sort of emulation of some IO that connected to an SD card. I thought I would have a go at something similar on my Amstrad CPC 464.

Initially, I just had the STM32F4 emulating some ROMs out of its own Flash, but I started investigating what I could do with the SD card integration in the STM32F4. Eventually I worked out a way to load floppy DSK images from an SD card, and emulate (enough of) the upd765 Floppy Controller chip to be able to load and run disk images. So this is really for CPC 464 users at the moment. ie. You don’t need a DDI-1. This pretends to be a DDI-1 with an  SD card.

Read the rest of this entry »

Emulating a hardware ROM in real time with an STM32F4

I remember reading dhole’s  Emulating a GameBoy Cartridge with an STM32F4 some time ago thinking that it had a lot of applications with respect to old computers. In that article  a STM32F4 microcontroller  ‘pretends to be a ROM chip for a gameboy’. At the start of a bus cycle, an interrupt is triggered in the STM32F4, it then reads the address bus of the gameboy’s 6502, checks the gameboy’s read/write line(s) and pulls data from its internal Flash and presents it onto the data bus long enough for the gameboy to read it, then tristates the databus. There are no wait states. It does this all within the 1000ns of the 1MHz Gameboy CPU clock. For all intensive purposes the gameboy thinks it has a real rom chip attached.

The STM32F4 is a good candidate here as it has a lot of GPIO pins, and they are pretty much all 5V tolerant. The clock speeds sound good too; 168MHz+, and there is plenty of Flash storage onboard, and you can get really cheap STM32F4 boards on eBay/aliexpress.

Anyway, I thought I’d see if I could turn an stm32f4 board into an ‘Electron Plus 1’ expansion for my Acorn Electron. That way I could add ROMs, and potentially an SD card interface that would let you load floppy images.

Read the rest of this entry »

Using TZXDuino to play UEF tape images

TZXDuino is a cool Arduino project that is basically a standalone hardware cassette audio playback unit for old computers. You hook up an Arduino, a microSD card adapter, an I2C LCD display and 5 buttons. Load a microSD with lots of game dumps, and hook that up to the audio input of your ZX Spectrum or Amstrad. With the buttons and LCD you can scroll through the files on the SD and basically ‘hit Play’.  So it can play the most common ZX Spectrum tape dump formats ; TZX and TAP (plus a few for the ZX80 and ZX81), and CDT format (for the Amstrad) as it’s basically the same as TZX.

It can’t play UEF tape dumps though. UEF is the tape dump format used by the BBC Micro and Acorn Electron. My current way of loading UEF files on my Electron is to use freeuef-alsa  on a linux PC with its audio out hooked up the Electron. Every time the Electron pauses the cassette I have to hit space on the PC, then wait a bit and press Enter to get it going again. It is not ideal.

So basically I’ve been hacking away at the TZXDuino code to add in UEF support. There are a few caveats at the moment
Read the rest of this entry »

BBC Micro Model B

I recently bought a BBC Micro Model B. It sold ‘as is’ and I had no idea if it worked. The case was very yellow. It came with a  5 1/4″ drive, cassette player, several books and original versions of Elite on disk and cassette. It did not work, and ended up having a number of faults

Read the rest of this entry »

Amiga Kickstart Switcher with no switches

A while back I burnt some 27C160 EPROMs for some of my Amigas. This allows you to have 4 kickstarts in an A500 or A600. Normally you would wire up two switches to the upper address lines of the EPROM to select the 4 images. But I thought there must be some way of selecting the images without needing some switches at the back of the Amiga.

So I’m using an ATTINY85 to drive the two upper address lines of the 27C160 and monitor Ctrl-Amiga-Amiga. You select a different kickstart by changing how long you hold down Ctrl-Amiga-Amiga for.

Read the rest of this entry »

Amstrad CPC-464 and broken sound chips

So I was pretty chuffed with setting up my Frankenstrad using just a CPC-464 motherboard and a homebrew keyboard. However, as luck would have it, a few weeks later, the local auction site had a couple of real CPC-464’s for sale … so I bought one.

Read the rest of this entry »

Frankenstrad

So I bought the motherboard out of an Amstrad CPC-464. This was like my Oric Atmos rationalisation . It’s cheaper to just buy the motherboard of some of these old computers, rather than the whole computer (especially when I add in postage from the UK to NZ). And I am more into these old computers for my own curiousity and educational value, rather than just purely ‘collecting them’.  In the case of the Oric, I came up with a Arduino based ‘PS2 keyboard to old-school key matrix’ converter to get around ‘not having a keyboard’.  I was thinking of doing the same for the Amstrad, but I had a nice Cherry keyboard that I was given for free; ie. individual keyswitches and an easy single sided PCB. So I butchered it to turn it into an Amstrad keypad (well most of it).

Read the rest of this entry »

SIO2SD with an Atmega328p

So, I have a SIO2Arduino setup hooked up to my Atari 800XL as a virtual floppy drive image thingee. It works pretty well and was really easy to make; one Arduino Uno plus one Arduino SD card adapter plus a few wires. Another popular one is SIO2SD. You can buy prebuilt SIO2SDs  from Lotharek , but like a lot of these devices its ‘just a microcontroller hooked up to an SD card with some buttons, LEDs and maybe a screen. Currently SIO2SD is based on an Atmega32 microcontroller. I had a spare Atmega1284p (like I used in my SD2IEC). It’s a 40 pin AVR chip like the Atmega32 …. so I set off to convert the SIO2SD software to run on the Atmega1284p. However, when I finished I thought I’d see if it would compile for an Atmega328p (as is used in the Arduino Uno). And hey it did compile.

Read the rest of this entry »

An Oric with a PS2 keyboard

So I ended up buying an Oric Atmos motherboard on ebay.co.uk. I don’t have an Oric Atmos to repair. I somehow rationalised this as ‘this is cheaper than buying a whole Oric’. Of course a key problem with buying an Oric motherboard is ;

“There is no keyboard”

Read the rest of this entry »