Changes

Programming:Integer Multiplication

568 bytes added, 09:04, 26 July 2006
Initial version
== Classic 8bit * 8bit Unsigned ==

'''Input:''' H = ''Multiplier'', E = ''Multiplicand'', L = 0, D = 0

'''Output:''' HL = ''Product''

<pre>
sla h ; optimised 1st iteration
jr nc,$+3
ld l,e

add hl,hl ; unroll 7 times
jr nc,$+3 ; ...
add hl,de ; ...
</pre>


== Classic 16bit * 8bit Unsigned ==

'''Input:''' A = ''Multiplier'', DE = ''Multiplicand'', HL = 0, C = 0

'''Output:''' A:HL = ''Product''

<pre>
add a,a ; optimised 1st iteration
jr nc,$+4
ld h,d
ld l,e

add hl,hl ; unroll 7 times
rla ; ...
jr nc,$+4 ; ...
add hl,de ; ...
adc a,c ; ...
</pre>
1,165
edits