repo.or.cz
/
urasm.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
renamed all ".inc" files to ".zas" (so egedit will properly highlight them)
[urasm.git]
/
libs
/
muldiv_fast.zas
blob
7d94e6e50bcb0f312335281831c3071c2367f0df
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;; unsigned multiply
3
;; IN:
4
;; DE: num0
5
;; HL: num1
6
;; OUT:
7
;; HL: high part
8
;; DE: low part
9
;; BC: dead
10
;; AF: dead
11
UMul1616_32f:
12
ld bc,hl
13
ld hl,0
14
or a
15
16
rr d
17
rr e
18
jr nc,$+3
19
add hl,bc
20
21
DUP 15
22
rr h
23
rr l
24
rr d
25
rr e
26
jr nc,$+3
27
add hl,bc
28
EDUP
29
30
rr h
31
rr l
32
rr d
33
rr e
34
35
ret
36
37
38
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
39
;; unsigned division
40
;; IN:
41
;; HL: high part
42
;; DE: low part
43
;; BC: divisor
44
;; OUT:
45
;; DE: res
46
;; HL: mod
47
;; BC: not changed
48
;; AF: dead
49
UDiv3216_16f:
50
or a
51
52
DUP 16
53
rl e
54
rl d
55
adc hl,hl
56
sbc hl,bc
57
jr nc,$+3
58
add hl,bc
59
EDUP
60
61
ld a,e
62
rla
63
cpl
64
ld e,a
65
66
ld a,d
67
rla
68
cpl
69
ld d,a
70
71
ret