;
; ++++++++++++++++++++++++++
; +++ KERMIT definitions +++
; ++++++++++++++++++++++++++
;
FALSE	equ	0		;Define the boolean constants.
TRUE	equ	NOT FALSE

; Select message style

;GERMAN	equ	TRUE
GERMAN	equ	FALSE

; Select serial device via IOPORT

_BDOS	equ	0
_PORT	equ	1
_INTRPT	equ	2
_QUEUE	equ	3

; IOPORT = 0: get I/O via BDOS functions
; IOPORT = 1: select I/O directly
; IOPORT = 2: select I/O directly via internal interrupt driver
; IOPORT = 3: select I/O directly via external interrupt driver

;IOport	equ	_BDOS		; The standard way
;IOport	equ	_PORT		; The direct way
IOport	equ	_INTRPT		; The direct interrupt way
;IOport	equ	_QUEUE		; The indirect interrupt way

; Define chracter I/O

BIOS	equ	TRUE		; Get from BIOS
;BIOS	equ	FALSE		; Get from BDOS

; Symbolic Definitions for some ASCII characters

ctrlc	equ	'C'-'@'		;ASCII ETX (Control-C)
bell	equ	'G'-'@'		;ASCII BEL (Control-G)
bs	equ	'H'-'@'		;ASCII Backspace (Control-H)
tab	equ	'I'-'@'		;ASCII Tab (Control-I)
lf	equ	'J'-'@'		;ASCII Line Feed (CTRL-J)
ff	equ	'L'-'@'		;ASCII Form Feed (CTRL-L)
cr	equ	'M'-'@'		;ASCII Carriage Return (CTRL-M)
xon	equ	'Q'-'@'		;The the ASCII character used for XON
xoff	equ	'S'-'@'		;The the ASCII character used for XOFF
esc	equ	'['-'@'		;ASCII ESCape
subt	equ	'Z'-'@'		;ASCII SUB (CTRL-Z)
del	equ	7fh		;ASCII DELete (rubout)
eot	equ	'$'		;CP/M end of text

npl	equ	4		;Number of names per line for dir cmd

defesc	equ	'\'-'@'		;The default is Control \

maxpkt  equ	96		;Maximum size of a packet.
maxtry	equ	5		;Default number of retries on a packet
imxtry	equ	16		;Default number of retries
				;send initiate.
drpsiz	equ	94		;Default receive packet size.
dspsiz	equ	32		;Default send packet size.
dstime	equ	 8		;Default send time out interval.
drtime	equ	 5		;Default receive time out interval.
dspad	equ	 0		;Default send padding.
drpad	equ	 0		;Default receive padding.
dspadc	equ	 0		;Default send padding char.
drpadc	equ	 0		;Default receive padding char.
dseol	equ	cr		;Default send EOL char.
dreol	equ	cr		;Default receive EOL char.
dsquot	equ	'#'		;Default send quote char.
drquot	equ	'#'		;Default receive quote char.
dschkt	equ	'1'		;Default checksum type
parevn	equ	 0		;Even parity.
parmrk	equ	 3		;Mark parity.
parnon	equ	 6		;No parity.
parodd	equ	 9		;Odd parity.
parspc	equ	12		;Space parity.

defpar	equ	parnon		;Default parity.
ibmpar	equ	parmrk		;IBM COMTEN's parity.

soh	equ	'A'-'@'		;Start of header char.

fcb	equ	005ch		;Location of File Control Block.
fcbt	equ	fcb+9
fcbrno	equ	fcb+33
buff	equ	0080h		;Location of file output buffer (DMA).
bufsiz	equ	128		;Size of DMA.

_NAM	equ	 1
_EX	equ	12
_EG	equ	14
_CR	equ	32

FCBnam	equ	12		;Length of FCB name
FCBlen	equ	36		;Length of FCB

diasw	equ	 1		;Default is diagnostics on.

cmkey	equ	 1		;Parse a keyword.
cmifi	equ	 2		;Parse an input file spec
				;(can be wild).
cmofi	equ	 3		;Parse an output file spec.
cmcfm	equ	 4		;Parse a confirm.
cmtxt	equ	 5		;Parse text.
cmifin	equ	16		;Parse an input file spec (but no
				;Error output

MSB	equ	10000000b	;Define MSB
NoMSB	equ	01111111b	;Define NO MSB

; BDOS constants

BDOS	equ	0005h		; Call BDOS

; BDOS calls

; Function Name			Function
; =============			========

conin	equ	  1		; Read Console
conout	equ	  2		; Write Console
auxin	equ	  3		; Auxiliary input
auxout	equ	  4		; Auxiliary output
lstout	equ	  5		; Write List
dconio	equ	  6		; Direct Con I/O
auxist	equ	  7		; Get AUXIN: status
auxost	equ	  8		; Get AUXOUT: status
prstr	equ	  9		; Print String
rdstr	equ	 10		; Read Buffer
consta	equ	 11		; Console Stat
verfun	equ	 12		; Get CP/M version
inbdos	equ	 13		; Init BDOS
logdsk	equ	 14		; LOG-In disk
openf	equ	 15		; Open File
closf	equ	 16		; Close File
sfirst	equ	 17		; Search File
snext	equ	 18		; Search next
delf	equ	 19		; Delete File
readf	equ	 20		; Read Record
writef	equ	 21		; Write Record
makef	equ	 22		; Create File
renam	equ	 23		; Rename File
rdlog	equ	 24		; Ret. Log Code
rddrv	equ	 25		; Read Drive #
setdma	equ	 26		; Set DMA Addr.
getalv	equ	 27		; Get All.Vect.
wrtprt	equ	 28		; Write prot dsk
getrov	equ	 29		; Get R/O Vect.
setfat	equ	 30		; Set File Attr.
gtdpar	equ	 31		; Get DSK par.
usrcod	equ	 32		; Get/Set Usr.Cd
rrand	equ	 33		; Read  Random
wrand	equ	 34		; Write Random
cflsz	equ	 35		; Comp File Sz.
setrar	equ	 36		; Set Rand. Rec.
indsk	equ	 37		; Initialize disk
errcod	equ	 45		; Set BDOS error code
getspc	equ	 46		; Get Drive Free Space
scbfun	equ	 49		; Gt/Put SCB
bioscl	equ	 50		; Direct BIOS call
consmod	equ	109		; Set/Get Console Mode

; BIOS calls

chtblf	equ	20		; Get Character Device Table
bdfun	equ	21		; Set Baud Rate
drvtab	equ	22		; Get drive table
userfn	equ	30		; Get Special User Function

vcpm3	equ	030h		; CP/M 3.0 version
amstra	equ	1		; JOYCE version
cpmerr	equ	0ffh		; File error return
warm	equ	0000h		; Start of BIOS warm vector

; JOYCE SIO line definition

dtroff	equ	80h
dtron	equ	7fh
rtsoff	equ	7eh
rtson	equ	7dh

; Constants for direct port access

datprt	equ	0e0h		; SIO data port
comprt	equ	0e1h		; SIO command port
comwrd	equ	11101010b	; SIO command word
				; DTR and RTS on
				; 8 data bits, TxE
rcvrdy	equ	00000100b	; Tx bit
ctsbit	equ	00100000b	; CTS bit
rxcav	equ	00000001b	; Rx bit
frmerr	equ	01000000b	; Frame error bit
siores	equ	00010000b	; Reset bit
break	equ	00010000b	; BREAK bit
reg0	equ	0		; WR0
reg1	equ	1		; WR1
reg5	equ	5		; WR5

; JOYCE extended BIOS vectors

cdinit	equ	00b6h
cdbaud	equ	00b9h
cdpara	equ	00bch
teask	equ	00bfh
cdvers	equ	00e3h
cdinfo	equ	00e6h

; JOYCE implemented OS versions

_MAJOR	equ	1
_MINORa	equ	4
_MINORb	equ	8

; Special interrupt vectors

SAinp.a	equ	00456h		; For BIOS 1.4
SAist.a	equ	00450h
INTveca	equ	0fea7h

SAinp.b	equ	04108h		; For BIOS 1.8
SAist.b	equ	04102h
INTvecb	equ	0fe77h

IntMod	equ	0feh		; Interrupt mode
PollMod	equ	000h		; Polling mode

; SCB locations

curp.	equ	01ch		; Page length
aux.in	equ	026h		; AUXIN vector address in SCB
aux.out	equ	028h		; AUXOUT vector address in SCB
pag.	equ	02ch		; Page mode
err..	equ	04bh		; Error mode

aux.vec	equ	2000h		; AUX SIO vector
get.	equ	000h		; Get item from SCB
put.wrd	equ	0feh		; Set word in SCB

; CPU speed - 10*MHZ

cpuspd	equ	40		; 4mhz

; Give info what we are building

IF1

_SelErr	aset	FALSE

.printx	+=======================================+
.printx	+                                       +

IF	IOport	EQ	_BDOS
IF	GERMAN
.printx	+ Serielle I/O durch BDOS Aufrufe       +
ELSE
.printx	+ Build BDOS based I/O                  +
ENDIF;GERMAN
ENDIF;_BDOS

IF	IOport	EQ	_PORT
IF	GERMAN
.printx	+ Serielle I/O durch Port Zugriff       +
ELSE
.printx	+ Build direct port accessed based I/O  +
ENDIF;GERMAN
ENDIF;_PORT

IF	IOport	EQ	_INTRPT
IF	GERMAN
.printx	+ Serielle I/O durch internen Interrupt +
ELSE
.printx	+ Build interrupt based I/O             +
ENDIF;GERMAN
ENDIF;_INTRPT

IF	IOport	EQ	_QUEUE
IF	GERMAN
.printx	+ Serielle I/O durch externen Interrupt +
ELSE
.printx	+ Build interrupt based queueing I/O    +
ENDIF;GERMAN
ENDIF;_QUEUE

IF	IOport	GT	_QUEUE
IF	GERMAN
.printx + !! Falsche Einstellung IOPORT (0..3)  +
ELSE
.printx	+ !!! Illegal selected IOPORT (0..3)    +
ENDIF;GERMAN
_SelErr	aset	TRUE
ENDIF;..out of range

.printx	+                                       +
.printx	+=======================================+

ENDIF;IF1

IF	_SelErr
	end
ENDIF;_SelErr

