Thanks for the additional comments! On Thu, 17 Jul 1997 02:17:16 -0400 Mike Keitz writes: >On Wed, 16 Jul 1997 21:36:22 EDT Harold Hallikainen > writes: >Using gotos, calls, etc. in the ISR means saveContext needs to handle >PCLATH if you're using more than the first 2K code page (unless copies >of the routines are stored in the same place in every page). Highest code address is 0x01a7, so it doesn't look like that's the problem. > Also it >may be overflowing the stack, if the main program is doing a lot of >calling around or the ISR continues to call deeper and deeper. Since >these routines are almost certainly only called from one place, it may >work better to goto them, then go back to the next bit test when done >rather than return. This will save on stack space but not help the >PCLATH problem. I don't think this is the problem in that the new enableIRQ is at the same subroutine depth (one call from the main loop). It seems that if the problem were stack overflow, it would still be there. I would need to move UP a level to eliminate the problem. Here's another code fragment. wn0 ; Waiting for -DataRq to go low btfsc porta,4 ; test bit return ; if not yet low, return movfw hostReadAddressHi ; Set up RamPort address disableIRQ ; RamPort code not reentrant movwf ReadAddressHi movfw hostReadAddressLo movwf ReadAddressLo call ReadRamPort ;read it movfw ReadData ; get results ; enableIRQ ; OLD enable location... moved down a bit movwf wnData ; and save it iorlw 0xf0 ; Set high half so we don't make -DataAck low right away movwf porta ; Output the data enableIRQ ; Enable IRQ after outputting data in case IRQ messes up W (shouldn't!) bcf porta,5 ; Set -DataAck low incf wnState,1 ; Go wait for -DataRq to go high ; return wn1 ; Waiting for -dataRq to go high btfss porta,4 ; test bit return ; Exit if host has not yet taken nybble So... I got it working by moving the enableIRQ. BUT, it should've worked before, I think. I'd sure like to understand what's going on! Harold