3 * Human68k DOS call interface
5 * written by Yasha (ITOH Yasufumi)
6 * (based on PD libc 1.1.32 by PROJECT C Library)
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
;
35 struct dos_nameckbuf
{
45 unsigned char devattr
;
48 unsigned char openmode
;
55 } __attribute__((__packed__
)) chr
;
64 unsigned char openmode
;
65 unsigned char entryidx
;
66 unsigned char clustidx
;
68 unsigned short acluster
;
82 } __attribute__((__packed__
)) blk
;
86 unsigned short indosf
;
88 unsigned char fat_flg
;
89 unsigned short retry_count
;
90 unsigned short retry_time
;
91 unsigned short verifyf
;
94 unsigned char reserved
;
95 unsigned char wkcurdrv
;
111 unsigned char handle
[12];
118 unsigned short abort_sr
;
126 unsigned char reserve_1
[28];
137 struct dos_namestbuf
{
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
;
169 struct dos_dpbptr
*next
;
170 unsigned short dirfat
;
172 } __attribute__((__packed__
));
175 unsigned char searchatr
;
176 unsigned char driveno
;
177 unsigned long dirsec
;
178 unsigned short dirlft
;
179 unsigned short dirpos
;
185 unsigned int filelen
;
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
;
200 unsigned int filelen
;
205 } __attribute__((__packed__
));
227 unsigned char *buf_ptr
;
228 unsigned short command
;
229 unsigned short your_id
;
233 struct dos_prcptr
*next_ptr
;
234 unsigned char wait_flg
;
235 unsigned char counter
;
236 unsigned char max_counter
;
237 unsigned char doscmd
;
239 unsigned int usp_reg
;
240 unsigned int d_reg
[8];
241 unsigned int a_reg
[7];
242 unsigned short sr_reg
;
244 unsigned int ssp_reg
;
245 unsigned short indosf
;
247 struct dos_prcctrl
*buf_ptr
;
248 unsigned char name
[16];
250 } __attribute__((__packed__
));
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
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__ */