?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. #ifndef included_TItox
  2. #define included_TItox
  3. #include "pushpop.z80"
  4. #include "strtox.z80"
  5.  
  6. TItox:
  7. ;;converts a TI-float to a single precision float.
  8.   call pushpop
  9.   push bc
  10.  
  11. ;Save the sign and exponent
  12.   ld a,(hl)
  13.   inc hl
  14.   ld c,(hl)
  15.   push af
  16.   ld b,0
  17.   ld a,c
  18.   sub $7F
  19.   ld c,a
  20.   jr nc,+_
  21.   dec b
  22. _:
  23.   push bc
  24.  
  25. ;Convert 7 bytes of the mantissa (BCD) to an 8-bit integer on [0,99].
  26. ;TI's is big-endian and we want little endian copied to scrap
  27.   ld de,xOP1+9
  28.   ld b,7
  29. _:
  30.   inc hl
  31.   ld a,(hl)
  32.   and $F0
  33.   rra
  34.   ld c,a
  35.   rra
  36.   rra
  37.   sub c
  38.   add a,(hl)
  39.   ld (de),a
  40.   dec de
  41.   djnz -_
  42.  
  43. ;Load the next 3 bytes with zeros
  44.   xor a
  45.   ld (de),a
  46.   dec de
  47.   ld (de),a
  48.   dec de
  49.   ld (de),a
  50.   pop bc
  51.  
  52. ;Pass off to the strtox routine
  53.   jp TItox_stepin
  54. #endif
  55.