Subversion Repositories Kolibri OS

Rev

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