Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;===============================================================
- ConvRStr:
- ;===============================================================
- ;Input:
- ; HL points to the base 10 number or the byte before
- ;Outputs:
- ; A is the byte before the number
- ; BC is the 16-bit value of the number
- ; DE is 10^(number of digits plus one)
- ; HL points to the byte after the number
- ;Size: 38 bytes
- ;Speed: 139d+11w+25[+12 if ending byte is >39h]
- ; d is the number of digits in the number
- ; w is at most the number of digits minus 2
- ; at most 765 cycles
- ;===============================================================
- dec hl
- bit 3,(iy+34)
- jp nz,ConvHexStr
- ld bc,0
- ConvLoop:
- ld a,(hl)
- sub 30h \ ret c
- cp 10 \ ret nc
- inc hl
- ld (progPtr),hl
- ld h,b \ ld l,c
- add hl,hl
- add hl,hl
- add hl,bc
- add hl,hl
- ld b,h
- add a,l
- ld hl,(progPtr)
- ld c,a
- jr nc,ConvLoop
- inc b
- jr ConvLoop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement