kolibrios-fun/programs/develop/libraries/box_lib/trunk/optionbox.mac
Marat Zakiyanov (Mario79) 79c0315dca BoxLib: Small reorganization for user-macros.
1) Now all the macros used by other applications to work with BoxLib located in box_lib.mac 
2) Macros for components that are used only in the library BoxLib - located in  bl_sys.mac, a list of include files. 
3) Big requests to other developers  -support this rule, it will do easier to use macros for other applications.

git-svn-id: svn://kolibrios.org@1432 a494cfbc-eb01-0410-851d-a64ba20cac60
2010-03-12 19:52:43 +00:00

198 lines
6.8 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;ä ©« ᮧ¤ ­ 13.02.2009 <Lrz> <20>  ª®¤ ¯à¨¬¥­¥­  GPL2 «¨æ¥­§¨ï
;Œ ªà®á ¤«ï á¨á⥬­®© ¡¨¡«¨®â¥ª¨ box_lib.obj
;Optionbox
macro use_optionbox_driver ;¬ ªà®áë ª®â®àë¥ ã¯à ¢«ïîâ à ¡®â®© ¡®ªá  )
{
option_box_draw:
pusha
mov eax,dword [esp+36]
@@: mov edi,dword [eax]
test edi,edi
je option_check
call option_box_draw_box
add eax,4
jmp @b
option_check:
mov eax,dword [esp+36]
@@: mov edi,dword [eax]
test edi,edi
je @f
mov ebx,dword [edi]
mov ebx,dword [ebx]
cmp edi,ebx
jne .clear_op
pusha
call option_box_draw_op
popa
add eax,4
jmp @b
.clear_op:
pusha
call option_box_clear_op
popa
add eax,4
jmp @b
@@: popa
ret 4
; exit ¢®®¡é¥ :)
option_box_mouse:
pusha
mcall 37,2
test eax,eax
jnz @f
popa
ret 4
@@:
mov eax,dword [esp+36]
@@: mov edi,dword [eax]
test edi,edi
je option_check
call option_box_mouse_op
add eax,4
jmp @b
}
macro use_optionbox_draw
{
option_box_draw_box:
option_group equ [edi]
op_left equ [edi+4] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® å
op_top equ [edi+6] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® ã
op_text_margin equ [edi+8] ;=4 à ááâ®ï­¨¥ ®â ¯àאַ㣮«ì­¨ª  祪 ¡®ªá  ¤® ­ ¤¯¨á¨
op_size equ [edi+12] ;12 à §¬¥à ª¢ ¤à â  祪 ¡®ªá 
op_color equ [edi+16]
op_border_color equ [edi+20] ; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦­® § ¤ âì á ¬®áâ®ï⥫쭮
op_text_color equ [edi+24];[edi+4] ;梥â ⥪áâ 
op_text_ptr equ [edi+28] ;㪠§ â¥«ì ­  ­ ç «® ⥪á⮢®© áâப¨
op_text_length equ [edi+32]
op_flags equ [edi+36] ;ä« £¨
pusha ;á®åà ­¨¬ ¢á¥ ॣ¨áâàë
movzx ebx,word op_left
shl ebx,16
add ebx,dword op_size
movzx ecx,word op_top
shl ecx,16
add ecx,dword op_size
mov edx,dword op_border_color
mov eax,13
mcall ;à¨á㥬 à ¬ªã
mov edx,dword op_color
add ebx,1 shl 16 - 2
add ecx,1 shl 16 - 2
mcall ;§ ªà è¨¢ ¥¬ ¢­ãâ७­®á⨠祪¡®ªá 
; mov eax,dword option_group
; mov dword eax,[eax]
; cmp eax,edi
; jne @f
; call option_box_draw_op ;­ à¨á®¢ âì ¢ª«î祭­ë© 祪 ¡®ªá
;----------------------------
;à áç¥â ªã¤  ¡ã¤¥â ¯à®¨§¢¥¤¥­ ¢ë¢®¤ ⥪áâ 
;----------------------------
@@: movzx ebx,word op_left ;§ £à㧨âì §­ ç¥­¨¥ å ¤«ï 祪 ¡®ªá 
add ebx,dword op_size
add ebx,dword op_text_margin;¤®¡ ¢¨âì à §¬¥à áâ®à®­ë ¨ à ááâ®ï­¨¥ ­  ª®â®à®¬ ­ ç­¥âáï ¢ë¢®¤ ⥪áâ 
shl ebx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov bx,word op_top ;§ £à㧨¬ §­ ç¥­¨¥ ¯® y
add ebx,op_size
mov ecx,dword op_text_color ;§ £à㧨¬ 梥⠭ ¤¯¨á¨ + flags
sub ebx,7 ;¤®¡ ¢¨¬ §­ ç¥­¨¥ ¤«¨­ë áâ®à®­ë -9+2
mov edx,dword op_text_ptr ;㪠¦¥¬  ¤à¥á ®â ªã¤  ­ã¦­® ¢ë¢®¤¨âì áâபã
mov esi,dword op_text_length
;¢­¥á¥¬ ¢ eax §­ ç¥­¨¥ ¢ë¢®¤  ­ ¤¯¨á¨ ­  ª ­¢ã
mov eax,4
mcall ;‚뢮¤
popa ;¢®ááâ ­®¢¨âì §­ ç¥­¨ï ॣ¨áâ஢ ¨§ á⥪ 
ret ;¢ë©¤¥¬ ¨§ ¯à®æ¥¤ãàë
option_box_clear_op: ;®ç¨á⪠ 祪 ¡®ªá 
mov edx,dword op_color ;梥⠢­ãâਠ祪 ¡®ªá 
jmp @f ;¡¥§ãá«®¢­ë© ¯à릮ª ­  ­¨¦­îî ¬¥âªã @@
option_box_draw_op: ;­ à¨á®¢ âì ¢ª«î祭­ë© 祪 ¡®ªá
mov edx,dword op_border_color ;§ £à㧨âì 梥â
@@:
movzx ebx,word op_left ;§ £à㧨âì ª®®à¤¨­ âã ¯® å
mov eax,dword op_size
mov bp,ax
shr eax,2
push ax
push ax
add ebx,eax
shl ebx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
pop ax
lea eax,[eax*2]
sub bp,ax ;á®åà ­¨¬ ॣ¨áâà bx ¢ ॣ¨áâॠ㪠§ â¥«ï ¡ §ë
mov bx,bp
movzx ecx,word op_top ;§ £à㧨âì ª®®à¤¨­ âã ¯® ã
pop ax
add cx,ax
shl ecx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov cx,bp ;§ £à㧨¬ §­ ç¥­¨ï ॣ¨áâà  ãª § â¥«ï ¡ §ë ¢ cx
mov eax,13 ;¢ eax - §­ ç¥­¨ï ä㭪樨 ¤«ï ¢ë¢®¤  ¯®«®áë â.¥. ¯® áã⨠¯àאַ㣮«ì­¨ª , ª®â®àë© ®â®¡à ¦ ¥â ¢ª«î祭­ë© ª®¬¯®­¥­â 祪 ¡®ªá
mcall ;¢ë¢®¤
ret ;¢ë©â¨ ¨§ ¯à®æ¥¤ãàë
}
macro use_optionbox_mouse
{
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Ž¡à ¡®â稪 mouse
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
option_box_mouse_op: ;®¡à ¡®âª  ¬ëè¨
pusha
mov esi,dword op_text_length ;§ £à㧨âì ª®«-¢® ᨬ¢®«®¢ ¢ ⥪á⮢®© áâப¥
;“¬­®¦¥­¨¥ ­  6 <20>ëáâ஥ 㬭®¦¥­¨¥ ¬®¦­® ¢®á¯®«ì§®¢ âìáï «î¡ë¬ ¬§ ¬¥â®¤®¢, ­® ­  áâ àëå <20>à®æ¥áá®à å (386,486,P1)¡ëáâ॥ ¡ã¤¥â á ¨­áâàãªæ¨¥© Lea
; lea esi,[eax*2+eax]
; shl eax,1
imul esi,6 ; ¨«¨ ¬®¦­® ¨ â ª 㬭®¦¨âì ­  6
xor ebx,ebx
add esi,dword op_text_margin ;¤®¡ ¢¨âì 3 - à ááâ®ï­¨¥ ®â 祪 ¡®ªá  ¤® ­ ¤¯¨á¨
mov eax,37 ;¯®«ã稬 ª®®à¤¨­ âë ¬ë誨
inc ebx ;¤®¡ ¢¨âì 1
mcall ;¯®«ãç¨âì ª®®à¤¨­ âë ªãàá®à  ®â­®á¨â¥«ì­® ®ª­ 
movzx ebx,word op_top ;§ £à㧨âì ¢ bx §­ ç¥­¨¥ ª®®à¤¨­ âë ã
cmp ax,bx ;áà ¢­¨âì á á ª®®à¤¨­ â®© ªãàá®à 
jl option_box_mouse_end ;SF <> OF ¥á«¨ ¬¥­ìè¥
add ebx,dword op_size ;¤®¡ ¢¨âì à §¬¥à
cmp ax,bx ;áà ¢­¨âì
jg option_box_mouse_end ;ZF = 0 ¨ SF = OF ¥á«¨ ¡®«ìè¥
shr eax,16 ;à §¤¥«¨¬ ­  65536 ¨«¨ ¯à®á⮠ᤢ¨­¥¬ ¡¨âë ­  16 §­ ç¥­¨©
movzx ebx,word op_left ;¯à®¨§¢¥¤¥¬  ­ «®£¨ç­®¥ áà ¢­¥­¨¥
cmp ax,bx ;áà ¢­¨âì ॣ¨áâàë
jl option_box_mouse_end ;¥á«¨ ¬¥­ìè¥
add ebx,dword op_size ;¤®¡ ¢¨âì ¤«¨­ã áâ®à®­ë ¯àאַ㣮«ì­¨ª 
add ebx,esi ;“ç¥áâì ¢ §­ ç¥­¨¨ ¯® å ¥é¥ ¨ ¤«¨­ã ­ ¤¯¨á¨ ª 祪¡®ªáã
cmp ax,bx ;áâà ¢­¨âì ॣ¨áâàë
jg option_box_mouse_end ;¥á«¨ ¡®«ìè¥
mov eax,dword option_group
mov [eax],edi
option_box_mouse_end:
popa ;¢®ááâ ­®¢¨âì ॣ¨áâàë ¨§ á⥪ 
ret ;¢ë©â¨
}