home *** CD-ROM | disk | FTP | other *** search
- #include "xenixomf.h"
- #include <stdio.h>
- #include <fcntl.h>
-
- #define I386 1
-
- #define L_DGROUP 2
- #define L_IGROUP 3
- #define L_BEGDATA 4
- #define L_ENDDATA 5
- #define L_ENDCODE 6
- #define L_C_ETEXT 7
- #define L_BSS 8
- #define L_DATA 9
- #define L_CODE 10
- #define L_EEND 11
- #define L_NULL 12
- #define L_UBSS 13
- #define L_EDATA 14
- #define L_STACK 15
- #define L_UDATA 16
- #define L_CONST 17
- #define L_UTEXT 18
- #define L_ENDBSS 19
-
- extern int outfile;
- char *lnames[] = {
- "",
- "",
- "DGROUP",
- "IGROUP",
- "BEGDATA",
- "ENDDATA",
- "ENDCODE",
- "C_ETEXT",
- "BSS",
- "DATA",
- "CODE",
- "EEND",
- "NULL",
- "_BSS",
- "EDATA",
- "STACK",
- "_DATA",
- "CONST",
- "_TEXT",
- "ENDBSS"
- };
-
- #define NLNAMES ((sizeof(lnames) / sizeof(char *)) - 1)
-
- struct segtable {
- unsigned char attrib;
- long length;
- unsigned nameindex;
- unsigned classindex;
- };
-
- /* SEGDEF's */
-
- static struct segtable segt[] = {
- {0, 0, 0, 0},
- {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_UTEXT, L_CODE},
- {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_C_ETEXT, L_ENDCODE},
- {SD_PARA|SD_PUBLIC|SD_PGRES, 0, L_NULL, L_BEGDATA},
- {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_UDATA, L_DATA},
- {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_CONST, L_CONST},
- {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_EDATA, L_ENDDATA},
- {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_UBSS, L_BSS},
- {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_EEND, L_ENDBSS},
- {SD_PARA|SD_STACK|SD_PGRES, 0, L_STACK, L_STACK},
- };
-
- #define SDEF_SIZE ((sizeof(segt) / sizeof(struct segtable)) - 1)
-
- unsigned int dgroup_tab[] = {3, 4, 5, 6, 7, 8, 9};
- #define DGRPTABSIZ (sizeof(dgroup_tab) / sizeof(int))
- unsigned int igroup_tab[] = {1, 2};
- #define IGRPTABSIZ (sizeof(igroup_tab) / sizeof(int))
-
- main()
- {
- int i;
-
- if ((outfile = creat("Sseg.o", 0644)) < 0)
- {
- fprintf(stderr, "cannot open Sseg.o\n");
- exit(-1);
- }
- omf_theadr("Sseg.asm"); /* Lies, Lies */
-
- omf_start_lnames();
- for (i = 1; i <= NLNAMES; i++)
- omf_lnames(lnames[i]);
- omf_end_lnames();
-
- for (i = 1; i <= SDEF_SIZE; i++)
- omf_segdef(I386, segt[i].attrib, 0, 0L, segt[i].length,
- segt[i].nameindex, segt[i].classindex);
-
- omf_start_grpdef(L_DGROUP);
- for (i = 0; i < DGRPTABSIZ; i++)
- omf_grpdef(dgroup_tab[i]);
- omf_end_grpdef();
-
- omf_start_grpdef(L_IGROUP);
- for (i = 0; i < IGRPTABSIZ; i++)
- omf_grpdef(igroup_tab[i]);
- omf_end_grpdef();
-
- omf_start_pubdef(I386, 0, 2, 0);
- omf_pubdef(I386, "_etext", 0, 0);
- omf_end_pubdef();
- omf_start_pubdef(I386, 0, 8, 0);
- omf_pubdef(I386, "_end", 0, 0);
- omf_end_pubdef();
- omf_start_pubdef(I386, 0, 6, 0);
- omf_pubdef(I386, "_edata", 0, 0);
- omf_end_pubdef();
-
- omf_modend(I386);
- }
-