Something simple to emulate


I think you might need to invert your Y co-ords. The scores should be at the top, and Credit at the bottom
 
@pmprog Thanks, when I got into game the player was at the top of the screen, and I was wondering what was causing that, but what you say makes sense, so I can flip that around (strange the letters are around the right way; must be another bug!)
 
strange the letters are around the right way; must be another bug!
Maybe bitmaps/characters/tiles use 0,0 in the top-left, and the screen uses 0,0 in the bottom-left?Do your invaders and player draw the correct way around?
 
It's a screen coordinate problem - the characters are drawn correctly but their positions are inverted. Should be reasonably easy with a decent debugger to track it down and fix that. It's not as simple as an inverted bitmap though.

D.
 
The Y coordinate was wrong as it wasn't being flipped to the texture space I am using (actually it is the X coordinate, as the monitor is rotated 90 degrees in the arcade machine), the fact each glyph was also upside down is because the pixels are store in a 1bpp buffer, so drawing a line of 8 vertical pixels (again, actually horizontal, due to rotated monitor), means unpacking the 8 bits from a byte and drawing them to 8 consecutive pixel, and I was reading the bits in the reverse order. Relatively minor issue in the grand scheme of things.

So the update for today is the video below, starting to look a fair bit better. Next major (obvious) issue is the lack of invaders and projectiles (so based on that I am 50% complete, as I have emulated the 'SPACE' but not the 'INVADERS') ...

http://youtu.be/hpvvwVGWhYA
 
I am currently trying to work out from the documents how the flags are meant to be set when a carry occurs, for example: 0xff + 0x1 = 0x0 with carry set (0b11111111 + 0xb00000001 = CARRY 0xb00000000). So if this addition was getting assigned to an 8 bit register, the register would be set to 0, the carry flag CY would be set the auxiliary carry flag AC would be set, the sign flag S not be set as the value is not negative, the parity would would be checked (for the value 0), but would the zero flag Z be set or not? The contents of the register is 0, which could mean the zero flag should be set, but the actual result was 0x100 which is obviously not zero.

At the moment I am setting the zero flag in the above, but as I am trying to work out why my aliens and projectiles are not drawing I am thinking about whether I am making bad assumptions anywhere.
 
Last edited by a moderator:
Zero flag is set based on the contents of the register.

I'm looking over your code right now, and I could be misinterpreting something but is line 735 right?
 
Last edited by a moderator:
@Exophase just pushed latest code, you highlighted a problem, although one that is already fixed. There is a few random bits of debug code left in, as I was mid flow and just commit + pushed so you weren't looking at stale code.

EDIT: And thanks for confirmation that the flags are set based on content of register, couldn't find that in the documents (could well be there, but I missed it). Good to know for sure, hoping this is generally always the case for flags?
 
Last edited by a moderator:
Good to know for sure, hoping this is generally always the case for flags?
If the documentation says it's based on the result it'll mean the value stored in the register, every time. I've never known an exception. Flags behavior tends to be pretty standard, with a few annoying variations.

Interestingly, in a subtraction/comparison you can't trip both zero and carry. Testing for zero after an addition is probably not done an awful lot.
 
Oh, okay, it is working now. Was convinced I would have made opcode mistakes, when in fact I hadn't (or maybe I have, but it wasn't the source of this problem). I hadn't implemented the special shift instruction (accessed via the IN/OUT instructions), with this implemented I get something that looks suspiciously like Space Invaders! :)


http://youtu.be/_QcF9halCIA
 
Last edited by a moderator:
hehe, absolutely useless but fun :) now make a JIT compiler for it :D
 
Back
Top