Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | 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      .editbox_exit
  597. end if
  598. if down eq
  599. else
  600.         cmp     ah,178
  601.         jz      .editbox_exit
  602. end if
  603. if esc eq
  604. else
  605.         cmp     ah,27   ;ESC - ª« ¢¨è  ))
  606.         jz      .editbox_exit
  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      .editbox_exit
  616.         cmp     ah,'9'
  617.         ja      .editbox_exit
  618. @@:
  619. }
  620. macro are_key_shift_press
  621. {
  622.         test    word ed_flags,ed_shift_on
  623.         je      @f
  624.         ;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
  625.         push    eax
  626.         mov     edx,ed_size
  627.         mov     ecx,ed_pos
  628.         pusha
  629. ;;;;;;;;;;;;;;;;;;;;;
  630.         mov     ebp,ed_color
  631.         mov     ebx,dword       ed_shift_pos
  632.         call    .sh_cl_
  633. ;;;;;;;;;;;;;;;;;;;;;
  634.         popa
  635.         call    .del_char
  636. ;;;;
  637.         mov     eax,dword ed_shift_pos
  638.         mov     ebx,ed_size
  639.         sub     ebx,eax
  640.         mov     ed_size,ebx
  641.         pop     eax
  642. @@:
  643. }
  644. macro are_key_cur_end
  645. {
  646.         mov     ecx,ed_size
  647.         mov     edx, ed_max
  648.         test    word ed_flags,ed_insert
  649.         jne     @f
  650.         cmp     ecx,edx
  651.         jae     .editbox_exit
  652. @@:     mov     ebx, ed_pos
  653.         cmp     ebx,edx
  654.         jl      @f ; ¥á«¨ ¬¥­ìè¥ ¨«¨ à ¢­®
  655.         jmp     .editbox_exit
  656.  
  657. @@:     ; ᤢ¨£ ¥¬ ᨬ¢®«ë ¯®á«¥ ªãàá®à  ¢¯à ¢®
  658.         mov     ecx,ed_size
  659.         push    edi eax
  660.         mov     ebp,edi
  661.         mov     esi,ed_text     ; “ª § â¥«ì ­  ¡ãä¥à
  662.                                 ;ã¤¥¬ à ¡®â âì á® áâப®©
  663.         add     esi,ecx         ;add ed_size ¤®¡ ¢¨¬ max size
  664.         mov     edi,esi
  665.  
  666.         cmp     ecx,ebx         ;…᫨ ã ­ á ¯®§¨æ¨ï ªãàá®à  = ⥪ã饬ã à §¬¥àã ­ ¯¥ç â ­­ëå ᨬ¢®«®¢ â.¥. ªãàá®à á⮨⠢ ª®­æ¥
  667.         je      .In_k
  668.  
  669.         test    word [ebp+40],ed_insert ;IF insert is enable  â.ª. edi ¨§¬¥­¥­  ¤à¥á㥬 ç¥à¥§ ebp
  670.         jne     .ins_v
  671. ;clear
  672. pusha
  673.         mov     edi,ebp
  674.         mov     ebp,ed_size
  675.         call    .clear_bg
  676. popa
  677.         sub     ecx,ebx         ; ©¤¥¬ ª®«-¢® ᨬ¢®«®¢ ¤«ï ¯¥à¥¤¢¨¦¥­¨ï.
  678.         inc     edi             ;‘¬¥á⨬ ­ è¨ ᨬ¢®«ë ¢ ¯à ¢®
  679.         std
  680.         inc     ecx
  681.    @@:  
  682.         ;--------
  683.         lodsb
  684.         stosb
  685.         ;--------
  686.         loop    @b
  687. .In_k:  cld
  688.         pop eax
  689.         mov al,ah
  690.         stosb
  691.         pop edi
  692. ; ¢áâ ¢«ï¥¬ ª®¤ ª« ¢¨è¨ â㤠, £¤¥ ªãàá®à
  693.         ; 㢥«¨ç¨¢ ¥¬ §­ ç¥­¨¥ à §¬¥à  ¨ ¯®§¨æ¨¨
  694.         inc      dword ed_size
  695.         inc      dword ed_pos
  696.         call    .draw_all2
  697.         jmp     .shift
  698. }
  699. macro use_work_key
  700. {
  701. .insert: test   word ed_flags,ed_insert ;not    word ed_insert
  702.          je     @f
  703.          and    word ed_flags,ed_insert_cl
  704.         jmp     .editbox_exit
  705. @@:
  706.         or      word ed_flags,ed_insert
  707.         jmp     .editbox_exit
  708. .ins_v:
  709.         dec     dword [ebp+42];ed_size    ;processing is insert
  710.         sub     esi,ecx
  711.         add     esi,ebx
  712.         mov     edi,esi
  713. ;clear
  714. pusha
  715.         mov     edi,ebp
  716.         mov     ebp,ed_pos
  717.         call    .clear_bg
  718. popa
  719.         jmp     .In_k
  720. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  721. .delete:        
  722.         mov     edx,ed_size
  723.         mov     ecx,ed_pos
  724.         cmp     edx,ecx
  725.         jg      .bac_del
  726.         test    word ed_flags,ed_shift_on
  727.         jne     .del_bac
  728. edit_ex
  729. .bac_del:      
  730.         call    .del_char
  731.         jmp     .draw_all
  732. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;        
  733. ;--- ­ ¦ â  ª« ¢¨è  backspace ---
  734. .backspace:
  735.         ; ¯à®¢¥à塞, ªãàá®à ã «¥¢®£® ªà ï ?
  736.         mov     ecx,ed_pos
  737.         test    ecx,ecx
  738.         jnz     .del_bac
  739.         test    word ed_flags,ed_shift_on
  740.         jne     .bac_del
  741.  
  742. edit_ex
  743. .del_bac:
  744.         mov     edx,ed_size
  745.         cmp     edx,ecx ;if ed_pos=ed_size
  746.         je      @f
  747.         dec     ecx
  748.         call    .del_char
  749. @@:     test    word ed_flags,ed_shift_on
  750.         jne     .bac_del
  751.         dec      dword ed_pos
  752. .draw_all:
  753.         push    .shift;.draw_cursor_text;eax
  754.  
  755.         test    word ed_flags,ed_shift_on
  756.         je      @f
  757.         mov     eax,dword ed_shift_pos
  758.         mov     ebx,ed_size
  759.         sub     ebx,eax
  760.         mov     ed_size,ebx
  761.  
  762.         mov     ebp,ed_color
  763.         call    .clear_cursor
  764.         call    .check_offset
  765.         call    .draw_bg
  766.         ret
  767. @@:     dec      dword ed_size
  768.  
  769. .draw_all2:
  770.         and    word ed_flags,ed_shift_cl
  771.         mov     ebp,ed_color
  772.         call    .clear_cursor
  773.         call    .check_offset
  774.         mov     ebp,ed_size
  775.         call    .clear_bg
  776.         ret
  777. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  778. ;--- ­ ¦ â  ª« ¢¨è  left ---
  779. .left:  mov     ebx,ed_pos
  780.         test    ebx,ebx
  781.         jz      .sh_st_of
  782.         or      word ed_flags,ed_left_fl
  783.         call    .sh_first_sh
  784.         dec      dword ed_pos
  785.         call    .sh_enable
  786.         jmp     .draw_cursor_text
  787. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  788. ;--- ­ ¦ â  ª« ¢¨è  right ---
  789. .right: mov     ebx,ed_pos
  790.         cmp     ebx,ed_size
  791.         je      .sh_st_of
  792.         and     word ed_flags,ed_right_fl
  793.         call    .sh_first_sh
  794.         inc     dword  ed_pos
  795.         call    .sh_enable
  796.         jmp     .draw_cursor_text
  797. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  798. .home:  
  799.         mov     ebx,ed_pos
  800.         test    ebx,ebx
  801.         jz      .sh_st_of
  802.         call    .sh_first_sh
  803.         xor     eax,eax
  804.         mov     ed_pos,eax
  805.         call    .sh_home_end
  806.         jmp     .draw_cursor_text
  807. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  808. .end:  
  809.         mov     ebx,ed_pos
  810.         cmp     ebx,dword ed_size
  811.         je      .sh_st_of
  812.         call    .sh_first_sh
  813.         mov     eax,ed_size
  814.         mov     ed_pos,eax
  815.         call    .sh_home_end
  816.         jmp     .draw_cursor_text
  817. }
  818.  
  819. macro use_mouse_func scr_w
  820. {
  821. ;----------------------------------------------------------
  822. ;--- Ž¡à ¡®âª  .mouse_wigwag
  823. ;----------------------------------------------------------
  824. .mouse_wigwag:
  825.         shr     eax,16
  826.         or      word ed_flags,ed_shift_bac+ed_shift_on+ed_shift
  827. ;;;;;;;;;;;;;;;;;;
  828. ;;¯à®æ¥¤ãà  ®¡à ¡®âª¨ ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ª®£¤  ¯à®¨á室¨â ¢ë室 §  ¯à¥¤¥«ë editbox
  829. ;;;;;;;;;;;;;;;;;;
  830.         mov     ebx,[procinfo.box.left]
  831.         add     ebx,ed_left
  832. if scr_w eq
  833. else
  834.         add     ebx,dword scr_w
  835. end if
  836.         cmp     eax,ebx
  837.         jb      .mleft
  838.  
  839.         add     ebx,ed_width
  840.         cmp     eax,ebx
  841.         ja      .mright
  842.  
  843.         sub     ebx,ed_width
  844.  
  845.         xor     edx,edx
  846.         sub     eax,ebx ; ¢ëç⨬ ¨§ ª®®à¤¨­ â ¬ë誨 ¯® ®á¨ å ª®®à¤¨­ âë ¤® editbox ¯® ®á¨ å
  847.         mov     ebx,6
  848.         div     ebx
  849. ;;;;;;;;;;;;;;;;;;
  850. ;;¯à®æ¥¤ãà  ®¡à ¡®âª¨ ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ¢ ¯à¥¤¥« å ®¡« á⨠editbox
  851. ;;;;;;;;;;;;;;;;;;
  852. ;®«ã稫¨ ª®®à¤¨­ âë ¢ eax ¬ë誨, â.¥. ªã¤  ®­  ¯¥à¥¬¥á⨫ áì
  853. ;¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
  854.         add     eax,ed_offset   ;¤®¡ ¢¨¬ ᬥ饭¨¥
  855.         cmp     eax,dword ed_size       ;¥á«¨ ¢ë諨 §  ¯à¥¤¥«ë, â® ­¨ç¥£® ­¥ ¤¥« âì
  856.         ja      .mwigvag
  857. .mdraw:
  858.         mov     dword   ed_pos,eax ;á®åà ­¨¬ ­®¢®¥ §­ ç¥­¨¥
  859. ;¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
  860.         mov     ecx,dword       ed_shift_pos
  861.         mov     ebx,dword       ed_shift_pos_old
  862.         mov     dword   ed_shift_pos_old,eax    ;¢­¥á¥¬ ­®¢®¥ §­ ç¥­¨¥ áâ à®© ¯®§¨æ¨¨ ªãàá®à 
  863. ;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­ëå ®¡« á⥩
  864.         cmp     ecx,ebx         ;¢ëïá­ï¥¬ ªã¤  ¡ë«® ¤¢¨¦¥­¨¥ ­  ®¤¨­ è £ ­ § ¤
  865.         je      .m1_shem        ;¤¢¨¦¥­¨ï ­¥ ¡ë«® à ­¥¥
  866.         jb      .msmaller       ;¤¢¨¦¥­¨¥ ¡ë«® ->
  867.         cmp     ebx,eax         ;¤¢¨¦¥­¨¥ ¡ë«® ¤® í⮣® <- ¨ âãâ ¬ë ¯à®¢¥à塞 ᥩç á ªã¤  ¤¢¨¦¥­¨¥ ¯à®¨á室¨â
  868.         ja      .m1_shem        ;¥á«¨ ¡ë«® ¤¢¨¦¥­¨¥ <- â® ­ã¦­® § ªà á¨âì ®¡« áâì
  869.         je      .mwigvag        ;¥á«¨ ¨§¬¥­¥­¨ï ­¥ ¡ë«®, â® ­¨ç¥£® ­¥ ¤¥« âì
  870.         mov     ebp,ed_color    ;âã⠭㦭® ®ç¨áâ¨âì ®¡« áâì c ed_pos ed_shift_pos_old
  871. ;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
  872.         call    .sh_cl_
  873.         jmp     .mwigvag
  874. .msmaller:
  875.         cmp     ebx,eax
  876.         jb      .m1_shem
  877.         mov     ebp,ed_color
  878. ;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
  879.         call    .sh_cl_
  880.         jmp     .mwigvag
  881. ;alike  =
  882. .m1_shem:
  883.         mov     ebp,shift_color
  884. ;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
  885.         mov     ebx,ecx
  886.         call    .sh_cl_
  887.         jmp     .mwigvag
  888. .mwigvag:
  889.         and     word ed_flags,ed_shift_mcl
  890.         jmp     .draw_cursor_text
  891. ;       popa
  892. ;       ret
  893. .mleft:
  894.         mov     eax,ed_pos
  895.         cmp     eax,0                                        
  896.         jbe      .mwigvag
  897.         dec     eax
  898.         call    .check_offset
  899.         push    eax
  900.         mov     ebx,ed_shift_pos
  901.         mov     ebp,shift_color
  902.         call    .sh_cl_
  903.         pop     eax
  904.         jmp     .mdraw
  905. .mright:
  906.         mov     eax,ed_pos
  907.         mov     ebx,ed_size
  908.         cmp     eax,ebx
  909.         jae     .mwigvag
  910.         inc     eax
  911.         call    .check_offset
  912.         mov     ebx,ed_shift_pos
  913.         mov     ebp,shift_color
  914.         push    eax
  915.         call    .sh_cl_
  916.         pop     eax
  917.         jmp     .mdraw  
  918. }
  919.  
  920. macro use_work_mause scr_h,scr_w
  921. ;----------------------------------------------------------
  922. ;--- € ­¥ 㤥ন¢ ¥¬ «¨ ¬ë ª« ¢¨èã ¬ë誨, ¯¥à¥¬¥é ï ªãàá®à, ¢® ¢á¥ à §­ë¥ áâ®à®­ë?
  923. ;----------------------------------------------------------
  924. {
  925.         test    word ed_flags,ed_mouse_on
  926.         jne     .mouse_wigwag
  927. ;----------------------------------------------------------
  928. ;--- ¯à®¢¥à塞, ¯®¯ ¤ ¥â «¨ ªãàá®à ¢ edit box -------------
  929. ;----------------------------------------------------------
  930.         mov     ebx,[procinfo.box.top]
  931.         add     ebx,ed_top
  932. if scr_h eq
  933. else
  934.         add     ebx,scr_h
  935. end if
  936.         cmp     ax,bx
  937.         jl      ._blur;.mouse_end_no_focus
  938.  
  939.         add     ebx,ed_height
  940.         cmp     ax,bx
  941.         jg      ._blur;.mouse_end_no_focus
  942.  
  943.         shr     eax,16
  944.  
  945.         mov     ebx,[procinfo.box.left]
  946.         add     ebx,ed_left
  947. if scr_w eq
  948. else
  949.         add     ebx,scr_w
  950. end if
  951.         cmp     ax,bx
  952.         jl      ._blur;.mouse_end_no_focus
  953.  
  954.         add     ebx,ed_width
  955.         cmp     ax,bx
  956.         jg      ._blur;.mouse_end_no_focus
  957. ;--- ¨§¬¥­ï¥¬ ¯®§¨æ¨î ªãàá®à  ---
  958.         push    eax
  959.         mov     ebp,ed_color
  960.         call    .clear_cursor
  961.         pop     eax
  962. ._mvpos:
  963.         mov     ebx,dword [procinfo.box.left]
  964.         xor     edx,edx
  965.         sub     eax,ed_left
  966.         sub     eax,ebx
  967. if scr_w eq
  968. else
  969.         add     ebx,scr_w
  970.         sub     eax,2
  971. end if
  972.         mov     ebx,6
  973.         div     bx
  974.         add     eax,ed_offset
  975.         cmp     eax,ed_size
  976.         jna     ._mshift
  977.         mov     eax,ed_size
  978. ._mshift:
  979. ;;;;;;;
  980. ;;‘¥ªæ¨ï ®¡à ¡®âª¨ shift ¨ ¢ë¤¥«¥­¨ï ¯® shift
  981. ;;;;;;;
  982.         test    word ed_flags,ed_shift_bac
  983.         je      @f
  984.         mov     ebp,dword       ed_color
  985.         mov     ebx,dword ed_shift_pos
  986.         push    eax
  987.         call    .sh_cl_
  988.         and     word ed_flags,ed_shift_bac_cl
  989.         pop     eax
  990. @@:    
  991.         test    word ed_flags,ed_mouse_on
  992.         jne     @f
  993.        
  994.         mov     dword ed_shift_pos,eax
  995.         or      word  ed_flags,ed_mouse_on
  996.         mov     dword ed_pos,eax
  997.         mov     dword [mouse_flag],edi          ;ãáâ ­®¢¨¬ ¨¤¥­â¨ä¨ª â®à
  998.         bts     word ed_flags,1                 ;ãáâ ­®¢ª  䮪ãá 
  999.         jmp     .m_sh
  1000. @@:            
  1001.         cmp     eax,dword ed_shift_pos  ;¥á«¨ ¯®§¨æ¨¨ ­¥ ¨§¬¥­¨«¨áì
  1002.         je      .editbox_exit
  1003.         mov     ed_pos,eax
  1004.         mov     ebp,dword shift_color
  1005.         mov     ebx,dword ed_shift_pos
  1006.         call    .sh_cl_
  1007.         or      word ed_flags,ed_mous_adn_b     ;ãáâ ­®¢¨¬ ¡¨â çâ® ¬ë ¢ë¤¥«¨«¨ +shift_on +
  1008. .m_sh:  call    .draw_text
  1009.         call    .draw_cursor
  1010. ;----------------------------------------------------------
  1011. ;--- ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá  ---------------------------
  1012. ;----------------------------------------------------------
  1013.         jmp     .drc
  1014. ._blur:
  1015.         test    word ed_flags,ed_always_focus
  1016.         jne     .editbox_exit
  1017.         btr     word ed_flags,1 ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
  1018.         jnc     .editbox_exit
  1019.  
  1020.         mov     ebp,ed_color
  1021.         call    .clear_cursor
  1022. .drc:   call    .draw_border
  1023.         jmp     .editbox_exit
  1024. }
  1025.  
  1026.  
  1027. ; Œ ªà®á ¢ë室 
  1028. macro edit_ex
  1029. {
  1030. popa          
  1031. ret
  1032. }
  1033. macro debug
  1034. {
  1035.         ;-----------  ®â« ¤ª 
  1036.         pushad
  1037. ;        mov     dword [ed_buffer.2],0
  1038. ;        mov     eax,edi
  1039.         mov eax,dword [ed_buffer.2]
  1040.         mov edi,ed_buffer.3
  1041.         call .str
  1042.         ;à¨á®¢ ­¨¥ ä®­ 
  1043.         mov eax,13
  1044.         mov ebx,178*65536+70
  1045.         mov ecx,28*65536+10
  1046.         xor edx,edx
  1047.         int 0x40
  1048.         ;¢ë¢®¤ §­ ç¥­¨ï ­  íªà ­
  1049.         mov eax,4
  1050.         mov ebx,180*65536+30
  1051.         mov ecx,0x10DDBBCC
  1052.         mov edx,ed_buffer.3
  1053.         mov esi,8
  1054.         int 0x40
  1055.         popad
  1056.         ;----------- ®â« ¤ª 
  1057. }
  1058. macro   debug_func
  1059. {
  1060. .str:
  1061.         mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
  1062.          ;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
  1063.         cmp eax,ecx  ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
  1064.         jb @f
  1065.         xor edx,edx  ;®ç¨áâ¨âì edx
  1066.         div ecx      ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
  1067.         push edx     ;¯®«®¦¨âì ¢ á⥪
  1068.         ;dec edi             ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
  1069.         call .str;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
  1070.         pop eax
  1071.         @@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
  1072.         ;sbb al,$69  ;- ç¥áâ­® ¤ ­­ ï ¨­áâàãªæ¨ï ¬¥­ï § áâ ¢«ï¥â § ¤ã¬ âìáï â.¥. ï ­¥ §­ î ª ª íâ® à ¡®â ¥â
  1073.         ;das        ;¯®á«¥ ¤ ­­®© ª®¬ ­¤ë ª ª ¡ë ¯à®¨á室¨â 㬥­ì襭¨¥ al ­  66h  (¢ ª­¨£¥ ­ ¯¨á ­® ¤à㣮¥)
  1074.         or al,0x30  ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥  ç¥¬ ¤¢¥ ¢ëè¥
  1075.         stosb       ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
  1076.  
  1077.         ret         ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
  1078. }