A0922A9DEBBAA3B5822389C2 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
snipped-for-privacy@aol.com wrote:
Li-ion battery charger in C 858 bytes of machine object code on a 68S08.
of memory.
than people making it easier for a compiler to maintain information on RAM allocation and reuse. Everytime a compiler has started it has a fresh look at how the code should be implemented this time. C compilers use the full instruction set. C compilers enforce instruction set usage including manufactures suggested practices and work arounds for silicon restrictions
that are not possible to maintain in hand written assembler.
Skip in a PIC used by compilers to avoid memory management to jump over a single instruction. Requires exact knowledge of the current instructions ROM address. The following code fragment shows an example of this at location 0088. BTFSS PCL,0 skips the next instruction if the LSbit of the LSbyte of the program counter is set. Remember that the program counter is updated before the bit is sampled
0087 A01C TLRD 0,1C 0088 9002 BTFSS PCL,0 0089 AB1C TABLRD 1,1,1C 008A 5C0A MOVPF 1C,WREGSame code sequence but the LSbit is a 0 this time
102C A01C TLRD 0,1C 102D 9802 BTFSC PCL,0 102E AB1C TABLRD 1,1,1C 102F 5C0A MOVPF 1C,WREGsome people use assembler there are many good reasons to use compiled code.
Each instruction of a processor is encoded in C, compiled and verified to generate one instruction. For example the following fragment from the Byte Craft Freescale RS08 compiler.
0165 BB 34 ADD $34 AC += page0; // ADD 0167 B9 34 ADC $34 AC = AC + CC.C + page0; // ADC 0169 B9 34 ADC $34 AC = AC + page0 + CC.C; 016B B0 34 SUB $34 AC = AC - page0; // SUB 016D B2 34 SBC $34 AC = AC - page0 - CC.C; // SBC 016F B1 34 CMP $34 (void) AC - page0; // CMP 0171 B8 34 EOR $34 AC ^= page0; // EOR 0173 BA 34 ORA $34 AC |= page0; // OR 0175 B4 34 AND $34 AC &= page0; // AND 0177 3B 34 00 DBNZ $34,$017A if (