r/programminghelp • • Mar 18 '19

How do I go from assembly code to an nes image/rom/playable game file?

I'd like to code in assembly, not C. How do I make my code into a playable file?

4 Upvotes

12 comments sorted by

2

u/FredTargaryen Mar 18 '19

You would have to learn the NES instruction set and architecture, and program entirely in that. Once you've made a file with all the instructions in there you'd have to find out the format of a NES file and make sure your file matches that (luckily for a NES I think it's like a 14-byte header and you're ready to go).

Then you could just load that file into an emulator and it should work. I think this would be a long and exhausting undertaking - unless there's some kind of NES compiler out there - but wiki.nesdev.com has probably all the info you will need for it.

1

u/lmperceptible Mar 19 '19

There are guides on how to code in 6502 but none are very descriptive on how to get the .nes file from assembly. How do I do specifically this? Nerdy Nights doesn't explain this and nesdev is vague. Where could I look for instructions?

1

u/rossdrew Mar 23 '19

Are you writing 6502 or NES 6502?

1

u/lmperceptible Mar 29 '19

NES 6502

1

u/rossdrew Mar 30 '19 edited Mar 30 '19

I could maybe adapt my emulator to turn your code into an iNES file if that would be useful.

1

u/lmperceptible Mar 31 '19

How would this work? I'm still learning. Also, is an iNES file readable by most emulators? And just to be clear, I'm focusing on writing in assembly

1

u/rossdrew Mar 31 '19

That’s the standard developed by and usually adopted by emulators. It’s essentially raw assembly, surrounded by some header data that the NES emulator memory maps to the correct place when its connected.

1

u/lmperceptible Apr 01 '19

How difficult would this be to adapt?

1

u/rossdrew Apr 02 '19 edited Apr 02 '19

Shouldn't be too hard, just a matter of combining the compiler and nes file code. If I can find the time.

It will require two inputs, your code and your character rom information. Are you writing with this in mind?

1

u/lmperceptible Apr 02 '19

What do you mean by character rom info?

→ More replies (0)

1

u/FredTargaryen Mar 19 '19

I don't know of any assemblers for the 6502, unfortunately