Hi
Can someone tell if my code is correct?
Write an assembly language subroutine for the HCS12 that prints out the byte in accumulator B as two hex digits decimal number. Assume there is a routine putch that print out the single ASCII char in accumulator B.
P.S
Can someone tell if my code is correct?
Write an assembly language subroutine for the HCS12 that prints out the byte in accumulator B as two hex digits decimal number. Assume there is a routine putch that print out the single ASCII char in accumulator B.
Rich (BB code):
toDigit
andb #$07 ;set to 3 digits
cmpb #'1'
blo end ;check if lower
cmpb #'9'
bhi end ;check if higher
addb #'0'
jsr putch ;prints out single ASCII char
end
rts