-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathtanhSingle.z80
70 lines (68 loc) · 1.04 KB
/
tanhSingle.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
65
66
67
68
69
70
#ifndef included_tanhSingle
#define included_tanhSingle
#include "pushpop.z80"
#include "expSingle.z80"
#include "invSingle.z80"
#include "rsubSingle.z80"
#include "ameanSingle.z80"
#define hyperout scrap+9
#define hyperout2 scrap+13
tanhSingle:
call pushpop
push bc
ld de,hyperout
ldi
ldi
ldi
ld a,(hl)
or a
jr z,tanh_inf
inc a
jr z,tanh_zero
ld (de),a
ld hl,hyperout
ld b,h
ld c,l
call expSingle
ld de,const_1
call ameanSingle
call invSingle
pop bc
jp rsubSingle
tanh_zero:
pop hl
ld b,h
ld c,l
xor a
ld (hl),a \ inc hl
ld (hl),a \ inc hl
ld (hl),a \ inc hl
dec a
ld (hl),a
ret
tanh_inf:
dec hl
ld a,(hl)
add a,a
jp p,tanh_NAN
pop hl
ld b,h
ld c,l
ld a,0
ld (hl),a \ inc hl
ld (hl),a \ inc hl
rra
ld (hl),a \ inc hl
ld (hl),80h
ret
tanh_NAN:
pop hl
ld b,h
ld c,l
xor a
ld (hl),a \ inc hl
ld (hl),a \ inc hl
ld (hl),a \ inc hl
ld (hl),a
ret
#endif