Monday, May 30, 2016

8051 Program - validate acc for A..Z, a..z, 0..9

; Description:
; Acc Has Character To Be Validate For A..Z, a..z, 0..9 Range.
;
; Entry Requirements:
; Acc Has Character To Validate As A..Z, a..z, 0..9 Range
;
; On Exit:
; Return CY == 0 If Character In Range, Else Return CY == 1.
;
; Affected:
; PSW.CY
;
; Stack:
; 2 Bytes, Not Including Space Used By Called Routines
;
; Comments:
; None
;
UTIL_VALALPHA:
call UTIL_TOUPPER ; Make Upper Case
cjne a,#'0',loop1 ; If < '0', Return CY == 1
loop1:jc loop8 ;
cjne a,#'9',loop2 ; If <= '9', Return CY == 0
jmp loop7 ;
loop2:jc loop7 ;
cjne a,#'A',loop3 ; If < 'A', Return CY == 1
loop3:jc loop8 ;
cjne a,#'Z',loop4 ; If > 'Z', Return CY == 1
jmp loop5 ;
loop4:jnc loop8 ;
loop5:;
;
loop7:clr c ; CY == 0 Means Good Character
ret ; Return To Caller
;
loop8:setb c ; CY == 1 Means Bad Character
ret ; Return To Caller


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



Related topics:
8051 Program - validate acc for ascii decimal   |   8051 Program - validate acc for ascii hex   |   8051 Program - validate string for A..Z, a..z, 0..9   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment