Assembly Language Problem

Discussion in 'Homework Help' started by Digit0001, Sep 24, 2010.

  1. Digit0001

    Thread Starter Member

    Mar 28, 2010
    89
    0
    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.

    Code ( (Unknown Language)):
    1.  
    2. toDigit
    3.     andb    #$07    ;set to 3 digits
    4.     cmpb    #'1'
    5.     blo        end      ;check if lower
    6.     cmpb    #'9'
    7.     bhi        end      ;check if higher    
    8.     addb    #'0'
    9.     jsr        putch     ;prints out single ASCII char
    10. end
    11.     rts
    12.  
    P.S
     
Loading...