Dwayne Reid wrote: > > > movf (INDF0 & 0xff), W > > > > > > Should be acceptable, but silent truncation is NEVER a good idea - > > > in any language. > > > >Then you'd have cumbersome and ugly syntax on almost every file > >register reference. Yuk. Since you'd have to AND the address with > >FFh most of the time, it might as well be understood that it will > >always be done automatically. > > the situation seems similar to dealing with the bank bits in the 14 > bit family. The warning message that comes up if I get an address > wrong lets me fix stupid mistakes right away and has saved many > hours of debugging time. > > Silently truncating values does seem a bit scary. Dwayne: Back when I wrote PIC code -- it seems like AGES ago -- my solution was to use macros like these (for the 14-bit PICs): MOVWF1 MACRO REG MOVWF (REG ^ 0X80) ENDM This removed the cumbersome and ugly syntax from my code and allowed me to define bank-1 registers with their complete addresses so my emulator watch windows would work properly. It's easy to look at register accesses between "BSF STATUS,PA0" and "BCF STATUS,PA0" instructions to make sure that they're all MOVWF1s rather than MOVWFs, and check that MOVWF rather than MOVWF1 is used outside of those bank-switch instruction pairs... Or, if you're too lazy to do that, and you're not doing anything particularly tricky in your code, you can add assemble-time flags to your bank-switch macros, then check those flags in the MOVWF1 macro. Note that I use XOR in my macro, rather than AND. This was deliberate; the XOR in the macro preserves the assembler's ability to catch mistakes that would be missed if it were an AND: If you accidentally misapply the macro to a register that ISN'T in bank one, the assembler produces a warning. -Andy === Andrew Warren -- aiw@cypress.com === Principal Design Engineer === Cypress Semiconductor Corporation === === Opinions expressed above do not === necessarily represent those of === Cypress Semiconductor Corporation -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body