-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfpsptst.s
165 lines (142 loc) · 3.44 KB
/
fpsptst.s
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
.text
/*
* GEMDOS startup code:
* get basepage, calculate program size, and shrink memory
*/
move.l 4(a7),a3
move.l 12(a3),a5
add.l 20(a3),a5
add.l 28(a3),a5
lea 256(a5),a5
/* Setup a stack */
lea stackend.w(pc),a7
/* Free not required memory */
move.l a5,-(a7)
move.l a3,-(a7)
clr.w -(a7)
move.w #0x4a,-(a7)
trap #1
lea.l 12(a7),a7
/* create test output file */
clr.w -(a7)
pea outfname(pc)
move.w #0x3c,-(a7) /* Fcreate */
trap #1
addq.w #8,a7
lea outhandle.w(pc),a0
move.w d0,(a0)
bmi fail
/* run integer tests */
bsr _060ISP_TEST+128+0
/* run floating-point tests */
bsr _060FPSP_TEST+128+0
bsr _060FPSP_TEST+128+8
bsr _060FPSP_TEST+128+16
move.w outhandle.w(pc),-(a7)
move.w #0x3e,-(a7) /* Fclose */
trap #1
addq.w #4,a7
exit:
clr.w -(a7) /* Pterm0 */
trap #1
bra.s exit /* just in case */
fail:
move.w #1,-(a7)
move.w #0x4c,-(a7) /* Pterm */
trap #1
outfname:
.asciz "fpsptst.txt"
crnl:
.dc.b 10,0
.even
/*
* INPUTS:
* 4(a7) - source address
* OUTPUTS:
* none
*/
_print_str:
movem.l d0-d3/a0-a3,-(a7)
move.l 36(a7),a3
_print_str_loop:
clr.w d3
move.b (a3)+,d3
beq.s _print_str_end
cmpi.b #10,d3
bne.s _print_str_nocr
move.w #13,-(a7)
pea 1(a7)
move.l #1,-(a7)
move.w outhandle.w(pc),-(a7)
move.w #0x40,-(a7) /* Fwrite */
trap #1
lea 14(a7),a7
move.w #13,-(a7)
move.w #2,-(a7) /* Cconout */
trap #1
addq.l #4,a7
_print_str_nocr:
move.w d3,-(a7)
pea 1(a7)
move.l #1,-(a7)
move.w outhandle.w(pc),-(a7)
move.w #0x40,-(a7) /* Fwrite */
trap #1
lea 14(a7),a7
move.w d3,-(a7)
move.w #2,-(a7) /* Cconout */
trap #1
addq.l #4,a7
bra.s _print_str_loop
_print_str_end:
movem.l (a7)+,d0-d3/a0-a3
rts
/*
* INPUTS:
* 4(a7) - number to print
* OUTPUTS:
* none
*/
_print_num:
movem.l d0-d2/a0-a2,-(a7)
move.l 28(a7),d0
move.l a7,a1
lea -32(a7),a7
clr.b -(a1)
_print_num_loop:
divul.l #10,d1:d0
add.b #'0',d1
move.b d1,-(a1)
tst.l d0
bne.s _print_num_loop
move.l a1,-(a7)
bsr _print_str
lea 36(a7),a7
movem.l (a7)+,d0-d2/a0-a2
rts
/*
* ################################
* # CALL-OUT SECTION #
* ################################
*/
/* The size of this section MUST be 128 bytes!!! */
_060ISP_TEST:
.dc.l _print_str-_060ISP_TEST
.dc.l _print_num-_060ISP_TEST
.ds.b 120
.include "itest.sa"
/*
* ################################
* # CALL-OUT SECTION #
* ################################
*/
/* The size of this section MUST be 128 bytes!!! */
_060FPSP_TEST:
.dc.l _print_str-_060FPSP_TEST
.dc.l _print_num-_060FPSP_TEST
.ds.b 120
.include "ftest.sa"
.bss
outhandle: ds.w 1
stack: .ds.b 4096
stackend: .ds.l 1