; Return with 2 HEX digits in [A] from keyboard ; If abort, Carry flag set & ESC is returned in [A] ; All registers unchanged except [A]    (ZILOG)   GETHEX: PUSH BC LD C,RDCON CALL BDOS ;Get a character from keyboard & ECHO CALLUPPER       CP A,ESC JR Z,HEXABORT CP '/' ;check 0-9, A-F JR C,HEXABORT CP 'F'+1 JR NC,HEXABORT CALL ASBIN ;Convert to binary SLA A SLA A SLA A SLA A ;Shift to high nibble LD B,A ;Store it PUSH BC ;Because CP/M destroys BC LD C,RDCON CALL BDOS ;Get a character from keyboard & ECHO POP BC       CALL  UPPER CP A,ESC JR Z,HEXABORT CP '/' ;check 0-9, A-F JR C,HEXABORT CP 'F'+1 JR NC,HEXABORT CALL ASBIN ;Convert to binary OR A,B ;add in the first digit OR A,A ;To return NC POP BC RET ; HEXABORT: SCF ;Set Carry flag LD A,ESC POP BC RET ; ASBIN:SUB 30H ; ASCII TO BINARY CONVERSION ROUTINE CP 0AH RET M SUB 07H RET ; UPPER:CP    A,'a'       RET   C       CP    A,'z'+1       RET   NC       SUB   A,'a'-'A'       RET