6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 7:25 pm

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Op-code testing
PostPosted: Mon Oct 18, 2004 12:27 pm 
Offline

Joined: Mon Oct 18, 2004 12:18 pm
Posts: 7
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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Aug 02, 2005 9:56 pm 
Offline

Joined: Tue Aug 02, 2005 9:42 pm
Posts: 19
Location: Poland
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

_________________
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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Aug 04, 2005 1:53 am 
Offline

Joined: Thu Aug 04, 2005 1:49 am
Posts: 2
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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Aug 04, 2005 4:04 pm 
Offline

Joined: Tue Aug 02, 2005 9:42 pm
Posts: 19
Location: Poland
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 :)

_________________
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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Aug 04, 2005 8:07 pm 
Offline

Joined: Thu Aug 04, 2005 1:49 am
Posts: 2
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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Aug 05, 2005 7:48 am 
Offline

Joined: Tue Aug 02, 2005 9:42 pm
Posts: 19
Location: Poland
I see :) then don't rely on me ;-) I'm too lazy to write such a thing :P

_________________
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Op-code testing
PostPosted: Thu Aug 18, 2005 3:12 am 
Offline

Joined: Wed Jul 20, 2005 11:08 pm
Posts: 53
Location: Hawaii
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 might be able to write that, but I need to know something: do you want to test all opcodes of the NMOS 6502 (including undocumented ones), just the documented ones, or the ones of the 65C02?

_________________
Sam

---
"OK, let's see, A0 on the 6502 goes to the ROM. Now where was that reset vector?"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Aug 18, 2005 6:23 pm 
Offline

Joined: Mon Oct 18, 2004 12:18 pm
Posts: 7
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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Aug 18, 2005 6:37 pm 
Offline

Joined: Mon Oct 18, 2004 12:18 pm
Posts: 7
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 :wink:


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jul 19, 2008 6:37 pm 
Offline

Joined: Fri Jul 18, 2008 11:01 am
Posts: 8
thanks alot guys appreciate it :D


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 59 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: