tepples wrote:Sometimes I prototype things in Python before translating them to assembly language.
Nice. Btw, I've written a script in Lua where the assembly as a whole is an object. This object has a method for each 6500 instruction. I've gone a little overboard with that in trying to mimic a 6502 processor, with members for the registers and a hash table for previously accessed memory locations... But that's a little flawed and I'll probably have to trim that away.
What this assembly object does is keep a record of each line, and it attempts to track the size as well. It also has a 'write' method to iterate through the lines and write to a string, which it returns, and which can be printed to standard output or written to another file.
You can pass this assembly object to other functions and let them call its instruction methods, and thus break down assembly code into much more manageable parts. Things that are a little harder to do in assembly could be passed on to Lua to some extent. Essentially, the Lua code builds the assembly code, and of course something similar could be done in Python.
And that's how the game is built.
link.