Subversion Repositories Kolibri OS

Rev

Rev 5230 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. //CODED by Veliant, Leency, Nable. GNU GPL licence.
  2.  
  3. #startaddress 0
  4. #code32 TRUE
  5.  
  6. char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
  7. dword  os_version   = 0x00000001;
  8. dword  start_addr   = #main;
  9. dword  final_addr   = #stop+32;
  10. dword  alloc_mem    = #0x00010000;
  11. dword  x86esp_reg   = #0x00010000;
  12. dword  I_Param      = 0;
  13. dword  I_Path       = 0;
  14.  
  15. //Events
  16. #define evMouse     6
  17. #define evButton    3
  18. #define evKey       2
  19. #define evReDraw    1
  20.  
  21. //Button options
  22. #define BT_DEL          0x80000000
  23. #define BT_HIDE         0x40000000
  24. #define BT_NOFRAME      0x20000000
  25.  
  26. //-------------------------------------------------------------------------
  27.  
  28.  
  29. struct proc_info{
  30.         dword   use_cpu;
  31.         word    pos_in_stack,num_slot,rezerv1;
  32.         char    name[11];
  33.         char    rezerv2;
  34.         dword   adress,use_memory,ID,left,top,width,height;
  35.         word    status_slot,rezerv3;
  36.         dword   work_left,work_top,work_width,work_height;
  37.         char    status_window;
  38.         void    GetInfo(dword ECX);
  39.         byte    reserved[1024-71];
  40. #define SelfInfo -1
  41. };
  42.  
  43. inline fastcall void GetProcessInfo(dword EBX, ECX)
  44. {
  45.         EAX = 9;
  46.         $int  0x40
  47. }
  48.  
  49. struct system_colors{
  50.         dword frame,grab,grab_button,grab_button_text,grab_text,work,work_button,work_button_text,work_text,work_graph;
  51.         void get();
  52. };
  53.  
  54. void system_colors::get()
  55. {
  56.         EAX = 48;
  57.         EBX = 3;
  58.         ECX = #frame;
  59.         EDX = 40;
  60.         $int 0x40
  61. }
  62.  
  63. //------------------------------------------------------------------------------
  64.  
  65. inline fastcall dword WaitEvent(){
  66.  EAX = 10;
  67.  $int 0x40
  68. }
  69.  
  70.  
  71. inline fastcall word GetKey(){ //Gluk fix
  72.  EAX = 2;              // just read it key from buffer
  73.  $int  0x40
  74.  EAX = EAX >> 8;         
  75. }
  76.  
  77. inline fastcall word GetButtonID(){
  78.  EAX = 17;
  79.  $int  0x40
  80.  EAX = EAX >> 8;
  81. }
  82.  
  83. inline fastcall ExitProcess(){
  84.  EAX = -1;              // close this program
  85.  $int 0x40
  86. }
  87.  
  88. inline fastcall Pause(dword EBX)
  89. {                                       // ã§ , ¢ á®âëå ¤®«ïå ᥪ㭤ë EBX = value
  90.         $mov eax, 5
  91.         $int 0x40
  92. }
  93.  
  94. //------------------------------------------------------------------------------
  95.  
  96. char buffer[11]="";
  97. inline fastcall dword IntToStr(dword ESI)
  98. {
  99.      $mov     edi, #buffer
  100.      $mov     ecx, 10
  101.      $test     esi, esi
  102.      $jns     f1
  103.      $mov     al, '-'
  104.      $stosb
  105.      $neg     esi
  106. f1:
  107.      $mov     eax, esi
  108.      $push     -'0'
  109. f2:
  110.      $xor     edx, edx
  111.      $div     ecx
  112.      $push     edx
  113.      $test     eax, eax
  114.      $jnz     f2
  115. f3:
  116.      $pop     eax
  117.      $add     al, '0'
  118.      $stosb
  119.      $jnz     f3
  120.      $mov     eax, #buffer
  121.      $ret
  122. }
  123.  
  124.  
  125. //------------------------------------------------------------------------------
  126.  
  127.  
  128. void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI)
  129. {
  130.         EAX = 12;              // function 12:tell os about windowdraw
  131.         EBX = 1;
  132.         $int 0x40
  133.        
  134.         EBX = x << 16 + sizeX;
  135.         ECX = y << 16 + sizeY;
  136.         EDX = mainAreaType << 24 | mainAreaColour;
  137.         ESI = headerType << 24 | headerColour;
  138.         $xor eax,eax
  139.         $int 0x40
  140.  
  141.         EAX = 12;              // function 12:tell os about windowdraw
  142.         EBX = 2;
  143.         $int 0x40
  144. }
  145.  
  146. inline fastcall MoveSize(int EBX,ECX,EDX,ESI)
  147. {
  148.         EAX = 67;
  149.         $int 0x40
  150. }
  151.  
  152. inline fastcall dword CreateThread(dword ECX,EDX)
  153. {
  154.         EAX = 51;
  155.         EBX = 1;
  156.         $int 0x40
  157. }
  158.  
  159. inline fastcall dword GetSkinWidth()
  160. {
  161.         $push ebx
  162.         $mov  eax, 48
  163.         $mov  ebx, 4
  164.         $int  0x40
  165.         $pop  ebx
  166. }
  167.  
  168. void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
  169. {
  170.         EAX = 4;
  171.         EBX = x<<16+y;
  172.         ECX = fontType<<24+color;
  173.         $int 0x40;
  174. }
  175.  
  176. void DrawBar(dword x,y,w,h,EDX)
  177. {
  178.         EAX = 13;
  179.         EBX = x<<16+w;
  180.         ECX = y<<16+h;
  181.         $int 0x40
  182. }
  183.  
  184. void DefineButton(dword x,y,w,h,EDX,ESI)
  185. {
  186.         EAX = 8;
  187.         EBX = x<<16+w;
  188.         ECX = y<<16+h;
  189.         $int 0x40
  190. }
  191.  
  192. void DrawRegion(dword x,y,width,height,EDX)
  193. {
  194.         DrawBar(x,y,width,1,EDX);
  195.         DrawBar(x,y+height,width,1,EDX);
  196.         DrawBar(x,y,1,height,EDX);
  197.         DrawBar(x+width,y,1,height+1,EDX);
  198. }
  199.  
  200. inline fastcall dword WriteDebug(dword EDX)
  201. {
  202.         $push ebx
  203.         $push ecx
  204.         $mov eax, 63
  205.         $mov ebx, 1
  206. next_char:
  207.         $mov ecx, DSDWORD[edx]
  208.         $or      cl, cl
  209.         $jz  done
  210.         $int 0x40
  211.         $inc edx
  212.         $jmp next_char
  213. done:
  214.         $mov cl, 13
  215.         $int 0x40
  216.         $mov cl, 10
  217.         $int 0x40
  218.         $pop ecx
  219.         $pop ebx
  220. }