1. Re: including ISR in euphoria program

to Robert Craig,

As I'm writing an include file to play wave file on sound blaster card
I'm stock with a bug regarding the interrupt service routine. it's
doesn't work.
I need to known if ISR are running in protected mode or real, or virtual
mode
Here is my ISR code.

****************           DSP_INT.E   *********************************
-- DSP_INT.E     is interrupt code
-- to include in playwave.e

constant END_OF_INT = #20  -- end of interrupt command for PIC
global constant PIC1_MASK_REG = #21  -- mask register I/O port for PIC 1
global constant PIC2_MASK_REG = #A1  -- mask register I/O port for PIC 2
global constant PIC1_MODE = #20  -- interrupt mode register I/O port for
PIC 1
global constant PIC2_MODE = #A0  -- interrupt mode register I/O port for
PIC 2

sequence ISRCode

-- 1) increment dMA_END flag to inform euphoria code that transfert is
complete
-- 2) reset DSP interrupt flag
-- 3) reset interrupt controller (master and slave PIC)

ISRCode = {
     #50,                    --    PUSH AX
     #52,                    --    PUSH DX
     #FE,#06,#00,#26,        --    INC  [DoneFlag]    ; transfert ended
     #8B,#16,#00,#23,        --    MOV DX, [BASE_IO]
     #83,#C2,#0E,            --    ADD DX, 0E        ; DSP_READ_STATUS
     #EC,                    --    IN AL, DX
     #BA,#00,#20,            --    MOV DX, PIC1_MODE  ; master pic
address
     #B0,#20,                --    MOV AL, END_OF_INT
     #EE,                    --    OUT DX, AL         ;send EOI to
master PIC
     #80,#3E,#00,#25,#07,    --    CMP [IRQ_NB], 7
     #76,#04,                --    JBE @SORTIE
     #BA,#00,#A0,            --    MOV DX, PIC2_MODE  ;slave pic address
     #EE,                    --    OUT DX, AL         ;send EOI to slave
PIC
                          -- @SORTIE:
     #5A,                     --   POP DX
     #58,                     --   POP AX
     #FB,                     --   STI   ;enable interrupt
     #CF,                     --   IRET
     #00,#00,             --  BASE_IO DW 0
     #00,                 --  IRQ_NB  DB 0
     #00                  --  DoneFlag DB 0
     } -- ISRCode

global atom pEND_FLAG, pIRQ_NB, pBASE_IO

     pEND_FLAG = length(ISRCode) - 1 -- flag end of play modified by ISR
     pIRQ_NB = length(ISRCode) - 2   -- store interrupt number
     pBASE_IO = length(ISRCode) - 3  -- store DSP base I/O port

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu