My first experience with computers was in 1978 when I used a Commodore PET at school. I managed to persuade my parents to buy me a computer for Christmas a year later. I wanted a Microtan because I had been using BASIC up until then and I decided it was too slow, so I wanted to learn machine code. At the time, the only alternative was a Sinclair ZX-80 - which had BASIC on it. I realised that if I had a machine with BASIC on, I'd never get around to learning machine code - so, Microtan it was!
During the early 80's, I wrote around 20 games and other programs for the system - which I was quite proud of! Last year, I attempted to get it all working after a couple of years in a cupboard (the Microtan, not me). Unfortunately, the keyboard interface had failed. Although I got it working again, I realised that the machine wouldn't last forever. As I was quite fond of it (it's probably directly responsible for the fact that I now spend most of my time sat in front of a PC screen! - did I say "fond"? Hmmm...) I decided to (almost) immortalise it in an emulator.
How it all went
I started by writing the 6502 emulator. This is an incredibly tedious task, requiring much patience and coffee. It took quite a while because I kept getting bored.
When I'd done that, I wrote the display emulator. This didn't take very long and wasn't too dull. The first version drew the characters into the window as required and scaled the display to fit the window. I realised that this was going to be far too slow, so I created all the characters in advance and copied them to the window as necessary. Although much faster, it does mean that the "screen" doesn't continuously scale to fill the window - you get jumps in character size.
Once I'd done that, I dumped the Microtan ROM images into it and was amazed to see "TANBUG" on my screen! I really hadn't expected that. I added ASCII keyboard and hex keypad emulation to it. I needed to emulate the hex keypad because the ASCII keyboard only sends the ASCII code of the key pressed - it is not possible to determine when the key is released or whether several keys are pressed. The hex keypad is scanned and, so, is more suited to playing games.
Then I loaded a couple of the Games Pack games into it. These had already been converted from tapes by Fabrice Frances. They mostly worked, but they did show an error in the 6502 emulation with ADC and SBC in decimal mode.
Next, I wrote a program to convert my old tapes into binary images. This had to work for both 300BAUD and 2400BAUD dumps, as not all my 300BAUD copies had survived. The 2400BAUD decoder still needs work. However, I did manage to convert quite a few tapes.
I sent the emulator to Fabrice, and it took his machine out! This was a bit upsetting - I couldn't reproduce the problem. However, after some searching, I did find a machine that did behave a little odd. After some time, the cause of the problem was located and fixed and I was off again.
During this time, I added emulation for the AY8912 sound card. This requires DirectX version 5 or later to work properly. Although it does try to do something with versions less than 5, it's not very good, yet. I also added emulation for the 6522's on the Tanex board, as I used the timers to generate "random" numbers and at least one game used a timed interrupt to play a tune.
The ability to load standard Intel Hex files was then added, so that a PC based 6502 two-pass assembler can be used for program development.
Several debug utilities were added to aid in writing and converting programs.
Emulation for the sound hardware of the Space Invasion machine was then added. This hardware worked by taking bits on the keypad column select (bff2) high - one bit for each sound type. This is not truly authentic emulation for two reasons:
When the Invasion hardware is used, the AY8912 emulation automatically stops and vice-versa.
Finally, I modified my games (and Space Invasion) to use a "joystick" plugged into the 1st 6522 VIA, so that the user doesn't have to switch back and forth between keyboards. Some of the games were originally written to use this (I made an adapter socket for an Atari joystick), but when I decided to pass them on to Microtanic, I rewrote them to use the standard keypad.
What's left to do?