Nes assembler interpreter

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Nes assembler interpreter
by on (#43811)
I would like to know how much feasible would it be today to make a nes interpreter?

We see emulators about nes rom sprouting every day (I don't say it's a bad thing since I'm guilty too because I wanted to make one a long time ago out of curiosity) but not nes interperter. Maybe I should explain what I mean since sometime my question seems to be always filled with ambiguity.

Let say you have an IDE like Visual Studio/Eclipse. You write your nes code in this. Then, instead of compiling your code to a rom and debugging it with an existing emulator, you would trace instead your code inside that ide. This mean you interpret the nes 6502 instructions in real time, like the gwbasic interpreter and see the results from that IDE. You can put break point anywhere you want, check the state of your memory etc from the IDE.

Since the 6502 instruction set is quite simple and almost as close as the byte code used in the rom, I guess it must be feasible. Possible problems I see are related with code that requires precise timing cannot really debugged with break points and supporting multiple contexts (ca65, asm6, wla, nesasm etc syntax).

Who think that it's now feasible with the current state of computing we are these days?

by on (#43815)
Most "interpreters" parse the program to bytecode when loading it. So by that time, you might as well assemble it.

Existing NES emulators already support code and data breakpoints and single-stepping, since even before FCE Ultra for Windows gained the alphabet soup of forks. If even my eight-year-old PC can assemble and link a full NES-compatible game in one second, I don't see what advantage an interpreter would have over CA65 + an emulator with a debugger that can read its symbol table.

But if you can put down your ideas for editor/debugger user interface design, that might be worth discussing. You appear to want at least a debugging emulator that runs inside Eclipse.

by on (#43819)
I will try to explain what I have in mind and would love to make someday if I can even find the time to do it.

I'm developing at the moment an editor for my nes needs. One feature that I thought could be interesting is to have an integrated code editor. The code editor would support syntax highlighting and maybe could support different context (nesasm, ca65, wla etc).

This editor would be more than just putting color on some instruction. It would give you some intelisence function depending on the instruction. Some example of this support could be a quick reference on the instruction you want to use, listing variables that can be used depending on the location you are (i.e. a bcc should only be able to see labels in a -127,128 byte range) etc.

Since you are interpreting it in real time, you should be able to correct the code you see on the screen and continue to trace it. VB6 (and now dot net), eclipse java editor allows this feature and is quite useful. Maybe for the nes it is less but could interesting.

I have many ideas and could go on an on but basically what I want to do is something similar to visual studio: an integrated solution for all my nes needs that is not a game maker style tool that hides everything from me but more an IDE for programmers.

I may work on it someday once I finish my first phase of my current editor. My code at the moment should be flexible enough to add this feature. And if you use a component like Scintilla, you should be able to save some time.

But still making such an editor is a hell of a task, especially if you have to build the editor + emulator for the code. Maybe using the code of an existing emulator and allow remote debugging could be a way to reduce the required development time.

Still, those are just ideas that I would like to put to reality someday. For now, I should check the feasibility before even writing any code for it.

Edit:

I didn't talk much about possible interface design since I'm still investigating if I will do it or not but I could always try to prototype some screens if I can find the time. Would that be more appropriate?