00001
00002
00003
00004
00005
00006
00007 #ifndef __OUT_H_INCLUDED
00008 #define __OUT_H_INCLUDED
00009
00010
00011
00012 #ifndef ushort
00013 #define ushort unsigned short
00014 #endif
00015
00016 struct outhead {
00017 ushort oh_magic;
00018 ushort oh_stamp;
00019 ushort oh_flags;
00020 ushort oh_nsect;
00021 ushort oh_nrelo;
00022 ushort oh_nname;
00023 long oh_nemit;
00024 long oh_nchar;
00025 };
00026
00027 #define O_MAGIC 0x0201
00028 #define O_STAMP 0
00029 #define MAXSECT 64
00030
00031 #define HF_LINK 0x0004
00032 #define HF_8086 0x0008
00033
00034 struct outsect {
00035 long os_base;
00036 long os_size;
00037 long os_foff;
00038 long os_flen;
00039 long os_lign;
00040 };
00041
00042 struct outrelo {
00043 char or_type;
00044 char or_sect;
00045 ushort or_nami;
00046 long or_addr;
00047 };
00048
00049 struct outname {
00050 union {
00051 char *on_ptr;
00052 long on_off;
00053 } on_u;
00054 #define on_mptr on_u.on_ptr
00055 #define on_foff on_u.on_off
00056 ushort on_type;
00057 ushort on_desc;
00058 long on_valu;
00059 };
00060
00061
00062
00063
00064 #define RELSZ 0x07
00065 #define RELO1 1
00066 #define RELO2 2
00067 #define RELO4 4
00068 #define RELPC 0x08
00069 #define RELBR 0x10
00070 #define RELWR 0x20
00071
00072
00073
00074
00075 #define S_TYP 0x007F
00076 #define S_EXT 0x0080
00077 #define S_ETC 0x7F00
00078
00079
00080
00081
00082 #define S_UND 0x0000
00083 #define S_ABS 0x0001
00084 #define S_MIN 0x0002
00085 #define S_MAX (S_TYP-1)
00086 #define S_CRS S_TYP
00087
00088
00089
00090
00091 #define S_SCT 0x0100
00092 #define S_LIN 0x0200
00093 #define S_FIL 0x0300
00094 #define S_MOD 0x0400
00095 #define S_COM 0x1000
00096 #define S_STB 0xe000
00097
00098
00099
00100
00101
00102
00103 #define SF_HEAD "22222244"
00104 #define SF_SECT "44444"
00105 #define SF_RELO "1124"
00106 #define SF_NAME "4224"
00107
00108
00109
00110
00111 #define SZ_HEAD 20
00112 #define SZ_SECT 20
00113 #define SZ_RELO 8
00114 #define SZ_NAME 12
00115
00116
00117
00118
00119 #define BADMAGIC(x) ((x).oh_magic!=O_MAGIC)
00120 #define OFF_SECT(x) SZ_HEAD
00121 #define OFF_EMIT(x) (OFF_SECT(x) + ((long)(x).oh_nsect * SZ_SECT))
00122 #define OFF_RELO(x) (OFF_EMIT(x) + (x).oh_nemit)
00123 #define OFF_NAME(x) (OFF_RELO(x) + ((long)(x).oh_nrelo * SZ_RELO))
00124 #define OFF_CHAR(x) (OFF_NAME(x) + ((long)(x).oh_nname * SZ_NAME))
00125
00126 #endif