fixed bag, stable

git-svn-id: svn://kolibrios.org@292 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Alexey Teplov ( 2007-01-24 10:00:37 +00:00
parent 98348199e8
commit 72cb45f7f1
2 changed files with 103 additions and 104 deletions

View File

@ -1,3 +1,4 @@
; <Lrz> 23.01.2007 ¯®ä¨ªá¥« ¡ £¨ ¢ë§¢ ­ë¥ ­¥ ¯à ¢¨«ì­ë¬ ª®¤®¬ )).
; <Lrz> 22.01.2007 ¨§¡ ¢¨«áï ®â £«îª®¢ ¯à¨ à ¡®â¥ á ¢ë¤¥«¥­¨¥¬ ¨ 㤠«¥­¨¥, ª®à४⭠ï à ¡®â  ª« ¢¨è¥© del & backspase
; <Lrz> 20.01.2007 ॠ«¨§®¢ « ¢ë¤¥«¥­¨¥ ⥪áâ  ¯® shift
; <Lrz> 12.12.2006 ॠ«¨§®¢ « ¯®¤¤¥à¦ªã ª­®¯ª¨ insert ¨ ᥣ®¤ï ª®¬¯®­¥­â ¯®ç⨠ࠡ®â ¥â!!!!
@ -62,10 +63,11 @@ ed_pos equ [edi+42] ;
ed_offset equ [edi+46] ;ᬥ饭¨¥
cl_curs_x equ [edi+50] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® å
cl_curs_y equ [edi+54] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® ã
ed_insert equ [edi+58] ;word
ed_shift_pos equ [edi+60]
ed_shift_pos equ [edi+58]
ed_height=14 ; ¢ëá®â 
shift_color=0x6a9480
ed_insert=10000b
ed_insert_cl=1111111111101111b
;==========================================================
;=== ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ =================================
;==========================================================
@ -89,24 +91,24 @@ pusha
popa
ret
.str:
mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
cmp eax,ecx ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
jb @f
xor edx,edx ;®ç¨áâ¨âì edx
div ecx ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
push edx ;¯®«®¦¨âì ¢ á⥪
;dec edi ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
call .str;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
pop eax
@@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
;sbb al,$69 ;- ç¥áâ­® ¤ ­­ ï ¨­áâàãªæ¨ï ¬¥­ï § áâ ¢«ï¥â § ¤ã¬ âìáï â.¥. ï ­¥ §­ î ª ª íâ® à ¡®â ¥â
;das ;¯®á«¥ ¤ ­­®© ª®¬ ­¤ë ª ª ¡ë ¯à®¨á室¨â 㬥­ì襭¨¥ al ­  66h (¢ ª­¨£¥ ­ ¯¨á ­® ¤à㣮¥)
or al,0x30 ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥ 祬 ¤¢¥ ¢ëè¥
stosb ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
ret ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
;.str:
; mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
; ;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
; cmp eax,ecx ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
; jb @f
; xor edx,edx ;®ç¨áâ¨âì edx
; div ecx ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
; push edx ;¯®«®¦¨âì ¢ á⥪
; ;dec edi ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
; call .str;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
; pop eax
; @@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
; ;sbb al,$69 ;- ç¥áâ­® ¤ ­­ ï ¨­áâàãªæ¨ï ¬¥­ï § áâ ¢«ï¥â § ¤ã¬ âìáï â.¥. ï ­¥ §­ î ª ª íâ® à ¡®â ¥â
; ;das ;¯®á«¥ ¤ ­­®© ª®¬ ­¤ë ª ª ¡ë ¯à®¨á室¨â 㬥­ì襭¨¥ al ­  66h (¢ ª­¨£¥ ­ ¯¨á ­® ¤à㣮¥)
; or al,0x30 ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥ 祬 ¤¢¥ ¢ëè¥
; stosb ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
;
; ret ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ⥪áâ  --------------------------
@ -137,6 +139,7 @@ ret
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ä®­  ----------------------------
;¢å®¤­ë¥ ¤ ­­ë¥
;eax
;edx - color
;----------------------------------------------------------
.draw_bg_eax:
;pusha
@ -144,9 +147,6 @@ ret
add ecx,1
shl ecx,16
mov cx,13
; sub ecx,1
; pop edx ;color
; mov edx,ed_color
mov eax,13
int 0x40
;popa
@ -311,13 +311,34 @@ ret
pusha
test word ed_flags,ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
je .no_figure ;@f
; ;----------- ®â« ¤ª 
; pushad
; mov [data_of_code],0
; mov eax,edi;word ed_flags
; mov edi,data_of_code
; call .str
; ;à¨á®¢ ­¨¥ ä®­ 
; mov eax,13
; mov ebx,178*65536+36
; mov ecx,28*65536+10
; xor edx,edx
; int 0x40
; ;¢ë¢®¤ §­ ç¥­¨ï ­  íªà ­
; mov eax,4
; mov ebx,180*65536+30
; mov ecx,0x10DDBBCC
; mov edx,data_of_code
; mov esi,4
; int 0x40
; popad
; ;----------- ®â« ¤ª 
xor ecx,ecx
push eax
mov ecx,1
inc ecx
mov eax,66
mov ebx,3
int 0x40
xor ebx,ebx
test al,0x03
je @f
or word ed_flags,ed_shift
@ -356,8 +377,25 @@ pusha
jb .no_figure
cmp ah,'9'
ja .no_figure
@@: ; ¯à®¢¥à塞, ­ å®¤¨âáï «¨ ªãàá®à ¢ ª®­æ¥
mov ecx,ed_size
;¯à®¢¥àª  ­  shift
test word ed_flags,ed_shift_on
je @f
;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
push eax
mov edx,ed_size
mov ecx,ed_pos
call .del_char
;;;;
mov eax,ed_shift_pos
mov ebx,ed_size
sub ebx,eax
mov ed_size,ebx
pop eax
; ¯à®¢¥à塞, ­ å®¤¨âáï «¨ ªãàá®à ¢ ª®­æ¥
@@: mov ecx,ed_size
mov edx, ed_max
cmp ecx,edx
jae .no_figure
@ -367,10 +405,14 @@ pusha
.no_figure:
popa
ret
.insert: not word ed_insert
.insert: test word ed_flags,ed_insert ;not word ed_insert
je .insert_1
and word ed_flags,ed_insert_cl
jmp .no_figure
.insert_1:
or word ed_flags,ed_insert
jmp .no_figure
.ins_v:
.ins_v:
pop eax edi
dec dword ed_size ;processing is insert
push edi eax
@ -381,17 +423,17 @@ pusha
@@: ; ᤢ¨£ ¥¬ ᨬ¢®«ë ¯®á«¥ ªãàá®à  ¢¯à ¢®
mov ecx,ed_size
push edi eax
mov ebp,edi
mov esi,ed_text ; “ª § â¥«ì ­  ¡ãä¥à
movzx eax,word ed_insert
;<3B>㤥¬ à ¡®â âì á® áâப®©
add esi,ecx ;add ed_size ¤®¡ ¢¨¬ max size
mov edi,esi
cmp ecx,ebx ;…᫨ ã ­ á ¯®§¨æ¨ï ªãàá®à  = ⥪ã饬ã à §¬¥àã ­ ¯¥ç â ­­ëå ᨬ¢®«®¢ â.¥. ªãàá®à á⮨⠢ ª®­æ¥
je .In_k
cmp ax,-1 ;IF insert is enable
je .ins_v
test word [ebp+36],ed_insert ;IF insert is enable â.ª. edi ¨§¬¥­¥­  ¤à¥á㥬 ç¥à¥§ ebp
jne .ins_v
sub ecx,ebx ;<3B> ©¤¥¬ ª®«-¢® ᨬ¢®«®¢ ¤«ï ¯¥à¥¤¢¨¦¥­¨ï.
inc edi ;‘¬¥á⨬ ­ è¨ ᨬ¢®«ë ¢ ¯à ¢®
@ -411,25 +453,20 @@ pusha
; ¢áâ ¢«ï¥¬ ª®¤ ª« ¢¨è¨ â㤠, £¤¥ ªãàá®à
; 㢥«¨ç¨¢ ¥¬ §­ ç¥­¨¥ à §¬¥à  ¨ ¯®§¨æ¨¨
inc dword ed_size
;push dword ed_pos
;push dword ed_size
; push .return
call .draw_all2
inc dword ed_pos
;.return:
jmp .shift;.draw_cursor_text
.delete:
mov edx,ed_size
mov ecx,ed_pos
cmp edx,ecx
jg @f
jg .bac_del
test word ed_flags,ed_shift_on
jne .del_bac
popa
ret
.bac_del:
@@: call .del_char
call .del_char
jmp .draw_all
;--- ­ ¦ â  ª« ¢¨è  backspace ---
@ -438,7 +475,7 @@ pusha
mov edx,ed_size
mov ecx,ed_pos
test ecx,ecx
jnz @f
jnz .del_bac
test word ed_flags,ed_shift_on
jne .bac_del
@ -447,7 +484,7 @@ pusha
popa
ret
.del_bac:
@@: cmp edx,ecx ;if ed_pos=ed_size
cmp edx,ecx ;if ed_pos=ed_size
je @f
dec ecx
call .del_char
@ -543,7 +580,7 @@ pusha
.end: call .sh_enable
mov ebx,ed_pos
cmp ebx,dword ed_size
je @f
je .nd_k
call .clear_cursor
mov eax,ed_size
mov ed_pos,eax
@ -624,15 +661,19 @@ pusha
.f_exit: and word ed_flags,ed_shift_cl
jmp .draw_cursor_text
;¯à®¢¥àª  á®áâ®ï­¨ï shift ¡ë« «¨ ®­ ­ ¦ â à ­ìè¥?
.sh_enable:
test word ed_flags,ed_shift
je @f
test word ed_flags,ed_shift_on
jne @f
jne .sh_ext_en
push dword ed_pos
pop dword ed_shift_pos
or word ed_flags,ed_shift_on
@@: ret
ret
@@: and word ed_flags,ed_shift_cl
.sh_ext_en: ret
;- 㤠«¥­¨¥ ᨬ¢®« 
;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
@ -674,27 +715,6 @@ pusha
sub edx,ecx
.del_ch_sh:
;----------- ®â« ¤ª 
pushad
mov [data_of_code],0
mov eax,ed_pos;word ed_flags
mov edi,data_of_code
call .str
;à¨á®¢ ­¨¥ ä®­ 
mov eax,13
mov ebx,178*65536+36
mov ecx,28*65536+10
xor edx,edx
int 0x40
;¢ë¢®¤ §­ ç¥­¨ï ­  íªà ­
mov eax,4
mov ebx,180*65536+30
mov ecx,0x10DDBBCC
mov edx,data_of_code
mov esi,4
int 0x40
popad
;----------- ®â« ¤ª 
push edi
mov edi,ebx
@ -770,8 +790,13 @@ pusha
mov ed_pos,ax
call .check_offset
call .draw_cursor
call .focus
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá  ---------------------------
;----------------------------------------------------------
bts word ed_flags,1
jc .mouse_pressed
call .draw_cursor
call .draw_border
.mouse_pressed:
popa
ret
@ -779,22 +804,12 @@ ret
; call .blur
;popa
;ret
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá  ---------------------------
;----------------------------------------------------------
.blur:
pusha
;.blur:
;pusha
._blur:
btr dword ed_flags,1
jnc @f
btr word ed_flags,1 ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
jnc @f
call .clear_cursor
jmp .blur_end
.focus:
pusha
bts dword ed_flags,1
jc @f
call .draw_cursor
.blur_end:
call .draw_border
@@:
popa
@ -848,7 +863,7 @@ macro key_edit_boxes start,end
add edi,ed_struc_size
loop @b
}
ed_struc_size=64
ed_struc_size=62
struc edit_box width,left,top,color,focus_border_color,\
blur_border_color,text_color,max,text,flags,size
{
@ -867,7 +882,6 @@ struc edit_box width,left,top,color,focus_border_color,\
.offset dd 0
.cl_curs_x dd 0
.cl_curs_y dd 0
.insert dw 0
.shift dd 0
}

View File

@ -2,7 +2,7 @@
;<3B>ä䥪⨢­®¥ ¯à®£à ¬¬¨à®¢ ­¨¥ ¢ KOLIBRI
;Ž¯â¨¬¨§¨à®¢ ­­ë© ª®¬¯®­¥­â EditBox (ˆá室­ë© ¢ à¨ ­â ®â Maxxxx32)
;Ž¯â¨¬¨§ æ¨ï ª®¬ ­¤.
;<Lrz> - ’¥¯«®¢ €«¥ªá¥© www.test-kolibri.narod.ru
;<Lrz> - ’¥¯«®¢ €«¥ªá¥© www.lrz.land.ru
;§ £®«®¢®ª ¯à¨«®¦¥­¨ï
use32 ; âà ­á«ïâ®à, ¨á¯®«ì§ãî騩 32 à §à來ëå ª®¬ ­¤ë
@ -28,20 +28,6 @@ start: ;
mov eax,40 ;ãáâ ­®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
mov ebx,0x27 ;á¨á⥬  ¡ã¤¥â ॠ£¨à®¢ âì ⮫쪮 ­  á®®¡é¥­¨¥ ® ¯¥à¥à¨á®¢ª¥,­ ¦ â  ª­®¯ª , ®¯à¥¤¥«ñ­­ ï à ­¥¥, ᮡë⨥ ®â ¬ëè¨ (çâ®-â® á«ã稫®áì - ­ ¦ â¨¥ ­  ª­®¯ªã ¬ëè¨ ¨«¨ ¯¥à¥¬¥é¥­¨¥; á¡à á뢠¥âáï ¯à¨ ¯à®ç⥭¨¨) ¨ ­ ¦ â¨¥ ª« ¢¨è¨
int 0x40
; mov eax,66 ; keyboard mode definitions
; mov ebx,1 ; set
; xor ecx,ecx
; inc ecx ; return scancodes
; int 0x40
; mov eax,26 ; get setup for keyboard
; inc ebx
; mov ebx,2
; mov ecx,1 ; base keymap
; mov edx,keymap
; int 0x40
red_win:
call draw_window ;¯¥à¢®­ ç «ì­® ­¥®¡å®¤¨¬® ­ à¨á®¢ âì ®ª­®
still: ;®á­®¢­®© ®¡à ¡®â稪
@ -101,22 +87,21 @@ draw_window: ;
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;DATA ¤ ­­ë¥
editboxes:
edit1 edit_box 168,10,50,0xffffff,0,0,0,100,ed_buffer.1,ed_focus
edit1 edit_box 168,10,50,0xffffff,0,0,0,512,ed_buffer.1,ed_focus
edit2 edit_box 168,10,30,0xffffff,0,0,0,99,ed_buffer.2,ed_figure_only
edit3 edit_box 35,10,70,0xffffff,0,0,0,9,ed_buffer.3,ed_figure_only
edit4 edit_box 16,10,90,0xffffff,0,0,0,1,ed_buffer.4,ed_figure_only
editboxes_end:
data_of_code dd 0
data_of_code1 dd 0
ed_buffer:
.1: rb 101;512;256
.1: rb 513;256
.2: rb 100
.3: rb 10
.4: rb 2
;text_b: db 'Š®«-¢® ᨬ¢®«®¢'
;buffer: dd 0
buffer_end:
hed db 'EDITBOX optimization and retype <Lrz> date 22.01.2007'
hed db 'EDITBOX optimization and retype <Lrz> date 24.01.2007'
i_end1:
rb 2048
i_end: