Subversion Repositories Kolibri OS

Rev

Rev 704 | Go to most recent revision | 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. typedef struct
  103. {   unsigned    attr;
  104.     unsigned    flags;
  105.     unsigned    cr_time;
  106.     unsigned    cr_date;
  107.     unsigned    acc_time;
  108.     unsigned    acc_date;
  109.     unsigned    mod_time;
  110.     unsigned    mod_date;
  111.     unsigned    size;
  112.     unsigned    size_high;
  113. } FILEINFO;
  114.  
  115.  
  116. unsigned init_heap(void);
  117. void *user_alloc(unsigned size);
  118. unsigned user_free(void *);
  119.  
  120. int create_file(const char *name);
  121. int get_fileinfo(const char *name,FILEINFO* pinfo);
  122. int read_file (const char *name,void *buff, unsigned offset, unsigned count,unsigned *reads);
  123. int write_file(const char *name,const void *buff,unsigned offset,unsigned count,unsigned *writes);
  124.  
  125. #pragma aux init_heap =   \
  126.             "mov EAX, 68" \
  127.             "mov EBX, 11" \
  128.             "int 0x40"    \
  129.             value [EAX] \
  130.             modify [ EBX ];
  131.  
  132. #pragma aux user_alloc = \
  133.             "mov EAX, 68" \
  134.             "mov EBX, 12" \
  135.             "int 0x40"    \
  136.             parm [ ECX ] value [EAX] \
  137.             modify [ EBX ];
  138.  
  139. #pragma aux user_free =   \
  140.             "mov EAX, 68" \
  141.             "mov EBX, 13" \
  142.             "int 0x40"    \
  143.             parm [ ECX ] value [EAX] \
  144.             modify [ EBX ];
  145.  
  146. #pragma aux create_file  = \
  147.             "push 0"           \
  148.             "push 0"           \
  149.             "mov [esp+1], eax" \
  150.             "push 0"           \
  151.             "push 0"           \
  152.             "push 0"           \
  153.             "push 0"           \
  154.             "push 2"           \
  155.             "mov ebx, esp"     \  
  156.             "mov eax, 70"      \
  157.             "int 0x40"         \
  158.             "add esp, 28"      \      
  159.             parm [EAX] value [EAX] \
  160.             modify [ EBX ];
  161.  
  162. #pragma aux get_fileinfo  = \
  163.             "push 0"           \
  164.             "push 0"           \
  165.             "mov [esp+1], eax" \
  166.             "push ebx"         \
  167.             "push 0"           \
  168.             "push 0"           \
  169.             "push 0"           \
  170.             "push 5"           \
  171.             "mov ebx, esp"     \  
  172.             "mov eax, 70"      \
  173.             "int 0x40"         \
  174.             "add esp, 28"      \      
  175.             parm [EAX] [ebx] value [EAX] \
  176.             modify [ EBX ];
  177.  
  178. #pragma aux read_file  = \
  179.             "push 0"           \
  180.             "push 0"           \
  181.             "mov [esp+1], eax" \
  182.             "push ebx"         \
  183.             "push edx"         \
  184.             "push 0"           \
  185.             "push ecx"         \
  186.             "push 0"           \
  187.             "mov ebx, esp"     \  
  188.             "mov eax, 70"      \
  189.             "int 0x40"         \
  190.             "test esi, esi"    \
  191.             "jz skip"          \
  192.             "mov [esi], ebx"   \
  193.      "skip:"                   \      
  194.             "add esp, 28"      \      
  195.             parm [EAX] [EBX] [ECX] [EDX] [ESI] value [EAX] \
  196.             modify [ EBX ];
  197.  
  198. #pragma aux write_file  = \
  199.             "push 0"           \
  200.             "push 0"           \
  201.             "mov [esp+1], eax" \
  202.             "push ebx"         \
  203.             "push edx"         \
  204.             "push 0"           \
  205.             "push ecx"         \
  206.             "push 3"           \
  207.             "mov ebx, esp"     \  
  208.             "mov eax, 70"      \
  209.             "int 0x40"         \
  210.             "test esi, esi"    \
  211.             "jz skip"          \
  212.             "mov [esi], ebx"   \
  213.      "skip:"                   \      
  214.             "add esp, 28"      \      
  215.             parm [EAX] [EBX] [ECX] [EDX] [ESI] value [EAX] \
  216.             modify [ EBX ];
  217.  
  218. #ifdef __cplusplus
  219. extern "C"
  220. }
  221. #endif
  222.