Hi, I need to write a program in the LC-3 assembly language to convert hex to dec. Here are the exact guidelines:
"Your program begins at x3000. Beginning at x4000 is a list of any length of positive numbers, terminated with a -1. Your program must display each number in the list in its decimal value. The numbers should be displayed as you would normally write them, with leading zeroes suppressed. Then halt." Heres what I have so far, my main problem is the actual conversion.
and r0,r0,#0 ; clear all registers
ld r3,hex ; point to the character string
loop ldr r0,r3,#0 ; load the character
brz end ; see if we have xFFFF (means done)
trap x21 ; print the character
add r3,r3,#1 ; increment the address pointer
end trap x25
hex .fill x4000
If anyone can help even in the least I would really appreciate it.
Thanks for your time in looking at this,