Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Conv_OP1:
- ld hl,8478h
- ConvDecAtHL:
- ;Inputs:
- ; HL points to the FP number to convert
- ;Outputs:
- ; A is the 8-bit result
- ; B is 0
- ; C is the value of the last digit
- ; DE is the 16-bit result
- ; HL is incremented by 9
- ;Destroys:
- ex de,hl
- ld hl,9
- add hl,de
- push hl
- ex de,hl
- ld a,(hl)
- and 80h
- push af
- inc hl
- ld a,(hl)
- sub 80h
- ld de,0
- jr nc,$+17
- ld c,e
- ld b,e
- ConvDone:
- pop af
- jr z,$+9
- ld a,e \ cpl \ ld e,a
- ld a,d \ cpl \ ld d,a
- inc de
- pop hl
- ld a,e
- ret
- ld b,a
- inc b
- inc hl
- ld a,(hl)
- ConvDecLoop:
- rlca
- rlca
- rlca
- rlca
- push hl
- ld h,d
- ld l,e
- add hl,hl
- add hl,hl
- add hl,de
- add hl,hl
- ex de,hl
- pop hl
- and 15
- add a,e
- ld e,a
- jr nc,$+3
- inc d
- dec b
- jr z,ConvDone
- ld a,80h
- xor b
- jr z,ConvDone
- ld b,a
- ld a,(hl)
- jp m,ConvDecLoop+4
- inc hl
- jp ConvDecLoop-1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement