; IOCB-Konstante

CIOV	= $E456

ICCOM	= $342
ICSTA	= $343
ICBAL	= $344
ICBAH	= $345
ICBLL	= $348
ICBLH	= $349
ICAX1	= $34A
ICAX2	= $34B

; CIO-Befehle

COPEN	=   3
CCLSE	=  12
CGTXT	=   5
CPTXT	=   9
CGBIN	=   7
CPBIN	=  11

	.MACRO KANNUM ;KANAL
	LDX #[%1]*16
	.ENDM

	.MACRO OPEN ; KANAL,AUX1,AUX2,FILENAME
	KANNUM %1
	LDA #%2
	STA ICAX1,X
	LDA #%3
	STA ICAX2,X
	LDA #COPEN
	STA ICCOM,X
	LDA #<[%4]
	STA ICBAL,X
	LDA #>[%4]
	STA ICBAH,X
	JSR CIOV
	.ENDM

	.MACRO CLOSE ; KANAL
	KANNUM %1
	LDA #CCLSE
	STA ICCOM,X
	JSR CIOV
	.ENDM

	.MACRO NOTE ; KANAL,SECTOR
	KANNUM %1
	LDA #$26
	STA ICCOM,X
	JSR CIOV
	LDA $34C,X
	STA %2
	LDA $34D,X
	STA %2+1
	.ENDM

	.MACRO PRINT ; KANAL,LABEL
	KANNUM %1
	LDA #CPTXT
	STA ICCOM,X
	LDA #<[%2]
	STA ICBAL,X
	LDA #>[%2]
	STA ICBAH,X
	LDA #127		; max. Laenge
	STA ICBLL,X
	LDA #0
	STA ICBLH,X
	JSR CIOV
	.ENDM

	.MACRO PRINT2 ; KANAL,VECTOR
	KANNUM %1
	LDA #CPTXT
	STA ICCOM,X
	LDA %2
	STA ICBAL,X
	LDA %2+1
	STA ICBAH,X
	LDA #127		; max. Laenge
	STA ICBLL,X
	LDA #0
	STA ICBLH,X
	JSR CIOV
	.ENDM

	.MACRO PUT
	LDX #[%1]*16
	LDA #CPBIN
	STA ICCOM,X
	LDA #0
	STA ICBLL,X
	STA ICBLH,X
	LDA #[%2]
	JSR CIOV
	.ENDM

	.MACRO BPUT ; KANAL,LAENGE,BUFFER
	KANNUM %1
	LDA #CPBIN
	STA ICCOM,X
	LDA #<[%2]
	STA ICBLL,X
	LDA #>[%2]
	STA ICBLH,X
	LDA #<[%3]
	STA ICBAL,X
	LDA #>[%3]
	STA ICBAH,X
	JSR CIOV
	.ENDM

	.MACRO BPUT2 ; KANAL,LEN-VECTOR,BUFFER
	KANNUM %1
	LDA #CPBIN
	STA ICCOM,X
	LDA %2
	STA ICBLL,X
	LDA %2+1
	STA ICBLH,X
	LDA #<[%3]
	STA ICBAL,X
	LDA #>[%3]
	STA ICBAH,X
	JSR CIOV
	.ENDM

	.MACRO BPUT3 ; KANAL,LEN-VECTOR,BUFFER-VEC
	KANNUM %1
	LDA #CPBIN
	STA ICCOM,X
	LDA %2
	STA ICBLL,X
	LDA %2+1
	STA ICBLH,X
	LDA %3
	STA ICBAL,X
	LDA %3+1
	STA ICBAH,X
	JSR CIOV
	.ENDM

	.MACRO BGET ; KANAL,LAENGE,BUFFER
	KANNUM %1
	LDA #CGBIN
	STA ICCOM,X
	LDA #<[%2]
	STA ICBLL,X
	LDA #>[%2]
	STA ICBLH,X
	LDA #<[%3]
	STA ICBAL,X
	LDA #>[%3]
	STA ICBAH,X
	JSR CIOV
	.ENDM

	.MACRO INPUT ; KANAL,BUFFER
	KANNUM %1
	LDA #CGTXT
       	STA ICCOM,X
       	LDA #<[%2]
       	STA ICBAL,X
       	LDA #>[%2]
       	STA ICBAH,X
       	LDA #127                ; max. Laenge
       	STA ICBLL,X
       	LDA #0
       	STA ICBLH,X
        JSR CIOV
	.ENDM

