File: entry.S

package info (click to toggle)
aranym 0.9.4beta2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 7,468 kB
  • ctags: 15,193
  • sloc: cpp: 69,881; ansic: 28,236; sh: 3,470; asm: 1,818; makefile: 706; perl: 492; objc: 225
file content (310 lines) | stat: -rw-r--r-- 5,562 bytes parent folder | download | duplicates (9)
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
/*
	NatFeat host CD-ROM access, MetaDOS BOS driver entry points

	ARAnyM (C) 2003 Patrice Mandin

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

	.text

	.globl	_asm_init_devices, _init_devices

	.globl	_asm_cd_open, _cd_open
	.globl	_asm_cd_close, _cd_close
	.globl	_asm_cd_read, _cd_read
	.globl	_asm_cd_write, _cd_write
	.globl	_asm_cd_seek, _cd_seek
	.globl	_asm_cd_status, _cd_status
	.globl	_asm_cd_ioctl, _cd_ioctl

	.globl	_asm_cd_startaudio, _cd_startaudio
	.globl	_asm_cd_stopaudio, _cd_stopaudio
	.globl	_asm_cd_setsongtime, _cd_setsongtime
	.globl	_asm_cd_gettoc, _cd_gettoc
	.globl	_asm_cd_discinfo, _cd_discinfo

/*--- Function to create a bos header ---*/

_asm_init_devices:
/*
	Input:
		d0.w	physical drive letter
		d1.w	dma channel

	Forward:
		0(sp)	physical drive letter
		4(sp)	dma channel
*/

	andl	#0xffff,d1
	movl	d1,sp@-
	andl	#0xffff,d0
	movl	d0,sp@-
	bsr		_init_devices
	addql	#8,sp
	rts

/*--- MetaDOS BOS functions frontends ---*/

_asm_cd_open:
/*
	Input:
		a0		metados_bosheader_t *device
		0(sp)	return address
		4(sp)	metaopen_t *metaopen

	Forward:
		0(sp)	metados_bosheader_t *device
		4(sp)	metaopen_t *metaopen
*/	
	movl	sp,a1
	movl	4(a1),sp@-
	movl	a0,sp@-	
	bsr		_cd_open
	addql	#8,sp
	rts

_asm_cd_close:
/*
	Input:
		a0		metados_bosheader_t *device
		0(sp)	return address

	Forward:
		0(sp)	metados_bosheader_t *device
*/	
	movl	a0,sp@-	
	bsr		_cd_close
	addql	#4,sp
	rts
	
_asm_cd_read:
/*
	Input:
		a0		metados_bosheader_t *device
		0(sp)	return address
		4(sp)	void *buffer;
		8(sp)	unsigned long first
		12(sp)	unsigned short length

	Forward:
		0(sp)	metados_bosheader_t *device
		4(sp)	void *buffer;
		8(sp)	unsigned long first
		12(sp)	unsigned long length
*/	
	movl	sp,a1
	clrl	d0
	movw	12(a1),d0
	movl	d0,sp@-
	movl	8(a1),sp@-
	movl	4(a1),sp@-
	movl	a0,sp@-	
	bsr		_cd_read
	lea		sp@(16),sp
	rts

_asm_cd_write:
/*
	Input:
		a0		metados_bosheader_t *device
		0(sp)	return address
		4(sp)	void *buffer;
		8(sp)	unsigned long first
		12(sp)	unsigned short length

	Forward:
		0(sp)	metados_bosheader_t *device
		4(sp)	void *buffer;
		8(sp)	unsigned long first
		12(sp)	unsigned long length
*/	
	movl	sp,a1
	clrl	d0
	movw	12(a1),d0
	movl	d0,sp@-
	movl	8(a1),sp@-
	movl	4(a1),sp@-
	movl	a0,sp@-	
	bsr		_cd_write
	lea		sp@(16),sp
	rts

_asm_cd_seek:
/*
	Input:
		a0		metados_bosheader_t *device
		0(sp)	return address
		4(sp)	unsigned long offset

	Forward:
		0(sp)	metados_bosheader_t *device
		4(sp)	unsigned long offset
*/	
	movl	sp,a1
	movl	4(a1),sp@-
	movl	a0,sp@-	
	bsr		_cd_seek
	addql	#8,sp
	rts

_asm_cd_status:
/*
	Input:
		a0		metados_bosheader_t *device
		0(sp)	return address
		4(sp)	metados_bosstatus_t *extended_status;

	Forward:
		0(sp)	metados_bosheader_t *device
		4(sp)	metados_bosstatus_t *extended_status;
*/	
	movl	sp,a1
	movl	4(a1),sp@-
	movl	a0,sp@-	
	bsr		_cd_status
	addql	#8,sp
	rts

_asm_cd_ioctl:
/*
	Input:
		a0		metados_bosheader_t *device
		0(sp)	return address
		4(sp)	unsigned long magic
		8(sp)	unsigned short opcode
		10(sp)	void *buffer;

	Forward:
		0(sp)	metados_bosheader_t *device
		4(sp)	unsigned long magic
		8(sp)	unsigned long opcode
		12(sp)	void *buffer;
*/	
	movl	sp,a1
	movl	10(a1),sp@-
	clrl	d0
	movw	8(a1),d0
	movl	d0,sp@-	
	movl	4(a1),sp@-
	movl	a0,sp@-	
	bsr		_cd_ioctl
	lea		sp@(16),sp
	rts

_asm_cd_startaudio:
/*
	Input:
		a0		metados_bosheader_t *device
		0(sp)	return address
		4(sp)	unknown parameter
		6(sp)	unsigned char *tracks

	Forward:
		0(sp)	metados_bosheader_t *device
		4(sp)	unknown parameter
		8(sp)	unsigned char *tracks
*/	
	movl	sp,a1
	movl	6(a1),sp@-
	clrl	d0
	movw	4(a1),d0
	movl	d0,sp@-
	movl	a0,sp@-	
	bsr		_cd_startaudio
	lea		sp@(12),sp
	rts

_asm_cd_stopaudio:
/*
	Input:
		a0		metados_bosheader_t *device
		0(sp)	return address

	Forward:
		0(sp)	metados_bosheader_t *device
*/	
	movl	a0,sp@-	
	bsr		_cd_stopaudio
	addql	#4,sp
	rts

_asm_cd_setsongtime:
/*
	Input:
		a0		metados_bosheader_t *device
		0(sp)	return address
		4(sp)	unknown parameter
		6(sp)	start_msf
		10(sp)	end_msf

	Forward:
		0(sp)	metados_bosheader_t *device
		4(sp)	unknown parameter
		8(sp)	start_msf
		12(sp)	end_msf
*/	
	movl	sp,a1
	movl	10(a1),sp@-
	movl	6(a1),sp@-
	clrl	d0
	movw	4(a1),d0
	movl	d0,sp@-
	movl	a0,sp@-	
	bsr		_cd_setsongtime
	lea		sp@(16),sp
	rts

_asm_cd_gettoc:
/*
	Input:
		a0		metados_bosheader_t *device
		0(sp)	return address
		4(sp)	dummy
		6(sp)	toc_header_t *toc_header

	Forward:
		0(sp)	metados_bosheader_t *device
		4(sp)	dummy
		8(sp)	toc_header_t *toc_header
*/	
	movl	sp,a1
	movl	6(a1),sp@-
	clrl	d0
	movw	4(a1),d0
	movl	d0,sp@-
	movl	a0,sp@-	
	bsr		_cd_gettoc
	lea		sp@(12),sp
	rts

_asm_cd_discinfo:
/*
	Input:
		a0		metados_bosheader_t *device
		0(sp)	return address
		4(sp)	metados_bosdiscinfo_t *discinfo

	Forward:
		0(sp)	metados_bosheader_t *device
		4(sp)	metados_bosdiscinfo_t *discinfo
*/	
	movl	sp,a1
	movl	4(a1),sp@-
	movl	a0,sp@-	
	bsr		_cd_discinfo
	addql	#8,sp
	rts