jonkey86 0 Newbie Poster

Hey im a new member, bad at programing but atleast i try :cheesy:

This multiply subrutine is part of of a bigger program with menu option, but if you can help me with this i think i can work the rest out. im having trouble displaying the value of the multiplication that is stored in R3, the trap rutine i use is TRAP x21, it displays the ascii value, how do i get the decimal value?

.ORIG x3000
            ST R7,sR7
             ST R0,sR0
             LEA R0,first1
             PUTS
             TRAP x23
             ADD R1,R0,#0 ;copy first number into R1
             ADD R2,R1,#0 ;copy into R2 also
             LEA R0,second1
             PUTS
             AND R0,R0,#0 ;clear R0
             TRAP x23
loop       ADD R3,R3,R0 ;multiplication result stored in R3
             ADD R2,R2,#-1
             BRp loop
             ADD R0,R3,#0
             TRAP x21 ;trap rutine im using to display this result
             LD R0,sR0
             LD R7,sR7 
             HALT
sR7       .FILL  0
sR0       .FILL  0
first1     .stringz "please input first multiplicand.\n"
second1 .stringz "please input the second multiplicand.\n"
             .end

P.S if you can help me get this subrutine to work for 2 digit numbers that would be great.

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.