Question: LC3 assembly help (easy) Code works, it displays the 16 bit binary of the entered value, every 4 bits followed by a space. I get

LC3 assembly help (easy)

Code works, it displays the 16 bit binary of the entered value, every 4 bits followed by a space. I get a space after the last displayed output but I only want a new line.

Example: I get "0000 0000 0000 0000 //n" but I want "0000 0000 0000 0000//n"

Please write the branch I need/tell me where to put it so I only get the space between every 4 bits and not after. Will thumbs up thanks

.ORIG x3000

LD R6, Convert

LDR R1, R6, #0

AND R5, R5, #0

ADD R5, R5, #15

AND R4, R4, #0

ADD R4, R4, #4

LOOP

ADD R4, R4, #0

BRp NEXTNIBBLE

LEA R0, free ;this is where the issue is, i want the space every 4 numbers but not after the 16th/last one

PUTS

AND R4, R4, #0

ADD R4, R4, #4

ADD R5, R5, #0

BR ENDNEXTNIBBLE

NEXTNIBBLE

ADD R1, R1, #0

BRn IFSTAMT

LEA R0, stringzero

PUTS

BR ENDIFSTAMT

IFSTAMT

LEA R0, stringone

PUTS

ENDIFSTAMT

ADD R1, R1, R1

ADD R5, R5, #-1

ADD R4, R4, #-1

ENDNEXTNIBBLE

BRzp LOOP

LEA R0, newLine

PUTS

HALT

;Data

Convert_addr .FILL x3040

stringone .STRINGZ "1"

stringzero .STRINGZ "0"

free .STRINGZ " "

newLine .STRINGZ " "

.ORIG x3040

Convert .FILL xABCD

;END of PROGRAM

.END

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!