3 Copyright (C) 1989-1995 Alan R. Baldwin
4 721 Berkeley St., Kent, Ohio 44240
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 3, or (at your option) any
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 * - outsym: show s_id as string rather than array [NCPS]
22 * - Added outr11 to support 8051's 11 bit destination address
33 * The module asout.c contains all the functions used to
34 * generate the .REL assembler output file.
37 * The assemblers' output object file is an ascii file containing
38 * the information needed by the linker to bind multiple object
39 * modules into a complete loadable memory image.
41 * The object module contains the following designators:
48 * H Most significant byte first
49 * L Least significant byte first
56 * R Relocation information
57 * P Paging information
62 * The first line of an object module contains the [XDQ][HL]
63 * format specifier (i.e. XH indicates a hexadecimal file with
64 * most significant byte first) for the following designators.
69 * H aa areas gg global symbols
71 * The header line specifies the number of areas(aa) and the
72 * number of global symbols(gg) defined or referenced in this ob-
73 * ject module segment.
80 * The module line specifies the module name from which this
81 * header segment was assembled. The module line will not appear
82 * if the .module directive was not used in the source program.
93 * The symbol line defines (Def) or references (Ref) the symbol
94 * 'string' with the value nnnn. The defined value is relative to
95 * the current area base address. References to constants and ex-
96 * ternal global symbols will always appear before the first area
97 * definition. References to external symbols will have a value of
103 * A label size ss flags ff
105 * The area line defines the area label, the size (ss) of the
106 * area in bytes, and the area flags (ff). The area flags specify
107 * the ABS, REL, CON, OVR, and PAG parameters:
109 * OVR/CON (0x04/0x00 i.e. bit position 2)
111 * ABS/REL (0x08/0x00 i.e. bit position 3)
113 * PAG (0x10 i.e. bit position 4)
118 * T xx xx nn nn nn nn nn ...
120 * The T line contains the assembled code output by the assem-
121 * bler with xx xx being the offset address from the current area
122 * base address and nn being the assembled instructions and data in
128 * R 0 0 nn nn n1 n2 xx xx ...
130 * The R line provides the relocation information to the linker.
131 * The nn nn value is the current area index, i.e. which area the
132 * current values were assembled. Relocation information is en-
133 * coded in groups of 4 bytes:
135 * 1. n1 is the relocation mode and object format
136 * 1. bit 0 word(0x00)/byte(0x01)
137 * 2. bit 1 relocatable area(0x00)/symbol(0x02)
138 * 3. bit 2 normal(0x00)/PC relative(0x04) relocation
139 * 4. bit 3 1-byte(0x00)/2-byte(0x08) object format for
141 * 5. bit 4 signed(0x00)/unsigned(0x10) byte data
142 * 6. bit 5 normal(0x00)/page '0'(0x20) reference
143 * 7. bit 6 normal(0x00)/page 'nnn'(0x40) reference
144 * 8. bit 7 normal(0x00)/MSB of value
146 * 2. n2 is a byte index into the corresponding (i.e. pre-
147 * ceeding) T line data (i.e. a pointer to the data to be
148 * updated by the relocation). The T line data may be
149 * 1-byte or 2-byte byte data format or 2-byte word
152 * 3. xx xx is the area/symbol index for the area/symbol be-
153 * ing referenced. the corresponding area/symbol is found
154 * in the header area/symbol lists.
157 * The groups of 4 bytes are repeated for each item requiring relo-
158 * cation in the preceeding T line.
163 * P 0 0 nn nn n1 n2 xx xx
165 * The P line provides the paging information to the linker as
166 * specified by a .setdp directive. The format of the relocation
167 * information is identical to that of the R line. The correspond-
168 * ing T line has the following information:
169 * T xx xx aa aa bb bb
171 * Where aa aa is the area reference number which specifies the
172 * selected page area and bb bb is the base address of the page.
173 * bb bb will require relocation processing if the 'n1 n2 xx xx' is
174 * specified in the P line. The linker will verify that the base
175 * address is on a 256 byte boundary and that the page length of an
176 * area defined with the PAG type is not larger than 256 bytes.
178 * The linker defaults any direct page references to the first
179 * area defined in the input REL file. All ASxxxx assemblers will
180 * specify the _CODE area first, making this the default page area.
183 * asout.c contains the following functions:
204 * The module asout.c contains the following local variables:
205 * int rel[] relocation data for code/data array
206 * int * relp pointer to rel array
207 * int txt[] assembled code/data array
208 * int * txtp pointer to txt array
217 char *txtp = { &txt[0] };
218 char *relp = { &rel[0] };
220 /*)Function VOID outab(b)
222 * int b assembler data word
224 * The function outab() processes a single word of
225 * assembled data in absolute format.
228 * int * txtp pointer to data word
231 * int oflag -o, generate relocatable output flag
232 * int pass assembler pass number
235 * VOID outchk() asout.c
236 * VOID out_lb() asout.c
239 * The current assembly address is incremented by 1.
255 /*)Function VOID outaw(w)
257 * int w assembler data word
259 * The function outaw() processes a single word of
260 * assembled data in absolute format.
263 * int * txtp pointer to data word
266 * int oflag -o, generate relocatable output flag
267 * int pass assembler pass number
270 * VOID outchk() asout.c
271 * VOID out_lw() asout.c
274 * The current assembly address is incremented by 2.
290 /*)Function VOID write_rmode(r)
292 * int r relocation mode
294 * write_rmode puts the passed relocation mode into the
295 * output relp buffer, escaping it if necessary.
298 * int * relp pointer to rel array
301 * VOID rerr() assubr.c
304 * relp is incremented appropriately.
309 /* We need to escape the relocation mode if it is greater
310 * than a byte, or if it happens to look like an escape.
311 * (I don't think that the latter case is legal, but
312 * better safe than sorry).
314 if ((r > 0xff) || ((r & R_ESCAPE_MASK) == R_ESCAPE_MASK))
316 /* Hack in up to an extra 4 bits of flags with escape. */
319 /* uh-oh.. we have more than 4 extra bits. */
321 "Internal error: relocation mode 0x%X too big.\n",
325 /* printf("escaping relocation mode\n"); */
326 *relp++ = R_ESCAPE_MASK | (r >> 8);
335 /*)Function VOID outrb(esp, r)
337 * expr * esp pointer to expr structure
338 * int r relocation mode
340 * The function outrb() processes a byte of generated code
341 * in either absolute or relocatable format dependent upon
342 * the data contained in the expr structure esp. If the
343 * .REL output is enabled then the appropriate information
344 * is loaded into the txt and rel buffers.
347 * int n symbol/area reference number
348 * int * relp pointer to rel array
349 * int * txtp pointer to txt array
352 * sym dot defined as sym[0]
353 * int oflag -o, generate relocatable output flag
354 * int pass assembler pass number
357 * VOID aerr() assubr.c
358 * VOID outchk() asout.c
359 * VOID out_lb() asout.c
360 * VOID out_rb() asout.c
361 * VOID out_tb() asout.c
364 * The current assembly address is incremented by 1.
368 outrb(struct expr *esp, int r)
373 if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
374 /* This is a constant; simply write the
375 * const byte to the T line and don't
376 * generate any relocation info.
378 out_lb(lobyte(esp->e_addr),0);
381 *txtp++ = lobyte(esp->e_addr);
384 /* We are generating a single byte of relocatable
387 * In 8051 mode, we generate a 16 bit address. The
388 * linker will later select a single byte based on
389 * whether R_MSB is set.
391 * In flat24 mode, we generate a 24 bit address. The
392 * linker will select a single byte based on
393 * whether R_MSB or R_HIB is set.
397 r |= R_BYTE | R_BYT2 | esp->e_rlcf;
399 out_lb(hibyte(esp->e_addr),r|R_RELOC|R_HIGH);
401 out_lb(lobyte(esp->e_addr),r|R_RELOC);
407 n = esp->e_base.e_sp->s_ref;
410 n = esp->e_base.e_ap->a_ref;
413 *relp++ = txtp - txt - 2;
420 r |= R_BYTE | R_BYT3 | esp->e_rlcf;
423 /* Probably should mark this differently in the
426 out_lb(byte3(esp->e_addr),r|R_RELOC|R_HIGH);
428 else if (r & R_MSB) {
429 out_lb(hibyte(esp->e_addr),r|R_RELOC|R_HIGH);
431 out_lb(lobyte(esp->e_addr),r|R_RELOC);
435 out_t24(esp->e_addr);
437 n = esp->e_base.e_sp->s_ref;
440 n = esp->e_base.e_ap->a_ref;
443 *relp++ = txtp - txt - 3;
452 /*)Function VOID outrw(esp, r)
454 * expr * esp pointer to expr structure
455 * int r relocation mode
457 * The function outrw() processes a word of generated code
458 * in either absolute or relocatable format dependent upon
459 * the data contained in the expr structure esp. If the
460 * .REL output is enabled then the appropriate information
461 * is loaded into the txt and rel buffers.
464 * int n symbol/area reference number
465 * int * relp pointer to rel array
466 * int * txtp pointer to txt array
469 * sym dot defined as sym[0]
470 * int oflag -o, generate relocatable output flag
471 * int pass assembler pass number
474 * VOID aerr() assubr.c
475 * VOID outchk() asout.c
476 * VOID out_lw() asout.c
477 * VOID out_rw() asout.c
478 * VOID out_tw() asout.c
481 * The current assembly address is incremented by 2.
485 outrw(struct expr *esp, int r)
491 if (esp->e_addr > 0xffff)
495 "large constant 0x%x truncated to 16 bits\n",
498 if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
499 out_lw(esp->e_addr,0);
505 r |= R_WORD | esp->e_rlcf;
509 out_lw(hibyte(esp->e_addr),r|R_RELOC);
511 out_lw(lobyte(esp->e_addr),r|R_RELOC);
514 out_lw(esp->e_addr,r|R_RELOC);
520 n = esp->e_base.e_sp->s_ref;
523 n = esp->e_base.e_ap->a_ref;
528 /* If this happens, the linker will
529 * attempt to process this 16 bit field
530 * as 24 bits. That would be bad.
533 "***Internal error: C24 out in "
538 *relp++ = txtp - txt - 2;
546 /*)Function VOID outr24(esp, r)
548 * expr * esp pointer to expr structure
549 * int r relocation mode
551 * The function outr24() processes 24 bits of generated code
552 * in either absolute or relocatable format dependent upon
553 * the data contained in the expr structure esp. If the
554 * .REL output is enabled then the appropriate information
555 * is loaded into the txt and rel buffers.
558 * int n symbol/area reference number
559 * int * relp pointer to rel array
560 * int * txtp pointer to txt array
563 * sym dot defined as sym[0]
564 * int oflag -o, generate relocatable output flag
565 * int pass assembler pass number
568 * VOID aerr() assubr.c
569 * VOID outchk() asout.c
570 * VOID out_l24() asout.c
571 * VOID out_rw() asout.c
572 * VOID out_t24() asout.c
575 * The current assembly address is incremented by 3.
579 outr24(struct expr *esp, int r)
584 if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
585 /* This is a constant expression. */
586 out_l24(esp->e_addr,0);
589 out_t24(esp->e_addr);
592 /* This is a symbol. */
593 r |= R_WORD | esp->e_rlcf;
595 /* I have no idea what this case is. */
598 out_lw(hibyte(esp->e_addr),r|R_RELOC);
600 out_lw(lobyte(esp->e_addr),r|R_RELOC);
603 out_l24(esp->e_addr,r|R_RELOC);
607 out_t24(esp->e_addr);
609 n = esp->e_base.e_sp->s_ref;
612 n = esp->e_base.e_ap->a_ref;
617 /* If this occurs, we cannot properly
618 * code the relocation data with the
619 * R_C24 flag. This means the linker
620 * will fail to do the 24 bit relocation.
624 "***Internal error: BYTE out in 24 "
625 "bit flat mode unexpected.\n");
629 write_rmode(r | R_C24);
630 *relp++ = txtp - txt - 3;
638 /*)Function VOID outdp(carea, esp)
640 * area * carea pointer to current area strcuture
641 * expr * esp pointer to expr structure
643 * The function outdp() flushes the output buffer and
644 * outputs paging information to the .REL file.
647 * int n symbol/area reference number
648 * int r relocation mode
649 * int * relp pointer to rel array
650 * int * txtp pointer to txt array
653 * int oflag -o, generate relocatable output flag
654 * int pass assembler pass number
657 * VOID outbuf() asout.c
658 * VOID outchk() asout.c
659 * VOID out_rw() asout.c
660 * VOID out_tw() asout.c
663 * Output buffer flushed to .REL fiel.
664 * Paging information dumped to .REL file.
668 outdp(register struct area *carea, register struct expr *esp)
672 if (oflag && pass==2) {
674 out_tw(carea->a_ref);
676 if (esp->e_flag || esp->e_base.e_ap!=NULL) {
679 n = esp->e_base.e_sp->s_ref;
682 n = esp->e_base.e_ap->a_ref;
685 *relp++ = txtp - txt - 2;
692 /*)Function VOID outall()
694 * The function outall() will output any bufferred assembled
695 * data and relocation information (during pass 2 if the .REL
696 * output has been enabled).
702 * int oflag -o, generate relocatable output flag
703 * int pass assembler pass number
706 * VOID outbuf() asout.c
709 * assembled data and relocation buffers will be cleared.
715 if (oflag && pass==2)
719 /*)Function VOID outdot()
721 * The function outdot() outputs information about the
722 * current program counter value (during pass 2 if the .REL
723 * output has been enabled).
729 * int oflag -o, generate relocatable output flag
730 * int pass assembler pass number
733 * int fprintf() c_library
737 * assembled data and relocation buffers will be cleared.
743 if (oflag && pass==2) {
745 out(txt,(int) (txtp-txt));
748 out(rel,(int) (relp-rel));
755 /*)Function outchk(nt, nr)
757 * int nr number of additional relocation words
758 * int nt number of additional data words
760 * The function outchk() checks the data and relocation buffers
761 * for space to insert the nt data words and nr relocation words.
762 * If space is not available then output the current data and
763 * initialize the data buffers to receive the new data.
766 * area * ap pointer to an area structure
767 * int * relp pointer to rel array
768 * int * txtp pointer to txt array
771 * sym dot defined as sym[0]
774 * VOID outbuf() asout.c
777 * Data and relocation buffers may be emptied and initialized.
781 outchk(int nt, int nr)
783 register struct area *ap;
785 if (txtp+nt > &txt[NTXT] || relp+nr > &rel[NREL]) {
790 if ((ap = dot.s_area) != NULL) {
791 write_rmode(R_WORD|R_AREA);
798 /*)Function VOID outbuf()
800 * The function outbuf() will output any bufferred data
801 * and relocation information to the .REL file. The output
802 * buffer pointers and counters are initialized.
805 * int rel[] relocation data for code/data array
806 * int * relp pointer to rel array
807 * int txt[] assembled code/data array
808 * int * txtp pointer to txt array
811 * FILE * ofp relocation output file handle
817 * All bufferred data written to .REL file and
818 * buffer pointers and counters initialized.
824 if (txtp > &txt[2]) {
826 out(txt,(int) (txtp-txt));
828 fprintf(ofp, "%s", s);
829 out(rel,(int) (relp-rel));
836 /*)Function VOID outgsd()
838 * The function outgsd() performs the following:
839 * (1) outputs the .REL file radix
840 * (2) outputs the header specifying the number
841 * of areas and global symbols
842 * (3) outputs the module name
843 * (4) set the reference number and output a symbol line
844 * for all external global variables and absolutes
845 * (5) output an area name, set reference number and output
846 * a symbol line for all global relocatables in the area.
847 * Repeat this proceedure for all areas.
850 * area * ap pointer to an area structure
851 * sym * sp pointer to a sym structure
854 * int c string character value
855 * int narea number of code areas
856 * char * ptr string pointer
857 * int nglob number of global symbols
858 * int rn symbol reference number
861 * area * areap pointer to an area structure
862 * char module[] module name string
863 * sym * symhash[] array of pointers to NHASH
864 * linked symbol lists
865 * int xflag -x, listing radix flag
868 * int fprintf() c_library
869 * VOID outarea() asout.c
870 * VOID outsym() asout.c
871 * int putc() c_library
874 * All symbols are given reference numbers, all symbol
875 * and area information is output to the .REL file.
881 register struct area *ap;
882 register struct sym *sp;
885 int c, narea, nglob, rn;
890 narea = areap->a_ref + 1;
893 * Number of global references/absolutes
896 for (i = 0; i < NHASH; ++i) {
899 if (sp->s_flag&S_GBL)
906 * Output Radix and number of areas and symbols
909 fprintf(ofp, "X%c\n", hilo ? 'H' : 'L');
910 fprintf(ofp, "H %X areas %X global symbols\n", narea, nglob);
913 fprintf(ofp, "Q%c\n", hilo ? 'H' : 'L');
914 fprintf(ofp, "H %o areas %o global symbols\n", narea, nglob);
917 fprintf(ofp, "D%c\n", hilo ? 'H' : 'L');
918 fprintf(ofp, "H %u areas %u global symbols\n", narea, nglob);
927 while (ptr < &module[NCPS]) {
928 if ((c = *ptr++) != 0)
935 * Sdcc compile options
937 if (strlen(optsdcc)) fprintf(ofp, "O %s\n", optsdcc);
940 * Global references and absolutes.
943 for (i=0; i<NHASH; ++i) {
946 if (sp->s_area==NULL && sp->s_flag&S_GBL) {
955 * Global relocatables.
957 for (i=0; i<narea; ++i) {
959 while (ap->a_ref != i)
962 for (j=0; j<NHASH; ++j) {
965 if (sp->s_area==ap && sp->s_flag&S_GBL) {
975 /*)Function VOID outarea(ap)
977 * area * ap pointer to an area structure
979 * The function outarea() outputs the A line to the .REL
980 * file. The A line contains the area's name, size, and
984 * char * ptr pointer to area id string
985 * int c character value
988 * FILE * ofp relocation output file handle
989 * int xflag -x, listing radix flag
992 * int fprintf() c_library
993 * int putc() c_library
996 * The A line is sent to the .REL file.
1000 outarea(register struct area *ap)
1007 while (ptr < &ap->a_id[NCPS]) {
1008 if ((c = *ptr++) != 0)
1012 fprintf(ofp, " size %X flags %X addr %X\n", ap->a_size, ap->a_flag, ap->a_addr);
1015 fprintf(ofp, " size %o flags %o\n", ap->a_size, ap->a_flag);
1018 fprintf(ofp, " size %u flags %u\n", ap->a_size, ap->a_flag);
1022 /*)Function VOID outsym(sp)
1024 * sym * sp pointer to a sym structure
1026 * The function outsym() outputs the S line to the .REL
1027 * file. The S line contains the symbols name and whether the
1028 * the symbol is defined or referenced.
1031 * char * ptr pointer to symbol id string
1032 * int c character value
1035 * FILE * ofp relocation output file handle
1036 * int xflag -x, listing radix flag
1039 * int fprintf() c_library
1040 * int putc() c_library
1043 * The S line is sent to the .REL file.
1047 outsym(register struct sym *sp)
1053 fprintf(ofp, "%s", ptr );
1054 fprintf(ofp, " %s", sp->s_type==S_NEW ? "Ref" : "Def");
1056 fprintf(ofp, "%04X\n", sp->s_addr);
1059 fprintf(ofp, "%06o\n", sp->s_addr);
1062 fprintf(ofp, "%05u\n", sp->s_addr);
1066 /*)Function VOID out(p, n)
1068 * int n number of words to output
1069 * int * p pointer to data words
1071 * The function out() outputs the data words to the .REL file
1072 * int the specified radix.
1078 * FILE * ofp relocation output file handle
1079 * int xflag -x, listing radix flag
1082 * int fprintf() c_library
1085 * Data is sent to the .REL file.
1093 fprintf(ofp, " %02X", (*p++)&0xff);
1096 fprintf(ofp, " %03o", (*p++)&0xff);
1099 fprintf(ofp, " %03u", (*p++)&0xff);
1104 /*)Function VOID out_lb(b, t)
1106 * int b assembled data
1107 * int t relocation type
1109 * The function out_lb() copies the assembled data and
1110 * its relocation type to the list data buffers.
1116 * int * cp pointer to assembler output array cb[]
1117 * int * cpt pointer to assembler relocation type
1118 * output array cbt[]
1124 * Pointers to data and relocation buffers incremented by 1.
1128 out_lb(register int b, register int t)
1130 if (cp < &cb[NCODE]) {
1136 /*)Function VOID out_lw(n, t)
1138 * int n assembled data
1139 * int t relocation type
1141 * The function out_lw() copies the assembled data and
1142 * its relocation type to the list data buffers.
1148 * int * cp pointer to assembler output array cb[]
1149 * int * cpt pointer to assembler relocation type
1150 * output array cbt[]
1156 * Pointers to data and relocation buffers incremented by 2.
1160 out_lw(register int n, register int t)
1163 out_lb(hibyte(n),t ? t|R_HIGH : 0);
1164 out_lb(lobyte(n),t);
1166 out_lb(lobyte(n),t);
1167 out_lb(hibyte(n),t ? t|R_HIGH : 0);
1171 /*)Function VOID out_l24(n, t)
1173 * int n assembled data
1174 * int t relocation type
1176 * The function out_l24() copies the assembled data and
1177 * its relocation type to the list data buffers.
1183 * int * cp pointer to assembler output array cb[]
1184 * int * cpt pointer to assembler relocation type
1185 * output array cbt[]
1191 * Pointers to data and relocation buffers incremented by 3.
1195 out_l24(int n, int t)
1198 out_lb(byte3(n),t ? t|R_HIGH : 0);
1199 out_lb(hibyte(n),t);
1200 out_lb(lobyte(n),t);
1202 out_lb(lobyte(n),t);
1203 out_lb(hibyte(n),t);
1204 out_lb(byte3(n),t ? t|R_HIGH : 0);
1208 /*)Function VOID out_rw(n)
1212 * The function out_rw() outputs the relocation (R)
1213 * data word as two bytes ordered according to hilo.
1216 * int * relp pointer to rel array
1222 * int lobyte() asout.c
1223 * int hibyte() asout.c
1226 * Pointer to relocation buffer incremented by 2.
1230 out_rw(register int n)
1233 *relp++ = hibyte(n);
1234 *relp++ = lobyte(n);
1236 *relp++ = lobyte(n);
1237 *relp++ = hibyte(n);
1241 /*)Function VOID out_tw(n)
1245 * The function out_tw() outputs the text (T)
1246 * data word as two bytes ordered according to hilo.
1249 * int * txtp pointer to txt array
1255 * int lobyte() asout.c
1256 * int hibyte() asout.c
1259 * Pointer to relocation buffer incremented by 2.
1263 out_tw(register int n)
1266 *txtp++ = hibyte(n);
1267 *txtp++ = lobyte(n);
1269 *txtp++ = lobyte(n);
1270 *txtp++ = hibyte(n);
1274 /*)Function VOID out_t24(n)
1278 * The function out_t24() outputs the text (T)
1279 * data word as three bytes ordered according to hilo.
1282 * int * txtp pointer to txt array
1288 * int lobyte() asout.c
1289 * int hibyte() asout.c
1292 * Pointer to relocation buffer incremented by 3.
1300 *txtp++ = hibyte(n);
1301 *txtp++ = lobyte(n);
1303 *txtp++ = lobyte(n);
1304 *txtp++ = hibyte(n);
1309 /*)Function int lobyte(n)
1313 * The function lobyte() returns the lower byte of
1335 /*)Function int hibyte(n)
1339 * The function hibyte() returns the higher byte of
1358 return ((n>>8)&0377);
1361 /*)Function int byte3(n)
1365 * The function byte3() returns the MSB of the
1383 return ((n >> 16) & 0xff);
1387 * JLH: Output relocatable 11 bit jump/call
1389 * This function is derived from outrw(), adding the parameter for the
1390 * 11 bit address. This form of address is used only on the 8051 and 8048.
1393 outr11(register struct expr *esp, int op, int r)
1398 if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
1399 /* Absolute destination.
1400 * Listing shows only the address.
1402 out_lw(esp->e_addr,0);
1405 out_tw(esp->e_addr);
1409 *relp++ = txtp - txt - 3;
1413 /* Relocatable destination. Build THREE
1414 * byte output: relocatable word, followed
1415 * by op-code. Linker will combine them.
1416 * Listing shows only the address.
1418 r |= R_WORD | esp->e_rlcf;
1419 out_lw(esp->e_addr,r|R_RELOC);
1422 out_tw(esp->e_addr);
1426 n = esp->e_base.e_sp->s_ref;
1429 n = esp->e_base.e_ap->a_ref;
1432 *relp++ = txtp - txt - 3;
1441 * Output relocatable 19 bit jump/call
1443 * This function is derived from outrw(), adding the parameter for the
1444 * 19 bit address. This form of address is used only in the DS80C390
1448 outr19(struct expr * esp, int op, int r)
1453 if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
1454 /* Absolute destination.
1455 * Listing shows only the address.
1457 out_lw(esp->e_addr,0);
1460 out_t24(esp->e_addr);
1464 *relp++ = txtp - txt - 4;
1468 /* Relocatable destination. Build FOUR
1469 * byte output: relocatable 24-bit entity, followed
1470 * by op-code. Linker will combine them.
1471 * Listing shows only the address.
1473 r |= R_WORD | esp->e_rlcf;
1474 out_l24(esp->e_addr,r|R_RELOC);
1477 out_t24(esp->e_addr);
1481 n = esp->e_base.e_sp->s_ref;
1484 n = esp->e_base.e_ap->a_ref;
1487 *relp++ = txtp - txt - 4;