EO - with some preliminary MMC support

Emulator and emulator development specific topics
Post Reply
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

EO - with some preliminary MMC support

Post by sirmorris »

I've had a couple of spare moments recently after all the work I've been doing on (ahem) a different old computer http://arduinonut.blogspot.com/2008/09/lash-up.html ;)

Everyone's probably aware of my love affair with MMC/SD cards. They're cheap, fast and so easy to interface that nearly all my old machines now have one attached in some form or other.

Developing for the zeddie is very hard as the code, load & test cycle can be quite long. If the thing you're testing fails in the first few lines of code because it relies on hardware then, unless the hardware is emulated, developing on a PC is out of the question. The driver code for my MMC hardware http://robsonfamily.dsl.pipex.com/mmc/mmc.htm is as much of a lash-up as the board, but I've got plans for it (Hacked ROM anyone?) hence the requirement to have MMC support in EO.

So I developed a very basic MMC simulator (emulator implies correctness ;). I started by programming a test harness that requires the simulator to behave in a manner that I would normally expect when coding for an MMC interface. This was refined after going over the MMC spec again, and finally I developed the simulation itself. When all the tests passed it was ready for use.

I hooked it into EightyOne and ran my '81 MMC driver (bear in mind it's the 1st one I ever wrote) which quickly and spectacularly FAILED. I went back to the '81 code and discovered that I'd done it all wrong - aah the benefits of hindsight :D No wonder the code I'd written was temperamental. So I rewrote the driver and now it's faster and way more reliable.

With Mike's permission I am offering my hacked-yone version here for people to play with. I don't imagine the code will be of much use to anyone but I'll be submitting it to Mike just in case.

Get the patch RAR from http://groups.google.com/group/micro-hacker?hl=en - EOMMC.rar. Feel free to listen to some of the fine oldskool techno there too :D

To play: Get the baseline 1.0a release of EO from http://www.chuntey.com/. Unzip it and drop the EOMMC.exe, mmc.bin & MMCDRIV.P files from the RAR into the folder where EightyOne.exe lives.

Enable RAM at 8k. Run EOMMC and load'n'run the MMCDRIV.P program in your preferred manner. 0/2 means that the driver is loaded and relocated to RAM at 8k. A reset when entering a command means that RAM is not enabled at 8k. Did I say you needed that enabled?? :P

Here's a command summary:

PRINT USR 8192,I
Initialise.

PRINT USR 8192,D
Directory-list all the wads it finds on the card, giving each a number which you use in further commands.

PRINT USR 8192,D,[n]
Directory-list all the files in wad [n]. Again, each file in the wad is given a number.

PRINT USR 8192,L,[n],[m]
Load the file numbered [m] from wad [n].

All should be well, but if not then there are some funky error codes. Needless to say you'll only ever see some of these with a real interface/card.

'G' - invalid command
'H' - need to call init
'I' - card failed to wake up
'J' - card failed to reset
'K' - failed to read the MBR from the card
'L' - failed to read boot sector
'M' - card geometry assertion failed
'N' - failed to read root directory
'O' - failed to read a sector
'P' - failed to write a sector
'Q' - no wads on card

If a program uses RAM at 8k you'll need to reload the driver. If you get a constant stream of error 'O's then reset the machine.

If any of this has piqued your interest, I can go into further details. Anyways - have fun!

Charlie
Post Reply