Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Bin2BCD8b ;Input: A = 8-bit number. Output: HL = value in BCD. Destroys: A,E,BC
- ld e,a
- ld hl,0
- ld b,8
- BucConvert ld a,l
- call CompareAndSumL
- ld c,a
- ld a,l
- and 0F0h
- or c
- ld l,a
- call CompareAndSumH
- ld c,a
- ld a,l
- and 0Fh
- or c
- ld l,a
- ld a,h
- call CompareAndSumL
- ld h,a
- sla e
- rl l
- rl h
- djnz BucConvert
- ret
- CompareAndSumL and 0Fh
- cp 05h
- ret c
- add a,03h
- ret
- CompareAndSumH and 0F0h
- cp 50h
- ret c
- add a,30h
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement