This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

nodeNES is out!

nodeNES is out!
by on (#95605)

Today nodeNES is out. It is a c6502 compiler in javascript. It's in more than alpha stage, but it is fully capable for compiling and running (with JSNES) some demos.

You can take a look at:

The source code is hosted at github. If you have your own demo or code snippet and you wish to post along with other demos of nodeNES.

You can fork add the demo and open a pull request, or if you don't know how to do it you can talk to me and I will certanelly help you.

Thanks, and have fun!

by on (#95607)
This is pretty cool! I like that you can inject your CHR edits into the running ROM, it reminds me a little of the NESticle days.

The tile editor could use a little polishing, but this is still pretty well put together. I hope to see it developed further.

by on (#95610)
Agreed -- neat, and convenient. Might make for a useful development tool, quite honestly. Sure takes the common annoyances out of writing code + testing.

If you wanted something to focus on however, it would be that running something takes up 100% CPU (of a single core); so someone very likely has a while(1) {} loop of some sort. Surely there is a better way to do it than that, but I know jack squat about Javascript (other than I avoid it :P).

by on (#95615)
@mikejmoffitt Thanks... I will certanlly polish it. Like I said, it is in pre-alpha stage. However it's already compiling a lot of stuff. Sorry for the minnor bugs. I will pimp it a little along this week.

@koitsu I've notive the running problem. However, that problem mostly is a emulator stuff. Two commum problems that I have:
1) I'm recompiling and reloading the code at every 5 second pause on the source editor. Problem is that NOT every source is a valid nes game. I need to put a checkbox to disable the auto-run
2) My compiler does yeild for several types of erros. I sould prompt it on the screen. So the developer could focus on that his is doing, and doing it write.

Anyway... thanks!

I hope I could use it for tutorials and those kind of stuff... Do you guys have any DEMO code that I could post along nodeNES? Right now the code dosen't work if a lot of mappers. The could was build all with TDD. So, it has tests for everything. And I didn't have fixture example with every kind of mapper. Examples are always welcome.

You can also post Issues on github, or even help me fix them!

thanks again

by on (#95616)
Is the "Basic example" seen here too complex?

by on (#95637)

Wow, that is a fantactic example. However the example deals with some directives that my compiler dosen't seem prepared yet. Like .include .import .segment and .exportzp.

Include would be very simple to implement. However, I don't know what import and exportzp does. The segment directive is another issue. With that you use you need to compile parts of the code to mount then latter. Or use a precompiler to catch and call .org at certain places, but it can be made.

In fact, it only seems that I need to know what .import and .exportzp does.

Nice example!

by on (#95639)
gutomaia wrote:
Wow, that is a fantactic example.

Why thank you.

However the example deals with some directives that my compiler dosen't seem prepared yet. Like .include .import .segment and .exportzp.

Include would be very simple to implement. However, I don't know what import and exportzp does.

They're to allow different translation units (that is, different .s files) to share symbols while keeping others private.
  • .export makes a symbol defined in this file visible to other translation units.
  • .import allows using symbols that another translation unit has exported, with the actual value subbed in later once all translation units have been loaded.
  • .global acts like .export if the symbol was defined here and .import if it was not.
  • .importzp, .exportzp, and .globalzp act the same but also involve an assumption that the value is $00-$FF, allowing use of 1-byte instructions. A symbol exported with zp can be imported without it but not vice versa.
For other directives see the ca65 users guide.

If your assembler works by .include'ing all source code files instead of producing object files and linking them later, here's a workaround:
  • Prepend the .s file's name to all top-level symbols that aren't imported or exported.
  • Collect lines by what segment they're in, and then reorder them by segment. (Lines before the first .segment are in .segment "CODE".)
  • Apply an appropriate .org before each segment.

by on (#96663)
This is amazing. It compiles and runs in real time! Can't believe the best IDE ever for NES homebrew is just inside my browser.

Congrats, bro.

by on (#96678)
That's unbeliavably cool!

by on (#96711)
vicious wrote:
It compiles and runs in real time!

Is that a feature expected from an IDE? Personally I find it strange having to wait for some event to trigger a compile. In my IDE I toyed with background compiling to highlight code errors as you were coding; I thought that actually loading and trying to run what you'd created might be too much because typically you'd expect the user might be stopped at a breakpoint and just trying things.

Oh and how do I save what I've created?