2460 lines
52 KiB
Plaintext
2460 lines
52 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];
|
|
I2 i2[2];
|
|
U2 u2[2];
|
|
};
|
|
|
|
public I4i union I4
|
|
{
|
|
I1i i1[4];
|
|
U1i u1[4];
|
|
I2 i2[2];
|
|
U2 u2[2];
|
|
};
|
|
|
|
public U8i union U8
|
|
{
|
|
I1i i1[8];
|
|
U1i u1[8];
|
|
I2 i2[4];
|
|
U2 u2[4];
|
|
I4 i4[2];
|
|
U4 u4[2];
|
|
};
|
|
|
|
public I8i union I8
|
|
{
|
|
I1i i1[8];
|
|
U1i u1[8];
|
|
I2 i2[4];
|
|
U2 u2[4];
|
|
I4 i4[2];
|
|
U4 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_BITS 3
|
|
#define INVALID_PTR 0x7FFFFFFF
|
|
#define INVALID_CLUSTER -1
|
|
#define ALL_MASK -1
|
|
|
|
#define OC_NOP 0x90
|
|
|
|
extern class TssStruct;
|
|
extern class Ltf;
|
|
extern class CPUStruct;
|
|
extern class ClassStruct;
|
|
extern class LTFile;
|
|
extern class GrElem;
|
|
|
|
public class Ode
|
|
{
|
|
Ode *next,*last;
|
|
I8 n;
|
|
double base_t;
|
|
double t;
|
|
double h;
|
|
double tolerance_start;
|
|
double tolerance;
|
|
double *state;
|
|
double *internal_state;
|
|
double *DstateDt;
|
|
double *state_scale;
|
|
double *initial_state;
|
|
double *temp0,*temp1,*temp2,*temp3,
|
|
*temp4,*temp5,*temp6,*temp7;
|
|
TssStruct *mem_tss,*win_tss;
|
|
void derivative(Ode *o,double t,double *state,double *DstateDt);
|
|
};
|
|
|
|
public class Order2D3
|
|
{
|
|
double x,y,z,DxDt,DyDt,DzDt;
|
|
};
|
|
|
|
class BinFileHeaderStruct
|
|
{
|
|
U2 jmp;
|
|
U2 type;
|
|
U4 header_offset;
|
|
U4 file_size;
|
|
U4 xsum;
|
|
};
|
|
|
|
//Software Interrupts
|
|
#define I_NMI 0x02
|
|
|
|
#define I_COUT 0x34
|
|
#define I_COUTLN 0x35
|
|
|
|
#define I_UNARY_MINUS 0x40
|
|
#define I_INC 0x41
|
|
#define I_DEC 0x42
|
|
#define I_POWER 0x43
|
|
#define I_MUL 0x44
|
|
#define I_DIV 0x45
|
|
#define I_MOD 0x46
|
|
#define I_ADD 0x47
|
|
#define I_SUB 0x48
|
|
#define I_LESS 0x49
|
|
#define I_GREATER 0x4A
|
|
#define I_LESS_EQUAL 0x4B
|
|
#define I_GREATER_EQUAL 0x4C
|
|
#define I_TO_INT_RAX 0x4D
|
|
#define I_TO_DOUBLE_RAX 0x4E
|
|
#define I_TO_INT_RDX 0x4F
|
|
#define I_TO_DOUBLE_RDX 0x50
|
|
#define I_TO_INT_RCX 0x51
|
|
#define I_TO_DOUBLE_RCX 0x52
|
|
|
|
#define MAXIDT 0x53
|
|
|
|
#define MAXGDT 0x200
|
|
#define SYS_START_CR0 0x0031
|
|
#define SYS_START_RFLAGS 0x0000
|
|
#define SYS_NORMAL_RFLAGS 0x0200
|
|
|
|
class GdtTabStruct
|
|
{
|
|
U4 lo,hi,pad1,pad2;
|
|
};
|
|
|
|
class OsMainStruct
|
|
{
|
|
BinFileHeaderStruct h;
|
|
U4 jmp;
|
|
U4 boot_base;
|
|
U4 header_base;
|
|
U4 os_32start;
|
|
GdtTabStruct gdttab[MAXGDT];
|
|
U4 boot_code;
|
|
U4 sys_memblks; //dbgo investigate if this is accurate
|
|
};
|
|
|
|
#define MP_MAX_PROCESSORS 4
|
|
|
|
class MPMainStruct
|
|
{
|
|
U4 jmp;
|
|
U8 sys_temp_ptr;
|
|
};
|
|
|
|
|
|
#define JIFFY_FREQ 2000 // Hz
|
|
#define LTDATE_FREQ 49710 // Hz
|
|
#define SYS_TIMER_FREQ (18333*65536/1000) //Hz
|
|
|
|
#define SYS_TIMER0_PERIOD (65536*182/10/JIFFY_FREQ)
|
|
|
|
#define CPU_CACHE_LINE_WIDTH 64
|
|
#define SEMA_STRUCT_SIZE CPU_CACHE_LINE_WIDTH
|
|
|
|
class sema
|
|
{
|
|
BoolU4 value;
|
|
U4 pad[CPU_CACHE_LINE_WIDTH/4-1];
|
|
};
|
|
#define NUM_IRQ_SEMAS 32
|
|
|
|
#define SYS_SEMA_CLEAR_SCREEN_TEXT 0
|
|
#define SYS_SEMA_DEBUG 1
|
|
#define SYS_SEMA_RECORD_MACRO 2
|
|
#define SYS_SEMA_NO_SOUND 3
|
|
#define SYS_SEMA_NO_IO_SOUND 4
|
|
#define SYS_SEMA_MEM_BUSY 5
|
|
#define SYS_SEMA_SYS_TIMER 6
|
|
#define SYS_SEMA_SYS_DATE 7
|
|
#define SYS_SEMA_IN_DEBUGGER 8
|
|
#define SYS_SEMA_SOUND 9
|
|
#define SYS_SEMA_HEAPLOG 10
|
|
#define SYS_SEMA_TIMESTAMP 11
|
|
#define SYS_SEMA_KEY_PRESSED 12
|
|
#define NUM_SYS_SEMAS 13
|
|
|
|
#define SYSf_CTRL_ALT_DEL 0
|
|
#define SYSf_CTRL_ALT_C 1
|
|
#define SYSf_CTRL_ALT_ESC 2
|
|
#define SYSf_CTRL_ALT_X 3
|
|
#define SYSf_CTRL_ALT_TAB 4
|
|
|
|
|
|
//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_IRQ0B 11 // SATA
|
|
#define EXT_IRQ0C 12 // Mouse
|
|
#define EXT_IRQ0E 14 // IDE0
|
|
#define EXT_IRQ0F 15 // IDE1
|
|
#define EXT_IRQ00 32 // Timer
|
|
#define EXT_LTF_READ 33
|
|
#define EXT_LTF_WRITE 34
|
|
#define EXT_LTF_NEW 35
|
|
#define EXT_LTF_RESET 36
|
|
#define EXT_LTF_DEL 37
|
|
#define EXT_LTF_RECALC 38
|
|
#define EXT_SPRINTF_JOIN 39
|
|
#define EXT_GETF_JOIN 41
|
|
#define EXT_DEBUG 42
|
|
#define EXT_EXECUTE_FILE 43
|
|
#define EXT_EXECUTE_STR 44
|
|
#define EXT_WIN_TO_TOP 45
|
|
#define EXT_CMP_EXE_BLK 46
|
|
#define EXT_SCAN_KEY 47
|
|
#define EXT_MGETS 48
|
|
#define EXT_DEBUGGER 49
|
|
#define EXT_HEAPLOG_MALLOC 50
|
|
#define EXT_HEAPLOG_FREE 51
|
|
#define EXT_INPUT_FILTER_TASK 52
|
|
#define EXT_FLUSH_MSGS 53
|
|
#define EXT_WALLPAPER 54
|
|
#define EXT_RESUME_DBG 55
|
|
#define EXT_TABLE_SIZE 256
|
|
|
|
|
|
#define FLT_UNDEF_EXTERN 0x100
|
|
|
|
//Hash table types
|
|
#define HTT_INVALID 0
|
|
#define HTT_ALL -1
|
|
#define HTT_STR_CONST 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_DICT_WORD 0x200
|
|
#define HTT_OPCODE 0x400
|
|
#define HTT_R8 0x800
|
|
#define HTT_R16 0x1000
|
|
#define HTT_R32 0x2000
|
|
#define HTT_R64 0x4000
|
|
#define HTT_SEG 0x8000
|
|
#define HTT_SYSTEXT 0x10000
|
|
#define HTT_FILE 0x20000
|
|
#define HTT_MODULE 0x40000
|
|
#define HTT_HELP_FILE 0x80000
|
|
#define HTT_PIC_WORD 0x100000
|
|
|
|
#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;
|
|
void * body[1];
|
|
};
|
|
|
|
public class SysHashEntry
|
|
//Don't forget to change WsHashEntry and asm stuff
|
|
{
|
|
SysHashEntry *next;
|
|
I1 *str;
|
|
U4 type,use_cnt;
|
|
I1 *source_link;
|
|
I1 *index;
|
|
DbgInfo *debug;
|
|
I8 user_data0,user_data1,user_data2;
|
|
};
|
|
|
|
public class PicWordEntry
|
|
{
|
|
SysHashEntry *next;
|
|
I1 *str;
|
|
U4 type,use_cnt;
|
|
I1 *source_link;
|
|
I1 *index;
|
|
DbgInfo *debug;
|
|
GrElem *grelem;
|
|
I8 size,width,height;
|
|
I1 *txt;
|
|
};
|
|
|
|
public class SysHashTable
|
|
{
|
|
SysHashTable *next;
|
|
U8 mask;
|
|
SysHashEntry *body[1]; //SysHashTable is var size
|
|
};
|
|
|
|
public class WsHashEntry
|
|
{
|
|
WsHashEntry *next;
|
|
I1 *word;
|
|
U4 type,use_cnt;
|
|
I1 *source_link;
|
|
I1 *index;
|
|
DbgInfo *debug;
|
|
I4 num;
|
|
U4 hits;
|
|
U2 last_vowel,last_consonant;
|
|
I1 *glossary;
|
|
};
|
|
|
|
public class StrConstStruct
|
|
{
|
|
SysHashEntry *next;
|
|
I1 *str;
|
|
U4 type,use_cnt;
|
|
I1 *source_link;
|
|
I1 *index;
|
|
I1 *data;
|
|
};
|
|
|
|
#define LTFLT_BLINK 0x10000000
|
|
#define LTFLT_INVERT 0x20000000
|
|
#define LTFLT_SELECTED 0x40000000
|
|
#define LTFLT_UNDERLINE 0x80000000
|
|
|
|
#define MLF_DEFAULT_AVAILABLE 1
|
|
#define MLF_FUNCTION 2
|
|
#define MLF_DOT_DOT_DOT 4
|
|
#define MLF_NO_REG_VARIABLE 8
|
|
#define MLF_USE_REG_VARIABLE 16
|
|
#define MLF_NO_UNUSED_WARN 32
|
|
|
|
public class ArrayDimStruct
|
|
{
|
|
ArrayDimStruct *next;
|
|
I8 cnt;
|
|
};
|
|
|
|
public class MemberListStruct
|
|
{
|
|
MemberListStruct *next;
|
|
I1 *str;
|
|
ClassStruct *member_class;
|
|
U4 use_cnt;
|
|
I1 *fmtstr;
|
|
I1 *fmtdata;
|
|
U2 flags;
|
|
U1 parameter_cnt;
|
|
I1 register;
|
|
U4 cnt; //for arrays
|
|
I4 offset;
|
|
ArrayDimStruct *dim_list;
|
|
I8 default_value;
|
|
ClassStruct *return_class;
|
|
};
|
|
|
|
class ExternUsage
|
|
{
|
|
ExternUsage *next;
|
|
I8 ip;
|
|
};
|
|
|
|
#define Cf_INTERNAL 0 // Internal function
|
|
#define Cf_EXTERN 1
|
|
public class ClassStruct //used for classes, functions and internal_data_types
|
|
{
|
|
SysHashEntry *next;
|
|
I1 *str;
|
|
U4 type,use_cnt;
|
|
I1 *source_link;
|
|
I1 *index;
|
|
DbgInfo *debug;
|
|
U2 member_cnt;
|
|
U2 parameter_cnt;
|
|
I4 size;
|
|
MemberListStruct *member_list;
|
|
MemberListStruct *last_in_member_list;
|
|
void *executable_address;
|
|
ClassStruct *return_class;
|
|
U1 ptr_cnt;
|
|
U1 sub_type,flags[2];
|
|
I1 *import_name;
|
|
ExternUsage *ext_list;
|
|
U4 used_reg_mask,trashed_reg_mask;
|
|
};
|
|
|
|
//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_PTR 8
|
|
#define IT_U8 9
|
|
#define IT_DOUBLE 10
|
|
#define IT_UDOUBLE 11 // fictitious placeholder
|
|
#define IT_NUM_IT 12
|
|
|
|
#define IT_MASK 0x0F
|
|
|
|
#define TY_NULL 0x00
|
|
#define TY_IMM 0x10
|
|
#define TY_REG 0x20
|
|
#define TY_DISP 0x30
|
|
#define TY_RIP_DISP32 0x40
|
|
#define TY_STK 0x50
|
|
|
|
#define TY_MASK 0xF0
|
|
|
|
#define GVAF_FUNCTION 1
|
|
#define GVAF_IMPORT 2
|
|
#define GVAF_EXTERN 4
|
|
public class GlblVarStruct
|
|
{
|
|
SysHashEntry *next;
|
|
I1 *str;
|
|
U4 type,use_cnt;
|
|
I1 *source_link;
|
|
I1 *index;
|
|
DbgInfo *debug;
|
|
U2 flags;
|
|
U2 parameter_cnt;
|
|
U4 size; //must be in same spot as in class
|
|
ClassStruct *var_class;
|
|
U4 cnt;
|
|
ArrayDimStruct *dim_list;
|
|
I1 *import_name;
|
|
void *data_address;
|
|
I8 data;
|
|
};
|
|
|
|
#define ARf_FLOODFILL_MSG 0
|
|
|
|
public class SysAccntRegistryStruct
|
|
{
|
|
U1 flags[1024];
|
|
double os_version;
|
|
};
|
|
|
|
public class SysAccntStruct
|
|
{
|
|
SysAccntStruct *next,*last;
|
|
I1 name[32];
|
|
SysAccntRegistryStruct *registry;
|
|
};
|
|
|
|
#define TSSCf_WAKE_MASTER 0
|
|
#define TSSCf_FOCUS_MASTER 1
|
|
#define TSSCf_EXIT_ON_COMPLETE 2
|
|
#define TSSCf_DONT_FILTER 3
|
|
#define TSSCf_HIGHEST_PRIORITY 4
|
|
|
|
#define TSSCT_TEXT_INPUT 0
|
|
#define TSSCT_MSG 1
|
|
#define TSSCT_EXECUTE_STR 2
|
|
#define TSSCT_EXECUTE_FILE 3
|
|
|
|
class TssCmdStruct
|
|
{
|
|
TssCmdStruct *next,*last;
|
|
U8 cmd_code;
|
|
U8 msg_code;
|
|
I8 p1,p2;
|
|
U8 flags;
|
|
I1 *data;
|
|
I8 result;
|
|
TssStruct *master_tss;
|
|
};
|
|
|
|
|
|
#define MPCf_DONE 0
|
|
#define MPCf_DISPATCHED 1
|
|
#define MPCf_FREE_ON_COMPLETE 2
|
|
|
|
#define MPCT_CALL 1
|
|
#define MPCT_SPAWN_TASK 2
|
|
|
|
class MPCmdStruct
|
|
{
|
|
MPCmdStruct *next,*last;
|
|
U8 cmd_code;
|
|
U8 flags;
|
|
void *add;
|
|
I1 *data;
|
|
I8 result;
|
|
};
|
|
|
|
#define MPCCf_LOCKED 0
|
|
|
|
class MPCmdCtrl
|
|
{
|
|
MPCmdStruct *next_waiting,*last_waiting;
|
|
MPCmdStruct *next_done,*last_done;
|
|
U8 flags;
|
|
};
|
|
|
|
#define SBPTf_DISABLE 0
|
|
|
|
#define SBPTF_BPT 2
|
|
class SysBpt
|
|
{
|
|
SysBpt *next;
|
|
void *address;
|
|
U4 flags;
|
|
U1 b;
|
|
};
|
|
|
|
#define MBS_USED_SIGNATURE 0x1020304
|
|
#define MBS_UNUSED_SIGNATURE 0x4030201
|
|
class MemBlk
|
|
{
|
|
MemBlk *next,*last;
|
|
U4 signature;
|
|
U4 pages;
|
|
};
|
|
|
|
class UnusedAllocatedMem
|
|
{
|
|
UnusedAllocatedMem *next;
|
|
U8 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_TOP_LEFT_TOOLBAR 53
|
|
#define LTFT_TOP_RIGHT_TOOLBAR 54
|
|
#define LTFT_PICWORD 55
|
|
#define LTFT_ERROR 56
|
|
|
|
//LtfEntry.flag flags
|
|
#define LTFLF_AUX_STR 1
|
|
#define LTFLF_LINK 2
|
|
#define LTFLF_LEFT_CB 4
|
|
#define LTFLF_LEFT_EXP 8
|
|
#define LTFLF_LEFT_MACRO 0x10
|
|
#define LTFLF_SONG 0x10
|
|
#define LTFLF_LEFT_AUTO 0x20
|
|
#define LTFLF_RIGHT_CB 0x40
|
|
#define LTFLF_RIGHT_EXP 0x80
|
|
#define LTFLF_RIGHT_MACRO 0x100
|
|
#define LTFLF_RIGHT_AUTO 0x200
|
|
#define LTFLF_DISPLAY_CB 0x400
|
|
#define LTFLF_HAS_BIN 0x800
|
|
#define LTFLF_ESC 0x1000
|
|
#define LTFLF_QUIT 0x2000
|
|
#define LTFLF_LEFT_X 0x4000
|
|
#define LTFLF_CENTER_X 0x8000
|
|
#define LTFLF_RIGHT_X 0x10000
|
|
#define LTFLF_TOP_Y 0x20000
|
|
#define LTFLF_CENTER_Y 0x40000
|
|
#define LTFLF_BOTTOM_Y 0x80000
|
|
#define LTFLF_SHIFTED_X 0x100000
|
|
#define LTFLF_SHIFTED_Y 0x200000
|
|
#define LTFLF_SCROLLING_X 0x400000
|
|
#define LTFLF_SCROLLING_Y 0x800000
|
|
#define LTFLF_WIN_REL 0x1000000
|
|
#define LTFLF_WIDTH 0x2000000
|
|
#define LTFLF_HEIGHT 0x4000000
|
|
|
|
#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_WORD_WRAP 0x20000000000
|
|
#define LTFLF_UNDERLINED 0x40000000000
|
|
#define LTFLF_INVERTED 0x80000000000
|
|
#define LTFLF_BLINK 0x100000000000
|
|
#define LTFLF_SELECTED 0x200000000000
|
|
#define LTFLF_HOLD 0x400000000000
|
|
#define LTFLF_TREE 0x800000000000
|
|
#define LTFLF_SKIP 0x1000000000000
|
|
#define LTFLF_ALIAS 0x2000000000000
|
|
#define LTFLF_POPUP 0x4000000000000
|
|
#define LTFLF_PAGE_REL_Y 0x8000000000000
|
|
#define LTFLF_MARGIN_REL_X 0x10000000000000
|
|
#define LTFLF_TOP_LEFT_MENU 0x20000000000000
|
|
#define LTFLF_TOP_RIGHT_MENU 0x40000000000000
|
|
#define LTFLF_FROM_START 0x80000000000000
|
|
|
|
#define LTFLf_AUX_STR 0
|
|
#define LTFLf_LINK 1
|
|
#define LTFLf_LEFT_CB 2
|
|
#define LTFLf_LEFT_EXP 3
|
|
#define LTFLf_LEFT_MACRO 4
|
|
#define LTFLf_LEFT_AUTO 5
|
|
#define LTFLf_RIGHT_CB 6
|
|
#define LTFLf_RIGHT_EXP 7
|
|
#define LTFLf_RIGHT_MACRO 8
|
|
#define LTFLf_RIGHT_AUTO 9
|
|
#define LTFLf_DISPLAY_CB 10
|
|
#define LTFLf_HAS_BIN 11
|
|
#define LTFLf_ESC 12
|
|
#define LTFLf_QUIT 13
|
|
#define LTFLf_LEFT_X 14
|
|
#define LTFLf_CENTER_X 15
|
|
#define LTFLf_RIGHT_X 16
|
|
#define LTFLf_TOP_Y 17
|
|
#define LTFLf_CENTER_Y 18
|
|
#define LTFLf_BOTTOM_Y 19
|
|
#define LTFLf_SHIFTED_X 20
|
|
#define LTFLf_SHIFTED_Y 21
|
|
#define LTFLf_SCROLLING_X 22
|
|
#define LTFLf_SCROLLING_Y 23
|
|
#define LTFLf_WIN_REL 24
|
|
#define LTFLf_WIDTH 25
|
|
#define LTFLf_HEIGHT 26
|
|
|
|
#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_WORD_WRAP 41
|
|
#define LTFLf_UNDERLINED 42
|
|
#define LTFLf_INVERTED 43
|
|
#define LTFLf_BLINK 44
|
|
#define LTFLf_SELECTED 45
|
|
#define LTFLf_HOLD 46
|
|
#define LTFLf_TREE 47
|
|
#define LTFLf_SKIP 48
|
|
#define LTFLf_ALIAS 49
|
|
#define LTFLf_POPUP 50
|
|
#define LTFLf_PAGE_REL_Y 51
|
|
#define LTFLf_MARGIN_REL_X 52
|
|
#define LTFLf_TOP_LEFT_MENU 53
|
|
#define LTFLf_TOP_RIGHT_MENU 54
|
|
#define LTFLf_FROM_START 55
|
|
|
|
#define LTFBT_GENERIC_DATA 1
|
|
#define LTFBT_GRELEM 2
|
|
public class LtfBinEntry
|
|
{
|
|
LtfBinEntry *next,*last;
|
|
U8 temp_use_cnt;
|
|
U0 start;
|
|
U4 type,num,flags,size,use_cnt;
|
|
void *data;
|
|
};
|
|
|
|
#define LTF_DEFAULT MIN_I4
|
|
|
|
public class LtfEntryBase
|
|
{
|
|
//This is a shortened structure for
|
|
//commands like the text command which
|
|
//don't require the full LtfEntry structure.
|
|
LtfEntryBase *next,*last;
|
|
union {
|
|
U1 btype; //this stores the code
|
|
U4 type; //these store attribute flags
|
|
};
|
|
U4 pad;
|
|
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;
|
|
|
|
I8 user_data;
|
|
};
|
|
|
|
public class LtfEntry
|
|
{
|
|
LtfEntry *next,*last;
|
|
union {
|
|
U1 btype; //this stores the code
|
|
U4 type; //these store attribute flags
|
|
};
|
|
U4 pad;
|
|
U8 flags;
|
|
I4 x,y;
|
|
I4 min_col,max_col;
|
|
|
|
// These are stored so we can recalc
|
|
// the document starting in the
|
|
// middle.
|
|
I4 indent,page_line_num;
|
|
I4 left_margin,right_margin;
|
|
I8 user_data;
|
|
|
|
union {
|
|
I1 *display;
|
|
I8 hex_edit_width;
|
|
};
|
|
|
|
union {
|
|
I8 attr;
|
|
I8 cursor_x_offset;
|
|
I8 left_cb(Ltf *l,LtfEntry *ll);
|
|
I8 left_exp;
|
|
};
|
|
|
|
union {
|
|
I1 *left_macro;
|
|
I1 *song;
|
|
}
|
|
|
|
union {
|
|
I8 cursor_y_offset;
|
|
I8 right_cb(Ltf *l,LtfEntry *ll);
|
|
I8 right_exp;
|
|
};
|
|
I1 *right_macro;
|
|
|
|
I1 *display_cb(Ltf *l,LtfEntry *ll,
|
|
TssStruct *mem_tss);
|
|
I1 *aux_str;
|
|
I1 *my_format_data;
|
|
union {
|
|
I4 scroll_len;
|
|
I4 width;
|
|
}
|
|
union {
|
|
I4 len;
|
|
I4 height;
|
|
}
|
|
I4 bin_num;
|
|
I4 pad;
|
|
LtfBinEntry *bin_data;
|
|
|
|
void *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";
|
|
BoolU4 replace fmtstr "$$CB,\"REPLACE\"$$\r\n";
|
|
BoolU4 scan_forward fmtstr "$$CB,\"FORWARD\"$$\r\n";
|
|
BoolU4 scan_selected_text fmtstr "$$CB,\"SELECTION\"$$\r\n";
|
|
BoolU4 match_case fmtstr "$$CB,\"CASE\"$$\r\n";
|
|
BoolU4 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
|
|
#define LTFF_MODIFIED 0x10000
|
|
#define LTFF_BACKWARD_MOVEMENT 0x20000
|
|
#define LTFF_HAS_SONG 0x40000
|
|
#define LTFF_TOP_ENTRY_COPIED 0x80000
|
|
#define LTFF_UNDO_DIRTY 0x100000
|
|
#define LTFF_ALLOW_UNDO 0x200000
|
|
#define LTFF_NO_PICWORDS 0x400000
|
|
#define LTFF_SUPERSCRIPT_MODE 0x800000
|
|
#define LTFF_SUBSCRIPT_MODE 0x1000000
|
|
#define LTFF_DONT_SWAP_OUT 0x2000000
|
|
#define LTFF_DO_FULL_UPDATE 0x4000000
|
|
|
|
#define LTFf_OVERSTRIKE 0
|
|
#define LTFf_PLAIN_TEXT 1
|
|
#define LTFf_PLAIN_TEXT_WITH_TABS 2
|
|
#define LTFf_MIN_SIZE 3
|
|
#define LTFf_NO_CURSOR 4 // Makes LtfInsertStr remove
|
|
#define LTFf_IN_DOLLAR 5
|
|
#define LTFf_STATEMENT_WAS_RUN 6
|
|
#define LTFf_WORD_WRAP 7
|
|
#define LTFf_UNDERLINED 8
|
|
#define LTFf_INVERTED 9
|
|
#define LTFf_BLINK 10
|
|
#define LTFf_FORM 11
|
|
#define LTFf_ATTR_BY_PARTITION 12
|
|
#define LTFf_ATTR_BY_FILENAME 13
|
|
#define LTFf_INHIBIT_LEFT_CLICK 14
|
|
#define LTFf_DOUBLE_DOLLARS 15
|
|
#define LTFf_MODIFIED 16
|
|
#define LTFf_BACKWARD_MOVEMENT 17
|
|
#define LTFf_HAS_SONG 18
|
|
#define LTFf_TOP_ENTRY_COPIED 19
|
|
#define LTFf_UNDO_DIRTY 20
|
|
#define LTFf_ALLOW_UNDO 21
|
|
#define LTFf_NO_PICWORDS 22
|
|
#define LTFf_SUPERSCRIPT_MODE 23
|
|
#define LTFf_SUBSCRIPT_MODE 24
|
|
#define LTFf_DONT_SWAP_OUT 25
|
|
#define LTFf_DO_FULL_UPDATE 26
|
|
|
|
class LtfUndo
|
|
{
|
|
LtfUndo *next,*last;
|
|
U8 size;
|
|
U8 ltf_flags;
|
|
U8 timestamp;
|
|
void *body;
|
|
};
|
|
|
|
public class Ltf //Linked Text File header
|
|
{
|
|
LtfEntryBase dummy;
|
|
I1 *dummy_display;
|
|
LtfBinEntry bin_root;
|
|
LtfUndo undo_root;
|
|
U4 start_text_attribute;
|
|
|
|
U8 w;
|
|
|
|
U8 flags;
|
|
U0 state_start;
|
|
I4 shifted_x,shifted_y;
|
|
I8 left_margin,right_margin;
|
|
I4 indent,page_line_num,page_length;
|
|
I4 header,footer,pad3;
|
|
U1 text_attribute,link_attribute,
|
|
macro_attribute,anchor_attribute,
|
|
hidden_attribute,tree_attribute,
|
|
user_attribute,pad2;
|
|
U0 state_end;
|
|
|
|
U8 top_flags;
|
|
U0 top_line_state_start;
|
|
I4 top_shifted_x,top_shifted_y;
|
|
I8 top_left_margin,top_right_margin;
|
|
I4 top_indent,top_page_line_num,top_page_length;
|
|
I4 top_header,top_footer,top_pad3;
|
|
U1 top_text_attribute,top_link_attribute,
|
|
top_macro_attribute,top_anchor_attribute,
|
|
top_hidden_attribute,top_tree_attribute,
|
|
top_user_attribute,top_pad2;
|
|
U0 top_line_state_end;
|
|
|
|
LtfEntry *cur_entry,*top_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_cur_data_col;
|
|
I8 undo_cnt;
|
|
I8 old_win_top,old_win_bottom,
|
|
old_win_left,old_win_right;
|
|
LtfEntry *old_cur_entry;
|
|
I8 line,col,best_d;
|
|
|
|
I4 cmd_I1,pad4;
|
|
U8 swap_out_time;
|
|
|
|
I4 dollar_buf_size,dollar_buf_ptr;
|
|
I1 *dollar_buf;
|
|
I4 max_entries,ww_lines_back,cur_bin_num,pad1;
|
|
I8 refresh_cnt;
|
|
LtfEntry *recalc_start;
|
|
EditFindTextStruct *find_replace;
|
|
Ltf *menu_ltf;
|
|
GrElem *cur_GrElem;
|
|
I8 cur_sub_grelem;
|
|
TssStruct *win_tss,*mem_tss;
|
|
EditFileNameStruct filename;
|
|
U8 file_attr;
|
|
void LeftClickLink(Ltf *l,LtfEntry *cl,BoolU4 old_preempt);
|
|
void RightClickLink(Ltf *l,LtfEntry *cl,BoolU4 old_preempt);
|
|
I8 user_data;
|
|
};
|
|
|
|
//LtfPopUpFlags
|
|
#define LTFPUF_INTERCEPT_TASK_END 1
|
|
|
|
|
|
|
|
#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;
|
|
I1 last_I1,pad[7];
|
|
};
|
|
|
|
class LexUndefEntry
|
|
{
|
|
LexUndefEntry *next;
|
|
SysHashEntry *hash;
|
|
};
|
|
|
|
#define ICF_R_TO_DOUBLE 0x00000001
|
|
#define ICF_R_TO_INT 0x00000002
|
|
#define ICF_P1_TO_DOUBLE 0x00000004
|
|
#define ICF_P1_TO_INT 0x00000008
|
|
#define ICF_P2_TO_DOUBLE 0x00000010
|
|
#define ICF_P2_TO_INT 0x00000020
|
|
#define ICF_P3_TO_DOUBLE 0x00000040
|
|
#define ICF_P3_TO_INT 0x00000080
|
|
#define ICF_USE_DOUBLE 0x00000100
|
|
#define ICF_USE_UNSIGNED 0x00000200
|
|
#define ICF_USE_INT 0x00000400 //highest priority
|
|
#define ICF_NO_DEPEND_RESULT 0x00000800
|
|
#define ICF_CODE_FINAL 0x00001000
|
|
#define ICF_NOT_ADDRESS 0x00002000
|
|
#define ICF_SHORT_JMP 0x00004000
|
|
#define ICF_P1_FIRST 0x00008000
|
|
#define ICF_PUSH_RESULT 0x00010000
|
|
#define ICF_TRACE 0x00020000
|
|
#define ICF_R_WAS_STK 0x00040000
|
|
#define ICF_P1_WAS_STK 0x00080000
|
|
#define ICF_P2_WAS_STK 0x00100000
|
|
#define ICF_P3_WAS_STK 0x00200000
|
|
#define ICF_PUSH_CMP 0x00400000 //for 50<i<j<=100 expressions
|
|
#define ICF_POP_CMP 0x00800000 //for 50<i<j<=100 expressions
|
|
#define ICF_RCX_CMP 0x01000000 //for 50<i<j<=100 expressions
|
|
#define ICF_RCX_CMP2 0x02000000 //for 50<i<j<=100 expressions
|
|
#define ICF_DEPEND_RESULT 0x04000000
|
|
#define ICF_NO_CVT_MASK 0xFFFFFF00
|
|
|
|
#define IC_BODY_SIZE 64
|
|
|
|
#define ECF_HAS_PUSH_CMP 0x01 //for 50<i<j<=100 expressions
|
|
|
|
|
|
class IcParam
|
|
{
|
|
U1 type,reg,ptype,pad1;
|
|
I8 disp;
|
|
};
|
|
|
|
class IntermediateCode
|
|
{//dup copys $LK,"IC_CODE","FF:::/LT/OSMain/OSDefs.ASZ,IC_CODE"$
|
|
U2 ic_opcode;
|
|
U2 ic_precidence;
|
|
U2 ic_cnt;
|
|
U2 ic_last_cnt;
|
|
|
|
U8 ic_flags;
|
|
I8 ic_data;
|
|
|
|
|
|
ClassStruct *ic_class;
|
|
|
|
U8 ic_line;
|
|
IcParam p1,p2,p3,r;
|
|
|
|
U1 *ic_ext_body;
|
|
U1 ic_body[IC_BODY_SIZE-7*sizeof(void *)];
|
|
|
|
//the following form a union with IC_BODY
|
|
ClassStruct *original_class;
|
|
ClassStruct *p1c,*p2c,*p3c;
|
|
IntermediateCode *p1t,*p2t,*p3t;
|
|
};
|
|
|
|
#assert IC_BODY_SIZE>7*sizeof(void *)
|
|
|
|
class ParseStack
|
|
{//dup code $LK,"CP_PRSPUSH","FF:::/LT/Compiler/CmpAsm.ASZ,CP_PRSPUSH"$
|
|
U8 ptr;
|
|
I8 stk[255];
|
|
};
|
|
|
|
#define CB_IC_CNT 511
|
|
class CodeBlk
|
|
{
|
|
CodeBlk *next;
|
|
IntermediateCode data[CB_IC_CNT];
|
|
};
|
|
|
|
#define CBMT_LABEL 0
|
|
#define CBMT_GOTO_LABEL 1
|
|
#define CBMT_STR_CONST 2
|
|
#define CBMT_JMP_TABLE 3
|
|
|
|
#define CBMF_USED 1
|
|
#define CBMF_POP_CMP 2
|
|
|
|
class CbMiscStruct
|
|
{
|
|
CbMiscStruct *next,*forward;
|
|
I1 *str;
|
|
U4 type,flags;
|
|
void *address;
|
|
U8 st_len;
|
|
void **jmp_table;
|
|
};
|
|
|
|
#define IEF_OP_SIZE16 1
|
|
#define IEF_OP_SIZE32 2
|
|
#define IEF_DONT_SWITCH_MODES 4
|
|
#define IEF_PLUS_OPCODE 8
|
|
#define IEF_DEFAULT 16
|
|
#define IEF_NO_REX 32
|
|
#define IEF_40_REX 64
|
|
#define IEF_48_REX 128
|
|
|
|
#define SV_REGISTER 8
|
|
#define SV_NONE 9
|
|
class InstructionEntry
|
|
{
|
|
U1 ins_entry_num; //This entry num in opcode hash entry
|
|
U1 opcode_cnt;
|
|
U1 opcode[4];
|
|
U1 flags,slash_value,opcode_modifier;
|
|
U1 arg1,arg2;
|
|
U1 pad[5];
|
|
};
|
|
|
|
class OpcodeHashEntry
|
|
{
|
|
SysHashEntry *next;
|
|
I1 *str;
|
|
U4 type,use_cnt; //AHT_OPCODE
|
|
I1 *source_link;
|
|
I1 *index;
|
|
DbgInfo *debug;
|
|
U1 instruction_entry_cnt;
|
|
U1 pad[7];
|
|
InstructionEntry ins[1];
|
|
};
|
|
|
|
#define ASM_CODE_BLK_BITS 16
|
|
#define ASM_CODE_BLK_SIZE (1<<ASM_CODE_BLK_BITS)
|
|
|
|
class AsmCodeBlk
|
|
{
|
|
AsmCodeBlk *next;
|
|
U1 body[ASM_CODE_BLK_SIZE];
|
|
};
|
|
|
|
class AsmArgStruct
|
|
{
|
|
I8 seg,size,reg1,reg2;
|
|
I8 imm;
|
|
I8 scale;
|
|
I8 absolute_address_cnt;
|
|
BoolU4 indirect,imm_or_off_present,just_seg,reserved;
|
|
LexUndefEntry *undef_local,*undef_glbl;
|
|
void *exp;
|
|
};
|
|
|
|
class AsmUnresolvedRef
|
|
{
|
|
AsmUnresolvedRef *next;
|
|
I8 type,line_num;
|
|
void *exp;
|
|
U8 ip,rel_ip;
|
|
I1 *str; //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;
|
|
I8 ip;
|
|
I1 *str;
|
|
U1 type;
|
|
};
|
|
|
|
class ExeAbsoluteAddressStruct
|
|
{
|
|
ExeAbsoluteAddressStruct *next;
|
|
I8 ip;
|
|
U1 type;
|
|
};
|
|
|
|
class ExeStruct
|
|
{
|
|
void *code;
|
|
I8 code_U1s;
|
|
ExeImportExportStruct *ie;
|
|
ExeAbsoluteAddressStruct *absolutes;
|
|
};
|
|
|
|
|
|
#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_UIMM64 7
|
|
|
|
#define ARGT_R8 8
|
|
#define ARGT_R16 9
|
|
#define ARGT_R32 10
|
|
#define ARGT_R64 11
|
|
|
|
#define ARGT_IMM8 12
|
|
#define ARGT_IMM16 13
|
|
#define ARGT_IMM32 14
|
|
#define ARGT_IMM64 15
|
|
|
|
#define ARGT_RM8 16
|
|
#define ARGT_RM16 17
|
|
#define ARGT_RM32 18
|
|
#define ARGT_RM64 19
|
|
|
|
#define ARGT_M8 20 // Not used, needed for LEA, etc
|
|
#define ARGT_M16 21 // Not used
|
|
#define ARGT_M32 22 // Not used
|
|
#define ARGT_M1616 23 // Not used
|
|
|
|
#define ARGT_M1632 24 // Not used
|
|
#define ARGT_M16N32 25 // Not used
|
|
#define ARGT_M16N16 26 // Not used
|
|
#define ARGT_M32N32 27 // Not used
|
|
|
|
#define ARGT_MOFFS8 28
|
|
#define ARGT_MOFFS16 29
|
|
#define ARGT_MOFFS32 30
|
|
#define ARGT_MOFFS64 31
|
|
|
|
#define ARGT_AL 32
|
|
#define ARGT_AX 33
|
|
#define ARGT_EAX 34
|
|
#define ARGT_RAX 35
|
|
|
|
#define ARGT_CL 36
|
|
#define ARGT_DX 37
|
|
|
|
#define ARGT_SREG 39
|
|
|
|
#define ARGT_SS 40
|
|
#define ARGT_DS 41
|
|
#define ARGT_ES 42
|
|
#define ARGT_FS 43
|
|
|
|
#define ARGT_GS 44
|
|
#define ARGT_CS 45
|
|
|
|
#define TK_EOF 0
|
|
#define TK_IDENT 2
|
|
#define TK_STR 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_IF 0x8A
|
|
#define TK_IFDEF 0x8B
|
|
#define TK_IFNDEF 0x8C
|
|
#define TK_ENDIF 0x8D
|
|
#define TK_ELSE 0x8E
|
|
#define TK_MOD_EQUAL 0x8F
|
|
|
|
#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
|
|
#define LF_IN_IF 16
|
|
|
|
//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 LFf_OPT_TRACE_PRESENT 13
|
|
|
|
#define LF_ECHO (1<<LFf_ECHO)
|
|
#define LF_PARSE_TRACE (1<<LFf_PARSE_TRACE)
|
|
#define LF_NOT_CONSTANT 0x00008000
|
|
#define LF_NO_REG_OPT 0x00010000
|
|
#define LF_IN_QUOTES 0x00020000
|
|
#define LF_EXE_BLK 0x00040000
|
|
#define LF_HAS_MISC_DATA 0x00080000
|
|
#define LF_STR2 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_RAX 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;
|
|
I8 ip,flags; //instruction ptr
|
|
AsmArgStruct arg1,arg2;
|
|
AsmCodeBlk *code;
|
|
I8 num_code_U1s;
|
|
AsmUnresolvedRef *local_unresolved,*glbl_unresolved;
|
|
ExeAbsoluteAddressStruct *absolutes;
|
|
I8 display_col,last_ip;
|
|
I1 *last_label,*last_line_listed;
|
|
LexFileStruct *last_lfn;
|
|
I8 seg_size;
|
|
BoolU4 has_locals,list;
|
|
};
|
|
|
|
class ExeBlkStruct
|
|
{
|
|
ExeBlkStruct *next,*last;
|
|
void *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;
|
|
};
|
|
|
|
#define NUM_REGS 16
|
|
#define OPTf_IGNORE_OVERFLOW 0
|
|
|
|
public class LexStruct
|
|
{
|
|
LexStruct *next,*last;
|
|
I8 token;
|
|
U8 flags;
|
|
I8 lag_line_num;
|
|
I8 cur_i;
|
|
double cur_d;
|
|
I1 *ident;
|
|
I8 ident_len;
|
|
I1 *cur_index;
|
|
I8 last_I1;
|
|
I8 braces_cnt;
|
|
I8 statement_cnt;
|
|
I8 instruction_pointer; //For asm
|
|
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;
|
|
CbMiscStruct *leave_label;
|
|
I1 *cur_buf_ptr;
|
|
LexFileStruct *cur_lfn;
|
|
I8 stack_ptr;
|
|
ExeBlkStruct *next_exe_blk,*last_exe_blk;
|
|
U8 opts;
|
|
U8 pass_trace_mask;
|
|
U8 error_cnt,warning_cnt;
|
|
|
|
LexCbStack cb;
|
|
AsmCtrlStruct *a;
|
|
LexFileStruct lfns[LFN_CNT];
|
|
LexFileStruct stack[LFN_STACK_CNT];
|
|
};
|
|
|
|
#define BLK_SIZE_BITS 9
|
|
#define BLK_SIZE (1<<BLK_SIZE_BITS)
|
|
|
|
#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?;*.SP?;*.HP?;*.AP?;*.AS?;*.AUZ"
|
|
#define C_FILE_MASK "*.CP?;*.SP?;*.HP?;*.AP?;*.AUZ"
|
|
#define ASM_FILE_MASK "*.AS?"
|
|
#define TEXT_FILE_MASK "*.CP?;*.HP?;*.SP?;*.AP?;*.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; //AA55
|
|
};
|
|
|
|
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;
|
|
};
|
|
|
|
|
|
//LTDirEntry flags
|
|
#define LTDEF_PROCESSED 1
|
|
#define LTDEF_REMOVABLE 2
|
|
#define LTDEF_NOT_INITIALIZED 4
|
|
|
|
#define LT_MAX_FILENAME_LEN 25
|
|
public class LTDirEntry
|
|
{
|
|
LTDirEntry *next,*parent,*sub;
|
|
I1 *full_name;
|
|
U8 flags;
|
|
I8 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_LT_FILE 5
|
|
#define LTBDT_NON_LT_FILE 6
|
|
|
|
#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;
|
|
|
|
//The following are for LT_FILE partitions
|
|
I1 *filename;
|
|
LTFile *f;
|
|
|
|
//The following are for NON_LT_FILE partitions
|
|
U4 non_lt_drive;
|
|
U8 non_lt_offset;
|
|
|
|
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;
|
|
TssStruct *owning_task;
|
|
LTBlkDev *bdev;
|
|
U1 text_attr,pad1,pad2,pad3;
|
|
|
|
I8 num_buffered_MAP_blks;
|
|
U8 cur_MAP_blk_num;
|
|
void *cur_MAP_blk;
|
|
U1 *buffered_MAP_dirty_bits;
|
|
LTFreeList *next_free,*last_free;
|
|
|
|
BoolU4 RBlks(LTPartition *p,void *buf,U8 blk,U8 cnt);
|
|
BoolU4 WBlks(LTPartition *p,void *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
|
|
#define EXCEPT_SPRINTF 13
|
|
#define EXCEPT_GETF 14
|
|
|
|
$LK,"EXCEPT_SYSTEXT","FF:::/LT/OSMain/SysText.CPZ,ST_EXCEPT"$
|
|
|
|
class ExceptStruct
|
|
{
|
|
ExceptStruct *next,*last;
|
|
U8 handler_start,handler_skip;
|
|
U8 rsp,rbp,rflags;
|
|
U8 rsi,rdi,
|
|
r12,r13,r14,r15;
|
|
};
|
|
|
|
class FPUState
|
|
{
|
|
U4 control;
|
|
U4 status;
|
|
U4 tag;
|
|
U4 instruction_pointer; //TODO: 64-bit?
|
|
U2 ip_selector;
|
|
U2 opcode;
|
|
U4 operand_pointer;
|
|
U2 op_selector;
|
|
U2 reserved;
|
|
U1 stack[8*10];
|
|
U4 pad;
|
|
};
|
|
|
|
#define LCT_NULL 0
|
|
#define LCT_COMM 1
|
|
|
|
class LTChnl
|
|
{
|
|
U8 type;
|
|
U8 port;
|
|
U8 baud;
|
|
U8 pkt_rx_jiffy;
|
|
U8 pkt_tx_jiffy;
|
|
U8 null_msg_jiffy;
|
|
U8 null_msg_cnt;
|
|
U8 tx_size;
|
|
U1 *tx_buf;
|
|
U1 *rx_buf;
|
|
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 TSSf_IS_FAULT_TASK 8
|
|
#define TSSf_NOT_RAW 9
|
|
#define TSSf_DONT_CHANGE_DESC 10
|
|
#define TSSf_DISABLE_BPTS 11
|
|
#define TSSf_AWAITING_MSG 12
|
|
|
|
#define CRTf_CURSOR_ON 0
|
|
#define CRTf_SHOW 1
|
|
#define CRTf_HAS_MENU 2
|
|
#define CRTf_HAS_CLOSE_WIN 3
|
|
#define CRTf_SCROLL_X 4
|
|
#define CRTf_SCROLL_Y 5
|
|
#define CRTf_HAS_BEEN_RESIZED 6
|
|
#define CRTf_SILENT 7
|
|
#define CRTf_NO_DOUBLE_CLICK 8
|
|
#define CRTf_HAS_BEEN_RESIZED2 9
|
|
#define CRTf_ON_TOP 10
|
|
#define CRTf_NO_BORDER 11
|
|
|
|
#define TSSS_IN_QUEUE_SIGNATURE 0x23476542
|
|
|
|
//MEM RELATED
|
|
#define PAGE_SIZE 0x200
|
|
#define PAGE_BITS 9
|
|
#define DEFAULT_STACK (PAGE_SIZE*256)
|
|
#define FREE_PAGE_HASH_SIZE 0x100
|
|
|
|
#define MAXIO 0x10000
|
|
#define HEAP_HASH_SIZE 1024
|
|
#define TSS_DESC_LENGTH 127
|
|
|
|
public class TssStruct $LK+BK,"Redundant Asm Struct","FF:/LT/OSMain/OSDefs.ASZ,TSS_RIP"$
|
|
{
|
|
TssStruct *absolute_address;
|
|
U8 task_flags;
|
|
U8 crt_flags;
|
|
|
|
Ltf *cur_ltf,*aux_ltf;
|
|
I8 win_left;
|
|
I8 win_right;
|
|
I8 win_top;
|
|
I8 win_bottom;
|
|
|
|
LTPartition *cur_partition;
|
|
I1 *cur_dir;
|
|
|
|
TssStruct *parent_tss;
|
|
TssStruct *next_tss,*last_tss;
|
|
TssStruct *next_input_filter_tss,*last_input_filter_tss;
|
|
TssStruct *next_sibling_tss,*last_sibling_tss;
|
|
TssStruct *next_child_tss,*last_child_tss;
|
|
|
|
I8 win_pixel_left; //These are derived
|
|
I8 win_pixel_right;
|
|
I8 win_pixel_top;
|
|
I8 win_pixel_bottom;
|
|
I8 win_border_pixel_left; //These are derived
|
|
I8 win_border_pixel_right;
|
|
I8 win_border_pixel_top;
|
|
I8 win_border_pixel_bottom;
|
|
|
|
U8 rip;
|
|
U8 rflags;
|
|
U8 rax;
|
|
U8 rcx;
|
|
U8 rdx;
|
|
U8 rbx;
|
|
U8 rsp;
|
|
U8 rbp;
|
|
U8 rsi;
|
|
U8 rdi;
|
|
U8 r8;
|
|
U8 r9;
|
|
U8 r10;
|
|
U8 r11;
|
|
U8 r12;
|
|
U8 r13;
|
|
U8 r14;
|
|
U8 r15;
|
|
CPUStruct *gs;
|
|
|
|
UnusedAllocatedMem *heap_hash[HEAP_HASH_SIZE/sizeof(void *)];
|
|
FPUState fpu;
|
|
U8 time_slice_start;
|
|
U8 total_time;
|
|
U8 swap_cnter;
|
|
|
|
void update_win(TssStruct *tss);
|
|
I1 task_descriptor[TSS_DESC_LENGTH+1];
|
|
I1 task_descriptor2[TSS_DESC_LENGTH+1];
|
|
|
|
Ltf *double_buf_cur_ltf,*double_buf_aux_ltf;
|
|
|
|
I4 scroll_speed; //For scrolling Sign like text
|
|
U1 text_attribute;
|
|
U1 border_attribute;
|
|
U2 pad;
|
|
|
|
I8 scroll_x,scroll_y;
|
|
|
|
void *stack_base;
|
|
U8 stack_size,mem_size;
|
|
MemBlk *next_mem_blk,*last_mem_blk;
|
|
void *malloc_free_list;
|
|
ExceptStruct *next_except,*last_except;
|
|
U8 except_rbp; //Stores throw routine's RBP
|
|
U8 except_argc;
|
|
I8 *except_argv;
|
|
BoolU4 catch_except;
|
|
BoolU4 ignore_except;
|
|
SysBpt *bpt_list;
|
|
Ode *next_ode,*last_ode;
|
|
SysHashTable *hash_table;
|
|
SysAccntStruct *account;
|
|
|
|
#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;
|
|
|
|
void *end_task_cb;
|
|
U4 user_num;
|
|
U4 fault_num;
|
|
U8 answers[8];
|
|
double double_answers[8];
|
|
U4 answers_types[8];
|
|
U4 answers_displayed;
|
|
U4 in_queue_signature;
|
|
TssStruct *dbg_tss;
|
|
TssStruct *popup_tss;
|
|
LTChnl *local_chnl;
|
|
LTChnl *rmt_chnl;
|
|
I8 user_data0;
|
|
I8 user_data1;
|
|
I8 user_data2;
|
|
I8 user_data3;
|
|
};
|
|
|
|
class TssStruct2
|
|
{
|
|
U4 res1;
|
|
U8 rsp0,rsp1,rsp2;
|
|
U8 res2;
|
|
U8 ist1,ist2,ist3,ist4,ist5,ist6,ist7;
|
|
U8 res3;
|
|
U2 res2,io_map_offset;
|
|
U1 io_map[MAXIO/8];
|
|
};
|
|
|
|
#define HCf_LOCKED 0
|
|
|
|
class HeapCtrl
|
|
{
|
|
U8 size;
|
|
U8 flags;
|
|
void *malloc_free_list;
|
|
MemBlk *mem_free_list;
|
|
UnusedAllocatedMem *heap_hash[HEAP_HASH_SIZE/sizeof(void *)];
|
|
MemBlk *free_page_hash[FREE_PAGE_HASH_SIZE];
|
|
MemBlk *free_page_hash2[64];
|
|
};
|
|
|
|
#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])
|
|
|
|
#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_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 CH_CTRLA 0x01
|
|
#define CH_CTRLB 0x02
|
|
#define CH_CTRLC 0x03
|
|
#define CH_CTRLD 0x04
|
|
#define CH_CTRLE 0x05
|
|
#define CH_CTRLF 0x06
|
|
#define CH_CTRLG 0x07
|
|
#define CH_CTRLH 0x08
|
|
#define CH_CTRLI 0x09
|
|
#define CH_CTRLJ 0x0A
|
|
#define CH_CTRLK 0x0B
|
|
#define CH_CTRLL 0x0C
|
|
#define CH_CTRLM 0x0D
|
|
#define CH_CTRLN 0x0E
|
|
#define CH_CTRLO 0x0F
|
|
#define CH_CTRLP 0x10
|
|
#define CH_CTRLQ 0x11
|
|
#define CH_CTRLR 0x12
|
|
#define CH_CTRLS 0x13
|
|
#define CH_CTRLT 0x14
|
|
#define CH_CTRLU 0x15
|
|
#define CH_CTRLV 0x16
|
|
#define CH_CTRLW 0x17
|
|
#define CH_CTRLX 0x18
|
|
#define CH_CTRLY 0x19
|
|
#define CH_CTRLZ 0x1A
|
|
|
|
#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 0x1B
|
|
#define CH_SHIFT_SPACE 0x1F
|
|
#define CH_SPACE 0x20
|
|
|
|
#define SC_CR 0x1C
|
|
#define SC_BACKSPACE 0x0E
|
|
#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_PAUSE 0x61
|
|
#define SC_GUI 0xDB
|
|
#define SC_PRTSCRN1 0xAA
|
|
#define SC_PRTSCRN2 0xB7
|
|
|
|
#define FONT_WIDTH 8
|
|
#define FONT_HEIGHT 8
|
|
#define GR_WIDTH 640
|
|
#define GR_HEIGHT 480
|
|
|
|
#define TEXT_COLS (GR_WIDTH/FONT_WIDTH)
|
|
#define TEXT_ROWS (GR_HEIGHT/FONT_HEIGHT)
|
|
|
|
#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 BMF_FILL_NOT_COLOR 32
|
|
|
|
#define BMT_COLOR4 1
|
|
#define BMT_MONO 2
|
|
|
|
#define BMS_SIGNATURE 0x28768922
|
|
class GrBitMap
|
|
{
|
|
U4 type,flags;
|
|
I4 color,bkcolor;
|
|
I4 color2,pen_width;
|
|
GrBitMap *brush;
|
|
|
|
I8 *r; //rotation matrix of quads decimal in lo
|
|
I4 x,y,z,pad2; //translation
|
|
|
|
//private
|
|
I8 plane_size;
|
|
I4 width,internal_width,height,pad3;
|
|
I4 left_margin,right_margin,top_margin,bottom_margin;
|
|
|
|
I8 nearest_sub_grelem;
|
|
U8 nearest_dist;
|
|
I8 cur_sub_grelem;
|
|
I4 cur_x,cur_y,cur_z,pad4;
|
|
double speedline_scale;
|
|
U8 collision_cnt;
|
|
|
|
U4 bitmap_signature,pad5;
|
|
TssStruct *mem_tss,*win_tss;
|
|
void *body;
|
|
};
|
|
|
|
#define GRET_END 0
|
|
#define GRET_COLOR4 2
|
|
#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
|
|
#define GRET_SPEEDLINE 14
|
|
#define GRET_SPEEDLINE_POINT 15
|
|
#define GRET_SPEEDLINE_SPEED 16 //not implemented
|
|
#define GRET_BOX 17
|
|
#define GRET_CIRCLE 18
|
|
#define GRET_FLOOD_FILL_NOT 19
|
|
#define GRET_FLOOD_FILL 20
|
|
#define GRET_BITMAP4 21
|
|
#define GRET_BITMAP4_TRANSPARENT 22
|
|
#define GRET_TEXT 23
|
|
#define GRET_ELLIPSE 24
|
|
|
|
public class GrElem
|
|
{
|
|
GrElem *next,*last;
|
|
|
|
U0 start;
|
|
U4 type;
|
|
union {
|
|
U1 color4;
|
|
I4 x1;
|
|
I4 num;
|
|
I4 width;
|
|
}
|
|
union {
|
|
I4 y1;
|
|
I4 height;
|
|
}
|
|
union {
|
|
I4 x2;
|
|
I1 st[4];
|
|
}
|
|
I4 y2;
|
|
union {
|
|
double linespeed;
|
|
double rot_angle;
|
|
I4 bkcolor;
|
|
}
|
|
};
|
|
|
|
public class GrRect
|
|
{
|
|
I4 minx,maxx,miny,maxy,minz,maxz;
|
|
};
|
|
|
|
//Raster operations which get added colors
|
|
#define ROP_EQU 0x00000000
|
|
#define ROP_OR 0x01000000
|
|
#define ROP_NAND 0x02000000
|
|
#define ROP_XOR 0x03000000
|
|
#define ROP_TRANSPARENT 0x04000000
|
|
#define ROP_COLLISION 0x05000000
|
|
|
|
#define ROPB_EQU 0x00
|
|
#define ROPB_OR 0x01
|
|
#define ROPB_NAND 0x02
|
|
#define ROPB_XOR 0x03
|
|
#define ROPB_TRANSPARENT 0x04
|
|
#define ROPB_COLLISION 0x05
|
|
|
|
#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
|
|
|
|
|
|
class RaxRbxRcxRdx
|
|
{
|
|
U8 rax,rbx,rcx,rdx;
|
|
};
|
|
|
|
|
|
#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;
|
|
U4 pad2;
|
|
};
|
|
|
|
public class ArcCs //control structure
|
|
{
|
|
U8 src_pos;
|
|
U8 src_size;
|
|
U8 dst_pos;
|
|
U8 dst_size;
|
|
U1 *src_buf;
|
|
U1 *dst_buf;
|
|
U8 min_bits;
|
|
U8 min_table_entry;
|
|
ArcTableEntry *cur_entry;
|
|
ArcTableEntry *next_entry;
|
|
U8 cur_bits_in_use;
|
|
U8 next_bits_in_use;
|
|
U1 *stack_ptr;
|
|
U1 *stack_base;
|
|
U8 free_index;
|
|
U8 free_limit;
|
|
U8 saved_basecode;
|
|
U8 entry_used;
|
|
U8 last_ch;
|
|
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 StrUtil and MStrUtil
|
|
#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 MStrUtil
|
|
#define SU_SAFE_DOLLAR 0x800
|
|
|
|
// Flags for SearchStr
|
|
#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
|
|
{
|
|
U8 flags;
|
|
LTDirEntry de;
|
|
LTPartition *p;
|
|
I8 fblk_num,cluster,file_cluster_num;
|
|
I8 max_blk;
|
|
U1 *cluster_buf;
|
|
};
|
|
|
|
//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
|
|
#define FUf_JUST_TEXT_FILES 11
|
|
|
|
#define CPUf_NOT_READY 0
|
|
|
|
class CPUStruct
|
|
{
|
|
void *absolute_address;
|
|
U8 flags;
|
|
U8 num;
|
|
TssStruct *cain_tss;
|
|
U8 tr;
|
|
U8 idle_point_hits;
|
|
double idle_factor;
|
|
U8 swap_cnter;
|
|
U8 startup_rip;
|
|
U8 start_stack[8];
|
|
TssStruct *dying_tss_list;
|
|
HeapCtrl *cpu_heap;
|
|
GrBitMap *grbase;
|
|
};
|
|
|
|
class KeyDevStruct
|
|
{
|
|
KeyDevStruct *next,*last;
|
|
U8 priority;
|
|
BoolU4 PutKey(I8 ch,U8 sc);
|
|
BoolU4 PutS(I1 *st);
|
|
};
|
|
|
|
#define CREG_RAX 0
|
|
#define CREG_RCX 1
|
|
#define CREG_RDX 2
|
|
#define CREG_RBX 3
|
|
#define CREG_RSP 4
|
|
#define CREG_RBP 5
|
|
#define CREG_RSI 6
|
|
#define CREG_RDI 7
|
|
#define CREG_RIP 16 //Used by compiler, not really it's number
|
|
|
|
#define CALWAYS_TRASHED_MASK 0x003F
|
|
#define CSTK_TEMPS_MASK 0x0F00
|
|
#define CREG_VARS_MASK 0xC0C0
|
|
#define CREG_NON_PTR_MASK 0x3000
|
|
|
|
#define PUSH_REGS PUSH RAX PUSH RCX PUSH RDX PUSH RBX PUSH RBP PUSH RSI PUSH RDI PUSH R8 PUSH R9 PUSH R10 PUSH R11 PUSH R12 PUSH R13 PUSH R14 PUSH R15
|
|
#define POP_REGS POP R15 POP R14 POP R13 POP R12 POP R11 POP R10 POP R9 POP R8 POP RDI POP RSI POP RBP POP RBX POP RDX POP RCX POP RAX
|
|
|
|
#define PUSH_C_REGS PUSH RAX PUSH RCX PUSH RDX PUSH RBX PUSH RBP PUSH R8 PUSH R9 PUSH R10 PUSH R11
|
|
#define POP_C_REGS POP R11 POP R10 POP R9 POP R8 POP RBP POP RBX POP RDX POP RCX POP RAX
|
|
|
|
#define NUM_PML1 1
|
|
#define NUM_PML2 128
|
|
#define NUM_PML3 1
|
|
#define NUM_PML4 1
|
|
|
|
#define ST_ERROR "$$FG,LTRED$$$$BK,1$$ERROR:$$FG$$$$BK,0$$ "
|
|
#define ST_WARNING "$$FG,RED$$$$BK,1$$WARNING:$$FG$$$$BK,0$$ "
|
|
|
|
public class U1Fifo
|
|
{
|
|
U1 *buf;
|
|
U8 mask,in_ptr,out_ptr;
|
|
TssStruct *mem_tss;
|
|
};
|
|
|
|
public class U8Fifo
|
|
{
|
|
U8 *buf;
|
|
U8 mask,in_ptr,out_ptr;
|
|
TssStruct *mem_tss;
|
|
};
|
|
|