< %27
7UGT U /CPWCN
80
7DEOH 0XOWLSO\ /LVWLQJ &RQWLQXHG
2EM
/RF
&RGH
6WPW 6RXUFH 6WDWHPHQW
16
17
0000 0610
18
0002 4a
19
0003 7b
20
0004 eb
21
0005 210000
22
0008 cb39
23
000a if
24
25
000b 3001
26
good 19
27
28
000e eb
29
goof 29
30
0010 eb
31
0011 10f5
32
0013 c9
33
34
;
a
low order bits of multiplier
;
ld
b, 16;
ld
c, d;
ld
a, e;
ex
de, hl;
ld
hl, 0;
mloop: srl
c;
rra
;
jr
nc, noadd-$; if no carry, skip the add.
add
hl, de;
;
noadd: ex
de, h l;
add
hl, hl;
ex
de, hl;
djnz
mloop-$;
ret;
end;
+DUGZDUH DQG 6RIWZDUH ,PSOHPHQWDWLRQ ([DPSOHV
number of bits-initialize
move multiplier
move multiplicand
clear partial result
shift multiplier right
least significant bit is
in carry.
else add multiplicand to
partial result.
shift multiplicand left
by multiplying it by two.
repeat until no more bits.
Need help?
Do you have a question about the Z80 and is the answer not in the manual?
Questions and answers