home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
cpm
/
tdossigi
/
remch0.mac
< prev
next >
Wrap
Text File
|
1986-07-05
|
1KB
|
99 lines
; REMCH - REMOTE CHANNEL DRIVER EXAMPLE
;
.Z80
;
NAME ('RemCh0')
;
;
; COM1 SET BAUD RATE
;
SETBA@::
LD B,0 ; SET CHANNEL 1
LD C,(IX+31H) ; GET E-REGISTER
LD E,3 ; SET FUNCTION 3=SET BAUD RATE
CALL COMDRV## ; DO IT
LD A,0FFH ; RETURN TRUE
JP EXITA## ; AND QUIT
;
; COM1 GET BAUD RATE
;
GETBD@::
LD B,0 ; SET CHANNEL 1
LD E,4 ; SET FUNCTION 4=GET BAUD RATE
CALL COMDRV##
JP EXITA## ; RETURN WITH BAUD IN A
;
; COM1 I/O
;
INOUT@::
LD A,(IX+30H) ; GET DIRECTION FLAG
AND 80H ; VALID CHAR IN E?
JR Z,.NO1 ; NO, INPUT ONLY
LD B,0
CALL .CMOUT ; COMMON OUTPUT
.NO1: CALL GETDMA## ; GET DMA ADDRESS
DI
EX DE,HL
LD BC,128
LD HL,COM1BF
LD A,(HL)
LDIR
LD HL,COM1BF
LD (HL),0
EI
JP EXITA##
;
; COMMON OUTPUT
;
.CMOUT: LD C,(IX+31H) ; GET CHARACTER
LD E,2 ; OUTPUT FCN
JP COMDRV## ; DO IT
;
; ATTACH COM CHANNEL
;
ATACH@::
LD DE,COM1PL
CALL LNKPOL##
XOR A
JP EXITA##
;
; DETACH COM CHANNEL
;
DETA@::
LD HL,COM1PL
JP UNLINK##
;
; POLL ROUTINE
;
COM1PL: DW 0
DW 0
LD E,0
LD B,0
CALL COMDRV##
OR A
RET Z
LD E,1
LD B,0
CALL COMDRV##
LD B,A
LD HL,COM1BF
LD A,(HL)
CP 7FH
RET Z
DI
INC A
LD (HL),A
LD E,A
LD D,0
ADD HL,DE
LD (HL),B
EI
RET
;
; REMCH DATA AREA
;
COM1BF: DB 0
DS 127
;
END