Appendix D Register-Level Programming
©
National Instruments Corporation
D-31
PC-DIO-96/PnP User Manual
slave:
add
al,068h
; Offset for slave vector list
mov
slave_ack,1
; Flag for slave channel
setvec:
push
ax
; Save vector number for later
mov
ah,35h
; Get current vector
int
21h
; Get previous int_addr in es:bx
pop
ax
; Restore vector number
mov
cx,cs
; Prep to compare current/new vectors
mov
dx,es
cmp
dx,cx
; See if vector is already there
jne
short ii_0
cmp
bx,offset _isr_handler
je
short ii_exit
; Vector already installed--exit
ii_0:
mov
vect_num,al
; Save vector number for remove_isr
mov
word ptr int_addr[0],bx ; Save the address
mov
word ptr int_addr[2],es
push
ds
; Save the data segment
mov
ds,cx
; Copy cx (== cs) into ds
mov
dx,offset _isr_handler ; ds:dx points to new handler
mov
ah,25h
int
21h
; Install the handler in the system
pop
ds
; mask interrupt level in the interrupt controller register and store
; the original setting of the mask bit for the selected interrupt level
mov
cx,[bp+6]
; Get interrupt level
mov
bx,1
; Generate some masks
shl
bx,cl
mov
cx,bx
; cx has 1 in bit pos of int-level
not
bx
; bx has 0 in bit pos of int-level
in
al,maskm
; Get mask data from master chip
jmp
$+2
; Delay--wait for data transfer
and
cl,al
; Determine setting of mask bit
and
al,bl
; Enable interrupts for selected level
out
maskm,al
jmp
$+2
; Delay--wait for data transfer
in
al,masks
; Get mask data from slave chip
jmp
$+2
; Delay--wait for data transfer
and
ch,al
; Determine setting of mask bit
Содержание PC-DIO-96/PnP
Страница 46: ......
Страница 47: ......
Страница 48: ......
Страница 49: ......
Страница 50: ......
Страница 51: ......
Страница 52: ......
Страница 53: ......
Страница 54: ......
Страница 55: ......
Страница 56: ......
Страница 57: ......
Страница 58: ......
Страница 59: ......
Страница 60: ......
Страница 61: ......
Страница 63: ......
Страница 64: ......
Страница 65: ......
Страница 66: ......
Страница 67: ......
Страница 68: ......
Страница 69: ......
Страница 70: ......
Страница 71: ......
Страница 72: ......
Страница 73: ......