Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;===============================================================
- HL_Div_BC:
- ;===============================================================
- ;Performs HL/BC
- ;Speed: 1494 cycles
- ;Size: 23 bytes
- ;Inputs:
- ; HL is the numerator
- ; BC is the denominator
- ;Outputs:
- ; HL is the quotient
- ; DE is the remainder
- ; BC is not changed
- ; A is 0
- ; z flag is set
- ; c flag is reset
- ;===============================================================
- ld a,16
- ld de,0
- Div_Loop_1:
- add hl,hl
- ex de,hl
- adc hl,hl
- or a
- sbc hl,bc
- jr c,$+5
- inc e
- jr $+3
- add hl,bc
- ex de,hl
- dec a
- jr nz,Div_Loop_1
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement