Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Thread Closed: Question answered in tutorial/FAQs

???
02/03/04 03:27
Read: times


 
#63903 - RE: asci to bin
Responding to: ???'s previous message
Here is another way to convert a binary nibble that has a 0 to 15 value into the corresponding ASCII Hex character 0-9A-F

;***************************************************
;NAME: BIN_ASC
;   Used to convert a binary nibble to ascii hex
;   Entry A is the bin nibble in bits 3-0.
;   Exit A is the ascii hex value
;---------------------------------------------------

BIN_ASC:
        INC  A
        MOVC    A, @A+PC
        RET
;
        DB      '0'       ; 0 (0000B)
        DB      '1'       ; 1 (0001B)
        DB      '2'       ; 2 (0010B) 
        DB      '3'       ; 3 (0011B)
        DB      '4'       ; 4 (0100B)
        DB      '5'       ; 5 (0101B)
        DB      '6'       ; 6 (0110B)
        DB      '7'       ; 7 (0111B)
        DB      '8'       ; 8 (1000B)
        DB      '9'       ; 9 (1001B)
        DB      'A'       ;10 (1010B)
        DB      'B'       ;11 (1011B) 
        DB      'C'       ;12 (1100B) 
        DB      'D'       ;13 (1101B) 
        DB      'E'       ;14 (1110B) 
        DB      'F'       ;15 (1111B) 


Michael Karas


List of 10 messages in thread
TopicAuthorDate
asci to bin            01/01/70 00:00      
   RE: asci to bin            01/01/70 00:00      
      RE: asci to bin            01/01/70 00:00      
   RE: asci to bin            01/01/70 00:00      
      RE: asci to bin            01/01/70 00:00      
         RE: asci to bin            01/01/70 00:00      
         RE: asci to bin            01/01/70 00:00      
   RE: asci to bin            01/01/70 00:00      
      RE: asci to bin            01/01/70 00:00      
   RE: asci to bin            01/01/70 00:00      

Back to Subject List