Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Assembler help please very desperate

Hello to all, I am new to this borad but i am in need of some help. I am new to assembler lang and i am in desperate need of help. I need to write a program to take in 2 digit 99 then add 9+9 them to get 18 or less. I can't figure out how to do the loop
: 77= 7+7=14. Can someone help me. I am using lc3.
: This is what i have but it only works for number smaller than ten . help plz.
:
:
: .ORIG x3050
:
: AND R0, R0 #0 ; CLEAR R0
: AND R1, R1 #0 ; CLEAR R1
: AND R2, R2 #0 ; CLEAR R2
:
:
:
: LD R2, NEG1 ;LOADS ASCII#-48
: OUT ;
:
: LEA R0,MESG ; LOADS ADDRESS OF MESSAGE
: PUTS ; PRINTS OUT MESSAGE
:
: LD R0, CR ; GOES TO NEXT LINE
: OUT ;
:
: IN ;TAKES IN FIRST NUMERAL
: ADD R1,R0,#0 ; ADDS NUMERAL INTO REGISTER
: IN ; TAKES IN SECOND NUMERAL
: ADD R0,R0,R1 ;ADDS BOTH NUMERALS
: ADD R0,R0,R2 ;CONVERTS NUMERAL BACK TO DECIMAL FORMAT
: OUT ;PRINTS OUT NUMERAL
: HALT ; STOPS PROGRAM
:
:
:
: ;************Data/Variable Storage*************
: CR .FILL X00A
: MESG .STRINGZ "Please enter a two-digit decimal number,one at a time "
: NEG1 .FILL #-48
: NEG .FILL #48
:
:
:
:
: .END
:

Sign In or Register to comment.