Did anyone have fun going all the way to tetris really from scratch? Ie using only the hack CPU emulator?

classic Classic list List threaded Threaded
2 messages Options
yyy
Reply | Threaded
Open this post in threaded view
|

Did anyone have fun going all the way to tetris really from scratch? Ie using only the hack CPU emulator?

yyy
This post was updated on .
The idea is that if we build our computer from scratch, we have no other available to write or run compilers.

Of course, I know that the purpose of the course is to understand the logic behind programming, the different levels of languages, compiling, etc... and the emulators are there to help verify and debug the code.

But I wondered if some, for the challenge, had already forbidden themselves to use anything other than the CPU emulator to go to tetris ? :)

I wonder what would be the most efficient method: write a small compiler of a language halfway between the asm and the hack, to avoid having to write in hack as soon as possible? The code to compile must be in the ROM, after the program, and the assembled code must be recover from the RAM. Then write a program that reads an asm file (translated into hex and placed after the program in the ROM that the program move into the RAM), character by character, to compile it in hack? And so on, same thing with the VM, then the jack?

The pinnacle being, of course, to write a text editor to be able to write your tetris program, before compiling it directly via the CPU emulator :)

Is it possible at least? Are there any other posts on this forum relate to this topic? I only found the jack compiler written in jack.

edit : just found this:
http://nand2tetris-questions-and-answers-forum.32033.n3.nabble.com/Implementing-the-Hack-Assembler-In-HACK-MACHINE-LANGUAGE-td4034423.html#a4034433
http://nand2tetris-questions-and-answers-forum.32033.n3.nabble.com/Writing-the-Assembler-in-Hack-assembly-language-td4029718.html

So the idea is there, but no one has tried it? :)
Reply | Threaded
Open this post in threaded view
|

Re: Did anyone have fun going all the way to tetris really from scratch? Ie using only the hack CPU emulator?

WBahn
Administrator
The biggest issue that you have to confront is that the CPU Emulator doesn't support any kind of file system, so you can't read a source code file or output the results.