Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Optimized from E37's routine
- text_len:
- ;finds the length in pixels the string
- ;inputs:
- ; hl = zero terminated string
- ;returns:
- ; de = length of the string in pixels
- ld bc, 0
- text_len_max:
- ;inputs:
- ; hl = zero terminated string
- ; bc = maximum number of characters (it will stop after hl characters or when 0 is reached, whichever comes first)
- ;returns:
- ; de = length of the string in pixels
- xor a
- ld d,a
- ld e,a
- TextRLoop:
- or (hl)
- ret z
- ; push bc
- push hl
- push de
- call get_sFont_custom ;preserves BC
- xor a
- ld l, (hl)
- ld h, a
- pop de
- add hl, de
- ex de,hl
- pop hl
- ; pop bc
- cpi
- jp pe, TextRLoop
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement