Subversion Repositories Kolibri OS

Rev

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

  1. ;Œ ªà®á ¤«ï ¢ë¢®¤  ®á­®¢­ëå ä㭪権 ª®â®àë¥ ¨á¯«ì§ãîâáï ¡®ªá®¬
  2. macro use_general_func
  3. {
  4. ;debug_func
  5. ;----------------------------------------------------------
  6. ;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ¢ë¤¥«¥­®© ç á⨠-----------------
  7. ;----------------------------------------------------------
  8. .draw_shift:
  9.         test    word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
  10.         jz      @f
  11.         mov     ebp,shift_color
  12.         mov     ebx,dword       ed_shift_pos
  13.         call    .sh_cl_
  14. @@:     ret
  15. ;----------------------------------------------------------
  16. ;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ⥪áâ  --------------------------
  17. ;----------------------------------------------------------
  18. .draw_text:
  19. ;--- ¢ëç¨á«ï¥¬, ᪮«ìª® ¯®¬¥é ¥âáï ᨬ¢®«®¢ ---
  20. ;--- çâ®¡ë ¬ãá®à ­¥ à¨á®¢ âì ---
  21.         call    .get_n
  22.         mov     esi,ed_size
  23.         mov     ebx,ed_offset
  24.         sub     esi,ebx
  25.         cmp     eax,esi
  26.         jae     @F
  27.         mov     esi,eax         ;çâ®¡ë ­¥ ¢ë室¨âì §  ¯à¥¤¥«ë íªà ­ 
  28. ;--- à¨á㥬 ⥪áâ ---                                            
  29. @@:     mov     eax,4
  30.         mov     ebx,ed_left
  31.         mov     edx,ed_offset
  32.         add     ebx,2
  33.         shl     ebx,16
  34.         mov     bx,ed_top
  35.         add     ebx,4
  36.         mov     ecx,ed_text_color
  37.         add     edx,ed_text
  38.         mcall
  39. ret
  40. ;----------------------------------------------------------
  41. ;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ä®­  ----------------------------
  42. ;¢å®¤­ë¥ ¤ ­­ë¥
  43. ;eax
  44. ;edx - color
  45. ;----------------------------------------------------------
  46. ;¢å®¤ ⮫쪮 梥â edx
  47. .draw_bg:
  48.         mov     ebx,ed_left
  49.         add     ebx,1
  50.         shl     ebx,16
  51.         mov     bx,ed_width
  52.         sub     ebx,1
  53.         mov     edx,ed_color
  54. .draw_bg_eax:
  55.         mov     ecx,ed_top
  56.         mov     eax,13
  57.         add     ecx,1
  58.         shl     ecx,16
  59.         mov     cx,ed_height
  60.         dec     ecx
  61.         mcall  
  62. ret
  63.  
  64. ;----------------------------------------------------------
  65. ;--- ¯à®æ¥¤ãà  ¯®«ã祭¨ï ª®«¨ç¥á⢠ ᨬ¢®«®¢ ¢ ⥪ã饩 é¨à¨­¥ ª®¬¯®­¥­â 
  66. ;----------------------------------------------------------
  67. .get_n:
  68.         mov     eax,ed_width    ;¯®«ã祬 è¨à¨­ã ª®¬¯®­¥­â 
  69.         xor     edx,edx   ;१ã«ìâ â à á¯®«®£ ¥âáï ¢ ¯ à¥ edx:eax ¢ eax - ®áâ â®ª
  70.         sub     eax,4           ;¢ëç⨬ 4
  71.         mov     ebx,6           ;§ £à㧬¨ ¤¥«¨â¥«ì
  72.         div     ebx             ;à §¬¤¥«¨¬ ­  6
  73. ret
  74. ;----------------------------------------------------------
  75. ;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï ªãàá®à  --------------------------
  76. ;----------------------------------------------------------
  77. ;¢å®¤­ë¥ ebp- 梥â
  78. .clear_cursor:
  79.         mov     edx,ebp
  80.         mov     ebx,cl_curs_x
  81.         mov     ecx,cl_curs_y
  82.         jmp     .draw_curs
  83. .draw_cursor:
  84.         mov     edx,ed_text_color
  85.         mov     ebx,ed_pos
  86.         mov     ecx,ed_offset
  87.         sub     ebx,ecx
  88.  
  89.         lea     ebx,[ebx*2+ebx]
  90.         shl     ebx,1
  91.         ;imul   ebx,6
  92.         add     bx,ed_left
  93.         mov     ecx,ed_top
  94.         inc     ebx
  95.         add     ecx,2
  96.         mov     ebp,ebx
  97.         shl     ebx,16
  98.         mov     bx,bp
  99.         mov     ebp,ecx
  100.        
  101.         shl     ecx,16
  102.         mov     cx,bp
  103.         add     cx,ed_height-4
  104.        
  105.         mov     cl_curs_x,ebx
  106.         mov     cl_curs_y,ecx
  107. .draw_curs:              
  108.         mcall   38
  109. ret
  110. ;----------------------------------------------------------
  111. ;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï à ¬ª¨ ----------------------------
  112. ;----------------------------------------------------------
  113. .draw_border:
  114. ;--- 梥â à ¬ª¨ ---
  115.         test    word ed_flags,ed_focus
  116.         mov     edx,ed_focus_border_color
  117.         jne     @f
  118.         mov     edx,ed_blur_border_color
  119. @@:
  120. ;--- ᢥàåã ---
  121.         mov     eax,38
  122.         mov     ebx,ed_left
  123.         mov     ecx,ebx
  124.         shl     ebx,16
  125.         mov     bx,cx
  126.         add     bx,ed_width
  127.         mov     ecx, ed_top
  128.         mov     esi,ecx
  129.         shl     ecx,16
  130.         mov     cx,si
  131.         mcall
  132. ;--- á­¨§ã ---
  133.         mov     esi,ecx
  134.         add     ecx,ed_height
  135.         mov     ebp,ecx
  136.         shl     ecx,16
  137.         mov     cx,bp
  138.         mcall
  139. ;--- á«¥¢  ---
  140.         mov     cx,si
  141.         mov     ebp,ebx
  142.         sub     bx,ed_width
  143.         mcall
  144. ;--- á¯à ¢  ---
  145.         mov     ebx,ebp
  146.         shl     ebx,16
  147.         mov     bx,bp
  148.         mcall
  149. ret
  150. ;----------------------------------------------------------
  151. ;--- ¯à®¢¥àª , § è¥« «¨ ªãàá®à §  £à ­¨æë ¨, ¥á«¨ ­ ¤®, ---
  152. ;--- ¨§¬¥­ï¥¬ ᬥ饭¨¥ ------------------------------------
  153. ;--- ¥á«¨ ᬥ饭¨¥ ¡ë«® ãáâ ­®¢ª  ä« £  ed_offset_cl ¨­ ç¥
  154. ; ¥á«¨ ­¨ç¥£® ­¥ ¨§¬¥­¨«®áì â® ¢ëáâ ¢«¥­¨¥ ed_offset_fl
  155. ; ¢ ®¡é¥© ¡¨â®¢®© ¬ àà¨æ¥ á®áâ®ï­¨ï ª®¬¯®­¥­â®¢ word ed_flags
  156. ;----------------------------------------------------------
  157. .check_offset:
  158. pusha
  159.         mov     ecx,ed_pos
  160.         mov     ebx,ed_offset
  161.         cmp     ebx,ecx
  162.         ja      .sub_8
  163.  
  164.         push    ebx
  165.         call    .get_n                  ;¯®«ã稬 ª®«-¢® ᨬ¢®«®¢ ¢ ¯ à¥ ॣ¨áâ஢ edx:eax
  166.         pop     ebx
  167.         mov     edx,ebx
  168.         add     edx,eax         ;ed_offset+width editbox
  169.         inc     edx             ;­¥®¡å®¤¨¬® ¤«ï ­®¬ «ì­®£® ¯®«®¦¥­¨ï ªãàá®à  ¢ ªà ©­¥© «¥¢®© ¯®§¨æ¨¨
  170.         cmp     edx,ecx
  171.         ja      @f
  172.  
  173.         mov     edx,ed_size
  174.         cmp     edx,ecx
  175.         je      .add_end
  176.  
  177.         sub     edx,ecx
  178.         cmp     edx,8
  179.         jbe     .add_8
  180.         add     ebx,8
  181.         jmp     .chk_d
  182.  
  183. .sub_8: cmp     ecx,0
  184.         je      .sub_min
  185.         cmp     ebx,8
  186.         jbe     .sub_min
  187.         sub     ebx,8   ;ebx=ed_offset
  188.         jmp     .chk_d
  189. .sub_min:
  190.         xor     ebx,ebx
  191.         jmp     .chk_d
  192.  
  193. .add_end:sub    edx,eax
  194.         mov     ebx,edx
  195.         jmp     .chk_d
  196. .add_8: add     ebx,edx
  197. .chk_d: mov     ed_offset,ebx
  198.         call    .draw_bg
  199.         and     word ed_flags,ed_offset_cl
  200. edit_ex
  201. @@:
  202.         or      word ed_flags,ed_offset_fl
  203. edit_ex
  204. }
  205.  
  206. macro use_key_func
  207. {
  208. ;Ž¡à ¡®âª  Shift ¤«ï á­ïâ¨ï ¢ë¤¥«¥­¨ï ­¥¨§¢¥áâ­®© ®¡« áâ¨
  209. .shift: ;;;;;;;SHIFT
  210.         test    word ed_flags,ed_shift
  211.         je      .f_exit
  212.  
  213. @@:     mov     ebp,shift_color
  214.         or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
  215.         mov     ebx,dword       ed_shift_pos
  216.         call    .sh_cl_
  217.         jmp     .draw_cursor_text
  218. ;;;;;;;;;;;;;;;;;;;;;
  219. .f_exit:call    .check_offset
  220.         and     word ed_flags,ed_shift_cl
  221.         call    .enable_null
  222.         jmp     .draw_cursor_text
  223. .sh_cl_:
  224. ;;;;;;SHIFT end
  225. ;®¡à ¡®âª  ®ç¨á⪨, ¯à¨ «¥¢®¬ - ¯à ¢®¬ ¤¢¨¦¥­¨¨ ¢ë¤¥«¥­¨ï
  226. ;¤«ï ®¡à ¡®âª¨ á­ïâ¨ï ¢ë¤¥«¥­¨ï
  227. ;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
  228.         mov     eax,dword       ed_pos
  229.         cmp     eax,ebx
  230.  
  231.         jae     .sh_n
  232.         push    eax  ;¬¥­ì襥 ¢ eax
  233.         push    ebx  ;¡®«ì襥
  234.         jmp     .sh_n1
  235.                      ;¥á«¨ ¨­ ç¥
  236. .sh_n:  push    ebx  
  237.         push    eax
  238. .sh_n1:
  239.         call    .check_offset
  240.         call    .get_n
  241.         mov     edx,eax ;size of ed_box
  242.         mov     ecx,ed_offset
  243.         add     eax,ecx ;eax = w_off= ed_offset+width
  244.         mov     edx,eax ;save
  245.         pop     ebx     ;¡®«ì襥
  246.         pop     eax     ;¬¥­ì襥
  247.  
  248.         cmp     eax,ecx         ;áà ¢­¥­¨¥ á ¬¥­ì襣® á offset.
  249.         jae     .f_f            ;¥á«¨ ¡®«ìè¥
  250.         xor     eax,eax
  251.         cmp     edx,ebx         ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
  252.         jb      @f
  253.         sub     ebx,ecx
  254.         jmp     .nxt_f
  255. @@:     mov     ebx,edx
  256.         sub     ebx,ecx
  257.         jmp     .nxt_f
  258. .f_f:  
  259.         sub     eax,ecx
  260.         cmp     edx,ebx         ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
  261.         jle     @f
  262.         sub     ebx,ecx
  263.         sub     ebx,eax
  264.         jmp     .nxt_f
  265. @@:
  266.         mov     ebx,edx
  267.         sub     ebx,ecx
  268.         sub     ebx,eax
  269. .nxt_f:
  270.         mov     edx,ebx
  271.         lea     ebx,[eax*2+eax]
  272.         shl     ebx,1
  273.         add     ebx,ed_left
  274.         inc     ebx
  275.         shl     ebx,16
  276.         lea     ecx,[edx*2+edx]
  277.         shl     ecx,1  
  278.         mov     bx,cx
  279.         inc     ebx
  280.         mov     edx,ebp;shift_color
  281.  
  282.         call    .draw_bg_eax
  283. @@:     call    .enable_null
  284.         ret
  285. ;;;;;;;;;;;;;;;;;;;;;
  286. ;“áâ ­®¢ª - á­ï⨥ ¢ë¤¥«¥­¨ï ¢ ®¤¨­ ᨬ¢®«
  287. ;;;;;;;;;;;;;;;;;;;;;
  288. .drw_sim:
  289.         mov     eax,dword       ed_pos
  290.         call    .draw_rectangle   ;­ à¨á®¢ âì ¯àאַ㣮«ì­¨ª á § ¤ ­­ë¬ 梥⮬
  291.         jmp     @b
  292. ;;;;;;;;;;;;;;;;;;;;;
  293. ;”ãªæ¨ï ãáâ ­®¢ª¨ ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨ï ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
  294. ;‹®£¨ª :
  295. ;;;;;;;;;;
  296. .draw_wigwag:
  297. ;äã­ªæ¨ï ãáâ ­®¢ª¨ ¯¥à¥¬¥­­ëå
  298.         mov     ebp,shift_color
  299.         call    .clear_cursor
  300.  
  301.         or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
  302.         mov     ebp,shift_color
  303.         mov     eax,dword       ed_pos
  304.         test    word ed_flags,ed_left_fl
  305.         jz      .low
  306.         jmp     @f
  307. ;;;;;;;;;;
  308. ;”ãªæ¨ï 㤠«¥­¨ï ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨ï ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
  309. ;‹®£¨ª :
  310. ;;;;;;;;;;
  311. .draw_wigwag_cl:
  312. ;äã­ªæ¨ï ãáâ ­®¢ª¨ ¯¥à¥¬¥­­ëå
  313.         mov     ebp,ed_color
  314.         call    .clear_cursor
  315.  
  316.         mov     ebp,ed_color
  317.         mov     eax,dword       ed_pos
  318.         test    word ed_flags,ed_left_fl
  319.         jz      .low
  320. @@:     call    .draw_rectangle  ;­ à¨á®¢ âì ¯àאַ㣮«ì­¨ª § ªà è¨¢ ¥¬®© ®¡« áâ¨
  321.         ret
  322. .low:   dec     eax
  323.         jmp     @b
  324. ;¢å®¤­®© ¯ à ¬¥âà ebx - ed_pos
  325. .sh_first_sh:
  326.         test    word ed_flags,ed_shift
  327.         je      @f
  328.         mov     dword ed_shift_pos_old,ebx
  329.         test    word ed_flags,ed_shift_on
  330.         jne     @f
  331.         mov     dword ed_shift_pos,ebx
  332.         or      word ed_flags,ed_shift_on
  333. @@:     ret
  334. ;Ž¡à ¡®âª  ªà ©­¨å ¯®«®¦¥­¨© ¢ editbox ¯à¨ ­ ¦ â®¬ shift
  335. ;¯à®¨§¢®¤¨â á­ï⨥ ¢ë¤¥«¥­¨¥, ¥á«¨ ­¥â shift
  336. ;¨­ ç¥ ¢®®¡é¥ ¢ë室¨â
  337. .sh_st_of:
  338.         test    word ed_flags,ed_shift
  339.         jne     @f
  340.         test    word ed_flags,ed_shift_bac
  341.         je      @f
  342.         mov     ebp,ed_color
  343.         mov     ebx,dword       ed_shift_pos
  344.         call    .sh_cl_  ;®ç¨á⪠ ¢ë¤¥«¥­®£® äà £¬¥­â 
  345.         and     word ed_flags,ed_shift_cl ; ®ç¨á⪠ ®â ⮣® çâ® ã¡à «¨ ¢ë¤¥«¥­¨¥
  346.         jmp     .draw_cursor_text
  347. @@:
  348.         and     word ed_flags,ed_shift_off
  349. edit_ex
  350. ;¯à®¢¥àª  á®áâ®ï­¨ï shift ¡ë« «¨ ®­ ­ ¦ â à ­ìè¥?
  351. .sh_enable:
  352.         test    word ed_flags,ed_shift
  353.         jne     .sh_ext_en ;­ à¨á®¢ âì § ªà è¥­ë© ¯àאַ㣮«ì­¨ª
  354.  
  355.         test    word ed_flags,ed_shift_bac
  356.         je      @f
  357.         call    .check_offset
  358.  
  359.         mov     ebp,ed_color
  360.         mov     ebx,dword       ed_shift_pos
  361.         call    .sh_cl_  ;®ç¨á⪠ ¢ë¤¥«¥­®£® äà £¬¥­â 
  362.         call    .draw_wigwag_cl
  363.         and     word ed_flags,ed_shift_cl ; 1¢ à ­¥ ­ã¦­®
  364.         ret
  365.  
  366. @@:     mov     ebp,ed_color
  367.         call    .clear_cursor
  368.         call    .check_offset
  369.         ret
  370. .sh_ext_en:    
  371.         call    .check_offset
  372.         test    word ed_flags,ed_offset_fl
  373.         je      @f
  374. ;¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
  375.         mov     eax,dword       ed_shift_pos
  376.         mov     ebx,dword       ed_pos
  377.         mov     ecx,dword       ed_shift_pos_old
  378. ;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­ëå ®¡« á⥩
  379.         cmp     eax,ecx
  380.         je      .1_shem
  381.         jb      .smaller
  382.         cmp     ecx,ebx
  383.         ja      .1_shem
  384.         call    .draw_wigwag_cl ;clear
  385.         jmp     .sh_e_end
  386. .smaller:
  387.         cmp     ecx,ebx
  388.         jb      .1_shem
  389.         call    .draw_wigwag_cl ;clear
  390.         jmp     .sh_e_end
  391. ;alike  =
  392. .1_shem: call   .draw_wigwag
  393. .sh_e_end:      and     word ed_flags,ed_shift_off
  394.         ret
  395. @@:     mov     ebp,shift_color
  396.         mov     ebx,dword       ed_shift_pos
  397.         call    .sh_cl_
  398.         jmp     .sh_e_end
  399. ;äã­ªæ¨ï ¤«ï ®¡à ¡®âª¨ shift ¯à¨ ­ ¦ â¨¨ home and end
  400. .sh_home_end:
  401.         mov     ebp,ed_color
  402.         call    .clear_cursor
  403.         test    word ed_flags,ed_shift_bac
  404.         je      @f
  405.         mov     ebp,ed_color
  406.         mov     ebx,dword       ed_shift_pos_old
  407.         call    .sh_cl_
  408.  
  409. @@:     test    word ed_flags,ed_shift
  410.         je      .sh_exit_ ;¢ë©â¨
  411.         mov     ebp,shift_color
  412.         mov     ebx,dword       ed_shift_pos
  413.         call    .sh_cl_
  414.         or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
  415.         jmp     .sh_e_end
  416. .sh_exit_:      call    .check_offset
  417.         ret
  418. ;äã­ªæ¨ï ¢­¥á¥­¨ï 0 ¯®  ¤à¥áã ed_size+1
  419. .enable_null:
  420.         pusha
  421.         mov     eax,ed_size
  422.         mov     ebx,ed_text
  423.         test    eax,eax
  424.         add     eax,ebx
  425.         jne     @f
  426.         inc     eax
  427. @@:     xor     ebx,ebx
  428.         mov     [eax],bl
  429. edit_ex
  430. ;- 㤠«¥­¨¥ ᨬ¢®« 
  431. ;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
  432. .del_char:
  433.         mov     esi,ed_text
  434.         test    word ed_flags,ed_shift_on
  435.         je      @f
  436.         mov     eax,dword ed_shift_pos
  437.         mov     ebx,esi
  438.         cmp     eax,ecx
  439.         jae     .dh_n
  440.  
  441.         mov     ed_pos,eax      ;çâ® ¡ë ­¥ ¡ë«® ã¡¥£ ­¨ï ªãàá®à 
  442.         mov     ebp,ecx
  443.         sub     ebp,eax
  444.         add     ebx,eax  ;eax ¬¥­ìè¥
  445.         sub     edx,ecx
  446.         add     esi,ecx
  447.  
  448.         mov     dword ed_shift_pos,ebp
  449.         jmp     .del_ch_sh
  450.                      ;¥á«¨ ¨­ ç¥
  451. .dh_n:  
  452.         mov     ebp,eax
  453.         sub     ebp,ecx
  454.         add     ebx,ecx
  455.         sub     edx,eax
  456.         add     esi,eax
  457.         mov     dword ed_shift_pos,ebp
  458.         jmp     .del_ch_sh
  459.  
  460. @@:     add     esi,ecx ;㪠§ â¥«ì + ᬥ饭¨¥ ª ॠ«ì­®¬ã ¡ãää¥àã
  461.         mov     ebx,esi
  462.         inc     esi
  463.         cld
  464.  
  465.         sub     edx,ecx
  466. .del_ch_sh:
  467.  
  468.         push    edi
  469.         mov     edi,ebx
  470. @@:
  471.         lodsb
  472.         stosb
  473.         dec edx
  474.         jns @b
  475.        
  476.         pop edi
  477.         ret
  478. ;¢ëç¨á«¨âì § ªà è¨¢ ¥¬ãî ®¡« áâì
  479. ;ᮣ« è¥­¨¥ ¢ ebp - ¯¥à¥¤ ¥âáï ed_size
  480. .clear_bg:
  481.         call    .get_n  ;¯®«ãç¨âì à §¬¥à ¢ ᨬ¢®« å è¨à¨­ë ª®¬¯®­¥­â 
  482.         push    eax
  483.         mov     ebx,ed_offset
  484.         add     eax,ebx ;eax = w_off= ed_offset+width
  485.         mov     ebx,ebp ;ed_size
  486.        
  487.         cmp     eax,ebx
  488.         jb      @f
  489.         mov     eax,ed_pos
  490.         sub     ebx,eax
  491.         mov     ecx,ed_offset
  492.         sub     eax,ecx
  493.         jmp     .nxt
  494. @@:     mov     ebx,ed_pos
  495.         push    ebx
  496.         sub     eax,ebx
  497.         mov     ebx,eax ;It is don't optimal
  498.        
  499.         pop     eax     ;ed_pos
  500.         mov     ecx,ed_offset
  501.         sub     eax,ecx
  502. .nxt:
  503.         mov     ebp,eax  ;¯à®¢¥àª  ­  ¢ë室 § ªà è¨¢ ¥¬®© ®¡« á⨠§  ¯à¥¤¥«ë ¤«¨­ë
  504.         add     ebp,ebx
  505.         pop     edx
  506.         cmp     ebp,edx
  507.         je      @f
  508.         inc     ebx
  509.  
  510. @@:     mov     edx,ebx
  511.         lea     ebx,[eax*2+eax]
  512.         shl     ebx,1
  513.         add     ebx,ed_left
  514.         inc     ebx
  515.         shl     ebx,16
  516.         lea     ecx,[edx*2+edx]
  517.         shl     ecx,1  
  518.         mov     bx,cx
  519.         mov     edx,ed_color
  520.         call    .draw_bg_eax
  521.         ret
  522. ;;;;;;;;;;;;;;;;;;;
  523. ;;; Ž¡à ¡®âª  ¯à¨¬¨â¨¢®¢
  524. ;;;;;;;;;;;;;;;;;;;;
  525. ; à¨á®¢ âì ¯àאַ㣮«ì­¨ª, 梥⠯¥à¥¤ ¥âáï ¢ ebp
  526. ;¢å®¤­ë¥ ¯ à ¬¥âàë:
  527. ;eax=dword ed_pos
  528. ;ebp=-梥â ed_color or shift_color
  529. .draw_rectangle:
  530.         mov     ecx,dword ed_offset
  531.         sub     eax,ecx
  532.         lea     ebx,[eax*2+eax]
  533.         shl     ebx,1
  534.         inc     ebx
  535.         add     ebx,ed_left
  536.         shl     ebx,16
  537.         mov     bx,6
  538.         mov     edx,ebp
  539.         call    .draw_bg_eax
  540.         ret
  541. ;;;;;;;;;;;;;;;;;;
  542. ;;à®¢¥àª  ­ ¦ â «¨ shift
  543. ;;;;;;;;;;;;;;;;;;
  544. .check_shift:
  545. pusha   ;á®åà ­¨¬ ¢á¥ ॣ¨áâàë
  546.         mcall   66,3,1
  547.         test    al,0x03
  548.         je      @f
  549.         or      word ed_flags,ed_shift   ;ãáâ ­®¢¨¬ ä« £
  550. @@:edit_ex
  551. }
  552. ;¬ ªà®á ª« ¢¨è ­  ª®â®àë¥ ¯à®¨á室¨â ॠªæ¨ï
  553. macro use_key_process backspase,delete,left,right,home,end,insert
  554. {
  555. if backspase eq
  556. else
  557.         cmp     ah,8
  558.         jz      .backspace
  559. end if
  560. if delete eq
  561. else
  562.         cmp     ah,0xb6
  563.         jz      .delete
  564. end if
  565. if left eq
  566. else
  567.         cmp     ah,176
  568.         jz      .left
  569. end if
  570. if right eq
  571. else
  572.         cmp     ah,179
  573.         jz      .right
  574. end if
  575. if home eq
  576. else
  577.         cmp     ah,180
  578.         jz      .home
  579. end if
  580. if home eq
  581. else
  582.         cmp     ah,181
  583.         jz      .end
  584. end if
  585. if insert eq
  586. else
  587.         cmp     ah,185  ;insert
  588.         jz      .insert
  589. end if
  590. }
  591. macro use_key_no_process  up,down,esc
  592. {
  593. if up eq
  594. else
  595.         cmp     ah,177
  596.         jz      .no_figure
  597. end if
  598. if down eq
  599. else
  600.         cmp     ah,178
  601.         jz      .no_figure
  602. end if
  603. if esc eq
  604. else
  605.         cmp     ah,27   ;ESC - ª« ¢¨è  ))
  606.         jz      .no_figure
  607. end if
  608. }
  609.  
  610. macro use_key_figures_only
  611. {
  612.         test    word ed_flags,ed_figure_only  ; ⮫쪮 æ¨äàë ?
  613.         jz      @f
  614.         cmp     ah,'0'
  615.         jb      .no_figure
  616.         cmp     ah,'9'
  617.         ja      .no_figure
  618. }
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626. ; Œ ªà®á ¢ë室 
  627. macro edit_ex
  628. {
  629. popa          
  630. ret
  631. }
  632. macro debug
  633. {
  634.         ;-----------  ®â« ¤ª 
  635.         pushad
  636. ;        mov     dword [ed_buffer.2],0
  637. ;        mov     eax,edi
  638.         mov eax,dword [ed_buffer.2]
  639.         mov edi,ed_buffer.3
  640.         call .str
  641.         ;à¨á®¢ ­¨¥ ä®­ 
  642.         mov eax,13
  643.         mov ebx,178*65536+70
  644.         mov ecx,28*65536+10
  645.         xor edx,edx
  646.         int 0x40
  647.         ;¢ë¢®¤ §­ ç¥­¨ï ­  íªà ­
  648.         mov eax,4
  649.         mov ebx,180*65536+30
  650.         mov ecx,0x10DDBBCC
  651.         mov edx,ed_buffer.3
  652.         mov esi,8
  653.         int 0x40
  654.         popad
  655.         ;----------- ®â« ¤ª 
  656. }
  657. macro   debug_func
  658. {
  659. .str:
  660.         mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
  661.          ;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
  662.         cmp eax,ecx  ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
  663.         jb @f
  664.         xor edx,edx  ;®ç¨áâ¨âì edx
  665.         div ecx      ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
  666.         push edx     ;¯®«®¦¨âì ¢ á⥪
  667.         ;dec edi             ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
  668.         call .str;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
  669.         pop eax
  670.         @@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
  671.         ;sbb al,$69  ;- ç¥áâ­® ¤ ­­ ï ¨­áâàãªæ¨ï ¬¥­ï § áâ ¢«ï¥â § ¤ã¬ âìáï â.¥. ï ­¥ §­ î ª ª íâ® à ¡®â ¥â
  672.         ;das        ;¯®á«¥ ¤ ­­®© ª®¬ ­¤ë ª ª ¡ë ¯à®¨á室¨â 㬥­ì襭¨¥ al ­  66h  (¢ ª­¨£¥ ­ ¯¨á ­® ¤à㣮¥)
  673.         or al,0x30  ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥  ç¥¬ ¤¢¥ ¢ëè¥
  674.         stosb       ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
  675.  
  676.         ret         ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
  677. }