Chapter 4
Register-Level Programming
© National Instruments Corporation
4-25
PC-DIO-96 User Manual
mov ax,[bp+8] ; Get ofs into ax
mov word ptr isrb_addr[0],ax ; Save address in variable
mov ax,[bp+10] ; Get seg into ax
mov word ptr isrb_addr[2],ax ; Save address in variable
; set interrupt vector--save the current vector before writing out new one
mov ax,[bp+6] ; Get interrupt level
cmp al,7 ; Check to see if it belongs to master
ja short slave ; or slave interrupt chip
add al,008h ; Offset for master vector list
jmp short setvec ; Go set the vector
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
and al,bh ; Enable interrupts for selected level
out masks,al
mov int_mask,cx ; Save the previous value of the mask
Summary of Contents for PC-DIO-96
Page 71: ...OKI 82C55A Data Sheet Appendix B PC DIO 96 User Manual B 2 National Instruments Corporation...
Page 72: ...Appendix B OKI 82C55A Data Sheet National Instruments Corporation B 3 PC DIO 96 User Manual...
Page 73: ...OKI 82C55A Data Sheet Appendix B PC DIO 96 User Manual B 4 National Instruments Corporation...
Page 74: ...Appendix B OKI 82C55A Data Sheet National Instruments Corporation B 5 PC DIO 96 User Manual...
Page 75: ...OKI 82C55A Data Sheet Appendix B PC DIO 96 User Manual B 6 National Instruments Corporation...
Page 76: ...Appendix B OKI 82C55A Data Sheet National Instruments Corporation B 7 PC DIO 96 User Manual...
Page 77: ...OKI 82C55A Data Sheet Appendix B PC DIO 96 User Manual B 8 National Instruments Corporation...
Page 78: ...Appendix B OKI 82C55A Data Sheet National Instruments Corporation B 9 PC DIO 96 User Manual...
Page 79: ...OKI 82C55A Data Sheet Appendix B PC DIO 96 User Manual B 10 National Instruments Corporation...
Page 80: ...Appendix B OKI 82C55A Data Sheet National Instruments Corporation B 11 PC DIO 96 User Manual...
Page 81: ...OKI 82C55A Data Sheet Appendix B PC DIO 96 User Manual B 12 National Instruments Corporation...
Page 82: ...Appendix B OKI 82C55A Data Sheet National Instruments Corporation B 13 PC DIO 96 User Manual...
Page 83: ...OKI 82C55A Data Sheet Appendix B PC DIO 96 User Manual B 14 National Instruments Corporation...
Page 84: ...Appendix B OKI 82C55A Data Sheet National Instruments Corporation B 15 PC DIO 96 User Manual...
Page 85: ...OKI 82C55A Data Sheet Appendix B PC DIO 96 User Manual B 16 National Instruments Corporation...
Page 86: ...Appendix B OKI 82C55A Data Sheet National Instruments Corporation B 17 PC DIO 96 User Manual...
Page 88: ...AMD 8253 Data Sheet Appendix C PC DIO 96 User Manual C 2 National Instruments Corporation...
Page 89: ...Appendix C AMD 8253 Data Sheet National Instruments Corporation C 3 PC DIO 96 User Manual...
Page 90: ...AMD 8253 Data Sheet Appendix C PC DIO 96 User Manual C 4 National Instruments Corporation...
Page 91: ...Appendix C AMD 8253 Data Sheet National Instruments Corporation C 5 PC DIO 96 User Manual...
Page 92: ...AMD 8253 Data Sheet Appendix C PC DIO 96 User Manual C 6 National Instruments Corporation...
Page 93: ...Appendix C AMD 8253 Data Sheet National Instruments Corporation C 7 PC DIO 96 User Manual...
Page 94: ...AMD 8253 Data Sheet Appendix C PC DIO 96 User Manual C 8 National Instruments Corporation...
Page 95: ...Appendix C AMD 8253 Data Sheet National Instruments Corporation C 9 PC DIO 96 User Manual...
Page 96: ...AMD 8253 Data Sheet Appendix C PC DIO 96 User Manual C 10 National Instruments Corporation...
Page 97: ...Appendix C AMD 8253 Data Sheet National Instruments Corporation C 11 PC DIO 96 User Manual...
Page 98: ...AMD 8253 Data Sheet Appendix C PC DIO 96 User Manual C 12 National Instruments Corporation...
Page 99: ...Appendix C AMD 8253 Data Sheet National Instruments Corporation C 13 PC DIO 96 User Manual...
Page 100: ...AMD 8253 Data Sheet Appendix C PC DIO 96 User Manual C 14 National Instruments Corporation...