RSS Forums RSS
Please support our Assembly advertiser: Programming Forums
Views: 3250 | Replies: 0
Reply
Join Date: Apr 2006
Posts: 1
Reputation: jonkey86 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jonkey86 jonkey86 is offline Offline
Newbie Poster

LC3 displaying numbers in registers

  #1  
Apr 27th, 2006
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
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
All times are GMT -4. The time now is 10:34 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC