-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 source= http://www.piclist.com/piclist/2003/09/10/074104a.txt? Thanks all for the comments. Part of my confusion was that I did not pay attention to the difference between figure 2-3 and 2-4. The large parts, '876 '877, do map '70 -'7F in common and it seems proper to allocate the save frame in that area. The '874 part only maps PCL, STATUS, FSR, PCLATH, and INTCON across the banks. No General Purpose registers are mapped across. (I have not looked at the '-A' datasheet, but my samples are in now, and maybe it is time ... Who knows? perhaps it is all fixed. ) My experience with a PIC is new, but I have mature assembly experience. I will make a .o file with the context save code, put it in a library, and modify the .lkr file to put this in the memory that I want. On the 16F874 part that I am using, I have modified the START definition of gpr1 so that the address 0xA0 is never allocated. When this code is stable, tested, and edited for clarity I'll put it on my Web page. The ideas are sketched out here: in Application.asm GLOBAL Hook RESET CODE H'000' ; ORG 0x000 ; processor reset vector goto Main ; go to beginning of program BODY CODE Hook ;handle the IRQs return ;to the middle of the context save restore at 004 - ---- in IRQContext.asm EXTERN Hook INTERRUPT CODE H'004' ; ORG 0x004 ; interrupt vector location movwf w_temp ; save off current W register contents ... call Hook ... restore and retfie project.lkr SECTION NAME=RESET ROM=vectors SECTION NAME=INTERRUPT ROM=vectors DATABANK NAME=gpr1 START=0xA1 END=0xFF //Does 0x20 & 0xA0 map together? My concern is that the template and code examples are misleading. From the responses, I gather that the consensus is emerging that 1) indeed the '874 '877 distinction is subtle, 2) the register support on the '874 is too weak and incorrectly documented, 3) there are some fixes at either code writing time or linker time (if using relocatable code). The question that follows this is : what is the procedure to submit a correction recommendation to Microchip? Also, if the "-A" part fixes this, I'll just move on ... ******** B. Pearce wrote: >Well as he is using a 16F87x it is better to have it saved in the >0x70-0x7f region where the same ram is shared between all banks. Then >it does not matter which bank you are in on interrupt entry. He's apparently using a 16F873 or 16F874. According to the datasheet, there is no shared ram between Bank 0 and Bank 1. I have wondered the same question about how to properly save context on these particular chips. michael brown - --- Aubrey McIntosh http://www.piclist.com/member/AM-vima-Y84 PIC/PICList FAQ: http://www.piclist.com -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 7.0.3 for non-commercial use iQA/AwUBP181YAKlSw8yssF7EQII5QCgtSzll2lkuo2YmIPcOwrrLVxhHNkAnAr8 sn/BtN3ibfq4i4mRqoKKLUpq =gfOb -----END PGP SIGNATURE----- -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics