-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmult76.a
More file actions
36 lines (32 loc) · 850 Bytes
/
mult76.a
File metadata and controls
36 lines (32 loc) · 850 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
; mult76.a
; from 'Microcomputing' Magazine (June 1981) article by Leo Scanlon https://archive.org/details/kilobaudmagazine-1981-06/page/n109/mode/2up
; see also 'Beyond Basic' by Richard Freeman (1983) https://archive.org/details/bbcbb/page/120/mode/2up
; see also 'Microprocessors : essentials, components and systems' by R Meadows (1983) https://archive.org/details/microprocessorse0000mead/page/240/mode/2up
;
; 8 bit x 8 bit unsigned multiply, 16 bit result
; Average cycles: 185.00
; 18 bytes
multiplicand = $02
multiplier = $03
resultlow = $04
; resulthigh = $05
* = $0200
; Multiply multiplier * multiplicand
;
; On Exit:
; (resultlow, resulthigh): product
mult
lda #0
ldx #8
next
lsr multiplier
bcc rot
clc
adc multiplicand
rot
ror
ror resultlow
dex
bne next
; sta resulthigh
rts