Can any of you 65(C)02 emulator/simulator writers out there point me in the direction of some well-established code that will allow me to test out all the standard op-codes? Presumably, you must have tested your emulator/simulator on such code?
I'd like to obtain a dump of of the PC and A,X,Y,P,S values after each instruction so I can check if my model is working correctly.
Op-code testing
http://www.serious-dial.atari.pl/pliki/ ... r_6502.zip
try this book, in the least part there are some short codes with very detailed description what's going on and how registers are set
try this book, in the least part there are some short codes with very detailed description what's going on and how registers are set
owns 1xC128, 1x128D cr ,1xc64 (broken unfortunately) ,1xc64c ,2xc64g (one is broken) ,~4xc64e ,1x1541 ,1x1541-II ,1x1541C and some chips for those machines
www.vulture.c64.org
www.rafalszyja.republika.pl
www.vulture.c64.org
www.rafalszyja.republika.pl
I, too, am writing an emulator and need opcode test cases - would prefer it if they were self-testing (pass/fail with no user interaction), but I can step through each if necessary.
I checked out the link that Raf posted, but it seems to be in a format I am not familiar with.
Would appreciate any tests.
I checked out the link that Raf posted, but it seems to be in a format I am not familiar with.
Would appreciate any tests.
I think that people out there can write small portions of code just to test various intructions and then if you put it all together you'll have such a test code. Myself I write such a small thingies to test if I'm thinking good about it's functionality in Michal Kowalski's 6502 simulator.
let's start with LDA: it affects only Z and C in that way:
lda #0 -> Z=1
lda #128 or higher -> N=1
CMP : if argument for cmp is greater than or equal to akku then C=1 N=0 else C=0 N=1 , if operand = akku then Z=1
live things:
LDA #20
CMP #20 -> C=1 , Z=1 , N=0
LDA #10
CMP #20 -> C=0 , Z=0 , N=1
LDA #20
CMP #10 -> C=0 , Z=0 , N=1
too bad somewhere I've had a chart which clearly showed which instructions affects bits in cpu's register but I just lost it. I have similiar thing in book but it's in polish
let's start with LDA: it affects only Z and C in that way:
lda #0 -> Z=1
lda #128 or higher -> N=1
CMP : if argument for cmp is greater than or equal to akku then C=1 N=0 else C=0 N=1 , if operand = akku then Z=1
live things:
LDA #20
CMP #20 -> C=1 , Z=1 , N=0
LDA #10
CMP #20 -> C=0 , Z=0 , N=1
LDA #20
CMP #10 -> C=0 , Z=0 , N=1
too bad somewhere I've had a chart which clearly showed which instructions affects bits in cpu's register but I just lost it. I have similiar thing in book but it's in polish
owns 1xC128, 1x128D cr ,1xc64 (broken unfortunately) ,1xc64c ,2xc64g (one is broken) ,~4xc64e ,1x1541 ,1x1541-II ,1x1541C and some chips for those machines
www.vulture.c64.org
www.rafalszyja.republika.pl
www.vulture.c64.org
www.rafalszyja.republika.pl
I'm not saying that I cannot write such tests, I just don't want to - it is work enough having to write the emulator, so I was hoping that there would be tests that people have used already that they can share with emulator writers, such as myself.
If I don't find anything that is already self-contained and complete, I'll just have to write them all myself.
If I don't find anything that is already self-contained and complete, I'll just have to write them all myself.
I see
then don't rely on me
I'm too lazy to write such a thing 
owns 1xC128, 1x128D cr ,1xc64 (broken unfortunately) ,1xc64c ,2xc64g (one is broken) ,~4xc64e ,1x1541 ,1x1541-II ,1x1541C and some chips for those machines
www.vulture.c64.org
www.rafalszyja.republika.pl
www.vulture.c64.org
www.rafalszyja.republika.pl
Re: Op-code testing
petej wrote:
Can any of you 65(C)02 emulator/simulator writers out there point me in the direction of some well-established code that will allow me to test out all the standard op-codes? Presumably, you must have tested your emulator/simulator on such code?
I'd like to obtain a dump of of the PC and A,X,Y,P,S values after each instruction so I can check if my model is working correctly.
I'd like to obtain a dump of of the PC and A,X,Y,P,S values after each instruction so I can check if my model is working correctly.
Sam
---
"OK, let's see, A0 on the 6502 goes to the ROM. Now where was that reset vector?"
---
"OK, let's see, A0 on the 6502 goes to the ROM. Now where was that reset vector?"
The most interesting one I found was by Wolfgang Lorenz. He wrote a C64 emulator some time ago. If you google for something like "wolfgang lorenz 6502 test suite" you should be able to track down his testsuite-2.1x.tar.gz code.
It needs work to make it run on Kowalski's emulator as it uses C64 bios calls to chain in further segments of code. If you make any progress with it let us know.
It needs work to make it run on Kowalski's emulator as it uses C64 bios calls to chain in further segments of code. If you make any progress with it let us know.
Goog,
I don't want to dampen your enthusiasm for writing yet another 6502 simulator, but there are lots of them already out there. The source code for Kowalski's is on his web site.
I'm not aware of there being one of the same quality of Kowalski's for the 65802/65816 instruction set. There are ones for the SNES but, from my cursory Google, not in the same league as Michal's which I've sucessfully used to test out my code before running it on real 65C02-based hardware.
A 65816 simulator/emulator extension for Kowalski's would get my vote
I don't want to dampen your enthusiasm for writing yet another 6502 simulator, but there are lots of them already out there. The source code for Kowalski's is on his web site.
I'm not aware of there being one of the same quality of Kowalski's for the 65802/65816 instruction set. There are ones for the SNES but, from my cursory Google, not in the same league as Michal's which I've sucessfully used to test out my code before running it on real 65C02-based hardware.
A 65816 simulator/emulator extension for Kowalski's would get my vote