home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ZSYS
/
SIMTEL20
/
SYSLIB
/
SLIB1.LBR
/
SCATH.Z80
< prev
next >
Wrap
Text File
|
2000-06-30
|
640b
|
31 lines
;
; SYSLIB Module Name: SCATH
; Author: Richard Conn
; SYSLIB Version Number: 3.6
; Module Version Number: 1.1
public cath
; CATH -- CONVERT ASCII TO HEX
; This routine converts the ASCII Hexadecimal char (0-9,A-F)
; in A to the corresponding binary value in A.
;
; On return, A=hex value if no error; if error, A=20H (<SP>).
;
CATH:
SUB '0' ; CONVERT 0-9
JP C,ERROR ; INVALID CHAR
CP 10 ; 0-9?
RET C
SUB 7 ; CONVERT A-F
CP 10
JP C,ERROR
CP 16 ; A-F?
JP NC,ERROR
RET
ERROR: LD A,' ' ; ERROR CHAR
RET
END