home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
cpm
/
turbodsg
/
remch0.a
< prev
next >
Wrap
Text File
|
1986-07-05
|
1KB
|
106 lines
; REMCH - REMOTE CHANNEL DRIVER EXAMPLE
;
MODULE "RemCh0"
;
LOC Code#
;
; COM1 SET BAUD RATE
;
SETBA_::
MOV CH,=0 ; SET CHANNEL 1
MOV CL,0X55[SI] ; GET E-REGISTER
MOV DL,=3 ; SET FUNCTION 3=SET BAUD RATE
CALL COMDRV# ; DO IT
MOV 0X4F[SI],=BYTE 0XFF ; RETURN TRUE
RET ; AND QUIT
;
; COM1 GET BAUD RATE
;
GETBD_::
MOV CH,=0 ; SET CHANNEL 1
MOV DL,=4 ; SET FUNCTION 4=GET BAUD RATE
CALL COMDRV#
MOV 0X4F[SI],AL ; RETURN WITH BAUD IN A
RET
;
; COM1 I/O
;
INOUT_::
MOV AL,0X54[SI] ; GET DIRECTION FLAG
AND AL,=0X80 ; VALID CHAR IN E?
JZ __NO1 ; NO, INPUT ONLY
MOV CH,=0
CALL CMOUT ; COMMON OUTPUT
__NO1: MOV DX,0X6A[SI]
MOV BP,0X6C[SI]
MOV CX,=128
MOV BX,&COM1BF
MOV AL,[BX]
PUSH AX
MOV AX,DS
CALL LDIR#
POP AX
MOV COM1BF,=BYTE 0
MOV 0X4F[SI],AL
RET
;
; COMMON OUTPUT
;
CMOUT: MOV CL,0X55[SI] ; GET CHARACTER
MOV DL,=2 ; OUTPUT FCN
JMP COMDRV# ; DO IT
;
; ATTACH COM CHANNEL
;
ATACH_::
MOV DX,&COM1PL
CALL LNKPOL#
MOV 0X4F[SI],=BYTE 0
RET
;
; DETACH COM CHANNEL
;
DETA_::
MOV BX,&COM1PL
JMP UNLINK#
;
; POLL ROUTINE
;
COM1PL: WORD 0
WORD 0
MOV DL,=0
MOV CH,=0
CALL COMDRV#
OR AL,AL
JNZ __1
RET
;
__1: MOV DL,=1
MOV CH,=0
CALL COMDRV#
MOV CH,AL
MOV BX,&COM1BF
MOV AL,[BX]
CMP AL,=0X7F
JNZ __2
RET
;
__2: CLI
INC AL
MOV [BX],AL
MOV DL,AL
MOV DH,=0
ADD BX,DX
MOV [BX],CH
STI
RET
;
; REMCH DATA AREA
;
LOC Data#
;
COM1BF: BYTE 0
RES 127
;
END