OSDN Git Service

svn rev.329より移動。
[chnosproject/CHNOSProject.git] / CHNOSProject / chnos / tolset_chn_000 / chnos_010 / chnos / coredef1.h
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/coredef1.h b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/coredef1.h
new file mode 100644 (file)
index 0000000..4af4ad6
--- /dev/null
@@ -0,0 +1,680 @@
+\r
+/*\83V\83X\83e\83\80\83f\81[\83^\8c^\90é\8c¾*/\r
+\r
+/*new object types*/\r
+//typedef enum _bool { false, true} bool;\r
+typedef unsigned char bool;\r
+typedef unsigned char uchar;\r
+typedef unsigned short ushort;\r
+typedef unsigned int uint;\r
+typedef enum _col_text { black, blue, green, skyblue, red, purple, brown, white} col_text;\r
+typedef unsigned char sector[512];\r
+\r
+/*structs*/\r
+/*CPU structs*/\r
+typedef union CPU_CONTROL_REGISTER0 {\r
+       uint cr0;\r
+       struct CPU_CONTROL_REGISTER0_BIT {\r
+               unsigned PE : 1;\r
+               unsigned MP : 1;\r
+               unsigned EM : 1;\r
+               unsigned TS : 1;\r
+               unsigned ET : 1;\r
+               unsigned NE : 1;\r
+               unsigned bit6 : 1;\r
+               unsigned bit7 : 1;\r
+               unsigned bit8 : 1;\r
+               unsigned bit9 : 1;\r
+               unsigned bit10 : 1;\r
+               unsigned bit11 : 1;\r
+               unsigned bit12 : 1;\r
+               unsigned bit13 : 1;\r
+               unsigned bit14 : 1;\r
+               unsigned bit15 : 1;\r
+               unsigned WP : 1;\r
+               unsigned bit17 : 1;\r
+               unsigned AM : 1;\r
+               unsigned bit19 : 1;\r
+               unsigned bit20 : 1;\r
+               unsigned bit21 : 1;\r
+               unsigned bit22 : 1;\r
+               unsigned bit23 : 1;\r
+               unsigned bit24 : 1;\r
+               unsigned bit25 : 1;\r
+               unsigned bit26 : 1;\r
+               unsigned bit27 : 1;\r
+               unsigned bit28 : 1;\r
+               unsigned NW : 1;\r
+               unsigned CD : 1;\r
+               unsigned PG : 1;\r
+       } bit;\r
+} CPU_ControlRegister0;\r
+\r
+typedef union CPU_CONTROL_REGISTER3 {\r
+       uint cr3;\r
+       struct CPU_CONTROL_REGISTER3_BIT {\r
+               unsigned bit0 : 1;\r
+               unsigned bit1 : 1;\r
+               unsigned bit2 : 1;\r
+               unsigned PWT : 1;\r
+               unsigned PCD : 1;\r
+               unsigned bit5 : 1;\r
+               unsigned bit6 : 1;\r
+               unsigned bit7 : 1;\r
+               unsigned bit8 : 1;\r
+               unsigned bit9 : 1;\r
+               unsigned bit10 : 1;\r
+               unsigned bit11 : 1;\r
+               unsigned PDB : 20;\r
+       } bit;\r
+} CPU_ControlRegister3;\r
+\r
+typedef union CPU_CONTROL_REGISTER4 {\r
+       uint cr4;\r
+       struct CPU_CONTROL_REGISTER4_BIT {\r
+               unsigned VME : 1;\r
+               unsigned PVI : 1;\r
+               unsigned TSD : 1;\r
+               unsigned DE : 1;\r
+               unsigned PSE : 1;\r
+               unsigned PAE : 1;\r
+               unsigned MCE : 1;\r
+               unsigned PGE : 1;\r
+               unsigned PCE : 1;\r
+               unsigned OSFXSR : 1;\r
+               unsigned OSXMMEXCPT : 1;\r
+               unsigned bit11 : 1;\r
+               unsigned bit12 : 1;\r
+               unsigned VMXE : 1;\r
+               unsigned SMXE : 1;\r
+               unsigned bit15 : 1;\r
+               unsigned bit16 : 1;\r
+               unsigned PCIDE : 1;\r
+               unsigned OSXSAVE : 1;\r
+               unsigned bit19 : 1;\r
+               unsigned SMEP : 1;\r
+               unsigned bit21 : 1;\r
+               unsigned bit22 : 1;\r
+               unsigned bit23 : 1;\r
+               unsigned bit24 : 1;\r
+               unsigned bit25 : 1;\r
+               unsigned bit26 : 1;\r
+               unsigned bit27 : 1;\r
+               unsigned bit28 : 1;\r
+               unsigned bit29 : 1;\r
+               unsigned bit30 : 1;\r
+               unsigned bit31 : 1;\r
+       } bit;\r
+} CPU_ControlRegister4;\r
+\r
+typedef union CPU_DEBUG_REGISTER6 {\r
+       uint dr6;\r
+       struct CPU_DEBUG_REGISTER6_BIT {\r
+               unsigned B0 : 1;\r
+               unsigned B1 : 1;\r
+               unsigned B2 : 1;\r
+               unsigned B3 : 1;\r
+               unsigned bit4_11 : 8;   //1\r
+               unsigned bit12 : 1;     //0\r
+               unsigned BD : 1;\r
+               unsigned BS : 1;\r
+               unsigned BT : 1;\r
+               unsigned bit16_31 : 16;\r
+       } bit;\r
+} CPU_DebugRegister6;\r
+\r
+typedef union CPU_DEBUG_REGISTER7 {\r
+       uint dr7;\r
+       struct CPU_DEBUG_REGISTER7_BIT {\r
+               unsigned L0 : 1;\r
+               unsigned G0 : 1;\r
+               unsigned L1 : 1;\r
+               unsigned G1 : 1;\r
+               unsigned L2 : 1;\r
+               unsigned G2 : 1;\r
+               unsigned L3 : 1;\r
+               unsigned G3 : 1;\r
+               unsigned LE : 1;        //must be 1\r
+               unsigned GE : 1;        //must be 1\r
+               unsigned bit10 : 1;     //1\r
+               unsigned bit11 : 1;     //0\r
+               unsigned bit12 : 1;     //0\r
+               unsigned GD : 1;\r
+               unsigned bit14 : 1;     //0\r
+               unsigned bit15 : 1;     //0\r
+               unsigned RW0 : 2;\r
+               unsigned LEN0 : 2;\r
+               unsigned RW1 : 2;\r
+               unsigned LEN1 : 2;\r
+               unsigned RW2 : 2;\r
+               unsigned LEN2 : 2;\r
+               unsigned RW3 : 2;\r
+               unsigned LEN3 : 2;\r
+       } bit;\r
+} CPU_DebugRegister7;\r
+\r
+typedef union CPU_EFLAGS {\r
+       uint eflags;\r
+       struct CPU_EFLAGS_BIT {\r
+               unsigned CF : 1;\r
+               unsigned bit1 : 1;      //\8fí\82ÉTrue\81A\82±\82ê\88È\8aO\82Ì\97\\96ñ\8dÏ\82Ý\83r\83b\83g\82Í\8fí\82ÉFalse\r
+               unsigned PF : 1;\r
+               unsigned bit3 : 1;\r
+               unsigned AF : 1;\r
+               unsigned bit5 : 1;\r
+               unsigned ZF : 1;\r
+               unsigned SF : 1;\r
+               unsigned TF : 1;\r
+               unsigned IF : 1;\r
+               unsigned DF : 1;\r
+               unsigned OF : 1;\r
+               unsigned IOPL : 2;\r
+               unsigned NT : 1;\r
+               unsigned bit15 : 1;\r
+               unsigned RF : 1;\r
+               unsigned VM : 1;\r
+               unsigned AC : 1;\r
+               unsigned VIF : 1;\r
+               unsigned VIP : 1;\r
+               unsigned ID : 1;\r
+               unsigned bit22 : 1;\r
+               unsigned bit23 : 1;\r
+               unsigned bit24 : 1;\r
+               unsigned bit25 : 1;\r
+               unsigned bit26 : 1;\r
+               unsigned bit27 : 1;\r
+               unsigned bit28 : 1;\r
+               unsigned bit29 : 1;\r
+               unsigned bit30 : 1;\r
+               unsigned bit31 : 1;\r
+       } bit;\r
+} CPU_EFlags;\r
+\r
+typedef struct TASK_STATE_SEGMENT {\r
+       ushort backlink, reserve00;\r
+       uint esp0;\r
+       ushort ss0, reserve01;\r
+       uint esp1;\r
+       ushort ss1, reserve02;\r
+       uint esp2;\r
+       ushort ss2, reserve03;\r
+       uint cr3;\r
+       uint eip;\r
+       CPU_EFlags eflags;\r
+       uint eax;\r
+       uint ecx;\r
+       uint edx;\r
+       uint ebx;\r
+       uint esp;\r
+       uint ebp;\r
+       uint esi;\r
+       uint edi;\r
+       ushort es, reserve04;\r
+       ushort cs, reserve05;\r
+       ushort ss, reserve06;\r
+       ushort ds, reserve07;\r
+       ushort fs, reserve08;\r
+       ushort gs, reserve09;\r
+       ushort ldtr, reserve10;\r
+       unsigned flag_trap : 1;\r
+       unsigned reserve11 : 15;\r
+       ushort iomap_base;\r
+} CPU_TaskStateSegment;\r
+\r
+typedef struct SEGMENT_DESCRIPTOR { \r
+       ushort limit_low, base_low;\r
+       uchar base_mid, access_right;\r
+       uchar limit_high, base_high;\r
+} IO_SegmentDescriptor;\r
+\r
+typedef struct GATE_DESCRIPTOR { \r
+       ushort offset_low, selector;\r
+       uchar dw_count, access_right;\r
+       ushort offset_high;\r
+} IO_GateDescriptor;\r
+\r
+/*memory*/\r
+typedef struct IO_MEMORYCONTROLTAG {\r
+       void *addr;\r
+       uint size;\r
+} IO_MemoryControlTag;\r
+\r
+typedef IO_MemoryControlTag* IO_MemoryControl;\r
+\r
+/*common tag*/\r
+typedef struct SYSTEM_COMMON_STRUCT {\r
+       uint structid;\r
+       uint structsize;\r
+} System_CommonStruct;\r
+\r
+/*FIFO*/\r
+typedef struct FIFO32 {\r
+       System_CommonStruct common_tag;\r
+       uint *buf;\r
+       uint p, q, size, free;\r
+       struct FIFO32_FLAGS {\r
+               unsigned initialized : 1;\r
+               unsigned overflow : 1;\r
+       } flags;\r
+       struct UI_TASK *task;\r
+} DATA_FIFO32;\r
+\r
+/*task*/\r
+typedef struct UI_TASK {\r
+       uint selector;\r
+       struct UI_TASK *next;\r
+       uint count;\r
+       DATA_FIFO32 *fifo;\r
+       CPU_TaskStateSegment *tss;\r
+       struct UI_TASK_STATE_FLAGS {\r
+               unsigned initialized : 1;\r
+               unsigned linked : 1;\r
+               unsigned running : 1;\r
+               unsigned first_run : 1;\r
+       } flags;\r
+} UI_Task;\r
+\r
+typedef struct UI_TASK_CONTROL {\r
+       struct UI_TASK *start;\r
+       struct UI_TASK *now;\r
+       IO_MemoryControl sysmemctrl;\r
+} UI_TaskControl;\r
+\r
+/*callbios*/\r
+typedef struct CALL_BIOS_CONTROL {\r
+       UI_Task *CallBIOS_Task;\r
+       uint codesize;\r
+       DATA_FIFO32 *fifo;\r
+       uint endsignal;\r
+       CPU_TaskStateSegment retvalue;\r
+       uint esp0;\r
+} IO_CallBIOSControl;\r
+\r
+/*cfunction*/\r
+typedef struct CFUNCTION_VSNPRINTF_WORKAREA {\r
+       uchar *destination_buf;         /*\8f\91\82«\8d\9e\82Ý\90æ\95\8e\9a\97ñ\82Ì\8aJ\8en\83A\83h\83\8c\83X*/\r
+       uint length_destination_buf;    /*\8f\91\82«\8d\9e\82Ý\90æ\95\8e\9a\97ñ\82Ì\8dÅ\91å\83T\83C\83Y*/\r
+       uint index_destination_buf;     /*\8f\91\82«\8d\9e\82Ý\90æ\95\8e\9a\97ñ\82Ì\83C\83\93\83f\83b\83N\83X*/\r
+\r
+       const uchar *format_buf;        /*\8f\91\8e®\8ew\92è\95\8e\9a\97ñ\82Ì\8aJ\8en\83A\83h\83\8c\83X*/\r
+       uint index_format_buf;          /*\8f\91\8e®\8ew\92è\95\8e\9a\97ñ\82Ì\83C\83\93\83f\83b\83N\83X*/\r
+\r
+       uchar temporary_data[16];       /*\88ê\8e\9e\83f\81[\83^\82Ì\94z\97ñ*/\r
+       uchar temporary_data_double[8]; /*64\83r\83b\83g\95\82\93®\8f¬\90\94\93_\97p\83o\83b\83t\83@*/\r
+\r
+       uint *vargs;                    /*\89Â\95Ï\92·\88ø\90\94\82Ì\8aJ\8en\83A\83h\83\8c\83X*/\r
+       uint index_vargs;               /*\89Â\95Ï\92·\88ø\90\94\82Ì\8c»\8dÝ\82Ì\8fê\8f\8a*/\r
+\r
+       uint format_phase;              /*\83t\83H\81[\83}\83b\83g\82Ì\92i\8aK\82ð\8e¦\82·\81B*/\r
+                                               /*\90\94\92l  :\88Ó\96¡*/\r
+                                               /*0     :\83t\83H\81[\83}\83b\83g\8ew\92è\92\86\82Å\82Í\82È\82¢*/\r
+                                               /*1     :\83t\83\89\83O\88È\8d~\82Ì\8f\91\8e®\82ð\97v\8b\81*/\r
+                                               /*2     :\83t\83B\81[\83\8b\83h\95\9d\88È\8d~\82Ì\8f\91\8e®\82ð\97v\8b\81\81B*/\r
+                                               /*3     :\90¸\93x\88È\8d~\82Ì\8f\91\8e®\82ð\97v\8b\81\81B*/\r
+                                               /*4     :\95Ï\8a·\8fC\8fü\8eq\88È\8d~\82Ì\8f\91\8e®\82ð\97v\8b\81\81B*/\r
+                                               /*5     :\83t\83H\81[\83}\83b\83g\8ew\92è\8eq\82ð\97v\8b\81*/\r
+} CFunction_vsnprintf_WorkArea;\r
+\r
+/*emu86*/\r
+typedef struct EMULATOR_X86_ENVIRONMENT_SEGMENT_REGISTER {\r
+       ushort selector;\r
+       ushort type;\r
+       uint base;\r
+       uint limit;\r
+} Emulator_x86_Environment_SegmentRegister;\r
+\r
+typedef struct EMULATOR_X86_ENVIRONMENT_SYSTEM_TABLE_REGISTER {\r
+       uint base;\r
+       ushort limit;\r
+} Emulator_x86_Environment_SystemTableRegister;\r
+\r
+typedef struct EMULATOR_X86_ENVIRONMENT {\r
+       CPU_EFlags EFLAGS;\r
+       uint EIP;\r
+\r
+       uint GReg[8];\r
+\r
+       Emulator_x86_Environment_SystemTableRegister GDTR;\r
+       Emulator_x86_Environment_SystemTableRegister IDTR;\r
+\r
+       Emulator_x86_Environment_SegmentRegister SReg[8];\r
+\r
+       CPU_ControlRegister0 CR0;\r
+       uint CR2;\r
+       CPU_ControlRegister3 CR3;\r
+       CPU_ControlRegister4 CR4;\r
+\r
+       uchar now_opcode;\r
+       uchar operation_end;\r
+       uchar operation_32bit;\r
+       uchar operation_prefix_lock_repeat;\r
+       uchar operation_prefix_segment;\r
+       uchar operation_prefix_opsize;\r
+       uchar operation_prefix_addrsize;\r
+} Emulator_x86_Environment;\r
+\r
+typedef union EMULATOR_X86_OPCODE_MODRM {\r
+       uchar modrm;\r
+       struct EMULATOR_X86_OPCODE_MODRM_BIT {\r
+               unsigned RM : 3;\r
+               unsigned Reg : 3;\r
+               unsigned Mod : 2;\r
+       } bit;\r
+} Emulator_x86_OperationCode_ModRM;\r
+\r
+typedef struct EMULATOR_X86_FAR_POINTER {\r
+       ushort offset;\r
+       ushort selector;\r
+} Emulator_x86_FarPointer;\r
+\r
+/*drawing*/\r
+typedef struct DATA_LOCATION_2D {\r
+       int x;\r
+       int y;\r
+} DATA_Location2D;\r
+\r
+typedef struct DATA_LOCATION_2DU {\r
+       uint x;\r
+       uint y;\r
+} DATA_Location2DU;\r
+\r
+/*display*/\r
+typedef struct _INFO_VBE_BIOS {\r
+       uchar sign[4];\r
+       uchar ver_minor;\r
+       uchar ver_major;\r
+       ushort oem_string_offset;\r
+       ushort oem_string_segment;\r
+       ushort flags[2];        //\83p\83f\83B\83\93\83O\82Ì\8aÖ\8cW\82Å\81A\96{\93\96\82Íuint\82¾\82ªushort*2\82É\82µ\82Ä\82¢\82é\81B\r
+       ushort vmode_args_offset;\r
+       ushort vmode_args_segment;\r
+       ushort vram_supported_size_kb;\r
+} INFO_VBE_BIOS;\r
+\r
+typedef struct _INFO_VBE_VIDEO_MODE {\r
+       ushort  ModeAttributes;\r
+       uchar   WinAAttributes;\r
+       uchar   WinBAttributes;\r
+       ushort  WinGranularity;\r
+       ushort  WinSize;\r
+       ushort  WinASegment;\r
+       ushort  WinBSegment;\r
+       uint    WinFuncPtr;\r
+       ushort  BytesPerScanLine;\r
+       ushort  XResolution;\r
+       ushort  YResolution;\r
+       uchar   XCharSize;\r
+       uchar   YCharSize;\r
+       uchar   NumberOfPlanes;\r
+       uchar   BitsPerPixel;\r
+       uchar   NumberOfBanks;\r
+       uchar   MemoryModel;\r
+       uchar   BankSize;\r
+       uchar   NumberOfImagePages;\r
+       uchar   Reserved;\r
+       uchar   RedMaskSize;\r
+       uchar   RedFieldPosition;\r
+       uchar   GreenMaskSize;\r
+       uchar   GreenFieldPosition;\r
+       uchar   BlueMaskSize;\r
+       uchar   BlueFieldPosition;\r
+       uchar   RsvdMaskSize;\r
+       uchar   RsvdFieldPodition;\r
+       uchar   DirectColorModeInfo;\r
+       void*   PhysBasePtr;\r
+} INFO_VBE_VideoMode;\r
+\r
+typedef struct _INFO_VBE_VIDEOMODETAG {\r
+       ushort mode_number;\r
+       ushort xsize;\r
+       ushort ysize;\r
+       uchar bpp;\r
+       uchar memory_model;     //0x00:text 0x04:256palette 0x06:direct color\r
+       ushort attribute;       //bit3:1:color 0:monochrome\r
+                               //bit4:1:graphic 0:text\r
+                               //bit7:linear buffer support\r
+       ushort reserve;\r
+       void *vram;     //vram:0=not supported.\r
+} INFO_VBE_VideoModeTag;\r
+\r
+typedef struct IO_DISPLAY_CONTROL {\r
+       struct IO_DISPLAY_CONTROL_VBE {\r
+               uchar version_minor;\r
+               uchar version_major;\r
+               ushort vram_supported_size_kb;\r
+               uint flags;\r
+               uchar *oem_string;\r
+               ushort *vmode_args;\r
+               uint list_vmode_tags;\r
+               INFO_VBE_VideoModeTag *list_vmode;\r
+       } VBE;\r
+       ushort display_mode;    //0x0000:BIOS 0x0001:VBE Window Access(version < 2.0)(not implemented) 0x0002:VBE Linear Access\r
+       ushort vmode;   //0x0000:VGA 320x200 8bit\r
+       ushort vmode_index;\r
+       ushort bpp;\r
+       ushort xsize;\r
+       ushort ysize;\r
+       void *vram;\r
+       DATA_FIFO32 *bios_signal;\r
+       struct UI_SHEET *vramsheet;\r
+} IO_DisplayControl;\r
+\r
+/*sheet*/\r
+typedef struct UI_SHEET {\r
+       System_CommonStruct common_tag;\r
+       struct UI_SHEET *parent;        //one sheet has one parent(if vramseet then:0)\r
+       struct UI_SHEET *next;          //same level sheet link\r
+       struct UI_SHEET *child;         //lowest height sheet in children\r
+       DATA_Location2D location;\r
+       DATA_Location2DU size;\r
+       ushort bpp;\r
+       union UI_SHEET_FLAGS {\r
+               ushort flags;\r
+               struct UI_SHEET_FLAGS_BITS {\r
+                       unsigned initialized : 1;\r
+                       unsigned buffer_configured : 1;\r
+                       unsigned visible : 1;\r
+                       unsigned using_map : 1;\r
+                       unsigned vram_auto_allocated : 1;\r
+                       unsigned using_invcol : 1;\r
+                       unsigned topmost : 1;\r
+                       unsigned movable : 1;\r
+                       unsigned autorefresh_upperlevel : 1;\r
+               } bit;\r
+       } flags;\r
+       void *vram;\r
+       uint *map;\r
+       uint vramsize;\r
+       uint mapsize;\r
+       uint invcol;\r
+       uint (*Config_Functions)(struct UI_SHEET *sheet);\r
+       uint (*RefreshSheet)(struct UI_SHEET *sheet, int px0, int py0, int px1, int py1);\r
+       bool (*IsVisiblePixel)(struct UI_SHEET *sheet, int px, int py);\r
+       struct UI_SHEET_DRAWING {\r
+               uint (*Fill_Rectangle)(struct UI_SHEET *sheet, uint c, int px0, int py0, int px1, int py1);\r
+               uint (*Put_String)(struct UI_SHEET *sheet, int x, int y, uint fc, const uchar s[]);\r
+               uint (*Draw_Point)(struct UI_SHEET *sheet, int x, int y, uint c);\r
+       } Drawing;\r
+       DATA_FIFO32 *input_fifo;\r
+} UI_Sheet;\r
+\r
+/*timer*/\r
+typedef struct UI_TIMER {\r
+       uint tick;\r
+       uint timeout;\r
+       struct UI_TIMER *root_next;\r
+       struct UI_TIMER *tree_next;\r
+       DATA_FIFO32 *fifo;\r
+       uint fifo_putdata;\r
+       union UI_TIMER_FLAGS {\r
+               uint flags;\r
+               struct UI_TIMER_FLAGS_BITS {\r
+                       unsigned initialized : 1;\r
+                       unsigned configured : 1;\r
+                       unsigned running : 1;\r
+                       unsigned interval : 1;\r
+               } bit;\r
+       } flags;\r
+} UI_Timer;\r
+\r
+typedef struct UI_TIMER_CONTROL {\r
+       uint tick_10ms;\r
+       void (*TaskSwitch)(void);\r
+       UI_Timer *timer_root;\r
+} UI_TimerControl;\r
+\r
+/*color*/\r
+typedef union RGB_32BIT {\r
+       uint c32;\r
+       struct RGB_32BIT_RGBA {\r
+               uchar b;\r
+               uchar g;\r
+               uchar r;\r
+               uchar a;\r
+       } bit;\r
+} RGB32;\r
+\r
+/*mouse*/\r
+\r
+typedef struct IO_MOUSE_CONTROL {\r
+       uint decode_phase;\r
+       uchar decode_buf[4];\r
+       DATA_Location2D move;\r
+       int scroll;\r
+       struct IO_MOUSE_CONTROL_FLAGS {\r
+               unsigned scroll : 1;\r
+       } flags;\r
+       union IO_MOUSE_CONTROL_BUTTON {\r
+               uchar button;\r
+               struct IO_MOUSE_CONTROL_BUTTON_BIT {\r
+                       unsigned L : 1;\r
+                       unsigned R : 1;\r
+                       unsigned C : 1;\r
+               } bit;\r
+       } button;\r
+} IO_MouseControl;\r
+\r
+typedef struct UI_MOUSE_CURSOR {\r
+       UI_Sheet *cursor_sheet;\r
+       struct UI_MOUSE_CURSOR_FLAGS {\r
+               unsigned mode : 2;\r
+       } flags;\r
+       uchar *cursors[4];\r
+} UI_MouseCursor;\r
+\r
+/*textbox*/\r
+typedef struct UI_TEXT_BOX {\r
+       System_CommonStruct common_tag;\r
+       UI_Sheet *sheet;\r
+       uint forecol;\r
+       uint backcol;\r
+       DATA_Location2D location_cursor;\r
+       DATA_Location2D location_cursor_record_started;\r
+       DATA_Location2DU chars;\r
+       uchar *text_buf;\r
+       uint size_text_buf;\r
+       uint using_text_buf;\r
+       \r
+       union UI_TEXT_BOX_FLAGS {\r
+               uint flags;\r
+               struct UI_TEXT_BOX_FLAGS_BITS {\r
+                       unsigned initialized : 1;\r
+                       unsigned textbuffer_configured : 1;\r
+                       unsigned record_input_text : 1;\r
+                       unsigned cursor_blink : 1;\r
+                       unsigned cursor_state : 1;\r
+               } bit;\r
+       } flags;\r
+} UI_TextBox;\r
+\r
+typedef struct IO_FLOPPYDISK_DIRECTORY_ENTRY {\r
+       uchar name[8];  //0x00:empty(no more files)\r
+                                       //0x05:=0xe5\r
+                                       //0x2e:(only directory)\r
+                                       //.             0x2e:current directory\r
+                                       //..    0x2e, 0x2e:parent directory\r
+                                       //0xe5:deleted(usable)\r
+       uchar ext[3];\r
+       uchar attribute;        //0x0f=LongFileNameEntry\r
+       uchar reserved;\r
+       uchar VFAT_createTimeMs;\r
+       ushort VFAT_createTime;\r
+       ushort VFAT_createDate;\r
+       ushort VFAT_accessDate;\r
+       ushort VFAT_clusterHighWord;\r
+       ushort updatetime;\r
+       ushort updatedate;\r
+       ushort cluster;\r
+       uint size;      //attribute.bit.directory==true:0\r
+} IO_FloppyDisk_DirectoryEntry;\r
+\r
+typedef struct IO_FLOPPYDISK {\r
+       System_CommonStruct common_tag;\r
+       uchar *img;\r
+       IO_FloppyDisk_DirectoryEntry *files;\r
+       sector *userdataarea;\r
+       ushort *fat;\r
+} IO_FloppyDisk;\r
+\r
+typedef union IO_FLOPPYDISK_DIRECTORY_ENTRY_ATTRIBUTE {\r
+       uchar attribute;        //0x0f=LongFileNameEntry\r
+       struct IO_FLOPPYDISK_RDE_ATTRIBUTE_BITS {\r
+               unsigned readonly : 1;\r
+               unsigned hidden : 1;\r
+               unsigned system : 1;\r
+               unsigned volumelabel : 1;\r
+               unsigned directory : 1;\r
+               unsigned archive : 1;\r
+               unsigned bit6 : 1;\r
+               unsigned bit7 : 1;\r
+       } bit;\r
+} IO_FloppyDisk_DirectoryEntry_Attribute;\r
+\r
+typedef union IO_FLOPPYDISK_DIRECTORY_ENTRY_UPDATETIME {\r
+       ushort updatetime;\r
+       struct IO_FLOPPYDISK_RDE_UPDATETIME_BITS {\r
+               unsigned second : 5;    //second/2\r
+               unsigned minute : 6;\r
+               unsigned hour : 5;\r
+       } bit;\r
+} IO_FloppyDisk_DirectoryEntry_UpdateTime;\r
+\r
+typedef union IO_FLOPPYDISK_DIRECTORY_ENTRY_UPDATEDATE {\r
+       ushort updatedate;\r
+       struct IO_FLOPPYDISK_RDE_UPDATEDATE_BITS {\r
+               unsigned day : 5;               //day(1-31)\r
+               unsigned month : 4;     //month(1-12)\r
+               unsigned year : 7;              //year(from 1980)\r
+       } bit;\r
+} IO_FloppyDisk_DirectoryEntry_UpdateDate;\r
+\r
+typedef struct UI_CONSOLE {\r
+       UI_TextBox *textbox;\r
+       UI_Task *task;\r
+       uchar *printf_buffer;\r
+       union UI_CONSOLE_FLAGS {\r
+               uint flags;\r
+               struct UI_CONSOLE_FLAGS_BITS {\r
+                       unsigned initialized : 1;\r
+                       unsigned configured_size : 1;\r
+                       unsigned isprompt : 1;\r
+               } bit;\r
+       } flags;\r
+       IO_FloppyDisk *boot_fd;\r
+} UI_Console;\r
+\r
+typedef struct IO_FILE {\r
+       System_CommonStruct common_tag;\r
+       uchar *path;\r
+       uint size;\r
+       void *img;\r
+       union IO_FILE_FLAGS {\r
+               uint flags;\r
+               struct IO_FILE_FLAGS_BITS {\r
+                       unsigned initialized : 1;\r
+                       unsigned img_loaded : 1;\r
+               } bit;\r
+       } flags;\r
+} IO_File;\r
+\r
+\r