ref: 6b341367541d0a5a221fcb8cba6d6ff0a2d48e16
parent: 16ac0a93b39ea62401f2d2edb5f203ffe2e746b0
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Mar 6 07:19:15 EST 2018
Add COFF 32 bit version includes These includes are derivated from the clasical coff headers of UNIX System V.
--- /dev/null
+++ b/inc/coff32/aouthdr.h
@@ -1,0 +1,15 @@
+
+/* This file is inspired in the book "Understanding and using COFF" */
+
+struct aouthdr {
+ short magic; /* magic number */
+ short vstamp; /* version stamp */
+ long tsize; /* text size in bytes */
+ long dsize; /* initialized data size */
+ long bsize; /* uinitialized data size */
+ long entry; /* entry point */
+ long text_start; /* base of text segment */
+ long data_start; /* base of data segment */
+};
+
+typedef struct aouthdr AOUTHDR;
--- /dev/null
+++ b/inc/coff32/filehdr.h
@@ -1,0 +1,22 @@
+
+/* This file is inspired in the book "Understanding and using COFF" */
+
+struct filehdr {
+ unsigned short f_magic; /* magic number */
+ unsigned short f_nscns; /* number of sections */
+ long f_timdat; /* time stamp */
+ long f_symptr; /* file pointer to symbols */
+ long f_nsyms; /* number of symbols */
+ unsigned short f_opthdr; /* size of optional header */
+ unsigned short f_flags; /* file flags */
+};
+
+#define FILHDR struct filehdr
+#define FILHSZ 20
+
+#define F_RELFLG (1 << 0)
+#define F_EXEC (1 << 1)
+#define F_LMNO (1 << 2)
+#define F_SYMS (1 << 3)
+
+#define COFF_Z80MAGIC 0x805a
--- /dev/null
+++ b/inc/coff32/linenum.h
@@ -1,0 +1,11 @@
+
+/* This file is inspired in the book "Understanding and using COFF" */
+
+struct lineno {
+ long l_symndx; /* index in table symbol if l_lnno == 0 */
+ long l_paddr; /* Break pointable address if l_lnno > 0 */
+ unsigned short l_lnno; /* Line number */
+};
+
+#define LINENO struct lineno
+#define LINESZ 6
--- /dev/null
+++ b/inc/coff32/reloc.h
@@ -1,0 +1,8 @@
+
+/* This file is inspired in the book "Understanding and using COFF" */
+
+struct reloc {
+ long r_vaddr; /* address of reference */
+ long r_symndx; /* index into symbol table */
+ unsignedd short r_type; /* relocation type */
+};
--- /dev/null
+++ b/inc/coff32/scnhdr.h
@@ -1,0 +1,38 @@
+
+/* This file is inspired in the book "Understanding and using COFF" */
+
+#define SCNNMLEN 8
+
+struct scnhdr {
+ char s_name[SCNNMLEN]; /* section name */
+ long s_paddr; /* physical address */
+ long s_vaddr; /* virtual address */
+ long s_size; /* section size */
+ long s_scnptr; /* file ptr to raw data */
+ long s_relptr; /* file ptr to relo info */
+ long s_lnnoptr; /* file ptr to line number */
+ unsigned short s_nrelloc; /* number of relocation entries */
+ unsigned short s_nlnno; /* number of lines entries */
+ long s_flags; /* type and content flags */
+};
+
+#define SCNHDR struct scnhdr
+#define SCNHSZ 40
+
+#define STYP_REG 0
+#define STYP_DSECT (1 << 0)
+#define STYP_NOLOAD (1 << 1)
+#define STYP_GROUP (1 << 2)
+#define STYP_PAD (1 << 3)
+#define STYP_COPY (1 << 4)
+#define STYP_TEXT (1 << 5)
+#define S_SHRSEG (1 << 6)
+#define STYP_DATA (1 << 7)
+#define STYP_BSS (1 << 8)
+#define S_NEWFCN (1 << 9)
+#define STYP_INFO (1 << 10)
+#define STYP_OVER (1 << 11)
+#define STYP_LIB (1 << 12)
+#define STYP_MERGE (1 << 13)
+#define STYP_REVERSE_PAD (1 << 14)
+#define STYP_LIT 0x8020
--- /dev/null
+++ b/inc/coff32/syms.h
@@ -1,0 +1,85 @@
+
+/* This file is inspired in the book "Understanding and using COFF" */
+
+struct syment {
+ union {
+ char _n_name[8]; /* symbol name */
+ struct {
+ long _n_zeroes; /* if _n_name[0-3] == 0 */
+ long _n_offset; /* offset into string table */
+ } _n_n;
+ char _n_ptr[2]; /* allows for overlaying */
+ } _n;
+ long n_value; /* value of symbol */
+ short n_scnum; /* section number */
+ unsigned short n_type; /* type and derived type */
+ char n_sclass; /* storage class */
+ char n_numaux; /* number of aux. entries */
+};
+
+#define n_name _n._n_name
+#define n_nptr _n._n_nptr[1]
+#define n_zeroes _n._n_n._n_zeroes
+#define n_offset _n._n_n._n_offset
+
+/* Special n_scnum values */
+#define N_DEBUG -2
+#define N_ABS -1
+#define N_UNDEF 0
+
+/* basic types */
+#define T_NULL 0
+#define T_VOID 1
+#define T_CHAR 2
+#define T_SHORT 3
+#define T_INT 4
+#define T_LONG 5
+#define T_FLOAT 6
+#define T_DOUBLE 7
+#define T_STRUCT 8
+#define T_UNION 9
+#define T_ENUM 10
+#define T_MOE 11
+#define T_UCHAR 12
+#define T_USHORT 13
+#define T_UINT 14
+#define T_ULONG 15
+#define T_LNGDBL 16
+
+/* derivated types */
+#define DT_NON 0
+#define DT_PTR 1
+#define DT_FCN 2
+#define DT_ARY 3
+
+/* storage class */
+#define C_NULL 0
+#define C_AUTO 1
+#define C_EXT 2
+#define C_STAT 3
+#define C_REG 4
+#define C_EXTDEF 5
+#define C_LABEL 6
+#define C_ULABEL 7
+#define C_MOS 8
+#define C_ARG 9
+#define C_STRTAG 10
+#define C_MOU 11
+#define C_UNTAG 12
+#define C_TPDEF 13
+#define C_USTATIC 14
+#define C_ENTAG 15
+#define C_MOE 16
+#define C_REGPARM 17
+#define C_FIELD 18
+#define C_AUTOARG 19
+#define C_LASTENT 20
+#define C_BLOCK 100
+#define C_FCN 101
+#define C_EOS 102
+#define C_FILE 103
+#define C_LINE 104
+#define C_ALIAS 105
+#define C_HIDDEN 106
+#define C_WEAKEXT 127
+#define C_EFCN 255