Changes

Jump to: navigation, search

Programming:Integer Division

343 bytes added, 14:20, 21 September 2006
Added 8bit division
 
== 8bit division ==
 
'''Input:''' HL=Value1, C=Value2
 
'''Output:''' L=Value1/Value2, H=Value1 MOD Value2
 
'''Destroyed:''' AF,BC
 
<pre>
LD B,8
Div_Next:
ADD HL,HL
LD A,H
SUB C
JR C,Div_NXTB
LD H,A
INC L
Div_NXTB:
DJNZ Div_Next
RET
</pre>
 
== 16bit division ==
Anonymous user