-
Notifications
You must be signed in to change notification settings - Fork 0
/
aip.s
207 lines (190 loc) · 3.27 KB
/
aip.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
.section .text.aip
.global _text_aip_start
_text_aip_start:
bra label_10
nop
label_4:
.long 0xac010000
label_8:
.long 0x00000000
label_c:
.long 0xac00e100
label_10:
mov.l label_1c,r0 /* ac00e020 */
jsr @r0
nop
label_16:
bra label_16
nop
nop
label_1c:
.long 0xac00e020
/* called from label_10 */
label_20:
mov.l label_40,r2 /* ac00e0dc */
mov.l label_3c,r3 /* a0000000 */
or r3,r2
jsr @r2 /* jump to label_dc */
nop
stc sr,r0
mov.w label_38,r1 /* ff0f */
and r1,r0
or #0xf0,r0 /* set IMASK ; disables interrupts */
ldc r0,sr
bra label_44
nop
label_38:
.word 0xff0f
label_3a:
.word 0x0000
label_3c:
.long 0xa0000000
label_40:
.long 0xac00e0dc
label_44:
mov.l label_4c,r0 /* ac00f400 → new stack address */
mov r0,r15
bra label_50
nop
label_4c:
.long 0xac00f400
label_50:
mov.l label_70,r2 /* ac00e0d0 */
mov.l label_6c,r3 /* a0000000 */
or r3,r2
jsr @r2 /* jump to label_d0 */
nop
label_5a:
mov.l label_78,r3 /* ac00e13c */
mov.l label_74,r4 /* ac00fc00 */
mov.w label_68,r6 /* 400 */
jsr @r3 /* jump to label_13c */
mov #0,r5
bra label_7c
nop
label_68:
.word 0x0400
label_6a:
.word 0x0000
label_6c:
.long 0xa0000000
label_70:
.long 0xac00e0d0 /* label_d0 */
label_74:
.long 0xac00fc00
label_78:
.long 0xac00e13c
label_7c:
mov.l label_c4,r0 /* 700000f0 */
ldc r0,sr
sub r0,r0
mov r0,r1
mov r0,r2
mov r0,r3
mov r0,r4
mov r0,r5
mov r0,r6
mov r0,r7
mov r0,r8
mov r0,r9
mov r0,r10
mov r0,r11
mov r0,r12
mov r0,r13
mov r0,r14
mov.l label_bc,r0 /* 8c00f400 */
mov r0,r15
mov.l label_c8,r0 /* 8c00f400 */
ldc r0,vbr
mov.l label_c0,r0 /* 40000 */
lds r0,fpscr
mov.l label_b8,r0 /* ac00e004 */
mov.l @r0,r0 /* ac010000 */
jsr @r0
mov r1,r0
label_b2:
bra label_b2
nop
nop
label_b8:
.long 0xac00e004 /* label_b4 */
label_bc:
.long 0x8c00f400
label_c0:
.long 0x00040000
label_c4:
.long 0x700000f0
label_c8:
.long 0x8c00f400
/* unreachable label_cc ? */
label_cc:
bra label_cc
nop
/* called from label_50 */
label_d0:
mov.l label_d8,r2 /* ff00001c (CCN.CCR) */
mov #0,r3 /* disable all caches */
rts
mov.l r3,@r2
label_d8:
.long 0xff00001c
/* called from label_20 */
label_dc:
mov.l label_f4,r0 /* ff00001c (CCN.CCR) */
mov.l @r0,r1
mov.l label_f8,r2 /* 89af → mask off undefined bits */
and r2,r1
mov.w label_f0,r2 /* 800 → ICI , instruction cache invalidation */
or r2,r1
mov.l r1,@r0
bra label_fc
nop
nop
label_f0:
.word 0x0800
nop /* unreachable nop? */
label_f4:
.long 0xff00001c
label_f8:
.word 0x89af
label_fa:
.word 0x0000
label_fc:
rts
nop
mov.l label_108,r0 /* 8c0000e0 */
mov.l @r0,r1
jmp @r1
mov #1,r4
label_108:
.long 0x8c0000e0
label_10c:
.long 0xac00e110
.ascii "\nAIP Ver 1.07 Build:Apr 27 1999 14:00:30\n"
.byte 0x00
.byte 0x00
.byte 0x00
/* called from label_5a */
/*
memset(char * dest, char value, unsigned int length)
dest : r4
value : r5
length : r6
[return]: original value of `dest` as r0
*/
label_13c:
mov #0,r7
mov r7,r3
cmp/hs r6,r3 /* r3 ≥ r6 (unsigned) */
/* 0 ≥ 0x400 */
bt/s label_150
mov r4,r0 /* ac00fc00 → r0 */
label_146:
add #1,r7
mov.b r5,@r0 /* 0 → @(ac00fc00) */
cmp/hs r6,r7 /* r7 ≥ 0x400 */
bf/s label_146
add #1,r0
label_150:
rts
mov r4,r0