Thanks for taking the time to post the explanation Andrew!:o) It's always good to hear from the oldtimers who learned their magic in the dawn of the PIC age! ;o) I understand your example but still find it amusing as in my ram_clear loops I tend to DEC the counters and test for the end, so a DECFSZ probably makes more sense to me, although I prefer a concrete test like >=X as you don't always need to clear all the ram. Either way it's extremely annoying to "read" a register and receive crap, then have to mask the unused bits out before you know what the register value is. Hopefully Microchip will stick to the convention that unused bits==0 now and when you read a register you get its darn value! :o) -Roman Andrew Warren wrote: > > Roman Black wrote: > > > So what happened to the Microchip convention that unused bits read > > as zeros??? > > Roman: > > The 16C505's FSR-register behavior (along with the datasheet's > description of it as "a 5-bit register") is left over from the 16C54. > > On that part, it made sense to hardwire the upper bits to 1, since it > allowed loops like this one, which clears all 16C54 RAM, to be short > and fast: > > MOVLW PORTA > MOVWF FSR > > LOOP: > > CLRF INDF > INCFSZ FSR > GOTO LOOP > > If the upper bits were hardwired to 0, INCFSZ would cease to work on > the FSR register, so the above loop would have to become: > > LOOP: > > CLRF INDF > INCF FSR > TSTF FSR > SKPZ > GOTO LOOP > > It's not a BIG deal... But I guess the guys who'd been contracted to > design the PIC figured that, since it didn't cost anything to > hardwire those bits to 1, it was better not to break the INCFSZ > instruction. Also, if the larger-RAM PICs that the C54's designers > had anticipated had been designed with contiguously-addressed RAM, > hardwiring the upper bits to 1 would have made code portable from the > 54 to other PICs. > > -Andy > > === Andrew Warren --- aiw@cypress.com > === IPD Systems Engineering, CYSD > === Cypress Semiconductor Corporation > === > === Opinions expressed above do not > === necessarily represent those of > === Cypress Semiconductor Corporation > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body