Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / x68k / stand / libdos / dos.h
blobc063b515f3152a54ec83fa5f660060987862266f
1 /*
2 * dos.h
3 * Human68k DOS call interface
5 * written by Yasha (ITOH Yasufumi)
6 * (based on PD libc 1.1.32 by PROJECT C Library)
7 * public domain
9 * $NetBSD: dos.h,v 1.6 2009/03/14 14:46:07 dsl Exp $
12 * PROJECT C Library, X68000 PROGRAMMING INTERFACE DEFINITION
13 * --------------------------------------------------------------------
14 * This file is written by the Project C Library Group, and completely
15 * in public domain. You can freely use, copy, modify, and redistribute
16 * the whole contents, without this notice.
17 * --------------------------------------------------------------------
18 * Id: dos.h,v 1.6 1994/07/27 13:44:11 mura Exp
19 * Id: dos_p.h,v 1.3 1993/10/06 16:46:07 mura Exp
22 #ifndef __X68K_DOS_H__
23 #define __X68K_DOS_H__
25 #include <sys/cdefs.h>
27 typedef int dos_mode_t;
29 struct dos_inpptr {
30 unsigned char max;
31 unsigned char length;
32 char buffer[256];
35 struct dos_nameckbuf {
36 char drive[2];
37 char path[65];
38 char name[19];
39 char ext[5];
42 union dos_fcb {
43 struct {
44 unsigned char dupcnt;
45 unsigned char devattr;
46 void *deventry;
47 char nouse_1[8];
48 unsigned char openmode;
49 char nouse_2[21];
50 char name1[8];
51 char ext[3];
52 char nouse_3;
53 char name2[10];
54 char nouse_4[38];
55 } __attribute__((__packed__)) chr;
56 struct {
57 unsigned char dupcnt;
58 unsigned mode : 1;
59 unsigned unknown : 2;
60 unsigned physdrv : 5;
61 void *deventry;
62 unsigned int fileptr;
63 unsigned int exclptr;
64 unsigned char openmode;
65 unsigned char entryidx;
66 unsigned char clustidx;
67 char nouse_2;
68 unsigned short acluster;
69 unsigned int asector;
70 void *iobuf;
71 unsigned long dirsec;
72 unsigned int fptrmax;
73 char name1[8];
74 char ext[3];
75 unsigned char attr;
76 char name2[10];
77 unsigned short time;
78 unsigned short date;
79 unsigned short fatno;
80 unsigned long size;
81 char nouse_4[28];
82 } __attribute__((__packed__)) blk;
85 struct dos_indos {
86 unsigned short indosf;
87 unsigned char doscmd;
88 unsigned char fat_flg;
89 unsigned short retry_count;
90 unsigned short retry_time;
91 unsigned short verifyf;
92 unsigned char breakf;
93 unsigned char ctrlpf;
94 unsigned char reserved;
95 unsigned char wkcurdrv;
98 struct dos_mep {
99 void *prev_mp;
100 void *parent_mp;
101 void *block_end;
102 void *next_mp;
105 struct dos_psp {
106 char *env;
107 void *exit;
108 void *ctrlc;
109 void *errexit;
110 char *comline;
111 unsigned char handle[12];
112 void *bss;
113 void *heap;
114 void *stack;
115 void *usp;
116 void *ssp;
117 unsigned short sr;
118 unsigned short abort_sr;
119 void *abort_ssp;
120 void *trap10;
121 void *trap11;
122 void *trap12;
123 void *trap13;
124 void *trap14;
125 unsigned int osflg;
126 unsigned char reserve_1[28];
127 char exe_path[68];
128 char exe_name[24];
129 char reserve_2[36];
132 struct dos_comline {
133 unsigned char len;
134 char buffer[255];
137 struct dos_namestbuf {
138 unsigned char flg;
139 unsigned char drive;
140 char path[65];
141 char name1[8];
142 char ext[3];
143 char name2[10];
146 struct dos_freeinf {
147 unsigned short free;
148 unsigned short max;
149 unsigned short sec;
150 unsigned short byte;
153 struct dos_dpbptr {
154 unsigned char drive;
155 unsigned char unit;
156 unsigned short byte;
157 unsigned char sec;
158 unsigned char shift;
159 unsigned short fatsec;
160 unsigned char fatcount;
161 unsigned char fatlen;
162 unsigned short dircount;
163 unsigned short datasec;
164 unsigned short maxfat;
165 unsigned short dirsec;
166 int driver;
167 unsigned char ide;
168 unsigned char flg;
169 struct dos_dpbptr *next;
170 unsigned short dirfat;
171 char dirbuf[64];
172 } __attribute__((__packed__));
174 struct dos_filbuf {
175 unsigned char searchatr;
176 unsigned char driveno;
177 unsigned long dirsec;
178 unsigned short dirlft;
179 unsigned short dirpos;
180 char filename[8];
181 char ext[3];
182 unsigned char atr;
183 unsigned short time;
184 unsigned short date;
185 unsigned int filelen;
186 char name[23];
187 } __attribute__((__packed__));
189 struct dos_exfilbuf {
190 unsigned char searchatr;
191 unsigned char driveno;
192 unsigned long dirsec;
193 unsigned short dirlft;
194 unsigned short dirpos;
195 char filename[8];
196 char ext[3];
197 unsigned char atr;
198 unsigned short time;
199 unsigned short date;
200 unsigned int filelen;
201 char name[23];
202 char drive[2];
203 char path[65];
204 char unused[21];
205 } __attribute__((__packed__));
207 struct dos_dregs {
208 int d0;
209 int d1;
210 int d2;
211 int d3;
212 int d4;
213 int d5;
214 int d6;
215 int d7;
216 int a0;
217 int a1;
218 int a2;
219 int a3;
220 int a4;
221 int a5;
222 int a6;
225 struct dos_prcctrl {
226 long length;
227 unsigned char *buf_ptr;
228 unsigned short command;
229 unsigned short your_id;
232 struct dos_prcptr {
233 struct dos_prcptr *next_ptr;
234 unsigned char wait_flg;
235 unsigned char counter;
236 unsigned char max_counter;
237 unsigned char doscmd;
238 unsigned int psp_id;
239 unsigned int usp_reg;
240 unsigned int d_reg[8];
241 unsigned int a_reg[7];
242 unsigned short sr_reg;
243 unsigned int pc_reg;
244 unsigned int ssp_reg;
245 unsigned short indosf;
246 unsigned int indosp;
247 struct dos_prcctrl *buf_ptr;
248 unsigned char name[16];
249 long wait_time;
250 } __attribute__((__packed__));
253 * arguments:
254 * l 32bit arg -> 32bit DOS arg
255 * w 32bit arg -> lower 16bit DOS arg
256 * lb31 32bit arg -> 32bit (arg | 0x80000000) DOS arg
257 * wb8 32bit arg -> 16bit (arg | 0x100) DOS arg
258 * wb15 32bit arg -> 16bit (arg | 0x8000) DOS arg
259 * (num).l (no C arg)-> 32bit (num) DOS arg
260 * (num).w (no C arg)-> 16bit (num) DOS arg
261 * drvctrl special arg for DOS_DRVCTRL
262 * super special arg for DOS_SUPER
263 * opts:
264 * e d0 < 0 is an error code
265 * estrct d0 > 0xffffff00 (unsigned) is an error code
266 * ealloc error handling of memory allocation
267 * ep error handling of process operation
268 * sv save and restore d2-d7/a2-a6
269 * noret the DOS call never returns
270 * alias NAME specify another entry name
271 * super special for DOS_SUPER
272 * super_jsr special for DOS_SUPER_JSR
275 /* ff00 ; noret */ __dead void DOS_EXIT (void);
276 /* ff01 */ int DOS_GETCHAR (void);
277 /* ff02 w */ void DOS_PUTCHAR (int);
278 /* ff03 */ int DOS_COMINP (void);
279 /* ff04 w */ void DOS_COMOUT (int);
280 /* ff05 w */ void DOS_PRNOUT (int);
281 /* ff06 w */ int DOS_INPOUT (int);
282 /* ff07 */ int DOS_INKEY (void);
283 /* ff08 */ int DOS_GETC (void);
284 /* ff09 l */ void DOS_PRINT (const char *);
285 /* ff0a l */ int DOS_GETS (struct dos_inpptr *);
286 /* ff0b */ int DOS_KEYSNS (void);
287 /* ff0c 1.w */ int DOS_KFLUSHGP (void);
288 /* ff0c 6.w w */ int DOS_KFLUSHIO (int);
289 /* ff0c 7.w */ int DOS_KFLUSHIN (void);
290 /* ff0c 8.w */ int DOS_KFLUSHGC (void);
291 /* ff0c 10.w l */ int DOS_KFLUSHGS (struct dos_inpptr *);
292 /* ff0d */ void DOS_FFLUSH (void);
293 /* ff0e w */ int DOS_CHGDRV (int);
294 /* ff0f drvctrl */ int DOS_DRVCTRL (int, int);
295 /* ff10 */ int DOS_CONSNS (void);
296 /* ff11 */ int DOS_PRNSNS (void);
297 /* ff12 */ int DOS_CINSNS (void);
298 /* ff13 */ int DOS_COUTSNS (void);
299 /* ff17 l l ; e */ int DOS_FATCHK (const char *, unsigned short *);
300 /* ff17 l lb31 w ; e */ int DOS_FATCHK2 (const char *, unsigned short *, int);
301 /* ff18 0.w */ int DOS_HENDSPMO (void);
302 /* ff18 1.w w l */ int DOS_HENDSPMP (int, const char *);
303 /* ff18 2.w w l */ int DOS_HENDSPMR (int, const char *);
304 /* ff18 3.w */ void DOS_HENDSPMC (void);
305 /* ff18 4.w */ int DOS_HENDSPIO (void);
306 /* ff18 5.w w l */ int DOS_HENDSPIP (int, const char *);
307 /* ff18 6.w w l */ int DOS_HENDSPIR (int, const char *);
308 /* ff18 7.w w */ void DOS_HENDSPIC (int);
309 /* ff18 8.w */ int DOS_HENDSPSO (void);
310 /* ff18 9.w w l */ int DOS_HENDSPSP (int, const char *);
311 /* ff18 10.w w l */ int DOS_HENDSPSR (int, const char *);
312 /* ff18 11.w */ void DOS_HENDSPSC (void);
313 /* ff19 */ int DOS_CURDRV (void);
314 /* ff1a l */ int DOS_GETSS (struct dos_inpptr *);
315 /* ff1b w */ int DOS_FGETC (int);
316 /* ff1c l w */ int DOS_FGETS (struct dos_inpptr *, int);
317 /* ff1d w w */ void DOS_FPUTC (int, int);
318 /* ff1e l w */ void DOS_FPUTS (const char *, int);
319 /* ff1f */ void DOS_ALLCLOSE (void);
320 /* ff20 super ; super e */ int DOS_SUPER (int);
321 /* ff21 w l ; e */ void DOS_FNCKEYGT (int, char *);
322 /* ff21 wb8 l ; e */ void DOS_FNCKEYST (int, const char *);
323 /* ff23 0.w w */ int DOS_C_PUTC (int);
324 /* ff23 1.w l */ int DOS_C_PRINT (const char *);
325 /* ff23 2.w w */ int DOS_C_COLOR (int);
326 /* ff23 3.w w w */ int DOS_C_LOCATE (int, int);
327 /* ff23 4.w */ int DOS_C_DOWN_S (void);
328 /* ff23 5.w */ int DOS_C_UP_S (void);
329 /* ff23 6.w w */ int DOS_C_UP (int);
330 /* ff23 7.w w */ int DOS_C_DOWN (int);
331 /* ff23 8.w w */ int DOS_C_RIGHT (int);
332 /* ff23 9.w w */ int DOS_C_LEFT (int);
333 /* ff23 10.w 0.w */ int DOS_C_CLS_ED (void);
334 /* ff23 10.w 1.w */ int DOS_C_CLS_ST (void);
335 /* ff23 10.w 2.w */ int DOS_C_CLS_AL (void);
336 /* ff23 11.w 0.w */ int DOS_C_ERA_ED (void);
337 /* ff23 11.w 1.w */ int DOS_C_ERA_ST (void);
338 /* ff23 11.w 2.w */ int DOS_C_ERA_AL (void);
339 /* ff23 12.w w */ int DOS_C_INS (int);
340 /* ff23 13.w w */ int DOS_C_DEL (int);
341 /* ff23 14.w w */ int DOS_C_FNKMOD (int);
342 /* ff23 15.w w w */ int DOS_C_WINDOW (int, int);
343 /* ff23 16.w w */ int DOS_C_WIDTH (int);
344 /* ff23 17.w */ int DOS_C_CURON (void);
345 /* ff23 18.w */ int DOS_C_CUROFF (void);
346 /* ff24 0.w */ int DOS_K_KEYINP (void);
347 /* ff24 1.w */ int DOS_K_KEYSNS (void);
348 /* ff24 2.w */ int DOS_K_SFTSNS (void);
349 /* ff24 3.w w */ int DOS_K_KEYBIT (int);
350 /* ff24 4.w w */ void DOS_K_INSMOD (int);
351 /* ff25 w l */ void *DOS_INTVCS (int, void *);
352 /* ff26 l */ void DOS_PSPSET (struct dos_psp *);
353 /* ff27 */ int DOS_GETTIM2 (void);
354 /* ff28 l ; e */ int DOS_SETTIM2 (int);
355 /* ff29 l l ; e */ int DOS_NAMESTS (const char *, struct dos_namestbuf *);
356 /* ff2a */ int DOS_GETDATE (void);
357 /* ff2b w ; e */ int DOS_SETDATE (int);
358 /* ff2c */ int DOS_GETTIME (void);
359 /* ff2d w ; e */ int DOS_SETTIME (int);
360 /* ff2e w */ void DOS_VERIFY (int);
361 /* ff2f w w ; e */ int DOS_DUP0 (int, int);
362 /* ff30 */ int __pure DOS_VERNUM (void);
363 /* ff31 l w ; noret */ __dead void DOS_KEEPPR (int, int);
364 /* ff32 w l ; e */ int DOS_GETDPB (int, struct dos_dpbptr *);
365 /* ff33 w */ int DOS_BREAKCK (int);
366 /* ff34 w w ; e */ void DOS_DRVXCHG (int, int);
367 /* ff35 w */ void *DOS_INTVCG (int);
368 /* ff36 w l ; estrct */ int DOS_DSKFRE (int, struct dos_freeinf *);
369 /* ff37 l l ; e */ int DOS_NAMECK (const char *, struct dos_nameckbuf *);
370 /* ff39 l ; e */ int DOS_MKDIR (const char *);
371 /* ff3a l ; e */ int DOS_RMDIR (const char *);
372 /* ff3b l ; e */ int DOS_CHDIR (const char *);
373 /* ff3c l w ; e */ int DOS_CREATE (const char *, dos_mode_t);
374 /* ff3d l w ; e */ int DOS_OPEN (const char *, int);
375 /* ff3e w ; e */ int DOS_CLOSE (int);
376 /* ff3f w l l ; e */ int DOS_READ (int, char *, int);
377 /* ff40 w l l ; e */ int DOS_WRITE (int, const char *, int);
378 /* ff41 l ; e */ int DOS_DELETE (const char *);
379 /* ff42 w l w ; e */ long DOS_SEEK (int, int, int);
380 /* ff43 l w ; e */ dos_mode_t DOS_CHMOD (const char *, dos_mode_t);
381 /* ff44 0.w w ; e */ int DOS_IOCTRLGT (int);
382 /* ff44 1.w w w ; e */ int DOS_IOCTRLST (int, int);
383 /* ff44 2.w w l l ; e */ int DOS_IOCTRLRH (int, char *, int);
384 /* ff44 3.w w l l ; e */ int DOS_IOCTRLWH (int, const char *, int);
385 /* ff44 4.w w l l ; e */ int DOS_IOCTRLRD (int, char *, int);
386 /* ff44 5.w w l l ; e */ int DOS_IOCTRLWD (int, const char *, int);
387 /* ff44 6.w w ; e */ int DOS_IOCTRLIS (int);
388 /* ff44 7.w w ; e */ int DOS_IOCTRLOS (int);
389 /* ff44 9.w w ; e */ int DOS_IOCTRLDVGT (int);
390 /* ff44 10.w w ; e */ int DOS_IOCTRLFDGT (int);
391 /* ff44 11.w w w ; e */ int DOS_IOCTRLRTSET (int, int);
392 /* ff44 12.w w w l ; e */ int DOS_IOCTRLDVCTL (int, int, char *);
393 /* ff44 13.w w w l ; e */ int DOS_IOCTRLFDCTL (int, int, char *);
394 /* ff45 w ; e */ int DOS_DUP (int);
395 /* ff46 w w ; e */ int DOS_DUP2 (int, int);
396 /* ff47 w l ; e */ int DOS_CURDIR (int, char *);
397 /* ff48 l ; ealloc */ void *DOS_MALLOC (int);
398 /* ff49 l ; e */ int DOS_MFREE (void *);
399 /* ff4a l l ; ealloc */ int DOS_SETBLOCK (void *, int);
400 /* ff4b 0.w l l l ; sv e */ int DOS_LOADEXEC (const char *, const struct dos_comline *, const char *);
401 /* ff4b 1.w l l l ; sv e */ int DOS_LOAD (const char *, const struct dos_comline *, const char *);
402 /* ff4b 2.w l l l ; e */ int DOS_PATHCHK (const char *, const struct dos_comline *, const char *);
403 /* ff4b 3.w l l l ; e */ int DOS_LOADONLY (const char *, const void *, const void *);
404 /* ff4b 4.w l ; sv e */ int DOS_EXECONLY (void *);
405 /* ff4b 5.w l l 0.l ; sv e */ int DOS_BINDNO (const char *, const char *);
406 /*^ 0.l is required?? */
407 /* ff4b w l l l ; sv e */ int DOS_EXEC2 (int, const char *, const char *, const char *);
408 /* ff4c w ; noret */ __dead void DOS_EXIT2 (int);
409 /* ff4d */ int DOS_WAIT (void);
410 /* ff4e l l w ; e */ int DOS_FILES (struct dos_filbuf *, const char *, int);
411 /* ff4e lb31 l w ; e */ int DOS_EXFILES (struct dos_exfilbuf *, const char *, int);
412 /* ff4f l ; e */ int DOS_NFILES (struct dos_filbuf *);
413 /* ff4f lb31 ; e */ int DOS_EXNFILES (struct dos_exfilbuf *);
414 /* ff80 l */ struct dos_psp *DOS_SETPDB (struct dos_psp *);
415 /* ff81 */ struct dos_psp *DOS_GETPDB (void);
416 /* ff82 l l l ; e */ int DOS_SETENV (const char *, const char *, const char *);
417 /* ff83 l l l ; e */ int DOS_GETENV (const char *, const char *, char *);
418 /* ff84 */ int DOS_VERIFYG (void);
419 /* ff85 0.w l ; e */ int DOS_COMMON_CK (const char *);
420 /* ff85 1.w l l l l ; e */ int DOS_COMMON_RD (const char *, int, char *, int);
421 /* ff85 2.w l l l l ; e */ int DOS_COMMON_WT (const char *, int, const char *, int);
422 /* ff85 3.w l l l l ; e */ int DOS_COMMON_LK (const char *, int, int, int);
423 /* ff85 4.w l l l l ; e */ int DOS_COMMON_FRE (const char *, int, int, int);
424 /* ff85 5.w l ; e */ int DOS_COMMON_DEL (const char *);
425 /* ff86 l l ; e */ int DOS_MOVE (const char *, const char *);
426 int DOS_RENAME (const char *, const char *);
427 /* ff87 w l ; estrct */ int DOS_FILEDATE (int, int);
428 /* ff88 w l ; ealloc */ void *DOS_MALLOC2 (int, int);
429 /* ff88 wb15 l l ; ealloc */ void *DOS_MALLOC0 (int, int, int);
430 /* ff8a l w ; e */ int DOS_MAKETMP (const char *, int);
431 /* ff8b l w ; e */ int DOS_NEWFILE (const char *, dos_mode_t);
432 /* ff8c 0.w w l l ; e */ int DOS_LOCK (int, int, int);
433 /* ff8c 1.w w l l ; e */ int DOS_UNLOCK (int, int, int);
434 /* ff8f 0.w l l ; e */ int DOS_GETASSIGN (const char *, char *);
435 /* ff8f 1.w l l w ; e */ int DOS_MAKEASSIGN (const char *, const char *, int);
436 /* ff8f 4.w l ; e */ int DOS_RASSIGN (const char *);
437 /* ffaa w */ int DOS_FFLUSH_SET (int);
438 /* ffab w l ; e */ void *DOS_OS_PATCH (unsigned int, void *);
439 /* ffac w ; e */ union dos_fcb *DOS_GET_FCB_ADR (unsigned int);
440 /* ffad w l ; ealloc */ void *DOS_S_MALLOC (int, int);
441 /* ffad wb15 l l ; ealloc */ void *DOS_S_MALLOC0 (int, int);
442 /* ffae l ; e */ int DOS_S_MFREE (void *);
443 /* ffaf w l l l ; ep */ int DOS_S_PROCESS (int, int, int, int);
444 /* fff0 ; alias DOS_EXITVC noret */ __dead void DOS_RETSHELL (void);
445 __dead void DOS_EXITVC (void);
446 /* fff1 ; noret */ __dead void DOS_CTLABORT (void);
447 /* fff2 ; noret */ __dead void DOS_ERRABORT (void);
448 /* fff3 l w w w */ void DOS_DISKRED (void *, int, int, int);
449 /* fff3 lb31 w l l */ void DOS_DISKRED2 (void *, int, int, int);
450 /* fff4 l w w w */ void DOS_DISKWRT (const void *, int, int, int);
451 /* fff4 lb31 w l l */ void DOS_DISKWRT2 (const void *, int, int, int);
452 /* fff5 */ struct dos_indos *DOS_INDOSFLG (void);
453 /* fff6 l ; super_jsr sv */ void DOS_SUPER_JSR (void (*)(void), struct dos_dregs *, struct dos_dregs *);
454 /* fff7 l l w ; alias DOS_BUS_ERR e */ int DOS_MEMCPY (void *, void *, int);
455 int DOS_BUS_ERR (void *, void *, int);
456 /* fff8 l w l l w l l l ; e */ int DOS_OPEN_PR (const char *, int, int, int, int, int, struct dos_prcctrl *, long);
457 /* fff9 ; e */ int DOS_KILL_PR (void);
458 /* fffa w l ; e */ int DOS_GET_PR (int, struct dos_prcptr *);
459 /* fffb w ; ep */ int DOS_SUSPEND_PR (int);
460 /* fffc l */ int DOS_SLEEP_PR (long);
461 /* fffd w w w l l ; ep */ int DOS_SEND_PR (int, int, int, char *, long);
462 /* fffe */ long DOS_TIME_PR (void);
463 /* ffff */ void DOS_CHANGE_PR (void);
465 #endif /* __X68K_DOS_H__ */