-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmult77.a
More file actions
42 lines (39 loc) · 715 Bytes
/
mult77.a
File metadata and controls
42 lines (39 loc) · 715 Bytes
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
; mult77.a
; from 'Instrumentation of a Savonius wind turbine' by Samuel Martin Babb (1979) https://archive.org/details/instrumentationo00babb/page/108/mode/2up
;
; 8 bit x 8 bit unsigned multiply, 16 bit result
; Average cycles: 288.00
; 43 bytes
mul1 = $02 ; multiplier
mul1h = $03 ; temp
mul2 = $04 ; multiplicand
lowmp = $05 ; product (low)
highmp = $06 ; product (high)
* = $0200
mult
lda #0
sta highmp
sta lowmp
sta mul1h
tax
lsr mul2
bcs run
itiso
cpx #7
beq don
inx
asl mul1
rol mul1h
lsr mul2
bcc itiso
run
lda mul1
clc
adc lowmp
sta lowmp
lda mul1h
adc highmp
sta highmp
jmp itiso
don
rts