SMS/Z80 Zexall

Discussion of development of software for any "obsolete" computer or video game system. See the WSdev wiki and ObscureDev wiki for more information on certain platforms.
Post Reply
DParrott
Posts: 25
Joined: Thu Jul 29, 2010 4:39 am

SMS/Z80 Zexall

Post by DParrott »

Hi all,

I wondered if anyone else had worked on a Z80/SMS emulator that passes zexall sms?

I've managed to implement all the instructions and have a full pass on zexdoc (using the sdsc version as I do not currently implement the vdp).

Running zexall shows passes on all except this one:

Code: Select all

bit n,<b,c,d,e,h,l,(hl),a>...   CRC:e283c214 expected:a937a161
I believe it has something to do with the bizarro bit n,(hl) undocumented flags, but from the documentation I can find online I think I've implemented MEMPTR in the instructions that affect it.

Looking at the source for the version of the test available at https://github.com/maxim-zhao/zexall-sm ... 1301-L1306 it looks like the instruction immediately before the instruction under test is ld sp,(nn), which I believe places addr+1 into MEMPTR. StackPointerBeforeTest is set to $C07E so would place $C07F into MEMPTR, so if I'm understanding correctly bits 3 and 5 of the high byte would not be set anyway, so shouldn't affect the flags.

Anyone able to help?

Also, has anyone got any build instrcutions for zexall? The latest source in that repo doesn't correspond with the latest released version, and I've never done anything with wla-dx to know where to start building it.

Cheers
DParrott
Posts: 25
Joined: Thu Jul 29, 2010 4:39 am

Re: SMS/Z80 Zexall

Post by DParrott »

Ok, self posting, but it does appear that I might have resolved this.

If what I've got is correct it wasn't in fact the MEMPTR but the flags on the non indirect BIT instruction.

My implementation followed the comments inside of the Undocumentd Z80 PDF which states:

SF flag Set if n = 7 and tested bit is set.
ZF flag Set if the tested bit is reset.
YF flag Set if n = 5 and tested bit is set.
HF flag Always set.
XF flag Set if n = 3 and tested bit is set.
PF flag Set just like ZF flag.
NF flag Always reset.
CF flag Unchanged.

Which I was doing, and failing. If I change my BIT instruction to take Bit 5/Bit 3 (YF/XF) from the value being tested, ignoring the bit being tested, it passes.

Is the documentation incorrect or have I missed something else?
Post Reply