---------- > From: Scott Dattalo > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: Question: C vs Asm > Date: Wednesday, April 12, 2000 10:24 AM > > On Wed, 12 Apr 2000, Walter Banks wrote: > > > > > Compilers can generate code sequences that are extremely difficult > > to maintain in assembler. For example, on the PIC's using the lsb of >> the PC to implement an unconditional skip the generated code >> sequence is address dependent.. > > Walter, > > Could you give us some examples where this may be useful? One example on the MPC compilers is the skip transformation when you have a skip instruction that is missing its compliment in the instruction set. A Skip followed by an unconditional skip transforms the pair into the compliment function of the first skip. Microchip PIC's do not have an unconditional skip so we created one by skipping on the lsb of the PC. The alternative is to use a goto but that may require ROM memory management. The unconditional skip is always a single word instruction and leaves memory management alone. The following code fragment illustrates the point. 0025 3328 TSTFSZ 28 if (i) 0026 9002 BTFSS PCL,0 0027 C02A GOTO 002Ah 0028 { 0028 0000 NOP NOP(); 0029 0000 NOP NOP(); } 002A 3328 TSTFSZ 28 if (i) 002B 9802 BTFSC PCL,0 002C C02F GOTO 002Fh 002D { 002D 0000 NOP NOP(); 002E 0000 NOP NOP(); } 002F 0002 RETURN } Walter Banks