Monday, May 30, 2016

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

; Description:
; DPTR Points To An ETX Terminated String In External Memory. Verify
; That Characters In String Are A..Z, a..z, 0..9.
;
; Entry Requirements:
; DPTR Points To An ETX Terminated String To Search
;
; On Exit:
; CY == 0 If No Other Characters, DPTR Points To ETX
; CY == 1 If Non A..Z, a..z, 0..9 Characters, DPTR Points To Bad Character
;
; Affected:
; PSW.CY, DPTR
;
; Stack:
; 3 Bytes, Not Including Space Used By Called Routines
;
; Comments:
; None
;
ETX equ 3 ; ASCII ETX Character
UTIL_VALALPHAZ:
push acc ; Save Acc
loop1:movx a,@dptr ; Get Character
cjne a,#ETX,temp ; Exit Of End Of String (CY=0)
temp:jmp loop2 ;
call UTIL_VALALPHA ; Validate Character
jc loop2 ; If Error, Exit
inc dptr ; Next Character
jmp loop1 ; Continue
loop2:pop acc ; Recover Acc
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 acc 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