Subversion Repositories Kolibri OS

Rev

Rev 711 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. #ifdef __cplusplus
  3. extern "C"
  4. {
  5. #endif
  6.  
  7.  
  8. #define FONT0          0x00000000
  9. #define FONT1          0x10000000
  10.  
  11. #define BT_NORMAL      0x00000000
  12. #define BT_NOFRAME     0x20000000
  13. #define BT_HIDE        0x40000000
  14. #define BT_DEL         0x80000000
  15.  
  16. #define EV_REDRAW      1
  17. #define EV_KEY         2
  18. #define EV_BUTTON      3
  19.  
  20. #define REL_SCREEN     0
  21. #define REL_WINDOW     1
  22.  
  23. #define FILE_NOT_FOUND 5
  24. #define FILE_EOF       6
  25.  
  26. #if 0
  27.  
  28. typedef unsigned int DWORD;
  29. typedef unsigned short int WORD;
  30.  
  31. typedef struct
  32. {  DWORD pci_cmd;
  33.    DWORD irq;
  34.    DWORD glob_cntrl;
  35.    DWORD glob_sta;
  36.    DWORD codec_io_base;
  37.    DWORD ctrl_io_base;
  38.    DWORD codec_mem_base;
  39.    DWORD ctrl_mem_base;
  40.    DWORD codec_id;
  41. } CTRL_INFO;
  42.  
  43. typedef struct
  44. {   DWORD       cmd;
  45.     DWORD       offset;
  46.     DWORD       r1;
  47.     DWORD       count;
  48.     DWORD       buff;
  49.     char        r2;
  50.     char       *name;
  51. } FILEIO;
  52.  
  53. typedef struct
  54. {   DWORD    attr;
  55.     DWORD    flags;
  56.     DWORD    cr_time;
  57.     DWORD    cr_date;
  58.     DWORD    acc_time;
  59.     DWORD    acc_date;
  60.     DWORD    mod_time;
  61.     DWORD    mod_date;
  62.     DWORD    size;
  63.     DWORD    size_high;
  64. } FILEINFO;
  65.  
  66. void  _stdcall GetNotify(void *event);
  67.  
  68. void _stdcall CreateThread(void *fn, char *p_stack);
  69.  
  70. DWORD _stdcall GetMousePos(DWORD rel_type);
  71.  
  72. void _stdcall debug_out_hex(DWORD val);
  73. void debug_out_str(char* str);
  74.  
  75. int _stdcall get_fileinfo(const char *name,FILEINFO* pinfo);
  76. int _stdcall read_file (const char *name,char*buff,DWORD offset, DWORD count,DWORD *reads);
  77. int _stdcall write_file(const char *name,char*buff,int offset,int count,int *writes);
  78.  
  79. //void exit();
  80. int _stdcall get_key(int *key);
  81. int _stdcall remap_key(int key);
  82.  
  83. int _cdecl get_button_id();
  84.  
  85. //void delay(int val);
  86.  
  87. int wait_for_event(int time);
  88. int wait_for_event_infinite();
  89. void BeginDraw(void);
  90. void EndDraw(void);
  91.  
  92. void _stdcall GetScreenSize(int *x, int*y);
  93. void _stdcall DrawWindow(int x,int y, int sx, int sy,int workcolor,int style,
  94.                                int captioncolor,int windowtype,int bordercolor);
  95. void _stdcall debug_out(int ch);
  96. void _stdcall make_button(int x, int y, int xsize, int ysize, int id, int color);
  97. void _stdcall draw_bar(int x, int y, int xsize, int ysize, int color);
  98. void _stdcall write_text(int x,int y,int color,char* text,int len);
  99.  
  100. #endif
  101.  
  102. #pragma pack(push, 1)
  103. typedef struct
  104. {
  105.   char sec;
  106.   char min;
  107.   char hour;
  108.   char rsv;
  109. }detime_t;
  110. #pragma pack(pop)
  111.  
  112. #pragma pack(push, 1)
  113. typedef struct
  114. {
  115.   char  day;
  116.   char  month;
  117.   short year;
  118. }dedate_t;
  119. #pragma pack(pop)
  120.  
  121. #pragma pack(push, 1)
  122. typedef struct
  123. {   unsigned    attr;
  124.     unsigned    flags;
  125.     union
  126.     {
  127.       detime_t  ctime;
  128.       unsigned  cr_time;
  129.     };
  130.     union
  131.     {
  132.       dedate_t  cdate;
  133.       unsigned  cr_date;
  134.     };
  135.     union
  136.     {
  137.       detime_t  atime;
  138.       unsigned  acc_time;
  139.     };
  140.     union
  141.     {
  142.       dedate_t  adate;
  143.       unsigned  acc_date;
  144.     };
  145.     union
  146.     {
  147.       detime_t  mtime;
  148.       unsigned  mod_time;
  149.     };
  150.     union
  151.     {
  152.       dedate_t  mdate;
  153.       unsigned  mod_date;
  154.     };
  155.     unsigned    size;
  156.     unsigned    size_high;
  157. } FILEINFO;
  158. #pragma pack(pop)
  159.  
  160.  
  161. unsigned init_heap(void);
  162. void *user_alloc(unsigned size);
  163. unsigned user_free(void *);
  164.  
  165. int create_file(const char *name);
  166. int set_file_size(const char *name, unsigned size);
  167. int get_fileinfo(const char *name,FILEINFO *info);
  168. int read_file (const char *name,void *buff, unsigned offset, unsigned count,unsigned *reads);
  169. int write_file(const char *name,const void *buff,unsigned offset,unsigned count,unsigned *writes);
  170.  
  171. #pragma aux init_heap =   \
  172.             "mov EAX, 68" \
  173.             "mov EBX, 11" \
  174.             "int 0x40"    \
  175.             value [EAX] \
  176.             modify [ EBX ];
  177.  
  178. #pragma aux user_alloc = \
  179.             "mov EAX, 68" \
  180.             "mov EBX, 12" \
  181.             "int 0x40"    \
  182.             parm [ ECX ] value [EAX] \
  183.             modify [ EBX ];
  184.  
  185. #pragma aux user_free =   \
  186.             "mov EAX, 68" \
  187.             "mov EBX, 13" \
  188.             "int 0x40"    \
  189.             parm [ ECX ] value [EAX] \
  190.             modify [ EBX ];
  191.  
  192. #pragma aux create_file  = \
  193.             "push 0"           \
  194.             "push 0"           \
  195.             "mov [esp+1], eax" \
  196.             "push 0"           \
  197.             "push 0"           \
  198.             "push 0"           \
  199.             "push 0"           \
  200.             "push 2"           \
  201.             "mov ebx, esp"     \  
  202.             "mov eax, 70"      \
  203.             "int 0x40"         \
  204.             "add esp, 28"      \      
  205.             parm [EAX] value [EAX] \
  206.             modify [ EBX ];
  207.  
  208. #pragma aux set_file_size    = \
  209.             "push 0"           \
  210.             "push 0"           \
  211.             "mov [esp+1], eax" \
  212.             "push 0"           \
  213.             "push 0"           \
  214.             "push 0"           \
  215.             "push ebx"           \
  216.             "push 4"           \
  217.             "mov ebx, esp"     \  
  218.             "mov eax, 70"      \
  219.             "int 0x40"         \
  220.             "add esp, 28"      \      
  221.             parm [EAX] [EBX] value [EAX] \
  222.             modify [ EBX ];
  223.  
  224. #pragma aux get_fileinfo  = \
  225.             "push 0"           \
  226.             "push 0"           \
  227.             "mov [esp+1], eax" \
  228.             "push ebx"         \
  229.             "push 0"           \
  230.             "push 0"           \
  231.             "push 0"           \
  232.             "push 5"           \
  233.             "mov ebx, esp"     \  
  234.             "mov eax, 70"      \
  235.             "int 0x40"         \
  236.             "add esp, 28"      \      
  237.             parm [EAX] [ebx] value [EAX] \
  238.             modify [ EBX ];
  239.  
  240. #pragma aux read_file  = \
  241.             "push 0"           \
  242.             "push 0"           \
  243.             "mov [esp+1], eax" \
  244.             "push ebx"         \
  245.             "push edx"         \
  246.             "push 0"           \
  247.             "push ecx"         \
  248.             "push 0"           \
  249.             "mov ebx, esp"     \  
  250.             "mov eax, 70"      \
  251.             "int 0x40"         \
  252.             "test esi, esi"    \
  253.             "jz skip"          \
  254.             "mov [esi], ebx"   \
  255.      "skip:"                   \      
  256.             "add esp, 28"      \      
  257.             parm [EAX] [EBX] [ECX] [EDX] [ESI] value [EAX] \
  258.             modify [ EBX ];
  259.  
  260. #pragma aux write_file  = \
  261.             "push 0"           \
  262.             "push 0"           \
  263.             "mov [esp+1], eax" \
  264.             "push ebx"         \
  265.             "push edx"         \
  266.             "push 0"           \
  267.             "push ecx"         \
  268.             "push 3"           \
  269.             "mov ebx, esp"     \  
  270.             "mov eax, 70"      \
  271.             "int 0x40"         \
  272.             "test esi, esi"    \
  273.             "jz skip"          \
  274.             "mov [esi], ebx"   \
  275.      "skip:"                   \      
  276.             "add esp, 28"      \      
  277.             parm [EAX] [EBX] [ECX] [EDX] [ESI] value [EAX] \
  278.             modify [ EBX ];
  279.  
  280. #ifdef __cplusplus
  281. extern "C"
  282. }
  283. #endif
  284.