Tuesday, 23 March 2021

Lunchtime Coder #4 - Space Invaders Emulator in Blitz3D / Blitz Basic






Have you ever wanted to take a trip down gaming nostalgia lane and relive the “good old days” of late 70s/early 80s arcade gaming?

No?

Me neither... but apparently there are some odd types around who miss the retroness of old skool arcade gaming in smoke filled germ ridden festering pits of arcadiness, and this led to the miracle of EMULATION !

But... Playing retro games using emulators is one thing... Writing an emulator? Now thats a tough old well done rump!

(BTW I kid... I bloody love emulators!)





I wrote this emulator as a two headed "Technical Demonstration":

1. I wanted to demonstrate that Blitz3D, despite being an older language, still has good capability and can still be used for some kuul coding projects.

2. I wanted to prove to myself that I could write an emulator...





I have provided a link above for the Blitz3D source code of my basic Space Invaders emulator.

The basic emulator includes support for the following:

1. Two romsets of the original Space Invaders monochrome game - an older and newer version with noticeable differences.

2. Adjustable dip switch settings and access to the diagnostic mode and the coin mechanism tilt switch function.

3. A cocktail flip screen mode.

4. A simulated colour overlay (the old skool red, green and white overlay).

5. Any other settings that existed in the original arcade Space Invaders.

There is also a lot of rambling comments / remarks to explain what each part of the emulator code does.

The emulator should run other 8080 based Taito Arcade games and bootlegs with a bit of adjustment on the memory array size, rom placing within the array and dipswitch / Input Port settings and assignments.

I have tried Lunar Rescue, Galaxy Wars and other Space Invaders variants / bootlegs and these seemed to run fine.





The full compiled release has additional support for Space Invaders Colour, Space Invaders Part II, Space Invaders Deluxe and Super Earth Invasion (Bootleg of Space Invaders).

I included Super Earth Invasion for one reason only. Its the version I remember playing as a kid back in the very early 80's.

It also includes a lot of "fluff" such as Bezels, Backgrounds and simulated colour cellophane overlays, and the whole thing runs from a select menu system making jumping between games a bit easier.





So what does the emulator contain?

1. Full Intel 8080 processor emulator including all opcodes and conditional flags.
2. Rom and ram area up to a maximum of 64 kB, the maximum that the 8080 with its 16-bit memory bus could address.
3. Emulated 16 bit Shift Register.
4. Video Display emulator including Interrupt generator.
5. Master and Secondary dip switch Input.
6. Inputs from Coin mechanism including Tilt Switch.
7. Inputs from Player Controls.
8. Sound Output simulator using sound samples.

I will follow this post up with some posts on the trickier aspects of the emulator, and how to overcome them.





No comments:

Post a Comment