2337 lines
51 KiB
Plaintext
2337 lines
51 KiB
Plaintext
public U2i union U2
|
|
{
|
|
I1i i1[2];
|
|
U1i u1[2];
|
|
};
|
|
|
|
public I2i union I2
|
|
{
|
|
I1i i1[2];
|
|
U1i u1[2];
|
|
};
|
|
|
|
public U4i union U4
|
|
{
|
|
I1i i1[4];
|
|
U1i u1[4];
|
|
I2i i2[2];
|
|
U2i u2[2];
|
|
};
|
|
|
|
public I4i union I4
|
|
{
|
|
I1i i1[4];
|
|
U1i u1[4];
|
|
I2i i2[2];
|
|
U2i u2[2];
|
|
};
|
|
|
|
public U8i union U8
|
|
{
|
|
I1i i1[8];
|
|
U1i u1[8];
|
|
I2i i2[4];
|
|
U2i u2[4];
|
|
I4i i4[2];
|
|
U4i u4[2];
|
|
};
|
|
|
|
public I8i union I8
|
|
{
|
|
I1i i1[8];
|
|
U1i u1[8];
|
|
I2i i2[4];
|
|
U2i u2[4];
|
|
I4i i4[2];
|
|
U4i u4[2];
|
|
};
|
|
|
|
public class P2I4 //two dimensional point
|
|
{
|
|
I4 x,y;
|
|
};
|
|
|
|
public class P3I4 //three dimensional point
|
|
{
|
|
I4 x,y,z;
|
|
};
|
|
|
|
public class P2I8 //two dimensional point
|
|
{
|
|
I8 x,y;
|
|
};
|
|
|
|
public class P3I8 //three dimensional point
|
|
{
|
|
I8 x,y,z;
|
|
};
|
|
|
|
public class P2d //two dimensional point
|
|
{
|
|
double x,y;
|
|
};
|
|
|
|
public class P3d //three dimensional point
|
|
{
|
|
double x,y,z;
|
|
};
|
|
|
|
#define NULL 0
|
|
#define TRUE 1
|
|
#define FALSE 0
|
|
#define ON 1
|
|
#define OFF 0
|
|
#define BoolU1 U1
|
|
#define BoolU2 U2
|
|
#define BoolU4 U4
|
|
#define BoolU8 U8
|
|
#define MAX_U1 0xFF
|
|
#define MIN_U1 0
|
|
#define MAX_I1 0x7F
|
|
#define MIN_I1 0x80
|
|
#define MAX_U2 0xFFFF
|
|
#define MIN_U2 0
|
|
#define MAX_I2 0x7FFF
|
|
#define MIN_I2 0x8000
|
|
#define MAX_U4 0xFFFFFFFF
|
|
#define MIN_U4 0
|
|
#define MAX_I4 0x7FFFFFFF
|
|
#define MIN_I4 0x80000000
|
|
#define MAX_U8 0xFFFFFFFFFFFFFFFF
|
|
#define MIN_U8 0
|
|
#define MAX_I8 0x7FFFFFFFFFFFFFFF
|
|
#define MIN_I8 0x8000000000000000
|
|
#define MAX_double 1.79e308 //TODO:make exact
|
|
#define MIN_double -1.79e308
|
|
#define PTR_SIZE sizeof(U4i)
|
|
#define INVALID_PTR 0x7FFFFFFF
|
|
#define INVALID_CLUSTER -1
|
|
#define ALL_MASK -1
|
|
|
|
public class Ode
|
|
{
|
|
Ode *next,*last;
|
|
I8 n;
|
|
double base_t;
|
|
double t;
|
|
double h;
|
|
double tolerance_start;
|
|
double tolerance;
|
|
double *state;
|
|
double *DstateDt;
|
|
double *state_scale;
|
|
double *initial_state;
|
|
double *temp0,*temp1,*temp2,*temp3,
|
|
*temp4,*temp5,*temp6,*temp7;
|
|
void derivative(Ode *o,double t,double *state,double *DstateDt);
|
|
};
|
|
|
|
public class Order2D3
|
|
{
|
|
double x,y,z,DxDt,DyDt,DzDt;
|
|
};
|
|
|
|
class BinFileHeaderStruct
|
|
{
|
|
U4 jmp;
|
|
U4 header_offset;
|
|
U4 file_size;
|
|
U4 xsum;
|
|
};
|
|
|
|
#define MAXGDT 512
|
|
#define MAXIDT 96
|
|
#define SYS_DEFAULT_FLAGS 0x40200
|
|
#define SYS_DEFAULT_CR3 0
|
|
|
|
class GdtTabStruct
|
|
{
|
|
U4 lo,hi;
|
|
};
|
|
|
|
class OsMainStruct $LK,"/LT/OSMain/OSMAIN.ASZ","FI:/LT/OSMain/OSMAIN.ASZ"$
|
|
{
|
|
BinFileHeaderStruct h;
|
|
U4 jmp;
|
|
U4 boot_base;
|
|
U4 header_base;
|
|
U4 os_32start;
|
|
GdtTabStruct gdttab[MAXGDT];
|
|
U4 boot_code;
|
|
U4 sys_memblks;
|
|
};
|
|
|
|
|
|
#define JIFFY_FREQ 10000 // Hz
|
|
#define LTDATE_FREQ 49710 // Hz
|
|
#define SYS_TIMER_FREQ (18333*65536/1000) //Hz
|
|
|
|
#define SYS_TIMER0_PERIOD (65536*182/10/JIFFY_FREQ)
|
|
|
|
//SYSFLAGS definitions
|
|
#define SYSf_PREEMPTIVE 0
|
|
#define SYSf_CLEAR_SCREEN_TEXT 1
|
|
#define SYSf_DEBUG 2
|
|
#define SYSf_RAW_CRT_OUT 3
|
|
#define SYSf_CTRL_ALT_DEL 4
|
|
#define SYSf_CTRL_ALT_C 5
|
|
#define SYSf_CTRL_ALT_ESC 6
|
|
#define SYSf_CTRL_ALT_X 7
|
|
#define SYSf_CTRL_ALT_TAB 8
|
|
#define SYSf_TASK_LINKS_ALTERED 9
|
|
#define SYSf_RECORD_MACRO 10
|
|
#define SYSf_NO_SOUND 11
|
|
#define SYSf_NO_IO_SOUND 12
|
|
|
|
//Extern calls
|
|
#define EXT_IRQ01 1 // Keyboard
|
|
#define EXT_IRQ03 3 // Comm
|
|
#define EXT_IRQ04 4 // Comm
|
|
#define EXT_IRQ06 6 // FDC0
|
|
#define EXT_IRQ07 7 // LPT1
|
|
#define EXT_IRQ0C 12 // Mouse
|
|
#define EXT_IRQ0E 14 // IDE0
|
|
#define EXT_IRQ0F 15 // IDE1
|
|
#define EXT_IRQ00 32 // Timer
|
|
#define EXT_LTF_PUT_I1 33
|
|
#define EXT_LTF_PUTS 34
|
|
#define EXT_LTF_READ 35
|
|
#define EXT_LTF_WRITE 36
|
|
#define EXT_LTF_NEW 37
|
|
#define EXT_LTF_RESET 38
|
|
#define EXT_LTF_DEL 39
|
|
#define EXT_LTF_RECALC 40
|
|
#define EXT_SPRINTF_JOIN 41
|
|
#define EXT_GETF_JOIN 42
|
|
#define EXT_DEBUG 43
|
|
#define EXT_EXECUTE_FILE 44
|
|
#define EXT_EXECUTE_STRING 45
|
|
#define EXT_WINDOW_TO_TOP 46
|
|
#define EXT_CMP_EXE_BLK 47
|
|
#define EXT_RMT_GETMSG 48
|
|
#define EXT_RMT_PUTCHAR 49
|
|
#define EXT_RMT_PUTS 50
|
|
#define EXT_RMT_LTFPUTCHAR 51
|
|
#define EXT_TABLE_SIZE 256
|
|
|
|
|
|
//Software Interrupts
|
|
#define I_PUT_SYSTEXT 0x30
|
|
#define I_PUT_I1 0x31
|
|
#define I_GET_CHAR 0x32
|
|
#define I_COUT 0x33
|
|
#define I_PEEK_MSG 0x34
|
|
#define I_GET_MSG_NO_WAIT 0x35
|
|
#define I_FLUSH_MSGS 0x36
|
|
#define I_GET_MSG 0x37
|
|
#define I_PUT_STRING 0x38
|
|
#define I_COUTLN 0x39
|
|
#define I_DEBUG 0x3A
|
|
|
|
#define FLT_UNDEF_EXTERN 0x100
|
|
|
|
//Hash table types
|
|
#define HTT_INVALID 0
|
|
#define HTT_ALL -1
|
|
#define HTT_STRING_CONSTANT 0x001
|
|
#define HTT_SYS_SYMBOL 0x002
|
|
#define HTT_KEYWORD 0x004
|
|
#define HTT_LOCAL_VAR 0x008
|
|
#define HTT_GLBL_VAR 0x010
|
|
#define HTT_CLASS 0x020
|
|
#define HTT_INTERNAL_TYPE 0x040
|
|
#define HTT_FUNCTION 0x080
|
|
#define HTT_WORD 0x100
|
|
#define HTT_OPCODE 0x200
|
|
#define HTT_R8 0x400
|
|
#define HTT_R16 0x800
|
|
#define HTT_R32 0x1000
|
|
#define HTT_SEG 0x2000
|
|
#define HTT_SYSTEXT 0x4000
|
|
#define HTT_FILE 0x8000
|
|
#define HTT_MODULE 0x10000
|
|
#define HTT_PRIVATE 0x02000000
|
|
#define HTT_PUBLIC 0x04000000
|
|
#define HTT_EXPORT 0x08000000
|
|
#define HTT_IMPORT 0x10000000
|
|
#define HTT_LITERAL 0x20000000
|
|
#define HTT_UNRESOLVED_LOCAL 0x40000000
|
|
#define HTT_UNRESOLVED_GLBL 0x80000000
|
|
|
|
class DbgInfo
|
|
{
|
|
U4 min_line,max_line;
|
|
U4 body[1];
|
|
};
|
|
|
|
public class SysHashEntry
|
|
//Don't forget to change WsHashEntry and asm stuff
|
|
{
|
|
SysHashEntry *next;
|
|
I1 *string;
|
|
U4 type,use_cnt;
|
|
I1 *source_link;
|
|
DbgInfo *debug;
|
|
U4 user0,user1,user2;
|
|
};
|
|
|
|
public class SysHashTable
|
|
{
|
|
SysHashTable *next;
|
|
U4 mask;
|
|
SysHashEntry *body[1]; //SysHashTable is var size
|
|
};
|
|
|
|
public class StringConstantStruct
|
|
{
|
|
SysHashEntry *next;
|
|
I1 *string;
|
|
U4 type,use_cnt;
|
|
I1 *source_link;
|
|
I1 *data;
|
|
};
|
|
|
|
#define LTFLT_BLINK 0x10000000
|
|
#define LTFLT_INVERTED 0x20000000
|
|
#define LTFLT_SELECTED 0x40000000
|
|
#define LTFLT_UNDERLINED 0x80000000
|
|
|
|
#define MLF_DEFAULT_AVAILABLE 1
|
|
#define MLF_FUNCTION 2
|
|
#define MLF_DOT_DOT_DOT 4
|
|
public class MemberListStruct
|
|
{
|
|
MemberListStruct *next;
|
|
I1 *string;
|
|
U4 *member_class;
|
|
U4 use_cnt;
|
|
I1 *fmtstr;
|
|
I1 *fmtdata;
|
|
U2 flags;
|
|
U2 parameter_cnt;
|
|
U4 cnt; //for arrays
|
|
I4 offset;
|
|
U8 default_value;
|
|
void output_fun(I1 *buf,U1 *d);
|
|
void input_fun(I1 *buf,U1 *d);
|
|
};
|
|
|
|
#define Cf_INTERNAL 0 // Internal function
|
|
#define Cf_EXTERN 1
|
|
public class ClassStruct //used for classes, functions and internal_data_types
|
|
{
|
|
SysHashEntry *next;
|
|
I1 *string;
|
|
U4 type,use_cnt;
|
|
I1 *source_link;
|
|
DbgInfo *debug;
|
|
U2 member_cnt;
|
|
U2 parameter_cnt;
|
|
I4 size;
|
|
MemberListStruct *member_list;
|
|
MemberListStruct *last_in_member_list;
|
|
U4 *executable_address;
|
|
ClassStruct *return_class;
|
|
U1 pointer_cnt;
|
|
U1 sub_type,flags[2];
|
|
I1 *import_name;
|
|
};
|
|
|
|
//Internal type definitions
|
|
#define IT_I0 0
|
|
#define IT_U0 1
|
|
#define IT_I1 2
|
|
#define IT_U1 3
|
|
#define IT_I2 4
|
|
#define IT_U2 5
|
|
#define IT_I4 6
|
|
#define IT_U4 7
|
|
#define IT_I8 8
|
|
#define IT_U8 9
|
|
#define IT_DOUBLE 10
|
|
#define IT_UDOUBLE 11 // fictitious placeholder
|
|
#define IT_NUM_IT 12
|
|
|
|
#define GVAF_FUNCTION 1
|
|
#define GVAF_IMPORT 2
|
|
#define GVAF_EXTERN 4
|
|
public class GlblVarStruct
|
|
{
|
|
SysHashEntry *next;
|
|
I1 *string;
|
|
U4 type,use_cnt;
|
|
I1 *source_link;
|
|
DbgInfo *debug;
|
|
U2 flags;
|
|
U2 parameter_cnt;
|
|
U4 size; //must be in same spot as in class
|
|
ClassStruct *var_class;
|
|
U4 cnt;
|
|
I1 *import_name;
|
|
U4 data_address;
|
|
U4 data;
|
|
};
|
|
|
|
#define SACTf_ADAM3_LOADED 0
|
|
|
|
public class SysAccntStruct
|
|
{
|
|
SysAccntStruct *next,*last;
|
|
I1 name[32];
|
|
U4 flags;
|
|
};
|
|
|
|
#define TSSCf_WAKE_MASTER 0
|
|
#define TSSCf_FOCUS_MASTER 1
|
|
#define TSSCf_NOT_INPUT 2
|
|
#define TSSCf_EXIT_ON_COMPLETE 3
|
|
#define TSSCf_TEXT 4
|
|
#define TSSCf_DONT_FILTER 5
|
|
|
|
class TssCmdStruct
|
|
{
|
|
TssCmdStruct *next,*last;
|
|
U4 code;
|
|
U8 p1,p2;
|
|
U8 flags;
|
|
I1 *data;
|
|
U8 result;
|
|
U4 master_tss;
|
|
};
|
|
|
|
#define SBPTf_DISABLE 0
|
|
|
|
#define SBPTF_BPT 2
|
|
#define SBPTF_STEP 4
|
|
class SysBpt
|
|
{
|
|
SysBpt *next;
|
|
U4 flags;
|
|
U4 address;
|
|
U1 b;
|
|
};
|
|
|
|
class MemBlk
|
|
{
|
|
MemBlk *next,*last;
|
|
U4 pages;
|
|
};
|
|
|
|
class UnusedAllocatedMem
|
|
{
|
|
UnusedAllocatedMem *next;
|
|
U4 size;
|
|
};
|
|
|
|
//LtfEntry.type codes (Low 8 bits)
|
|
#define LTFT_TEXT 0
|
|
#define LTFT_CR 1
|
|
#define LTFT_SOFT_CR 2
|
|
#define LTFT_CURSOR 3
|
|
#define LTFT_TAB 4
|
|
#define LTFT_CLEAR 5
|
|
#define LTFT_PAGE_BREAK 6
|
|
#define LTFT_DATA 7
|
|
#define LTFT_PAGE_LENGTH 8
|
|
#define LTFT_LEFT_MARGIN 9
|
|
#define LTFT_RIGHT_MARGIN 10
|
|
#define LTFT_HEADER 11
|
|
#define LTFT_FOOTER 12
|
|
#define LTFT_INDENT 13
|
|
#define LTFT_FOREGROUND_COLOR 14
|
|
#define LTFT_BACKGROUND_COLOR 15
|
|
#define LTFT_DEFAULT_FOREGROUND_COLOR 16
|
|
#define LTFT_DEFAULT_BACKGROUND_COLOR 17
|
|
#define LTFT_LINK_FOREGROUND 18
|
|
#define LTFT_LINK_BACKGROUND 19
|
|
#define LTFT_MACRO_FOREGROUND 20
|
|
#define LTFT_MACRO_BACKGROUND 21
|
|
#define LTFT_ANCHOR_FOREGROUND 22
|
|
#define LTFT_ANCHOR_BACKGROUND 23
|
|
#define LTFT_HIDDEN_FOREGROUND 24
|
|
#define LTFT_HIDDEN_BACKGROUND 25
|
|
#define LTFT_TREE_FOREGROUND 26
|
|
#define LTFT_TREE_BACKGROUND 27
|
|
#define LTFT_USER_FOREGROUND 28
|
|
#define LTFT_USER_BACKGROUND 29
|
|
#define LTFT_WORD_WRAP 30
|
|
#define LTFT_UNDERLINED 31
|
|
#define LTFT_INVERTED 32
|
|
#define LTFT_BLINK 33
|
|
#define LTFT_SHIFTED_X 34
|
|
#define LTFT_SHIFTED_Y 35
|
|
#define LTFT_CURSOR_MOVEMENT 36
|
|
#define LTFT_ANCHOR 37
|
|
#define LTFT_LINK 38
|
|
#define LTFT_BUTTON 39
|
|
#define LTFT_CHECK_BOX 40
|
|
#define LTFT_MACRO 41
|
|
#define LTFT_MENU_VALUE 42
|
|
#define LTFT_HEX_EDIT 43
|
|
#define LTFT_HIDE_START 44
|
|
#define LTFT_HIDE_END 45
|
|
#define LTFT_TREE 46
|
|
#define LTFT_PICTURE 47
|
|
#define LTFT_INSERT_BINARY 48
|
|
#define LTFT_INSERT_BINARY_TYPE 49
|
|
#define LTFT_INSERT_BINARY_SIZE 50
|
|
#define LTFT_BPT 51
|
|
#define LTFT_SONG 52
|
|
#define LTFT_ERROR 53
|
|
|
|
//LtfEntry.flag flags
|
|
#define LTFLF_AUX_STRING 1
|
|
#define LTFLF_LEFT_CB 2
|
|
#define LTFLF_LEFT_EXP 4
|
|
#define LTFLF_LEFT_MACRO 8
|
|
#define LTFLF_LEFT_AUTO 0x10
|
|
#define LTFLF_RIGHT_CB 0x20
|
|
#define LTFLF_RIGHT_EXP 0x40
|
|
#define LTFLF_RIGHT_MACRO 0x80
|
|
#define LTFLF_RIGHT_AUTO 0x100
|
|
#define LTFLF_DISPLAY_CB 0x200
|
|
#define LTFLF_HAS_BIN 0x400
|
|
#define LTFLF_ESC 0x800
|
|
#define LTFLF_QUIT 0x1000
|
|
#define LTFLF_LEFT_X 0x2000
|
|
#define LTFLF_CENTER_X 0x4000
|
|
#define LTFLF_RIGHT_X 0x8000
|
|
#define LTFLF_TOP_Y 0x10000
|
|
#define LTFLF_CENTER_Y 0x20000
|
|
#define LTFLF_BOTTOM_Y 0x40000
|
|
#define LTFLF_SHIFTED_X 0x80000
|
|
#define LTFLF_SHIFTED_Y 0x100000
|
|
#define LTFLF_SCROLLING_X 0x200000
|
|
#define LTFLF_SCROLLING_Y 0x400000
|
|
|
|
#define LTFLF_HAS_BORDER 0x100000000
|
|
#define LTFLF_SOLID_BORDER 0x200000000
|
|
#define LTFLF_BORDER_PLOT 0x400000000
|
|
#define LTFLF_COLLAPSED 0x800000000
|
|
#define LTFLF_CHECKED 0x1000000000
|
|
#define LTFLF_REFRESH_DATA 0x2000000000
|
|
#define LTFLF_DATA_IS_PTR 0x4000000000
|
|
#define LTFLF_HAS_TERMINATOR 0x8000000000
|
|
#define LTFLF_ZERO_BASED 0x10000000000
|
|
#define LTFLF_PASSWORD 0x20000000000
|
|
#define LTFLF_WORD_WRAP 0x40000000000
|
|
#define LTFLF_UNDERLINED 0x80000000000
|
|
#define LTFLF_INVERTED 0x100000000000
|
|
#define LTFLF_BLINK 0x200000000000
|
|
#define LTFLF_SELECTED 0x400000000000
|
|
#define LTFLF_HOLD 0x800000000000
|
|
#define LTFLF_TREE 0x1000000000000
|
|
#define LTFLF_SKIP 0x2000000000000
|
|
#define LTFLF_ALIAS 0x4000000000000
|
|
#define LTFLF_POPUP 0x8000000000000
|
|
#define LTFLF_PAGE_REL_Y 0x10000000000000
|
|
#define LTFLF_MARGIN_REL_X 0x20000000000000
|
|
|
|
#define LTFLf_AUX_STRING 0
|
|
#define LTFLf_LEFT_CB 1
|
|
#define LTFLf_LEFT_EXP 2
|
|
#define LTFLf_LEFT_MACRO 3
|
|
#define LTFLf_LEFT_AUTO 4
|
|
#define LTFLf_RIGHT_CB 5
|
|
#define LTFLf_RIGHT_EXP 6
|
|
#define LTFLf_RIGHT_MACRO 7
|
|
#define LTFLf_RIGHT_AUTO 8
|
|
#define LTFLf_DISPLAY_CB 9
|
|
#define LTFLf_HAS_BIN 10
|
|
#define LTFLf_ESC 11
|
|
#define LTFLf_QUIT 12
|
|
#define LTFLf_LEFT_X 13
|
|
#define LTFLf_CENTER_X 14
|
|
#define LTFLf_RIGHT_X 15
|
|
#define LTFLf_TOP_Y 16
|
|
#define LTFLf_CENTER_Y 17
|
|
#define LTFLf_BOTTOM_Y 18
|
|
#define LTFLf_SHIFTED_X 19
|
|
#define LTFLf_SHIFTED_Y 20
|
|
#define LTFLf_SCROLLING_X 21
|
|
#define LTFLf_SCROLLING_Y 22
|
|
|
|
#define LTFLf_HAS_BORDER 32
|
|
#define LTFLf_SOLID_BORDER 33
|
|
#define LTFLf_BORDER_PLOT 34
|
|
#define LTFLf_COLLAPSED 35
|
|
#define LTFLf_CHECKED 36
|
|
#define LTFLf_REFRESH_DATA 37
|
|
#define LTFLf_DATA_IS_PTR 38
|
|
#define LTFLf_HAS_TERMINATOR 39
|
|
#define LTFLf_ZERO_BASED 40
|
|
#define LTFLf_PASSWORD 41
|
|
#define LTFLf_WORD_WRAP 42
|
|
#define LTFLf_UNDERLINED 43
|
|
#define LTFLf_INVERTED 44
|
|
#define LTFLf_BLINK 45
|
|
#define LTFLf_SELECTED 46
|
|
#define LTFLf_HOLD 47
|
|
#define LTFLf_TREE 48
|
|
#define LTFLf_SKIP 49
|
|
#define LTFLf_ALIAS 50
|
|
#define LTFLf_POPUP 51
|
|
#define LTFLf_PAGE_REL_Y 52
|
|
#define LTFLf_MARGIN_REL_X 53
|
|
|
|
#define LTFBT_GENERIC_DATA 1
|
|
#define LTFBT_ELEMENT_GRAPH 2
|
|
public class LtfBinEntry
|
|
{
|
|
LtfBinEntry *next,*last;
|
|
U0 start;
|
|
U4 type,num,flags,size,use_cnt;
|
|
U1 *data;
|
|
};
|
|
|
|
#define LTF_DEFAULT (-0x7FFFFFFF)
|
|
|
|
public class LtfEntryBase
|
|
{
|
|
LtfEntryBase *next,*last;
|
|
union {
|
|
U4 type;
|
|
U1 btype;
|
|
};
|
|
U8 flags;
|
|
I4 x,y;
|
|
U4 min_col,max_col;
|
|
|
|
//These are here to allow recalculating the Ltf
|
|
//from a point other than the beginning. Without
|
|
//these, you do not know the current state.
|
|
//Margins will change to allow multiple columns
|
|
//of text on the same page. (cursor move back up the page.)
|
|
I4 indent,page_line_num;
|
|
I4 left_margin,right_margin;
|
|
|
|
U1 *user_data;
|
|
};
|
|
|
|
public class LtfEntry
|
|
{
|
|
LtfEntry *next,*last;
|
|
union {
|
|
U4 type;
|
|
U1 btype;
|
|
};
|
|
U8 flags;
|
|
I4 x,y;
|
|
U4 min_col,max_col;
|
|
I4 indent,page_line_num;
|
|
I4 left_margin,right_margin;
|
|
U1 *user_data;
|
|
|
|
U1 *display;
|
|
U1 *plain_text;
|
|
|
|
union {
|
|
I4 attr;
|
|
I4 cursor_x_offset;
|
|
I4 left_cb(U4 *l,U1 *user,LtfEntry *ll);
|
|
I4 left_exp;
|
|
};
|
|
|
|
union {
|
|
I1 *left_macro;
|
|
I1 *song;
|
|
}
|
|
|
|
union {
|
|
I4 cursor_y_offset;
|
|
I4 right_cb(U4 *l,U1 *user,LtfEntry *ll);
|
|
I4 right_exp;
|
|
};
|
|
I1 *right_macro;
|
|
|
|
I1 *display_cb(U4 *l,U1 *user,LtfEntry *ll,
|
|
TssStruct *mem_tss);
|
|
I1 *aux_string;
|
|
U1 *my_format_data;
|
|
U4 scroll_len;
|
|
U4 len;
|
|
U4 bin_num;
|
|
LtfBinEntry *bin_data;
|
|
|
|
U1 *data;
|
|
};
|
|
|
|
class EditFindTextStruct
|
|
{
|
|
I1 find_text[132] fmtstr "$$DA -P 131 \"FIND :%s\"$$\r\n";
|
|
I1 replace_text[132] fmtstr "$$DA -P 131 \"REPLACE:%s\"$$\r\n";
|
|
U4 replace fmtstr "$$CB \"REPLACE\"$$\r\n";
|
|
U4 scan_forward fmtstr "$$CB \"FORWARD\"$$\r\n";
|
|
U4 scan_selected_text fmtstr "$$CB \"SELECTION\"$$\r\n";
|
|
U4 match_case fmtstr "$$CB \"CASE\"$$\r\n";
|
|
U4 whole_labels fmtstr "$$CB \"WHOLE LABELS\"$$\r\n";
|
|
};
|
|
|
|
class EditFileNameStruct
|
|
{
|
|
I1 name[256] fmtstr "$$DA -P 255 \"File Name:%s\"$$";
|
|
};
|
|
|
|
|
|
// LTF header flags
|
|
#define LTFF_OVERSTRIKE 1
|
|
#define LTFF_PLAIN_TEXT 2
|
|
#define LTFF_PLAIN_TEXT_WITH_TABS 4
|
|
#define LTFF_MIN_SIZE 8
|
|
#define LTFF_NO_CURSOR 0x10 // Makes LtfInsertStr remove
|
|
#define LTFF_IN_DOLLAR 0x20
|
|
#define LTFF_STATEMENT_WAS_RUN 0x40
|
|
#define LTFF_WORD_WRAP 0x80
|
|
#define LTFF_UNDERLINED 0x100
|
|
#define LTFF_INVERTED 0x200
|
|
#define LTFF_BLINK 0x400
|
|
#define LTFF_FORM 0x800
|
|
#define LTFF_ATTR_BY_PARTITION 0x1000
|
|
#define LTFF_ATTR_BY_FILENAME 0x2000
|
|
#define LTFF_INHIBIT_LEFT_CLICK 0x4000
|
|
#define LTFF_DOUBLE_DOLLARS 0x8000
|
|
|
|
public class Ltf //Linked Text File header
|
|
{
|
|
LtfEntryBase dummy;
|
|
LtfBinEntry bin_root;
|
|
|
|
U4 flags;
|
|
I4 shifted_x,shifted_y;
|
|
LtfEntry *cur_entry;
|
|
I4 cur_data_col,
|
|
line_start_col,cur_top_line_num;
|
|
I4 x,y,min_x,max_x,min_y,max_y;
|
|
I4 old_window_top,old_window_bottom,
|
|
old_window_left,old_window_right;
|
|
I8 line,col;
|
|
I4 indent,page_line_num,page_length;
|
|
I4 left_margin,right_margin;
|
|
I4 header,footer;
|
|
U4 cmd_I1;
|
|
U4 dollar_buf_size,dollar_buf_ptr;
|
|
U1 *dollar_buf;
|
|
U4 max_entries,ww_lines_back,cur_bin_num;
|
|
LtfEntry *recalc_start;
|
|
EditFindTextStruct *find_replace;
|
|
LtfEntry *base_select,*limit_select;
|
|
Ltf *menu_ltf;
|
|
U4 cur_GrElem,cur_sub_GrElem;
|
|
U4 *tss,*mem_tss;
|
|
U1 text_attribute,link_attribute,
|
|
macro_attribute,anchor_attribute,
|
|
hidden_attribute,tree_attribute,user_attribute,pad1;
|
|
EditFileNameStruct filename;
|
|
U8 file_attr;
|
|
BoolU4 EditPlugIns(Ltf *l,I8 ch,U8 sc);
|
|
U1 *user_data;
|
|
};
|
|
|
|
|
|
class InstructionEntry
|
|
{
|
|
U1 ins_entry_num; //This entry num in opcode hash entry
|
|
U1 opcode_cnt;
|
|
U1 opcode[4],operand_size16,operand_size32,dont_switch_modes;
|
|
U1 plus_opcode,slash_value,opcode_modifier,default;
|
|
U1 arg1,arg2;
|
|
};
|
|
|
|
class OpcodeHashEntry
|
|
{
|
|
SysHashEntry *next;
|
|
I1 *string;
|
|
U4 type,use_cnt; //AHT_OPCODE
|
|
I1 *source_link;
|
|
DbgInfo *debug;
|
|
U1 instruction_entry_cnt;
|
|
U1 reserved[3];
|
|
InstructionEntry ins[1];
|
|
};
|
|
|
|
|
|
#define OM_NO 0
|
|
#define OM_R 1 // Not used
|
|
#define OM_CB 2
|
|
#define OM_CW 3
|
|
#define OM_CD 4
|
|
#define OM_CP 5
|
|
#define OM_IB 6
|
|
#define OM_IW 7
|
|
#define OM_ID 8
|
|
#define OM_RB 9
|
|
#define OM_RW 10
|
|
#define OM_RD 11
|
|
|
|
#define ARGT_NO 0
|
|
#define ARGT_REL8 1
|
|
#define ARGT_REL16 2
|
|
#define ARGT_REL32 3
|
|
|
|
#define ARGT_UIMM8 4
|
|
#define ARGT_UIMM16 5
|
|
#define ARGT_UIMM32 6
|
|
#define ARGT_R8 7
|
|
|
|
#define ARGT_R16 8
|
|
#define ARGT_R32 9
|
|
#define ARGT_IMM8 10
|
|
#define ARGT_IMM16 11
|
|
|
|
#define ARGT_IMM32 12
|
|
#define ARGT_RM8 13
|
|
#define ARGT_RM16 14
|
|
#define ARGT_RM32 15
|
|
|
|
#define ARGT_M8 16 // Not used, needed for LEA, etc
|
|
#define ARGT_M16 17 // Not used
|
|
#define ARGT_M32 18 // Not used
|
|
#define ARGT_M1616 19 // Not used
|
|
|
|
#define ARGT_M1632 20 // Not used
|
|
#define ARGT_M16N32 21 // Not used
|
|
#define ARGT_M16N16 22 // Not used
|
|
#define ARGT_M32N32 23 // Not used
|
|
|
|
#define ARGT_MOFFS8 24
|
|
#define ARGT_MOFFS16 25
|
|
#define ARGT_MOFFS32 26
|
|
#define ARGT_CL 27
|
|
|
|
#define ARGT_AL 28
|
|
#define ARGT_AX 29
|
|
#define ARGT_EAX 30
|
|
#define ARGT_DX 31
|
|
|
|
#define ARGT_SS 32
|
|
#define ARGT_DS 33
|
|
#define ARGT_ES 34
|
|
#define ARGT_FS 35
|
|
|
|
#define ARGT_GS 36
|
|
#define ARGT_SREG 37
|
|
#define ARGT_CS 38
|
|
|
|
|
|
#define ASM_CODE_BLK_BITS 15
|
|
#define ASM_CODE_BLK_SIZE (1<<ASM_CODE_BLK_BITS)
|
|
|
|
|
|
#define LFSF_IS_INCLUDED 1
|
|
#define LFSF_IS_LTF 2
|
|
class LexFileStruct
|
|
{
|
|
I1 *buf;
|
|
I1 *buf_ptr;
|
|
I8 line_num,flags;
|
|
I1 *name;
|
|
I1 *line_start;
|
|
Ltf *l;
|
|
LtfEntry *cur_entry;
|
|
U1 last_I1,pad[3];
|
|
};
|
|
|
|
class LexUndefEntry
|
|
{
|
|
LexUndefEntry *next;
|
|
SysHashEntry *hash;
|
|
};
|
|
|
|
#define ICF_TO_DOUBLE 1
|
|
#define ICF_TO_INT 2
|
|
#define ICF_USE_DOUBLE_TEMPLATE 4
|
|
#define ICF_USE_UNSIGNED_TEMPLATE 8
|
|
#define ICF_NO_PUSHES 16
|
|
#define ICF_NO_PUSHES_TO_DOUBLE_OR_INT 32
|
|
|
|
class IntermediateCode
|
|
{//dup copys $LK,"IC_CODE","FF:::/LT/OSMain/OSINC.ASZ,IC_CODE"$ $LK,"IC_CODE","FF:::/LT/COMPILE/CODE.ASZ,IC_CODE"$
|
|
U4 ic_code;
|
|
U4 ic_flags;
|
|
U8 ic_data;
|
|
ClassStruct *ic_class;
|
|
U4 ic_line;
|
|
};
|
|
|
|
class ParseStack
|
|
{//dup code $LK,"CP_PRSPUSH","FF:::/LT/COMPILE/CODE.ASZ,CP_PRSPUSH"$
|
|
U4 ptr;
|
|
U4 stk[256];
|
|
};
|
|
|
|
#define CB_IC_CNT 2047
|
|
class CodeBlk
|
|
{
|
|
CodeBlk *next;
|
|
IntermediateCode data[CB_IC_CNT];
|
|
};
|
|
|
|
#define CBMT_LABEL 0
|
|
#define CBMT_GOTO_LABEL 1
|
|
#define CBMT_STRING_CONSTANT 2
|
|
#define CBMT_JMP_TABLE 3
|
|
class CbMiscStruct
|
|
{
|
|
CbMiscStruct *next;
|
|
I1 *string;
|
|
U4 type;
|
|
U4 address;
|
|
U8 st_len;
|
|
U4 *jmp_table;
|
|
};
|
|
|
|
class AsmCodeBlk
|
|
{
|
|
AsmCodeBlk *next;
|
|
U1 body[ASM_CODE_BLK_SIZE];
|
|
};
|
|
|
|
class AsmArgStruct
|
|
{
|
|
I4 seg,size,reg1,reg2;
|
|
I4 imm;
|
|
I4 scale;
|
|
I4 absolute_address_cnt;
|
|
BoolU4 indirect,imm_or_off_present,just_seg,reserved;
|
|
LexUndefEntry *undef_local,*undef_glbl;
|
|
U1 *exp;
|
|
};
|
|
|
|
class AsmUnresolvedRef
|
|
{
|
|
AsmUnresolvedRef *next;
|
|
I4 type,line_num;
|
|
U1 *exp;
|
|
U4 ip,rel_ip;
|
|
I1 *string; //Only for import glbls
|
|
LexUndefEntry *undef_hash;
|
|
BoolU4 U1_avail;
|
|
BoolU4 literal; //Only for import glbls
|
|
};
|
|
|
|
#define EIE_REL_EXPORT 0
|
|
#define EIE_LIT_EXPORT 1
|
|
#define EIE_REL_U1 2
|
|
#define EIE_LIT_U1 3
|
|
#define EIE_REL_U2 4
|
|
#define EIE_LIT_U2 5
|
|
#define EIE_REL_U4 6
|
|
#define EIE_LIT_U4 7
|
|
#define EIE_REL_U8 8
|
|
#define EIE_LIT_U8 9
|
|
#define EIE_MAIN 16
|
|
#define EIE_ABSOLUTE_ADDRESS 32
|
|
#define EIE_END 0xFF
|
|
|
|
class ExeImportExportStruct
|
|
{
|
|
ExeImportExportStruct *next;
|
|
U1 type;
|
|
U4 ip;
|
|
I1 *string;
|
|
};
|
|
|
|
class ExeAbsoluteAddressStruct
|
|
{
|
|
ExeAbsoluteAddressStruct *next;
|
|
U1 type;
|
|
U4 ip;
|
|
};
|
|
|
|
class ExeStruct
|
|
{
|
|
U1 *code;
|
|
U4 code_U1s;
|
|
ExeImportExportStruct *ie;
|
|
ExeAbsoluteAddressStruct *absolutes;
|
|
};
|
|
|
|
|
|
#define KW_INCLUDE 0
|
|
#define KW_DEFINE 1
|
|
#define KW_UNION 2
|
|
#define KW_CATCH 3
|
|
#define KW_CLASS 4
|
|
#define KW_TRY 5
|
|
#define KW_IF 6
|
|
#define KW_ELSE 7
|
|
#define KW_FOR 8
|
|
#define KW_WHILE 9
|
|
#define KW_EXTERN 10
|
|
#define KW_LTEXTERN 11
|
|
#define KW_RETURN 12
|
|
#define KW_SIZEOF 13
|
|
#define KW_INTERNAL 14
|
|
#define KW_FMTSTR 15
|
|
#define KW_FMTDATA 16
|
|
#define KW_OUTPUT_FUN 17
|
|
#define KW_INPUT_FUN 18
|
|
#define KW_COUT 19
|
|
#define KW_DO 20
|
|
#define KW_ASM 21
|
|
#define KW_GOTO 22
|
|
#define KW_EXE 23
|
|
#define KW_BREAK 24
|
|
#define KW_CONTINUE 25
|
|
#define KW_SWITCH 26
|
|
#define KW_CASE 27
|
|
#define KW_DEFAULT 28
|
|
#define KW_PUBLIC 29
|
|
#define KW_OFFSET 30
|
|
#define KW_TYPEOF 31
|
|
#define KW_IMPORT 32
|
|
#define KW_LTIMPORT 33
|
|
#define KW_COUTLN 34
|
|
|
|
#define AKW_ALIGN 64
|
|
#define AKW_END 65
|
|
#define AKW_U1 66
|
|
#define AKW_U2 67
|
|
#define AKW_U4 68
|
|
#define AKW_DU1 69
|
|
#define AKW_DU2 70
|
|
#define AKW_DU4 71
|
|
#define AKW_DUP 72
|
|
#define AKW_ORG 73
|
|
#define AKW_STRUC 74
|
|
#define AKW_ENDS 75
|
|
#define AKW_USE16 76
|
|
#define AKW_USE32 77
|
|
#define AKW_IMPORT 78
|
|
#define AKW_EXPORT 79
|
|
#define AKW_INSERT 80
|
|
#define AKW_LIST 81
|
|
#define AKW_NOLIST 82
|
|
#define AKW_INSERT_COMPRESSED 83
|
|
#define AKW_DU8 84
|
|
|
|
#define TK_EOF 0
|
|
#define TK_IDENT 2
|
|
#define TK_STRING 3
|
|
#define TK_INTEGER 6
|
|
#define TK_DOUBLE 7
|
|
|
|
#define TK_PLUS_PLUS 11
|
|
#define TK_MINUS_MINUS 14
|
|
#define TK_DEREFERRENCE 15
|
|
#define TK_DOUBLE_COLON 16
|
|
|
|
#define TK_SHL 17
|
|
#define TK_SHR 18
|
|
|
|
#define TK_EQUAL_EQUAL 19
|
|
#define TK_NOT_EQUAL 20
|
|
#define TK_LESS_EQUAL 21
|
|
#define TK_GREATER_EQUAL 22
|
|
|
|
#define TK_AND_AND 23
|
|
#define TK_OR_OR 24
|
|
#define TK_XOR_XOR 25
|
|
|
|
#define TK_SHL_EQUAL 0x80
|
|
#define TK_SHR_EQUAL 0x81
|
|
#define TK_MUL_EQUAL 0x82
|
|
#define TK_DIV_EQUAL 0x83
|
|
#define TK_AND_EQUAL 0x84
|
|
#define TK_OR_EQUAL 0x85
|
|
#define TK_XOR_EQUAL 0x86
|
|
#define TK_ADD_EQUAL 0x87
|
|
#define TK_SUB_EQUAL 0x88
|
|
#define TK_CAST 0x89
|
|
|
|
#define TK_INSERT_BINARY 0x90
|
|
#define TK_INSERT_BINARY_TYPE 0x91
|
|
#define TK_INSERT_BINARY_SIZE 0x92
|
|
|
|
#define TK_LF 0x0A
|
|
#define TK_CR 0x0D
|
|
#define TK_DOUBLE_QUOTE 0x22
|
|
#define TK_SINGLE_QUOTE 0x27
|
|
#define TK_LEFT_BRACE 0x7B
|
|
#define TK_RIGHT_BRACE 0x7D
|
|
|
|
#define TK_NUM_TK 0xA0
|
|
|
|
//Lex flags
|
|
#define LF_EXPECTING_HEX 1
|
|
#define LF_PROMPT 2
|
|
#define LF_DONT_FREE_BUFFER 4
|
|
#define LF_NO_DEFINES 8
|
|
|
|
//These are assigned by bit number
|
|
#define LFf_PARSE_TRACE 5
|
|
#define LFf_COMPILE_TRACE 6
|
|
#define LFf_ECHO 7
|
|
#define LFf_OPT_TRACE 8
|
|
#define LFf_LEX_TRACE 9
|
|
#define LFf_EXTERNS_TO_IMPORTS 10
|
|
#define LFf_KEEP_PRIVATE 11
|
|
#define LFf_NO_REG_VAR 12
|
|
|
|
#define LF_ECHO (1<<LFf_ECHO)
|
|
#define LF_PARSE_TRACE (1<<LFf_PARSE_TRACE)
|
|
#define LF_NO_REG_OPT 0x00010000
|
|
#define LF_IN_QUOTES 0x00020000
|
|
#define LF_EXE_BLK 0x00040000
|
|
#define LF_HAS_MISC_DATA 0x00080000
|
|
#define LF_STRING2 0x00100000
|
|
#define LF_ASM_EXPRESSIONS 0x00200000
|
|
#define LF_UNRESOLVED_LOCAL 0x00400000
|
|
#define LF_UNRESOLVED_GLBL 0x00800000
|
|
#define LF_FUNCTION 0x01000000
|
|
#define LF_POSTINC 0x02000000
|
|
#define LF_POSTDEC 0x04000000
|
|
#define LF_PREINC 0x08000000
|
|
#define LF_PREDEC 0x10000000
|
|
#define LF_ARRAY 0x20000000
|
|
#define LF_EAX 0x40000000
|
|
#define LF_USE_LAST_I1 0x80000000
|
|
|
|
#define LEX_MAX_IDENT 134
|
|
|
|
#define LFN_CNT 8
|
|
#define LFN_STACK_CNT 32
|
|
|
|
#define ACSF_IN_STRUCT 1
|
|
|
|
class AsmCtrlStruct
|
|
{
|
|
SysHashTable *local_hash,*glbl_hash;
|
|
U4 ip,flags; //instruction ptr
|
|
AsmArgStruct arg1,arg2;
|
|
AsmCodeBlk *code;
|
|
U4 num_code_U1s;
|
|
AsmUnresolvedRef *local_unresolved,*glbl_unresolved;
|
|
ExeAbsoluteAddressStruct *absolutes;
|
|
I4 display_col,last_ip;
|
|
I1 *last_label,*last_line_listed;
|
|
LexFileStruct *last_lfn;
|
|
BoolU4 use16,has_locals,list;
|
|
};
|
|
|
|
class ExeBlkStruct
|
|
{
|
|
ExeBlkStruct *next,*last;
|
|
I1 *body;
|
|
};
|
|
|
|
class LexCbStack
|
|
{
|
|
LexCbStack *cb_next;
|
|
CodeBlk *cb_out_first;
|
|
CodeBlk *cb_out_last;
|
|
IntermediateCode *cb_out_end;
|
|
IntermediateCode *cb_out_ptr;
|
|
IntermediateCode *cb_last_out_ptr;
|
|
CodeBlk *cb_in_first;
|
|
IntermediateCode *cb_in_end;
|
|
IntermediateCode *cb_in_ptr;
|
|
CbMiscStruct *cb_misc_list,*cb_misc_list_end;
|
|
};
|
|
|
|
public class LexStruct
|
|
{
|
|
LexStruct *next,*last;
|
|
I8 token;
|
|
U8 flags;
|
|
I8 cur_i;
|
|
double cur_d;
|
|
I1 *ident;
|
|
I8 ident_len;
|
|
I8 last_I1;
|
|
I8 braces_cnt;
|
|
I8 statement_cnt;
|
|
I8 instruction_pointer; //For asm
|
|
I8 ESI_offset,EDI_offset;
|
|
SysHashTable *define_hash_table;
|
|
SysHashTable *local_hash_table;
|
|
SysHashTable *glbl_hash_table;
|
|
U8 hash_mask;
|
|
SysHashTable *hash_table_list;
|
|
SysHashEntry *hash_entry;
|
|
U8 absolute_address_cnt;
|
|
LexUndefEntry *undef_hash_entry;
|
|
ClassStruct *local_var_list;
|
|
MemberListStruct *local_var_entry;
|
|
I1 *cur_buf_ptr;
|
|
LexFileStruct *cur_lfn;
|
|
I4 stack_ptr;
|
|
ExeBlkStruct *next_exe_blk,*last_exe_blk;
|
|
U8 error_cnt,warning_cnt;
|
|
|
|
LexCbStack cb;
|
|
AsmCtrlStruct *a;
|
|
LexFileStruct lfns[LFN_CNT];
|
|
LexFileStruct stack[LFN_STACK_CNT];
|
|
};
|
|
|
|
#define BLK_SIZE 512
|
|
#define CD_BLK_SIZE 2048
|
|
#define CD_FILE_OFFSET 80
|
|
|
|
#define BOOT_CODE_FLOPPY 1
|
|
#define BOOT_CODE_HARDDRIVE 2
|
|
#define BOOT_CODE_CDROM 3
|
|
#define BOOT_CODE_RAM 4
|
|
|
|
#define LT_XSUM 0xA5CF3796
|
|
#define SOURCE_FILE_MASK "*.CP?;*.HP?;*.AS?;*.AUZ"
|
|
#define C_FILE_MASK "*.CP?;*.HP?;*.AUZ"
|
|
#define ASM_FILE_MASK "*.AS?"
|
|
#define TEXT_FILE_MASK "*.CP?;*.HP?;*.AS?;*.TX?;*.MU?;*.AU?;*.GL?"
|
|
public class MbrPartitionEntry
|
|
{
|
|
U1 active; //0x80=active 0x00=inactive
|
|
U1 start_head;
|
|
U2 start_cyl;
|
|
U1 type;
|
|
U1 end_head;
|
|
U2 end_cyl;
|
|
U4 offset; //Sectors between MBR and first sector
|
|
U4 size; //Sectors in partition
|
|
};
|
|
|
|
public class MasterBootStruct
|
|
{
|
|
U1 boot_code[446];
|
|
MbrPartitionEntry p[4];
|
|
U2 signature; //55AA
|
|
};
|
|
|
|
public class LTBootStruct
|
|
{
|
|
U1 jump_and_nop[3];
|
|
U1 signature; //PT_LT=0x88
|
|
U2 U1s_per_sector;
|
|
U2 sectors_per_cluster;
|
|
U8 sectors;
|
|
U8 root_cluster;
|
|
U4 bitmap_sectors;
|
|
U4 unique_id;
|
|
U1 code[478];
|
|
U2 signature2; //0xAA55
|
|
};
|
|
|
|
public class U2Palindrome
|
|
{
|
|
U2 little,big;
|
|
};
|
|
|
|
public class U4Palindrome
|
|
{
|
|
U4 little,big;
|
|
};
|
|
|
|
class ISODate
|
|
{
|
|
U1 year,mon,day,hour,min,sec,hund;
|
|
};
|
|
|
|
class ISODirEntry
|
|
{
|
|
U1 length;
|
|
U1 ext_attr_length;
|
|
U4Palindrome location;
|
|
U4Palindrome size;
|
|
ISODate date;
|
|
U1 flags;
|
|
U1 file_unit_size;
|
|
U1 interleave;
|
|
U2Palindrome volume_sequence_num;
|
|
U1 name_len;
|
|
U1 name;
|
|
};
|
|
|
|
class ISOPathTableEntry
|
|
{
|
|
U1 name_len;
|
|
U1 zero;
|
|
U4 blk;
|
|
U2 parent_entry_num;
|
|
U2 name[1]; //Aligned to U2 boundries
|
|
};
|
|
|
|
#define ISOT_BOOT_RECORD 0
|
|
#define ISOT_PRIMARY_VOLUME_DESC 1
|
|
#define ISOT_SUPPLEMENTARY_DESC 2
|
|
#define ISOT_VOLUME_PARTRITION_DESC 3
|
|
#define ISOT_TERMINATOR 255
|
|
|
|
public class ISOPrimaryDescriptor
|
|
{
|
|
U1 type;
|
|
I1 id[5];
|
|
U1 version;
|
|
U1 unused1;
|
|
I1 system_id[32];
|
|
I1 volume_id[32];
|
|
U1 unused2[8];
|
|
U4Palindrome volume_space_size;
|
|
U1 unused3[32];
|
|
U2Palindrome volume_set_size;
|
|
U2Palindrome volume_sequence_number;
|
|
U2Palindrome logical_block_size;
|
|
U4Palindrome path_table_size;
|
|
U4 type_l_path_table;
|
|
U1 opt_type_l_path_table[4];
|
|
U1 type_m_path_table[4];
|
|
U1 opt_type_m_path_table[4];
|
|
ISODirEntry root_directory_record;
|
|
I1 volume_set_id[128];
|
|
I1 publisher_id[128];
|
|
I1 preparer_id[128];
|
|
I1 application_id[128];
|
|
I1 copyright_file_id[37];
|
|
I1 abstract_file_id[37];
|
|
I1 bibliographic_file_id[37];
|
|
I1 creation_date[17];
|
|
I1 modification_date[17];
|
|
I1 expiration_date[17];
|
|
I1 effective_date[17];
|
|
U1 file_structure_version;
|
|
U1 unused4;
|
|
U1 application_data[512];
|
|
U1 unused5[653];
|
|
};
|
|
|
|
#define ISO_BASE_YEAR 1900
|
|
|
|
#define LT_BASE_DAY_OF_WEEK 0
|
|
public I8 class LTDate
|
|
{
|
|
U4 time;
|
|
I4 date;
|
|
};
|
|
|
|
public class LTDateStruct
|
|
{
|
|
U2 ten_thousandths;
|
|
U1 hundredths,seconds,minutes,hours,
|
|
day_of_week,day_of_month,month;
|
|
I4 year;
|
|
};
|
|
|
|
#define LT_MAX_FILENAME_LEN 25
|
|
public class LTDirEntry
|
|
{
|
|
LTDirEntry *next,*sub;
|
|
I1 *full_name;
|
|
U1 *user_data;
|
|
|
|
U0 start;
|
|
U2 attr;
|
|
I1 name[LT_MAX_FILENAME_LEN+1];
|
|
U4 xsum;
|
|
U8 cluster;
|
|
U8 size;
|
|
U8 expanded_size;
|
|
LTDate datetime;
|
|
};
|
|
|
|
#define LT_DIR_ENTRY_SIZE (sizeof(LTDirEntry)-offset(LTDirEntry.start))
|
|
|
|
#define LTBDT_NULL 0
|
|
#define LTBDT_RAM 1
|
|
#define LTBDT_FDC 2
|
|
#define LTBDT_ATA 3
|
|
#define LTBDT_ATAPI 4
|
|
#define LTBDT_FILE 5
|
|
|
|
#define LTBDF_REMOVABLE 1
|
|
#define LTBDF_INITIALIZED 2
|
|
#define LTBDF_READ_ONLY 4
|
|
#define LTBDF_READ_ONLY_OVERRIDE 8
|
|
#define LTBDF_HAS_BEEN_RESET 16
|
|
#define LTBDF_READ_CACHE 32
|
|
#define LTBDF_WRITE_CACHE 64
|
|
#define LTBDF_FORMAT 128
|
|
#define LTBDF_INIT_IN_PROGRESS 256
|
|
|
|
public class LTBlkDev
|
|
{
|
|
I1 partition_base,ch_L,ch_B,ch_D;
|
|
U4 type,flags;
|
|
U4 unit;
|
|
U4 base0,base1,irq,dma;
|
|
U4 blk_size;
|
|
U8 offset;
|
|
U8 min_blk,max_blk;
|
|
U1 *RAM_disk;
|
|
I1 *filename;
|
|
U4 *f; //LTFile
|
|
U1 *status;
|
|
U8 last_jiffy;
|
|
U4 max_reads,max_writes;
|
|
U2 read_freq,write_freq;
|
|
};
|
|
|
|
|
|
#define MPEf_LOCKED 0
|
|
#define PT_FAT12 1
|
|
#define PT_FAT32 0xB
|
|
#define PT_ISO9660 32 // arbitrary
|
|
#define PT_LT 0x88
|
|
|
|
public class LTFreeList
|
|
{
|
|
LTFreeList *next,*last;
|
|
U8 start,size;
|
|
};
|
|
|
|
public class LTPartition
|
|
{
|
|
I1 drive,ch_L,ch_P,ch_E;
|
|
U4 type;
|
|
U8 offset;
|
|
U8 size;
|
|
U8 file_system_info_sector;
|
|
U8 MAP1;
|
|
U8 MAP2;
|
|
U8 root_cluster;
|
|
U8 data;
|
|
U4 spc; //sectors_per_cluster
|
|
U4 flags;
|
|
U4 owning_task;
|
|
LTBlkDev *bdev;
|
|
U1 text_attr,pad1,pad2,pad3;
|
|
|
|
U4 num_buffered_MAP_blks;
|
|
U8 cur_MAP_blk_num;
|
|
U4 *cur_MAP_blk;
|
|
U1 *buffered_MAP_dirty_bits;
|
|
LTFreeList *next_free,*last_free;
|
|
|
|
BoolU4 RBlks(LTPartition *p,U1 *buf,U8 blk,U8 cnt);
|
|
BoolU4 WBlks(LTPartition *p,U1 *buf,U8 blk,U8 cnt);
|
|
};
|
|
|
|
#define LTDC_TABLE_SIZE 0x2000
|
|
|
|
public class LTCacheBlk
|
|
{
|
|
LTCacheBlk *next_lru,*last_lru;
|
|
LTCacheBlk *next_hash,*last_hash;
|
|
LTPartition *p;
|
|
U8 blk,flags;
|
|
U1 body[BLK_SIZE];
|
|
};
|
|
|
|
#define EXCEPT_LOCAL 0 // good for narrow scope user handling
|
|
#define EXCEPT_COMPILER 1
|
|
#define EXCEPT_ARITHMETIC 2
|
|
#define EXCEPT_UNDEF_SYSTEXT 3
|
|
#define EXCEPT_UNDEF_EXTERN 4
|
|
#define EXCEPT_FILE 5
|
|
#define EXCEPT_BREAK 6
|
|
#define EXCEPT_ARC_XSUM 7
|
|
#define EXCEPT_FDC 8
|
|
#define EXCEPT_PARTITION 9
|
|
#define EXCEPT_BLKDEV 10
|
|
#define EXCEPT_FLOATING 11
|
|
#define EXCEPT_GRAPHICS 12
|
|
|
|
$LK,"EXCEPT_SYSTEXT","FF:::/LT/OSMain/SYSTEXT.CPZ,ST_EXCEPT"$
|
|
|
|
class ExceptStruct
|
|
{
|
|
ExceptStruct *next,*last;
|
|
U4 handler_start,handler_skip;
|
|
U4 *esp,*ebp,*esi,*edi;
|
|
};
|
|
|
|
class FPUState
|
|
{
|
|
U4 control;
|
|
U4 status;
|
|
U4 tag;
|
|
U4 instruction_pointer;
|
|
U2 ip_selector;
|
|
U2 opcode;
|
|
U4 operand_pointer;
|
|
U2 op_selector;
|
|
U2 reserved;
|
|
U1 stack[8*10];
|
|
};
|
|
|
|
#define LCT_NULL 0
|
|
#define LCT_COMM 1
|
|
|
|
class LTChnl
|
|
{
|
|
U8 type;
|
|
U8 port;
|
|
U8 baud;
|
|
U8 null_msg_jiffy;
|
|
void PutChar(LTChnl *chnl,U1 b);
|
|
U1 GetChar(LTChnl *chnl);
|
|
BoolU4 ScanChar(LTChnl *chnl,U1 *ch);
|
|
};
|
|
|
|
// TSS task flags
|
|
#define TSSf_KILL_TASK 0
|
|
#define TSSf_SUSPENDED 1
|
|
#define TSSf_LOCAL_USER 2
|
|
#define TSSf_PREEMPT 3
|
|
#define TSSf_IDLE 4
|
|
#define TSSf_INPUT_FILTER_TASK 5
|
|
#define TSSf_FILTER_INPUT 6
|
|
#define TSSf_HAS_SONG 7
|
|
|
|
#define CRTf_CURSOR_ON 0
|
|
#define CRTf_WRAP_AROUND 1
|
|
#define CRTf_SHOW 2
|
|
#define CRTf_HAS_MENU 3
|
|
#define CRTf_HAS_CLOSE_WINDOW 4
|
|
#define CRTf_SCROLL_X 5
|
|
#define CRTf_SCROLL_Y 6
|
|
#define CRTf_HAS_BEEN_RESIZED 7
|
|
#define CRTf_SILENT 8
|
|
#define CRTf_NO_DOUBLE_CLICK 9
|
|
#define CRTf_HAS_BEEN_RESIZED2 10
|
|
|
|
//MEM RELATED
|
|
#define PAGE_SIZE 0x200
|
|
#define PAGE_BITS 9
|
|
#define DEFAULT_STACK (PAGE_SIZE*256)
|
|
#define FREE_PAGE_HASH_SIZE 0x100
|
|
|
|
#define MAXIO 0x800
|
|
#define HEAP_HASH_SIZE 1024
|
|
#define TSS_DESC_LENGTH 127
|
|
public class TssStruct
|
|
{
|
|
U4 backlink;
|
|
U4 *esp0;
|
|
U4 ss0;
|
|
U4 *esp1;
|
|
U4 ss1;
|
|
U4 *esp2;
|
|
U4 ss2;
|
|
U4 cr3;
|
|
U1 *eip fmtstr "EIP :%08X";
|
|
U4 eflags fmtstr "EFLAGS:%08X";
|
|
U4 eax fmtstr "EAX :%08X";
|
|
U4 ecx fmtstr "ECX :%08X";
|
|
U4 edx fmtstr "EDX :%08X";
|
|
U4 ebx fmtstr "EBX :%08X";
|
|
U4 *esp fmtstr "ESP :%08X";
|
|
U1 *ebp fmtstr "EBP :%08X";
|
|
U1 *esi fmtstr "ESI :%08X";
|
|
U1 *edi fmtstr "EDI :%08X";
|
|
U4 es;
|
|
U4 cs;
|
|
U4 ss;
|
|
U4 ds;
|
|
U4 fs;
|
|
U4 gs;
|
|
U4 ldtr;
|
|
U2 task_switch_except;
|
|
U2 io_bitmap_ptr;
|
|
U1 io_bitmap[MAXIO/8];
|
|
|
|
I1 task_descriptor[TSS_DESC_LENGTH+1];
|
|
|
|
void update_window();
|
|
U4 *cur_ltf;
|
|
U4 *aux_ltf;
|
|
BoolU4 EditPlugIns(Ltf *l,I8 ch,U8 sc);
|
|
I4 scroll_speed; //For scrolling Sign like text
|
|
I4 crt_width;
|
|
I4 crt_height;
|
|
U1 text_attribute;
|
|
U1 border_attribute;
|
|
U2 unused; //UNUSED
|
|
I4 window_left;
|
|
I4 window_right;
|
|
I4 window_top;
|
|
I4 window_bottom;
|
|
I4 cursor_hor;
|
|
I4 cursor_vert;
|
|
|
|
I4 window_pixel_left; //These are derived
|
|
I4 window_pixel_right;
|
|
I4 window_pixel_top;
|
|
I4 window_pixel_bottom;
|
|
I4 scroll_x,scroll_y;
|
|
U4 crt_flags;
|
|
|
|
TssStruct *absolute_address;
|
|
TssStruct *parent_tss;
|
|
TssStruct *next_tss,*last_tss;
|
|
TssStruct *input_filter_tss;
|
|
TssStruct *next_sibling_tss,*last_sibling_tss;
|
|
TssStruct *next_child_tss,*last_child_tss;
|
|
FPUState fpu;
|
|
I4 window_border_pixel_left; //These are derived
|
|
I4 window_border_pixel_right;
|
|
I4 window_border_pixel_top;
|
|
I4 window_border_pixel_bottom;
|
|
U4 task_flags;
|
|
U4 stack_base;
|
|
MemBlk *next_mem_blk,*last_mem_blk;
|
|
U4 heap_hash[HEAP_HASH_SIZE/4];
|
|
U4 malloc_free_list;
|
|
ExceptStruct *next_except,*last_except;
|
|
U4 except_ebp; //Stores throw routine's EBP
|
|
U4 except_argc;
|
|
I8i *except_argv;
|
|
U4 catch_except;
|
|
SysBpt *bpt_list;
|
|
Ode *next_ode,*last_ode;
|
|
SysHashTable *hash_table;
|
|
SysAccntStruct *account;
|
|
U4 optimization; //does nothing
|
|
|
|
#define MSG_CMD 1
|
|
#define MSG_KEY_DOWN 2
|
|
#define MSG_KEY_UP 3
|
|
#define MSG_IP_MOVE 4
|
|
#define MSG_IP_L_DOWN 5
|
|
#define MSG_IP_L_UP 6
|
|
#define MSG_IP_L_D_DOWN 7
|
|
#define MSG_IP_L_D_UP 8
|
|
#define MSG_IP_R_DOWN 9
|
|
#define MSG_IP_R_UP 10
|
|
#define MSG_IP_R_D_DOWN 11
|
|
#define MSG_IP_R_D_UP 12
|
|
|
|
TssCmdStruct *next_servant_cmd,*last_servant_cmd;
|
|
TssCmdStruct *next_master_cmd,*last_master_cmd;
|
|
LexStruct *next_lex,*last_lex;
|
|
|
|
LTPartition *cur_partition;
|
|
I1 *cur_dir;
|
|
U1 *end_task_cb;
|
|
U4 user_num;
|
|
U8 answers[8];
|
|
double double_answers[8];
|
|
U4 answers_types[8];
|
|
U4 answers_displayed;
|
|
TssStruct *dbg_tss;
|
|
TssStruct *popup_tss;
|
|
LTChnl *rmt_chnl;
|
|
U4 user_aux0;
|
|
U4 user_aux1;
|
|
U4 user_aux2;
|
|
U4 user_aux3;
|
|
};
|
|
|
|
|
|
#define ans (Fs->answers[0])
|
|
#define ans0 (Fs->answers[0])
|
|
#define ans1 (Fs->answers[1])
|
|
#define ans2 (Fs->answers[2])
|
|
#define ans3 (Fs->answers[3])
|
|
#define ans4 (Fs->answers[4])
|
|
#define ans5 (Fs->answers[5])
|
|
#define ans6 (Fs->answers[6])
|
|
#define ans7 (Fs->answers[7])
|
|
|
|
#define ansd (Fs->double_answers[0])
|
|
#define ansd0 (Fs->double_answers[0])
|
|
#define ansd1 (Fs->double_answers[1])
|
|
#define ansd2 (Fs->double_answers[2])
|
|
#define ansd3 (Fs->double_answers[3])
|
|
#define ansd4 (Fs->double_answers[4])
|
|
#define ansd5 (Fs->double_answers[5])
|
|
#define ansd6 (Fs->double_answers[6])
|
|
#define ansd7 (Fs->double_answers[7])
|
|
|
|
public class MachineRegsStruct
|
|
{
|
|
U4
|
|
cr0 fmtstr "CR0 :%08X",
|
|
cr2 fmtstr "CR2 :%08X",
|
|
cr3 fmtstr "CR3 :%08X",
|
|
cr4 fmtstr "CR4 :%08X",
|
|
dbg0 fmtstr "DBG0:%08X",
|
|
dbg1 fmtstr "DBG1:%08X",
|
|
dbg2 fmtstr "DBG2:%08X",
|
|
dbg3 fmtstr "DBG3:%08X",
|
|
dbg6 fmtstr "DBG6:%08X",
|
|
dbg7 fmtstr "DBG7:%08X";
|
|
};
|
|
|
|
#define KEYB_PORT 0x60
|
|
#define KEYB_CTRL 0x64
|
|
|
|
|
|
//SYS_CUR_SCAN_CODE FLAGS
|
|
#define SCf_E0_PREFIX 7
|
|
#define SCf_KEY_UP 8
|
|
#define SCf_SHIFT 9
|
|
#define SCf_CTRL 10
|
|
#define SCf_ALT 11
|
|
#define SCf_CAPS 12
|
|
#define SCf_NUM 13
|
|
#define SCf_SCROLL 14
|
|
#define SCf_NEW_KEY 16
|
|
#define SCf_PRIOR_E0 17
|
|
|
|
#define SCF_E0_PREFIX (1<<SCf_E0_PREFIX)
|
|
#define SCF_KEY_UP (1<<SCf_KEY_UP)
|
|
#define SCF_SHIFT (1<<SCf_SHIFT)
|
|
#define SCF_CTRL (1<<SCf_CTRL)
|
|
#define SCF_ALT (1<<SCf_ALT)
|
|
#define SCF_CAPS (1<<SCf_CAPS)
|
|
#define SCF_NUM (1<<SCf_NUM)
|
|
#define SCF_SCROLL (1<<SCf_SCROLL)
|
|
#define SCF_NEW_KEY (1<<SCf_NEW_KEY)
|
|
#define SCF_PRIOR_E0 (1<<SCf_PRIOR_E0)
|
|
|
|
#define CH_CURSOR 0x05
|
|
#define CH_BACKSPACE 0x08
|
|
#define CH_TAB 0x09
|
|
#define CH_LINE_FEED 0x0A
|
|
#define CH_FORM_FEED 0x0C
|
|
#define CH_CR 0x0D
|
|
#define CH_ESC 27
|
|
#define CH_CTRLQ 0x11
|
|
#define CH_SHIFT_SPACE 31
|
|
#define CH_SPACE 32
|
|
|
|
#define SC_CR 0x1C
|
|
#define SC_SHIFT 0x2A
|
|
#define SC_CTRL 0x1D
|
|
#define SC_ALT 0x38
|
|
#define SC_CAPS 0x3A
|
|
#define SC_NUM 0x45
|
|
#define SC_SCROLL 0x46
|
|
#define SC_CURSOR_UP 0x48
|
|
#define SC_CURSOR_DOWN 0x50
|
|
#define SC_CURSOR_LEFT 0x4B
|
|
#define SC_CURSOR_RIGHT 0x4D
|
|
#define SC_PAGE_UP 0x49
|
|
#define SC_PAGE_DOWN 0x51
|
|
#define SC_HOME 0x47
|
|
#define SC_END 0x4F
|
|
#define SC_INSERT 0x52
|
|
#define SC_DELETE 0x53
|
|
#define SC_F1 0x3B
|
|
#define SC_F2 0x3C
|
|
#define SC_F3 0x3D
|
|
#define SC_F4 0x3E
|
|
#define SC_F5 0x3F
|
|
#define SC_F6 0x40
|
|
#define SC_F7 0x41
|
|
#define SC_F8 0x42
|
|
#define SC_F9 0x43
|
|
#define SC_F10 0x44
|
|
#define SC_F11 0x57
|
|
#define SC_F12 0x58
|
|
#define SC_SCROLL 0x46
|
|
#define SC_GUI 0xDB
|
|
#define SC_PRTSCRN1 0xAA
|
|
#define SC_PRTSCRN2 0xB7
|
|
|
|
//Use these for text
|
|
#define BLACK 0
|
|
#define BLUE 1
|
|
#define GREEN 2
|
|
#define CYAN 3
|
|
#define RED 4
|
|
#define PURPLE 5
|
|
#define BROWN 6
|
|
#define LTGRAY 7
|
|
#define DKGRAY 8
|
|
#define LTBLUE 9
|
|
#define LTGREEN 10
|
|
#define LTCYAN 11
|
|
#define LTRED 12
|
|
#define LTPURPLE 13
|
|
#define YELLOW 14
|
|
#define WHITE 15
|
|
|
|
#define BMF_TRANSFORMATION 1
|
|
#define BMF_LOCATE_NEAREST 2
|
|
#define BMF_DONT_DRAW 4
|
|
#define BMF_ALIAS 8
|
|
#define BMF_SCREEN_BITMAP 16
|
|
|
|
#define BMT_COLOR4 1
|
|
#define BMT_COLOR24 2
|
|
#define BMT_MONO 3
|
|
|
|
class GrBitMap
|
|
{
|
|
U4 type,flags;
|
|
U4 color;
|
|
I4 pen_width;
|
|
GrBitMap *brush;
|
|
|
|
I4 x,y,z; //translation
|
|
I8 *r; //rotation matrix of quads decimal in lo
|
|
|
|
//private
|
|
U4 width,internal_width,height,plane_size;
|
|
I4 left_margin,right_margin,top_margin,bottom_margin;
|
|
|
|
U4 nearest_sub_GrElem;
|
|
U8 nearest_dist;
|
|
U4 cur_sub_GrElem;
|
|
I4 cur_x,cur_y,cur_z;
|
|
|
|
U1 *body;
|
|
};
|
|
|
|
#define GRET_END 0
|
|
#define GRET_UNUSED 1
|
|
#define GRET_COLOR4 2
|
|
#define GRET_COLOR24 3
|
|
#define GRET_POINT 4
|
|
#define GRET_LINE 5
|
|
#define GRET_POLYLINE 6
|
|
#define GRET_POLYPOINT 7
|
|
#define GRET_WIDTH 8
|
|
#define GRET_SHIFT 9
|
|
#define GRET_BSPLINE2 10
|
|
#define GRET_BSPLINE3 11
|
|
#define GRET_BSPLINE2_CLOSED 12
|
|
#define GRET_BSPLINE3_CLOSED 13
|
|
|
|
public class GrElem
|
|
{
|
|
GrElem *next,*last;
|
|
|
|
U0 start;
|
|
U4 type;
|
|
union {
|
|
U1 color4;
|
|
U4 color24;
|
|
I4 x1;
|
|
I4 num;
|
|
I4 width;
|
|
}
|
|
I4 y1,x2,y2;
|
|
};
|
|
|
|
public class GrRect
|
|
{
|
|
I4 minx,maxx,miny,maxy,minz,maxz;
|
|
};
|
|
|
|
//Use these for graphics, since they will change
|
|
//when 24-bit color is implemented
|
|
#define GR_BLACK 0
|
|
#define GR_BLUE 1
|
|
#define GR_GREEN 2
|
|
#define GR_CYAN 3
|
|
#define GR_RED 4
|
|
#define GR_PURPLE 5
|
|
#define GR_BROWN 6
|
|
#define GR_LTGRAY 7
|
|
#define GR_DKGRAY 8
|
|
#define GR_LTBLUE 9
|
|
#define GR_LTGREEN 10
|
|
#define GR_LTCYAN 11
|
|
#define GR_LTRED 12
|
|
#define GR_LTPURPLE 13
|
|
#define GR_YELLOW 14
|
|
#define GR_WHITE 15
|
|
|
|
//Raster operations which get added to 24-bit colors
|
|
#define ROP_EQU 0x00000000
|
|
#define ROP_OR 0x01000000
|
|
#define ROP_NAND 0x02000000
|
|
#define ROP_XOR 0x03000000
|
|
#define ROP_TRANSPARENT 0x04000000
|
|
|
|
#define ROPB_EQU 0x00
|
|
#define ROPB_OR 0x01
|
|
#define ROPB_NAND 0x02
|
|
#define ROPB_XOR 0x03
|
|
#define ROPB_TRANSPARENT 0x04
|
|
|
|
#define VGA_MISC_OUTPUT 0x03c2
|
|
#define VGA_SC_INDEX 0x03c4
|
|
#define VGA_SC_DATA 0x03c5
|
|
#define VGA_PALETTE_INDEX 0x03c8
|
|
#define VGA_PALETTE_DATA 0x03c9
|
|
#define VGA_CRTC_INDEX 0x03d4
|
|
#define VGA_MAP_MASK 0x02
|
|
#define VGA_H_TOTAL 0x00
|
|
#define VGA_H_BLANK_START 0x02
|
|
#define VGA_H_RETRACE_START 0x04
|
|
#define VGA_V_TOTAL 0x06
|
|
#define VGA_MAX_SCAN_LINE 0x09
|
|
#define VGA_V_RETRACE_END 0x11
|
|
#define VGA_OFFSET 0x13
|
|
#define VGA_V_BLANK_START 0x15
|
|
#define VGA_MODE_CONTROL 0x17
|
|
|
|
#define FONT_WIDTH 8
|
|
#define FONT_HEIGHT 8
|
|
#define SCREEN_COLS (grwidth/FONT_WIDTH)
|
|
#define SCREEN_LINES (grheight/FONT_HEIGHT)
|
|
|
|
|
|
|
|
#define ARC_MAX_BITS 12
|
|
#define ARC_MAX_TABLE_ENTRY ((1<<ARC_MAX_BITS)-1)
|
|
|
|
#define CT_NONE 0
|
|
#define CT_7_BIT 1
|
|
#define CT_8_BIT 2
|
|
|
|
class ArcTableEntry
|
|
{
|
|
ArcTableEntry *next;
|
|
U2 basecode;
|
|
U1 ch,pad;
|
|
};
|
|
|
|
public class ArcCs //control structure
|
|
{
|
|
U8 src_size;
|
|
U8 src_pos;
|
|
U1 *src_buf;
|
|
U8 dst_size;
|
|
U8 dst_pos;
|
|
U1 *dst_buf;
|
|
U4 min_bits;
|
|
U4 min_table_entry;
|
|
ArcTableEntry *cur_entry;
|
|
U4 cur_bits_in_use;
|
|
ArcTableEntry *next_entry;
|
|
U4 next_bits_in_use;
|
|
U1 *stack_ptr;
|
|
U1 *stack_base;
|
|
U4 free_index;
|
|
U4 free_limit;
|
|
U4 saved_basecode;
|
|
U4 entry_used;
|
|
U1 last_ch,pad1,pad2,pad3;
|
|
ArcTableEntry compress[ARC_MAX_TABLE_ENTRY+1];
|
|
ArcTableEntry *hash[ARC_MAX_TABLE_ENTRY+1];
|
|
};
|
|
|
|
public class ArcCompressStruct
|
|
{
|
|
U8 compressed_size,
|
|
expanded_size;
|
|
U2 compression_type,flags;
|
|
U1 body[1];
|
|
};
|
|
|
|
// Flags for StringUtil and MStringUtil
|
|
#define SU_DISCARD_PARITY 1
|
|
#define SU_REMOVE_SPACES 2
|
|
#define SU_REMOVE_CTRL_CHARS 4
|
|
#define SU_REMOVE_LEADING 8
|
|
#define SU_SINGLE_SPACE 16
|
|
#define SU_TO_UPPER 32
|
|
#define SU_TO_LOWER 64
|
|
#define SU_REMOVE_TRAILING 128
|
|
#define SU_CAP_UNDERSCORES 0x100
|
|
#define SU_S2T 0x200
|
|
#define SU_T2S 0x400 // Only works with MStringUtil
|
|
#define SU_SAFE_DOLLAR 0x800
|
|
|
|
// Flags for SearchString
|
|
#define SS_IGNORE_CASE 1
|
|
#define SS_WHOLE_LABELS 2
|
|
|
|
//Flags for MatchListEntry
|
|
#define MLE_IGNORE_CASE 1
|
|
#define MLE_EXACT 2
|
|
|
|
#define ISO_ATTR_DIR 2
|
|
|
|
#define LT_ATTR_DIR 0x10
|
|
#define LT_ATTR_ARCHIVE 0x20
|
|
#define LT_ATTR_DELETED 0x100
|
|
#define LT_ATTR_ENCRYPTED 0x200 // not implemented
|
|
#define LT_ATTR_RESIDENT 0x400
|
|
#define LT_ATTR_COMPRESSED 0x800
|
|
#define LT_ATTR_CONTIGUOUS 0x1000
|
|
#define LT_ATTR_FIXED 0x2000
|
|
|
|
public class LTFileAccess
|
|
{
|
|
LTPartition *old_partition,*p;
|
|
I1 *old_dir,*mask;
|
|
};
|
|
|
|
#define LTFB_NEXT_BLK 0xFFFFFFFF
|
|
|
|
#define LTF_WRITE 1
|
|
#define LTF_NEW_FILE 2
|
|
#define LTF_BUF_DIRTY 4
|
|
#define LTF_NEEDS_WRITE 8
|
|
#define LTF_CONTIGUOUS 16
|
|
#define LTF_USE_OLD_DATETIME 32
|
|
|
|
public class LTFile
|
|
{
|
|
U4 flags;
|
|
LTDirEntry de;
|
|
LTPartition *p;
|
|
U4 fblk_num,cluster,file_cluster_num;
|
|
U4 max_blk;
|
|
U4 file_ptr;
|
|
U1 *cluster_buf;
|
|
};
|
|
|
|
//Intermediate compiler codes
|
|
#define EC_NULL 0x000
|
|
#define EC_NOP 0x001
|
|
#define EC_END_EXP 0x002
|
|
|
|
#define EC_ZERO 0x003
|
|
#define EC_U8 0x004
|
|
#define EC_U4 0x005
|
|
#define EC_U2 0x006
|
|
#define EC_U1 0x007
|
|
#define EC_DOUBLE 0x008
|
|
#define EC_STRING_CONSTANT 0x009
|
|
#define EC_EBP 0x00A
|
|
#define EC_FS 0x00B
|
|
#define EC_ESI 0x00C
|
|
#define EC_EDI 0x00D
|
|
|
|
#define EC_TO_DOUBLE 0x00E
|
|
#define EC_TO_INT 0x00F
|
|
|
|
#define EC_COM 0x010
|
|
#define EC_NOT 0x011
|
|
#define EC_UNARY_MINUS 0x012
|
|
#define EC_ADDRESS 0x013
|
|
|
|
#define EC_U8_DISP32 0x014
|
|
#define EC_U4_DISP32 0x015
|
|
#define EC_U2_DISP32 0x016
|
|
#define EC_U1_DISP32 0x017
|
|
#define EC_U8_DISP8 0x018
|
|
#define EC_U4_DISP8 0x019
|
|
#define EC_U2_DISP8 0x01A
|
|
#define EC_U1_DISP8 0x01B
|
|
#define EC_FS_U8_DISP32 0x01C
|
|
#define EC_FS_U4_DISP32 0x01D
|
|
#define EC_FS_U2_DISP32 0x01E
|
|
#define EC_FS_U1_DISP32 0x01F
|
|
#define EC_ESI_U8_DISP32 0x020
|
|
#define EC_ESI_U4_DISP32 0x021
|
|
#define EC_ESI_U2_DISP32 0x022
|
|
#define EC_ESI_U1_DISP32 0x023
|
|
#define EC_ESI_U8_DISP8 0x024
|
|
#define EC_ESI_U4_DISP8 0x025
|
|
#define EC_ESI_U2_DISP8 0x026
|
|
#define EC_ESI_U1_DISP8 0x027
|
|
#define EC_EDI_U8_DISP32 0x028
|
|
#define EC_EDI_U4_DISP32 0x029
|
|
#define EC_EDI_U2_DISP32 0x02A
|
|
#define EC_EDI_U1_DISP32 0x02B
|
|
#define EC_EDI_U8_DISP8 0x02C
|
|
#define EC_EDI_U4_DISP8 0x02D
|
|
#define EC_EDI_U2_DISP8 0x02E
|
|
#define EC_EDI_U1_DISP8 0x02F
|
|
|
|
#define EC_DEREF_U8 0x030
|
|
#define EC_DEREF_U4 0x031
|
|
#define EC_DEREF_U2 0x032
|
|
#define EC_DEREF_U1 0x033
|
|
#define EC_ESI_DEREF_U8 0x034
|
|
#define EC_ESI_DEREF_U4 0x035
|
|
#define EC_ESI_DEREF_U2 0x036
|
|
#define EC_ESI_DEREF_U1 0x037
|
|
#define EC_EDI_DEREF_U8 0x038
|
|
#define EC_EDI_DEREF_U4 0x039
|
|
#define EC_EDI_DEREF_U2 0x03A
|
|
#define EC_EDI_DEREF_U1 0x03B
|
|
#define EC_U8_PP 0x03C
|
|
#define EC_U4_PP 0x03D
|
|
#define EC_U2_PP 0x03E
|
|
#define EC_U1_PP 0x03F
|
|
#define EC_U8_MM 0x040
|
|
#define EC_U4_MM 0x041
|
|
#define EC_U2_MM 0x042
|
|
#define EC_U1_MM 0x043
|
|
#define EC_PP_U8 0x044
|
|
#define EC_PP_U4 0x045
|
|
#define EC_PP_U2 0x046
|
|
#define EC_PP_U1 0x047
|
|
#define EC_MM_U8 0x048
|
|
#define EC_MM_U4 0x049
|
|
#define EC_MM_U2 0x04A
|
|
#define EC_MM_U1 0x04B
|
|
|
|
#define EC_ESI_U4_PP 0x04C
|
|
#define EC_ESI_U4_MM 0x04D
|
|
#define EC_ESI_PP_U4 0x04E
|
|
#define EC_ESI_MM_U4 0x04F
|
|
#define EC_EDI_U4_PP 0x050
|
|
#define EC_EDI_U4_MM 0x051
|
|
#define EC_EDI_PP_U4 0x052
|
|
#define EC_EDI_MM_U4 0x053
|
|
|
|
#define EC_LEA_DISP32_EBP 0x054
|
|
#define EC_LEA_DISP8_EBP 0x055
|
|
|
|
#define EC_U8_DISP32_SCALED 0x056
|
|
#define EC_U4_DISP32_SCALED 0x057
|
|
#define EC_U2_DISP32_SCALED 0x058
|
|
|
|
#define EC_SHL 0x059
|
|
#define EC_SHR 0x05A
|
|
#define EC_SHL_CONSTANT1 0x05B
|
|
#define EC_SHL_CONSTANT2 0x05C
|
|
#define EC_SHR_CONSTANT1 0x05D
|
|
#define EC_SHR_CONSTANT2 0x05E
|
|
|
|
#define EC_POWER 0x05F
|
|
|
|
#define EC_MULTIPLICATION 0x060
|
|
#define EC_DIVISION 0x061
|
|
#define EC_REMAINDER 0x062
|
|
|
|
#define EC_AND 0x063
|
|
|
|
#define EC_OR 0x064
|
|
#define EC_XOR 0x065
|
|
|
|
#define EC_ADDITION 0x066
|
|
#define EC_SUBTRACTION 0x067
|
|
|
|
#define EC_EQUAL_EQUAL 0x068
|
|
#define EC_NOT_EQUAL_TO 0x069
|
|
#define EC_LESS_THAN 0x06A
|
|
#define EC_GREATER_THAN 0x06B
|
|
#define EC_LESS_OR_EQUAL 0x06C
|
|
#define EC_GREATER_OR_EQUAL 0x06D
|
|
|
|
#define EC_AND_AND 0x06E
|
|
|
|
#define EC_OR_OR 0x06F
|
|
#define EC_XOR_XOR 0x070
|
|
|
|
#define EC_COLON 0x071
|
|
#define EC_QUESTION 0x072
|
|
|
|
#define EC_ASSIGN_U8 0x073
|
|
#define EC_ASSIGN_U4 0x074
|
|
#define EC_ASSIGN_U2 0x075
|
|
#define EC_ASSIGN_U1 0x076
|
|
|
|
#define EC_SHL_EQUAL_U8 0x077
|
|
#define EC_SHL_EQUAL_U4 0x078
|
|
#define EC_SHL_EQUAL_U2 0x079
|
|
#define EC_SHL_EQUAL_U1 0x07A
|
|
|
|
#define EC_SHR_EQUAL_U8 0x07B
|
|
#define EC_SHR_EQUAL_U4 0x07C
|
|
#define EC_SHR_EQUAL_U2 0x07D
|
|
#define EC_SHR_EQUAL_U1 0x07E
|
|
|
|
#define EC_MUL_EQUAL_U8 0x07F
|
|
#define EC_MUL_EQUAL_U4 0x080
|
|
#define EC_MUL_EQUAL_U2 0x081
|
|
#define EC_MUL_EQUAL_U1 0x082
|
|
|
|
#define EC_DIV_EQUAL_U8 0x083
|
|
#define EC_DIV_EQUAL_U4 0x084
|
|
#define EC_DIV_EQUAL_U2 0x085
|
|
#define EC_DIV_EQUAL_U1 0x086
|
|
|
|
#define EC_AND_EQUAL_U8 0x087
|
|
#define EC_AND_EQUAL_U4 0x088
|
|
#define EC_AND_EQUAL_U2 0x089
|
|
#define EC_AND_EQUAL_U1 0x08A
|
|
|
|
#define EC_OR_EQUAL_U8 0x08B
|
|
#define EC_OR_EQUAL_U4 0x08C
|
|
#define EC_OR_EQUAL_U2 0x08D
|
|
#define EC_OR_EQUAL_U1 0x08E
|
|
|
|
#define EC_XOR_EQUAL_U8 0x08F
|
|
#define EC_XOR_EQUAL_U4 0x090
|
|
#define EC_XOR_EQUAL_U2 0x091
|
|
#define EC_XOR_EQUAL_U1 0x092
|
|
|
|
#define EC_ADD_EQUAL_U8 0x093
|
|
#define EC_ADD_EQUAL_U4 0x094
|
|
#define EC_ADD_EQUAL_U2 0x095
|
|
#define EC_ADD_EQUAL_U1 0x096
|
|
|
|
#define EC_SUB_EQUAL_U8 0x097
|
|
#define EC_SUB_EQUAL_U4 0x098
|
|
#define EC_SUB_EQUAL_U2 0x099
|
|
#define EC_SUB_EQUAL_U1 0x09A
|
|
|
|
#define EC_ESI_ASSIGN_U4 0x09B
|
|
#define EC_ESI_SHL_EQUAL_U4 0x09C
|
|
#define EC_ESI_SHR_EQUAL_U4 0x09D
|
|
#define EC_ESI_MUL_EQUAL_U4 0x09E
|
|
#define EC_ESI_DIV_EQUAL_U4 0x09F
|
|
#define EC_ESI_AND_EQUAL_U4 0x0A0
|
|
#define EC_ESI_OR_EQUAL_U4 0x0A1
|
|
#define EC_ESI_XOR_EQUAL_U4 0x0A2
|
|
#define EC_ESI_ADD_EQUAL_U4 0x0A3
|
|
#define EC_ESI_SUB_EQUAL_U4 0x0A4
|
|
|
|
#define EC_EDI_ASSIGN_U4 0x0A5
|
|
#define EC_EDI_SHL_EQUAL_U4 0x0A6
|
|
#define EC_EDI_SHR_EQUAL_U4 0x0A7
|
|
#define EC_EDI_MUL_EQUAL_U4 0x0A8
|
|
#define EC_EDI_DIV_EQUAL_U4 0x0A9
|
|
#define EC_EDI_AND_EQUAL_U4 0x0AA
|
|
#define EC_EDI_OR_EQUAL_U4 0x0AB
|
|
#define EC_EDI_XOR_EQUAL_U4 0x0AC
|
|
#define EC_EDI_ADD_EQUAL_U4 0x0AD
|
|
#define EC_EDI_SUB_EQUAL_U4 0x0AE
|
|
|
|
#define EC_ADD64 0x0AF
|
|
#define EC_ADD32 0x0B0
|
|
#define EC_ADD8 0x0B1
|
|
#define EC_INC 0x0B2
|
|
#define EC_SUB64 0x0B3
|
|
#define EC_SUB32 0x0B4
|
|
#define EC_SUB8 0x0B5
|
|
#define EC_DEC 0x0B6
|
|
|
|
#define EC_ENTER 0x0B7
|
|
#define EC_LEAVE 0x0B8
|
|
#define EC_ENTER1 0x0B9
|
|
#define EC_LEAVE1 0x0BA
|
|
#define EC_ENTER2 0x0BB
|
|
#define EC_LEAVE2 0x0BC
|
|
|
|
#define EC_ADD_ESP32 0x0BD
|
|
#define EC_ADD_ESP8 0x0BE
|
|
#define EC_RET 0x0BF
|
|
#define EC_CALL 0x0C0
|
|
#define EC_CALL_INDIRECT 0x0C1
|
|
#define EC_CALL_INDIRECT2 0x0C2
|
|
#define EC_IRQ 0x0C3
|
|
|
|
#define EC_CLI 0x0C4
|
|
#define EC_STI 0x0C5
|
|
#define EC_GET_FLAGS 0x0C6
|
|
#define EC_SET_FLAGS 0x0C7
|
|
#define EC_GET_BASE_PTR 0x0C8
|
|
#define EC_SET_BASE_PTR 0x0C9
|
|
#define EC_GET_STACK_PTR 0x0CA
|
|
#define EC_SET_STACK_PTR 0x0CB
|
|
#define EC_GET_LABEL 0x0CC
|
|
#define EC_ABSOLUTE_ADDRESS 0x0CD
|
|
#define EC_LABEL 0x0CE
|
|
#define EC_TYPE 0x0CF
|
|
|
|
#define EC_BT 0x0D0
|
|
#define EC_BTS 0x0D1
|
|
#define EC_BTR 0x0D2
|
|
#define EC_BTC 0x0D3
|
|
#define EC_BSF 0x0D4
|
|
#define EC_BSR 0x0D5
|
|
#define EC_INSQUE 0x0D6
|
|
#define EC_INSQUE_REV 0x0D7
|
|
#define EC_REMQUE 0x0D8
|
|
#define EC_STRLEN 0x0D9
|
|
#define EC_MEMCPY 0x0DA
|
|
#define EC_MEMSET 0x0DB
|
|
#define EC_INPD 0x0DC
|
|
#define EC_INPW 0x0DD
|
|
#define EC_INP 0x0DE
|
|
#define EC_OUTPD 0x0DF
|
|
#define EC_OUTPW 0x0E0
|
|
#define EC_OUTP 0x0E1
|
|
|
|
#define EC_JMP 0x0E2
|
|
#define EC_SHORT_JMP 0x0E3
|
|
#define EC_SWITCH 0x0E4
|
|
|
|
#define EC_SKIPZ 0x0E5
|
|
#define EC_SKIPZ2 0x0E6
|
|
#define EC_SKIPNZ 0x0E7
|
|
#define EC_SKIPNZ2 0x0E8
|
|
|
|
#define EC_EQUAL_EQUAL_SKIPZ 0x0E9
|
|
#define EC_EQUAL_EQUAL_SKIPZ2 0x0EA
|
|
|
|
#define EC_NOT_EQUAL_TO_SKIPZ 0x0EB
|
|
#define EC_NOT_EQUAL_TO_SKIPZ2 0x0EC
|
|
|
|
#define EC_LESS_THAN_SKIPZ 0x0ED
|
|
#define EC_LESS_THAN_SKIPZ2 0x0EE
|
|
|
|
#define EC_GREATER_THAN_SKIPZ 0x0EF
|
|
#define EC_GREATER_THAN_SKIPZ2 0x0F0
|
|
|
|
#define EC_LESS_OR_EQUAL_SKIPZ 0x0F1
|
|
#define EC_LESS_OR_EQUAL_SKIPZ2 0x0F2
|
|
|
|
#define EC_GREATER_OR_EQUAL_SKIPZ 0x0F3
|
|
#define EC_GREATER_OR_EQUAL_SKIPZ2 0x0F4
|
|
|
|
#define EC_AND_AND_SKIPZ 0x0F5
|
|
#define EC_AND_AND_SKIPZ2 0x0F6
|
|
#define EC_AND_AND_SKIPNZ 0x0F7
|
|
#define EC_AND_AND_SKIPNZ2 0x0F8
|
|
|
|
#define EC_OR_OR_SKIPZ 0x0F9
|
|
#define EC_OR_OR_SKIPZ2 0x0FA
|
|
#define EC_OR_OR_SKIPNZ 0x0FB
|
|
#define EC_OR_OR_SKIPNZ2 0x0FC
|
|
|
|
#define EC_LEA_DISP32_ESI 0x0FD
|
|
#define EC_LEA_DISP8_ESI 0x0FE
|
|
#define EC_LEA_DISP32_EDI 0x0FF
|
|
#define EC_LEA_DISP8_EDI 0x100
|
|
|
|
//Search push_map for how these get used
|
|
#define EC_PUSH_U8 0x101
|
|
#define EC_PUSH_U4 0x102
|
|
#define EC_PUSH_U2 0x103
|
|
#define EC_PUSH_U1 0x104
|
|
#define EC_PUSH_NEG_U4 0x105
|
|
#define EC_PUSH_NEG_U2 0x106
|
|
#define EC_PUSH_NEG_U1 0x107
|
|
#define EC_PUSH_DOUBLE 0x108
|
|
#define EC_PUSH_U8_DISP32 0x109
|
|
#define EC_PUSH_U8_DISP8 0x10A
|
|
#define EC_PUSH_ESI_U8_DISP32 0x10B
|
|
#define EC_PUSH_ESI_U8_DISP8 0x10C
|
|
#define EC_PUSH_EDI_U8_DISP32 0x10D
|
|
#define EC_PUSH_EDI_U8_DISP8 0x10E
|
|
#define EC_PUSH_DEREF_U8 0x10F
|
|
#define EC_PUSH_U8_DISP32_SCALED 0x110
|
|
|
|
#define EC_BT_CONSTANT 0x111
|
|
#define EC_BTS_CONSTANT 0x112
|
|
#define EC_BTR_CONSTANT 0x113
|
|
#define EC_BTC_CONSTANT 0x114
|
|
|
|
#define EC_ESI_NEXT_EQUAL_U4 0x115
|
|
#define EC_EDI_NEXT_EQUAL_U4 0x116
|
|
|
|
#define EC_ADD_EQUAL_U8_CONSTANT_U1 0x117
|
|
#define EC_SUB_EQUAL_U8_CONSTANT_U1 0x118
|
|
#define EC_ADD_EQUAL_U4_CONSTANT_U1 0x119
|
|
#define EC_ESI_ADD_EQUAL_U4_CONSTANT_U1 0x11A
|
|
#define EC_EDI_ADD_EQUAL_U4_CONSTANT_U1 0x11B
|
|
|
|
#define EC_NUM_ENTRIES 0x11C
|
|
|
|
class PasswordStruct
|
|
{
|
|
I1 pw[256] fmtstr "$$DA -P +PW,255 \"Password:%s\"$$";
|
|
};
|
|
|
|
//File util flags
|
|
#define FUf_RECURSE 0
|
|
#define FUf_DIFF 1
|
|
#define FUf_IGNORE 2
|
|
#define FUf_LABEL 3
|
|
#define FUf_QUESTION 4
|
|
#define FUf_ALL 5
|
|
#define FUf_CANCEL 6
|
|
#define FUf_REPLACE 7
|
|
#define FUf_PUBLIC 8
|
|
#define FUf_MAP 9
|
|
#define FUf_JUST_DIRS 10
|
|
|
|
class FlagsStruct
|
|
{
|
|
U8 on;
|
|
U8 off;
|
|
};
|