Systems Architecture
Systems Architecture
7th Edition
ISBN: 9781305080195
Author: Stephen D. Burd
Publisher: Cengage Learning
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

this is my code :

it is supposed to print "CS 220"

on the screen of the Nand2Tetris screen which loads code onto the ROM and utilizes the CPU Emulator:

However, it is not working.

// Built-in constant in Assembly
// @SCREEN // A=16384
// D=A

// Let's say we start at address 16640 (this is where our text will be placed)
@16640
D=A // D = 16640 (starting address for text)
@address
M=D // store starting address in 'address' variable

// Loop 48 times (arbitrary number, feel free to adjust as needed)
@count
M=0 // initialize the count to 0

(LOOP)
@48
D=A // D = 48
@count
D=M-D // D = count - 48
@ENDLOOP
D;JGE // if count >= 48, jump to ENDLOOP

// Place character 'C' (ASCII 67) at current address
@67
D=A // D = 67 (ASCII value for 'C')
@address
A=M // A = current address
M=D // Store 'C' at the current address

// Move to the next memory location (increment by 1)
@address
M=M+1 // Increment address by 1

// Place character 'S' (ASCII 83)
@83
D=A // D = 83 (ASCII value for 'S')
@address
A=M // A = current address
M=D // Store 'S' at the current address

// Move to the next memory location
@address
M=M+1 // Increment address by 1

// Place space character ' ' (ASCII 32)
@32
D=A // D = 32 (ASCII value for space)
@address
A=M // A = current address
M=D // Store space at the current address

// Move to the next memory location
@address
M=M+1 // Increment address by 1

// Place character '2' (ASCII 50)
@50
D=A // D = 50 (ASCII value for '2')
@address
A=M // A = current address
M=D // Store '2' at the current address

// Move to the next memory location
@address
M=M+1 // Increment address by 1

// Place another '2' (ASCII 50)
@50
D=A // D = 50 (ASCII value for '2')
@address
A=M // A = current address
M=D // Store '2' at the current address

// Move to the next memory location
@address
M=M+1 // Increment address by 1

// Place character '0' (ASCII 48)
@48
D=A // D = 48 (ASCII value for '0')
@address
A=M // A = current address
M=D // Store '0' at the current address

// End of program, prevent further operations
@END
0;JMP

(END)

//====================================================================================

Please fix it

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
A+ Guide to Hardware (Standalone Book) (MindTap C...
Computer Science
ISBN:9781305266452
Author:Jean Andrews
Publisher:Cengage Learning
Text book image
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:9781337569798
Author:ECKERT
Publisher:CENGAGE L