-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmul10Single.z80
64 lines (64 loc) · 1.13 KB
/
mul10Single.z80
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
#ifndef included_mul10Single
#define included_mul10Single
;#include "pushpop.z80"
mul10Single:
;Multiplies a single precision float by 10
push af
push hl
push de
push bc
ld c,(hl) \ inc hl
ld b,(hl) \ inc hl
ld e,(hl) \ inc hl
ld a,(hl)
push de
or 80h
rra \ rr e \ rr b \ rr c
srl a \ rr e \ rr b \ rr c
dec hl \ dec hl \ dec hl
ld d,a
ld a,(hl) \ adc a,c \ ld c,a \ inc hl
ld a,(hl) \ adc a,b \ ld c,a \ inc hl
ld a,(hl) \ adc a,e \ ld c,a \ inc hl
ld a,(hl) \ set 7,a \ adc a,d \ inc hl
jr nc,$+10
rra \ rr e \ rr b \ rr c \ scf
add a,a
ld d,a
ld a,(hl) \ adc a,3 \ jr c,mul10_overflow
ld (hl),a
ld l,a
pop af
add a,a
rr d
ld a,l
pop hl
push hl
ld (hl),c \ inc hl
ld (hl),b \ inc hl
ld (hl),e \ inc hl
ld (hl),d \ inc hl
ld (hl),a
pop bc
pop de
pop hl
pop af
ret
mul10_overflow:
xor a
pop de
pop hl
ld b,h
ld c,l
ld (hl),a \ inc hl
ld (hl),a \ inc hl
rl d
or 80h
rra
ld (hl),a \ inc hl
ld(hl),-1
pop de
pop hl
pop af
ret
#endif