/*   System inline DOSCALL header 1993 by H.Ogasawara (COR.)	*/

#ifndef	__dos_inline_call__
#define	__dos_inline_call__

/* ff00 */
DOSCALL	volatile void	EXIT(void);
DOSCALL	int		GETCHAR(void);
DOSCALL	void		PUTCHAR(unsigned short);
DOSCALL	int		COMINP(void);
DOSCALL	void		COMOUT(unsigned short);
DOSCALL	void		PRNOUT(unsigned short);
DOSCALL	int		INPOUT(unsigned short);
DOSCALL	int		INKEY(void);
/* ff08 */
DOSCALL	int		GETC(void);
DOSCALL	void		PRINT(const char *);
DOSCALL	int		GETS(char *);
DOSCALL	int		KEYSNS(void);
/*DOSCALL int		KFLUSH(unsigned short,...);*/
DOSCALL	void		FFLUSH(void);
DOSCALL	int		CHGDRV(unsigned short);
DOSCALL	int		DRVCTRL(unsigned short);
/* ff10 */
DOSCALL	int		CONSNS(void);
DOSCALL	int		PRNSNS(void);
DOSCALL	int		CINSNS(void);
DOSCALL	int		COUTSNS(void);
/*DOSCALL 14*/
/*DOSCALL 15*/
/*DOSCALL 16*/
DOSCALL	int		FATCHK(const char *fname, char *buf);
/* ff18 */
/*DOSCALL int		HENDSP(short,...);*/
DOSCALL	int		CURDRV(void);
DOSCALL	int		GETSS(char *);
DOSCALL	int		FGETC(short);
DOSCALL	int		FGETS(char *,short);
DOSCALL	int		FPUTC(short, short);
DOSCALL	int		FPUTS(char *,short);
DOSCALL	void		ALLCLOSE(void);
/* ff20 */
DOSCALL int		SUPER(int);	/* Caution!! */
DOSCALL	void		FNCKEY(unsigned short,char*);
#define	FNCKEYGT(a,b)	FNCKEY(a,b)
#define	FNCKEYST(a,b)	FNCKEY((a)+256,b)
/*DOSCALL int		KNJCTRL(unsigned short,...);*/
/*DOSCALL int		CONCTRL(unsigned short,...);*/

asm( "CONCTRLs	equ	CONCTRL" );
asm( "CONCTRLss	equ	CONCTRL" );
asm( "CONCTRLsss equ	CONCTRL" );
DOSCALL	int		CONCTRLs(unsigned short);
DOSCALL	int		CONCTRLss(unsigned short, unsigned short);
DOSCALL	int	      CONCTRLsss(unsigned short,unsigned short,unsigned short);
#define	C_CLS_AL()	CONCTRLss(10,2)
#define	C_FNKMOD(a)	CONCTRLss(14,a)
#define	C_WINDOW(a,b)	CONCTRLsss(15,a,b)
#define	C_WIDTH(a)	CONCTRLss(16,a)
#define	C_CURON()	CONCTRLs(17)
#define	C_CUROFF()	CONCTRLs(18)

/*DOSCALL int		KEYCTRL(unsigned short,...);*/
asm( "KEYCTRLs	equ	KEYCTRL" );
DOSCALL	int		KEYCTRLs( unsigned short );
#define	K_SFTSNS()	KEYCTRLs(2)

DOSCALL	int		INTVCS(unsigned short, void *);
DOSCALL	void		PSPSET(void *);
DOSCALL	int		GETTIME2(void);
/* ff28 */
DOSCALL	int		SETTIME2(int);
DOSCALL	int		NAMESTS(char *,char *);
DOSCALL	int		GETDATE(void);
DOSCALL	int		SETDATE(unsigned short);
DOSCALL	unsigned short	GETTIME(void);
DOSCALL	int		SETTIME(unsigned short);
DOSCALL	void		VERIFY(unsigned short);
DOSCALL	int		DUP0(short,short);
/* ff30 */
DOSCALL	const int	VERNUM(void);
DOSCALL	volatile void	KEEPPR(int,short);
DOSCALL	int		GETDPB(unsigned short,void *);
DOSCALL	int		BREAKCK(unsigned short);
DOSCALL	int		DRVXCHG(short,short);
DOSCALL	int		INTVCG(unsigned short);
DOSCALL	int		DSKFRE(unsigned short,void *);
DOSCALL	int		NAMECK(const char*, void *);
/* ff38 */
/*DOSCALL 38*/
DOSCALL	int		MKDIR(const char*);
DOSCALL	int		RMDIR(const char*);
DOSCALL	int		CHDIR(const char*);
DOSCALL	int		CREATE(const char*,short);
DOSCALL	int		OPEN(const char*,short);
DOSCALL	int		CLOSE(short);
DOSCALL	int		READ(short,void *,int);
/* ff40 */
DOSCALL	int		WRITE(short,void *,int);
DOSCALL	int		DELETE(const char*);
DOSCALL	int		SEEK(short,int,short);
DOSCALL	int		CHMOD(const char*,short);
/*DOSCALL int		IOCTRL(short,...);*/
DOSCALL	int		DUP(short);
DOSCALL	int		DUP2(short,short);
DOSCALL	int		CURDIR(short,char *);
/* ff48 */
DOSCALL	void		*MALLOC(int);
DOSCALL	int		MFREE(void*);
DOSCALL	int		SETBLOCK(void*,int);
/*DOSCALL int		EXEC(short,...);*/

asm( "EXECsss	equ	EXEC" );
DOSCALL	int		EXECsss( unsigned short, void*, void*, void* );
#define	PATHCHK( a, b, c )	EXECsss( 2, a, b, c )
/*#define	LOADEXEC( a, b, c )	EXECsss( 0, a, b, c )*/

DOSCALL	volatile void	EXIT2(short);
DOSCALL	int		WAIT(void);
DOSCALL	int		FILES(void*,const char*,short);
DOSCALL	int		NFILES(void*);
/* ff50 */
DOSCALL	int		SETPDB(int);
DOSCALL	int		GETPDB(void);
DOSCALL	int		SETENV(const char*,void *,char *);
DOSCALL	int		GETENV(const char*,void *,char *);
DOSCALL	int		VERIFYG(void);
/*DOSCALL int		COMMON(short,...);*/
DOSCALL	int		RENAME(const char *, const char *);
DOSCALL	unsigned int	FILEDATE(short,unsigned int);
/* ff58 */
DOSCALL	int		MALLOC2(int);
/*DOSCALL 59*/
DOSCALL	int		MAKETMP(char *,short);
DOSCALL	int		NEWFILE(const char *,short);
DOSCALL	int		LOCK(short,short,int,int);
/*DOSCALL 5d*/
/*DOSCALL 5e*/
/*DOSCALL int		ASSIGN(short,...);*/

/* ff7c */
DOSCALL	void		*GETFCB(short);
DOSCALL	int		S_MALLOC(short,int);
DOSCALL	int		S_MFREE(int);
DOSCALL	int		S_PROCESS(short,void*,int,int);

/* fff0 */
/*DOSCALL int		EXITVC();*/
/*DOSCALL int		CTRLVC();*/
/*DOSCALL int		ERRJVC();*/
DOSCALL	void		DISKRED(char*,short,short,short);
DOSCALL	void		DISKWRT(char*,short,short,short);
DOSCALL	int		INDOSFLG(void);
DOSCALL	int		SUPER_JSR(void*);
DOSCALL	int		BUS_ERR(void*,void*,short);
/* fff8 */
DOSCALL	int		OPEN_PR(char*,short,int,int,short,void*,void*,int);
DOSCALL	void		KILL_PR(void);
DOSCALL	int		GET_PR(short,void*);
DOSCALL	int		SUSPEND(short);
DOSCALL	int		SLEEP_PR(int);
DOSCALL	int		SEND_PR(short,short,short,void*,int);
DOSCALL	int		TIME_PR(void);
DOSCALL	void		CHANGE_PR(void);

#endif

#ifndef	__float_inline_call__
#define	__float_inline_call__
/* fe00 */
asm( "RAND	equ	$fe0e" );
DOSCALL	int		RAND(void);
#endif

#ifndef	__dos_lib__
#define	__dos_lib__

struct PDBADR {
	unsigned int	env,		/* 0 */
			exit,		/* 4 */
			ctrlc,		/* 8 */
			errexit,	/* 12 */
			comline;	/* 16 */
	unsigned char	handle[12];
	unsigned int	bss,
			heap,
			stack,
			usp,
			ssp;
	unsigned short	sr,
			abort_sr;
	unsigned int	abort_ssp,
			trap10,
			trap11,
			trap12,
			trap13,
			trap14,
			osflg;
	unsigned char	reserve[28],
			exe_path[68],
			exe_name[24];
	};

struct INPPTR {
	unsigned char 	max,
			length,
			buffer[256];
	};

struct COMLINE {
	unsigned char 	len,
			buffer[255];
	};

struct NAMESTBUF {
	unsigned char	flg,
			drive;
	unsigned char	path[65],
			name1[8],
			ext[3],
			name2[10];
	};

struct FREEINF {
	unsigned short	free,
			max,
			sec,
			byte;
	};

struct NAMECKBUF {
	unsigned char	drive[2],
			path[65],
			name[19],
			ext[5];
	};

struct DPBPTR {
	unsigned char	drive,
			unit;
	unsigned short	byte;
	unsigned char	sec,
			shift;
	unsigned short	fatsec;
	unsigned char	fatcount,
			fatlen;
	unsigned short	dircount,
			datasec,
			maxfat,
			dirsec;
	int		driver;
	unsigned char	id,
			flg;
	struct DPBPTR	*next;
	unsigned short	dirfat;
	unsigned char	dirbuf[64];
};

struct FILBUF {
	unsigned char	os[21],
			atr;
	unsigned short	time,
			date;
	unsigned int	filelen;
	unsigned char	name[23];
};

#endif

/* :vi:se ts=8 sw=8: */
