Arm condition detection, Sample program – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual
Page 118
II. SOFTWARE GUIDES - 8. Driver488/DRV
8K. Other Languages
Personal488 User’s Manual, Rev. 3.0
II-103
ARM Condition Detection
It is sometimes desirable to be able to easily check for asynchronous bus conditions, such as Service
Request (
SRQ
), without having to use the Driver488/DRV
STATUS
command. This can be
accomplished by using the light pen interrupt emulation feature of Driver488/DRV. When this feature
is enabled, Driver488/DRV preempts the normal function of the light pen BIOS status request interrupt.
Instead of returning the light pen switch status, this interrupt returns an indicator that is non-zero if any
of the
ARM
conditions are true. See the
ARM
command in “Section III: Command References” for more
details about the conditions that can be checked.
There are two items to notice about this routine: it uses the BIOS video interrupt
10h
rather than the
DOS function call interrupt
21h
, and it checks twice to see if a condition has been detected. The test
must be repeated if
IOCTL Read
is used to check the Driver488/DRV status.
IOCTL Read
causes the
light pen interrupt emulation to return
no interrupt
status on the next status read, regardless of the
actual
ARM
condition status. This allows the BASIC function
ON PEN
to operate properly, but requires
the status to be checked twice in other languages.
Sample Program
name
DB”
IEEE”, 0
;Driver488/DRV device name
ieee
DWO
;Place to hold Driver488/DRV file
handle
ioctlbufDB
0
;IOCTL Read response buffer
ioctllenEQU
$-ioctllen
;Length of buffer
cr
EQU
0Dh
;Carriage-return
lf
EQU
0Ah
;Line-feed
hello
DB
“HELLO”,,cr,,lf
;HELLO command with terminators
hellolen
EQU
$-hello
;HELLO command length
response
DB
256 DUP (?)
;Place to put Driver488 response
responselen
EQ
$-response
;Length of response buffer
;
recvdlen
DW
?
;Place to keep # chars in response
start
mov
Ah, 3Dh
;Open function
mov
AL, 02
;Access code = read/write
mov
DX, offset name
;DS:DX-name
int
21h
;Execute DOS function
jc
error
;Error if carry set
mov
ieee,AX
;Save file handle
mov
AH, 3Eh
;Close function
mov
BX, ieee
;File handle
int
21h
;Execute DOS function
jc
error
;Check for error
mov
AX, 4400h
;DOS GetDeviceData Function
mov
BX, ieee
;File handle for Driver488/DRV
int
21h
;Execute DOS function
mov
DH, 0
;Must clear
or
DL, 20h
;Set “don’t check for control
characters” bit
mov
AX, 4401h
;DOS SetDeviceData Function
mov
BX, ieee
;File handle
int
21h
;Execute DOS function
Checking the Driver488/DRV light pen emulation status is straight forward, as illustrated by the
following table.
mov
AX,0400h
;Test light pen function
int
10h
;BIOS video interrupt
or
AH,AH
;Check AH
jnz
GotInt
;Non-zero means interrupt
mov
AX,0400h
;Repeat the test
int
10h
or
AH,AH
jnz
GotInt