@RB - some optimisations and code refactoring

git-svn-id: svn://kolibrios.org@2510 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2012-03-27 09:57:38 +00:00
parent a540a71a13
commit 8cdca726a0
3 changed files with 301 additions and 289 deletions

View File

@ -7,223 +7,229 @@
; ;
; Compile with flat assembler ; Compile with flat assembler
; ;
;------------------------------------------------------------------------------
; version: 1.1
; last update: 27/03/2012
; changed by: Marat Zakiyanov aka Mario79, aka Mario
; changes: The program uses only 3404 bytes memory is now.
; Optimisations and code refactoring.
;------------------------------------------------------------------------------
include 'lang.inc' include 'lang.inc'
include '..\..\..\macros.inc' include '..\..\..\macros.inc'
;------------------------------------------------------------------------------
meos_app_start use32
code org 0x0
db 'MENUET01' ; 8 byte id
mov eax, 48 ; ¯®«ãç¨âì á¨á⥬­ë¥ æ¢¥â  dd 0x01 ; header version
mov ebx, 3 dd START ; start of code
mov ecx, sc ;  ¤à¥á áâàãªâãàë dd IM_END ; size of image
mov edx, sizeof.system_colors ; ¨ ¥¥ à §¬¥à dd I_END ; memory for app
mcall dd stack_area ; esp
dd 0 ; boot parameters
mov eax,40 ; ãáâ ­®¢¨¬ ¬ áªã ᮡë⨩ dd 0 ; path
mov ebx,100000b ; ­ á ¨­â¥à¥áã¥â ⮫쪮 ¬ëèì ;------------------------------------------------------------------------------
mcall START:
; ¯®«ãç¨âì á¨á⥬­ë¥ 梥â 
mcall 48,3,sc,sizeof.system_colors
; ãáâ ­®¢¨¬ ¬ áªã ᮡë⨩ - ­ á ¨­â¥à¥áã¥â ⮫쪮 ¬ëèì
mcall 40,100000b
;------------------------------------------------------------------------------
align 4
still: ; £« ¢­ë© 横« ®á­®¢­®£® ¯à®æ¥áá  still: ; £« ¢­ë© 横« ®á­®¢­®£® ¯à®æ¥áá 
mcall 10 ; ¦¤ñ¬ ᮡëâ¨ï
mov eax,10 ; ¦¤ñ¬ ᮡëâ¨ï mcall 37,2 ; ª ª¨¥ ­ ¦ âë ª¯®¯ª¨?
mcall cmp eax,ebx ; ¥á«¨ ­¥ ¯à ¢ ï, ¢®§¢à â
jne still
;--------------------------------------
; íâ® ¤«ï ®â« ¤ª¨ - ¥á«¨ ¬ëèì ¢ â®çª¥ (0;0), § ªà®¥¬áï
; xor ebx,ebx
; mcall 37
; test eax,eax ; ªãàá®à ¢ â®çª¥ (0;0), â.¥. eax = 0
; je exit
;--------------------------------------
; ¯®«ã稬 ç¨á«® ¯à®æ¥áᮢ ¢ á¨á⥬¥
xor ecx,ecx
mcall 9,procinfo
mov eax,37 ; ª ª¨¥ ­ ¦ âë ª¯®¯ª¨? inc eax ; ⥯¥àì ¢ eax ᮤ¥à¦¨âáï ç¨á«® ¯à®æ¥áᮢ + 1
mov ebx,2 mov [processes],eax
mcall mov ecx,1
;--------------------------------------
align 4
new_process:
pushad
; ¯®«ã稬 ¨­ä®à¬ æ¨î ® ¯à®æ¥áá¥; ­®¬¥à - ¢ ecx
mcall 9,procinfo
; ª®®à¤¨­ âë ªãàá®à 
xor ebx,ebx
mcall 37
cmp eax,ebx ; ¥á«¨ ­¥ ¯à ¢ ï, ¢®§¢à â mov ebx,eax ; eax = cursor_x
jne still shr eax,16 ; ebx = cursor_y
and ebx,0xffff
;---¯®¥å «¨!--- mov [curx1],eax ; curx1 = cursor_x
mov [cury1],ebx ; cury1 = cursor_y
; mov eax,37 ; íâ® ¤«ï ®â« ¤ª¨ - ¥á«¨ ¬ëèì ¢ â®çª¥ (0;0), § ªà®¥¬áï
; xor ebx,ebx
; mcall
; test eax,eax ; ªãàá®à ¢ â®çª¥ (0;0), â.¥. eax = 0
; je exit
mov eax,9 ; ¯®«ã稬 ç¨á«® ¯à®æ¥áᮢ ¢ á¨á⥬¥
mov ebx,procinfo
xor ecx,ecx
mcall
inc eax ; ⥯¥àì ¢ eax ᮤ¥à¦¨âáï ç¨á«® ¯à®æ¥áᮢ + 1
mov [processes],eax
mov ecx,1
new_process:
pushad
mov eax,9 ; ¯®«ã稬 ¨­ä®à¬ æ¨î ® ¯à®æ¥áá¥; ­®¬¥à - ¢ ecx
mov ebx,procinfo
mcall
mov eax,37 ; ª®®à¤¨­ âë ªãàá®à 
xor ebx,ebx
mcall
mov ebx,eax ; eax = cursor_x
shr eax,16 ; ebx = cursor_y
and ebx,0xffff
mov [curx1],eax ; curx1 = cursor_x
mov [cury1],ebx ; cury1 = cursor_y
; \begin{diamond}[18.09.2006] ; \begin{diamond}[18.09.2006]
; ignore minimized windows ; ignore minimized windows
test [procinfo.wnd_state], 2 test [procinfo.wnd_state], 2
jnz ne_goden jnz ne_goden
; \end{diamond}[18.09.2006] ; \end{diamond}[18.09.2006]
mov eax,[procinfo.box.left] ; eax = wnd_x_start mov eax,[procinfo.box.left] ; eax = wnd_x_start
mov ebx,[procinfo.box.top] ; ebx = wnd_y_start mov ebx,[procinfo.box.top] ; ebx = wnd_y_start
mov ecx,[procinfo.box.width] mov ecx,[procinfo.box.width]
add ecx,eax ; ecx = wnd_x_end add ecx,eax ; ecx = wnd_x_end
mov edx,[procinfo.box.height] mov edx,[procinfo.box.height]
add edx,ebx ; ecx = wnd_y_end add edx,ebx ; ecx = wnd_y_end
cmp eax,[curx1] ; wnd_x_start > cursor_x => ªãàá®à «¥¢¥¥ ®ª­  cmp eax,[curx1] ; wnd_x_start > cursor_x => ªãàá®à «¥¢¥¥ ®ª­ 
jg ne_goden jg ne_goden
cmp ecx,[curx1] ; wnd_x_end < cursor_x => ªãàá®à ¯à ¢¥¥ ®ª­ 
jl ne_goden
cmp ebx,[cury1] ; wnd_y_start > cursor_y => ªãàá®à ¢ëè¥ ®ª­ 
jg ne_goden
cmp edx,[cury1] ; wnd_y_end < cursor_y => ªãàá®à ­¨¦¥ ®ª­ 
jl ne_goden
cmp ecx,[curx1] ; wnd_x_end < cursor_x => ªãàá®à ¯à ¢¥¥ ®ª­ 
jl ne_goden
cmp ebx,[cury1] ; wnd_y_start > cursor_y => ªãàá®à ¢ëè¥ ®ª­ 
jg ne_goden
cmp edx,[cury1] ; wnd_y_end < cursor_y => ªãàá®à ­¨¦¥ ®ª­ 
jl ne_goden
;--------------------------------------
align 4
goden: ; ª«¨ª ¡ë« ¢­ãâਠª ª®£®-â® ®ª­ , ¯®í⮬㠭¨ç¥£® ­¥ ¤¥« ¥¬ goden: ; ª«¨ª ¡ë« ¢­ãâਠª ª®£®-â® ®ª­ , ¯®í⮬㠭¨ç¥£® ­¥ ¤¥« ¥¬
popad popad
jmp still jmp still
;--------------------------------------
align 4
ne_goden: ; ª«¨ª ¡ë« á­ à㦨 à áᬠâਢ ¥¬®£® ®ª­ , ¯®í⮬ã ne_goden: ; ª«¨ª ¡ë« á­ à㦨 à áᬠâਢ ¥¬®£® ®ª­ , ¯®í⮬ã
popad popad
inc ecx inc ecx
cmp ecx,[processes] cmp ecx,[processes]
jl new_process ; «¨¡® ᬮਬ á«¥¤ãî饥 ®ª­®, «¨¡® § ¯ã᪠¥¬ ¬¥­î jl new_process ; «¨¡® ᬮਬ á«¥¤ãî饥 ®ª­®, «¨¡® § ¯ã᪠¥¬ ¬¥­î
;--------------------------------------
align 4
@@: ; ¯®¤®¦¤ñ¬, ¯®ª  ¯®«ì§®¢ â¥«ì ­¥ ®â¯ãá⨫ ¯à ¢ãî ª­®¯ªã ¬ëè¨ @@: ; ¯®¤®¦¤ñ¬, ¯®ª  ¯®«ì§®¢ â¥«ì ­¥ ®â¯ãá⨫ ¯à ¢ãî ª­®¯ªã ¬ëè¨
mov eax,37 mcall 37,2 ; ­ ¦ âë «¨ ª­®¯ª¨ ¬ëè¨?
mov ebx,2 ; äã­ªæ¨ï 37-2: test eax,ebx ; ¥á«¨ ®â¯ãá⨫, (eax != 2)
mcall ; ­ ¦ âë «¨ ª­®¯ª¨ ¬ëè¨? jz @f ; ¨¤ñ¬ ¢ ­ ç «® £« ¢­®£® 横« 
test eax,ebx ; ¥á«¨ ®â¯ãá⨫, (eax != 2)
jz @f ; ¨¤ñ¬ ¢ ­ ç «® £« ¢­®£® 横« 
mov eax,5 ; ¨­ ç¥ mcall 68,1 ; ¨­ ç¥ ¯¥à¥ª«î稬áï ­  á«¥¤ãî騩 ¯®â®ª á¨áâ¥¬ë ¨ ª®£¤ 
;mov ebx,2 ; ¯®¤®¦¤ñ¬ 2 ¬á jmp @b ; ¢ë¯®«­¥­¨¥ ¢¥à­¥âáï í⮬㠯®â®ªã, ¯à®¢¥à¨¬ ¬ëèì ®¯ïâì
mcall ;--------------------------------------
align 4
jmp @b ; ¨ ¯à®¢¥à¨¬ ¬ëèì ®¯ïâì
@@: @@:
; ¥á«¨ 㦥 ¡ë«® ®âªàëâ® ¬¥­î, ­ã¦­® ¯®¤®¦¤ âì, ¯®ª  ®­® § ªà®¥âáï: ; ¥á«¨ 㦥 ¡ë«® ®âªàëâ® ¬¥­î, ­ã¦­® ¯®¤®¦¤ âì, ¯®ª  ®­® § ªà®¥âáï:
cmp [menu_opened],0
je @f
mcall 68,1 ; ¯¥à¥ª«î稬áï ­  á«¥¤ãî騩 ¯®â®ª á¨á⥬ë
; ¡®«¥¥ íä䥪⨢­ë© ᯮᮡ § ¤¥à¦ª¨ 祬 mcall 5
jmp @b
;--------------------------------------
align 4
@@: @@:
cmp [menu_opened],0 ;   ⥯¥àì ¬®¦­® ᬥ«® § ¯ã᪠âì ¯à®æ¥áá (¯®â®ª) ¬¥­î
je @f mcall 51,1,start_wnd,stack_wnd
mov eax,5 jmp still
mov ebx,3 ; ¦¤ñ¬ 3 ¬á ;------------------------------------------------------------------------------
mcall align 4
jmp @b
@@:
mov eax,51 ;   ⥯¥àì ¬®¦­® ᬥ«® § ¯ã᪠âì ¯à®æ¥áá (¯®â®ª) ¬¥­î
mov ebx,1 ; ᮧ¤ ñ¬ ¯®â®ª (thread)
mov ecx,start_wnd ; â®çª  ¢å®¤  ¯®â®ª 
mov edx,stack_wnd ; ¢¥à設  áâíª  ¤«ï ¯®â®ª 
mcall
jmp still
exit_menu: ; ¥á«¨ ¢ë室¨¬ ¨§ ¬¥­î, ­ ¤® § ¯¨á âì ¢ [menu_opened] 0 exit_menu: ; ¥á«¨ ¢ë室¨¬ ¨§ ¬¥­î, ­ ¤® § ¯¨á âì ¢ [menu_opened] 0
mov [menu_opened],0 mov [menu_opened],0
;--------------------------------------
align 4
exit: ; á ¬ë ¨¤ñ¬, ª®£¤  ¢ë室¨¬ ¨§ ®á­®¢­®£® ¯à®æ¥áá  exit: ; á ¬ë ¨¤ñ¬, ª®£¤  ¢ë室¨¬ ¨§ ®á­®¢­®£® ¯à®æ¥áá 
or eax,-1 ; eax = -1 or eax,-1 ; eax = -1
mcall mcall
;------------------------------------------------------------------------------
; §¤¥áì áâ àâã¥â ¯à®æ¥áá ¬¥­î ; §¤¥áì áâ àâã¥â ¯à®æ¥áá ¬¥­î
;------------------------------------------------------------------------------
align 4
start_wnd: start_wnd:
mov [menu_opened],1 mov [menu_opened],1
mov eax,40 ; ãáâ ­®¢¨¬ ¬ áªã ¦¥« ¥¬ëå ᮡë⨩ ¤«ï í⮣® ¯à®æ¥áá  ; ãáâ ­®¢¨¬ ¬ áªã ¦¥« ¥¬ëå ᮡë⨩: ¬¥­î + ª­®¯ª¨ + ¯¥à¥à¨á®¢ª 
mov ebx,100101b ; ¬¥­î + ª­®¯ª¨ + ¯¥à¥à¨á®¢ª  mcall 40,100101b
mcall ;------------------------------------------------------------------------------
align 4
red: red:
call draw_window call draw_window
;------------------------------------------------------------------------------
align 4
still2: ; £« ¢­ë© 横« ¯à®æ¥áá  ¬¥­î still2: ; £« ¢­ë© 横« ¯à®æ¥áá  ¬¥­î
mcall 10 ; ¦¤ñ¬ ᮡëâ¨ï
mov eax,10 ; ¦¤ñ¬ ᮡëâ¨ï cmp eax,1 ; ¯¥à¥à¨á®¢ª ?
mcall je red
cmp eax,1 ; ¯¥à¥à¨á®¢ª ? cmp eax,3 ; ª­®¯ª ?
je red je button
cmp eax,3 ; ª­®¯ª ?
je button cmp eax,6 ; ¬ëèì?
cmp eax,6 ; ¬ëèì? je mouse
je mouse
jmp still2 ; ¢¥à­ñ¬áï ¢ ­ ç «® £« ¢­®£® 横« 
jmp still2 ; ¢¥à­ñ¬áï ¢ ­ ç «® £« ¢­®£® 横« 
;------------------------------------------------------------------------------
align 4
; Ž<><C5BD><EFBFBD>ŽˆŠ Œ›˜ˆ ; Ž<><C5BD><EFBFBD>ŽˆŠ Œ›˜ˆ
mouse: ; ª®£¤  ¯®«ì§®¢ â¥«ì ­ ¦¬ñâ ª­®¯ªã ¬ëè¨, § ªà®¥¬áï mouse: ; ª®£¤  ¯®«ì§®¢ â¥«ì ­ ¦¬ñâ ª­®¯ªã ¬ëè¨, § ªà®¥¬áï
mov eax,37 mcall 37,2 ; ª ª¨¥ ª­®¯ª¨ ­ ¦ âë?
mov ebx,2 ; ª ª¨¥ ª­®¯ª¨ ­ ¦ âë? test eax,eax ; ­¨ª ª¨¥? - ⮣¤  ¯à¥ªà á­®! ¢¥à­ñ¬áï ¢ £« ¢­ë© 横«
mcall jz still2
test eax,eax ; ­¨ª ª¨¥? - ⮣¤  ¯à¥ªà á­®! ¢¥à­ñ¬áï ¢ £« ¢­ë© 横«
jz still2 mcall 37,0
mcall 37, 0
mov esi, eax mov esi, eax
shr esi, 16 shr esi, 16
movzx edi, ax movzx edi, ax
mcall 9, procinfo2, -1 mcall 9, procinfo, -1
mov eax, [procinfo2.box.left]
mov eax, [procinfo.box.left]
cmp esi, eax cmp esi, eax
jl exit_menu jl exit_menu
add eax, [procinfo2.box.width]
add eax, [procinfo.box.width]
cmp esi, eax cmp esi, eax
jge exit_menu jge exit_menu
mov eax, [procinfo2.box.top]
mov eax, [procinfo.box.top]
cmp edi, eax cmp edi, eax
jl exit_menu jl exit_menu
add eax, [procinfo2.box.height]
add eax, [procinfo.box.height]
cmp edi, eax cmp edi, eax
jge exit_menu jge exit_menu
jmp still2 jmp still2
;------------------------------------------------------------------------------
align 4
; <20>€†€€ Š<>Ž<EFBFBD>Š€ ; <20>€†€€ Š<>Ž<EFBFBD>Š€
button: button:
mov eax,17 ; ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨ mcall 17 ; ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
mcall
sub ah,10 ; áà ¢­¨¢ ¥¬ á 10 sub ah,10 ; áà ¢­¨¢ ¥¬ á 10
jl nofuncbtns ; ¥á«¨ ¬¥­ìè¥ - § ªà뢠¥¬ ¬¥­î jl nofuncbtns ; ¥á«¨ ¬¥­ìè¥ - § ªà뢠¥¬ ¬¥­î
movzx ebx,ah ; ¯®«ã稫¨ ­®¬¥à ¯à®£à ¬¬ë ¢ ᯨ᪥ ¢ ebx movzx ebx,ah ; ¯®«ã稫¨ ­®¬¥à ¯à®£à ¬¬ë ¢ ᯨ᪥ ¢ ebx
mov esi, [startapps + ebx*4] mov esi,[startapps + ebx*4]
mov edi, start_info.path mov edi,start_info.path
cld cld
@@: ;--------------------------------------
lodsb align 4
stosb @@:
test al, al lodsb
jnz @b stosb
mcall 70, start_info test al,al
jnz @b
mcall 70, start_info
; mov eax,5 ; ¯®¤®¦¤ñ¬, ¯®ª  ¯à®£à ¬¬  § ¯ãáâ¨âìáï ; mov eax,5 ; ¯®¤®¦¤ñ¬, ¯®ª  ¯à®£à ¬¬  § ¯ãáâ¨âìáï
; mov ebx,1 ;   â® ¥ñ ®ª­® ­¥ ¡ã¤¥â ®âà¨á®¢ ­® (¡ £ ¢ ï¤à¥???) ; mov ebx,1 ;   â® ¥ñ ®ª­® ­¥ ¡ã¤¥â ®âà¨á®¢ ­® (¡ £ ¢ ï¤à¥???)
; mcall ; à áª®¬¬¥­â¨àã©â¥ í⨠áâப¨, ¥á«¨ ã ¢ á ¯à®¡«¥¬ë ; mcall ; à áª®¬¬¥­â¨àã©â¥ í⨠áâப¨, ¥á«¨ ã ¢ á ¯à®¡«¥¬ë
; á ®âà¨á®¢ª®© ; á ®âà¨á®¢ª®©
;--------------------------------------
align 4
nofuncbtns: ; § ªà뢠¥¬ ¬¥­î nofuncbtns: ; § ªà뢠¥¬ ¬¥­î
jmp exit_menu jmp exit_menu
;------------------------------------------------------------------------------
_BTNS_ = 6 ; ª®«¨ç¥á⢮ ª­®¯®ª ("¯ã­ªâ®¢ ¬¥­î") _BTNS_ = 6 ; ª®«¨ç¥á⢮ ª­®¯®ª ("¯ã­ªâ®¢ ¬¥­î")
if lang eq ru if lang eq ru
@ -237,118 +243,113 @@ else
wnd_x_size = 105 ; è¨à¨­  ®ª­  wnd_x_size = 105 ; è¨à¨­  ®ª­ 
title_pos = 23 shl 16 + 7 title_pos = 23 shl 16 + 7
end if end if
;------------------------------------------------------------------------------
;******************************* ;*******************************
;******** <20>ˆ“…Œ ŽŠ<C5BD>Ž ******** ;******** <20>ˆ“…Œ ŽŠ<C5BD>Ž ********
;******************************* ;*******************************
draw_window: draw_window:
mcall 12,1 ; ­ ç¨­ ¥¬ "à¨á®¢ âì"
mov eax,12 ; ­ ç¨­ ¥¬ "à¨á®¢ âì" mov eax,[curx1] ; ⥪ã騥 ª®®à¤¨­ âë ªãàá®à 
mov ebx,1 mov [curx],eax ; § ¯¨è¥¬ ¢ ª®®à¤¨­ âë ®ª­ 
mcall mov eax,[cury1]
mov [cury],eax
mov eax,[curx1] ; ⥪ã騥 ª®®à¤¨­ âë ªãàá®à 
mov [curx],eax ; § ¯¨è¥¬ ¢ ª®®à¤¨­ âë ®ª­ 
mov eax,[cury1]
mov [cury],eax
; ⥯¥àì ¡ã¤¥¬ áç¨â âì ª®®à¤¨­ âë ®ª­ , çâ®¡ë ®­® §  ªà © íªà ­  ­¥ ¢ë«¥§«® ; ⥯¥àì ¡ã¤¥¬ áç¨â âì ª®®à¤¨­ âë ®ª­ , çâ®¡ë ®­® §  ªà © íªà ­  ­¥ ¢ë«¥§«®
mov eax,14 ; ¯®«ã稬 à §¬¥à íªà ­  mcall 14 ; ¯®«ã稬 à §¬¥à íªà ­ 
mcall
mov ebx,eax
shr eax,16 ; ¢ eax - x_screen
and ebx,0xffff ; ¢ ebx - y_screen
add eax,-wnd_x_size ; eax = [x_screen - è¨à¨­  ®ª­ ]
add ebx,-_BTNS_*15-21 ; ebx = [y_screen - ¢ëá®â  ®ª­ ]
cmp eax,[curx] mov ebx,eax
jg .okx ; ¥á«¨ ®ª­® ᫨誮¬ ¡«¨§ª® ª ¯à ¢®¬ã ªà î, shr eax,16 ; ¢ eax - x_screen
add [curx],-wnd_x_size ; ᤢ¨­¥¬ ¥£® ¢«¥¢® ­  100 and ebx,0xffff ; ¢ ebx - y_screen
.okx: add eax,-wnd_x_size ; eax = [x_screen - è¨à¨­  ®ª­ ]
add ebx,-_BTNS_*15-21 ; ebx = [y_screen - ¢ëá®â  ®ª­ ]
cmp ebx, [cury] cmp eax,[curx]
jg .oky ; ¯® ¢¥à⨪ «¨ â®ç­® â ª¦¥ jg .okx ; ¥á«¨ ®ª­® ᫨誮¬ ¡«¨§ª® ª ¯à ¢®¬ã ªà î,
add [cury], -_BTNS_*15-21 add [curx],-wnd_x_size ; ᤢ¨­¥¬ ¥£® ¢«¥¢® ­  100
.oky: ;--------------------------------------
align 4
.okx:
cmp ebx, [cury]
jg .oky ; ¯® ¢¥à⨪ «¨ â®ç­® â ª¦¥
add [cury], -_BTNS_*15-21
;--------------------------------------
align 4
.oky:
xor eax, eax ; äã­ªæ¨ï 0 - ᮧ¤ âì ®ª­®
mov ebx, [curx] ; ebx = [ª®®à¤¨­ â  ¯® x] shl 16 + [è¨à¨­ ]
shl ebx, 16
add ebx, wnd_x_size
mov ecx, [cury] ; ecx = [ª®®à¤¨­ â  ¯® y] shl 16 + [¢ëá®â ]
shl ecx, 16
add ecx, _BTNS_*15+21
mov edx, [sc.work] ; 梥â à ¡®ç¥© ®¡« áâ¨
mov esi, [sc.grab] ; 梥⠧ £®«®¢ª 
or esi, 0x81000000
mov edi, [sc.frame] ; 梥â à ¬ª¨
mcall
xor eax, eax ; äã­ªæ¨ï 0 - ᮧ¤ âì ®ª­® mov eax, 4 ; § £®«®¢®ª
mov ebx, [curx] ; ebx = [ª®®à¤¨­ â  ¯® x] shl 16 + [è¨à¨­ ] mov ebx, title_pos ; [x] shl 16 + [y]
shl ebx, 16 mov ecx, [sc.grab_text]; èà¨äâ ¨ 梥â (á¥àë©)
add ebx, wnd_x_size or ecx, 0x10000000
mov ecx, [cury] ; ecx = [ª®®à¤¨­ â  ¯® y] shl 16 + [¢ëá®â ]
shl ecx, 16
add ecx, _BTNS_*15+21
mov edx, [sc.work] ; 梥â à ¡®ç¥© ®¡« áâ¨
mov esi, [sc.grab] ; 梥⠧ £®«®¢ª 
or esi, 0x81000000
mov edi, [sc.frame] ; 梥â à ¬ª¨
mcall
mov eax, 4 ; § £®«®¢®ª push ecx
mov ebx, title_pos ; [x] shl 16 + [y] push ecx
mov ecx, [sc.grab_text]; èà¨äâ ¨ 梥â (á¥àë©) xor edx,edx
or ecx, 0x10000000 ;--------------------------------------
; add ecx, -0x333333 align 4
push ecx
push ecx
xor edx,edx
.dec_color: .dec_color:
sub byte [esp+edx], 0x33 sub byte [esp+edx], 0x33
jae @f jae @f
mov byte [esp+edx], 0 mov byte [esp+edx], 0
;--------------------------------------
align 4
@@: @@:
inc edx inc edx
jnp .dec_color jnp .dec_color
pop ecx pop ecx
mov edx, title ;  ¤à¥á § £®«®¢ª  mov edx, title ;  ¤à¥á § £®«®¢ª 
mov esi, title.size ; ¤«¨­  § £®«®¢ª  ("M E N U") mov esi, title.size ; ¤«¨­  § £®«®¢ª  ("M E N U")
mcall mcall
pop ecx pop ecx
add ebx, 1 shl 16 ; ᤢ¨­¥¬ ¢¯à ¢® ­  1 add ebx, 1 shl 16 ; ᤢ¨­¥¬ ¢¯à ¢® ­  1
mcall mcall
mov ebx, 1*65536+wnd_x_size-2 ; ­ ç¨­ ¥¬ ¤¥« âì ª­®¯ª¨ mov ebx, 1*65536+wnd_x_size-2 ; ­ ç¨­ ¥¬ ¤¥« âì ª­®¯ª¨
mov ecx, 20*65536+15 mov ecx, 20*65536+15
mov edx, 10 or 0x40000000 ; ¡¨â 30 ãáâ ­®¢«¥­ => ª­®¯ª  ­¥ à¨áã¥âáï mov edx, 10 or 0x40000000 ; ¡¨â 30 ãáâ ­®¢«¥­ => ª­®¯ª  ­¥ à¨áã¥âáï
mov edi,_BTNS_ ; ª®«¨ç¥á⢮ ª­®¯®ª (áçñâ稪) mov edi,_BTNS_ ; ª®«¨ç¥á⢮ ª­®¯®ª (áçñâ稪)
;--------------------------------------
newbtn: ; ­ ç «® 横«  align 4
mov eax,8 ; ᮧ¤ ñ¬ ª­®¯ªã newbtn: ; ­ ç «® 横« 
mcall mcall 8 ; ᮧ¤ ñ¬ ª­®¯ªã
; ¯¨è¥¬ ⥪áâ ­  ª­®¯ª¥ ; ¯¨è¥¬ ⥪áâ ­  ª­®¯ª¥
pushad ; ᯠᠥ¬ ॣ¨áâàë pushad ; ᯠᠥ¬ ॣ¨áâàë
shr ecx, 16 shr ecx, 16
and ebx, 0xffff0000 and ebx, 0xffff0000
add ebx, ecx ; ebx = [x] shl 16 + [y]; add ebx, ecx ; ebx = [x] shl 16 + [y];
add ebx, 10*65536+4 ; ebx += ᬥ饭¨¥ ®â­®á¨â¥«ì­® ªà ï ª­®¯ª¨; add ebx, 10*65536+4 ; ebx += ᬥ饭¨¥ ®â­®á¨â¥«ì­® ªà ï ª­®¯ª¨;
mov ecx, [sc.work_text] ; èà¨äâ ¨ 梥â mov ecx, [sc.work_text] ; èà¨äâ ¨ 梥â
or ecx, font or ecx, font
add edx, -10 ; edx = ­®¬¥à ª­®¯ª¨; add edx, -10 ; edx = ­®¬¥à ª­®¯ª¨;
imul edx, string_length ; edx *= ¤«¨­  áâப¨; imul edx, string_length ; edx *= ¤«¨­  áâப¨;
add edx, text ; edx += text; ⥯¥àì ¢ edx  ¤à¥á áâப¨ add edx, text ; edx += text; ⥯¥àì ¢ edx  ¤à¥á áâப¨
mov esi, string_length ; ¢ esi - ¤«¨­  áâப¨ mov esi, string_length ; ¢ esi - ¤«¨­  áâப¨
mov eax, 4 ; äã­ªæ¨ï 4 - ¢ë¢®¤ ⥪áâ  mcall 4
mcall popad
popad
inc edx ; ­®¬¥à ª­®¯ª¨++;
add ecx,15*65536 ; 㢥«¨ç¨¬ ᬥ饭¨¥ ¯® y
dec edi ; 㬥­ì訬 áçñâ稪
jnz newbtn ; ¥á«¨ ­¥ ­®«ì, ¯®¢â®à¨¬ ¢áñ ¥éñ à §
mov eax,12 ; § ª®­ç¨«¨ "à¨á®¢ âì"
mov ebx,2
mcall
ret ; ¢®§¢à â
inc edx ; ­®¬¥à ª­®¯ª¨++;
add ecx,15*65536 ; 㢥«¨ç¨¬ ᬥ饭¨¥ ¯® y
dec edi ; 㬥­ì訬 áçñâ稪
jnz newbtn ; ¥á«¨ ­¥ ­®«ì, ¯®¢â®à¨¬ ¢áñ ¥éñ à §
mcall 12,2 ; § ª®­ç¨«¨ "à¨á®¢ âì"
ret ; ¢®§¢à â
;------------------------------------------------------------------------------
align 4
; „€<E2809E><E282AC><20><>Žƒ<C5BD>€ŒŒ ; „€<E2809E><E282AC><20><>Žƒ<C5BD>€ŒŒ
DATA
macro strtbl name, [string] macro strtbl name, [string]
{ {
@ -385,37 +386,46 @@ DATA
ru, '<27> áâனª  ãáâனá⢠',\ ru, '<27> áâனª  ãáâனá⢠',\
ru, '<27> áâனª  ¬®­¨â®à  ',\ ru, '<27> áâனª  ¬®­¨â®à  ',\
ru, '<27>à®æ¥ááë ' ru, '<27>à®æ¥ááë '
;------------------------------------------------------------------------------
start_info:
.mode dd 7
dd 0
.params dd 0
dd 0
dd 0
db 0
dd start_info.path
; <20>ˆ<E280A6>ˆˆˆˆ<E280A1>Ž<E2809A><E282AC>… „€<E2809E><E282AC>
UDATA
processes dd ? ; ª®«¨ç¥á⢮ ¯à®æ¥áᮢ ¢ á¨á⥬¥
curx1 dd ? ; ª®®à¤¨­ âë ªãàá®à 
cury1 dd ?
curx dd ? ; ª®®à¤¨­ âë ®ª­  ¬¥­î
cury dd ?
menu_opened db ? ; ®âªàëâ® ¬¥­î ¨«¨ ­¥â? (1-¤ , 0-­¥â)
align 4 align 4
start_info.path rb 256 start_info:
.mode dd 7
dd 0
.params dd 0
dd 0
dd 0
db 0
dd start_info.path
;------------------------------------------------------------------------------
IM_END:
align 4
; <20>ˆ<E280A6>ˆˆˆˆ<E280A1>Ž<E2809A><E282AC>… „€<E2809E><E282AC>
processes dd ? ; ª®«¨ç¥á⢮ ¯à®æ¥áᮢ ¢ á¨á⥬¥
curx1 dd ? ; ª®®à¤¨­ âë ªãàá®à 
cury1 dd ?
curx dd ? ; ª®®à¤¨­ âë ®ª­  ¬¥­î
cury dd ?
sc system_colors ; á¨á⥬­ë¥ æ¢¥â  menu_opened db ? ; ®âªàëâ® ¬¥­î ¨«¨ ­¥â? (1-¤ , 0-­¥â)
procinfo process_information ; ¨­ä®à¬ æ¨ï ® ¯à®æ¥áᥠ;------------------------------------------------------------------------------
procinfo2 process_information align 4
start_info.path rb 256
rb 1024 ; áâíª ¤«ï ®ª­  ¬¥­î - 墠â¨â ¨ 1 Š¡ ;------------------------------------------------------------------------------
align 32 align 4
stack_wnd: sc system_colors ; á¨á⥬­ë¥ 梥â 
;------------------------------------------------------------------------------
align 4
MEOS_APP_END procinfo process_information ; ¨­ä®à¬ æ¨ï ® ¯à®æ¥áá¥
;------------------------------------------------------------------------------
align 4
rb 512 ; áâíª ¤«ï ®ª­  ¬¥­î - 墠â¨â ¨ 1 Š¡
stack_wnd:
;------------------------------------------------------------------------------
align 4
rb 512
stack_area:
;------------------------------------------------------------------------------
I_END:
;------------------------------------------------------------------------------
; ŠŽ<C5A0> <20><>Žƒ<C5BD>€ŒŒ ; ŠŽ<C5A0> <20><>Žƒ<C5BD>€ŒŒ
;------------------------------------------------------------------------------

View File

@ -1,5 +1,6 @@
@erase lang.inc @erase lang.inc
@echo lang fix en >lang.inc @echo lang fix en >lang.inc
@fasm @rb.asm @rb @fasm @rb.asm @rb
@kpack @rb
@erase lang.inc @erase lang.inc
@pause @pause

View File

@ -1,5 +1,6 @@
@erase lang.inc @erase lang.inc
@echo lang fix ru >lang.inc @echo lang fix ru >lang.inc
@fasm @rb.asm @rb @fasm @rb.asm @rb
@kpack @rb
@erase lang.inc @erase lang.inc
@pause @pause