0

I am trying to create a program that will present the number input in binary to the user. Currently, all I have is the setup to get the user's number once they are finished typing all of their characters, however I don't understand why the code below will not run.

.ORIG x3000

RESET
AND R1, R1, #0
AND R2, R2, #0 
AND R3, R3, #0
AND R4, R4, #0

ASCII .FILL #-48   ;ASCII CONVERSION
LD R5, ASCII       ;

AND R6, R6, #0  ;NEGATIVE FLAG

DISPLAY .STRINGZ "\nTYPE A NUMBER THEN PRESS ENTER: "
LEA R0 DISPLAY
PUTS

loop

LOOP
GETC
OUT

AND R4, R4, #0   ;CHECK IF LF
ADD R4, R4, #-10 ;
ADD R4, R4, R0  ; 
BRZ READY

LD R4, CHECKN   ;check if negative
AND R4, R4, #0  ;
ADD R4, R4, R0  ;
BRZ NEGATIVE    ;

ADD R1, R0, R5
BRNZP MULTIPLY
ADD R2, R1, R3
BRNZP LOOP

NEGATIVE
ADD R6, R6, #1
BRNZP LOOP

multiply by adding the same number 10 times

MULTIPLY
ADD R3, R2, R2
ADD R3, R3, R2
ADD R3, R3, R2
ADD R3, R3, R2
ADD R3, R3, R2
ADD R3, R3, R2
ADD R3, R3, R2
ADD R3, R3, R2
ADD R3, R3, R2
BRNZP LOOP


CHECKN .FILL #-45

READY


HALT

.END
Jolta
  • 2,620
  • 1
  • 29
  • 42
  • 2
    Welcome to SO. When you say 'will not run' what exactly occurs? Is it a error displayed or a result you did not expect. These kind of details can speed up answers as they get to the point quicker. – miltonb Feb 17 '17 at 02:04
  • Include the error message you got, or the output you desire when you run this code. That will help us in looking through your code. – BusyProgrammer Feb 17 '17 at 02:12

0 Answers0