; Definition of CPM 2.2.  "set" vars can be modified if needed.
;
; BDOS Functions:
@SYS	equ	0;	reinitialize
@KEY	equ	1;	input console char, echo
@CON	equ	2;	output console char
@RDR	equ	3;	input RDR char.
@PUN	equ	4;	output PUN char
@LST	equ	5;	output LST char
@DIO	equ	6;	Direct console i/o & status
@RIO	equ	7;	Get IO byte (2.2). Rdr status (3.0)
@SIO	equ	8;	Set IO byte (2.2). Pun status (3.0)
@MSG	equ	9;	String to console
@INP	equ	10;	Input string from console
@RDY	equ	11;	Console input ready
@VER	equ	12;	CPM version
@LOG	equ	13;	Reset disk system (^C)
@DSK	equ	14;	Select drive
@OPN	equ	15;	Open file
@CLS	equ	16;	Close file
@DIR	equ	17;	Search 1st Dir. entry
@NXT	equ	18;	Search next Dir. entry
@DEL	equ	19;	Delete file
@FRD	equ	20;	File read (sequential)
@FWR	equ	21;	File write (sequential)
@MAK	equ	22;	Make file
@REN	equ	23;	Rename file
@LGV	equ	24;	Log-in vector
@CUR	equ	25;	Get current disk
@DMA	equ	26;	Set DMA address
@ALO	equ	27;	Get disk allocation vector
@WPT	equ	28;	Write protect drive
@GRO	equ	29;	Get read/only vector (drives)
@CHG	equ	30;	Change file attributes
@GPM	equ	31;	Get disk parameter table pointer
@USR	equ	32;	Get/set current user
@RRD	equ	33;	Random record read
@RWR	equ	34;	Random record write
@SIZ	equ	35;	Get file size
@REC	equ	36;	Set random record to current sequential
@RDV	equ	37;	Reset (selected) drive(s)
;			38 and 39 are MPM functions
@WRZ	equ	40;	Random write w/zero fill
;
; some CPM 3.0 functions, for reference.  Match function if
; possible when a 2.2 RSX is created.
; 41 thru 50 are used
@CHN	equ	47;	Chain to command line in (dmaadr)
@OVL	equ	59;	Load overlay
;@RSX	equ	60;	Call RSX.  Different usage than here
; 98 thru 112 are used.  115 is CPM86 GSX graphics.
@PFN	equ	152;	parse filename
;
; System equates:
CPMBASE	set	0
boot	set	CPMBASE
iobyte	set	boot+3
drvusr	set	boot+4
bdos	set	boot+5
tfcb	set	boot+5CH
tfcb1	set	tfcb
tfcb2	set	tfcb+16
tbuff	set	boot+80H
TPA	set	boot+100H
fcblen	equ	36;		Length of input FCB, incl. random rcd
;
; Known CPM 2.2 definitions, for validation. Modify for other systems
BDOSARG	set	0011h;		Entry point jumps to this, relative
;				to the first page of BDOS proper
BDOSLGH	set	0eh;		BDOS is this many 256 byte pages long
CCPLGH	set	0800h;		CCP is this long. If this is not 800h
;				then the standard versions of RELOCCP
;				(.SYS & .OVR) must be revised.
;
; nvects is larger than the CPM 2.2 standard to allow for:
;   1. CPM 3 bios system
;   2. Other systems with extended bios calls and/or use
;      e.g. Kaypro has a key table, which some applications
;      alter (via the pointer at 1).  If the space is not
;      reserved system crashes will result.
nvects	set	29;		Number of BIOS vectors
n22vec	set	16;		Number of CPM 2.2 vectors
;
; Some control chars.
CTRL	equ	' '-1;		CTRL CHAR MASK
CTRLC	equ	CTRL AND 'C'
BEL	equ	CTRL AND 'G'
BS	equ	CTRL AND 'H'
TAB	equ	CTRL AND 'I'
LF	equ	CTRL AND 'J'
FF	equ	CTRL AND 'L'
CR	equ	CTRL AND 'M'
eof	equ	CTRL AND 'Z'
vZ