SMS/Z80 Zexall
Page 1 of 1

Author:  DParrott [ Fri Nov 03, 2017 7:03 am ]
Post subject:  SMS/Z80 Zexall

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:
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 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.


Author:  DParrott [ Tue Nov 07, 2017 3:47 am ]
Post subject:  Re: SMS/Z80 Zexall

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?

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group