* 721 Berkeley St.
* Kent, Ohio 44240
*
- * 28-Oct-97 JLH:
- * - outsym: show s_id as string rather than array [NCPS]
+ * 28-Oct-97 JLH:
+ * - outsym: show s_id as string rather than array [NCPS]
* - Added outr11 to support 8051's 11 bit destination address
*/
#include "asm.h"
-/*)Module asout.c
+/*)Module asout.c
*
- * The module asout.c contains all the functions used to
- * generate the .REL assembler output file.
+ * The module asout.c contains all the functions used to
+ * generate the .REL assembler output file.
*
*
- * The assemblers' output object file is an ascii file containing
- * the information needed by the linker to bind multiple object
- * modules into a complete loadable memory image.
+ * The assemblers' output object file is an ascii file containing
+ * the information needed by the linker to bind multiple object
+ * modules into a complete loadable memory image.
*
- * The object module contains the following designators:
+ * The object module contains the following designators:
*
- * [XDQ][HL]
- * X Hexadecimal radix
- * D Decimal radix
- * Q Octal radix
- *
- * H Most significant byte first
- * L Least significant byte first
- *
- * H Header
- * M Module
- * A Area
- * S Symbol
- * T Object code
- * R Relocation information
- * P Paging information
+ * [XDQ][HL]
+ * X Hexadecimal radix
+ * D Decimal radix
+ * Q Octal radix
*
+ * H Most significant byte first
+ * L Least significant byte first
*
- * (1) Radix Line
+ * H Header
+ * M Module
+ * A Area
+ * S Symbol
+ * T Object code
+ * R Relocation information
+ * P Paging information
*
- * The first line of an object module contains the [XDQ][HL]
- * format specifier (i.e. XH indicates a hexadecimal file with
- * most significant byte first) for the following designators.
*
+ * (1) Radix Line
*
- * (2) Header Line
+ * The first line of an object module contains the [XDQ][HL]
+ * format specifier (i.e. XH indicates a hexadecimal file with
+ * most significant byte first) for the following designators.
*
- * H aa areas gg global symbols
*
- * The header line specifies the number of areas(aa) and the
- * number of global symbols(gg) defined or referenced in this ob-
- * ject module segment.
+ * (2) Header Line
*
+ * H aa areas gg global symbols
*
- * (3) Module Line
+ * The header line specifies the number of areas(aa) and the
+ * number of global symbols(gg) defined or referenced in this ob-
+ * ject module segment.
*
- * M name
*
- * The module line specifies the module name from which this
- * header segment was assembled. The module line will not appear
- * if the .module directive was not used in the source program.
+ * (3) Module Line
*
+ * M name
*
- * (4) Symbol Line
+ * The module line specifies the module name from which this
+ * header segment was assembled. The module line will not appear
+ * if the .module directive was not used in the source program.
*
- * S string Defnnnn
*
- * or
+ * (4) Symbol Line
*
- * S string Refnnnn
+ * S string Defnnnn
*
- * The symbol line defines (Def) or references (Ref) the symbol
- * 'string' with the value nnnn. The defined value is relative to
- * the current area base address. References to constants and ex-
- * ternal global symbols will always appear before the first area
- * definition. References to external symbols will have a value of
- * zero.
+ * or
*
+ * S string Refnnnn
*
- * (5) Area Line
+ * The symbol line defines (Def) or references (Ref) the symbol
+ * 'string' with the value nnnn. The defined value is relative to
+ * the current area base address. References to constants and ex-
+ * ternal global symbols will always appear before the first area
+ * definition. References to external symbols will have a value of
+ * zero.
*
- * A label size ss flags ff
*
- * The area line defines the area label, the size (ss) of the
- * area in bytes, and the area flags (ff). The area flags specify
- * the ABS, REL, CON, OVR, and PAG parameters:
+ * (5) Area Line
*
- * OVR/CON (0x04/0x00 i.e. bit position 2)
+ * A label size ss flags ff
*
- * ABS/REL (0x08/0x00 i.e. bit position 3)
+ * The area line defines the area label, the size (ss) of the
+ * area in bytes, and the area flags (ff). The area flags specify
+ * the ABS, REL, CON, OVR, and PAG parameters:
*
- * PAG (0x10 i.e. bit position 4)
+ * OVR/CON (0x04/0x00 i.e. bit position 2)
*
+ * ABS/REL (0x08/0x00 i.e. bit position 3)
*
- * (6) T Line
+ * PAG (0x10 i.e. bit position 4)
*
- * T xx xx nn nn nn nn nn ...
*
- * The T line contains the assembled code output by the assem-
- * bler with xx xx being the offset address from the current area
- * base address and nn being the assembled instructions and data in
- * byte format.
+ * (6) T Line
*
+ * T xx xx nn nn nn nn nn ...
*
- * (7) R Line
+ * The T line contains the assembled code output by the assem-
+ * bler with xx xx being the offset address from the current area
+ * base address and nn being the assembled instructions and data in
+ * byte format.
*
- * R 0 0 nn nn n1 n2 xx xx ...
*
- * The R line provides the relocation information to the linker.
- * The nn nn value is the current area index, i.e. which area the
- * current values were assembled. Relocation information is en-
- * coded in groups of 4 bytes:
+ * (7) R Line
*
- * 1. n1 is the relocation mode and object format
- * 1. bit 0 word(0x00)/byte(0x01)
- * 2. bit 1 relocatable area(0x00)/symbol(0x02)
- * 3. bit 2 normal(0x00)/PC relative(0x04) relocation
- * 4. bit 3 1-byte(0x00)/2-byte(0x08) object format for
- * byte data
- * 5. bit 4 signed(0x00)/unsigned(0x10) byte data
- * 6. bit 5 normal(0x00)/page '0'(0x20) reference
- * 7. bit 6 normal(0x00)/page 'nnn'(0x40) reference
- * 8. bit 7 normal(0x00)/MSB of value
+ * R 0 0 nn nn n1 n2 xx xx ...
*
- * 2. n2 is a byte index into the corresponding (i.e. pre-
- * ceeding) T line data (i.e. a pointer to the data to be
- * updated by the relocation). The T line data may be
- * 1-byte or 2-byte byte data format or 2-byte word
- * format.
+ * The R line provides the relocation information to the linker.
+ * The nn nn value is the current area index, i.e. which area the
+ * current values were assembled. Relocation information is en-
+ * coded in groups of 4 bytes:
*
- * 3. xx xx is the area/symbol index for the area/symbol be-
- * ing referenced. the corresponding area/symbol is found
- * in the header area/symbol lists.
+ * 1. n1 is the relocation mode and object format
+ * 1. bit 0 word(0x00)/byte(0x01)
+ * 2. bit 1 relocatable area(0x00)/symbol(0x02)
+ * 3. bit 2 normal(0x00)/PC relative(0x04) relocation
+ * 4. bit 3 1-byte(0x00)/2-byte(0x08) object format for
+ * byte data
+ * 5. bit 4 signed(0x00)/unsigned(0x10) byte data
+ * 6. bit 5 normal(0x00)/page '0'(0x20) reference
+ * 7. bit 6 normal(0x00)/page 'nnn'(0x40) reference
+ * 8. bit 7 normal(0x00)/MSB of value
*
+ * 2. n2 is a byte index into the corresponding (i.e. pre-
+ * ceeding) T line data (i.e. a pointer to the data to be
+ * updated by the relocation). The T line data may be
+ * 1-byte or 2-byte byte data format or 2-byte word
+ * format.
*
- * The groups of 4 bytes are repeated for each item requiring relo-
- * cation in the preceeding T line.
+ * 3. xx xx is the area/symbol index for the area/symbol be-
+ * ing referenced. the corresponding area/symbol is found
+ * in the header area/symbol lists.
*
*
- * (8) P Line
+ * The groups of 4 bytes are repeated for each item requiring relo-
+ * cation in the preceeding T line.
*
- * P 0 0 nn nn n1 n2 xx xx
*
- * The P line provides the paging information to the linker as
- * specified by a .setdp directive. The format of the relocation
- * information is identical to that of the R line. The correspond-
- * ing T line has the following information:
- * T xx xx aa aa bb bb
+ * (8) P Line
*
- * Where aa aa is the area reference number which specifies the
- * selected page area and bb bb is the base address of the page.
- * bb bb will require relocation processing if the 'n1 n2 xx xx' is
- * specified in the P line. The linker will verify that the base
- * address is on a 256 byte boundary and that the page length of an
- * area defined with the PAG type is not larger than 256 bytes.
+ * P 0 0 nn nn n1 n2 xx xx
*
- * The linker defaults any direct page references to the first
- * area defined in the input REL file. All ASxxxx assemblers will
- * specify the _CODE area first, making this the default page area.
+ * The P line provides the paging information to the linker as
+ * specified by a .setdp directive. The format of the relocation
+ * information is identical to that of the R line. The correspond-
+ * ing T line has the following information:
+ * T xx xx aa aa bb bb
*
+ * Where aa aa is the area reference number which specifies the
+ * selected page area and bb bb is the base address of the page.
+ * bb bb will require relocation processing if the 'n1 n2 xx xx' is
+ * specified in the P line. The linker will verify that the base
+ * address is on a 256 byte boundary and that the page length of an
+ * area defined with the PAG type is not larger than 256 bytes.
*
- * asout.c contains the following functions:
- * int lobyte()
- * int hibyte()
- * VOID out()
- * VOID outab()
- * VOID outall()
- * VOID outarea()
- * VOID outaw()
- * VOID outbuf()
- * VOID outchk()
- * VOID outdot()
- * VOID outdp()
- * VOID outgsd()
- * VOID outrb()
- * VOID outrw()
- * VOID outsym()
- * VOID out_lb()
- * VOID out_lw()
- * VOID out_rw()
- * VOID out_tw()
+ * The linker defaults any direct page references to the first
+ * area defined in the input REL file. All ASxxxx assemblers will
+ * specify the _CODE area first, making this the default page area.
*
- * The module asout.c contains the following local variables:
- * int rel[] relocation data for code/data array
- * int * relp pointer to rel array
- * int txt[] assembled code/data array
- * int * txtp pointer to txt array
+ *
+ * asout.c contains the following functions:
+ * int lobyte()
+ * int hibyte()
+ * VOID out()
+ * VOID outab()
+ * VOID outall()
+ * VOID outarea()
+ * VOID outaw()
+ * VOID outbuf()
+ * VOID outchk()
+ * VOID outdot()
+ * VOID outdp()
+ * VOID outgsd()
+ * VOID outrb()
+ * VOID outrw()
+ * VOID outsym()
+ * VOID out_lb()
+ * VOID out_lw()
+ * VOID out_rw()
+ * VOID out_tw()
+ *
+ * The module asout.c contains the following local variables:
+ * int rel[] relocation data for code/data array
+ * int * relp pointer to rel array
+ * int txt[] assembled code/data array
+ * int * txtp pointer to txt array
*/
-#define NTXT 16
-#define NREL 16
+#define NTXT 16
+#define NREL 16
-char txt[NTXT];
-char rel[NREL];
+char txt[NTXT];
+char rel[NREL];
-char *txtp = { &txt[0] };
-char *relp = { &rel[0] };
+char *txtp = { &txt[0] };
+char *relp = { &rel[0] };
-/*)Function VOID outab(b)
+/*)Function VOID outab(b)
*
- * int b assembler data word
+ * int b assembler data word
*
- * The function outab() processes a single word of
- * assembled data in absolute format.
+ * The function outab() processes a single word of
+ * assembled data in absolute format.
*
- * local variables:
- * int * txtp pointer to data word
+ * local variables:
+ * int * txtp pointer to data word
*
- * global variables:
- * int oflag -o, generate relocatable output flag
- * int pass assembler pass number
+ * global variables:
+ * int oflag -o, generate relocatable output flag
+ * int pass assembler pass number
*
- * functions called:
- * VOID outchk() asout.c
- * VOID out_lb() asout.c
+ * functions called:
+ * VOID outchk() asout.c
+ * VOID out_lb() asout.c
*
- * side effects:
- * The current assembly address is incremented by 1.
+ * side effects:
+ * The current assembly address is incremented by 1.
*/
VOID
outab(b)
{
- if (pass == 2) {
- out_lb(b,0);
- if (oflag) {
- outchk(1, 0);
- *txtp++ = lobyte(b);
- }
- }
- ++dot.s_addr;
+ if (pass == 2) {
+ out_lb(b,0);
+ if (oflag) {
+ outchk(1, 0);
+ *txtp++ = lobyte(b);
+ }
+ }
+ ++dot.s_addr;
}
-/*)Function VOID outaw(w)
+/*)Function VOID outaw(w)
*
- * int w assembler data word
+ * int w assembler data word
*
- * The function outaw() processes a single word of
- * assembled data in absolute format.
+ * The function outaw() processes a single word of
+ * assembled data in absolute format.
*
- * local variables:
- * int * txtp pointer to data word
+ * local variables:
+ * int * txtp pointer to data word
*
- * global variables:
- * int oflag -o, generate relocatable output flag
- * int pass assembler pass number
+ * global variables:
+ * int oflag -o, generate relocatable output flag
+ * int pass assembler pass number
*
- * functions called:
- * VOID outchk() asout.c
- * VOID out_lw() asout.c
+ * functions called:
+ * VOID outchk() asout.c
+ * VOID out_lw() asout.c
*
- * side effects:
- * The current assembly address is incremented by 2.
+ * side effects:
+ * The current assembly address is incremented by 2.
*/
VOID
outaw(w)
{
- if (pass == 2) {
- out_lw(w,0);
- if (oflag) {
- outchk(2, 0);
- out_tw(w);
- }
- }
- dot.s_addr += 2;
+ if (pass == 2) {
+ out_lw(w,0);
+ if (oflag) {
+ outchk(2, 0);
+ out_tw(w);
+ }
+ }
+ dot.s_addr += 2;
}
-/*)Function VOID write_rmode(r)
+/*)Function VOID write_rmode(r)
*
- * int r relocation mode
+ * int r relocation mode
*
- * write_rmode puts the passed relocation mode into the
- * output relp buffer, escaping it if necessary.
+ * write_rmode puts the passed relocation mode into the
+ * output relp buffer, escaping it if necessary.
*
- * global variables:
- * int * relp pointer to rel array
+ * global variables:
+ * int * relp pointer to rel array
*
- * functions called:
- * VOID rerr() assubr.c
+ * functions called:
+ * VOID rerr() assubr.c
*
- * side effects:
- * relp is incremented appropriately.
+ * side effects:
+ * relp is incremented appropriately.
*/
VOID
write_rmode(int r)
*/
if ((r > 0xff) || ((r & R_ESCAPE_MASK) == R_ESCAPE_MASK))
{
- /* Hack in up to an extra 4 bits of flags with escape. */
- if (r > 0xfff)
- {
- /* uh-oh.. we have more than 4 extra bits. */
- fprintf(stderr,
- "Internal error: relocation mode 0x%X too big.\n",
- r);
- rerr();
- }
- /* printf("escaping relocation mode\n"); */
- *relp++ = R_ESCAPE_MASK | (r >> 8);
- *relp++ = r & 0xff;
+ /* Hack in up to an extra 4 bits of flags with escape. */
+ if (r > 0xfff)
+ {
+ /* uh-oh.. we have more than 4 extra bits. */
+ fprintf(stderr,
+ "Internal error: relocation mode 0x%X too big.\n",
+ r);
+ rerr();
+ }
+ /* printf("escaping relocation mode\n"); */
+ *relp++ = R_ESCAPE_MASK | (r >> 8);
+ *relp++ = r & 0xff;
}
else
{
- *relp++ = r;
+ *relp++ = r;
}
}
-/*)Function VOID outrb(esp, r)
- *
- * expr * esp pointer to expr structure
- * int r relocation mode
- *
- * The function outrb() processes a byte of generated code
- * in either absolute or relocatable format dependent upon
- * the data contained in the expr structure esp. If the
- * .REL output is enabled then the appropriate information
- * is loaded into the txt and rel buffers.
- *
- * local variables:
- * int n symbol/area reference number
- * int * relp pointer to rel array
- * int * txtp pointer to txt array
- *
- * global variables:
- * sym dot defined as sym[0]
- * int oflag -o, generate relocatable output flag
- * int pass assembler pass number
- *
- * functions called:
- * VOID aerr() assubr.c
- * VOID outchk() asout.c
- * VOID out_lb() asout.c
- * VOID out_rb() asout.c
- * VOID out_tb() asout.c
- *
- * side effects:
- * The current assembly address is incremented by 1.
+/*)Function VOID outrb(esp, r)
+ *
+ * expr * esp pointer to expr structure
+ * int r relocation mode
+ *
+ * The function outrb() processes a byte of generated code
+ * in either absolute or relocatable format dependent upon
+ * the data contained in the expr structure esp. If the
+ * .REL output is enabled then the appropriate information
+ * is loaded into the txt and rel buffers.
+ *
+ * local variables:
+ * int n symbol/area reference number
+ * int * relp pointer to rel array
+ * int * txtp pointer to txt array
+ *
+ * global variables:
+ * sym dot defined as sym[0]
+ * int oflag -o, generate relocatable output flag
+ * int pass assembler pass number
+ *
+ * functions called:
+ * VOID aerr() assubr.c
+ * VOID outchk() asout.c
+ * VOID out_lb() asout.c
+ * VOID out_rb() asout.c
+ * VOID out_tb() asout.c
+ *
+ * side effects:
+ * The current assembly address is incremented by 1.
*/
VOID
outrb(struct expr *esp, int r)
{
- register int n;
-
- if (pass == 2) {
- if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
- /* This is a constant; simply write the
- * const byte to the T line and don't
- * generate any relocation info.
- */
- out_lb(lobyte(esp->e_addr),0);
- if (oflag) {
- outchk(1, 0);
- *txtp++ = lobyte(esp->e_addr);
- }
- } else {
- /* We are generating a single byte of relocatable
- * info.
- *
- * In 8051 mode, we generate a 16 bit address. The
- * linker will later select a single byte based on
- * whether R_MSB is set.
- *
- * In flat24 mode, we generate a 24 bit address. The
- * linker will select a single byte based on
- * whether R_MSB or R_HIB is set.
- */
- if (!flat24Mode)
- {
- r |= R_BYTE | R_BYT2 | esp->e_rlcf;
- if (r & R_MSB) {
- out_lb(hibyte(esp->e_addr),r|R_RELOC|R_HIGH);
- } else {
- out_lb(lobyte(esp->e_addr),r|R_RELOC);
- }
- if (oflag) {
- outchk(2, 5);
- out_tw(esp->e_addr);
- if (esp->e_flag) {
- n = esp->e_base.e_sp->s_ref;
- r |= R_SYM;
- } else {
- n = esp->e_base.e_ap->a_ref;
- }
- write_rmode(r);
- *relp++ = txtp - txt - 2;
- out_rw(n);
- }
- }
- else
- {
- /* 24 bit mode. */
- r |= R_BYTE | R_BYT3 | esp->e_rlcf;
- if (r & R_HIB)
- {
- /* Probably should mark this differently in the
- * listing file.
- */
- out_lb(byte3(esp->e_addr),r|R_RELOC|R_HIGH);
- }
- else if (r & R_MSB) {
- out_lb(hibyte(esp->e_addr),r|R_RELOC|R_HIGH);
- } else {
- out_lb(lobyte(esp->e_addr),r|R_RELOC);
- }
- if (oflag) {
- outchk(3, 5);
- out_t24(esp->e_addr);
- if (esp->e_flag) {
- n = esp->e_base.e_sp->s_ref;
- r |= R_SYM;
- } else {
- n = esp->e_base.e_ap->a_ref;
- }
- write_rmode(r);
- *relp++ = txtp - txt - 3;
- out_rw(n);
- }
- }
- }
- }
- ++dot.s_addr;
+ register int n;
+
+ if (pass == 2) {
+ if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
+ /* This is a constant; simply write the
+ * const byte to the T line and don't
+ * generate any relocation info.
+ */
+ out_lb(lobyte(esp->e_addr),0);
+ if (oflag) {
+ outchk(1, 0);
+ *txtp++ = lobyte(esp->e_addr);
+ }
+ } else {
+ /* We are generating a single byte of relocatable
+ * info.
+ *
+ * We generate a 24 bit address. The linker will
+ * select a single byte based on whether R_MSB or
+ * R_HIB is set.
+ */
+ {
+ /* 24 bit mode. */
+ r |= R_BYTE | R_BYT3 | esp->e_rlcf;
+ if (r & R_HIB)
+ {
+ /* Probably should mark this differently in the
+ * listing file.
+ */
+ out_lb(byte3(esp->e_addr),r|R_RELOC|R_HIGH);
+ }
+ else if (r & R_MSB) {
+ out_lb(hibyte(esp->e_addr),r|R_RELOC|R_HIGH);
+ } else {
+ out_lb(lobyte(esp->e_addr),r|R_RELOC);
+ }
+ if (oflag) {
+ outchk(3, 5);
+ out_t24(esp->e_addr);
+ if (esp->e_flag) {
+ n = esp->e_base.e_sp->s_ref;
+ r |= R_SYM;
+ } else {
+ n = esp->e_base.e_ap->a_ref;
+ }
+ write_rmode(r);
+ *relp++ = txtp - txt - 3;
+ out_rw(n);
+ }
+ }
+ }
+ }
+ ++dot.s_addr;
}
-/*)Function VOID outrw(esp, r)
- *
- * expr * esp pointer to expr structure
- * int r relocation mode
- *
- * The function outrw() processes a word of generated code
- * in either absolute or relocatable format dependent upon
- * the data contained in the expr structure esp. If the
- * .REL output is enabled then the appropriate information
- * is loaded into the txt and rel buffers.
- *
- * local variables:
- * int n symbol/area reference number
- * int * relp pointer to rel array
- * int * txtp pointer to txt array
- *
- * global variables:
- * sym dot defined as sym[0]
- * int oflag -o, generate relocatable output flag
- * int pass assembler pass number
- *
- * functions called:
- * VOID aerr() assubr.c
- * VOID outchk() asout.c
- * VOID out_lw() asout.c
- * VOID out_rw() asout.c
- * VOID out_tw() asout.c
- *
- * side effects:
- * The current assembly address is incremented by 2.
+/*)Function VOID outrw(esp, r)
+ *
+ * expr * esp pointer to expr structure
+ * int r relocation mode
+ *
+ * The function outrw() processes a word of generated code
+ * in either absolute or relocatable format dependent upon
+ * the data contained in the expr structure esp. If the
+ * .REL output is enabled then the appropriate information
+ * is loaded into the txt and rel buffers.
+ *
+ * local variables:
+ * int n symbol/area reference number
+ * int * relp pointer to rel array
+ * int * txtp pointer to txt array
+ *
+ * global variables:
+ * sym dot defined as sym[0]
+ * int oflag -o, generate relocatable output flag
+ * int pass assembler pass number
+ *
+ * functions called:
+ * VOID aerr() assubr.c
+ * VOID outchk() asout.c
+ * VOID out_lw() asout.c
+ * VOID out_rw() asout.c
+ * VOID out_tw() asout.c
+ *
+ * side effects:
+ * The current assembly address is incremented by 2.
*/
VOID
outrw(struct expr *esp, int r)
{
- register int n;
-
- if (pass == 2) {
-
- if (esp->e_addr > 0xffff)
- {
- warnBanner();
- fprintf(stderr,
- "large constant 0x%x truncated to 16 bits\n",
- esp->e_addr);
- }
- if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
- out_lw(esp->e_addr,0);
- if (oflag) {
- outchk(2, 0);
- out_tw(esp->e_addr);
- }
- } else {
- r |= R_WORD | esp->e_rlcf;
- if (r & R_BYT2) {
- rerr();
- if (r & R_MSB) {
- out_lw(hibyte(esp->e_addr),r|R_RELOC);
- } else {
- out_lw(lobyte(esp->e_addr),r|R_RELOC);
- }
- } else {
- out_lw(esp->e_addr,r|R_RELOC);
- }
- if (oflag) {
- outchk(2, 5);
- out_tw(esp->e_addr);
- if (esp->e_flag) {
- n = esp->e_base.e_sp->s_ref;
- r |= R_SYM;
- } else {
- n = esp->e_base.e_ap->a_ref;
- }
-
- if (IS_C24(r))
- {
- /* If this happens, the linker will
- * attempt to process this 16 bit field
- * as 24 bits. That would be bad.
- */
- fprintf(stderr,
- "***Internal error: C24 out in "
- "outrw()\n");
- rerr();
- }
- write_rmode(r);
- *relp++ = txtp - txt - 2;
- out_rw(n);
- }
- }
- }
- dot.s_addr += 2;
+ register int n;
+
+ if (pass == 2) {
+
+ if (esp->e_addr > 0xffff)
+ {
+ warnBanner();
+ fprintf(stderr,
+ "large constant 0x%x truncated to 16 bits\n",
+ esp->e_addr);
+ }
+ if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
+ out_lw(esp->e_addr,0);
+ if (oflag) {
+ outchk(2, 0);
+ out_tw(esp->e_addr);
+ }
+ } else {
+ r |= R_WORD | esp->e_rlcf;
+ if (r & R_BYT2) {
+ rerr();
+ if (r & R_MSB) {
+ out_lw(hibyte(esp->e_addr),r|R_RELOC);
+ } else {
+ out_lw(lobyte(esp->e_addr),r|R_RELOC);
+ }
+ } else {
+ out_lw(esp->e_addr,r|R_RELOC);
+ }
+ if (oflag) {
+ outchk(2, 5);
+ out_tw(esp->e_addr);
+ if (esp->e_flag) {
+ n = esp->e_base.e_sp->s_ref;
+ r |= R_SYM;
+ } else {
+ n = esp->e_base.e_ap->a_ref;
+ }
+
+ if (IS_C24(r))
+ {
+ /* If this happens, the linker will
+ * attempt to process this 16 bit field
+ * as 24 bits. That would be bad.
+ */
+ fprintf(stderr,
+ "***Internal error: C24 out in "
+ "outrw()\n");
+ rerr();
+ }
+ write_rmode(r);
+ *relp++ = txtp - txt - 2;
+ out_rw(n);
+ }
+ }
+ }
+ dot.s_addr += 2;
}
-/*)Function VOID outr24(esp, r)
- *
- * expr * esp pointer to expr structure
- * int r relocation mode
- *
- * The function outr24() processes 24 bits of generated code
- * in either absolute or relocatable format dependent upon
- * the data contained in the expr structure esp. If the
- * .REL output is enabled then the appropriate information
- * is loaded into the txt and rel buffers.
- *
- * local variables:
- * int n symbol/area reference number
- * int * relp pointer to rel array
- * int * txtp pointer to txt array
- *
- * global variables:
- * sym dot defined as sym[0]
- * int oflag -o, generate relocatable output flag
- * int pass assembler pass number
- *
- * functions called:
- * VOID aerr() assubr.c
- * VOID outchk() asout.c
- * VOID out_l24() asout.c
- * VOID out_rw() asout.c
- * VOID out_t24() asout.c
- *
- * side effects:
- * The current assembly address is incremented by 3.
+/*)Function VOID outr24(esp, r)
+ *
+ * expr * esp pointer to expr structure
+ * int r relocation mode
+ *
+ * The function outr24() processes 24 bits of generated code
+ * in either absolute or relocatable format dependent upon
+ * the data contained in the expr structure esp. If the
+ * .REL output is enabled then the appropriate information
+ * is loaded into the txt and rel buffers.
+ *
+ * local variables:
+ * int n symbol/area reference number
+ * int * relp pointer to rel array
+ * int * txtp pointer to txt array
+ *
+ * global variables:
+ * sym dot defined as sym[0]
+ * int oflag -o, generate relocatable output flag
+ * int pass assembler pass number
+ *
+ * functions called:
+ * VOID aerr() assubr.c
+ * VOID outchk() asout.c
+ * VOID out_l24() asout.c
+ * VOID out_rw() asout.c
+ * VOID out_t24() asout.c
+ *
+ * side effects:
+ * The current assembly address is incremented by 3.
*/
VOID
outr24(struct expr *esp, int r)
{
- register int n;
-
- if (pass == 2) {
- if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
- /* This is a constant expression. */
- out_l24(esp->e_addr,0);
- if (oflag) {
- outchk(3, 0);
- out_t24(esp->e_addr);
- }
- } else {
- /* This is a symbol. */
- r |= R_WORD | esp->e_rlcf;
- if (r & R_BYT2) {
- /* I have no idea what this case is. */
- rerr();
- if (r & R_MSB) {
- out_lw(hibyte(esp->e_addr),r|R_RELOC);
- } else {
- out_lw(lobyte(esp->e_addr),r|R_RELOC);
- }
- } else {
- out_l24(esp->e_addr,r|R_RELOC);
- }
- if (oflag) {
- outchk(3, 5);
- out_t24(esp->e_addr);
- if (esp->e_flag) {
- n = esp->e_base.e_sp->s_ref;
- r |= R_SYM;
- } else {
- n = esp->e_base.e_ap->a_ref;
- }
-
- if (r & R_BYTE)
- {
- /* If this occurs, we cannot properly
- * code the relocation data with the
- * R_C24 flag. This means the linker
- * will fail to do the 24 bit relocation.
- * Which will suck.
- */
- fprintf(stderr,
- "***Internal error: BYTE out in 24 "
- "bit flat mode unexpected.\n");
- rerr();
- }
-
- write_rmode(r | R_C24);
- *relp++ = txtp - txt - 3;
- out_rw(n);
- }
- }
- }
- dot.s_addr += 3;
+ register int n;
+
+ if (pass == 2) {
+ if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
+ /* This is a constant expression. */
+ out_l24(esp->e_addr,0);
+ if (oflag) {
+ outchk(3, 0);
+ out_t24(esp->e_addr);
+ }
+ } else {
+ /* This is a symbol. */
+ r |= R_WORD | esp->e_rlcf;
+ if (r & R_BYT2) {
+ /* I have no idea what this case is. */
+ rerr();
+ if (r & R_MSB) {
+ out_lw(hibyte(esp->e_addr),r|R_RELOC);
+ } else {
+ out_lw(lobyte(esp->e_addr),r|R_RELOC);
+ }
+ } else {
+ out_l24(esp->e_addr,r|R_RELOC);
+ }
+ if (oflag) {
+ outchk(3, 5);
+ out_t24(esp->e_addr);
+ if (esp->e_flag) {
+ n = esp->e_base.e_sp->s_ref;
+ r |= R_SYM;
+ } else {
+ n = esp->e_base.e_ap->a_ref;
+ }
+
+ if (r & R_BYTE)
+ {
+ /* If this occurs, we cannot properly
+ * code the relocation data with the
+ * R_C24 flag. This means the linker
+ * will fail to do the 24 bit relocation.
+ * Which will suck.
+ */
+ fprintf(stderr,
+ "***Internal error: BYTE out in 24 "
+ "bit flat mode unexpected.\n");
+ rerr();
+ }
+
+ write_rmode(r | R_C24);
+ *relp++ = txtp - txt - 3;
+ out_rw(n);
+ }
+ }
+ }
+ dot.s_addr += 3;
}
-/*)Function VOID outdp(carea, esp)
- *
- * area * carea pointer to current area strcuture
- * expr * esp pointer to expr structure
- *
- * The function outdp() flushes the output buffer and
- * outputs paging information to the .REL file.
- *
- * local variables:
- * int n symbol/area reference number
- * int r relocation mode
- * int * relp pointer to rel array
- * int * txtp pointer to txt array
- *
- * global variables:
- * int oflag -o, generate relocatable output flag
- * int pass assembler pass number
- *
- * functions called:
- * VOID outbuf() asout.c
- * VOID outchk() asout.c
- * VOID out_rw() asout.c
- * VOID out_tw() asout.c
- *
- * side effects:
- * Output buffer flushed to .REL fiel.
- * Paging information dumped to .REL file.
+/*)Function VOID outdp(carea, esp)
+ *
+ * area * carea pointer to current area strcuture
+ * expr * esp pointer to expr structure
+ *
+ * The function outdp() flushes the output buffer and
+ * outputs paging information to the .REL file.
+ *
+ * local variables:
+ * int n symbol/area reference number
+ * int r relocation mode
+ * int * relp pointer to rel array
+ * int * txtp pointer to txt array
+ *
+ * global variables:
+ * int oflag -o, generate relocatable output flag
+ * int pass assembler pass number
+ *
+ * functions called:
+ * VOID outbuf() asout.c
+ * VOID outchk() asout.c
+ * VOID out_rw() asout.c
+ * VOID out_tw() asout.c
+ *
+ * side effects:
+ * Output buffer flushed to .REL fiel.
+ * Paging information dumped to .REL file.
*/
VOID
register struct area *carea;
register struct expr *esp;
{
- register int n, r;
-
- if (oflag && pass==2) {
- outchk(HUGE,HUGE);
- out_tw(carea->a_ref);
- out_tw(esp->e_addr);
- if (esp->e_flag || esp->e_base.e_ap!=NULL) {
- r = R_WORD;
- if (esp->e_flag) {
- n = esp->e_base.e_sp->s_ref;
- r |= R_SYM;
- } else {
- n = esp->e_base.e_ap->a_ref;
- }
- write_rmode(r);
- *relp++ = txtp - txt - 2;
- out_rw(n);
- }
- outbuf("P");
- }
+ register int n, r;
+
+ if (oflag && pass==2) {
+ outchk(HUGE,HUGE);
+ out_tw(carea->a_ref);
+ out_tw(esp->e_addr);
+ if (esp->e_flag || esp->e_base.e_ap!=NULL) {
+ r = R_WORD;
+ if (esp->e_flag) {
+ n = esp->e_base.e_sp->s_ref;
+ r |= R_SYM;
+ } else {
+ n = esp->e_base.e_ap->a_ref;
+ }
+ write_rmode(r);
+ *relp++ = txtp - txt - 2;
+ out_rw(n);
+ }
+ outbuf("P");
+ }
}
-/*)Function VOID outall()
+/*)Function VOID outall()
*
- * The function outall() will output any bufferred assembled
- * data and relocation information (during pass 2 if the .REL
- * output has been enabled).
+ * The function outall() will output any bufferred assembled
+ * data and relocation information (during pass 2 if the .REL
+ * output has been enabled).
*
- * local variables:
- * none
+ * local variables:
+ * none
*
- * global variables:
- * int oflag -o, generate relocatable output flag
- * int pass assembler pass number
+ * global variables:
+ * int oflag -o, generate relocatable output flag
+ * int pass assembler pass number
*
- * functions called:
- * VOID outbuf() asout.c
+ * functions called:
+ * VOID outbuf() asout.c
*
- * side effects:
- * assembled data and relocation buffers will be cleared.
+ * side effects:
+ * assembled data and relocation buffers will be cleared.
*/
VOID
outall()
{
- if (oflag && pass==2)
- outbuf("R");
+ if (oflag && pass==2)
+ outbuf("R");
}
-/*)Function VOID outdot()
+/*)Function VOID outdot()
*
- * The function outdot() outputs information about the
- * current program counter value (during pass 2 if the .REL
- * output has been enabled).
+ * The function outdot() outputs information about the
+ * current program counter value (during pass 2 if the .REL
+ * output has been enabled).
*
- * local variables:
- * none
+ * local variables:
+ * none
*
- * global variables:
- * int oflag -o, generate relocatable output flag
- * int pass assembler pass number
+ * global variables:
+ * int oflag -o, generate relocatable output flag
+ * int pass assembler pass number
*
- * functions called:
- * int fprintf() c_library
- * VOID out() asout.c
+ * functions called:
+ * int fprintf() c_library
+ * VOID out() asout.c
*
- * side effects:
- * assembled data and relocation buffers will be cleared.
+ * side effects:
+ * assembled data and relocation buffers will be cleared.
*/
VOID
outdot()
{
- if (oflag && pass==2) {
- fprintf(ofp, "T");
- out(txt,(int) (txtp-txt));
- fprintf(ofp, "\n");
- fprintf(ofp, "R");
- out(rel,(int) (relp-rel));
- fprintf(ofp, "\n");
- txtp = txt;
- relp = rel;
- }
+ if (oflag && pass==2) {
+ fprintf(ofp, "T");
+ out(txt,(int) (txtp-txt));
+ fprintf(ofp, "\n");
+ fprintf(ofp, "R");
+ out(rel,(int) (relp-rel));
+ fprintf(ofp, "\n");
+ txtp = txt;
+ relp = rel;
+ }
}
-/*)Function outchk(nt, nr)
+/*)Function outchk(nt, nr)
*
- * int nr number of additional relocation words
- * int nt number of additional data words
+ * int nr number of additional relocation words
+ * int nt number of additional data words
*
- * The function outchk() checks the data and relocation buffers
- * for space to insert the nt data words and nr relocation words.
- * If space is not available then output the current data and
- * initialize the data buffers to receive the new data.
+ * The function outchk() checks the data and relocation buffers
+ * for space to insert the nt data words and nr relocation words.
+ * If space is not available then output the current data and
+ * initialize the data buffers to receive the new data.
*
- * local variables:
- * area * ap pointer to an area structure
- * int * relp pointer to rel array
- * int * txtp pointer to txt array
+ * local variables:
+ * area * ap pointer to an area structure
+ * int * relp pointer to rel array
+ * int * txtp pointer to txt array
*
- * global variables:
- * sym dot defined as sym[0]
+ * global variables:
+ * sym dot defined as sym[0]
*
- * functions called:
- * VOID outbuf() asout.c
+ * functions called:
+ * VOID outbuf() asout.c
*
- * side effects:
- * Data and relocation buffers may be emptied and initialized.
+ * side effects:
+ * Data and relocation buffers may be emptied and initialized.
*/
VOID
outchk(nt, nr)
{
- register struct area *ap;
-
- if (txtp+nt > &txt[NTXT] || relp+nr > &rel[NREL]) {
- outbuf("R");
- }
- if (txtp == txt) {
- out_tw(dot.s_addr);
- if ((ap = dot.s_area) != NULL) {
- write_rmode(R_WORD|R_AREA);
- *relp++ = 0;
- out_rw(ap->a_ref);
- }
- }
+ register struct area *ap;
+
+ if (txtp+nt > &txt[NTXT] || relp+nr > &rel[NREL]) {
+ outbuf("R");
+ }
+ if (txtp == txt) {
+ out_tw(dot.s_addr);
+ if ((ap = dot.s_area) != NULL) {
+ write_rmode(R_WORD|R_AREA);
+ *relp++ = 0;
+ out_rw(ap->a_ref);
+ }
+ }
}
-/*)Function VOID outbuf()
+/*)Function VOID outbuf()
*
- * The function outbuf() will output any bufferred data
- * and relocation information to the .REL file. The output
- * buffer pointers and counters are initialized.
+ * The function outbuf() will output any bufferred data
+ * and relocation information to the .REL file. The output
+ * buffer pointers and counters are initialized.
*
- * local variables:
- * int rel[] relocation data for code/data array
- * int * relp pointer to rel array
- * int txt[] assembled code/data array
- * int * txtp pointer to txt array
+ * local variables:
+ * int rel[] relocation data for code/data array
+ * int * relp pointer to rel array
+ * int txt[] assembled code/data array
+ * int * txtp pointer to txt array
*
- * global variables:
- * FILE * ofp relocation output file handle
+ * global variables:
+ * FILE * ofp relocation output file handle
*
- * functions called:
- * VOID out() asout.c
+ * functions called:
+ * VOID out() asout.c
*
- * side effects:
- * All bufferred data written to .REL file and
- * buffer pointers and counters initialized.
+ * side effects:
+ * All bufferred data written to .REL file and
+ * buffer pointers and counters initialized.
*/
VOID
outbuf(s)
char *s;
{
- if (txtp > &txt[2]) {
- fprintf(ofp, "T");
- out(txt,(int) (txtp-txt));
- fprintf(ofp, "\n");
- fprintf(ofp, "%s", s);
- out(rel,(int) (relp-rel));
- fprintf(ofp, "\n");
- }
- txtp = txt;
- relp = rel;
+ if (txtp > &txt[2]) {
+ fprintf(ofp, "T");
+ out(txt,(int) (txtp-txt));
+ fprintf(ofp, "\n");
+ fprintf(ofp, "%s", s);
+ out(rel,(int) (relp-rel));
+ fprintf(ofp, "\n");
+ }
+ txtp = txt;
+ relp = rel;
}
-/*)Function VOID outgsd()
- *
- * The function outgsd() performs the following:
- * (1) outputs the .REL file radix
- * (2) outputs the header specifying the number
- * of areas and global symbols
- * (3) outputs the module name
- * (4) set the reference number and output a symbol line
- * for all external global variables and absolutes
- * (5) output an area name, set reference number and output
- * a symbol line for all global relocatables in the area.
- * Repeat this proceedure for all areas.
- *
- * local variables:
- * area * ap pointer to an area structure
- * sym * sp pointer to a sym structure
- * int i loop counter
- * int j loop counter
- * int c string character value
- * int narea number of code areas
- * char * ptr string pointer
- * int nglob number of global symbols
- * int rn symbol reference number
- *
- * global variables:
- * area * areap pointer to an area structure
- * char module[] module name string
- * sym * symhash[] array of pointers to NHASH
- * linked symbol lists
- * int xflag -x, listing radix flag
- *
- * functions called:
- * int fprintf() c_library
- * VOID outarea() asout.c
- * VOID outsym() asout.c
- * int putc() c_library
- *
- * side effects:
- * All symbols are given reference numbers, all symbol
- * and area information is output to the .REL file.
+/*)Function VOID outgsd()
+ *
+ * The function outgsd() performs the following:
+ * (1) outputs the .REL file radix
+ * (2) outputs the header specifying the number
+ * of areas and global symbols
+ * (3) outputs the module name
+ * (4) set the reference number and output a symbol line
+ * for all external global variables and absolutes
+ * (5) output an area name, set reference number and output
+ * a symbol line for all global relocatables in the area.
+ * Repeat this proceedure for all areas.
+ *
+ * local variables:
+ * area * ap pointer to an area structure
+ * sym * sp pointer to a sym structure
+ * int i loop counter
+ * int j loop counter
+ * int c string character value
+ * int narea number of code areas
+ * char * ptr string pointer
+ * int nglob number of global symbols
+ * int rn symbol reference number
+ *
+ * global variables:
+ * area * areap pointer to an area structure
+ * char module[] module name string
+ * sym * symhash[] array of pointers to NHASH
+ * linked symbol lists
+ * int xflag -x, listing radix flag
+ *
+ * functions called:
+ * int fprintf() c_library
+ * VOID outarea() asout.c
+ * VOID outsym() asout.c
+ * int putc() c_library
+ *
+ * side effects:
+ * All symbols are given reference numbers, all symbol
+ * and area information is output to the .REL file.
*/
VOID
outgsd()
{
- register struct area *ap;
- register struct sym *sp;
- register int i, j;
- char *ptr;
- int c, narea, nglob, rn;
-
- /*
- * Number of areas
- */
- narea = areap->a_ref + 1;
-
- /*
- * Number of global references/absolutes
- */
- nglob = 0;
- for (i = 0; i < NHASH; ++i) {
- sp = symhash[i];
- while (sp) {
- if (sp->s_flag&S_GBL)
- ++nglob;
- sp = sp->s_sp;
- }
- }
-
- /*
- * Output Radix and number of areas and symbols
- */
- if (xflag == 0) {
- fprintf(ofp, "X%c\n", hilo ? 'H' : 'L');
- fprintf(ofp, "H %X areas %X global symbols\n", narea, nglob);
- } else
- if (xflag == 1) {
- fprintf(ofp, "Q%c\n", hilo ? 'H' : 'L');
- fprintf(ofp, "H %o areas %o global symbols\n", narea, nglob);
- } else
- if (xflag == 2) {
- fprintf(ofp, "D%c\n", hilo ? 'H' : 'L');
- fprintf(ofp, "H %u areas %u global symbols\n", narea, nglob);
- }
-
- /*
- * Module name
- */
- if (module[0]) {
- fprintf(ofp, "M ");
- ptr = &module[0];
- while (ptr < &module[NCPS]) {
- if ((c = *ptr++) != 0)
- putc(c, ofp);
- }
- putc('\n', ofp);
- }
+ register struct area *ap;
+ register struct sym *sp;
+ register int i, j;
+ char *ptr;
+ int c, narea, nglob, rn;
+
+ /*
+ * Number of areas
+ */
+ narea = areap->a_ref + 1;
+
+ /*
+ * Number of global references/absolutes
+ */
+ nglob = 0;
+ for (i = 0; i < NHASH; ++i) {
+ sp = symhash[i];
+ while (sp) {
+ if (sp->s_flag&S_GBL)
+ ++nglob;
+ sp = sp->s_sp;
+ }
+ }
+
+ /*
+ * Output Radix and number of areas and symbols
+ */
+ if (xflag == 0) {
+ fprintf(ofp, "X%c\n", hilo ? 'H' : 'L');
+ fprintf(ofp, "H %X areas %X global symbols\n", narea, nglob);
+ } else
+ if (xflag == 1) {
+ fprintf(ofp, "Q%c\n", hilo ? 'H' : 'L');
+ fprintf(ofp, "H %o areas %o global symbols\n", narea, nglob);
+ } else
+ if (xflag == 2) {
+ fprintf(ofp, "D%c\n", hilo ? 'H' : 'L');
+ fprintf(ofp, "H %u areas %u global symbols\n", narea, nglob);
+ }
+
+ /*
+ * Module name
+ */
+ if (module[0]) {
+ fprintf(ofp, "M ");
+ ptr = &module[0];
+ while (ptr < &module[NCPS]) {
+ if ((c = *ptr++) != 0)
+ putc(c, ofp);
+ }
+ putc('\n', ofp);
+ }
/*
* Sdcc compile options
*/
- if (strlen(optsdcc)) fprintf(ofp, "O %s\n", optsdcc);
-
- /*
- * Global references and absolutes.
- */
- rn = 0;
- for (i=0; i<NHASH; ++i) {
- sp = symhash[i];
- while (sp) {
- if (sp->s_area==NULL && sp->s_flag&S_GBL) {
- sp->s_ref = rn++;
- outsym(sp);
- }
- sp = sp->s_sp;
- }
- }
-
- /*
- * Global relocatables.
- */
- for (i=0; i<narea; ++i) {
- ap = areap;
- while (ap->a_ref != i)
- ap = ap->a_ap;
- outarea(ap);
- for (j=0; j<NHASH; ++j) {
- sp = symhash[j];
- while (sp) {
- if (sp->s_area==ap && sp->s_flag&S_GBL) {
- sp->s_ref = rn++;
- outsym(sp);
- }
- sp = sp->s_sp;
- }
- }
- }
+ if (strlen(optsdcc)) fprintf(ofp, "O %s\n", optsdcc);
+
+ /*
+ * Global references and absolutes.
+ */
+ rn = 0;
+ for (i=0; i<NHASH; ++i) {
+ sp = symhash[i];
+ while (sp) {
+ if (sp->s_area==NULL && sp->s_flag&S_GBL) {
+ sp->s_ref = rn++;
+ outsym(sp);
+ }
+ sp = sp->s_sp;
+ }
+ }
+
+ /*
+ * Global relocatables.
+ */
+ for (i=0; i<narea; ++i) {
+ ap = areap;
+ while (ap->a_ref != i)
+ ap = ap->a_ap;
+ outarea(ap);
+ for (j=0; j<NHASH; ++j) {
+ sp = symhash[j];
+ while (sp) {
+ if (sp->s_area==ap && sp->s_flag&S_GBL) {
+ sp->s_ref = rn++;
+ outsym(sp);
+ }
+ sp = sp->s_sp;
+ }
+ }
+ }
}
-/*)Function VOID outarea(ap)
+/*)Function VOID outarea(ap)
*
- * area * ap pointer to an area structure
+ * area * ap pointer to an area structure
*
- * The function outarea() outputs the A line to the .REL
- * file. The A line contains the area's name, size, and
- * attributes.
+ * The function outarea() outputs the A line to the .REL
+ * file. The A line contains the area's name, size, and
+ * attributes.
*
- * local variables:
- * char * ptr pointer to area id string
- * int c character value
+ * local variables:
+ * char * ptr pointer to area id string
+ * int c character value
*
- * global variables:
- * FILE * ofp relocation output file handle
- * int xflag -x, listing radix flag
+ * global variables:
+ * FILE * ofp relocation output file handle
+ * int xflag -x, listing radix flag
*
- * functions called:
- * int fprintf() c_library
- * int putc() c_library
+ * functions called:
+ * int fprintf() c_library
+ * int putc() c_library
*
- * side effects:
- * The A line is sent to the .REL file.
+ * side effects:
+ * The A line is sent to the .REL file.
*/
VOID
outarea(ap)
register struct area *ap;
{
- register char *ptr;
- register int c;
-
- fprintf(ofp, "A ");
- ptr = &ap->a_id[0];
- while (ptr < &ap->a_id[NCPS]) {
- if ((c = *ptr++) != 0)
- putc(c, ofp);
- }
- if (xflag == 0) {
- fprintf(ofp, " size %X flags %X\n", ap->a_size, ap->a_flag);
- } else
- if (xflag == 1) {
- fprintf(ofp, " size %o flags %o\n", ap->a_size, ap->a_flag);
- } else
- if (xflag == 2) {
- fprintf(ofp, " size %u flags %u\n", ap->a_size, ap->a_flag);
- }
+ register char *ptr;
+ register int c;
+
+ fprintf(ofp, "A ");
+ ptr = &ap->a_id[0];
+ while (ptr < &ap->a_id[NCPS]) {
+ if ((c = *ptr++) != 0)
+ putc(c, ofp);
+ }
+ if (xflag == 0) {
+ fprintf(ofp, " size %X flags %X\n", ap->a_size, ap->a_flag);
+ } else
+ if (xflag == 1) {
+ fprintf(ofp, " size %o flags %o\n", ap->a_size, ap->a_flag);
+ } else
+ if (xflag == 2) {
+ fprintf(ofp, " size %u flags %u\n", ap->a_size, ap->a_flag);
+ }
}
-/*)Function VOID outsym(sp)
+/*)Function VOID outsym(sp)
*
- * sym * sp pointer to a sym structure
+ * sym * sp pointer to a sym structure
*
- * The function outsym() outputs the S line to the .REL
- * file. The S line contains the symbols name and whether the
- * the symbol is defined or referenced.
+ * The function outsym() outputs the S line to the .REL
+ * file. The S line contains the symbols name and whether the
+ * the symbol is defined or referenced.
*
- * local variables:
- * char * ptr pointer to symbol id string
- * int c character value
+ * local variables:
+ * char * ptr pointer to symbol id string
+ * int c character value
*
- * global variables:
- * FILE * ofp relocation output file handle
- * int xflag -x, listing radix flag
+ * global variables:
+ * FILE * ofp relocation output file handle
+ * int xflag -x, listing radix flag
*
- * functions called:
- * int fprintf() c_library
- * int putc() c_library
+ * functions called:
+ * int fprintf() c_library
+ * int putc() c_library
*
- * side effects:
- * The S line is sent to the .REL file.
+ * side effects:
+ * The S line is sent to the .REL file.
*/
VOID
outsym(sp)
register struct sym *sp;
{
- register char *ptr;
-
- fprintf(ofp, "S ");
- ptr = &sp->s_id[0];
- fprintf(ofp, "%s", ptr );
- fprintf(ofp, " %s", sp->s_type==S_NEW ? "Ref" : "Def");
- if (xflag == 0) {
- fprintf(ofp, "%04X\n", sp->s_addr);
- } else
- if (xflag == 1) {
- fprintf(ofp, "%06o\n", sp->s_addr);
- } else
- if (xflag == 2) {
- fprintf(ofp, "%05u\n", sp->s_addr);
- }
+ register char *ptr;
+
+ fprintf(ofp, "S ");
+ ptr = &sp->s_id[0];
+ fprintf(ofp, "%s", ptr );
+ fprintf(ofp, " %s", sp->s_type==S_NEW ? "Ref" : "Def");
+ if (xflag == 0) {
+ fprintf(ofp, "%04X\n", sp->s_addr);
+ } else
+ if (xflag == 1) {
+ fprintf(ofp, "%06o\n", sp->s_addr);
+ } else
+ if (xflag == 2) {
+ fprintf(ofp, "%05u\n", sp->s_addr);
+ }
}
-/*)Function VOID out(p, n)
+/*)Function VOID out(p, n)
*
- * int n number of words to output
- * int * p pointer to data words
+ * int n number of words to output
+ * int * p pointer to data words
*
- * The function out() outputs the data words to the .REL file
- * int the specified radix.
+ * The function out() outputs the data words to the .REL file
+ * int the specified radix.
*
- * local variables:
- * none
+ * local variables:
+ * none
*
- * global variables:
- * FILE * ofp relocation output file handle
- * int xflag -x, listing radix flag
+ * global variables:
+ * FILE * ofp relocation output file handle
+ * int xflag -x, listing radix flag
*
- * functions called:
- * int fprintf() c_library
+ * functions called:
+ * int fprintf() c_library
*
- * side effects:
- * Data is sent to the .REL file.
+ * side effects:
+ * Data is sent to the .REL file.
*/
VOID
out(char *p, int n)
{
- while (n--) {
- if (xflag == 0) {
- fprintf(ofp, " %02X", (*p++)&0xff);
- } else
- if (xflag == 1) {
- fprintf(ofp, " %03o", (*p++)&0xff);
- } else
- if (xflag == 2) {
- fprintf(ofp, " %03u", (*p++)&0xff);
- }
- }
+ while (n--) {
+ if (xflag == 0) {
+ fprintf(ofp, " %02X", (*p++)&0xff);
+ } else
+ if (xflag == 1) {
+ fprintf(ofp, " %03o", (*p++)&0xff);
+ } else
+ if (xflag == 2) {
+ fprintf(ofp, " %03u", (*p++)&0xff);
+ }
+ }
}
-/*)Function VOID out_lb(b, t)
+/*)Function VOID out_lb(b, t)
*
- * int b assembled data
- * int t relocation type
+ * int b assembled data
+ * int t relocation type
*
- * The function out_lb() copies the assembled data and
- * its relocation type to the list data buffers.
+ * The function out_lb() copies the assembled data and
+ * its relocation type to the list data buffers.
*
- * local variables:
- * none
+ * local variables:
+ * none
*
- * global variables:
- * int * cp pointer to assembler output array cb[]
- * int * cpt pointer to assembler relocation type
- * output array cbt[]
+ * global variables:
+ * int * cp pointer to assembler output array cb[]
+ * int * cpt pointer to assembler relocation type
+ * output array cbt[]
*
- * functions called:
- * none
+ * functions called:
+ * none
*
- * side effects:
- * Pointers to data and relocation buffers incremented by 1.
+ * side effects:
+ * Pointers to data and relocation buffers incremented by 1.
*/
VOID
out_lb(b,t)
register int b,t;
{
- if (cp < &cb[NCODE]) {
- *cp++ = b;
- *cpt++ = t;
- }
+ if (cp < &cb[NCODE]) {
+ *cp++ = b;
+ *cpt++ = t;
+ }
}
-/*)Function VOID out_lw(n, t)
+/*)Function VOID out_lw(n, t)
*
- * int n assembled data
- * int t relocation type
+ * int n assembled data
+ * int t relocation type
*
- * The function out_lw() copies the assembled data and
- * its relocation type to the list data buffers.
+ * The function out_lw() copies the assembled data and
+ * its relocation type to the list data buffers.
*
- * local variables:
- * none
+ * local variables:
+ * none
*
- * global variables:
- * int * cp pointer to assembler output array cb[]
- * int * cpt pointer to assembler relocation type
- * output array cbt[]
+ * global variables:
+ * int * cp pointer to assembler output array cb[]
+ * int * cpt pointer to assembler relocation type
+ * output array cbt[]
*
- * functions called:
- * none
+ * functions called:
+ * none
*
- * side effects:
- * Pointers to data and relocation buffers incremented by 2.
+ * side effects:
+ * Pointers to data and relocation buffers incremented by 2.
*/
VOID
out_lw(n,t)
register int n,t;
{
- if (hilo) {
- out_lb(hibyte(n),t ? t|R_HIGH : 0);
- out_lb(lobyte(n),t);
- } else {
- out_lb(lobyte(n),t);
- out_lb(hibyte(n),t ? t|R_HIGH : 0);
- }
+ if (hilo) {
+ out_lb(hibyte(n),t ? t|R_HIGH : 0);
+ out_lb(lobyte(n),t);
+ } else {
+ out_lb(lobyte(n),t);
+ out_lb(hibyte(n),t ? t|R_HIGH : 0);
+ }
}
-/*)Function VOID out_l24(n, t)
+/*)Function VOID out_l24(n, t)
*
- * int n assembled data
- * int t relocation type
+ * int n assembled data
+ * int t relocation type
*
- * The function out_l24() copies the assembled data and
- * its relocation type to the list data buffers.
+ * The function out_l24() copies the assembled data and
+ * its relocation type to the list data buffers.
*
- * local variables:
- * none
+ * local variables:
+ * none
*
- * global variables:
- * int * cp pointer to assembler output array cb[]
- * int * cpt pointer to assembler relocation type
- * output array cbt[]
+ * global variables:
+ * int * cp pointer to assembler output array cb[]
+ * int * cpt pointer to assembler relocation type
+ * output array cbt[]
*
- * functions called:
- * none
+ * functions called:
+ * none
*
- * side effects:
- * Pointers to data and relocation buffers incremented by 3.
+ * side effects:
+ * Pointers to data and relocation buffers incremented by 3.
*/
VOID
out_l24(int n, int t)
{
- if (hilo) {
- out_lb(byte3(n),t ? t|R_HIGH : 0);
- out_lb(hibyte(n),t);
- out_lb(lobyte(n),t);
- } else {
- out_lb(lobyte(n),t);
- out_lb(hibyte(n),t);
- out_lb(byte3(n),t ? t|R_HIGH : 0);
- }
+ if (hilo) {
+ out_lb(byte3(n),t ? t|R_HIGH : 0);
+ out_lb(hibyte(n),t);
+ out_lb(lobyte(n),t);
+ } else {
+ out_lb(lobyte(n),t);
+ out_lb(hibyte(n),t);
+ out_lb(byte3(n),t ? t|R_HIGH : 0);
+ }
}
-/*)Function VOID out_rw(n)
+/*)Function VOID out_rw(n)
*
- * int n data word
+ * int n data word
*
- * The function out_rw() outputs the relocation (R)
- * data word as two bytes ordered according to hilo.
+ * The function out_rw() outputs the relocation (R)
+ * data word as two bytes ordered according to hilo.
*
- * local variables:
- * int * relp pointer to rel array
+ * local variables:
+ * int * relp pointer to rel array
*
- * global variables:
- * none
+ * global variables:
+ * none
*
- * functions called:
- * int lobyte() asout.c
- * int hibyte() asout.c
+ * functions called:
+ * int lobyte() asout.c
+ * int hibyte() asout.c
*
- * side effects:
- * Pointer to relocation buffer incremented by 2.
+ * side effects:
+ * Pointer to relocation buffer incremented by 2.
*/
VOID
out_rw(n)
register int n;
{
- if (hilo) {
- *relp++ = hibyte(n);
- *relp++ = lobyte(n);
- } else {
- *relp++ = lobyte(n);
- *relp++ = hibyte(n);
- }
+ if (hilo) {
+ *relp++ = hibyte(n);
+ *relp++ = lobyte(n);
+ } else {
+ *relp++ = lobyte(n);
+ *relp++ = hibyte(n);
+ }
}
-/*)Function VOID out_tw(n)
+/*)Function VOID out_tw(n)
*
- * int n data word
+ * int n data word
*
- * The function out_tw() outputs the text (T)
- * data word as two bytes ordered according to hilo.
+ * The function out_tw() outputs the text (T)
+ * data word as two bytes ordered according to hilo.
*
- * local variables:
- * int * txtp pointer to txt array
+ * local variables:
+ * int * txtp pointer to txt array
*
- * global variables:
- * none
+ * global variables:
+ * none
*
- * functions called:
- * int lobyte() asout.c
- * int hibyte() asout.c
+ * functions called:
+ * int lobyte() asout.c
+ * int hibyte() asout.c
*
- * side effects:
- * Pointer to relocation buffer incremented by 2.
+ * side effects:
+ * Pointer to relocation buffer incremented by 2.
*/
VOID
out_tw(n)
register int n;
{
- if (hilo) {
- *txtp++ = hibyte(n);
- *txtp++ = lobyte(n);
- } else {
- *txtp++ = lobyte(n);
- *txtp++ = hibyte(n);
- }
+ if (hilo) {
+ *txtp++ = hibyte(n);
+ *txtp++ = lobyte(n);
+ } else {
+ *txtp++ = lobyte(n);
+ *txtp++ = hibyte(n);
+ }
}
-/*)Function VOID out_t24(n)
+/*)Function VOID out_t24(n)
*
- * int n data word
+ * int n data word
*
- * The function out_t24() outputs the text (T)
- * data word as three bytes ordered according to hilo.
+ * The function out_t24() outputs the text (T)
+ * data word as three bytes ordered according to hilo.
*
- * local variables:
- * int * txtp pointer to txt array
+ * local variables:
+ * int * txtp pointer to txt array
*
- * global variables:
- * none
+ * global variables:
+ * none
*
- * functions called:
- * int lobyte() asout.c
- * int hibyte() asout.c
+ * functions called:
+ * int lobyte() asout.c
+ * int hibyte() asout.c
*
- * side effects:
- * Pointer to relocation buffer incremented by 3.
+ * side effects:
+ * Pointer to relocation buffer incremented by 3.
*/
VOID
out_t24(int n)
{
- if (hilo) {
- *txtp++ = byte3(n);
- *txtp++ = hibyte(n);
- *txtp++ = lobyte(n);
- } else {
- *txtp++ = lobyte(n);
- *txtp++ = hibyte(n);
- *txtp++ = byte3(n);
- }
+ if (hilo) {
+ *txtp++ = byte3(n);
+ *txtp++ = hibyte(n);
+ *txtp++ = lobyte(n);
+ } else {
+ *txtp++ = lobyte(n);
+ *txtp++ = hibyte(n);
+ *txtp++ = byte3(n);
+ }
}
-/*)Function int lobyte(n)
+/*)Function int lobyte(n)
*
- * int n data word
+ * int n data word
*
- * The function lobyte() returns the lower byte of
- * integer n.
+ * The function lobyte() returns the lower byte of
+ * integer n.
*
- * local variables:
- * none
+ * local variables:
+ * none
*
- * global variables:
- * none
+ * global variables:
+ * none
*
- * functions called:
- * none
+ * functions called:
+ * none
*
- * side effects:
- * none
+ * side effects:
+ * none
*/
int
lobyte(n)
{
- return (n&0377);
+ return (n&0377);
}
-/*)Function int hibyte(n)
+/*)Function int hibyte(n)
*
- * int n data word
+ * int n data word
*
- * The function hibyte() returns the higher byte of
- * integer n.
+ * The function hibyte() returns the higher byte of
+ * integer n.
*
- * local variables:
- * none
+ * local variables:
+ * none
*
- * global variables:
- * none
+ * global variables:
+ * none
*
- * functions called:
- * none
+ * functions called:
+ * none
*
- * side effects:
- * none
+ * side effects:
+ * none
*/
int
hibyte(n)
{
- return ((n>>8)&0377);
+ return ((n>>8)&0377);
}
-/*)Function int byte3(n)
+/*)Function int byte3(n)
*
- * int n 24 bit data
+ * int n 24 bit data
*
- * The function byte3() returns the MSB of the
- * 24 bit integer n.
+ * The function byte3() returns the MSB of the
+ * 24 bit integer n.
*
- * local variables:
- * none
+ * local variables:
+ * none
*
- * global variables:
- * none
+ * global variables:
+ * none
*
- * functions called:
- * none
+ * functions called:
+ * none
*
- * side effects:
- * none
+ * side effects:
+ * none
*/
int
byte3(int n)
{
- return ((n >> 16) & 0xff);
+ return ((n >> 16) & 0xff);
}
/*
int op;
int r;
{
- register int n;
+ register int n;
- if (pass == 2) {
- if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
- /* equated absolute destination. Assume value
+ if (pass == 2) {
+ if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
+ /* equated absolute destination. Assume value
* relative to current area */
esp->e_base.e_ap = dot.s_area;
- }
+ }
/* Relocatable destination. Build THREE
* byte output: relocatable word, followed
* by op-code. Linker will combine them.
* Listing shows only the address.
*/
- r |= R_WORD | esp->e_rlcf;
+ r |= R_WORD | esp->e_rlcf;
out_lw(esp->e_addr,r|R_RELOC);
if (oflag) {
outchk(3, 5);
*relp++ = txtp - txt - 3;
out_rw(n);
}
- }
- dot.s_addr += 2;
+ }
+ dot.s_addr += 2;
}
/*
VOID
outr19(struct expr * esp, int op, int r)
{
- register int n;
+ register int n;
- if (pass == 2) {
- if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
- /* equated absolute destination. Assume value
+ if (pass == 2) {
+ if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
+ /* equated absolute destination. Assume value
* relative to current area */
esp->e_base.e_ap = dot.s_area;
- }
+ }
/* Relocatable destination. Build FOUR
* byte output: relocatable 24-bit entity, followed
* by op-code. Linker will combine them.
* Listing shows only the address.
*/
- r |= R_WORD | esp->e_rlcf;
+ r |= R_WORD | esp->e_rlcf;
out_l24(esp->e_addr,r|R_RELOC);
if (oflag) {
outchk(4, 5);
out_t24(esp->e_addr);
*txtp++ = op;
-
+
if (esp->e_flag) {
n = esp->e_base.e_sp->s_ref;
r |= R_SYM;
*relp++ = txtp - txt - 4;
out_rw(n);
}
- }
- dot.s_addr += 3;
+ }
+ dot.s_addr += 3;
}
static unsigned short rbank = -1;
+#define AOP(op) op->aop
+#define AOP_TYPE(op) AOP(op)->type
+#define AOP_SIZE(op) AOP(op)->size
+#define IS_AOP_PREG(x) (AOP(x) && (AOP_TYPE(x) == AOP_R1 || \
+ AOP_TYPE(x) == AOP_R0))
+
+#define AOP_NEEDSACC(x) (AOP(x) && (AOP_TYPE(x) == AOP_CRY || \
+ AOP_TYPE(x) == AOP_DPTR || AOP(x)->paged))
+
+#define AOP_INPREG(x) (x && (x->type == AOP_REG && \
+ (x->aopu.aop_reg[0] == mcs51_regWithIdx(R0_IDX) || \
+ x->aopu.aop_reg[0] == mcs51_regWithIdx(R1_IDX) )))
+
+
#define SYM_BP(sym) (SPEC_OCLS (sym->etype)->paged ? "_bpx" : "_bp")
#define R0INB _G.bu.bs.r0InB
char offset = ((sym->stack < 0) ?
((char) (sym->stack - _G.nRegsSaved)) :
((char) sym->stack)) & 0xff;
- if (_G.accInUse || leftRightUseAcc (ic))
- emitcode ("push", "acc");
if ((offset >= -3) && (offset <= 3))
{
}
else
{
+ if (_G.accInUse || leftRightUseAcc (ic))
+ emitcode ("push", "acc");
emitcode ("mov", "a,%s", SYM_BP (sym));
emitcode ("add", "a,#0x%02x", offset);
emitcode ("mov", "%s,a",
aop->aopu.aop_ptr->name);
+ if (_G.accInUse || leftRightUseAcc (ic))
+ emitcode ("pop", "acc");
}
- if (_G.accInUse || leftRightUseAcc (ic))
- emitcode ("pop", "acc");
}
else
emitcode ("mov", "%s,#%s",
sym_link *from_type = operandType(IC_RIGHT(ic));
aop->aopu.aop_immd.from_cast_remat = 1;
ic = OP_SYMBOL (IC_RIGHT (ic))->rematiCode;
- ptr_type = DCL_TYPE(from_type);
- if (ptr_type == IPOINTER) {
- // bug #481053
- ptr_type = POINTER;
- }
+ ptr_type = pointerTypeToGPByte (DCL_TYPE(from_type), NULL, NULL);
continue ;
} else break;
/* clobber the accumulator */
/*-----------------------------------------------------------------*/
static bool
-aopGetUsesAcc (asmop *aop, int offset)
+aopGetUsesAcc (operand * oper, int offset)
{
+ asmop * aop = AOP (oper);
+
if (offset > (aop->size - 1))
return FALSE;
/* aopGet - for fetching value of the aop */
/*-----------------------------------------------------------------*/
static char *
-aopGet (asmop * aop, int offset, bool bit16, bool dname)
+aopGet (operand * oper, int offset, bool bit16, bool dname)
{
char *s = buffer;
char *rs;
+ asmop * aop = AOP (oper);
/* offset is greater than
size then zero */
return rs;
case AOP_DIR:
- if (offset)
+ if (SPEC_SCLS (getSpec (operandType (oper))) == S_SFR && offset)
+ sprintf (s, "(%s >> %d)",
+ aop->aopu.aop_dir, offset * 8);
+ else if (offset)
sprintf (s, "(%s + %d)",
aop->aopu.aop_dir,
offset);
/* aopPut - puts a string for a aop and indicates if acc is in use */
/*-----------------------------------------------------------------*/
static bool
-aopPut (asmop * aop, const char *s, int offset, bool bvolatile)
+aopPut (operand * result, const char *s, int offset, bool bvolatile)
{
char *d = buffer;
bool accuse = FALSE;
+ asmop * aop = AOP (result);
if (aop->size && offset > (aop->size - 1))
{
break;
case AOP_DIR:
- if (offset)
+ if (SPEC_SCLS (getSpec (operandType (result))) == S_SFR && offset)
+ sprintf (d, "(%s >> %d)",
+ aop->aopu.aop_dir, offset * 8);
+ else if (offset)
sprintf (d, "(%s + %d)",
aop->aopu.aop_dir, offset);
else
aop->coff = 0;
}
-#define AOP(op) op->aop
-#define AOP_TYPE(op) AOP(op)->type
-#define AOP_SIZE(op) AOP(op)->size
-#define IS_AOP_PREG(x) (AOP(x) && (AOP_TYPE(x) == AOP_R1 || \
- AOP_TYPE(x) == AOP_R0))
-
-#define AOP_NEEDSACC(x) (AOP(x) && (AOP_TYPE(x) == AOP_CRY || \
- AOP_TYPE(x) == AOP_DPTR || AOP(x)->paged))
-
-#define AOP_INPREG(x) (x && (x->type == AOP_REG && \
- (x->aopu.aop_reg[0] == mcs51_regWithIdx(R0_IDX) || \
- x->aopu.aop_reg[0] == mcs51_regWithIdx(R1_IDX) )))
-
-
/*-----------------------------------------------------------------*/
/* opIsGptr: returns non-zero if the passed operand is */
/* a generic pointer type. */
size = getDataSize (result);
if (size)
{
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
size--;
offset = 1;
/* unsigned or positive */
while (size--)
{
- aopPut (AOP (result), zero, offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, offset++, isOperandVolatile (result, FALSE));
}
}
}
{
/* if the result is bit */
if (AOP_TYPE (result) == AOP_CRY)
- aopPut (AOP (result), "c", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "c", 0, isOperandVolatile (result, FALSE));
else
{
emitcode ("clr", "a");
while (!AccUsed && size--)
{
- AccUsed |= aopGetUsesAcc(AOP (oper), offset++);
+ AccUsed |= aopGetUsesAcc(oper, offset++);
}
size = AOP_SIZE (oper) - 1;
offset = 1;
- MOVA (aopGet (AOP (oper), 0, FALSE, FALSE));
+ MOVA (aopGet (oper, 0, FALSE, FALSE));
if (size && AccUsed && (AOP (oper)->type != AOP_ACC))
{
pushedB = pushB ();
emitcode("mov", "b,a");
while (--size)
{
- MOVA (aopGet (AOP (oper), offset++, FALSE, FALSE));
+ MOVA (aopGet (oper, offset++, FALSE, FALSE));
emitcode ("orl", "b,a");
}
- MOVA (aopGet (AOP (oper), offset++, FALSE, FALSE));
+ MOVA (aopGet (oper, offset++, FALSE, FALSE));
emitcode ("orl", "a,b");
popB (pushedB);
}
{
while (size--)
{
- emitcode ("orl", "a,%s", aopGet (AOP (oper), offset++, FALSE, FALSE));
+ emitcode ("orl", "a,%s", aopGet (oper, offset++, FALSE, FALSE));
}
}
}
}
tlbl=newiTempLabel(NULL);
- l = aopGet (AOP (IC_LEFT (ic)), offset++, FALSE, FALSE);
+ l = aopGet (IC_LEFT (ic), offset++, FALSE, FALSE);
if ((AOP_TYPE (IC_LEFT (ic)) == AOP_ACC && offset == 0) ||
AOP_TYPE (IC_LEFT (ic)) == AOP_REG ||
IS_AOP_PREG (IC_LEFT (ic)))
size = AOP_SIZE (IC_RESULT (ic));
while (size--)
{
- char *l = aopGet (AOP (IC_LEFT (ic)), offset, FALSE, FALSE);
+ char *l = aopGet (IC_LEFT (ic), offset, FALSE, FALSE);
MOVA (l);
emitcode ("cpl", "a");
- aopPut (AOP (IC_RESULT (ic)), "a", offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), "a", offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
}
while (size--)
{
- aopPut (AOP (result),
- aopGet (AOP (op), offset, FALSE, FALSE),
+ aopPut (result,
+ aopGet (op, offset, FALSE, FALSE),
offset,
isOperandVolatile (result, FALSE));
offset++;
}
- l = aopGet (AOP (op), offset, FALSE, FALSE);
+ l = aopGet (op, offset, FALSE, FALSE);
MOVA (l);
emitcode ("cpl", "acc.7");
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
}
/*-----------------------------------------------------------------*/
//CLRC ;
while (size--)
{
- char *l = aopGet (AOP (IC_LEFT (ic)), offset, FALSE, FALSE);
+ char *l = aopGet (IC_LEFT (ic), offset, FALSE, FALSE);
if (!strcmp (l, "a"))
{
if (offset == 0)
emitcode ("clr", "a");
emitcode ("subb", "a,%s", l);
}
- aopPut (AOP (IC_RESULT (ic)), "a", offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), "a", offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
}
/* if any remaining bytes in the result */
emitcode ("rlc", "a");
emitcode ("subb", "a,acc");
while (size--)
- aopPut (AOP (IC_RESULT (ic)), "a", offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), "a", offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
}
release:
int offset = 0;
while (size--)
{
- char *l = aopGet (AOP (oper), offset++, FALSE, TRUE);
+ char *l = aopGet (oper, offset++, FALSE, TRUE);
if (AOP_TYPE (oper) != AOP_REG &&
AOP_TYPE (oper) != AOP_DIR &&
strcmp (l, "a"))
while (size--)
{
- accuse |= aopPut (AOP (oper), fReturn[offset], offset, isOperandVolatile (oper, FALSE));
+ accuse |= aopPut (oper, fReturn[offset], offset, isOperandVolatile (oper, FALSE));
offset++;
}
return accuse;
if (size == 1)
{
- MOVA (aopGet (AOP (IC_LEFT (ic)), 0, FALSE, FALSE));
+ MOVA (aopGet (IC_LEFT (ic), 0, FALSE, FALSE));
emitcode ("mov", "%s,%s", r->name, spname);
emitcode ("inc", "%s", spname); // allocate space first
emitcode ("movx", "@%s,a", r->name);
while (size--)
{
- MOVA (aopGet (AOP (IC_LEFT (ic)), offset++, FALSE, FALSE));
+ MOVA (aopGet (IC_LEFT (ic), offset++, FALSE, FALSE));
emitcode ("movx", "@%s,a", r->name);
emitcode ("inc", "%s", r->name);
}
/* push it on the stack */
while (size--)
{
- l = aopGet (AOP (IC_LEFT (ic)), offset++, FALSE, TRUE);
+ l = aopGet (IC_LEFT (ic), offset++, FALSE, TRUE);
if (*l == '#')
{
MOVA (l);
while (size--)
{
- l = aopGet (AOP (IC_LEFT (ic)), offset++, FALSE, TRUE);
+ l = aopGet (IC_LEFT (ic), offset++, FALSE, TRUE);
if (AOP_TYPE (IC_LEFT (ic)) != AOP_REG &&
AOP_TYPE (IC_LEFT (ic)) != AOP_DIR &&
strcmp (l, "a"))
size = AOP_SIZE (IC_LEFT (ic));
offset = (size - 1);
while (size--)
- emitcode ("pop", "%s", aopGet (AOP (IC_LEFT (ic)), offset--,
+ emitcode ("pop", "%s", aopGet (IC_LEFT (ic), offset--,
FALSE, TRUE));
freeAsmop (IC_LEFT (ic), NULL, ic, TRUE);
if (sic->argreg == 1) {
while (size--) {
- char *l = aopGet (AOP (IC_LEFT (sic)), offset,
+ char *l = aopGet (IC_LEFT (sic), offset,
FALSE, FALSE);
if (strcmp (l, fReturn[offset]))
emitcode ("mov", "%s,%s", fReturn[offset], l);
} else {
while (size--) {
emitcode ("mov","b1_%d,%s",rb1_count++,
- aopGet (AOP (IC_LEFT (sic)), offset++,FALSE, FALSE));
+ aopGet (IC_LEFT (sic), offset++,FALSE, FALSE));
}
}
freeAsmop (IC_LEFT (sic), NULL, sic, TRUE);
{
if (options.useXstack)
{
- emitcode ("mov", "r0,%s", spname);
- emitcode ("inc", "%s", spname);
- emitcode ("xch", "a,_bpx");
- emitcode ("movx", "@r0,a");
- emitcode ("inc", "r0");
- emitcode ("mov", "a,r0");
- emitcode ("xch", "a,_bpx");
- emitcode ("push", "_bp"); /* save the callers stack */
- emitcode ("mov", "_bp,sp");
+ if (sym->xstack || FUNC_HASSTACKPARM(sym->type))
+ {
+ emitcode ("mov", "r0,%s", spname);
+ emitcode ("inc", "%s", spname);
+ emitcode ("xch", "a,_bpx");
+ emitcode ("movx", "@r0,a");
+ emitcode ("inc", "r0");
+ emitcode ("mov", "a,r0");
+ emitcode ("xch", "a,_bpx");
+ }
+ if (sym->stack)
+ {
+ emitcode ("push", "_bp"); /* save the callers stack */
+ emitcode ("mov", "_bp,sp");
+ }
}
else
{
- /* set up the stack */
- emitcode ("push", "_bp"); /* save the callers stack */
- emitcode ("mov", "_bp,sp");
+ if (sym->stack || FUNC_HASSTACKPARM(sym->type))
+ {
+ /* set up the stack */
+ emitcode ("push", "_bp"); /* save the callers stack */
+ emitcode ("mov", "_bp,sp");
+ }
}
}
if ((IFFUNC_ISREENT (sym->type) || options.stackAuto))
{
- emitcode ("mov", "sp,_bp");
- emitcode ("pop", "_bp");
-
if (options.useXstack)
{
- emitcode ("xch", "a,_bpx");
- emitcode ("mov", "r0,a");
- emitcode ("dec", "r0");
- emitcode ("movx", "a,@r0");
- emitcode ("xch", "a,_bpx");
- emitcode ("mov", "%s,r0", spname); //read before freeing stack space (interrupts)
+ if (sym->stack)
+ {
+ emitcode ("mov", "sp,_bp");
+ emitcode ("pop", "_bp");
+ }
+ if (sym->xstack || FUNC_HASSTACKPARM(sym->type))
+ {
+ emitcode ("xch", "a,_bpx");
+ emitcode ("mov", "r0,a");
+ emitcode ("dec", "r0");
+ emitcode ("movx", "a,@r0");
+ emitcode ("xch", "a,_bpx");
+ emitcode ("mov", "%s,r0", spname); //read before freeing stack space (interrupts)
+ }
+ }
+ else if (sym->stack || FUNC_HASSTACKPARM(sym->type))
+ {
+ emitcode ("mov", "sp,_bp");
+ emitcode ("pop", "_bp");
}
}
if (AOP_TYPE (IC_LEFT (ic)) == AOP_DPTR)
{
/* #NOCHANGE */
- l = aopGet (AOP (IC_LEFT (ic)), offset++,
+ l = aopGet (IC_LEFT (ic), offset++,
FALSE, TRUE);
emitcode ("push", "%s", l);
pushed++;
}
else
{
- l = aopGet (AOP (IC_LEFT (ic)), offset,
+ l = aopGet (IC_LEFT (ic), offset,
FALSE, FALSE);
if (strcmp (fReturn[offset], l))
emitcode ("mov", "%s,%s", fReturn[offset++], l);
tlbl = newiTempLabel (NULL);
emitTlbl = 1;
}
- emitcode ("inc", "%s", aopGet (AOP (IC_RESULT (ic)), LSB, FALSE, FALSE));
+ emitcode ("inc", "%s", aopGet (IC_RESULT (ic), LSB, FALSE, FALSE));
if (AOP_TYPE (IC_RESULT (ic)) == AOP_REG ||
IS_AOP_PREG (IC_RESULT (ic)))
emitcode ("cjne", "%s,#0x00,%05d$",
- aopGet (AOP (IC_RESULT (ic)), LSB, FALSE, FALSE),
+ aopGet (IC_RESULT (ic), LSB, FALSE, FALSE),
tlbl->key + 100);
else
{
emitcode ("clr", "a");
emitcode ("cjne", "a,%s,%05d$",
- aopGet (AOP (IC_RESULT (ic)), LSB, FALSE, FALSE),
+ aopGet (IC_RESULT (ic), LSB, FALSE, FALSE),
tlbl->key + 100);
}
- emitcode ("inc", "%s", aopGet (AOP (IC_RESULT (ic)), MSB16, FALSE, FALSE));
+ emitcode ("inc", "%s", aopGet (IC_RESULT (ic), MSB16, FALSE, FALSE));
if (size > 2)
{
if (AOP_TYPE (IC_RESULT (ic)) == AOP_REG ||
IS_AOP_PREG (IC_RESULT (ic)))
emitcode ("cjne", "%s,#0x00,%05d$",
- aopGet (AOP (IC_RESULT (ic)), MSB16, FALSE, FALSE),
+ aopGet (IC_RESULT (ic), MSB16, FALSE, FALSE),
tlbl->key + 100);
else
emitcode ("cjne", "a,%s,%05d$",
- aopGet (AOP (IC_RESULT (ic)), MSB16, FALSE, FALSE),
+ aopGet (IC_RESULT (ic), MSB16, FALSE, FALSE),
tlbl->key + 100);
- emitcode ("inc", "%s", aopGet (AOP (IC_RESULT (ic)), MSB24, FALSE, FALSE));
+ emitcode ("inc", "%s", aopGet (IC_RESULT (ic), MSB24, FALSE, FALSE));
}
if (size > 3)
{
if (AOP_TYPE (IC_RESULT (ic)) == AOP_REG ||
IS_AOP_PREG (IC_RESULT (ic)))
emitcode ("cjne", "%s,#0x00,%05d$",
- aopGet (AOP (IC_RESULT (ic)), MSB24, FALSE, FALSE),
+ aopGet (IC_RESULT (ic), MSB24, FALSE, FALSE),
tlbl->key + 100);
else
{
emitcode ("cjne", "a,%s,%05d$",
- aopGet (AOP (IC_RESULT (ic)), MSB24, FALSE, FALSE),
+ aopGet (IC_RESULT (ic), MSB24, FALSE, FALSE),
tlbl->key + 100);
}
- emitcode ("inc", "%s", aopGet (AOP (IC_RESULT (ic)), MSB32, FALSE, FALSE));
+ emitcode ("inc", "%s", aopGet (IC_RESULT (ic), MSB32, FALSE, FALSE));
}
if (emitTlbl)
if (icount > 3)
{
- MOVA (aopGet (AOP (IC_LEFT (ic)), 0, FALSE, FALSE));
+ MOVA (aopGet (IC_LEFT (ic), 0, FALSE, FALSE));
emitcode ("add", "a,#0x%02x", ((char) icount) & 0xff);
- aopPut (AOP (IC_RESULT (ic)), "a", 0, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), "a", 0, isOperandVolatile (IC_RESULT (ic), FALSE));
}
else
{
while (icount--)
- emitcode ("inc", "%s", aopGet (AOP (IC_LEFT (ic)), 0, FALSE, FALSE));
+ emitcode ("inc", "%s", aopGet (IC_LEFT (ic), 0, FALSE, FALSE));
}
return TRUE;
/* if the result is a bit */
if (AOP_TYPE (result) == AOP_CRY)
{
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
}
else
{
if (AOP_SIZE (IC_RESULT (ic)) == 3 &&
AOP_SIZE (IC_LEFT (ic)) == 3 &&
!sameRegs (AOP (IC_RESULT (ic)), AOP (IC_LEFT (ic))))
- aopPut (AOP (IC_RESULT (ic)),
- aopGet (AOP (IC_LEFT (ic)), 2, FALSE, FALSE),
+ aopPut (IC_RESULT (ic),
+ aopGet (IC_LEFT (ic)), 2, FALSE, FALSE),
2,
isOperandVolatile (IC_RESULT (ic), FALSE));
if (AOP_SIZE (IC_RESULT (ic)) == 3 &&
AOP_SIZE (IC_RIGHT (ic)) == 3 &&
!sameRegs (AOP (IC_RESULT (ic)), AOP (IC_RIGHT (ic))))
- aopPut (AOP (IC_RESULT (ic)),
- aopGet (AOP (IC_RIGHT (ic)), 2, FALSE, FALSE),
+ aopPut (IC_RESULT (ic),
+ aopGet (IC_RIGHT (ic)), 2, FALSE, FALSE),
2,
isOperandVolatile (IC_RESULT (ic), FALSE));
!sameRegs (AOP (IC_RESULT (ic)), AOP (IC_RIGHT (ic))))
{
char buffer[5];
- sprintf (buffer, "#%d", pointerCode (getSpec (operandType (IC_LEFT (ic)))));
- aopPut (AOP (IC_RESULT (ic)), buffer, 2, isOperandVolatile (IC_RESULT (ic), FALSE));
+ sprintf (buffer, "#%d", pointerTypeToGPByte (pointerCode (getSpec (operandType (IC_LEFT (ic)))), NULL, NULL));
+ aopPut (IC_RESULT (ic), buffer, 2, isOperandVolatile (IC_RESULT (ic), FALSE));
}
}
#else
opIsGptr (IC_LEFT (ic)) &&
!sameRegs (AOP (IC_RESULT (ic)), AOP (IC_LEFT (ic))))
{
- aopPut (AOP (IC_RESULT (ic)),
- aopGet (AOP (IC_LEFT (ic)), GPTRSIZE - 1, FALSE, FALSE),
+ aopPut (IC_RESULT (ic),
+ aopGet (IC_LEFT (ic), GPTRSIZE - 1, FALSE, FALSE),
GPTRSIZE - 1,
isOperandVolatile (IC_RESULT (ic), FALSE));
}
opIsGptr (IC_RIGHT (ic)) &&
!sameRegs (AOP (IC_RESULT (ic)), AOP (IC_RIGHT (ic))))
{
- aopPut (AOP (IC_RESULT (ic)),
- aopGet (AOP (IC_RIGHT (ic)), GPTRSIZE - 1, FALSE, FALSE),
+ aopPut (IC_RESULT (ic),
+ aopGet (IC_RIGHT (ic), GPTRSIZE - 1, FALSE, FALSE),
GPTRSIZE - 1,
isOperandVolatile (IC_RESULT (ic), FALSE));
}
!sameRegs (AOP (IC_RESULT (ic)), AOP (IC_RIGHT (ic))))
{
char buffer[5];
- sprintf (buffer, "#%d", pointerCode (getSpec (operandType (IC_LEFT (ic)))));
- aopPut (AOP (IC_RESULT (ic)), buffer, GPTRSIZE - 1, isOperandVolatile (IC_RESULT (ic), FALSE));
+ sprintf (buffer, "#%d", pointerTypeToGPByte (pointerCode (getSpec (operandType (IC_LEFT (ic)))), NULL, NULL));
+ aopPut (IC_RESULT (ic), buffer, GPTRSIZE - 1, isOperandVolatile (IC_RESULT (ic), FALSE));
}
}
#endif
int size, offset = 0;
int skip_bytes = 0;
char *add = "add";
- asmop *leftOp, *rightOp;
+ operand *leftOp, *rightOp;
operand * op;
/* special cases :- */
size = getDataSize (IC_RESULT (ic));
while (size--)
{
- MOVA (aopGet (AOP (IC_RIGHT (ic)), offset, FALSE, FALSE));
+ MOVA (aopGet (IC_RIGHT (ic), offset, FALSE, FALSE));
emitcode ("addc", "a,#00");
- aopPut (AOP (IC_RESULT (ic)), "a", offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), "a", offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
}
}
goto release;
goto release;
size = getDataSize (IC_RESULT (ic));
- leftOp = AOP(IC_LEFT(ic));
- rightOp = AOP(IC_RIGHT(ic));
+ leftOp = IC_LEFT(ic);
+ rightOp = IC_RIGHT(ic);
op=IC_LEFT(ic);
/* if this is an add for an array access
)
{
D(emitcode ("; genPlus aligned array",""));
- aopPut (AOP (IC_RESULT (ic)),
+ aopPut (IC_RESULT (ic),
aopGet (rightOp, 0, FALSE, FALSE),
0,
isOperandVolatile (IC_RESULT (ic), FALSE));
if( 1 == getDataSize (IC_RIGHT (ic)) )
{
- aopPut (AOP (IC_RESULT (ic)),
+ aopPut (IC_RESULT (ic),
aopGet (leftOp, 1, FALSE, FALSE),
1,
isOperandVolatile (IC_RESULT (ic), FALSE));
}
else
{
- MOVA (aopGet (AOP (IC_LEFT (ic)), 1, FALSE, FALSE));
+ MOVA (aopGet (IC_LEFT (ic), 1, FALSE, FALSE));
emitcode ("add", "a,%s", aopGet (rightOp, 1, FALSE, FALSE));
- aopPut (AOP (IC_RESULT (ic)), "a", 1, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), "a", 1, isOperandVolatile (IC_RESULT (ic), FALSE));
}
goto release;
}
MOVA (aopGet (rightOp, offset, FALSE, TRUE));
emitcode (add, "a,%s", aopGet (leftOp, offset, FALSE, TRUE));
}
- aopPut (AOP (IC_RESULT (ic)), "a", offset, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), "a", offset, isOperandVolatile (IC_RESULT (ic), FALSE));
add = "addc"; /* further adds must propagate carry */
}
else
isOperandVolatile (IC_RESULT (ic), FALSE))
{
/* just move */
- aopPut (AOP (IC_RESULT (ic)),
+ aopPut (IC_RESULT (ic),
aopGet (leftOp, offset, FALSE, FALSE),
offset,
isOperandVolatile (IC_RESULT (ic), FALSE));
emitTlbl = 1;
}
- emitcode ("dec", "%s", aopGet (AOP (IC_RESULT (ic)), LSB, FALSE, FALSE));
+ emitcode ("dec", "%s", aopGet (IC_RESULT (ic), LSB, FALSE, FALSE));
if (AOP_TYPE (IC_RESULT (ic)) == AOP_REG ||
IS_AOP_PREG (IC_RESULT (ic)))
emitcode ("cjne", "%s,#0xff,%05d$"
- ,aopGet (AOP (IC_RESULT (ic)), LSB, FALSE, FALSE)
+ ,aopGet (IC_RESULT (ic), LSB, FALSE, FALSE)
,tlbl->key + 100);
else
{
emitcode ("mov", "a,#0xff");
emitcode ("cjne", "a,%s,%05d$"
- ,aopGet (AOP (IC_RESULT (ic)), LSB, FALSE, FALSE)
+ ,aopGet (IC_RESULT (ic), LSB, FALSE, FALSE)
,tlbl->key + 100);
}
- emitcode ("dec", "%s", aopGet (AOP (IC_RESULT (ic)), MSB16, FALSE, FALSE));
+ emitcode ("dec", "%s", aopGet (IC_RESULT (ic), MSB16, FALSE, FALSE));
if (size > 2)
{
if (AOP_TYPE (IC_RESULT (ic)) == AOP_REG ||
IS_AOP_PREG (IC_RESULT (ic)))
emitcode ("cjne", "%s,#0xff,%05d$"
- ,aopGet (AOP (IC_RESULT (ic)), MSB16, FALSE, FALSE)
+ ,aopGet (IC_RESULT (ic), MSB16, FALSE, FALSE)
,tlbl->key + 100);
else
{
emitcode ("cjne", "a,%s,%05d$"
- ,aopGet (AOP (IC_RESULT (ic)), MSB16, FALSE, FALSE)
+ ,aopGet (IC_RESULT (ic), MSB16, FALSE, FALSE)
,tlbl->key + 100);
}
- emitcode ("dec", "%s", aopGet (AOP (IC_RESULT (ic)), MSB24, FALSE, FALSE));
+ emitcode ("dec", "%s", aopGet (IC_RESULT (ic), MSB24, FALSE, FALSE));
}
if (size > 3)
{
if (AOP_TYPE (IC_RESULT (ic)) == AOP_REG ||
IS_AOP_PREG (IC_RESULT (ic)))
emitcode ("cjne", "%s,#0xff,%05d$"
- ,aopGet (AOP (IC_RESULT (ic)), MSB24, FALSE, FALSE)
+ ,aopGet (IC_RESULT (ic), MSB24, FALSE, FALSE)
,tlbl->key + 100);
else
{
emitcode ("cjne", "a,%s,%05d$"
- ,aopGet (AOP (IC_RESULT (ic)), MSB24, FALSE, FALSE)
+ ,aopGet (IC_RESULT (ic), MSB24, FALSE, FALSE)
,tlbl->key + 100);
}
- emitcode ("dec", "%s", aopGet (AOP (IC_RESULT (ic)), MSB32, FALSE, FALSE));
+ emitcode ("dec", "%s", aopGet (IC_RESULT (ic), MSB32, FALSE, FALSE));
}
if (emitTlbl)
{
{
while (icount--)
- emitcode ("dec", "%s", aopGet (AOP (IC_RESULT (ic)), 0, FALSE, FALSE));
+ emitcode ("dec", "%s", aopGet (IC_RESULT (ic), 0, FALSE, FALSE));
return TRUE;
}
emitcode ("rlc", "a");
emitcode ("subb", "a,acc");
while (size--)
- aopPut (AOP (result), "a", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset++, isOperandVolatile (result, FALSE));
}
else
while (size--)
- aopPut (AOP (result), zero, offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, offset++, isOperandVolatile (result, FALSE));
}
}
emitcode ("jnb", "%s,%05d$", AOP (IC_LEFT (ic))->aopu.aop_dir, (lbl->key + 100));
emitcode ("inc", "a");
emitcode ("", "%05d$:", (lbl->key + 100));
- aopPut (AOP (IC_RESULT (ic)), "a", 0, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), "a", 0, isOperandVolatile (IC_RESULT (ic), FALSE));
addSign (IC_RESULT (ic), MSB16, SPEC_USIGN (getSpec (operandType (IC_RESULT (ic)))));
}
}
if (AOP_TYPE (IC_RIGHT (ic)) == AOP_LIT)
{
unsigned long lit = 0L;
+ bool useCarry = FALSE;
lit = (unsigned long) floatFromVal (AOP (IC_RIGHT (ic))->aopu.aop_lit);
lit = -(long) lit;
while (size--)
{
- MOVA (aopGet (AOP (IC_LEFT (ic)), offset, FALSE, FALSE));
- /* first add without previous c */
- if (!offset) {
- if (!size && lit== (unsigned long) -1) {
+ if (useCarry || ((lit >> (offset * 8)) & 0x0FFL)) {
+ MOVA (aopGet (IC_LEFT (ic), offset, FALSE, FALSE));
+ if (!offset && !size && lit== (unsigned long) -1) {
emitcode ("dec", "a");
- } else {
+ } else if (!useCarry) {
+ /* first add without previous c */
emitcode ("add", "a,#0x%02x",
- (unsigned int) (lit & 0x0FFL));
- }
+ (unsigned int) ((lit >> (offset * 8)) & 0x0FFL));
+ useCarry = TRUE;
} else {
emitcode ("addc", "a,#0x%02x",
(unsigned int) ((lit >> (offset * 8)) & 0x0FFL));
}
- aopPut (AOP (IC_RESULT (ic)), "a", offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), "a", offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
+ } else {
+ /* no need to add zeroes */
+ offset++;
+ }
}
}
else
{
- asmop *leftOp, *rightOp;
+ operand *leftOp, *rightOp;
- leftOp = AOP(IC_LEFT(ic));
- rightOp = AOP(IC_RIGHT(ic));
+ leftOp = IC_LEFT(ic);
+ rightOp = IC_RIGHT(ic);
while (size--)
{
aopGet(rightOp, offset, FALSE, TRUE));
}
- aopPut (AOP (IC_RESULT (ic)), "a", offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), "a", offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
}
}
if (AOP_TYPE (right) == AOP_LIT)
{
/* moving to accumulator first helps peepholes */
- MOVA (aopGet (AOP (left), 0, FALSE, FALSE));
- emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE));
+ MOVA (aopGet (left, 0, FALSE, FALSE));
+ emitcode ("mov", "b,%s", aopGet (right, 0, FALSE, FALSE));
}
else
{
- emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE));
- MOVA (aopGet (AOP (left), 0, FALSE, FALSE));
+ emitcode ("mov", "b,%s", aopGet (right, 0, FALSE, FALSE));
+ MOVA (aopGet (left, 0, FALSE, FALSE));
}
emitcode ("mul", "ab");
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
if (size == 2)
- aopPut (AOP (result), "b", 1, isOperandVolatile (result, FALSE));
+ aopPut (result, "b", 1, isOperandVolatile (result, FALSE));
popB (pushedB);
return;
{
if (rUnsigned) /* emitcode (";", "signed"); */
- emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE));
+ emitcode ("mov", "b,%s", aopGet (right, 0, FALSE, FALSE));
else
{
- MOVA (aopGet (AOP (right), 0, FALSE, FALSE));
+ MOVA (aopGet (right, 0, FALSE, FALSE));
lbl = newiTempLabel (NULL);
emitcode ("jnb", "acc.7,%05d$", (lbl->key + 100));
emitcode ("cpl", "F0"); /* complement sign flag */
}
else /* ! literal */
{
- MOVA (aopGet (AOP (left), 0, FALSE, FALSE));
+ MOVA (aopGet (left, 0, FALSE, FALSE));
if (!lUnsigned)
{
}
emitcode ("", "%05d$:", (lbl->key + 100));
}
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
if (size == 2)
- aopPut (AOP (result), "b", 1, isOperandVolatile (result, FALSE));
+ aopPut (result, "b", 1, isOperandVolatile (result, FALSE));
popB (pushedB);
}
pushedB = pushB ();
/* the result must be bit */
- emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE));
- l = aopGet (AOP (left), 0, FALSE, FALSE);
+ emitcode ("mov", "b,%s", aopGet (right, 0, FALSE, FALSE));
+ l = aopGet (left, 0, FALSE, FALSE);
MOVA (l);
popB (pushedB);
- aopPut (AOP (result), "c", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "c", 0, isOperandVolatile (result, FALSE));
}
/*-----------------------------------------------------------------*/
if (lUnsigned && rUnsigned)
{
/* unsigned is easy */
- emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE));
- MOVA (aopGet (AOP (left), 0, FALSE, FALSE));
+ emitcode ("mov", "b,%s", aopGet (right, 0, FALSE, FALSE));
+ MOVA (aopGet (left, 0, FALSE, FALSE));
emitcode ("div", "ab");
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
while (size--)
- aopPut (AOP (result), zero, offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, offset++, isOperandVolatile (result, FALSE));
popB (pushedB);
return;
else /* ! literal */
{
if (rUnsigned)
- emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE));
+ emitcode ("mov", "b,%s", aopGet (right, 0, FALSE, FALSE));
else
{
- MOVA (aopGet (AOP (right), 0, FALSE, FALSE));
+ MOVA (aopGet (right, 0, FALSE, FALSE));
lbl = newiTempLabel (NULL);
emitcode ("jnb", "acc.7,%05d$", (lbl->key + 100));
emitcode ("cpl", "F0"); /* complement sign flag */
}
else /* ! literal */
{
- MOVA (aopGet (AOP (left), 0, FALSE, FALSE));
+ MOVA (aopGet (left, 0, FALSE, FALSE));
if (!lUnsigned)
{
emitcode ("inc", "a");
emitcode ("", "%05d$:", (lbl->key + 100));
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
if (size > 0)
{
/* msb is 0x00 or 0xff depending on the sign */
emitcode ("mov", "c,F0");
emitcode ("subb", "a,acc");
while (size--)
- aopPut (AOP (result), "a", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset++, isOperandVolatile (result, FALSE));
}
else /* compiletimeSign */
while (size--)
- aopPut (AOP (result), "#0xff", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "#0xff", offset++, isOperandVolatile (result, FALSE));
}
}
else
{
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
while (size--)
- aopPut (AOP (result), zero, offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, offset++, isOperandVolatile (result, FALSE));
}
popB (pushedB);
pushedB = pushB ();
/* the result must be bit */
- emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE));
- l = aopGet (AOP (left), 0, FALSE, FALSE);
+ emitcode ("mov", "b,%s", aopGet (right, 0, FALSE, FALSE));
+ l = aopGet (left, 0, FALSE, FALSE);
MOVA (l);
popB (pushedB);
- aopPut (AOP (result), "c", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "c", 0, isOperandVolatile (result, FALSE));
}
/*-----------------------------------------------------------------*/
/* because iCode should have been changed to genAnd */
/* see file "SDCCopt.c", function "convertToFcall()" */
- MOVA (aopGet (AOP (left), 0, FALSE, FALSE));
+ MOVA (aopGet (left, 0, FALSE, FALSE));
emitcode ("mov", "c,acc.7");
emitcode ("anl", "a,#0x%02x", val - 1);
lbl = newiTempLabel (NULL);
int size2 = size;
int offs2 = offset;
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
while (size2--)
- aopPut (AOP (result), "#0xff", offs2++, isOperandVolatile (result, FALSE));
+ aopPut (result, "#0xff", offs2++, isOperandVolatile (result, FALSE));
lbl2 = newiTempLabel (NULL);
emitcode ("sjmp", "%05d$", (lbl2->key + 100));
}
emitcode ("", "%05d$:", (lbl->key + 100));
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
while (size--)
- aopPut (AOP (result), zero, offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, offset++, isOperandVolatile (result, FALSE));
if (lbl2)
{
emitcode ("", "%05d$:", (lbl2->key + 100));
if (lUnsigned && rUnsigned)
{
/* unsigned is easy */
- emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE));
- MOVA (aopGet (AOP (left), 0, FALSE, FALSE));
+ emitcode ("mov", "b,%s", aopGet (right, 0, FALSE, FALSE));
+ MOVA (aopGet (left, 0, FALSE, FALSE));
emitcode ("div", "ab");
- aopPut (AOP (result), "b", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "b", 0, isOperandVolatile (result, FALSE));
while (size--)
- aopPut (AOP (result), zero, offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, offset++, isOperandVolatile (result, FALSE));
popB (pushedB);
return;
else /* not literal */
{
if (rUnsigned)
- emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE));
+ emitcode ("mov", "b,%s", aopGet (right, 0, FALSE, FALSE));
else
{
- MOVA (aopGet (AOP (right), 0, FALSE, FALSE));
+ MOVA (aopGet (right, 0, FALSE, FALSE));
lbl = newiTempLabel (NULL);
emitcode ("jnb", "acc.7,%05d$", (lbl->key + 100));
emitcode ("cpl", "a"); /* 2's complement */
}
else /* ! literal */
{
- MOVA (aopGet (AOP (left), 0, FALSE, FALSE));
+ MOVA (aopGet (left, 0, FALSE, FALSE));
if (!lUnsigned)
{
emitcode ("inc", "a");
emitcode ("", "%05d$:", (lbl->key + 100));
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
if (size > 0)
{
/* msb is 0x00 or 0xff depending on the sign */
emitcode ("mov", "c,F0");
emitcode ("subb", "a,acc");
while (size--)
- aopPut (AOP (result), "a", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset++, isOperandVolatile (result, FALSE));
}
else /* compiletimeSign */
while (size--)
- aopPut (AOP (result), "#0xff", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "#0xff", offset++, isOperandVolatile (result, FALSE));
}
}
else
{
- aopPut (AOP (result), "b", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "b", 0, isOperandVolatile (result, FALSE));
while (size--)
- aopPut (AOP (result), zero, offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, offset++, isOperandVolatile (result, FALSE));
}
popB (pushedB);
{
symbol *lbl = newiTempLabel (NULL);
emitcode ("cjne", "%s,%s,%05d$",
- aopGet (AOP (left), offset, FALSE, FALSE),
- aopGet (AOP (right), offset, FALSE, FALSE),
+ aopGet (left, offset, FALSE, FALSE),
+ aopGet (right, offset, FALSE, FALSE),
lbl->key + 100);
emitcode ("", "%05d$:", lbl->key + 100);
}
}
else
{
- MOVA (aopGet (AOP (left), AOP_SIZE (left) - 1, FALSE, FALSE));
+ MOVA (aopGet (left, AOP_SIZE (left) - 1, FALSE, FALSE));
if (!(AOP_TYPE (result) == AOP_CRY && AOP_SIZE (result)) && ifx)
{
genIfxJump (ifx, "acc.7", left, right, result);
while (size--)
{
bool pushedB = FALSE;
- rightInB = aopGetUsesAcc(AOP (right), offset);
+ rightInB = aopGetUsesAcc(right, offset);
if (rightInB)
{
pushedB = pushB ();
- emitcode ("mov", "b,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ emitcode ("mov", "b,%s", aopGet (right, offset, FALSE, FALSE));
}
- MOVA (aopGet (AOP (left), offset, FALSE, FALSE));
+ MOVA (aopGet (left, offset, FALSE, FALSE));
if (sign && size == 0)
{
emitcode ("xrl", "a,#0x80");
{
pushedB = pushB ();
rightInB++;
- emitcode ("mov", "b,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ emitcode ("mov", "b,%s", aopGet (right, offset, FALSE, FALSE));
}
emitcode ("xrl", "b,#0x80");
emitcode ("subb", "a,b");
if (rightInB)
emitcode ("subb", "a,b");
else
- emitcode ("subb", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ emitcode ("subb", "a,%s", aopGet (right, offset, FALSE, FALSE));
}
if (rightInB)
popB (pushedB);
while (size--)
{
emitcode ("cjne", "%s,%s,%05d$",
- aopGet (AOP (left), offset, FALSE, FALSE),
- aopGet (AOP (right), offset, FALSE, FALSE),
+ aopGet (left, offset, FALSE, FALSE),
+ aopGet (right, offset, FALSE, FALSE),
lbl->key + 100);
offset++;
}
{
while (size--)
{
- MOVA (aopGet (AOP (left), offset, FALSE, FALSE));
+ MOVA (aopGet (left, offset, FALSE, FALSE));
if ((AOP_TYPE (left) == AOP_DIR && AOP_TYPE (right) == AOP_LIT) &&
((unsigned int) ((lit >> (offset * 8)) & 0x0FFL) == 0))
emitcode ("jnz", "%05d$", lbl->key + 100);
else
emitcode ("cjne", "a,%s,%05d$",
- aopGet (AOP (right), offset, FALSE, TRUE),
+ aopGet (right, offset, FALSE, TRUE),
lbl->key + 100);
offset++;
}
char *l;
//if B in use: push B; mov B,left; mov A,right; clrc; subb A,B; pop B; jnz
wassertl(!BINUSE, "B was in use");
- l = aopGet (AOP (left), offset, FALSE, FALSE);
+ l = aopGet (left, offset, FALSE, FALSE);
if (strcmp (l, "b"))
emitcode ("mov", "b,%s", l);
- MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+ MOVA (aopGet (right, offset, FALSE, FALSE));
emitcode ("cjne", "a,b,%05d$", lbl->key + 100);
offset++;
}
gencjne (left, right, newiTempLabel (NULL));
if (AOP_TYPE (result) == AOP_CRY && AOP_SIZE (result))
{
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
goto release;
}
if (ifx)
else
{
// c = bit & val;
- MOVA (aopGet (AOP (right), 0, FALSE, FALSE));
+ MOVA (aopGet (right, 0, FALSE, FALSE));
// c = lsb
emitcode ("rrc", "a");
emitcode ("anl", "c,%s", AOP (left)->aopu.aop_dir);
if (posbit)
{
posbit--;
- MOVA (aopGet (AOP (left), posbit >> 3, FALSE, FALSE));
+ MOVA (aopGet (left, posbit >> 3, FALSE, FALSE));
// bit = left & 2^n
if (size)
{
{
if ((bytelit = ((lit >> (offset * 8)) & 0x0FFL)) != 0x0L)
{
- MOVA (aopGet (AOP (left), offset, FALSE, FALSE));
+ MOVA (aopGet (left, offset, FALSE, FALSE));
// byte == 2^n ?
if ((posbit = isLiteralBit (bytelit)) != 0)
emitcode ("jb", "acc.%d,%05d$", (posbit - 1) & 0x07, tlbl->key + 100);
{
if (bytelit != 0x0FFL)
emitcode ("anl", "a,%s",
- aopGet (AOP (right), offset, FALSE, TRUE));
+ aopGet (right, offset, FALSE, TRUE));
emitcode ("jnz", "%05d$", tlbl->key + 100);
}
}
{
/* dummy read of volatile operand */
if (isOperandVolatile (left, FALSE))
- MOVA (aopGet (AOP (left), offset, FALSE, FALSE));
+ MOVA (aopGet (left, offset, FALSE, FALSE));
else
continue;
}
else if (bytelit == 0)
{
- aopPut (AOP (result), zero, offset, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, offset, isOperandVolatile (result, FALSE));
}
else if (IS_AOP_PREG (result))
{
- MOVA (aopGet (AOP (left), offset, FALSE, TRUE));
- emitcode ("anl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ MOVA (aopGet (left, offset, FALSE, TRUE));
+ emitcode ("anl", "a,%s", aopGet (right, offset, FALSE, FALSE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
}
else
emitcode ("anl", "%s,%s",
- aopGet (AOP (left), offset, FALSE, TRUE),
- aopGet (AOP (right), offset, FALSE, FALSE));
+ aopGet (left, offset, FALSE, TRUE),
+ aopGet (right, offset, FALSE, FALSE));
}
else
{
if (AOP_TYPE (left) == AOP_ACC && offset == 0)
{
- emitcode ("anl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ emitcode ("anl", "a,%s", aopGet (right, offset, FALSE, FALSE));
}
else
{
- MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+ MOVA (aopGet (right, offset, FALSE, FALSE));
if (IS_AOP_PREG (result))
{
- emitcode ("anl", "a,%s", aopGet (AOP (left), offset, FALSE, TRUE));
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ emitcode ("anl", "a,%s", aopGet (left, offset, FALSE, TRUE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
}
else
emitcode ("anl", "%s,a",
- aopGet (AOP (left), offset, FALSE, TRUE));
+ aopGet (left, offset, FALSE, TRUE));
}
}
}
if (offset)
emitcode("mov", "a,b");
emitcode ("anl", "a,%s",
- aopGet (AOP (right), offset, FALSE, FALSE));
+ aopGet (right, offset, FALSE, FALSE));
} else {
if (AOP_TYPE(left)==AOP_ACC)
{
{
bool pushedB = pushB ();
emitcode("mov", "b,a");
- MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+ MOVA (aopGet (right, offset, FALSE, FALSE));
emitcode("anl", "a,b");
popB (pushedB);
}
else
{
- MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+ MOVA (aopGet (right, offset, FALSE, FALSE));
emitcode("anl", "a,b");
}
} else {
- MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+ MOVA (aopGet (right, offset, FALSE, FALSE));
emitcode ("anl", "a,%s",
- aopGet (AOP (left), offset, FALSE, FALSE));
+ aopGet (left, offset, FALSE, FALSE));
}
}
emitcode ("jnz", "%05d$", tlbl->key + 100);
bytelit = (int) ((lit >> (offset * 8)) & 0x0FFL);
if (bytelit == 0x0FF)
{
- aopPut (AOP (result),
- aopGet (AOP (left), offset, FALSE, FALSE),
+ aopPut (result,
+ aopGet (left, offset, FALSE, FALSE),
offset,
isOperandVolatile (result, FALSE));
continue;
{
/* dummy read of volatile operand */
if (isOperandVolatile (left, FALSE))
- MOVA (aopGet (AOP (left), offset, FALSE, FALSE));
- aopPut (AOP (result), zero, offset, isOperandVolatile (result, FALSE));
+ MOVA (aopGet (left, offset, FALSE, FALSE));
+ aopPut (result, zero, offset, isOperandVolatile (result, FALSE));
continue;
}
else if (AOP_TYPE (left) == AOP_ACC)
{
if (!offset)
{
- emitcode ("anl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ emitcode ("anl", "a,%s", aopGet (right, offset, FALSE, FALSE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
continue;
}
else
{
- emitcode ("anl", "b,%s", aopGet (AOP (right), offset, FALSE, FALSE));
- aopPut (AOP (result), "b", offset, isOperandVolatile (result, FALSE));
+ emitcode ("anl", "b,%s", aopGet (right, offset, FALSE, FALSE));
+ aopPut (result, "b", offset, isOperandVolatile (result, FALSE));
continue;
}
}
{
if (offset)
emitcode("mov", "a,b");
- emitcode ("anl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ emitcode ("anl", "a,%s", aopGet (right, offset, FALSE, FALSE));
}
else
{
- MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+ MOVA (aopGet (right, offset, FALSE, FALSE));
emitcode ("anl", "a,%s",
- aopGet (AOP (left), offset, FALSE, FALSE));
+ aopGet (left, offset, FALSE, FALSE));
}
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
}
}
}
{
/* dummy read of volatile operand */
if (isOperandVolatile (left, FALSE))
- MOVA (aopGet (AOP (left), offset, FALSE, FALSE));
+ MOVA (aopGet (left, offset, FALSE, FALSE));
else
continue;
}
else if (bytelit == 0x0FF)
{
- aopPut (AOP (result), "#0xFF", offset, isOperandVolatile (result, FALSE));
+ aopPut (result, "#0xFF", offset, isOperandVolatile (result, FALSE));
}
else if (IS_AOP_PREG (left))
{
- MOVA (aopGet (AOP (left), offset, FALSE, TRUE));
- emitcode ("orl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ MOVA (aopGet (left, offset, FALSE, TRUE));
+ emitcode ("orl", "a,%s", aopGet (right, offset, FALSE, FALSE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
}
else
{
emitcode ("orl", "%s,%s",
- aopGet (AOP (left), offset, FALSE, TRUE),
- aopGet (AOP (right), offset, FALSE, FALSE));
+ aopGet (left, offset, FALSE, TRUE),
+ aopGet (right, offset, FALSE, FALSE));
}
}
else
{
if (offset)
emitcode("mov", "a,b");
- emitcode ("orl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ emitcode ("orl", "a,%s", aopGet (right, offset, FALSE, FALSE));
}
else
{
- MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+ MOVA (aopGet (right, offset, FALSE, FALSE));
if (IS_AOP_PREG (left))
{
- emitcode ("orl", "a,%s", aopGet (AOP (left), offset, FALSE, TRUE));
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ emitcode ("orl", "a,%s", aopGet (left, offset, FALSE, TRUE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
}
else
{
emitcode ("orl", "%s,a",
- aopGet (AOP (left), offset, FALSE, TRUE));
+ aopGet (left, offset, FALSE, TRUE));
}
}
}
if (offset)
emitcode("mov", "a,b");
emitcode ("orl", "a,%s",
- aopGet (AOP (right), offset, FALSE, FALSE));
+ aopGet (right, offset, FALSE, FALSE));
} else {
- MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+ MOVA (aopGet (right, offset, FALSE, FALSE));
emitcode ("orl", "a,%s",
- aopGet (AOP (left), offset, FALSE, FALSE));
+ aopGet (left, offset, FALSE, FALSE));
}
emitcode ("jnz", "%05d$", tlbl->key + 100);
offset++;
bytelit = (int) ((lit >> (offset * 8)) & 0x0FFL);
if (bytelit == 0)
{
- aopPut (AOP (result),
- aopGet (AOP (left), offset, FALSE, FALSE),
+ aopPut (result,
+ aopGet (left, offset, FALSE, FALSE),
offset,
isOperandVolatile (result, FALSE));
continue;
{
/* dummy read of volatile operand */
if (isOperandVolatile (left, FALSE))
- MOVA (aopGet (AOP (left), offset, FALSE, FALSE));
- aopPut (AOP (result), "#0xFF", offset, isOperandVolatile (result, FALSE));
+ MOVA (aopGet (left, offset, FALSE, FALSE));
+ aopPut (result, "#0xFF", offset, isOperandVolatile (result, FALSE));
continue;
}
}
{
if (offset)
emitcode("mov", "a,b");
- emitcode ("orl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ emitcode ("orl", "a,%s", aopGet (right, offset, FALSE, FALSE));
}
else
{
- MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+ MOVA (aopGet (right, offset, FALSE, FALSE));
emitcode ("orl", "a,%s",
- aopGet (AOP (left), offset, FALSE, FALSE));
+ aopGet (left, offset, FALSE, FALSE));
}
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
}
}
}
emitcode ("setb", "c");
while (sizer)
{
- MOVA (aopGet (AOP (right), sizer - 1, FALSE, FALSE));
+ MOVA (aopGet (right, sizer - 1, FALSE, FALSE));
if (sizer == 1)
// test the msb of the lsb
emitcode ("anl", "a,#0xfe");
{
/* dummy read of volatile operand */
if (isOperandVolatile (left, FALSE))
- MOVA (aopGet (AOP (left), offset, FALSE, FALSE));
+ MOVA (aopGet (left, offset, FALSE, FALSE));
else
continue;
}
else if (IS_AOP_PREG (left))
{
- MOVA (aopGet (AOP (left), offset, FALSE, TRUE));
- emitcode ("xrl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ MOVA (aopGet (left, offset, FALSE, TRUE));
+ emitcode ("xrl", "a,%s", aopGet (right, offset, FALSE, FALSE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
}
else
{
emitcode ("xrl", "%s,%s",
- aopGet (AOP (left), offset, FALSE, TRUE),
- aopGet (AOP (right), offset, FALSE, FALSE));
+ aopGet (left, offset, FALSE, TRUE),
+ aopGet (right, offset, FALSE, FALSE));
}
}
else
{
if (offset)
emitcode("mov", "a,b");
- emitcode ("xrl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ emitcode ("xrl", "a,%s", aopGet (right, offset, FALSE, FALSE));
}
else
{
- MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+ MOVA (aopGet (right, offset, FALSE, FALSE));
if (IS_AOP_PREG (left))
{
- emitcode ("xrl", "a,%s", aopGet (AOP (left), offset, FALSE, TRUE));
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ emitcode ("xrl", "a,%s", aopGet (left, offset, FALSE, TRUE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
}
else
emitcode ("xrl", "%s,a",
- aopGet (AOP (left), offset, FALSE, TRUE));
+ aopGet (left, offset, FALSE, TRUE));
}
}
}
if ((AOP_TYPE (right) == AOP_LIT) &&
(((lit >> (offset * 8)) & 0x0FFL) == 0x00L))
{
- MOVA (aopGet (AOP (left), offset, FALSE, FALSE));
+ MOVA (aopGet (left, offset, FALSE, FALSE));
}
else
{
if (offset)
emitcode("mov", "a,b");
emitcode ("xrl", "a,%s",
- aopGet (AOP (right), offset, FALSE, FALSE));
+ aopGet (right, offset, FALSE, FALSE));
} else {
- MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+ MOVA (aopGet (right, offset, FALSE, FALSE));
emitcode ("xrl", "a,%s",
- aopGet (AOP (left), offset, FALSE, FALSE));
+ aopGet (left, offset, FALSE, FALSE));
}
}
emitcode ("jnz", "%05d$", tlbl->key + 100);
bytelit = (int) ((lit >> (offset * 8)) & 0x0FFL);
if (bytelit == 0)
{
- aopPut (AOP (result),
- aopGet (AOP (left), offset, FALSE, FALSE),
+ aopPut (result,
+ aopGet (left, offset, FALSE, FALSE),
offset,
isOperandVolatile (result, FALSE));
continue;
{
if (offset)
emitcode("mov", "a,b");
- emitcode ("xrl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ emitcode ("xrl", "a,%s", aopGet (right, offset, FALSE, FALSE));
}
else
{
- MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+ MOVA (aopGet (right, offset, FALSE, FALSE));
emitcode ("xrl", "a,%s",
- aopGet (AOP (left), offset, FALSE, TRUE));
+ aopGet (left, offset, FALSE, TRUE));
}
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
}
}
}
size = AOP_SIZE (result);
offset = size - 1;
if (size == 1) { /* special case for 1 byte */
- l = aopGet (AOP (left), offset, FALSE, FALSE);
+ l = aopGet (left, offset, FALSE, FALSE);
MOVA (l);
emitcode ("rr", "a");
goto release;
/* no need to clear carry, bit7 will be written later */
while (size--)
{
- l = aopGet (AOP (left), offset, FALSE, FALSE);
+ l = aopGet (left, offset, FALSE, FALSE);
MOVA (l);
emitcode ("rrc", "a");
if (AOP_SIZE (result) > 1)
- aopPut (AOP (result), "a", offset--, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset--, isOperandVolatile (result, FALSE));
}
/* now we need to put the carry into the
highest order byte of the result */
if (AOP_SIZE (result) > 1)
{
- l = aopGet (AOP (result), AOP_SIZE (result) - 1, FALSE, FALSE);
+ l = aopGet (result, AOP_SIZE (result) - 1, FALSE, FALSE);
MOVA (l);
}
emitcode ("mov", "acc.7,c");
release:
- aopPut (AOP (result), "a", AOP_SIZE (result) - 1, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", AOP_SIZE (result) - 1, isOperandVolatile (result, FALSE));
freeAsmop (left, NULL, ic, TRUE);
freeAsmop (result, NULL, ic, TRUE);
}
offset = 0;
if (size--)
{
- l = aopGet (AOP (left), offset, FALSE, FALSE);
+ l = aopGet (left, offset, FALSE, FALSE);
MOVA (l);
if (size == 0) { /* special case for 1 byte */
emitcode("rl","a");
}
emitcode("rlc","a"); /* bit0 will be written later */
if (AOP_SIZE (result) > 1)
- aopPut (AOP (result), "a", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset++, isOperandVolatile (result, FALSE));
while (size--)
{
- l = aopGet (AOP (left), offset, FALSE, FALSE);
+ l = aopGet (left, offset, FALSE, FALSE);
MOVA (l);
emitcode ("rlc", "a");
if (AOP_SIZE (result) > 1)
- aopPut (AOP (result), "a", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset++, isOperandVolatile (result, FALSE));
}
}
/* now we need to put the carry into the
highest order byte of the result */
if (AOP_SIZE (result) > 1)
{
- l = aopGet (AOP (result), 0, FALSE, FALSE);
+ l = aopGet (result, 0, FALSE, FALSE);
MOVA (l);
}
emitcode ("mov", "acc.0,c");
release:
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
freeAsmop (left, NULL, ic, TRUE);
freeAsmop (result, NULL, ic, TRUE);
}
aopOp (result, ic, FALSE);
/* get the highest order byte into a */
- MOVA (aopGet (AOP (left), AOP_SIZE (left) - 1, FALSE, FALSE));
+ MOVA (aopGet (left, AOP_SIZE (left) - 1, FALSE, FALSE));
if (AOP_TYPE (result) == AOP_CRY)
{
emitcode ("rlc", "a");
switch (AOP_SIZE (left))
{
case 1: /* swap nibbles in byte */
- MOVA (aopGet (AOP (left), 0, FALSE, FALSE));
+ MOVA (aopGet (left, 0, FALSE, FALSE));
emitcode ("swap", "a");
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
break;
case 2: /* swap bytes in word */
if (AOP_TYPE(left) == AOP_REG && sameRegs(AOP(left), AOP(result)))
{
- MOVA (aopGet (AOP (left), 0, FALSE, FALSE));
- aopPut (AOP (result), aopGet (AOP (left), 1, FALSE, FALSE),
+ MOVA (aopGet (left, 0, FALSE, FALSE));
+ aopPut (result, aopGet (left, 1, FALSE, FALSE),
0, isOperandVolatile (result, FALSE));
- aopPut (AOP (result), "a", 1, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 1, isOperandVolatile (result, FALSE));
}
else if (operandsEqu (left, result))
{
char * reg = "a";
bool pushedB = FALSE, leftInB = FALSE;
- MOVA (aopGet (AOP (left), 0, FALSE, FALSE));
- if (aopGetUsesAcc(AOP (left), 1) || aopGetUsesAcc(AOP (result), 0))
+ MOVA (aopGet (left, 0, FALSE, FALSE));
+ if (aopGetUsesAcc(left, 1) || aopGetUsesAcc(result, 0))
{
pushedB = pushB ();
emitcode ("mov", "b,a");
reg = "b";
leftInB = TRUE;
}
- aopPut (AOP (result), aopGet (AOP (left), 1, FALSE, FALSE),
+ aopPut (result, aopGet (left, 1, FALSE, FALSE),
0, isOperandVolatile (result, FALSE));
- aopPut (AOP (result), reg, 1, isOperandVolatile (result, FALSE));
+ aopPut (result, reg, 1, isOperandVolatile (result, FALSE));
if (leftInB)
popB (pushedB);
}
else
{
- aopPut (AOP (result), aopGet (AOP (left), 1, FALSE, FALSE),
+ aopPut (result, aopGet (left, 1, FALSE, FALSE),
0, isOperandVolatile (result, FALSE));
- aopPut (AOP (result), aopGet (AOP (left), 0, FALSE, FALSE),
+ aopPut (result, aopGet (left, 0, FALSE, FALSE),
1, isOperandVolatile (result, FALSE));
}
break;
operand * result, int offr,
int shCount, int sign)
{
- MOVA (aopGet (AOP (left), offl, FALSE, FALSE));
+ MOVA (aopGet (left, offl, FALSE, FALSE));
/* shift right accumulator */
if (sign)
AccSRsh (shCount);
else
AccRsh (shCount);
- aopPut (AOP (result), "a", offr, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offr, isOperandVolatile (result, FALSE));
}
/*-----------------------------------------------------------------*/
operand * result, int offr, int shCount)
{
char *l;
- l = aopGet (AOP (left), offl, FALSE, FALSE);
+ l = aopGet (left, offl, FALSE, FALSE);
MOVA (l);
/* shift left accumulator */
AccLsh (shCount);
- aopPut (AOP (result), "a", offr, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offr, isOperandVolatile (result, FALSE));
}
/*-----------------------------------------------------------------*/
char *l;
if (!sameRegs (AOP (left), AOP (result)) || (offl != offr))
{
- l = aopGet (AOP (left), offl, FALSE, FALSE);
+ l = aopGet (left, offl, FALSE, FALSE);
if (*l == '@' && (IS_AOP_PREG (result)))
{
emitcode ("mov", "a,%s", l);
- aopPut (AOP (result), "a", offr, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offr, isOperandVolatile (result, FALSE));
}
else
{
if (!sign)
- aopPut (AOP (result), l, offr, isOperandVolatile (result, FALSE));
+ aopPut (result, l, offr, isOperandVolatile (result, FALSE));
else
{
/* MSB sign in acc.7 ! */
if (getDataSize (left) == offl + 1)
{
emitcode ("mov", "a,%s", l);
- aopPut (AOP (result), "a", offr, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offr, isOperandVolatile (result, FALSE));
}
}
}
((offl + MSB16) == offr))
{
/* don't crash result[offr] */
- MOVA (aopGet (AOP (left), offl, FALSE, FALSE));
- emitcode ("xch", "a,%s", aopGet (AOP (left), offl + MSB16, FALSE, FALSE));
+ MOVA (aopGet (left, offl, FALSE, FALSE));
+ emitcode ("xch", "a,%s", aopGet (left, offl + MSB16, FALSE, FALSE));
}
else
{
movLeft2Result (left, offl, result, offr, 0);
- MOVA (aopGet (AOP (left), offl + MSB16, FALSE, FALSE));
+ MOVA (aopGet (left, offl + MSB16, FALSE, FALSE));
}
/* ax << shCount (x = lsb(result)) */
- AccAXLsh (aopGet (AOP (result), offr, FALSE, FALSE), shCount);
- aopPut (AOP (result), "a", offr + MSB16, isOperandVolatile (result, FALSE));
+ AccAXLsh (aopGet (result, offr, FALSE, FALSE), shCount);
+ aopPut (result, "a", offr + MSB16, isOperandVolatile (result, FALSE));
}
((offl + MSB16) == offr))
{
/* don't crash result[offr] */
- MOVA (aopGet (AOP (left), offl, FALSE, FALSE));
- emitcode ("xch", "a,%s", aopGet (AOP (left), offl + MSB16, FALSE, FALSE));
+ MOVA (aopGet (left, offl, FALSE, FALSE));
+ emitcode ("xch", "a,%s", aopGet (left, offl + MSB16, FALSE, FALSE));
}
else
{
movLeft2Result (left, offl, result, offr, 0);
- MOVA (aopGet (AOP (left), offl + MSB16, FALSE, FALSE));
+ MOVA (aopGet (left, offl + MSB16, FALSE, FALSE));
}
/* a:x >> shCount (x = lsb(result)) */
if (sign)
- AccAXRshS (aopGet (AOP (result), offr, FALSE, FALSE), shCount);
+ AccAXRshS (aopGet (result, offr, FALSE, FALSE), shCount);
else
- AccAXRsh (aopGet (AOP (result), offr, FALSE, FALSE), shCount);
+ AccAXRsh (aopGet (result, offr, FALSE, FALSE), shCount);
if (getDataSize (result) > 1)
- aopPut (AOP (result), "a", offr + MSB16, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offr + MSB16, isOperandVolatile (result, FALSE));
}
/*-----------------------------------------------------------------*/
shiftLLeftOrResult (operand * left, int offl,
operand * result, int offr, int shCount)
{
- MOVA (aopGet (AOP (left), offl, FALSE, FALSE));
+ MOVA (aopGet (left, offl, FALSE, FALSE));
/* shift left accumulator */
AccLsh (shCount);
/* or with result */
- emitcode ("orl", "a,%s", aopGet (AOP (result), offr, FALSE, FALSE));
+ emitcode ("orl", "a,%s", aopGet (result, offr, FALSE, FALSE));
/* back to result */
- aopPut (AOP (result), "a", offr, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offr, isOperandVolatile (result, FALSE));
}
/*-----------------------------------------------------------------*/
shiftRLeftOrResult (operand * left, int offl,
operand * result, int offr, int shCount)
{
- MOVA (aopGet (AOP (left), offl, FALSE, FALSE));
+ MOVA (aopGet (left, offl, FALSE, FALSE));
/* shift right accumulator */
AccRsh (shCount);
/* or with result */
- emitcode ("orl", "a,%s", aopGet (AOP (result), offr, FALSE, FALSE));
+ emitcode ("orl", "a,%s", aopGet (result, offr, FALSE, FALSE));
/* back to result */
- aopPut (AOP (result), "a", offr, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offr, isOperandVolatile (result, FALSE));
}
/*-----------------------------------------------------------------*/
else
movLeft2Result (left, LSB, result, MSB16, 0);
}
- aopPut (AOP (result), zero, LSB, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, LSB, isOperandVolatile (result, FALSE));
}
/* 1 <= shCount <= 7 */
if (size >= LSB + offr)
{
- l = aopGet (AOP (left), LSB, FALSE, FALSE);
+ l = aopGet (left, LSB, FALSE, FALSE);
MOVA (l);
emitcode ("add", "a,acc");
if (sameRegs (AOP (left), AOP (result)) &&
size >= MSB16 + offr && offr != LSB)
emitcode ("xch", "a,%s",
- aopGet (AOP (left), LSB + offr, FALSE, FALSE));
+ aopGet (left, LSB + offr, FALSE, FALSE));
else
- aopPut (AOP (result), "a", LSB + offr, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", LSB + offr, isOperandVolatile (result, FALSE));
}
if (size >= MSB16 + offr)
{
if (!(sameRegs (AOP (result), AOP (left)) && size >= MSB16 + offr && offr != LSB))
{
- l = aopGet (AOP (left), MSB16, FALSE, FALSE);
+ l = aopGet (left, MSB16, FALSE, FALSE);
MOVA (l);
}
emitcode ("rlc", "a");
if (sameRegs (AOP (left), AOP (result)) &&
size >= MSB24 + offr && offr != LSB)
emitcode ("xch", "a,%s",
- aopGet (AOP (left), MSB16 + offr, FALSE, FALSE));
+ aopGet (left, MSB16 + offr, FALSE, FALSE));
else
- aopPut (AOP (result), "a", MSB16 + offr, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", MSB16 + offr, isOperandVolatile (result, FALSE));
}
if (size >= MSB24 + offr)
{
if (!(sameRegs (AOP (result), AOP (left)) && size >= MSB24 + offr && offr != LSB))
{
- l = aopGet (AOP (left), MSB24, FALSE, FALSE);
+ l = aopGet (left, MSB24, FALSE, FALSE);
MOVA (l);
}
emitcode ("rlc", "a");
if (sameRegs (AOP (left), AOP (result)) &&
size >= MSB32 + offr && offr != LSB)
emitcode ("xch", "a,%s",
- aopGet (AOP (left), MSB24 + offr, FALSE, FALSE));
+ aopGet (left, MSB24 + offr, FALSE, FALSE));
else
- aopPut (AOP (result), "a", MSB24 + offr, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", MSB24 + offr, isOperandVolatile (result, FALSE));
}
if (size > MSB32 + offr)
{
if (!(sameRegs (AOP (result), AOP (left)) && size >= MSB32 + offr && offr != LSB))
{
- l = aopGet (AOP (left), MSB32, FALSE, FALSE);
+ l = aopGet (left, MSB32, FALSE, FALSE);
MOVA (l);
}
emitcode ("rlc", "a");
- aopPut (AOP (result), "a", MSB32 + offr, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", MSB32 + offr, isOperandVolatile (result, FALSE));
}
if (offr != LSB)
- aopPut (AOP (result), zero, LSB, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, LSB, isOperandVolatile (result, FALSE));
}
/*-----------------------------------------------------------------*/
shiftL1Left2Result (left, LSB, result, MSB32, shCount);
else
movLeft2Result (left, LSB, result, MSB32, 0);
- aopPut (AOP (result), zero, LSB, isOperandVolatile (result, FALSE));
- aopPut (AOP (result), zero, MSB16, isOperandVolatile (result, FALSE));
- aopPut (AOP (result), zero, MSB24, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, LSB, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, MSB16, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, MSB24, isOperandVolatile (result, FALSE));
return;
}
movLeft2Result (left, MSB16, result, MSB32, 0);
movLeft2Result (left, LSB, result, MSB24, 0);
}
- aopPut (AOP (result), zero, MSB16, isOperandVolatile (result, FALSE));
- aopPut (AOP (result), zero, LSB, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, MSB16, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, LSB, isOperandVolatile (result, FALSE));
return;
}
movLeft2Result (left, MSB24, result, MSB32, 0);
movLeft2Result (left, MSB16, result, MSB24, 0);
movLeft2Result (left, LSB, result, MSB16, 0);
- aopPut (AOP (result), zero, LSB, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, LSB, isOperandVolatile (result, FALSE));
}
else if (shCount == 1)
shiftLLong (left, result, MSB16);
shiftL2Left2Result (left, MSB16, result, MSB24, shCount);
shiftL1Left2Result (left, LSB, result, MSB16, shCount);
shiftRLeftOrResult (left, LSB, result, MSB24, 8 - shCount);
- aopPut (AOP (result), zero, LSB, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, LSB, isOperandVolatile (result, FALSE));
}
}
}
else if (shCount >= (size * 8))
while (size--)
- aopPut (AOP (result), zero, size, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, size, isOperandVolatile (result, FALSE));
else
{
switch (size)
largest size of an object can be only 32 bits ) */
pushedB = pushB ();
- emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE));
+ emitcode ("mov", "b,%s", aopGet (right, 0, FALSE, FALSE));
emitcode ("inc", "b");
freeAsmop (right, NULL, ic, TRUE);
aopOp (left, ic, FALSE);
offset = 0;
while (size--)
{
- l = aopGet (AOP (left), offset, FALSE, TRUE);
+ l = aopGet (left, offset, FALSE, TRUE);
if (*l == '@' && (IS_AOP_PREG (result)))
{
emitcode ("mov", "a,%s", l);
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
}
else
- aopPut (AOP (result), l, offset, isOperandVolatile (result, FALSE));
+ aopPut (result, l, offset, isOperandVolatile (result, FALSE));
offset++;
}
}
{
symbol *tlbl1 = newiTempLabel (NULL);
- l = aopGet (AOP (left), 0, FALSE, FALSE);
+ l = aopGet (left, 0, FALSE, FALSE);
MOVA (l);
emitcode ("sjmp", "%05d$", tlbl1->key + 100);
emitcode ("", "%05d$:", tlbl->key + 100);
emitcode ("", "%05d$:", tlbl1->key + 100);
emitcode ("djnz", "b,%05d$", tlbl->key + 100);
popB (pushedB);
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
goto release;
}
emitcode ("sjmp", "%05d$", tlbl1->key + 100);
emitcode ("", "%05d$:", tlbl->key + 100);
- l = aopGet (AOP (result), offset, FALSE, FALSE);
+ l = aopGet (result, offset, FALSE, FALSE);
MOVA (l);
emitcode ("add", "a,acc");
- aopPut (AOP (result), "a", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset++, isOperandVolatile (result, FALSE));
while (--size)
{
- l = aopGet (AOP (result), offset, FALSE, FALSE);
+ l = aopGet (result, offset, FALSE, FALSE);
MOVA (l);
emitcode ("rlc", "a");
- aopPut (AOP (result), "a", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset++, isOperandVolatile (result, FALSE));
}
reAdjustPreg (AOP (result));
werror(E_INTERNAL_ERROR, __FILE__, __LINE__);
}
- MOVA (aopGet (AOP (left), MSB32, FALSE, FALSE));
+ MOVA (aopGet (left, MSB32, FALSE, FALSE));
if (offl==MSB16) {
// shift is > 8
emitcode ("rlc", "a");
emitcode ("subb", "a,acc");
if (isSameRegs)
- emitcode ("xch", "a,%s", aopGet(AOP(left), MSB32, FALSE, FALSE));
+ emitcode ("xch", "a,%s", aopGet (left, MSB32, FALSE, FALSE));
else {
- aopPut (AOP (result), "a", MSB32, isOperandVolatile (result, FALSE));
- MOVA (aopGet (AOP (left), MSB32, FALSE, FALSE));
+ aopPut (result, "a", MSB32, isOperandVolatile (result, FALSE));
+ MOVA (aopGet (left, MSB32, FALSE, FALSE));
}
} else {
- aopPut (AOP(result), zero, MSB32, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, MSB32, isOperandVolatile (result, FALSE));
}
}
emitcode ("rrc", "a");
if (isSameRegs && offl==MSB16) {
- emitcode ("xch", "a,%s",aopGet (AOP (left), MSB24, FALSE, FALSE));
+ emitcode ("xch", "a,%s",aopGet (left, MSB24, FALSE, FALSE));
} else {
- aopPut (AOP (result), "a", MSB32-offl, isOperandVolatile (result, FALSE));
- MOVA (aopGet (AOP (left), MSB24, FALSE, FALSE));
+ aopPut (result, "a", MSB32-offl, isOperandVolatile (result, FALSE));
+ MOVA (aopGet (left, MSB24, FALSE, FALSE));
}
emitcode ("rrc", "a");
if (isSameRegs && offl==1) {
- emitcode ("xch", "a,%s",aopGet (AOP (left), MSB16, FALSE, FALSE));
+ emitcode ("xch", "a,%s",aopGet (left, MSB16, FALSE, FALSE));
} else {
- aopPut (AOP (result), "a", MSB24-offl, isOperandVolatile (result, FALSE));
- MOVA (aopGet (AOP (left), MSB16, FALSE, FALSE));
+ aopPut (result, "a", MSB24-offl, isOperandVolatile (result, FALSE));
+ MOVA (aopGet (left, MSB16, FALSE, FALSE));
}
emitcode ("rrc", "a");
- aopPut (AOP (result), "a", MSB16 - offl, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", MSB16 - offl, isOperandVolatile (result, FALSE));
if (offl == LSB)
{
- MOVA (aopGet (AOP (left), LSB, FALSE, FALSE));
+ MOVA (aopGet (left, LSB, FALSE, FALSE));
emitcode ("rrc", "a");
- aopPut (AOP (result), "a", LSB, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", LSB, isOperandVolatile (result, FALSE));
}
}
{
if (sign) {
/* get sign in acc.7 */
- MOVA (aopGet (AOP (left), size - 1, FALSE, FALSE));
+ MOVA (aopGet (left, size - 1, FALSE, FALSE));
}
addSign (result, LSB, sign);
}
largest size of an object can be only 32 bits ) */
pushedB = pushB ();
- emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE));
+ emitcode ("mov", "b,%s", aopGet (right, 0, FALSE, FALSE));
emitcode ("inc", "b");
freeAsmop (right, NULL, ic, TRUE);
aopOp (left, ic, FALSE);
offset = 0;
while (size--)
{
- l = aopGet (AOP (left), offset, FALSE, TRUE);
+ l = aopGet (left, offset, FALSE, TRUE);
if (*l == '@' && IS_AOP_PREG (result))
{
emitcode ("mov", "a,%s", l);
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
}
else
- aopPut (AOP (result), l, offset, isOperandVolatile (result, FALSE));
+ aopPut (result, l, offset, isOperandVolatile (result, FALSE));
offset++;
}
}
size = AOP_SIZE (result);
offset = size - 1;
- MOVA (aopGet (AOP (left), offset, FALSE, FALSE));
+ MOVA (aopGet (left, offset, FALSE, FALSE));
emitcode ("rlc", "a");
emitcode ("mov", "ov,c");
/* if it is only one byte then */
if (size == 1)
{
- l = aopGet (AOP (left), 0, FALSE, FALSE);
+ l = aopGet (left, 0, FALSE, FALSE);
MOVA (l);
emitcode ("sjmp", "%05d$", tlbl1->key + 100);
emitcode ("", "%05d$:", tlbl->key + 100);
emitcode ("", "%05d$:", tlbl1->key + 100);
emitcode ("djnz", "b,%05d$", tlbl->key + 100);
popB (pushedB);
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
goto release;
}
emitcode ("mov", "c,ov");
while (size--)
{
- l = aopGet (AOP (result), offset, FALSE, FALSE);
+ l = aopGet (result, offset, FALSE, FALSE);
MOVA (l);
emitcode ("rrc", "a");
- aopPut (AOP (result), "a", offset--, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset--, isOperandVolatile (result, FALSE));
}
reAdjustPreg (AOP (result));
emitcode ("", "%05d$:", tlbl1->key + 100);
largest size of an object can be only 32 bits ) */
pushedB = pushB ();
- emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE));
+ emitcode ("mov", "b,%s", aopGet (right, 0, FALSE, FALSE));
emitcode ("inc", "b");
freeAsmop (right, NULL, ic, TRUE);
aopOp (left, ic, FALSE);
offset = 0;
while (size--)
{
- l = aopGet (AOP (left), offset, FALSE, TRUE);
+ l = aopGet (left, offset, FALSE, TRUE);
if (*l == '@' && IS_AOP_PREG (result))
{
emitcode ("mov", "a,%s", l);
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
}
else
- aopPut (AOP (result), l, offset, isOperandVolatile (result, FALSE));
+ aopPut (result, l, offset, isOperandVolatile (result, FALSE));
offset++;
}
}
/* if it is only one byte then */
if (size == 1)
{
- l = aopGet (AOP (left), 0, FALSE, FALSE);
+ l = aopGet (left, 0, FALSE, FALSE);
MOVA (l);
emitcode ("sjmp", "%05d$", tlbl1->key + 100);
emitcode ("", "%05d$:", tlbl->key + 100);
emitcode ("", "%05d$:", tlbl1->key + 100);
emitcode ("djnz", "b,%05d$", tlbl->key + 100);
popB (pushedB);
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
goto release;
}
CLRC;
while (size--)
{
- l = aopGet (AOP (result), offset, FALSE, FALSE);
+ l = aopGet (result, offset, FALSE, FALSE);
MOVA (l);
emitcode ("rrc", "a");
- aopPut (AOP (result), "a", offset--, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset--, isOperandVolatile (result, FALSE));
}
reAdjustPreg (AOP (result));
emitPtrByteGet (rname, ptype, FALSE);
AccRsh (bstr);
emitcode ("anl", "a,#0x%02x", ((unsigned char) -1) >> (8 - blen));
- aopPut (AOP (result), "a", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset++, isOperandVolatile (result, FALSE));
goto finish;
}
for (rlen=blen;rlen>=8;rlen-=8)
{
emitPtrByteGet (rname, ptype, FALSE);
- aopPut (AOP (result), "a", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset++, isOperandVolatile (result, FALSE));
if (rlen>8)
emitcode ("inc", "%s", rname);
}
{
emitPtrByteGet (rname, ptype, FALSE);
emitcode ("anl", "a,#0x%02x", ((unsigned char) -1) >> (8-rlen));
- aopPut (AOP (result), "a", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset++, isOperandVolatile (result, FALSE));
}
finish:
{
rsize -= offset;
while (rsize--)
- aopPut (AOP (result), zero, offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, offset++, isOperandVolatile (result, FALSE));
}
}
aopOp (result, ic, TRUE);
/* get the string representation of the name */
- l = aopGet (AOP (left), 0, FALSE, TRUE);
+ l = aopGet (left, 0, FALSE, TRUE);
size = AOP_SIZE (result);
while (size--)
{
sprintf (buffer, "(%s + %d)", l + 1, offset);
else
sprintf (buffer, "%s", l + 1);
- aopPut (AOP (result), buffer, offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, buffer, offset++, isOperandVolatile (result, FALSE));
}
freeAsmop (left, NULL, ic, TRUE);
if (IS_AOP_PREG (left))
{
// Aha, it is a pointer, just in disguise.
- rname = aopGet (AOP (left), 0, FALSE, FALSE);
+ rname = aopGet (left, 0, FALSE, FALSE);
if (*rname != '@')
{
fprintf(stderr, "probable internal error: unexpected rname @ %s:%d\n",
preg = getFreePtr (ic, &aop, FALSE);
emitcode ("mov", "%s,%s",
preg->name,
- aopGet (AOP (left), 0, FALSE, TRUE));
+ aopGet (left, 0, FALSE, TRUE));
rname = preg->name;
}
}
else
- rname = aopGet (AOP (left), 0, FALSE, FALSE);
+ rname = aopGet (left, 0, FALSE, FALSE);
//aopOp (result, ic, FALSE);
aopOp (result, ic, result?TRUE:FALSE);
emitcode ("mov", "a,@%s", rname);
if (!ifx)
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
}
else
{
sprintf (buffer, "@%s", rname);
- aopPut (AOP (result), buffer, offset, isOperandVolatile (result, FALSE));
+ aopPut (result, buffer, offset, isOperandVolatile (result, FALSE));
}
offset++;
if (size || pi)
if (aop) /* we had to allocate for this iCode */
{
if (pi) { /* post increment present */
- aopPut(AOP ( left ),rname,0, isOperandVolatile (left, FALSE));
+ aopPut (left, rname, 0, isOperandVolatile (left, FALSE));
}
freeAsmop (NULL, aop, ic, RESULTONSTACK (ic) ? FALSE : TRUE);
}
preg = getFreePtr (ic, &aop, FALSE);
emitcode ("mov", "%s,%s",
preg->name,
- aopGet (AOP (left), 0, FALSE, TRUE));
+ aopGet (left, 0, FALSE, TRUE));
rname = preg->name;
}
else
- rname = aopGet (AOP (left), 0, FALSE, FALSE);
+ rname = aopGet (left, 0, FALSE, FALSE);
aopOp (result, ic, FALSE);
emitcode ("movx", "a,@%s", rname);
if (!ifx)
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
offset++;
/* now some housekeeping stuff */
if (aop) /* we had to allocate for this iCode */
{
- if (pi) aopPut ( AOP (left), rname, 0, isOperandVolatile (left, FALSE));
+ if (pi) aopPut (left, rname, 0, isOperandVolatile (left, FALSE));
freeAsmop (NULL, aop, ic, TRUE);
}
else
/* if this is rematerializable */
if (AOP_TYPE (op) == AOP_IMMD)
{
- emitcode ("mov", "dptr,%s", aopGet (AOP (op), 0, TRUE, FALSE));
+ emitcode ("mov", "dptr,%s", aopGet (op, 0, TRUE, FALSE));
if (loadBToo)
{
if (AOP(op)->aopu.aop_immd.from_cast_remat)
- emitcode ("mov", "b,%s",aopGet(AOP (op), AOP_SIZE(op)-1, FALSE, FALSE));
+ emitcode ("mov", "b,%s",aopGet (op, AOP_SIZE(op)-1, FALSE, FALSE));
else
{
wassertl(FALSE, "need pointerCode");
** from genPointerGet:
** emitcode ("mov", "b,#%d", pointerCode (retype));
** from genPointerSet:
- ** emitcode ("mov", "b,%s + 1", aopGet (AOP (result), 0, TRUE, FALSE));
+ ** emitcode ("mov", "b,%s + 1", aopGet (result, 0, TRUE, FALSE));
*/
}
}
{
if (loadBToo)
{
- MOVA (aopGet (AOP (op), 0, FALSE, FALSE));
+ MOVA (aopGet (op, 0, FALSE, FALSE));
emitcode ("push", "acc");
- MOVA (aopGet (AOP (op), 1, FALSE, FALSE));
+ MOVA (aopGet (op, 1, FALSE, FALSE));
emitcode ("push", "acc");
- emitcode ("mov", "b,%s", aopGet (AOP (op), 2, FALSE, FALSE));
+ emitcode ("mov", "b,%s", aopGet (op, 2, FALSE, FALSE));
emitcode ("pop", "dph");
emitcode ("pop", "dpl");
}
else
{
- MOVA (aopGet (AOP (op), 0, FALSE, FALSE));
+ MOVA (aopGet (op, 0, FALSE, FALSE));
emitcode ("push", "acc");
- emitcode ("mov", "dph,%s", aopGet (AOP (op), 1, FALSE, FALSE));
+ emitcode ("mov", "dph,%s", aopGet (op, 1, FALSE, FALSE));
emitcode ("pop", "dpl");
}
}
else
{ /* we need to get it byte by byte */
- emitcode ("mov", "dpl,%s", aopGet (AOP (op), 0, FALSE, FALSE));
- emitcode ("mov", "dph,%s", aopGet (AOP (op), 1, FALSE, FALSE));
+ emitcode ("mov", "dpl,%s", aopGet (op, 0, FALSE, FALSE));
+ emitcode ("mov", "dph,%s", aopGet (op, 1, FALSE, FALSE));
if (loadBToo)
- emitcode ("mov", "b,%s", aopGet (AOP (op), 2, FALSE, FALSE));
+ emitcode ("mov", "b,%s", aopGet (op, 2, FALSE, FALSE));
}
}
}
{
emitcode ("movx", "a,@dptr");
if (!ifx)
- aopPut (AOP (result), "a", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset++, isOperandVolatile (result, FALSE));
if (size || pi)
emitcode ("inc", "dptr");
}
if (pi && AOP_TYPE (left) != AOP_IMMD && AOP_TYPE (left) != AOP_STR)
{
- aopPut ( AOP (left), "dpl", 0, isOperandVolatile (left, FALSE));
- aopPut ( AOP (left), "dph", 1, isOperandVolatile (left, FALSE));
+ aopPut (left, "dpl", 0, isOperandVolatile (left, FALSE));
+ aopPut (left, "dph", 1, isOperandVolatile (left, FALSE));
pi->generated = 1;
}
emitcode ("clr", "a");
emitcode ("movc", "a,@a+dptr");
if (!ifx)
- aopPut (AOP (result), "a", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset++, isOperandVolatile (result, FALSE));
emitcode ("inc", "dptr");
}
else
emitcode ("mov", "a,#0x%02x", offset);
emitcode ("movc", "a,@a+dptr");
if (!ifx)
- aopPut (AOP (result), "a", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset++, isOperandVolatile (result, FALSE));
}
}
}
if (pi && AOP_TYPE (left) != AOP_IMMD && AOP_TYPE (left) != AOP_STR)
{
- aopPut ( AOP (left), "dpl", 0, isOperandVolatile (left, FALSE));
- aopPut ( AOP (left), "dph", 1, isOperandVolatile (left, FALSE));
+ aopPut (left, "dpl", 0, isOperandVolatile (left, FALSE));
+ aopPut (left, "dph", 1, isOperandVolatile (left, FALSE));
pi->generated = 1;
}
{
emitcode ("lcall", "__gptrget");
if (!ifx)
- aopPut (AOP (result), "a", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset++, isOperandVolatile (result, FALSE));
if (size || pi)
emitcode ("inc", "dptr");
}
if (pi && AOP_TYPE (left) != AOP_IMMD && AOP_TYPE (left) != AOP_STR)
{
- aopPut ( AOP (left), "dpl", 0, isOperandVolatile (left, FALSE));
- aopPut ( AOP (left), "dph", 1, isOperandVolatile (left, FALSE));
+ aopPut (left, "dpl", 0, isOperandVolatile (left, FALSE));
+ aopPut (left, "dph", 1, isOperandVolatile (left, FALSE));
pi->generated = 1;
}
emitcode ("mov", "c,%s", AOP(right)->aopu.aop_dir);
else
{
- MOVA (aopGet (AOP (right), 0, FALSE, FALSE));
+ MOVA (aopGet (right, 0, FALSE, FALSE));
emitcode ("rrc","a");
}
emitPtrByteGet (rname, p_type, FALSE);
bool pushedB;
/* Case with a bitfield length < 8 and arbitrary source
*/
- MOVA (aopGet (AOP (right), 0, FALSE, FALSE));
+ MOVA (aopGet (right, 0, FALSE, FALSE));
/* shift and mask source value */
AccLsh (bstr);
emitcode ("anl", "a,#0x%02x", (~mask) & 0xff);
for (rlen=blen;rlen>=8;rlen-=8)
{
emitPtrByteSet (rname, p_type,
- aopGet (AOP (right), offset++, FALSE, TRUE) );
+ aopGet (right, offset++, FALSE, TRUE) );
if (rlen>8)
emitcode ("inc", "%s", rname);
}
bool pushedB;
/* Case with partial byte and arbitrary source
*/
- MOVA (aopGet (AOP (right), offset++, FALSE, FALSE));
+ MOVA (aopGet (right, offset++, FALSE, FALSE));
emitcode ("anl", "a,#0x%02x", (~mask) & 0xff);
pushedB = pushB ();
aopOp (right, ic, FALSE);
- l = aopGet (AOP (result), 0, FALSE, TRUE);
+ l = aopGet (result, 0, FALSE, TRUE);
size = AOP_SIZE (right);
while (size--)
{
else
sprintf (buffer, "%s", l + 1);
emitcode ("mov", "%s,%s", buffer,
- aopGet (AOP (right), offset++, FALSE, FALSE));
+ aopGet (right, offset++, FALSE, FALSE));
}
freeAsmop (right, NULL, ic, TRUE);
)
{
// Aha, it is a pointer, just in disguise.
- rname = aopGet (AOP (result), 0, FALSE, FALSE);
+ rname = aopGet (result, 0, FALSE, FALSE);
if (*rname != '@')
{
fprintf(stderr, "probable internal error: unexpected rname @ %s:%d\n",
preg = getFreePtr (ic, &aop, FALSE);
emitcode ("mov", "%s,%s",
preg->name,
- aopGet (AOP (result), 0, FALSE, TRUE));
+ aopGet (result, 0, FALSE, TRUE));
rname = preg->name;
}
}
else
{
- rname = aopGet (AOP (result), 0, FALSE, FALSE);
+ rname = aopGet (result, 0, FALSE, FALSE);
}
aopOp (right, ic, FALSE);
while (size--)
{
- l = aopGet (AOP (right), offset, FALSE, TRUE);
+ l = aopGet (right, offset, FALSE, TRUE);
if (*l == '@')
{
MOVA (l);
if (aop) /* we had to allocate for this iCode */
{
if (pi)
- aopPut (AOP (result), rname, 0, isOperandVolatile (result, FALSE));
+ aopPut (result, rname, 0, isOperandVolatile (result, FALSE));
freeAsmop (NULL, aop, ic, TRUE);
}
else
preg = getFreePtr (ic, &aop, FALSE);
emitcode ("mov", "%s,%s",
preg->name,
- aopGet (AOP (result), 0, FALSE, TRUE));
+ aopGet (result, 0, FALSE, TRUE));
rname = preg->name;
}
else
- rname = aopGet (AOP (result), 0, FALSE, FALSE);
+ rname = aopGet (result, 0, FALSE, FALSE);
aopOp (right, ic, FALSE);
while (size--)
{
- l = aopGet (AOP (right), offset, FALSE, TRUE);
+ l = aopGet (right, offset, FALSE, TRUE);
MOVA (l);
emitcode ("movx", "@%s,a", rname);
if (aop) /* we had to allocate for this iCode */
{
if (pi)
- aopPut (AOP (result), rname, 0, isOperandVolatile (result, FALSE));
+ aopPut (result, rname, 0, isOperandVolatile (result, FALSE));
freeAsmop (NULL, aop, ic, TRUE);
}
else
while (size--)
{
- char *l = aopGet (AOP (right), offset++, FALSE, FALSE);
+ char *l = aopGet (right, offset++, FALSE, FALSE);
MOVA (l);
emitcode ("movx", "@dptr,a");
if (size || pi)
}
}
if (pi && AOP_TYPE (result) != AOP_STR && AOP_TYPE (result) != AOP_IMMD) {
- aopPut (AOP(result), "dpl", 0, isOperandVolatile (result, FALSE));
- aopPut (AOP(result), "dph", 1, isOperandVolatile (result, FALSE));
+ aopPut (result, "dpl", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "dph", 1, isOperandVolatile (result, FALSE));
pi->generated=1;
}
freeAsmop (result, NULL, ic, TRUE);
while (size--)
{
- char *l = aopGet (AOP (right), offset++, FALSE, FALSE);
+ char *l = aopGet (right, offset++, FALSE, FALSE);
MOVA (l);
emitcode ("lcall", "__gptrput");
if (size || pi)
}
if (pi && AOP_TYPE (result) != AOP_STR && AOP_TYPE (result) != AOP_IMMD) {
- aopPut (AOP(result), "dpl", 0, isOperandVolatile (result, FALSE));
- aopPut (AOP(result), "dph", 1, isOperandVolatile (result, FALSE));
+ aopPut (result, "dpl", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "dph", 1, isOperandVolatile (result, FALSE));
pi->generated=1;
}
freeAsmop (result, NULL, ic, TRUE);
emitcode ("add", "a,#0x%02x", ((sym->stack < 0) ?
((char) (sym->stack - _G.nRegsSaved)) :
((char) sym->stack)) & 0xff);
- aopPut (AOP (IC_RESULT (ic)), "a", 0, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), "a", 0, isOperandVolatile (IC_RESULT (ic), FALSE));
}
else
{
/* we can just move _bp */
- aopPut (AOP (IC_RESULT (ic)), SYM_BP (sym), 0, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), SYM_BP (sym), 0, isOperandVolatile (IC_RESULT (ic), FALSE));
}
/* fill the result with zero */
size = AOP_SIZE (IC_RESULT (ic)) - 1;
offset = 1;
while (size--)
{
- aopPut (AOP (IC_RESULT (ic)), zero, offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), zero, offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
}
goto release;
offset * 8);
else
sprintf (s, "#%s", sym->rname);
- aopPut (AOP (IC_RESULT (ic)), s, offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), s, offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
}
release:
/* first push the right side on to the stack */
while (size--)
{
- l = aopGet (AOP (right), offset++, FALSE, FALSE);
+ l = aopGet (right, offset++, FALSE, FALSE);
MOVA (l);
emitcode ("push", "acc");
}
while (size--)
{
emitcode ("pop", "acc");
- aopPut (AOP (result), "a", --offset, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", --offset, isOperandVolatile (result, FALSE));
}
freeAsmop (result, NULL, ic, FALSE);
if (AOP_TYPE (right) == AOP_LIT)
{
if (((int) operandLitValue (right)))
- aopPut (AOP (result), one, 0, isOperandVolatile (result, FALSE));
+ aopPut (result, one, 0, isOperandVolatile (result, FALSE));
else
- aopPut (AOP (result), zero, 0, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, 0, isOperandVolatile (result, FALSE));
goto release;
}
if (AOP_TYPE (right) == AOP_CRY)
{
emitcode ("mov", "c,%s", AOP (right)->aopu.aop_dir);
- aopPut (AOP (result), "c", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "c", 0, isOperandVolatile (result, FALSE));
goto release;
}
/* we need to or */
toBoolean (right);
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
goto release;
}
{
while ((size) && (lit))
{
- aopPut (AOP (result),
- aopGet (AOP (right), offset, FALSE, FALSE),
+ aopPut (result,
+ aopGet (right, offset, FALSE, FALSE),
offset,
isOperandVolatile (result, FALSE));
lit >>= 8;
emitcode ("clr", "a");
while (size--)
{
- aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset, isOperandVolatile (result, FALSE));
offset++;
}
}
{
while (size--)
{
- aopPut (AOP (result),
- aopGet (AOP (right), offset, FALSE, FALSE),
+ aopPut (result,
+ aopGet (right, offset, FALSE, FALSE),
offset,
isOperandVolatile (result, FALSE));
offset++;
How will multiply by three be updated ???*/
aopOp (IC_JTCOND (ic), ic, FALSE);
/* get the condition into accumulator */
- l = aopGet (AOP (IC_JTCOND (ic)), 0, FALSE, FALSE);
+ l = aopGet (IC_JTCOND (ic), 0, FALSE, FALSE);
MOVA (l);
/* multiply by three */
emitcode ("add", "a,acc");
- emitcode ("add", "a,%s", aopGet (AOP (IC_JTCOND (ic)), 0, FALSE, FALSE));
+ emitcode ("add", "a,%s", aopGet (IC_JTCOND (ic), 0, FALSE, FALSE));
freeAsmop (IC_JTCOND (ic), NULL, ic, TRUE);
jtab = newiTempLabel (NULL);
/* get the condition into accumulator.
Using b as temporary storage, if register push/pop is needed */
aopOp (IC_JTCOND (ic), ic, FALSE);
- l = aopGet (AOP (IC_JTCOND (ic)), 0, FALSE, FALSE);
+ l = aopGet (IC_JTCOND (ic), 0, FALSE, FALSE);
if ((AOP_TYPE (IC_JTCOND (ic)) == AOP_R0 && _G.r0Pushed) ||
(AOP_TYPE (IC_JTCOND (ic)) == AOP_R1 && _G.r1Pushed))
{
if (AOP_TYPE (right) == AOP_LIT)
{
if (((int) operandLitValue (right)))
- aopPut (AOP (result), one, 0, isOperandVolatile (result, FALSE));
+ aopPut (result, one, 0, isOperandVolatile (result, FALSE));
else
- aopPut (AOP (result), zero, 0, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, 0, isOperandVolatile (result, FALSE));
goto release;
}
if (AOP_TYPE (right) == AOP_CRY)
{
emitcode ("mov", "c,%s", AOP (right)->aopu.aop_dir);
- aopPut (AOP (result), "c", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "c", 0, isOperandVolatile (result, FALSE));
goto release;
}
/* we need to or */
toBoolean (right);
- aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", 0, isOperandVolatile (result, FALSE));
goto release;
}
offset = 0;
while (size--)
{
- aopPut (AOP (result),
- aopGet (AOP (right), offset, FALSE, FALSE),
+ aopPut (result,
+ aopGet (right, offset, FALSE, FALSE),
offset,
isOperandVolatile (result, FALSE));
offset++;
offset = 0;
while (size--)
{
- aopPut (AOP (result),
- aopGet (AOP (right), offset, FALSE, FALSE),
+ aopPut (result,
+ aopGet (right, offset, FALSE, FALSE),
offset,
isOperandVolatile (result, FALSE));
offset++;
exit(1);
}
- sprintf(gpValStr, "#0x%d", gpVal);
- aopPut (AOP (result), gpValStr, GPTRSIZE - 1, isOperandVolatile (result, FALSE));
+ sprintf(gpValStr, "#0x%x", gpVal);
+ aopPut (result, gpValStr, GPTRSIZE - 1, isOperandVolatile (result, FALSE));
}
goto release;
}
offset = 0;
while (size--)
{
- aopPut (AOP (result),
- aopGet (AOP (right), offset, FALSE, FALSE),
+ aopPut (result,
+ aopGet (right, offset, FALSE, FALSE),
offset,
isOperandVolatile (result, FALSE));
offset++;
offset = 0;
while (size--)
{
- aopPut (AOP (result),
- aopGet (AOP (right), offset, FALSE, FALSE),
+ aopPut (result,
+ aopGet (right, offset, FALSE, FALSE),
offset,
isOperandVolatile (result, FALSE));
offset++;
if (!IS_SPEC (rtype) || SPEC_USIGN (rtype) || AOP_TYPE(right)==AOP_CRY)
{
while (size--)
- aopPut (AOP (result), zero, offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, zero, offset++, isOperandVolatile (result, FALSE));
}
else
{
/* we need to extend the sign :{ */
- char *l = aopGet (AOP (right), AOP_SIZE (right) - 1,
+ char *l = aopGet (right, AOP_SIZE (right) - 1,
FALSE, FALSE);
MOVA (l);
emitcode ("rlc", "a");
emitcode ("subb", "a,acc");
while (size--)
- aopPut (AOP (result), "a", offset++, isOperandVolatile (result, FALSE));
+ aopPut (result, "a", offset++, isOperandVolatile (result, FALSE));
}
/* we are done hurray !!!! */
* the accumulator, we must explicitly write
* it back after the decrement.
*/
- char *rByte = aopGet(AOP(IC_RESULT(ic)), 0, FALSE, FALSE);
+ char *rByte = aopGet (IC_RESULT(ic), 0, FALSE, FALSE);
if (strcmp(rByte, "a"))
{
return 0;
}
emitcode ("dec", "%s", rByte);
- aopPut(AOP(IC_RESULT(ic)), rByte, 0, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), rByte, 0, isOperandVolatile (IC_RESULT (ic), FALSE));
emitcode ("jnz", "%05d$", lbl->key + 100);
}
else if (IS_AOP_PREG (IC_RESULT (ic)))
{
emitcode ("dec", "%s",
- aopGet (AOP (IC_RESULT (ic)), 0, FALSE, FALSE));
- MOVA (aopGet (AOP (IC_RESULT (ic)), 0, FALSE, FALSE));
+ aopGet (IC_RESULT (ic), 0, FALSE, FALSE));
+ MOVA (aopGet (IC_RESULT (ic), 0, FALSE, FALSE));
emitcode ("jnz", "%05d$", lbl->key + 100);
}
else
{
- emitcode ("djnz", "%s,%05d$", aopGet (AOP (IC_RESULT (ic)), 0, FALSE, FALSE),
+ emitcode ("djnz", "%s,%05d$", aopGet (IC_RESULT (ic), 0, FALSE, FALSE),
lbl->key + 100);
}
emitcode ("sjmp", "%05d$", lbl1->key + 100);
_G.accInUse++;
aopOp (IC_RESULT (ic), ic, FALSE);
_G.accInUse--;
- aopPut (AOP (IC_RESULT (ic)), "a", offset,
+ aopPut (IC_RESULT (ic), "a", offset,
isOperandVolatile (IC_RESULT (ic), FALSE));
for (offset = 1; offset<size; offset++)
- aopPut (AOP (IC_RESULT (ic)), tempRegs[--roffset]->name, offset,
+ aopPut (IC_RESULT (ic), tempRegs[--roffset]->name, offset,
isOperandVolatile (IC_RESULT (ic), FALSE));
goto release;
}
emitcode("mov","%s,%s", tempRegs[offset]->name, fReturn[offset]);
aopOp (IC_RESULT (ic), ic, FALSE);
for (offset = 0; offset<size; offset++)
- aopPut (AOP (IC_RESULT (ic)), tempRegs[offset]->name, offset,
+ aopPut (IC_RESULT (ic), tempRegs[offset]->name, offset,
isOperandVolatile (IC_RESULT (ic), FALSE));
goto release;
}
offset = 0;
while (size--) {
emitcode ("pop", "acc");
- aopPut (AOP (IC_RESULT (ic)), "a", offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), "a", offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
}
} else {
aopOp (IC_RESULT (ic), ic, FALSE);
rb1off = ic->argreg;
while (size--) {
- aopPut (AOP (IC_RESULT (ic)), rb1regs[rb1off++ -5], offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
+ aopPut (IC_RESULT (ic), rb1regs[rb1off++ -5], offset++, isOperandVolatile (IC_RESULT (ic), FALSE));
}
}
offset = 0;
while (size--)
{
- MOVA (aopGet (AOP (op), offset, FALSE, FALSE));
+ MOVA (aopGet (op, offset, FALSE, FALSE));
offset++;
}
}
offset = 0;
while (size--)
{
- MOVA (aopGet (AOP (op), offset, FALSE, FALSE));
+ MOVA (aopGet (op, offset, FALSE, FALSE));
offset++;
}
}
if (IC_RESULT (ic))
{
aopOp (IC_RESULT (ic), ic, TRUE);
- aopPut (AOP (IC_RESULT (ic)), one, 0, 0);
+ aopPut (IC_RESULT (ic), one, 0, 0);
emitcode ("jbc", "ea,%05d$", (tlbl->key + 100)); /* atomic test & clear */
- aopPut (AOP (IC_RESULT (ic)), zero, 0, 0);
+ aopPut (IC_RESULT (ic), zero, 0, 0);
emitcode ("", "%05d$:", (tlbl->key + 100));
freeAsmop (IC_RESULT (ic), NULL, ic, TRUE);
}
else
{
if (AOP_TYPE (IC_RIGHT (ic)) != AOP_DUMMY)
- MOVA (aopGet (AOP (IC_RIGHT (ic)), 0, FALSE, FALSE));
+ MOVA (aopGet (IC_RIGHT (ic), 0, FALSE, FALSE));
emitcode ("rrc", "a");
emitcode ("mov", "ea,c");
}