Showing posts with label Gaming. Show all posts
Showing posts with label Gaming. Show all posts

Monday, 30 November 2020

Lunchtime Coder #4-2 - Arcade Space Invaders Emulator - Memory Buffer / Memory Map

Before I can start emulating, I need to make a ROM / RAM area or memory buffer to store the ROMs and provide the system with RAM.

And before I can do that, I need to know the Space Invaders memory map.

Space Invaders has four x 2 kB roms:


This rom set is widely available on the internet. I googled for websites supplying MAME 0.36 romsets. If you end up with a romset that has four x 2 kB roms of a different naming convention, you may be able to work out which rom corresponds to the naming convention above, or just find an older set.

Space invaders then has 8 kB of RAM; 1 kB of general purpose RAM and 7 kB of video RAM. It then also has a RAM mirror of a further 8 kB.

The processor addresses these ROMs and RAM as a single 16 kB entity so the memory map in Hex goes:

invaders.h 2 kB 0000 to 07ff
invaders.g 2 kB 0800 to 0fff
invaders.f 2 kB 1000 to 17ff
invaders.e 2 kB 1800 to 1fff
RAM 1 kB 2000 to 23ff
Video RAM 7 kB 2400 to 3fff

Note that already we can start to gather info for the processor emulator. 16 kB cannot be addressed in 8 bits / 1 byte. The 8080 processor is an 8 bit processor, but must use 16 bit memory addressing, or memory addressing spread across two bytes.

Also note that Space Invaders screen resolution is 256 x 224 in black and white, so one bit per pixel. 256 x 224 is 57344 bits or 7168 bytes or 7 kB. This makes for a nice easy bit streaming screen interpreter hopefully.

Two additional important notes to add here:

Note 1. Some Space Invaders Emulation sites state that there is a "RAM Mirror" above memory address 3fff which seems to be frequently misunderstood as to what it is. A RAM mirror isn't an extra area of RAM. It simply means that because of how the memory pins on the processor work, memory addresses above 3fff may be requested by the processor. If the requested memory address is above the stated memory limit of 3fff, then the real memory address is (Address-3fff). I am doubtful whether this situation ever comes up though. Several people have stated that their emulators don't request addresses above 3fff. Several others have stated that an emulator won't work unless you allow for the RAM mirror. I havent seen any need to take this into account in my emulator. Just keep it in mind.

Note 2. Building in error checks as you write the emulator is always a good idea. A good error check is that whenever the processor writes to memory, check to see that the address that its writing to is in the RAM area and not the ROM area. Another good check is to ensure that the program counter doesn't go up beyond the program area. If either of these checks fail, then its a good indicator that there is errors in your code.

Now that I have the memory map details, I can start making the memory buffer.

I have two choices here; Array or Databank. Both should be pretty straight forward to implement. Set up an array or databank with 16384 slots and allow one byte in each slot. The only real question is, which would be faster?

DEV 1 - Program to test the speed of writing to and reading from an array vs writing to and reading from a databank.

This was a nice easy dev program that checks the time in ms, writes a fixed value to each of the 16384 slots in the array, and then reads each of them back out. On completion check the time is ms again and see how long its taken.

Repeat the process for the databank and then compare which one was faster.

I let this run for several thousand cycles capturing the average time taken for each one, and was slightly disappointed to find that both methods take pretty much exactly the same amount of time.. (rolls eyes) and so after literally three seconds of consideration, I went with the array option as the coding to read and write from array slots is shorter.

I have a feeling that this will by far be the easiest part of this emulator.

I have made a single dimension array with 16384 spaces. I have loaded up the Space Invaders roms into first part of the array in the correct order, and left the rest of the array empty... And that's about it!

One last important thing to know. What memory location do you start running the Space Invaders game from?

While this isn't always the case with 8080 code, conveniently Space Invaders starts running from memory location 0000.

Lunchtime Coder #4-1 - Arcade Space Invaders Emulator

The weary invaders take a break and a drink from a nearby lake..

This is a bit more in depth than my usual Lunchtime Coder projects.

Some googling has told me that a Space Invaders emulator is a reasonably good entry level into emulation. Looks pretty complicated to me.

I don't know a great deal about processors or emulation, so this is going to be a steep learning curve, and I am going to need to do a lot of reading up on how an 8080 processor works.

Dust can be the trickiest part of an old arcade board to emulate..

All good projects start off with a goal and a plan:

Goal - To write a full speed, fully working and playable Arcade Space Invaders emulator.


1. Create a buffer of some sort to hold the Space Invaders ROMs and provide video and scratch RAM.
2. Write an 8080 emulator.
3. Write a screen interpreter.
4. Write an input / output interface (Controls, Coin mech., Dip Switches etc).
5. Write a sound interpreter.
6. Emulation of hardware external to the processor (I think Interrupts and a 16 bit Shift Register).

Wow. As simple as that...

Some years ago I did a module on Digi-Tech as part of a course, and that included some entry level processor and machine code work. From what I can remember, processors are not capable of doing a huge amount. Mostly simple arithmetic and logic and/or comparisons. That and moving values from one location to another in the memory.
Sounds like a doddle....

So, I'd better make a start. More posts to follow...

Thursday, 26 November 2020

Space Invaders (Arcade Original) on the Sony PlayStation 2/ PSTwo / PS2

Almost everyone must have a PS2 knocking around somewhere in a cupboard or atic, maybe even a soft or hard modded one?

And almost everyone likes a good blat on an old arcade classic once in a while right?

So why not go grab it and get old skooling!

But first... Lets ask the question:

Question Can I play arcade original Space Invaders on my Sony PS2?

Answer Of course you bloody can! And in so many variants!

Taking into account that you can play Arcade Original Space Invaders on the PS1 (See Post Here), and that the PS2 is almost 100 % compatible with PS1 games, you can already blat away at the invading hoards without checking out what PS2 offerings there are out there.

That would make a bit of a boring post though, so lets take a look at what PS2 Space Invader options there are.

This post will cover: Commercial releases, Commercial Compilation Releases, Unlockables and Homebrew.

Commercial Release - Space Invaders Anniversary

I love Space Invaders so I should be really happy with this release, but I'm not. I will try and explain why in the shortest possible narative.

The PS1 had three commercial releases of Space Invaders in the NTSC-J regions:
Space Invaders (Not the same as the PAL and NTSC-U release of the same name. In Japan that was called Space Invaders X)
Space Invaders 2000
Simple 1500 Series - The Invaders

Each release contained the same 4 core variants of Space Invaders:

Monochrome tabletop
Colour Cellophane tabletop
Color tabletop
Upright (The one with the moon style backdrop)

Each release also added an additional game to the list of playable Space Invaderness:

Space Invaders had a two player "VS Mode"
Space Invaders 2000 had VS mode and Timed Attack Mode
Simple 1500 The Invaders had VS Mode, Timed Attack Mode and 3D Space Invaders

So, what are we given on PS2 Space Invaders Anniversary?

The SAME four variants of the original Space Invaders... and another bloody Space Invaders 3D!

There is also a VS Mode... but at least its a different VS Mode than was included on the PS1 releases, and I guess to be fair the 3D mode has been reskinned to look different but is essentially still the same game.

As for original content, we have Space Invaders Part II (tabletop and Upright) and Space Invaders Doubles, a variant of Space Invaders colour but as a two player co-op game. Its not exactly piles of joy..

I know that I'm being a bit negative about this title, but Taito just could have done so much better with the content. Space Invaders II, Return Of The Invaders, Super Space Invaders 91 aka The Majestic 12, Space Invaders DX, Space Invaders 95.. Where are they all?

To make matters worse, most of the list of missing items above then rocked up on Taito Legends / Taito Memories a couple of years later.

As I mentioned earlier, Space Invaders 3D in Simple 1500 Series The Invaders is different graphically to Space Invaders 3D in the PS2 Anniversary collection, but why do I hear Alan Partridge saying "They Rebadged it you fool!".

3D Space Invaders on the PS1
3D Space Invaders on the PS2

Yes, it is arcade original Space Invaders on the PS2, but its also such a missed opportunity.

However..I do love this special edition NTSC-J release of Space Invaders Anniversary, complete with a mini table top arcade machine controller.

Compilation - Taito Legends I and II, Taito Memories Gekan and Jokan, Taito Memories 2 Gekan and Joukan.

Taito Legends I and II (72 games total) released in the PAL and NTSC-U regions, Taito Memories 1 and 2, Jokan and Gekan (100 Games Total) released in NTSC-J regions, and as It's Taito, some Space Invaders variants made their way into these collections.

Taito Legends

Space Invaders
Space Invaders Part II aka Space Invaders Deluxe
Return Of The Invaders

Taito Legends II

Super Space Invaders '91 aka Majestic Twelve: The Space Invaders Part IV
Space Invaders DX
Space Invaders '95

Taito Memories Jokan

Space Invaders Colour
Majestic Twelve: The Space Invaders Part IV aka Super Space Invaders '91
Space Invaders DX

Taito Memories Gekan

Space Invaders
Space Invaders Part II
Space Invaders '95

Taito Memories 2 Jokan

Return of the Invaders

Unlockable - Space Invaders Invasion Day (PAL) (NTSC-U) aka Space Raiders (NTSC-J)

An imaginitive Space Invaders remake, although the game itself doesn't quite live up to the overdone graphical introduction and cut scenes, but guess what?! Space Invaders arcade original is unlockable by Holding L1+R1 and pressing X + O on the "Press START Button" screen.

The "Press START Button" will flash faster, then the screen will fade, and then... Arcade original Space Invaders Colour begins!

Homebrew - PS2 MAME

PS2 MAME will allow you to play a whole host of 8-bit Arcade Classics, including all of the 8-bit variants of Space Invaders.

It will struggle with more advanced variants though e.g. Super Space Invaders '91, Space Invaders '95 etc.

For further information on PS2 MAME, have a read of the post HERE!

And so..

That wraps up Space Invaders on the PS2. Plenty of options for the moral, immoral and amoral gamer.

Have I missed one? Probably.. Let me know and I will add it to the post.

Wednesday, 25 November 2020

My TOP 10 Horizontal SHMUPS on the Sony PlayStation / PSOne / PS1 / PSX

Being an absolute fanboy of all Sony PS1 shmuppiness, and playing more Sony PS1 / PS2 shmups than anything else, I have a full list of absolute favourites, both horizontal and vertical.

This is my absolute favourite Horizontal shmups on the PS1. I guess that they are not everyones favourites, however its a subjective list, and hopefully there's something here that you didn't know existed and will go on to try and enjoy.

I'm not going to bang on about how great each one is, but I will give a small amount of info and provide a link to where you can "Read All About It".

And I'm not a mad fan of 3D shmups / 3D remakes. I like the flat sprite shooters.. But a couple of Polygon style shooters have made the top 10.

and so in no particular order..

1. KYUIN aka Vacuum Kids (NTSC-J)

An absolute cute-em-up with kid riding on a magic flying shooting vacuum that still stuff sucks up pretty well too.

2. Harmful Park (NTSC-J)

Another excellent cute-em-up set in a theme park with tons of varied enemies, power ups, multiple methods of gatting the bad guys and an all round superb presentation.

3. Cotton (Original and 100%)

Cotton Original aka Cotton: Fantastic Night Dreams (NTSC-J)

Cotton 100% aka Märchen Adventure Cotton 100% (NTSC-J)

Yet another cute-em-up. Witch on broomstick gatting everything she sees, and a few half dressed hot pixie women. Whats not to like?

4. Parodius (Series)

Parodius (PAL) aka Parodius Deluxe Pack (NTSC-J)

A Compilation pack of Parodius - From Myth to Laughter and Parodius - Fantastic Journey.

Sexy Parodius (NTSC-J)

Jikkyou Oshaberi Parodius - Forever With Me (NTSC-J)

And the cute-em-up's keep coming. Parodius - Combination of "Parody" and "Gradius". Better than Gradicup I guess (Gradius and cute-em-up). Plays like Gradius but better/surreal bizarre graphics.

5. Gradius Deluxe Pack (NTSC-J)

Enought Cute-em-ups! Some real gatting of nasty aliens intent on making balloon animals out of your intestines! Tip top shmups all the way through.. except when you die and ALL of your power-ups are wiped out.
Contains Gradius and Gradius II.

6. Salamander Deluxe Pack

Another selection of absolute arcade classic H-Shmups. The Salamander series is a spin-off from Gradius, but has its own style and charm.
Contains Salamander, Salamander 2 and Lifeforce.

7. Scramble (Konami Arcade Classics (NTSC-U) aka Konami 80s Arcade Gallery (NTSC-J)

It's the Granddaddy of horizontal shmups. Loads of aliens, rockets, meteors, falling fuel levels, caves, passages.. What more could you want.. And in a psychodelic colour scheme!

8. In The Hunt (PAL) (NTSC-U)

OK, so space is now safe, lets take it under water. Describes as a cross between R-Type and Metal Slug, this graphically pleasing blaster looks amazing and plays so smoothly. Try at your peril (as it will eat up hours of your life!).

9. Thunderforce V - Perfect System (NTSC-U) (NTSC-J)

Well technically it does have some 3D, but also some sprites.. OK its 3D and its pretty good.
For a 3D Shmup, its pretty darn good.

10. G Darius (PAL) (NTSC-U) (NTSC-J)

Another 3Der.. and yup its pretty decent! For some reason I love G Darius, but not so much on Darius Gaiden.. Bizarre. Maybe I should give Gaiden another go.

Some Honourable mentions for those that didn't make the Top Ten: