ilmenit Posted March 19, 2014 Share Posted March 19, 2014 Hi, Is there any 6502 emulation library written in C with available sources that allows execution of single instruction? There is lib6502 but this is terrible to modify (macros everywhere) and does not allow step execution. I don't care about speed but the clear code. Quote Link to comment Share on other sites More sharing options...
danwinslow Posted March 19, 2014 Share Posted March 19, 2014 I don't know of any library, but here's a suggestion if youc an't find one. One trick I learned to get around zillions of obscure macros was to intercept the output of the parsing before it is sent to the compilation backend. Most compilers have a switch that allows this. You wind up with the source code after .h file processing, macro expansion and subsitutuion is done. Still not perfect, but can be a lot more readable. Quote Link to comment Share on other sites More sharing options...
Rybags Posted March 19, 2014 Share Posted March 19, 2014 Write you own? 6502 is amazingly simple, doing an emulator would probably be something you'd knock over in a few hours. Quote Link to comment Share on other sites More sharing options...
ilmenit Posted March 19, 2014 Author Share Posted March 19, 2014 Write you own? 6502 is amazingly simple, doing an emulator would probably be something you'd knock over in a few hours. I respect my time and reinventing the wheel is nothing I want. A few hours? With debugging and making sure that emulation is 100% correct? I'd say a few days. Quote Link to comment Share on other sites More sharing options...
Bryan Posted March 19, 2014 Share Posted March 19, 2014 What about the Altirra source? I doubt there's much better 6502 code out there. http://www.virtualdub.org/altirra.html Quote Link to comment Share on other sites More sharing options...
Irgendwer Posted March 19, 2014 Share Posted March 19, 2014 (edited) Is there any 6502 emulation library written in C with available sources that allows execution of single instruction? What about this one: http://raster.infos.cz/atari/sa_libraries/sa_libraries.htm AFAIK it is based on the Atari800 code. Edit: Since the "readme" seems missing there, here the contents: ======================================================================== DYNAMIC LINK LIBRARY: sa_6502.dll license: GPL Standalone CPU 6502 emulation library, by C.P.U. 2003 ======================================================================== This is the library created from the CPU 6502 emulator. Code was taken from Atari800 emulator 1.2.4 (http://atari800.sourceforge.net) and was stripped down for instructions execution only and lacks a lot of the original functionality (IRQ, NMI, etc.). It provides this functions: void C6502_Initialise(BYTE* memory ); int C6502_JSR(WORD* adr, BYTE* areg, BYTE* xreg, BYTE* yreg, int* maxcycles); void C6502_About(char** name, char** author, char** description ); Note: Full source codes are in the "src" directory. Edited March 19, 2014 by Irgendwer Quote Link to comment Share on other sites More sharing options...
ilmenit Posted March 19, 2014 Author Share Posted March 19, 2014 Seems to be exactly what I need and exactly at the moment when I need it! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.