#define S_BDOSVER	12
#define DIR_SET		14
#define F_OPEN		15
#define F_CLOSE		16
#define F_SEARCH	17
#define F_DELETE	19
#define F_READ		20
#define F_WRITE		21
#define F_MAKE		22
#define F_RENAME	23
#define DIR_LOGINVEC	24
#define DIR_GET		25
#define F_DMASET	26
#define DIR_SETRO	28
#define DIR_ROVEC	29
#define F_ATTRIB	30
#define F_READRAND	33
#define F_WRITERAND	34
#define F_SIZE		35
#define F_RANDREC	36
#define DRV_RESET	37
#define DRV_ACCESS	38
#define DRV_FREE	39
#define F_WRITEZF	40
#define F_LOCK		42
#define F_UNLOCK	43
#define F_ERRMODE	45
#define DRV_SPACE	46
#define P_CHAIN		47
#define DRV_FLUSH	48
#define S_SYSVAR	49
#define F_DMAGET	52
#define P_RSX		60
#define P_EXCEPT	61
#define F_TRUNCATE	99
#define DRV_SETLABEL	100
#define F_TIMEDATE	102
#define F_WRITEXFCB	103
#define F_PASSWD	106
#define S_SERIAL	107
#define P_CODE		108
#define C_KTRAN		114
#define G_GSX		115
#define C_COPY		116
#define C_ALTER		117
#define CH_READ		118
#define CH_WRITE	119
#define CH_STAT		120
#define CH_DELIM	121
#define CH_MODE		122
#define CH_SET		123
#define CH_OWNER	124
#define CH_INFO		125
#define DRV_LOCK	126
#define DRV_UNLOCK	127
#define M_ALLOC		128
#define M_FREE		130
#define DEV_POLL	131
#define DEV_WAITFLAG	132
#define DEV_SETFLAG	133
#define Q_MAKE		134
#define Q_OPEN		135
#define Q_DELETE	136
#define Q_READ		137
#define Q_CREAD		138
#define Q_WRITE		139
#define Q_CWRITE	140
#define P_DELAY		141
#define P_DISPATCH	142
#define P_TERM		143
#define P_CREATE	144
#define P_PRIORITY	145
#define P_CLI		150
#define P_CALL		151
#define F_PARSE		152
#define P_PID		156
#define P_ABORT		157
#define S_OSVER		163
#define W_CREATE	165
#define W_TOP		166
#define W_WINDOW	167
#define W_KGIVE		168
#define W_KEYPUT	169
#define W_KCTRL		170
#define W_DELETE	171
#define F_LOCKMODE	172
#define F_SETDATE	173
#define F_TESTFCB	174
#define DRV_READLABEL	175
#define DRV_VECTOR	176
#define DRV_INFO	177
#define DRV_PHYIO	178
#define DIR_ASSIGN	179
#define DIR_MAKE	180
#define DIR_DELETE	181
#define DIR_PATHNAME	182
#define DIR_INFO	183
#define DEV_GETFLAG	184
#define DEV_RELFLAG	185
#define DEV_RESETFLAG	186
#define P_LOADPO	187
#define T_TIMEDATE	188
#define DRV_USERS	189
#define CD_INSTALL	190
#define CD_INFO		191
#define CD_SET		192
#define P_ASYNC		193
#define P_MWAIT		194
#define P_ACANCEL	195
#define P_ARET		196
#define P_EVENTS	197

	/* CPM 4 RTL functions that do not need */
	/* parameter conversion			*/

#define	c_ktran(x)		(WORD)__CPMIF(C_KTRAN,x)
#define dev_getflag()		(UWORD)__CPMIF(DEV_GETFLAG,0)
#define	dev_poll(x)		(WORD)__CPMIF(DEV_POLL,x)
#define	dev_relflag(x)		(WORD)__CPMIF(DEV_RELFLAG,x)
#define	dev_resetflag(x)	(WORD)__CPMIF(DEV_RESETFLAG,x)
#define	dev_setflag(x)		(WORD)__CPMIF(DEV_SETFLAG,x)
#define	dev_waitflag(x)		(WORD)__CPMIF(DEV_WAITFLAG,x)
#define	dir_delete(x)		(BYTE)__CPMIF(DIR_DELETE,x)
#define	dir_get()		(BYTE)__CPMIF(DIR_GET,0)
#define	dir_info(x)		(UWORD)__CPMIF(DIR_INFO,x)
#define	dir_loginvec()		(UWORD)__CPMIF(DIR_LOGINVEC,0)
#define	dir_make(x)		(BYTE)__CPMIF(DIR_MAKE,x)
#define	dir_pathname(x)		(UBYTE)__CPMIF(DIR_PATHNAME,x)
#define	dir_rovec()		(UWORD)__CPMIF(DIR_ROVEC,0)
#define	dir_set(x)		(BYTE)__CPMIF(DIR_SET,x)
#define	dir_setro()		(BYTE)__CPMIF(DIR_SETRO,0)
#define	drv_access(x)		(BYTE)__CPMIF(DRV_ACCESS,x)
#define	drv_flush(x)		(BYTE)__CPMIF(DRV_FLUSH,x)
#define	drv_free(x)		(BYTE)__CPMIF(DRV_FREE,x)
#define	drv_lock(x)		(BYTE)__CPMIF(DRV_LOCK,x)
#define	drv_readlabel(x)	(BYTE)__CPMIF(DRV_READLABEL,x)
#define	drv_reset(x)		(BYTE)__CPMIF(DRV_RESET,x)
#define	drv_setlabel(x)		(BYTE)__CPMIF(DRV_SETLABEL,x)
#define	drv_space(x)		(BYTE)__CPMIF(DRV_SPACE,x)
#define	drv_unlock(x)		(BYTE)__CPMIF(DRV_UNLOCK,x)
#define	drv_vector()		(UWORD)__CPMIF(DRV_VECTOR,0)
#define	f_attrib(x)		(BYTE)__CPMIF(F_ATTRIB,x)
#define	f_close(x)		(BYTE)__CPMIF(F_CLOSE,x)
#define	f_delete(x)		(BYTE)__CPMIF(F_DELETE,x)
#define	f_dmaget()		(UBYTE	*)__CPMIF(F_DMAGET,0)
#define	f_dmaset(x)		__CPMIF(F_DMASET,x)
#define	f_errmode(x)		__CPMIF(F_ERRMODE,x)
#define	f_lock(x)		(BYTE)__CPMIF(F_LOCK,x)
#define	f_lockmode(x)		(BYTE)__CPMIF(F_LOCKMODE,x)
#define	f_make(x)		(BYTE)__CPMIF(F_MAKE,x)
#define	f_open(x)		(BYTE)__CPMIF(F_OPEN,x)
#define	f_passwd(x)		(BYTE)__CPMIF(F_PASSWD,x)

#define	f_parse(x)		(UBYTE	*)__CPMIF(F_PARSE,x)

#define	f_randrec(x)		(BYTE)__CPMIF(F_RANDREC,x)
#define	f_read(x)		(BYTE)__CPMIF(F_READ,x)
#define	f_readrand(x)		(BYTE)__CPMIF(F_READRAND,x)
#define	f_rename(x)		(BYTE)__CPMIF(F_RENAME,x)
#define	f_setdate(x)		(BYTE)__CPMIF(F_SETDATE,x)

#define	f_search(x)		(BYTE *)__CPMIF(F_SEARCH,x)

#define	f_size(x)		(BYTE)__CPMIF(F_SIZE,x)
#define	f_testfcb(x)		(BYTE)__CPMIF(F_TESTFCB,x)
#define	f_timedate(x)		(BYTE)__CPMIF(F_TIMEDATE,x)
#define	f_truncate(x)		(BYTE)__CPMIF(F_TRUNCATE,x)
#define	f_unlock(x)		(BYTE)__CPMIF(F_UNLOCK,x)
#define	f_write(x)		(BYTE)__CPMIF(F_WRITE,x)
#define	f_writerand(x)		(BYTE)__CPMIF(F_WRITERAND,x)
#define	f_writexfcb(x)		(BYTE)__CPMIF(F_WRITEXFCB,x)
#define	f_writezf(x)		(BYTE)__CPMIF(F_WRITEZF,x)
#define	m_alloc(x)		(WORD)__CPMIF(M_ALLOC,x)
#define	m_free(x)		(WORD)__CPMIF(M_FREE,x)
#define	p_abort(x)		(WORD)__CPMIF(P_ABORT,x)
#define p_acancel(x)		(UWORD)__CPMIF(P_ACANCEL,x)
#define p_aret(x)		(UWORD)__CPMIF(P_ARET,x)
#define p_asynch(x)		(UWORD)__CPMIF(P_ASYNCH,x)
#define	p_chain(x)		(WORD)__CPMIF(P_CHAIN,x)
#define	p_cli(x)		(WORD)__CPMIF(P_CLI,x)
#define	p_code(x)		(LONG)__CPMIF(P_CODE,x)
#define	p_create(x)		(WORD)__CPMIF(P_CREATE,x)
#define	p_delay(x)		(WORD)__CPMIF(P_DELAY,x)
#define	p_dispatch()		__CPMIF(P_DISPATCH,0)
#define p_events()		(UWORD)__CPMIF(P_EVENTS,0)
#define	p_except(x)		(WORD)__CPMIF(P_EXCEPT,x)
#define	p_id()			(UWORD)__CPMIF(P_ID,0)
#define	p_loadpo(x)		(WORD)__CPMIF(P_LOADPO,x)
#define p_mwait(x)		(UWORD)__CPMIF(P_MWAIT,x)
#define	p_priority(x)		__CPMIF(P_PRIORITY,x)
#define	p_super()		__CPMIF(P_SUPER,0)
#define	p_term(x)		(WORD)__CPMIF(P_TERM,x)
#define	q_cread(x)		(WORD)__CPMIF(Q_CREAD,x)
#define	q_cwrite(x)		(WORD)__CPMIF(Q_CWRITE,x)
#define	q_delete(x)		(WORD)__CPMIF(Q_DELETE,x)
#define	q_make(x)		(WORD)__CPMIF(Q_MAKE,x)
#define	q_read(x)		(WORD)__CPMIF(Q_READ,x)
#define	q_write(x)		(WORD)__CPMIF(Q_WRITE,x)
#define	s_bdosver()		(WORD)__CPMIF(S_BDOSVER,0)
#define	s_osver()		(WORD)__CPMIF(S_OSVER,0)
#define	s_serial()		(WORD)__CPMIF(S_SERIAL,0)
#define	s_sysvar(x)		(WORD)__CPMIF(S_SYSVAR,x)
#define	w_delete(x)		(WORD)__CPMIF(W_DELETE,x)
#define	w_kgive(x)		(WORD)__CPMIF(W_KGIVE,x)
#define	w_top(x)		(WORD)__CPMIF(W_TOP,x)
#define	w_window(x)		(WORD)__CPMIF(W_WINDOW,x)

#define	C_READ		1
#define	C_WRITE		2
#define	C_RAWIO		6
#define	C_WRITESTR	9
#define	C_READSTR	10
#define	C_STAT		11
#define	C_DELIMIT	110
#define	C_GET		153
#define	F_USERNUM	32
#define	F_SFIRST	17
#define	F_SNEXT		18
#define	L_SETNUM	160
#define	L_GETNUM	164
#define	L_ATTACH	158
#define	L_DETACH	159
#define	L_CATTACH	161
#define	L_WRITE		5
#define	L_WRITEBLK	112
#define	P_TERMCPM	0

#define	c_get()			(BYTE)__CPMIF(C_GET,0)
#define	c_read()		(BYTE)__CPMIF(C_READ,0)
#define	c_write(x)		__CPMIF(C_WRITE,x)
#define	c_rawio(x)		(BYTE)__CPMIF(C_RAWIO,x)
#define	c_writestr(x)		__CPMIF(C_WRITESTR,x)
#define	c_readstr(x)		__CPMIF(C_READSTR,x)
#define	c_stat()		(BYTE)__CPMIF(C_STAT,0)
#define	c_delimit(x)		(BYTE)__CPMIF(C_DELIMIT,x)
#define	f_usernum(x)		(BYTE)__CPMIF(F_USERNUM,x)
#define	f_sfirst(x)		(WORD)__CPMIF(F_SFIRST,x)
#define	f_snext()		(WORD)__CPMIF(F_SNEXT,0)
#define	l_setnum(x)		__CPMIF(L_SETNUM,x)
#define	l_getnum()		(WORD)__CPMIF(L_GETNUM,0)
#define	l_attach()		(WORD)__CPMIF(L_ATTACH,0)
#define	l_detach()		__CPMIF(L_DETACH,0)
#define	l_cattach()		(WORD)__CPMIF(L_CATTACH,0)
#define	l_write(x)		__CPMIF(L_WRITE,x)
#define	l_writeblk(x)		__CPMIF(L_WRITEBLK,x)
#define	p_termcpm()		__CPMIF(P_TERMCPM,0)
