Subversion Repositories Kolibri OS

Rev

Rev 2276 | Rev 6174 | 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. {
  73.                 $push edx
  74. GETKEY:
  75.                 $mov  eax,2
  76.                 $int  0x40
  77.                 $cmp eax,1
  78.                 $jne GETKEYI
  79.                 $mov ah,dh
  80.                 $jmp GETKEYII //jz?
  81. GETKEYI:
  82.                 $mov dh,ah
  83.                 $jmp GETKEY
  84. GETKEYII:
  85.                 $pop edx
  86.                 $shr eax,8
  87. }
  88.  
  89. inline fastcall word GetButtonID(){
  90.  EAX = 17;
  91.  $int  0x40
  92.  EAX = EAX >> 8;
  93. }
  94.  
  95. inline fastcall ExitProcess(){
  96.  EAX = -1;              // close this program
  97.  $int 0x40
  98. }
  99.  
  100. inline fastcall Pause(dword EBX)
  101. {                                       // ã§ , ¢ á®âëå ¤®«ïå ᥪ㭤ë EBX = value
  102.         $mov eax, 5
  103.         $int 0x40
  104. }
  105.  
  106. //------------------------------------------------------------------------------
  107.  
  108. char buffer[11]="";
  109. inline fastcall dword IntToStr(dword ESI)
  110. {
  111.      $mov     edi, #buffer
  112.      $mov     ecx, 10
  113.      $test     esi, esi
  114.      $jns     f1
  115.      $mov     al, '-'
  116.      $stosb
  117.      $neg     esi
  118. f1:
  119.      $mov     eax, esi
  120.      $push     -'0'
  121. f2:
  122.      $xor     edx, edx
  123.      $div     ecx
  124.      $push     edx
  125.      $test     eax, eax
  126.      $jnz     f2
  127. f3:
  128.      $pop     eax
  129.      $add     al, '0'
  130.      $stosb
  131.      $jnz     f3
  132.      $mov     eax, #buffer
  133.      $ret
  134. }
  135.  
  136.  
  137. //------------------------------------------------------------------------------
  138.  
  139.  
  140. void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI)
  141. {
  142.         EAX = 12;              // function 12:tell os about windowdraw
  143.         EBX = 1;
  144.         $int 0x40
  145.        
  146.         EBX = x << 16 + sizeX;
  147.         ECX = y << 16 + sizeY;
  148.         EDX = mainAreaType << 24 | mainAreaColour;
  149.         ESI = headerType << 24 | headerColour;
  150.         $xor eax,eax
  151.         $int 0x40
  152.  
  153.         EAX = 12;              // function 12:tell os about windowdraw
  154.         EBX = 2;
  155.         $int 0x40
  156. }
  157.  
  158. inline fastcall MoveSize(int EBX,ECX,EDX,ESI)
  159. {
  160.         EAX = 67;
  161.         $int 0x40
  162. }
  163.  
  164. inline fastcall dword CreateThread(dword ECX,EDX)
  165. {
  166.         EAX = 51;
  167.         EBX = 1;
  168.         $int 0x40
  169. }
  170.  
  171. inline fastcall dword GetSkinWidth()
  172. {
  173.         $push ebx
  174.         $mov  eax, 48
  175.         $mov  ebx, 4
  176.         $int  0x40
  177.         $pop  ebx
  178. }
  179.  
  180. void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
  181. {
  182.         EAX = 4;
  183.         EBX = x<<16+y;
  184.         ECX = fontType<<24+color;
  185.         $int 0x40;
  186. }
  187.  
  188. void DrawBar(dword x,y,w,h,EDX)
  189. {
  190.         EAX = 13;
  191.         EBX = x<<16+w;
  192.         ECX = y<<16+h;
  193.         $int 0x40
  194. }
  195.  
  196. void DefineButton(dword x,y,w,h,EDX,ESI)
  197. {
  198.         EAX = 8;
  199.         EBX = x<<16+w;
  200.         ECX = y<<16+h;
  201.         $int 0x40
  202. }
  203.  
  204. void DrawRegion(dword x,y,width,height,EDX)
  205. {
  206.         DrawBar(x,y,width,1,EDX);
  207.         DrawBar(x,y+height,width,1,EDX);
  208.         DrawBar(x,y,1,height,EDX);
  209.         DrawBar(x+width,y,1,height+1,EDX);
  210. }
  211.  
  212. inline fastcall dword WriteDebug(dword EDX)
  213. {
  214.         $push ebx
  215.         $push ecx
  216.         $mov eax, 63
  217.         $mov ebx, 1
  218. next_char:
  219.         $mov ecx, DSDWORD[edx]
  220.         $or      cl, cl
  221.         $jz  done
  222.         $int 0x40
  223.         $inc edx
  224.         $jmp next_char
  225. done:
  226.         $mov cl, 13
  227.         $int 0x40
  228.         $mov cl, 10
  229.         $int 0x40
  230.         $pop ecx
  231.         $pop ebx
  232. }