Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/29/07 09:06
Read: times


 
#141332 - Solution
Responding to: ???'s previous message
This Routine converts
'0' - '9' en 'A' - 'F' to
00h - 0Fh (Carry = 0)
or carry = 1 if input is inavalid

Have a nice day
Robert
; ********************************************
;DN ASC2HEX
;D  Converteer ASCII teken (0..9 A..F) naar Hex nibble
;D  C=0 OK, C=1 bij ongeldige invoer
; ********************************************
ASC2HEX:  ADD   A,#208   ; '0' - 'F' wordt 00h - 16h
          JNC   ASC2HEX5 ; < '0' is fout
          ADD   A,#246   ; '0' - '9' wordt F6h - FFh
          JC    ASC2HEX2 ; > 3Ah (9+1) verder controleren
          ADD   A,#10    ; F6h - FFh wordt 00h - 09h
ASC2HEX1: CLR   C        ; OK
          RET

ASC2HEX2: ADD   A,#249   ; 'A' - 'F' wordt 00h - 06h
          JNC   ASC2HEX5 ; 3Ah - 40h is fout
          ADD   A,#250   ; 'A' - 'F' wordt FAh - FFh
          JC    ASC2HEX5 ; > 'F' is fout
          ADD   A,#16    ; 'A' - 'F' wordt 0Ah - 0Fh
          JMP   ASC2HEX1 ; en dat is OK

ASC2HEX5: SETB  C        ; Fout C=1
          RET



List of 8 messages in thread
TopicAuthorDate
number in ascii to binary            01/01/70 00:00      
   Not sure if this will help but anyways            01/01/70 00:00      
   Basic method            01/01/70 00:00      
      Needs a bit more error checking            01/01/70 00:00      
         Solution            01/01/70 00:00      
         A Different Solution            01/01/70 00:00      
      I agree            01/01/70 00:00      
   thank you            01/01/70 00:00      

Back to Subject List