So I've been developing a bytecode interpreter for the NES to solve a few problems. I'm using it to do r&d. Here's why I did it:
1) 6502 is hard - too hard to try out ideas on or get something running quickly.
2) C is not much easier and not space-efficient at all.
3) NES has tight storage, so space-maximizing measures are advantageous
I'd been a fan of Forth for several years and became a minor expert in it. I thought it was the perfect solution to primarily the problem of difficulty of coding. Forth simplifies things a lot, at the cost of speed. The savings in size are almost a side benefit, but they are substantial.
What I settled on is a virtual machine with 8-bit instructions and an 8-bit stack. It'salmost fully functional - still tweaking the instruction set. I optimized it as best I could - the estimated speed is about 600 900 instructions on average per frame. This is enough for rapid prototyping of ideas ... but also useful where speed is not critical, like decompression. I estimate that the size savings it provides over plain asm is about 30%. That ratio, as well as the speed can be improved with peephole optimization (when the compiler combines commonly used pairs of "words" into faster hybrids)
A "compiler" coded in SwiftForth (PC) will generate asm6 assembly code. It should run on the trial version.
I thought I might create a thread to let people know what I'm doing, gauge interest, maybe get help with any issues I run into or just hear ideas and answer questions.
8/15/2013
I threw the runtime source up in a Google Code project - https://code.google.com/p/eighth6502/ sorry no docs, compiler, or example yet
8/18/2013
Updated OP to be a little more general and up-to-date
1) 6502 is hard - too hard to try out ideas on or get something running quickly.
2) C is not much easier and not space-efficient at all.
3) NES has tight storage, so space-maximizing measures are advantageous
I'd been a fan of Forth for several years and became a minor expert in it. I thought it was the perfect solution to primarily the problem of difficulty of coding. Forth simplifies things a lot, at the cost of speed. The savings in size are almost a side benefit, but they are substantial.
What I settled on is a virtual machine with 8-bit instructions and an 8-bit stack. It's
A "compiler" coded in SwiftForth (PC) will generate asm6 assembly code. It should run on the trial version.
I thought I might create a thread to let people know what I'm doing, gauge interest, maybe get help with any issues I run into or just hear ideas and answer questions.
8/15/2013
I threw the runtime source up in a Google Code project - https://code.google.com/p/eighth6502/ sorry no docs, compiler, or example yet
8/18/2013
Updated OP to be a little more general and up-to-date