Monday, May 30, 2016

8051 Program - convert base36 value to binary

; Description:
; Convert Base 36 Value In Acc To Hex (i.e. 'H' -> 011h)
;
; Entry Requirements:
; Acc Has Value In Base 36 (0..9, 'A'..'Z' (Case Significant)). Values
; None In Range Will Produce Inpredictable Results.
;
; On Exit:
; Acc Contains 0..35
;
; Affected:
; PSW.CY, PSW.Z, PSW.P, Acc
;
; Stack:
; 2 Bytes, Not Including Space Used By Called Routines
;
; Comments:
; None
;
UTIL_ASC36TOBIN:
cjne a,#'G',loop1 ; If >= 'G', Special
loop1:jnc loop2 ;
call UTIL_HEXTOBIN ; Convert To Binary
ret ; Return To Caller
loop2:clr c ; Clear For SUBB
subb a,#'G'-10h ; Make Binary
ret ; Return To Caller


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



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

List of topics: 8051

No comments:

Post a Comment