please help me fix the following code to display the string 'CS 220' in the Nand2Tetris screen which uses the CPU Emulator  it is supposed to initialize the screen memory location at the middle of the screen....the CPU Emulator has 32767 ROM addresses and 24576 RAM addresses.// Built-in constant in Assembly  // @SCREEN   // A=16384 @16384         // SCREEN base addressD=A@SCREEN_ADDRM=D            // store SCREEN base address in SCREEN_ADDR // Calculate the starting address for centered text (row = 6, column = 20)@32            // Row offset: each row has 32 addressesD=A@6D=D*A          // D = 192 (row offset for row 6)@20            // Column offset: 20th columnD=D+A          // D = 212 (starting address for row 6, column 20)@SCREEN_ADDRD=M+D          // Calculate starting address@ADDRESSM=D            // store starting address in ADDRESS // Initialize count to 0 (start counting for 6 characters)@COUNTM=0            // initialize the count to 0 // Character 'C' (ASCII 67)@67D=A            // D = 67@ADDRESSA=M            // A = current addressM=D            // Store 'C' // Move to the next memory location@ADDRESSM=M+1          // Increment address by 1 // Character 'S' (ASCII 83)@83D=A            // D = 83@ADDRESSA=MM=D            // Store 'S' // Move to the next memory location@ADDRESSM=M+1          // Increment address by 1 // Space ' ' (ASCII 32)@32D=A            // D = 32@ADDRESSA=MM=D            // Store space // Move to the next memory location@ADDRESSM=M+1          // Increment address by 1 // Character '2' (ASCII 50)@50D=A            // D = 50@ADDRESSA=MM=D            // Store '2' // Move to the next memory location@ADDRESSM=M+1          // Increment address by 1 // Character '2' (ASCII 50)@50D=A@ADDRESSA=MM=D            // Store '2' // Move to the next memory location@ADDRESSM=M+1          // Increment address by 1 // Character '0' (ASCII 48)@48D=A@ADDRESSA=MM=D            // Store '0' // End of program@END0;JMP (END)

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter6: Arrays
Section: Chapter Questions
Problem 5GZ
icon
Related questions
Topic Video
Question

please help me fix the following code to display the string 'CS 220' in the Nand2Tetris screen which uses the CPU Emulator  it is supposed to initialize the screen memory location at the middle of the screen....the CPU Emulator has 32767 ROM addresses and 24576 RAM addresses.
// Built-in constant in Assembly  
// @SCREEN   // A=16384


@16384         // SCREEN base address
D=A
@SCREEN_ADDR
M=D            // store SCREEN base address in SCREEN_ADDR

// Calculate the starting address for centered text (row = 6, column = 20)
@32            // Row offset: each row has 32 addresses
D=A
@6
D=D*A          // D = 192 (row offset for row 6)
@20            // Column offset: 20th column
D=D+A          // D = 212 (starting address for row 6, column 20)
@SCREEN_ADDR
D=M+D          // Calculate starting address
@ADDRESS
M=D            // store starting address in ADDRESS

// Initialize count to 0 (start counting for 6 characters)
@COUNT
M=0            // initialize the count to 0

// Character 'C' (ASCII 67)
@67
D=A            // D = 67
@ADDRESS
A=M            // A = current address
M=D            // Store 'C'

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

// Character 'S' (ASCII 83)
@83
D=A            // D = 83
@ADDRESS
A=M
M=D            // Store 'S'

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

// Space ' ' (ASCII 32)
@32
D=A            // D = 32
@ADDRESS
A=M
M=D            // Store space

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

// Character '2' (ASCII 50)
@50
D=A            // D = 50
@ADDRESS
A=M
M=D            // Store '2'

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

// Character '2' (ASCII 50)
@50
D=A
@ADDRESS
A=M
M=D            // Store '2'

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

// Character '0' (ASCII 48)
@48
D=A
@ADDRESS
A=M
M=D            // Store '0'

// End of program
@END
0;JMP

(END)

AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Knowledge Booster
Instruction Format
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.
Similar questions
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning