|
Hey!
I was wondering how I'd go about creating the Assembler in the Hack Assembly Language itself, instead of using a language like Python or C. As far as I can tell, I'd need to create some mechanism to fill the Assembly code somewhere in memory, and for my Hack program to go over this memory, assembling it somehow.
As far as I can tell, this isn't made easy to do by the GUI.
Ways I can think of doing this:
1) Use the CPU Simulator and load up my Assembler.hack file and fill in Hack instructions in a pre-determined area of the RAM (interpreting every 2-byte register as an ASCII character?). Convert these instructions into the respective A-type and C-type instructions in a different area of RAM.
This method sounds incredibly painful, especially considering that the GUI is supplied with only the compiled class files, not the original Java files, so I can't simply modify the GUI to make it easier to input code into the RAM.
2) Write my own Hack interpreter, like what they've got, but one that can be extended more easily and will allow us to do what I want more easily.
This sounds like a pretty fun learning experience, but it might be a bit too involved for someone more interested in taking the course and less in creating the course itself.
Thoughts? Am I missing some other obvious way to create the Hack Assembler using the Hack Assembly Language itself?
|