Advertisement
Zeda

TokensToASCII

Jan 4th, 2012
510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;===============================================================
  2. TokensToASCII:
  3. ;===============================================================
  4. ;Input:
  5. ;    HL points to the start of the string
  6. ;    DE points to where to output the ACII
  7. ;Outputs:
  8. ;     A is the value of the ending byte of the string
  9. ;    BC is the size of the string
  10. ;    DE is not changed
  11. ;    HL points to the ending byte of the string
  12. ;     z flag is set
  13. ;===============================================================
  14.         ld bc,0
  15.         push de
  16. TextConvert:
  17.           ld a,(hl)
  18.           cp 4
  19.           jr z,TextConvertEnd
  20.           cp 3Fh
  21.           jr z,TextConvertEnd
  22.           cp 2Ah
  23.           jr z,TextConvertEnd
  24.           push hl
  25.           push bc
  26.           push de
  27.           bcall(4594h)
  28.           pop de
  29.           pop hl
  30.           add hl,bc
  31.           push hl
  32.           ld hl,848Eh
  33.           ldir
  34.           pop bc
  35.           pop hl
  36.           ld a,(hl)
  37.           call Is_2_Byte       ;see http://pastebin.com/Y4sdjN9h
  38.           jr nz,$+3
  39.             inc hl
  40.           inc hl
  41.           cp 2Ah
  42.           jr nz,TextConvert
  43. TextConvertEnd:
  44.           inc hl
  45.           pop de
  46.           ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement