Isaac Marino Bavaresco wrote 2012-08-29 16:04: > The instruction 'MOVF' has only room for 8 bits of the address. The > other bits are obtained from the BSR register. > > So your "movf 0x240,w" will generate the exactly same binary encoding > than a "movf 0x40,w". I think the assembler will give a warning saying > that some bits of the address will be ignored (or at least it should). > I do not think it either does or should. :-) When you are allocating memory using UDATA and RES, you always gets symbols with full adresses. If not, the BANKSEL would not work on any self-allocated variables, BANKSEL would not be able to calculate the actual bank. And you would get *a lot* of warnings also... :-) Jan-Erik. > > Best regards, > > Isaac > > > > > Em 29/8/2012 10:21, Nathan House escreveu: >> I'm learning to program a PIC18 using assembly language and am curious >> why there seems to be some redundancy with many instructions. Take the >> MOVF instruction, for example: >> >> MOVLB 0x2 ;select bank 2 >> MOVF 0x240, W ;move the value at 0x240 to W >> >> If my understanding is correct, then the "2" digit in the MOVF >> instruction is ignored completely, making it redundant since the bank >> is selected above. From what I've read, it seems that the assembler >> automatically sets the access "a" bit based on the address when >> translating to machine code, so what I'm wondering is why the >> assembler doesn't automatically generate bank select instructions as >> well? >> >> Thanks! >> >> Nathan >> > --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .