; If abort, Carry flag set & ESC is returned in [A] ; All registers unchanged except [A]    (INTEL)   GETHEX:       PUSH  B       MVI   C,RDCON       CALL  BDOS        ;Get a character from keyboard & ECHO                 CPI   ESC       JZ    HEXABORT       CPI   '/'         ;check 0-9, A-F       JC    HEXABORT       CPI   '9'+1       JNC   HEXABORT       CALL  ASBIN       ;Convert to binary       RLC               ;Shift to high nibble       RLC       RLC       RLC       MOV   B,A         ;Store it       PUSH  B       MOV   C,RDCON       CALL  BDOS        ;Get 2nd character from keyboard & ECHO       POP   B                 CPI   ESC       JZ    HEXABORT       CPI   '/'         ;check 0-9, A-F       JC    HEXABORT       CPI   '9'+1       JNC   HEXABORT       CALL  ASBIN       ;Convert to binary       ORA   B           ;add in the first digit       ORA   A           ;To return NC       POP   B       RET ; HEXABORT:       STC               ;Set Carry flag       MVI   A,ESC       POP   B       RET ;                       ;Convert LC to UC UPPER:CPI   'a'         ;must be >= lowercase a       RC                ; else go back...       CPI   'z'+1       ;must be <= lowercase z       RNC               ; else go back...       SUI   'a'-'A'           ;subtract lowercase bias       RET ;                       ASBIN:SUI   30H          ;ASCII TO BINARY CONVERSION ROUTINE       CPI   0AH       RM       SUI   07H       RET