Quantcast
Channel: x86 Assembly - Programmers Heaven
Viewing all articles
Browse latest Browse all 152

Need help getting Interrupt Routine to respond to IRQ.

$
0
0
I am looking for some help with a VERY simple little program I made for testing some new hardware. Basically I need to be able to respond to an interrupt and read a port (at least initially). I am not doing anything with the data, this is simply to test a new PC/104 IO board design. The problem is that I cannot get the damned PC to respond to the interrupt! If I directly read or write to the port I can get the data to go across the bus, so the port is correct... It just will not work from a hardware interrupt. The IRQ line is definitely being asserted, and after forcing a read the hardware immediately removes the IRQ.

Thanks in advance for any help,

Derek

Here is the whole thing (not much to it):

*************************************************************
title PC104 Test Program (PC104TST.ASM)

.model tiny

;

PC104int equ 0Dh ;Interrupt (IRQ 5)
;PC104int equ 72h ;Interrupt (IRQ 10)
PC104port equ 0320h ;Unused IO Port

.code
;code segment
; assume cs:code,ds:code

org 100h ; this is a COM program

start:
jmp setup ; jump to TSR installation routine

; Memory-resident code begins here

intr_handler proc far ; beginging of procedure
push ax ; save register
push dx ; save register

mov dx,PC104port ; place the IO port value in DX
in ax,dx ; get a word from IO port dx
out dx,ax ; send word back to the IO port dx
sti ; re-enable hardware interrupts

pop dx ; restore register
pop ax ; restore register
iret ; return to the system

intr_handler endp ; end of procedure
end_ISR label byte

; --------------- (end of TSR program) ------------------

setup:
mov dx,PC104port ; place the IO port value in DX
in ax,dx ; get a word from IO port dx

mov ah,25h ; 25h to "set interrupt vector"
mov al,PC104int ; interrupt to use
mov dx,offset intr_handler ; interrupt handler routine
int 21h ; set the interrupt vector

mov dx,offset end_ISR ; end of interrupt handler routine
int 27h ; terminate and stay resident

end start

*************************************************************

Viewing all articles
Browse latest Browse all 152

Trending Articles