Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;===============================================================
- BC_Div_DE:
- ;===============================================================
- ;Performs BC/DE
- ;Speed: 1130+6b cycles
- ;Size: 27 bytes
- ;Inputs:
- ; BC is the numerator
- ; DE is the denominator
- ;Outputs:
- ; BC is the quotient
- ; HL is the remainder
- ; DE is not changed
- ; A is 0
- ; z flag is set
- ; c flag is reset
- ;===============================================================
- ld a,b
- ld hl,0
- ld b,16
- loop:
- rl c
- rla
- adc hl,hl
- sbc hl,de
- jr nc,$+3
- add hl,de
- djnz loop
- rl c
- rla
- cpl
- ld b,a
- ld a,c
- cpl
- ld c,a
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement