Can Someone tell me what to do in chapter 6 Project??

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

Can Someone tell me what to do in chapter 6 Project??

wudi8913
This post was updated on .
I am trying to finish chapter 6 and I have no clue what to do.

Can someone send me some pictures of their work.

Wudi8913@gmail.com

Please help !!


Reply | Threaded
Open this post in threaded view
|

Re: Can Someone tell me what to do in chapter 6 Project??

ybakos
Can you ask a specific question about what you are having trouble with?

In project 6, you have to write a program, using any programming language you want, that translates an .asm file into a .hack file.
Reply | Threaded
Open this post in threaded view
|

Re: Can Someone tell me what to do in chapter 6 Project??

wudi8913
I have four .asm files in project6(add,max,rect and pong).
So I just need to choose a programming language(Like C++) to achieve the same result??
Reply | Threaded
Open this post in threaded view
|

Re: Can Someone tell me what to do in chapter 6 Project??

ivant

No. You have to write a program, say in c++, which reads an .asm program from a file (the file name is passed as parameter), translate that program to HACK code and write the result in a corresponding .hack file.


On Tue, Mar 24, 2015, 03:59 wudi8913 [via Nand2Tetris Questions and Answers Forum] <[hidden email]> wrote:
I have four .asm files in project6(add,max,rect and pong).
So I just need to choose a programming language(Like C++) to achieve the same result??


If you reply to this email, your message will be added to the discussion below:
To start a new topic under Project 6, email [hidden email]
To unsubscribe from Nand2Tetris Questions and Answers Forum, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Can Someone tell me what to do in chapter 6 Project??

rgravina
In reply to this post by wudi8913
I'll show you what mine does and hope it helps. I wrote it in C, and it compiles to an executable called 'hack'. When I run 'hack' with no arguments it shows usage information:
~/workspace/nand2tetris/projects/HackC: ./hack
usage: ./hack 
An assembler for the Hack platform.
When I run 'hack' with an assembly file it produces Hack machine code.
 ~/workspace/nand2tetris/projects/HackC: ./hack ../06/add/Add.asm 
0000000000000010
... etc
(As the previous poster suggested you should probably write it to a .hack file. I just piped its output to a text file instead.)

Then you can take those .hack files and compare them with what the visual assembler (Assembler.sh or .bat) generates for the same assembly file.

As the book suggests, it's easiest to start with a assembler which doesn't support labels and symbols, and add that in later once the non-label version works.