Testing Z80 Emulation...
Testing Z80 Emulation...
Hi,
Just wondering if anyone has a program (asm or bin) that executes every instruction in the Z80 instruction set? I've just finished a C# port of libz80 and am trying to find a lazy way of testing it.
It all seems to work, but there's always a chance that some of those instructions that I don't know how to use haven't been implemented properly.
Just wondering if anyone has a program (asm or bin) that executes every instruction in the Z80 instruction set? I've just finished a C# port of libz80 and am trying to find a lazy way of testing it.
It all seems to work, but there's always a chance that some of those instructions that I don't know how to use haven't been implemented properly.
Re: Testing Z80 Emulation...
If you download tasm there is a testfile with every mnemonic included and you can compare the outputs to tasm.
In theory, there is no difference between theory and practice. But, in practice, there is.
Re: Testing Z80 Emulation...
Cool. I'll check that out - cheers mate.
Re: Testing Z80 Emulation...
Hi,
I did implement the whole Z80 instruction set (excluding non-official instruction set, working but non-documented instructions by ZILOG) in the ZX81-IDE.
viewtopic.php?f=6&t=795
There you will find a file Z80test.asm which is a summary of all possible instructions and could compare output Z80test.p
By the way - I am not sure if these files are provided with the IDE, will attach it here to be sure.
You maybe have to adjust some labels for testing jumps.
And for the IDE there can be used either () or [] for memory referencing.
In case you have to replace [] with () depending on your assembler engine.
I did implement the whole Z80 instruction set (excluding non-official instruction set, working but non-documented instructions by ZILOG) in the ZX81-IDE.
viewtopic.php?f=6&t=795
There you will find a file Z80test.asm which is a summary of all possible instructions and could compare output Z80test.p
By the way - I am not sure if these files are provided with the IDE, will attach it here to be sure.
You maybe have to adjust some labels for testing jumps.
And for the IDE there can be used either () or [] for memory referencing.
In case you have to replace [] with () depending on your assembler engine.
- Attachments
-
- Z80test.p
- (1.16 KiB) Downloaded 510 times
-
- Z80test.asm
- (8.25 KiB) Downloaded 597 times
Re: Testing Z80 Emulation...
Great stuff Poke, thanks mate.
Didn't get too far with the TASM files - long story - but have fixed one issue with some of the extended opcodes (I forgot to actually code that bit properly) and have tested all the 8-bit load operations successfully.
Didn't get too far with the TASM files - long story - but have fixed one issue with some of the extended opcodes (I forgot to actually code that bit properly) and have tested all the 8-bit load operations successfully.
Re: Testing Z80 Emulation...
There is also Zexall, you might have to tweak it for ZX81 operation, google it or check out world of spectrum
what's that Smell.... smells like fresh flux and solder fumes...
Re: Testing Z80 Emulation...
Could also try to assemble the zx81 rom, added as source and binary to the IDE above.Rink wrote:Great stuff Poke, thanks mate.
Didn't get too far with the TASM files - long story - but have fixed one issue with some of the extended opcodes (I forgot to actually code that bit properly) and have tested all the 8-bit load operations successfully.
Re: Testing Z80 Emulation...
Might try that in a bit, cheers. Although I'm just doing the cpu emulation so it might be difficult to test the ROM without any other parts of the ZX system.
I have a question about the alternate registers which hopefully someone can help with. Looking at the Z80 datasheet from Zilog, I can't really see how these things are used.
Is is just the EXX and EX AF,AF' instructions that can do anything with them?
I have a question about the alternate registers which hopefully someone can help with. Looking at the Z80 datasheet from Zilog, I can't really see how these things are used.
Is is just the EXX and EX AF,AF' instructions that can do anything with them?
- RetroTechie
- Posts: 379
- Joined: Tue Nov 01, 2011 12:16 am
- Location: Hengelo, NL
- Contact:
Re: Testing Z80 Emulation...
Yes and no.
No, because there's no instructions that do anything directly with an alternate register. Not even the exchange instructions: they change what set you're using but not contents of the registers themselves.
Yes, because any instruction that affects A, flags, B, C, D, E, H or L will also work on an alternate register.
Confusing? Not really. It's simply this: there's 2 for each of AF / BC /DE / HL. But for any of those, only 1 is active at any time. Which one, is selected (flipped back & forth) whenever you execute an exchange instruction. Everyting that works on AF-HL, affects the currently selected ones, the currently non-selected ones are simply 'invisible' / unreachable.
Internally in the Z80, there's probably some flip-flops that decide which set is active (one for AF vs. AF', one for BC-HL vs. BC'-HL'). And the exchange instructions simply flip those 'pointers'. Apart from that, these register sets are the same (and other than following a program's flow, you can't tell 'm apart).
Like Andy said, ZEXALL (and ZEXDOC, for testing documented instructions only) is what you're looking for. Just make it fit onto your 'hardware', then sit back.
No, because there's no instructions that do anything directly with an alternate register. Not even the exchange instructions: they change what set you're using but not contents of the registers themselves.
Yes, because any instruction that affects A, flags, B, C, D, E, H or L will also work on an alternate register.
Confusing? Not really. It's simply this: there's 2 for each of AF / BC /DE / HL. But for any of those, only 1 is active at any time. Which one, is selected (flipped back & forth) whenever you execute an exchange instruction. Everyting that works on AF-HL, affects the currently selected ones, the currently non-selected ones are simply 'invisible' / unreachable.
Internally in the Z80, there's probably some flip-flops that decide which set is active (one for AF vs. AF', one for BC-HL vs. BC'-HL'). And the exchange instructions simply flip those 'pointers'. Apart from that, these register sets are the same (and other than following a program's flow, you can't tell 'm apart).
Like Andy said, ZEXALL (and ZEXDOC, for testing documented instructions only) is what you're looking for. Just make it fit onto your 'hardware', then sit back.
Re: Testing Z80 Emulation...
I had a quick look at ZEXDOC but because I'm not building a ZX emulator, I don't think I have any suitable output that it can look at. I need to spend a bit more time checking that though when I'm not at work.
I'm a bit happier with the alternate registers thing now. Cheers mate.
I'm a bit happier with the alternate registers thing now. Cheers mate.