-
Notifications
You must be signed in to change notification settings - Fork 6
/
mult44.a
70 lines (66 loc) · 1.06 KB
/
mult44.a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
; mult44.a
; from 'The Sentinel' for the BBC Micro, http://level7.org.uk/miscellany/the-sentinel-disassembly.txt
;
; 8 bit x 8 bit unsigned multiply, 16 bit result
; Average cycles: 109
; 69 bytes
multiplicand = $02
multiplier = $03
* = $0200
; Multiply multiplier * multiplicand
;
; On Exit:
; A: high byte
; multiplier: low byte
multiply_A_by_byte
lda #0
lsr multiplier
bcc skip_bit_0
clc
adc multiplicand
skip_bit_0
ror
ror multiplier
bcc skip_bit_1
clc
adc multiplicand
skip_bit_1
ror
ror multiplier
bcc skip_bit_2
clc
adc multiplicand
skip_bit_2
ror
ror multiplier
bcc skip_bit_3
clc
adc multiplicand
skip_bit_3
ror
ror multiplier
bcc skip_bit_4
clc
adc multiplicand
skip_bit_4
ror
ror multiplier
bcc skip_bit_5
clc
adc multiplicand
skip_bit_5
ror
ror multiplier
bcc skip_bit_6
clc
adc multiplicand
skip_bit_6
ror
ror multiplier
bcc skip_bit_7
clc
adc multiplicand
skip_bit_7
ror
ror multiplier
rts