At 03:53 PM 3/1/00 +1100, Tony Nixon wrote: >I changed the boot code like this > > org 0h > goto start > > org 4h > goto 0x0081 > >start ; boot code starts here > > > > >In your source code with no interrupts > > org 0x0080 > > ; your code begins > > >In your source code with interrupts > > org 0x0080 > > goto start > goto Interrupt ; or just put interrupt code here > ; causes extra 2 machine cycles each IRQ > ; for 1 extra goto instruction > >start ; your code begins Hi again, Tony. I'm somewhat reluctant to make the following suggestions for fear that I might be criticizing or coming off as a 'know it all' - I certainly am not. However, nothing ventured, nothing gained. That said, here goes. I now tend to structure my code as follows: org 0x00 goto ColdBoot org 0x04 ;save context and parse interrupts here ;here is where the parser lives - jump to appropriate ISR minimal ISR code here - if a routine is nice and short, it lives here. Otherwise, its located after any jump tables. ;jump tables live here ; blah blah blah ;actual ISRs live past the jump tables. ;subroutines live here ColdBoot ;start of code The rational is somewhat convoluted and may be flawed. 1) I don't perform any jumps when entering the ISR until the context is saved - on 4K and larger parts, PCLATH may be incorrect and you might be jumping to the wrong page. Thus, I save context, clear PCLATH, THEN jump to the appropriate routines. 2) I like to keep jump tables right near the beginning of ROM space because it means that I can set PCLATH with a single instruction that does not affect any flags (clrf PCLATH). This means that the actual ISR routines usually live past jump table space. There are always exceptions to the rule. In particular, if an ISR is very short and has to be quick, it goes before the jump tables. I'm interested in opinions and thoughts. dwayne Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax Celebrating 16 years of Engineering Innovation (1984 - 2000) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Do NOT send unsolicited commercial email to this email address. This message neither grants consent to receive unsolicited commercial email nor is intended to solicit commercial email.