SDK6800 Emulator ! How to divide?

Question: Using the 6800 emulator, write a 6800 assembly program that reads in a single digit in the range from 2 to 9 inclusive from the keyboard and prints that digit n / 2 times, where n is the value of the digit and n / 2 is rounded down. For example, if the user inputs the digit 5, the program prints ‘55’... show more Question:
Using the 6800 emulator, write a 6800 assembly program that reads in a single digit in the range from 2 to 9 inclusive from the keyboard and prints that digit n / 2 times, where n is the value of the digit and n / 2 is rounded down. For example, if the user inputs the digit 5, the program prints ‘55’ because n = 5 / 2 = 2.5,
rounded down is 2.
If the user enters any character not in the range 2 to 9, the program terminates without output.

What I have done:
ldx #$FFFF
wai

ldaa 0,x
staa keyPressed

ldx #$FB00
asra

staa result



.org $50
keyPressed .byte 0
result .byte $FF

.end


Now, I got stuck already because the value of result is not properly divided, I'm using asra to shift what I input with wai
But if I input 5 for example, using the ASCII table I can see that it's hexidecimal value is 35, so what I expect as value for result is supposed to be 17, but instead I get 1A
Why is that?
2 answers 2