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.
.orig x3000
and r0,r0,#0 ; clear all registers
and r1,r1,#0
and r2,r2,#0
and r3,r3,#0
and r4,r4,#0
and r5,r5,#0
and r6,r6,#0
ld r3,hex ; point to the character string
loop ldr r0,r3,#0 ; load the character
add r1,r0,#1
brz end ; see if we have xFFFF (means done)
trap x21 ; print the character
add r3,r3,#1 ; increment the address pointer
brnzp loop
end trap x25
hex .fill x4000
.end
If anyone can help even in the least I would really appreciate it.
Thanks for your time in looking at this,
Aaron