6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Sep 28, 2024 10:18 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri Aug 16, 2024 2:02 am 
Offline

Joined: Thu Aug 15, 2024 10:58 pm
Posts: 4
Hey all, I'm new to the emulator writing game. I just decided a few days ago to write a 6502 emulator in Zig. Eventually I may work up to emulating a whole //e. One thing that I've been looking for that I haven't found so far is the availability of unit tests for each individual 6502 opcode in a language neutral format. I've found plenty of unit tests embedded in the source code of emulators that have published their source code and I've found quite a few large test suites that will test everything on a 6502 all in one binary.

The unit tests embedded into the source code of other emulators are useful, except that it's very tedious and error prone to try and understand the source project and then convert those tests to your system. And until your emulator is nearly finished the large test suites are not very useful.

What I'm looking for would be a set of YAML or JSON files that have the instructions for initializing the emulated CPU & memory with a certain state (flags, registers, data). Then the CPU would be stepped to run a single instruction. Lastly the state of the system would be compared to what's listed in the test file to make sure that it matches.

I think that would be invaluable for anyone developing a 6502 emulator. If anything like that exists, I'd love to hear about it.


Top
 Profile  
Reply with quote  
PostPosted: Sat Aug 17, 2024 4:54 pm 
Offline
User avatar

Joined: Tue Feb 28, 2023 11:39 pm
Posts: 220
Location: Texas
I do not know of any thing that would be a definition in JSON or otherwise; unit tests are usually very specific to whatever code base your developing in.

That being said, I know there are some various test programs that run on the 6502 itself to verify that it is working.

The Klaus tests are one such set:
https://github.com/Klaus2m5/6502_65C02_functional_tests

Depending on how accurate you want to go, different variations of the 6502 will have some slightly different side effects in some cases. Rockwell NMOS vs. WDC CMOS vs. Roch 2C02 for example.


Top
 Profile  
Reply with quote  
PostPosted: Sat Aug 17, 2024 7:54 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1948
Location: Sacramento, CA, USA
The work of forum member cjs comes to mind ... perhaps close to what you seek?

search.php?st=0&sk=t&sd=d&sr=posts&keywords=+unit+test&author_id=2898

(I hope I'm not wasting your time ... I don't have the tiniest clue what a YAML or a JSON is, and my biological hard drive is in desperate need of a defrag ... ]

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
PostPosted: Sat Aug 17, 2024 8:20 pm 
Offline

Joined: Fri Apr 15, 2016 1:03 am
Posts: 139
Here is another possibility:
http://forum.6502.org/viewtopic.php?f=8&t=8119&p=108636&hilit=json#p108636


Top
 Profile  
Reply with quote  
PostPosted: Sat Aug 17, 2024 8:38 pm 
Offline

Joined: Thu Aug 15, 2024 10:58 pm
Posts: 4
leepivonka wrote:


Aha! That led me to this GitHub project:

https://github.com/SingleStepTests/65x02/tree/main/6502

That's perfect!


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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: