-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmult35.a
More file actions
39 lines (35 loc) · 731 Bytes
/
mult35.a
File metadata and controls
39 lines (35 loc) · 731 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
; mult35.a
; from 'Atari Roots' by Mark Andrews (1984) p173: https://archive.org/details/ataribooks-atari-roots/page/n173/mode/2up
; also available at https://www.atariarchives.org/roots/chapter_10.php
;
; 8 bit x 8 bit unsigned multiply, 16 bit result
; Average cycles: 188.00
; 20 bytes
mpr = $02
mpd = $03
prodl = $04
; prodh = $05
*=$0200
; ***************************************************************************************
; On Entry:
; mpr: multiplier
; mpd: multiplicand
; On Exit:
; prodl: low byte of product
; A: high byte of product
values
lda #0
sta prodl
ldx #8
loop
lsr mpr
bcc noadd
clc
adc mpd
noadd
ror
ror prodl
dex
bne loop
; sta prodh
rts