?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. #ifndef included_ascii_to_uint8
  2. #define included_ascii_to_uint8
  3. ascii_to_uint8:
  4. ;c flag means don't increment the exponent
  5.   ld c,0
  6.   ld a,(hl)
  7.   jr c,ascii_to_uint8_noexp
  8.   cp char_DEC
  9.   jr z,ascii_to_uint8_noexp-2
  10. _:
  11.   sub 3Ah
  12.   add a,10
  13.   jr nc,ascii_to_uint8_noexp_end
  14.   inc b
  15.   ld c,a
  16.   add a,a
  17.   add a,a
  18.   add a,c
  19.   add a,a
  20.   ld c,a
  21.   inc hl
  22. _:
  23.   ld a,(hl)
  24.   cp char_DEC
  25.   jr z,ascii_to_uint8_noexp_2nd
  26. _:
  27.   sub 3Ah
  28.   add a,10
  29.   jr nc,ascii_to_uint8_noexp_end
  30.   inc b
  31.   add a,c
  32.   inc hl
  33.   ld (de),a
  34.   dec de
  35.   or a
  36.   ret
  37.  
  38.   inc hl
  39.   ld a,(hl)
  40. ascii_to_uint8_noexp:
  41.   sub 3Ah
  42.   add a,10
  43.   jr nc,ascii_to_uint8_noexp_end
  44.   ld c,a
  45.   add a,a
  46.   add a,a
  47.   add a,c
  48.   add a,a
  49.   ld c,a
  50. ascii_to_uint8_noexp_2nd:
  51.   inc hl
  52.   ld a,(hl)
  53.   sub 3Ah
  54.   add a,10
  55.   jr nc,ascii_to_uint8_noexp_end
  56.   add a,c
  57.   inc hl
  58.   .db $FE   ;start of `cp **`, saves 1cc
  59. ascii_to_uint8_noexp_end:
  60.   ld a,c
  61.   ld (de),a
  62.   dec de
  63.   scf
  64.   ret
  65. #endif
  66.