Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Basics of interrupt chaining? (Developers)

posted by myrkraverk, 13.12.2012, 19:39

Hi all,

There was a previous discussion about interrupt chaining here, but that just confused me more.

For context, I'm still programming the Sound Blaster, so I'm doing an IRQ 7 (for DOSBox) hardware interrupt handler.

What is the basic method of chaining an interrupt? From what I've gathered, I can't just place the segment:offset in registers and JMP, but have to store the IP and CS in memory (in this order) and then far jump by a pointer reference.

Or is CALL better?

Here is the code I've come up with for this. This is WASM btw in the tiny model, hence cs=ds.

Am I on the right track?


        ;; Load IRQ 7 handler.
        mov     ah, 0x37
        mov     al, 0x07        ; In DOSBox, the SB uses IRQ 7.
        int     0x21
        ;; Now es=code segment, bx=instruction pointer
        ;; And save in pointer
        mov     irq_handler, bx
        mov     irq_handler+2, es

        ;; Save our IRQ 7 handler
        lea     dx, sb_interrupt
        mov     cx, cs          ; redundant since ds
        mov     ds, cx          ; hasn't been modified
        mov     ah, 0x25
        mov     al, 0x07        ; again, redundant but explicit.
        int     0x21

; [snip]

        sb_interrupt proc
                jmp far ptr irq_handler

                irq_handler     dw      0,      0
        sb_interrupt    endp

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 243 users online (0 registered, 243 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum