What's new

Space Invaders Emulator - All the Invaders draw in bottom LH corner

Randall_Flagg

New member
Hi All,

First time post on what looks like a great forum.

I am after some assistance with a Space Invaders Emulator that I have written. Before I start I will say that it is written in Blitz3D as I was just interested to see whether an old skool language like Blitz would have enough grunt to do the job, and when it works, I will then try it on older more obscure platforms (maybe PS2 YaBasic for real old and obscure..).

It turns out that it runs pretty well and at full speed without sweating and I have implemented 8080 processor, Interrupts and 16 bit shift register.

The emulator runs well until it gets to the attract screen, where all of the invaders draw themselves in the same screen location at the bottom LH side of the screen, and then the gun shows up and starts blasting away at empty space.

From what I can see, the Space Invaders pixels are taken from the shift register and then placed into the correct video memory location a column at a time. As the Space Invaders display in on its side, this means that the invaders are drawn from the bottom left of the screen to top right in Columns(rows) a byte of pixels at a time. The actual memory location that the pixels from the shift register are put is I think derived from the memory location stored in HL, and each column is counted off in BC, something like 24 lots of 8 bytes of pixels per column.

Has anyone had an issue like this and if so how was it resolved?

Many thanks for any information that anyone can give.

Edit 1 - Having spent an hour trawling through the debug log, I can see that HL is around 16 bytes off where it should be when it starts to draw invaders. This may be because at least part of the emulator thinks that there is no space invaders left to draw... and the other part thinks there is and starts drawing them! Back to ComputerArcheology's space invaders code page...
 

Attachments

  • SI1.jpg
    SI1.jpg
    83.1 KB · Views: 28
  • SI2.jpg
    SI2.jpg
    73.7 KB · Views: 29
Last edited:

Robbbert

Member
Moderator
Don't forget that Space Invaders has a special chip (MB14241) for doing bit-shifts, which you'll need to emulate too.
 
OP
R

Randall_Flagg

New member
Don't forget that Space Invaders has a special chip (MB14241) for doing bit-shifts, which you'll need to emulate too.

Yer that's the 16-bit Shift register. Have implemented this and it seems to work as without it, I wouldn't get any invaders drawn at all, but the offset in the screen memory is incorrect. Am just trawling through Computer Archaeologies Space Invaders code page to try and work out where the offset comes from.

Edit: Finally found out what was wrong with a lot of trawling through debug log and comparing to working emulator. I misread how Opcode 0x2A - LHLD, A16 works. The A16 in the name gives it away, A for address. I was treating it as a D16 and loading PC and PC+1 into registers H and L. All invaders now in correct places. Now the next bug! Attract mode shot collision doesn't seem to work :-(
 
Last edited:

Top