Yep. I was shocked it was that easy, myself, to be honest! Not that I've created Metroid or anything, but the possibility is at least not a pipe dream.strat wrote:So you can actually write code in this thing and instantly run it ala 6502 Simulator? Niiiice.
... But it would be great if it also worked as a frontend for an existing assembler (say nesasm or ca65), so you can build an existing project and play it.
I need to formally put a plug out...I wonder if there's a DLL frontend for any of these existing assemblers? The reason I implemented my own assembler is several-fold:
1. Desire to keep everything in one neat-n-tidy exe package.
2. Lex/Yacc experience burning a hole in the back of my head trying to get lost forever...needed a project just like this to keep it live!
3. Desire to *not* have to use Windows system calls, execl calls, or any other sort of clumsy interface and whatever "hack" file presence checking and temporary files and all that mess to interface to an outside executable.
The assembler I wrote is actually a separate package built as a static library (in Cygwin) and linked into NESICIDE. It has a fairly simple interface that would, I think, work well in a DLL (I just haven't promoted it to DLL yet, see 1 above):
void assemble ( const char* buffer_in, char** buffer_out, int* size );
int get_num_errors ( void );
void get_errors ( char** errors );
Basically NESICIDE concatenates all of the subroutine elements and passes the whopping mess to "assemble", which allocates memory and returns the a pointer to the assembled result (unless there are errors) and how many bytes were assembled. All the while, the errors are kept and retrievable via "get_errors".