Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BC_Div_DE:
- ;756 t-states worst case for old version
- ;227 bytes
- ld a,b \ or a \ jp z,C_Div_DE
- ;If D>0, then the first iteration will yield carry=B, acc=0
- ld hl,0
- inc d \ dec d
- jr z,BC_Div_E
- ld l,b \ ld b,h
- ld a,c
- jp sub0
- BC_Div_E:
- xor a
- rl b \ rla \ sub e \ jr nc,$+3 \ add a,e
- rl b \ rla \ sub e \ jr nc,$+3 \ add a,e
- rl b \ rla \ sub e \ jr nc,$+3 \ add a,e
- rl b \ rla \ sub e \ jr nc,$+3 \ add a,e
- rl b \ rla \ sub e \ jr nc,$+3 \ add a,e
- rl b \ rla \ sub e \ jr nc,$+3 \ add a,e
- rl b \ rla \ sub e \ jr nc,$+3 \ add a,e
- rl b \ rla \ sub e \ jr nc,$+3 \ add a,e
- ld d,a
- ld a,b \ rla \ cpl \ ld b,a
- ld a,d
- bit 7,e \ jr z,C_Div_E
- ld l,a
- ld d,h
- ld a,c
- sub0:
- rla \ adc hl,hl \ sbc hl,de \ jr nc,$+3 \ add hl,de
- rla \ adc hl,hl \ sbc hl,de \ jr nc,$+3 \ add hl,de
- rla \ adc hl,hl \ sbc hl,de \ jr nc,$+3 \ add hl,de
- rla \ adc hl,hl \ sbc hl,de \ jr nc,$+3 \ add hl,de
- rla \ adc hl,hl \ sbc hl,de \ jr nc,$+3 \ add hl,de
- rla \ adc hl,hl \ sbc hl,de \ jr nc,$+3 \ add hl,de
- rla \ adc hl,hl \ sbc hl,de \ jr nc,$+3 \ add hl,de
- rla \ adc hl,hl \ sbc hl,de \ jr nc,$+3 \ add hl,de
- rla \ cpl \ ld c,a
- ret
- C_Div_DE:
- ld a,c \ or a \ ret z
- inc d \ dec d \ jr z,$+4 \ ld c,b \ ret
- xor a
- C_Div_E:
- rl c \ rla \ sub e \ jr nc,$+3 \ add a,e
- rl c \ rla \ sub e \ jr nc,$+3 \ add a,e
- rl c \ rla \ sub e \ jr nc,$+3 \ add a,e
- rl c \ rla \ sub e \ jr nc,$+3 \ add a,e
- rl c \ rla \ sub e \ jr nc,$+3 \ add a,e
- rl c \ rla \ sub e \ jr nc,$+3 \ add a,e
- rl c \ rla \ sub e \ jr nc,$+3 \ add a,e
- rl c \ rla \ sub e \ jr nc,$+3 \ add a,e
- ld a,c \ rla \ cpl \ ld c,a
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement