Path: utzoo!attcan!uunet!know!cs.utexas.edu!hellgate.utah.edu!peruvian.utah.edu!msmith From: msmith%peruvian.utah.edu@cs.utah.edu (Matthew Smith) Newsgroups: comp.os.msdos.programmer Subject: Re: Need info on 286/386 exceptions and int handling under DOS Message-ID: <1990Oct10.134728.20403@hellgate.utah.edu> Date: 10 Oct 90 19:47:28 GMT References: <1990Oct10.163006.8081@Octopus.COM> Organization: University of Utah CS Dept Lines: 36 In article <1990Oct10.163006.8081@Octopus.COM> stever@octopus.COM (Steve Resnick ) writes: >Heres's a good question for you PC guru types ... > >On 80286 and 80386 processors, int 12 is designated as a stack fault exception. >So far so good. Also on PC's in general, IRQ4 is designated as the default >interrupt for COM1. Since IRQ int numbers are IRQ += 8, IRQ4 becomes int 12 >also. My question is, how does the system determine what interrupt to vector >where and how are "separate" interrupt vectors defined? I have some serial >code which needs to tweek int vectors from time to time. The code is all >there to handle the serial interrupts, but there is no vector chaining >being done. I can force an int 12 by mov'ing 0 into SP and pushing AX onto >the stack, and I get my default "stack fault exception" message. What magic >is being done here? > >Thanx, in advance.... > >Steve > There is a "vector interrupt table" somewhere in lowest memory (the exact location eludes me at the moment), and it contains 255 pointers each pointing to a piece of code that it jumps to when that particular interrupt is generated. You can change the place that a pointer points to via DOS interrupt functions get/set vector (I believe 25h is set vector). Some languages offer those functions built in as commands. For example, TurboC has get_vector() which returns a pointer to where the interrupt points to, and set_vector() which takes an integer of the interrupt and a pointer to a function and it sets that interrupt to your function. BTW, on INT 12, you need to enable the IMR mask for the 8259 chip to allow interrupts on Com1 and Com2. This is done by changing the 3rd and 4th bits of port 21h to 1 (3 for com2, 4 for com1) to enable that particular port. Matt Smith msmith@cs.utah.edu