BASIC-80

RMX/80 BASIC-SO

 

 

 

USER TERMINAL HANDLER TO OUTPUT FOR FILE :L1:

NAME

BQUSER

PUBLIC

BQUSER

EXTRN

BQOPNX,RQSEND,RQWAIT,RQOUTX

CSEG

 

;WAIT FOR MESSAGE AT BQOPNX

;OPEN AND CLOSE ARE IGNORED

BQUSER:

LXI

B,BQOPNX

:EXCHANGE FOR USER OPEN

LXI

0,0

;WAIT FOREVER

CALL

RQWAIT

 

 

PUSH

H

;MESSAGEADOR

LXI

0,4

;OFFSET OF TYPE

DAD

0

 

 

 

MOV

A,M

;MESSAGE TYPE

LXI

D,S

;STATUS IS AT OFFSET 9

DAD

0

 

 

 

CPI

14

;CLOSE TYPE

 

JZ

ZSTAT

 

;ZEROSTATUSANOQUIT

CPI

15

;OPEN STAT

 

JNZ

NOTOPN

;NOT AN OPEN REQUEST

PUSH

H

;SAVE STATUS ADOR

LXI

0,6

ADD 6 TO GET LOCATION

DAD

0

;OFAFREXCHANGE

LXI

O,BQOPNX ;OPEN EXCHANGE ALSO USED FOR WRITE MESSAGES

MOV

M,E

;LOW BYTE AFR

INX

H

,

 

 

MOV

M,O

;HI BYTE AFR

 

POP

H

;RESTORE STATUS POINTER

JMP

ZSTAT

;AND ZERO STATUS

NOTOPN:

 

 

 

 

CPI

12

;WRITETYPE

 

JZ

WRITE

 

 

 

; BAD MESSAGE TYPE - RETURN ERROR STATUS

MVI

M,18

;STATUS-UNRECOGNIZEDTYPE

JMP

ERRRET ;RETURN MESSAGE AND QUIT

; PASS MESSAGE ON TO TH

 

WRITE:

LXI

B,RQOUTX

;TH OUTPUT EXCH

POP

0

;MESSAGE AOOR

CALL

RQSEN~SENOMESSAGE

JMP

BQUSER ;WAIT FOR MORE

,

;ZERO STATUS AND RETURN MESSAGE

ZSTAT: XRA A

MOV

M,A

;LOW BYTE OF STATUS

ERRRET:

INX

H

 

MOV

M,A

;HI BYTE OF STATUS

; RETURN MESSAGE

 

 

DCX

H

;BACKUPTO

OCX

H

 

RESPONSE EXCH

MOV

B,M

 

;HI BYTE OF RESP EXCH

DCX

H

 

 

MOV

C,M

 

;LOW BYTE

POP

0

;MESSAGEAODR

CALL

RQSENO

RETURN MESSAGE

JMP

BQUSER

;WAIT FOR MORE

END

 

 

 

Figure F-S. Sample User-Written 1/0 Driver Routine

F-15

Page 107
Image 107
Intel 9800758-02 manual Figure F-S. Sample User-Written 1/0 Driver Routine