Question: Each test program except the first one comes in two versions: Prog.asm is an assembly program; ProgL.asm is the very same program, Less the symbols

Each test program except the first one comes in two versions: Prog.asm is an assembly program; ProgL.asm is the very same program, Less the symbols (each symbol is replaced with an explicit memory address).

Symbolic Program

Add.asm

Symbolic Program

Max.asm

Symbolic Program

Rect.asm

Symbolic Program

Pong.asm

Symbolic Program

Without Symbols

Without Symbols

Without Symbols

MaxL.asm

Without Symbols

RectL.asm

Without Symbols

PongL.asm

Description

Adds up the constants 2 and 3 and puts the result in R0.

Description

Computes max(R0,R1) and puts the result in R2.

Description

Draws a rectangle at the top-left corner of the screen. The rectangle is 16 pixels wide and R0 pixels high.

Description

A single-player Pong game. A ball bounces off the screen's "walls". The player attempts to hit the ball with a paddle by pressing the left and right arrow keyboard keys. For each successful hit, the player gains one point and the paddle shrinks a little, to make the game slightly more challenging. If the player misses the ball, the game is over. To quit the game, press the ESC key.

Description

The Pong program supplied above was written in the Java-like high-level Jack language and translated into the Hack assembly language by the Jack compiler (Jack and the Jack compiler are described in Chapter 9 and in Chapters 10-11, respectively). Although the original Jack program is only about 300 lines of Jack code, the executable Pong code is naturally much longer. Running this interactive program in the supplied CPU Emulator is a slow affair, so don't expect a high-powered Pong game. This slowness is actually a virtue, since it enables your eye to track the graphical behavior of the program. And don't worry! as we continue to build the software platform in the next few projects, Pong and and other games will run much faster.


Write an Assembler program that translates programs written in the symbolic Hack assembly language into binary code that can execute on the Hack hardware platform built in the previous projects.

Part of the nand2tetris Companion.

Step by Step Solution

3.49 Rating (175 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

An assembler is a program that translates assembly language a lowlevel programming language into machine code a series of instructions that can be exe... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!