Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!uw-beaver!ubc-vision!alberta!calgary!radford From: radford@calgary.UUCP Newsgroups: comp.arch Subject: Re: Interrupt vectors. Message-ID: <962@vaxb.calgary.UUCP> Date: Tue, 9-Jun-87 17:04:42 EDT Article-I.D.: vaxb.962 Posted: Tue Jun 9 17:04:42 1987 Date-Received: Sat, 13-Jun-87 04:23:07 EDT References: <7408@boring.cwi.nl> <2878@pyramid.UUCP> <19253@ucbvax.BERKELEY.EDU> <971@killer.UUCP> Organization: U. of Calgary, Calgary, Ab. Lines: 34 Keywords: interrupt handlers Summary: even easier to do on a 68000 In article <971@killer.UUCP>, jfh@killer.UUCP (John Haugh) writes: > yes, this is slower, so don't flame me for it, and besides, this code wasn't > my idea anyway ... > ... > now i write my trap routine. it figures out the vector number and > does a few other things > > trap: > movem.l #,-(sp) ; save those registers > mov.l 16(sp),d0 ; get the stack pc ... > sub.l #vectable, d0 ; ... and offset from ... > lsr.l #2,d0 ; ... and make it into an index! > mov.l usp,-(sp) ; stack user stack poiner for kicks > mov.l d0, -(sp) ; stack interupt number > jsr _trap ; call c trap routine > add.w #8,sp ; pop args > movem.l (sp)+,# ; those registers again... > add.w #4,sp ; waste some cycles ... > rte ; ... and poof - back you go. > > what is so horrible about this? (no, on second thought, don't answer that.) > for a cisc machine, i can't imagine doing any better. The easiest way is to store the vector number in the unused top eight bits of the interrupt vector address. Then you can have all interrupts go directly to the same place, do a jsr to the next instruction, and fetch the interrupt number from the stack. Before you flame about using the top eight bits of the PC this way, remember that this piece of code will be inherently incompatible with the 68020 whatever you do. Radford Neal