Subversion Repositories Kolibri OS

Rev

Rev 5591 | Rev 5606 | 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. #ifndef INCLUDE_KOLIBRI_H
  3. #define INCLUDE_KOLIBRI_H
  4.  
  5. #startaddress 0
  6. #code32 TRUE
  7.  
  8. char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
  9. dword  os_version   = 0x00000001;
  10. dword  start_addr   = #load_init_main;
  11. dword  final_addr   = #stop+32;
  12. dword  alloc_mem    = MEMSIZE;
  13. dword  x86esp_reg   = MEMSIZE;
  14. dword  I_Param      = #param;
  15. dword  I_Path       = #program_path;
  16. char param[4096];
  17. char program_path[4096];
  18.  
  19. #define NULL      0
  20. #define OLD      -1
  21. #define true      1
  22. #define false     0
  23.  
  24. //Events
  25. #define evReDraw  1
  26. #define evKey     2
  27. #define evButton  3
  28. #define evDesktop 5
  29. #define evMouse   6
  30. #define evIPC     7
  31. #define evNetwork 8
  32. #define evDebug   9
  33.  
  34. //Button options
  35. #define BT_DEL      0x80000000
  36. #define BT_HIDE     0x40000000
  37. #define BT_NOFRAME  0x20000000
  38.  
  39. //Button mouse
  40. #define MOUSE_LEFT   001b
  41. #define MOUSE_RIGHT  010b
  42. #define MOUSE_LR     011b
  43. #define MOUSE_CENTER 100b
  44.  
  45. //ASCII KEYS
  46. #define ASCII_KEY_BS    008
  47. #define ASCII_KEY_TAB   009
  48. #define ASCII_KEY_ENTER 013
  49. #define ASCII_KEY_ESC   027
  50. #define ASCII_KEY_DEL   182
  51. #define ASCII_KEY_INS   185
  52. #define ASCII_KEY_SPACE 032
  53.  
  54. #define ASCII_KEY_LEFT  176
  55. #define ASCII_KEY_RIGHT 179
  56. #define ASCII_KEY_DOWN  177
  57. #define ASCII_KEY_UP    178
  58. #define ASCII_KEY_HOME  180
  59. #define ASCII_KEY_END   181
  60. #define ASCII_KEY_PGDN  183
  61. #define ASCII_KEY_PGUP  184
  62.  
  63. //allow event mask
  64. #define EVENT_MASK_REDRAW   000000001b
  65. #define EVENT_MASK_KEYBOARD 000000010b
  66. #define EVENT_MASK_BUTTONS  000000100b
  67. #define EVENT_MASK_DESKTOP  000010000b
  68. #define EVENT_MASK_MOUSE    000100000b
  69. #define EVENT_MASK_IPC      001000000b
  70. #define EVENT_MASK_NETWORK  010000000b
  71. #define EVENT_MASK_DEBUG    100000000b
  72.  
  73. //ARGS FUNCTION
  74. #define END_ARGS 0xFF00FF
  75. //-------------------------------------------------------------------------
  76.  
  77. :struct raw_image {
  78.         dword w, h, data;
  79. };
  80.  
  81. /**
  82.  *  The structure of the mouse
  83.  *  x - coordinate X
  84.  *  y - coordinate Y
  85.  *  xx and yy - time coordinates
  86.  *  lkm - left mouse button
  87.  *  pkm - right mouse button
  88.  *  mkm - mouse wheel
  89.  *  key - keycode button
  90.  *  tmp - time keycode
  91.  *  down - key event press
  92.  *  up - key release events
  93.  *  move - event mouse movements
  94.  *  click - when clicked
  95.  *  dblclick - double-click the default 50 (500 ms)
  96.  */
  97.  
  98. :dword __TMP_TIME,MOUSE_TIME;
  99. :struct mouse
  100. {
  101.         signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick,left,top;
  102.         dword handle,_;
  103.         byte cmd;
  104.         void clearTime();
  105.         void get();
  106.         void set();
  107.         void center();
  108.         dword hide();
  109.         void slider();
  110.         void show();
  111. };
  112. :void mouse::clearTime()
  113. {
  114.         tmp_time = GetStartTime()+MOUSE_TIME;
  115. }
  116. :void mouse::show()
  117. {
  118.         if(!handle)return;
  119.         ECX = handle;
  120.         EAX = 37;
  121.         EBX = 5;
  122.         $int 0x40;
  123. }
  124. :dword mouse::hide()
  125. {
  126.         if(!_)
  127.         {
  128.                 EAX = 68;
  129.                 EBX = 12;
  130.                 ECX = 32*32*4;
  131.                 $int 0x40
  132.                 ECX = EAX;
  133.                 _ = EAX;
  134.         } else ECX = _;
  135.         EAX = 37;
  136.         EBX = 4;
  137.         DX  = 2;
  138.         $int 0x40;
  139.         handle = EAX;
  140.         ECX = EAX;
  141.         EAX = 37;
  142.         EBX = 5;
  143.         $int 0x40;
  144.         handle = EAX;
  145. }
  146.  
  147. //set new attributes mouse
  148. :void mouse::set()
  149. {
  150.         if((xx!=x)||(yy!=y))
  151.         {
  152.                 EAX = 18;
  153.                 EBX = 19;
  154.                 ECX = 4;
  155.                 EDX = (x<<16)+y;
  156.                 $int 0x40
  157.                 //move = true;
  158.         }
  159.         if((key)||(lkm|mkm|pkm))&&(down|up|click|dblclick|move)
  160.         {
  161.                 if(lkm|mkm|pkm)key=(lkm)|(pkm<<1)|(2<<mkm);
  162.                 EAX = 18;
  163.                 EBX = 19;
  164.                 ECX = key;
  165.                 EDX = (x<<16)+y;
  166.                 $int 0x40
  167.         }
  168. }
  169.  
  170. :void mouse::center()
  171. {
  172.         EAX = 18;
  173.         EBX = 15;
  174.         $int 0x40
  175. }
  176.  
  177. //get new attributes mouse
  178. :void mouse::get()
  179. {
  180.         EAX = 37;
  181.         EBX = 1;
  182.         $int    0x40
  183.         $mov    ebx, eax
  184.         $shr    eax, 16
  185.         $and    ebx,0x0000FFFF
  186.         x = EAX;
  187.         y = EBX;
  188.         if (x>6000) x-=65535;
  189.         if (y>6000) y-=65535;
  190.         EAX = 37;
  191.         EBX = 2;
  192.         $int    0x40
  193.         $mov    ebx, eax
  194.         $mov    ecx, eax
  195.         key = EAX;
  196.         $and    eax, 0x00000001
  197.         $shr    ebx, 1
  198.         $and    ebx, 0x00000001
  199.         $shr    ecx, 2
  200.         $and    ecx, 0x00000001
  201.         lkm = EAX;
  202.         pkm = EBX;
  203.         mkm = ECX;
  204.        
  205.         //when you release the mouse button
  206.         // Mouse Up Event
  207.         if((cmd)&&!(key)){
  208.                 up = true;
  209.                 down = false;
  210.                 if(!move) click = true;
  211.                 move = false;
  212.                 __TMP_TIME = GetStartTime();
  213.                 if(__TMP_TIME-tmp_time<=MOUSE_TIME){ dblclick = true;click = false; }
  214.                 tmp_time = __TMP_TIME;
  215.                 //returns the key code
  216.                 key = tmp;
  217.                 lkm = 1&tmp;
  218.                 pkm = 2&tmp;
  219.                 pkm >>= 1;
  220.                 mkm = 4&tmp;
  221.                 mkm >>= 2;
  222.                 cmd = false;
  223.         }
  224.        
  225.         //when you press the mouse button
  226.         // Mouse Down Event/Move Event
  227.         else {
  228.             up       = false;
  229.                 click    = false;
  230.                 dblclick = false;
  231.                 down     = false;
  232.                 // Mouse Move Event
  233.                 if((xx!=x)||(yy!=y))
  234.                 {
  235.                         move = true;
  236.                         xx = x;
  237.                         yy = y;
  238.                 }
  239.                 else move = false;
  240.                 if(key)if(!cmd) {down = true;cmd = true;tmp=key;}
  241.         }
  242.        
  243.         //scroll
  244.         EAX = 37;
  245.         EBX = 7;
  246.         $int    0x40
  247.         $mov    ebx, eax
  248.         $shr    eax, 16
  249.         $and    ebx,0x0000FFFF
  250.         //hor = EAX;
  251.         vert = EBX;
  252. }
  253.  
  254. :void mouse::slider()
  255. {
  256.         signed _x,_y;
  257.         if(!handle)hide();
  258.         get();
  259.         _x = x;_y = y;
  260.         pause(5);
  261.         get();
  262.         left = _x - x;
  263.         top  = _y - y;
  264.         center();
  265.         get();
  266.         _x = x;_y = y;
  267.         pause(5);
  268. }
  269.  
  270. :struct keyboard
  271. {
  272.         signed key;
  273.         byte down,up,press;
  274.         void get(void);
  275. };
  276.  
  277. :void keyboard::get(void)
  278. {
  279.        
  280. }
  281.  
  282. :struct system_colors
  283. {
  284.         dword frame,grab,grab_button,grab_button_text,grab_text,
  285.               work,work_button,work_button_text,work_text,work_graph;
  286.         void get();
  287. };
  288.  
  289. :void system_colors::get()
  290. {
  291.         EAX = 48;
  292.         EBX = 3;
  293.         ECX = #frame;
  294.         EDX = 40;
  295.         $int 0x40
  296. }
  297.  
  298. //------------------------------------------------------------------------------
  299. :dword wait_event_code;
  300. inline fastcall dword WaitEvent()
  301. {
  302.         $mov eax,10
  303.         $int 0x40
  304.         wait_event_code = EAX;
  305.         //if(wait_event_code==evMouse) MOUSE.get();
  306.         //return wait_event_code;
  307. }
  308.  
  309. inline fastcall dword CheckEvent()
  310. {
  311.         $mov eax,11
  312.         $int 0x40
  313. }
  314.  
  315. inline fastcall dword WaitEventTimeout(EBX)
  316. {
  317.         $mov eax,23
  318.         $int 0x40
  319. }
  320.  
  321. inline fastcall SetEventMask(EBX)
  322. {
  323.         $mov eax,40
  324.         $int 0x40
  325. }
  326.  
  327. inline fastcall ScancodesGeting(){
  328.         $mov eax,66
  329.         $mov ebx,1
  330.         $mov ecx,1 //᪠­ª®¤ë
  331.         $int 0x40
  332. }
  333.  
  334. inline fastcall word GetKey()  //+Gluk fix
  335. {
  336.                 $push edx
  337. GETKEY:
  338.                 $mov  eax,2
  339.                 $int  0x40
  340.                 $cmp eax,1
  341.                 $jne GETKEYI
  342.                 $mov ah,dh
  343.                 $jmp GETKEYII //jz?
  344. GETKEYI:
  345.                 $mov dh,ah
  346.                 $jmp GETKEY
  347. GETKEYII:
  348.                 $pop edx
  349.                 $shr eax,8
  350. }
  351.  
  352. inline fastcall int GetFullKey()
  353. {
  354.         $mov  eax,2
  355.         $int  0x40
  356. }
  357.  
  358.  
  359. inline fastcall pause(EBX)
  360. {
  361.         $mov eax, 5
  362.         $int 0x40
  363. }
  364.  
  365. inline fastcall word GetButtonID()
  366. {
  367.         $mov eax,17
  368.         $int  0x40
  369.         $shr eax,8
  370. }
  371.  
  372. inline fastcall dword GetFreeRAM()
  373. {
  374.         $mov eax, 18
  375.         $mov ebx, 16
  376.         $int 0x40
  377.         //return eax = ðàçìåð ñâîáîäíîé ïàìÿòè â êèëîáàéòàõ
  378. }
  379.  
  380. inline void draw_line(dword x1,y1,x2,y2,color)
  381. {
  382.         x2--;y2--;y1--;
  383.         $mov EAX,38
  384.         EBX = x1<<16;
  385.         EBX |= x2;
  386.         ECX = y1<<16;
  387.         ECX |= y2;
  388.         $mov EDX,color
  389.         $int 0x40
  390. }
  391.  
  392. inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà
  393. {
  394.         $mov eax, 68
  395.         $mov ebx, 16
  396.         $int 0x40
  397.         //return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà
  398. }
  399.  
  400. inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó
  401. {
  402.         $mov eax, 68
  403.         $mov ebx, 17
  404.         $int 0x40
  405.         //return eax = îïðåäåëÿåòñÿ äðàéâåðîì
  406. }
  407.  
  408. struct proc_info
  409. {
  410.         #define SelfInfo -1
  411.         dword   use_cpu;
  412.         word    pos_in_stack,num_slot,rezerv1;
  413.         unsigned char name[11];
  414.         char    rezerv2;
  415.         dword   adress,use_memory,ID,left,top,width,height;
  416.         word    status_slot,rezerv3;
  417.         dword   work_left,work_top,work_width,work_height;
  418.         char    status_window;
  419.         dword   cwidth,cheight;
  420.         byte    reserved[1024-71-8];
  421. };
  422.  
  423. inline fastcall void GetProcessInfo(EBX, ECX)
  424. {
  425.         $mov eax,9;
  426.         $int  0x40
  427.         DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth
  428.         DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight
  429. }
  430.  
  431. inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
  432. {
  433.         $mov eax,34
  434.         $int 0x40
  435. }
  436.  
  437. inline fastcall int GetProcessSlot( ECX)
  438. {
  439.         EAX = 18;
  440.         EBX = 21;
  441.         $int 0x40
  442. }
  443.  
  444. inline fastcall int GetActiveProcess()
  445. {
  446.         EAX = 18;
  447.         EBX = 7;
  448.         $int 0x40
  449. }
  450.  
  451. :int CheckActiveProcess(int Form_ID)
  452. {
  453.         int id9=GetProcessSlot(Form_ID);
  454.         if (id9==GetActiveProcess()) return 1;
  455.         return 0;
  456. }
  457.  
  458. inline fastcall void ActivateWindow( ECX)
  459. {
  460.         EAX = 18;
  461.         EBX = 3;
  462.         $int 0x40
  463. }
  464.  
  465. inline fastcall int MinimizeWindow()
  466. {
  467.         EAX = 18;
  468.         EBX = 10;
  469.         $int 0x40
  470. }
  471.  
  472. inline fastcall int CreateThread(ECX,EDX)
  473. {
  474.         $mov eax,51
  475.         $mov ebx,1
  476.         $int 0x40
  477. }
  478.  
  479. inline fastcall void SwitchToAnotherThread()
  480. {
  481.         $mov eax,68
  482.         $mov ebx,1
  483.         $int 0x40
  484. }
  485.  
  486. inline fastcall int SendWindowMessage( ECX, EDX)
  487. {
  488.         $mov eax, 72
  489.         $mov ebx, 1
  490.         $int 0x40
  491. }
  492.  
  493. inline fastcall int KillProcess( ECX)
  494. {
  495.         $mov eax,18;
  496.         $mov ebx,18;
  497.         $int 0x40
  498. }
  499.  
  500. #define TURN_OFF 2
  501. #define REBOOT 3
  502. #define KERNEL 4
  503. inline fastcall int ExitSystem( ECX)
  504. {
  505.         $mov eax, 18
  506.         $mov ebx, 9
  507.         $int 0x40
  508. }
  509.  
  510. inline fastcall ExitProcess()
  511. {
  512.         $mov eax,-1;
  513.         $int 0x40
  514. }
  515.  
  516. //------------------------------------------------------------------------------
  517.  
  518. //eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
  519. inline fastcall int GetSystemLanguage()
  520. {
  521.         EAX = 26;
  522.         EBX = 5;
  523.         $int 0x40
  524. }
  525.  
  526. inline fastcall GetSkinHeight()
  527. {
  528.         $push ebx
  529.         $mov  eax,48
  530.         $mov  ebx,4
  531.         $int 0x40
  532.         $pop  ebx
  533. }
  534.  
  535. inline fastcall void SetSystemSkin( ECX)
  536. {
  537.         EAX = 48;
  538.         EBX = 8;
  539.         $int 0x40
  540. }
  541.  
  542. inline fastcall int GetScreenWidth()
  543. {
  544.         $mov eax, 14
  545.         $int 0x40
  546.         $shr eax, 16
  547. }
  548.  
  549. inline fastcall int GetScreenHeight()
  550. {
  551.         $mov eax, 14
  552.         $int 0x40
  553.         $and eax,0x0000FFFF
  554. }
  555.  
  556. inline fastcall int GetClientTop()
  557. {
  558.         $mov eax, 48
  559.         $mov ebx, 5
  560.         $int 0x40
  561.     $mov eax, ebx
  562.     $shr eax, 16
  563. }
  564.  
  565. inline fastcall int GetClientHeight()
  566. {
  567.         $mov eax, 48
  568.         $mov ebx, 5
  569.         $int 0x40
  570.     $mov eax, ebx
  571. }
  572.  
  573.  
  574. inline fastcall dword LoadLibrary( ECX)
  575. {
  576.         $mov eax, 68
  577.         $mov ebx, 19
  578.         $int  0x40
  579. }
  580.  
  581. inline fastcall int TestBit( EAX, CL)
  582. {
  583.         $shr eax,cl
  584.         $and eax,1
  585. }
  586.  
  587. inline fastcall int PlaySpeaker( ESI)
  588. {
  589.         $mov eax, 55
  590.         $mov ebx, 55
  591.         $int 0x40
  592. }
  593.  
  594. inline fastcall void debugln( EDX)
  595. {
  596.         $push eax
  597.         $push ebx
  598.         $push ecx
  599.         $mov eax, 63
  600.         $mov ebx, 1
  601. NEXT_CHAR:
  602.         $mov ecx, DSDWORD[edx]
  603.         $or      cl, cl
  604.         $jz  DONE
  605.         $int 0x40
  606.         $inc edx
  607.         $jmp NEXT_CHAR
  608. DONE:
  609.         $mov cl, 13
  610.         $int 0x40
  611.         $mov cl, 10
  612.         $int 0x40
  613.         $pop ecx
  614.         $pop ebx
  615.         $pop eax
  616. }
  617.  
  618. inline fastcall void debug( EDX)
  619. {
  620.         $push eax
  621.         $push ebx
  622.         $push ecx
  623.         $mov eax, 63
  624.         $mov ebx, 1
  625. NEXT_CHAR:
  626.         $mov ecx, DSDWORD[edx]
  627.         $or      cl, cl
  628.         $jz  DONE
  629.         $int 0x40
  630.         $inc edx
  631.         $jmp NEXT_CHAR
  632. DONE:
  633.         $pop ecx
  634.         $pop ebx
  635.         $pop eax
  636. }
  637.  
  638.  
  639. inline fastcall void debugch( ECX)
  640. {
  641.         $push eax
  642.         $push ebx
  643.         $mov eax,63
  644.         $mov ebx,1
  645.         $int 0x40
  646.         $pop ebx
  647.         $pop eax
  648. }
  649. //------------------------------------------------------------------------------
  650.  
  651. void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, EDI, ESI)
  652. {
  653.         EAX = 12;              // function 12:tell os about windowdraw
  654.         EBX = 1;
  655.         $int 0x40
  656.        
  657.         $xor EAX,EAX
  658.         EBX = x << 16 + size_w;
  659.         ECX = y << 16 + size_h;
  660.  
  661.         EDX = WindowType << 24 | WindowAreaColor;
  662.         $int 0x40
  663.  
  664.         EAX = 12;              // function 12:tell os about windowdraw
  665.         EBX = 2;
  666.         $int 0x40
  667. }
  668.  
  669. inline fastcall MoveSize( EBX,ECX,EDX,ESI)
  670. {
  671.         $mov eax, 67
  672.         $int 0x40
  673. }
  674.  
  675. inline fastcall void DrawTitle( ECX)
  676. {
  677.         EAX = 71;
  678.         EBX = 1;
  679.         $int 0x40;
  680. }
  681.  
  682. void WriteTextB(dword x,y,byte fontType, dword color, EDX)
  683. {
  684.         EAX = 4;
  685.         EBX = x<<16+y;
  686.         ECX = fontType<<24+color;
  687.         ESI = 0;
  688.         $int 0x40;
  689.         $add ebx, 1<<16
  690.         $int 0x40
  691. }
  692.  
  693. void WriteText(dword x,y,byte fontType, dword color, EDX)
  694. {
  695.         EAX = 4;
  696.         EBX = x<<16+y;
  697.         ECX = fontType<<24+color;
  698.         $int 0x40;
  699. }
  700.  
  701. dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI)
  702. {
  703.         EAX = 4;
  704.         EBX = x<<16+y;
  705.         ECX = fontType<<24+color;
  706.         $int 0x40;
  707. }
  708.  
  709. void WriteNumber(dword x,y,byte fontType, dword color, count, ECX)
  710. {
  711.         EAX = 47;
  712.         EBX = count<<16;
  713.         EDX = x<<16+y;
  714.         ESI = fontType<<24+color;
  715.         $int 0x40;
  716. }
  717.  
  718. void CopyScreen(dword EBX, x, y, w, h)
  719. {
  720.   EAX = 36;
  721.   ECX = w << 16 + h;
  722.   EDX = x << 16 + y;
  723.   $int  0x40;
  724. }
  725.  
  726. :dword GetPixelColor(dword x, x_size, y)
  727. {
  728.         $mov eax, 35
  729.         EBX= y*x_size+x;
  730.         $int 0x40
  731. }
  732.  
  733.  
  734. void _PutImage(dword x,y, w,h, EBX)
  735. {
  736.         EAX = 7;
  737.         ECX = w<<16+h;
  738.         EDX = x<<16+y;
  739.         $int 0x40
  740. }
  741.  
  742. void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI)
  743. {
  744.         EAX = 65;
  745.         ECX = w<<16+h;
  746.         EDX = x<<16+y;
  747.         EBP = 0;
  748.         $int 0x40
  749. }
  750.  
  751. inline fastcall void PutPixel( EBX,ECX,EDX)
  752. {
  753.   EAX=1;
  754.   $int 0x40
  755. }
  756.  
  757. void DrawBar(dword x,y,w,h,EDX)
  758. {
  759.         if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :)
  760.         EAX = 13;
  761.         EBX = x<<16+w;
  762.         ECX = y<<16+h;
  763.         $int 0x40
  764. }
  765.  
  766. void DefineButton(dword x,y,w,h,EDX,ESI)
  767. {
  768.         EAX = 8;
  769.         $push edx
  770.         EDX += BT_DEL;
  771.         $int 0x40;
  772.         $pop edx
  773.         EBX = x<<16+w;
  774.         ECX = y<<16+h;
  775.         $int 0x40
  776. }
  777.  
  778. inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE)
  779. {
  780.         EAX = 18;
  781.         EBX = 22;
  782.         ECX = 3;
  783.         EDX = ID_REFRESH;
  784.         $int 0x40
  785.         EAX = 18;
  786.         EBX = 3;
  787.         EDX = ID_ACTIVE;
  788.         $int 0x40
  789. }
  790.  
  791. inline getIPC(ECX,EDX)
  792. {
  793.         $mov EAX,60
  794.         $mov EBX,2
  795.         $int 0x40
  796. }
  797.  
  798. inline sendIPC(ECX,EDX,ESI)
  799. {
  800.         $mov EAX,60
  801.         $mov EBX,1
  802.         $int 0x40
  803. }
  804.  
  805. void UnsafeDefineButton(dword x,y,w,h,EDX,ESI)
  806. {
  807.         EAX = 8;
  808.         EBX = x<<16+w;
  809.         ECX = y<<16+h;
  810.         $int 0x40
  811. }
  812.  
  813. inline fastcall void DeleteButton( EDX)
  814. {
  815.         EAX = 8;
  816.         EDX += BT_DEL;
  817.         $int 0x40;
  818. }
  819.  
  820. inline fastcall dword GetStartTime()
  821. {
  822.         $mov eax,26
  823.         $mov ebx,9
  824.         $int 0x40
  825. }
  826.  
  827. :dword ALERT_TEXT;
  828. :void dialog_alert()
  829. {
  830.         byte id;
  831.         loop()switch(WaitEvent())
  832.         {
  833.                 case evReDraw:
  834.                         DefineAndDrawWindow(215,100,250,200,0x34,0xFFFFFF,"Alert");
  835.                         WriteTextB(5,5,0x90,0x0,ALERT_TEXT);
  836.                 break;
  837.                 case evKey:
  838.                 case evButton:
  839.                         id=GetButtonID();
  840.                         if (id==1) ExitProcess();
  841.                 break;
  842.         }
  843. }
  844.  
  845. :dword alert(dword text)
  846. {
  847.         dword mem = malloc(4096);
  848.         ALERT_TEXT = text;
  849.         CreateThread(#dialog_alert,mem+4092);
  850.         return mem;
  851. }
  852.  
  853. :struct _screen
  854. {
  855.         dword width,height;
  856. } screen;
  857.  
  858. :struct _skin
  859. {
  860.         dword width,height;
  861. } SKIN;
  862.  
  863. dword __generator;  // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
  864.  
  865. :dword program_path_length;
  866.  
  867. //The initialization of the initial data before running
  868. void load_init_main()
  869. {
  870.         SKIN.height   = GetSkinHeight();
  871.        
  872.         screen.width  = GetScreenWidth();
  873.         screen.height = GetScreenHeight();
  874.        
  875.         //program_path_length = strlen(I_Path);
  876.         MOUSE_TIME = 50; //Default 500 ms.
  877.         __generator = GetStartTime();
  878.         //mem_Init();
  879.         main();
  880. }
  881.  
  882. #endif