Monday, May 30, 2016

8051 Program - convert binary to ascii base36

; Description:
; Convert Value In Acc To Base 36 ASCII Character
;
; Entry Requirements:
; Acc Has Value To Convert. Must Be 0..35 (0..23h)
;
; On Exit:
; Base 36 Value In ASCII
;
; Affected:
; PSW.CY, PSW.Z, PSW.P, Acc
;
; Stack:
; 0 Bytes, Not Including Space Used By Called Routines
;
; Comments:
; Opposite Of UTIL_ASC36TOBIN
;
UTIL_BINTOASC36:
cjne a,#10h,loop1 ; If >= 0x10, Special
loop1: jnc loop2 ;
add a,#090h ; Add 144
da a ; Decimal Adjust
addc a,#040h ; Add 64
da a ; Decimal Adjust
ret ; Return To Caller
loop2:add a,#'G'-10h ; Make 'G'..'Z'
ret ; Return To Caller


Source: Assorted Utilities, John C. Wren 11/23/96



Related topics:
8051 Program - convert base36 value to binary   |   8051 Program - convert binary to ascii   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment