git-svn-id: svn://kolibrios.org@355 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Alexey Teplov ( 2007-02-16 10:48:41 +00:00
parent b0776c09ad
commit 95ecd429a8
4 changed files with 602 additions and 0 deletions

View File

@ -0,0 +1,269 @@
; new application structure
macro meos_app_start
{
use32
org 0x0
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
dd 0x0
}
MEOS_APP_START fix meos_app_start
macro code
{
__start:
}
CODE fix code
macro data
{
__data:
}
DATA fix data
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
macro mov arg1,arg2
{
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
dw ? ; +52 - reserved
.client_left dd ? ; +54
.client_top dd ? ; +58
.client_width dd ? ; +62
.client_height dd ? ; +66
.wnd_state db ? ; +70
rb (1024-71)
}
struct process_information
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
; constants
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b

View File

@ -0,0 +1,115 @@
;ª®¬¯®­¥­â OptionBox (Žá­®¢ ­ ­  Checkbox)
;Ž£à®¬­ ï ¡« £®¤ à­®áâì Maxxxx32, Diamond, ¨ ¤à㣨¬ ¯à®£à ¬¬¨áâ ¬, ¨ ¨å ¯à®£à ¬¬ ¬, ¡¥§
;ª®â®àëå ï ­¥ ᬮ£ ¡ë ­ ¯¨á âì íâ®â ª®¬¯®­¥­â.
;16.02.2007
;<Lrz> - ’¥¯«®¢ €«¥ªá¥© www.lrz.land.ru
;§ £®«®¢®ª ¯à¨«®¦¥­¨ï
use32 ; âà ­á«ïâ®à, ¨á¯®«ì§ãî騩 32 à §à來ëå ª®¬ ­¤ë
org 0x0 ; ¡ §®¢ë©  ¤à¥á ª®¤ , ¢á¥£¤  0x0
db 'MENUET01' ; ¨¤¥­â¨ä¨ª â®à ¨á¯®«­ï¥¬®£® ä ©«  (8 ¡ ©â)
dd 0x1 ; ¢¥àá¨ï ä®à¬ â  § £®«®¢ª  ¨á¯®«­ï¥¬®£® ä ©« 
dd start ;  ¤à¥á, ­  ª®â®àë© á¨á⥬  ¯¥à¥¤ ñâ ã¯à ¢«¥­¨¥
; ¯®á«¥ § £à㧪¨ ¯à¨«®¦¥­¨ï ¢ ¯ ¬ïâì
dd i_end ; à §¬¥à ¯à¨«®¦¥­¨ï
dd (i_end+0x100) and not 3 ; Ž¡ê¥¬ ¨á¯®«ì§ã¥¬®© ¯ ¬ïâ¨, ¤«ï á⥪  ®â¢¥¤¥¬ 0å100 ¡ ©â ¨ ¢ë஢­¨¬ ­  £à­¨æã 4 ¡ ©â 
dd (i_end+0x100) and not 3 ; à á¯®«®¦¨¬ ¯®§¨æ¨î á⥪  ¢ ®¡« á⨠¯ ¬ïâ¨, áࠧ㠧  ⥫®¬ ¯à®£à ¬¬ë. ‚¥à設  á⥪  ¢ ¤¨ ¯ §®­¥ ¯ ¬ïâ¨, 㪠§ ­­®¬ ¢ëè¥
dd 0x0,0x0 ; 㪠§ â¥«ì ­  áâபã á ¯ à ¬¥âà ¬¨.
; ¥á«¨ ¯®á«¥ § ¯ã᪠ ­¥à ¢­® ­ã«î, ¯à¨«®¦¥­¨¥ ¡ë«®
; § ¯ã饭® á ¯ à ¬¥âà ¬¨ ¨§ ª®¬ ­¤­®© áâப¨
; 㪠§ â¥«ì ­  áâபã, ¢ ª®â®àãî § ¯¨á ­ ¯ãâì,
; ®âªã¤  § ¯ã饭® ¯à¨«®¦¥­¨¥
;------------------
include 'macros.inc'
include 'optionbox.inc' ;¢ª«îç¨âì ä ©« check.inc
use_option_box ;¨á¯®«ì§ãï ¬ ªà®áë ¢­¥á⨠¯à®æ¥¤ãàë ¤«ï à¨á®¢ ­¨ï 祪 ¡®ªá 
align 16
;Ž¡« áâì ª®¤ 
start: ;’®çª  ¢å®¤  ¢ ¯à®£à ¬¬ã
mov eax,48 ;¯®«ãç¨âì á¨á⥬­ë¥ 梥â 
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
int 0x40
mov eax,40 ;ãáâ ­®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
mov ebx,0x25 ;á¨á⥬  ¡ã¤¥â ॠ£¨à®¢ âì ⮫쪮 ­  á®®¡é¥­¨¥ ® ¯¥à¥à¨á®¢ª¥,­ ¦ â  ª­®¯ª , ®¯à¥¤¥«ñ­­ ï à ­¥¥, ᮡë⨥ ®â ¬ëè¨ (çâ®-â® á«ã稫®áì - ­ ¦ â¨¥ ­  ª­®¯ªã ¬ëè¨ ¨«¨ ¯¥à¥¬¥é¥­¨¥; á¡à á뢠¥âáï ¯à¨ ¯à®ç⥭¨¨)
int 0x40
red_win:
call draw_window ;¯¥à¢®­ ç «ì­® ­¥®¡å®¤¨¬® ­ à¨á®¢ âì ®ª­®
still: ;®á­®¢­®© ®¡à ¡®â稪
mov eax,10 ;Ž¦¨¤ âì ᮡëâ¨ï
int 0x40 ;®¦¨¤ âì ᮡë⨥ ¢ â¥ç¥­¨¥ 2 ¬¨««¨á¥ªã­¤
cmp al,0x1 ;¥á«¨ ¨§¬¥­¨«®áì ¯®«®¦¥­¨¥ ®ª­ 
jz red_win
cmp al,0x3 ;¥á«¨ ­ ¦ â  ª­®¯ª  â® ¯¥à¥©â¨
jz button
mouse_option_boxes option_boxes,option_boxes_end ;¯à®¢¥àª  祪 ¡®ªá 
jmp still ;¥á«¨ ­¨ç¥£® ¨§ ¯¥à¥ç¨á«¥­­®£® â® á­®¢  ¢ 横«
button:
mov eax,17 ;¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª« ¢¨è¨
int 0x40
test ah,ah ;¥á«¨ ¢ ah 0, â® ¯¥à¥©â¨ ­  ®¡à ¡®â稪 ᮡë⨩ still
jz still
or eax,-1 ;¢ eax,-1 - 5 ,¡ ©â®¢ ã ­ á ¦¥ ⮫쪮 3 ¢ë©â¨
int 0x40 ;¤ «¥¥ ¢ë¯®«­ï¥âáï ¢ë室 ¨§ ¯à®£à ¬¬ë
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
draw_window: ;à¨á®¢ ­¨¥ ®ª­  ¯à¨«®¦¥­¨ï
mov eax,12 ;¢ ॣ¨áâà ¢­¥á⨠§­ ç¥­¨¥ = 12
mov ebx,1 ;¯à¨á¢®¨âì 1
int 0x40
xor eax,eax ;®¡­ã«¨âì eax
mov ebx,50*65536+180 ;[ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ x]
mov ecx,30*65536+200 ;[ª®®à¤¨­ â  ¯® ®á¨ y]*65536 + [à §¬¥à ¯® ®á¨ y]
mov edx,[sc.work] ; color of work area RRGGBB,8->color gl
or edx,0xb3000000
mov esi,[sc.work_text]
mov edi,hed;0x005080DD ;0x00RRGGBB - 梥â à ¬ª¨
int 0x40 ;­ à¨á®¢ âì ®ª­® ¯à¨«®¦¥­¨ï
draw_option_boxes option_boxes,option_boxes_end ;à¨á®¢ ­¨¥ 祪¡®ªá®¢
mov eax,12 ;”ã­ªæ¨ï 12 - ­ ç âì/§ ª®­ç¨âì ¯¥à¥à¨á®¢ªã ®ª­ .
mov ebx,2 ;<3B>®¤äã­ªæ¨ï 2 - § ª®­ç¨âì ¯¥à¥à¨á®¢ªã ®ª­ .
int 0x40
ret
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;DATA ¤ ­­ë¥
;”®à¬ â ¤ ­­ëå 祪 ¡®ªá :
;10 - ª®®à¤¨­ â  祪 ¡®ªá  ¯® å
;30 - ª®®à¤¨­ â  祪 ¡®ªá  ¯® ã
;0xffffff - 梥⠢­ãâਠ祪 ¡®ªá 
;0 - 梥â à ¬ª¨ 祪 ¡®ªá 
;0 - 梥â ⥪áâ  ­ ¤¯¨á¨
;op_text.1 - 㪠§ â¥«ì ­  ­ ç «® áâப¨
;option_group1 - íâ® ¯à¨§­ ª £à㯯ë, â.¥. íâ®â ª®¤ ¬®¦¥â ®¡à ¡ â뢠âì ¬­®£® £à㯯 ¨§ optibox
;op_text.e1-ch_text.1 - ¤«¨­  áâப¨
;
option_boxes:
op1 option_box 10,15,0xffffff,0,0,ch_text.1,ch_text.e1-ch_text.1,option_group1
op2 option_box 10,30,0xffffff,0,0,ch_text.2,ch_text.e2-ch_text.2,option_group1
op3 option_box 10,45,0xffffff,0,0,ch_text.3,ch_text.e3-ch_text.3,option_group1
op11 option_box 10,80,0xffffff,0,0,ch_text.1,ch_text.e1-ch_text.1,option_group2
op12 option_box 10,95,0xffffff,0,0,ch_text.2,ch_text.e2-ch_text.2,option_group2
op13 option_box 10,110,0xffffff,0,0,ch_text.3,ch_text.e3-ch_text.3,option_group2
option_boxes_end:
ch_text: ; ‘®¯à®¢®¦¤ î騩 ⥪áâ ¤«ï 祪 ¡®ªá®¢
.1 db 'Option_Box #1'
.e1:
.2 db 'Option_Box #2'
.e2:
.3 db 'Option_Box #3'
.e3:
option_group1 dd op1 ;㪠§ â¥«¨, ®­¨ ®â®¡à ¦ îâáï ¯® 㬮«ç ­¨î, ª®£¤  ¢ë¢®¤¨âáï
option_group2 dd op11 ;¯à¨«®¦¥­¨¥
hed db 'Optionbox [16.02.2007]',0 ;§ £®«®¢®ª ¯à¨«®¦¥­¨ï
sc system_colors
i_end: ;ª®­¥æ ª®¤ 

View File

@ -0,0 +1,2 @@
@fasm.exe optionbox.asm optionbox
@mtappack.exe optionbox

View File

@ -0,0 +1,216 @@
;ª®¬¯®­¥­â OptionBox (Žá­®¢ ­ ­  Checkbox)
;Ž£à®¬­ ï ¡« £®¤ à­®áâì Maxxxx32, Diamond, ¨ ¤à㣨¬ ¯à®£à ¬¬¨áâ ¬, ¨ ¨å ¯à®£à ¬¬ ¬, ¡¥§
;ª®â®àëå ï ­¥ ᬮ£ ¡ë ­ ¯¨á âì íâ®â ª®¬¯®­¥­â.
;16.02.2007
;<Lrz> - ’¥¯«®¢ €«¥ªá¥© www.lrz.land.ru
macro use_option_box
{
op_text_margin=4 ;à ááâ®ï­¨¥ ®â ¯àאַ㣮«ì­¨ª  祪 ¡®ªá  ¤® ­ ¤¯¨á¨
op_size=10 ;à §¬¥à ª¢ ¤à â  祪 ¡®ªá 
op_left equ [edi] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® å
op_top equ [edi+2] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® ã
op_color equ [edi+4] ;梥⠢­ãâਠoptionbox
op_border_color equ [edi+8] ;梥â à ¬ª¨ optionbox
op_text_color equ [edi+12] ;梥â ⥪áâ 
op_text_ptr equ [edi+16] ;㪠§ â¥«ì ­  ­ ç «® ⥪á⮢®© áâப¨
op_text_length equ [edi+20] ;¤«¨­  ­ ¤¯¨á¨ (2^64 â ª®© ¤«¨­ë ¬®¦¥â ¡ëâì ⥪áâ)
op_optibox_gr equ [edi+22]
option_box:
.draw:
pusha ;á®åà ­¨¬ ¢á¥ ॣ¨áâàë
mov eax,38 ;à¨á®¢ ­¨¥ «¨­¨¨
movzx ebx,word op_left ;¯®«®¦¥­¨¥ ¯® å
mov ecx,ebx ;á®åà ­¨¬ ¢ ॣ¨áâॠcx §­ ç¥­¨¥ bx 1 ¬¨ªà®®¯¥à æ¨ï
;push bx ;3 - ¬¨ªà®®¯¥à æ¨¨ ¨á¯®«ì§ãï á⥪ ¬®¦­® ¢ë¨£à âì ¢ à §¬¥à¥, ¨á¯®«ì§ãï ॣ¨áâàë - ¢ ᪮à®áâ¨
shl ebx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
;pop bx ;2 - ¬¨ªà®®¯¥à æ¨¨ ­  ¤ ­­ë© ¬®¬¥­â áä®à¬¨à®¢ ­  [ª®®à¤¨­ â  ­ ç «  ¯® ®á¨ x]*65536 + [ª®®à¤¨­ â  ­ ç «  ¯® ®á¨ x]
mov bx,cx ;¢®ááâ ­®¢¨¬ §­ ç¥­¨¥ bx
movzx ecx,word op_top ;§ £à㧨¬ ¢ cx §­ ç¥­¨¥ y
mov esi,ecx ;á®åà ­¨¬ §­ ç¥­¨¥ ॣ¨áâà  cx ¢ ॣ¨áâà 㪠§ â¥«ì si
;push cx
shl ecx,16 ; ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536) mov cx,si ;¢®ááâ ­®¢¨¬ §­ ç¥­¨¥ ॣ¨áâà  cx
mov cx,si ;¢®ááâ ­®¢¨¬ §­ ç¥­¨¥ ॣ¨áâà  cx
;pop cx ;[ª®®à¤¨­ â  ­ ç «  ¯® ®á¨ y]*65536 + [ª®®à¤¨­ â  ­ ç «  ¯® ®á¨ y]
;push cx
add ecx,op_size ;[ª®®à¤¨­ â  ­ ç «  ¯® ®á¨ y]*65536 + [ª®®à¤¨­ â  ª®­æ  ¯® ®á¨ y]
mov edx,op_border_color ;–¢¥â «¨­¨¨
int 0x40 ;à¨á®¢ ­¨¥ ¢¥à⨪ «ì­®© «¥¢®© «¨­¨¨ ª¢ ¤à â  (¯àאַ㣮«ì­¨ª )
;
mov ebp,ebx ;á®åà ­¨¬ ॣ¨áâà bx ¢ ॣ¨áâॠ㪠§ â¥«ï ¡ §ë
;push bx ;¢â®«ª­ãâì ¢ bx [ª®®à¤¨­ â  ­ ç «  ¯® ®á¨ å]*65536 + [ª®®à¤¨­ â  ­ ç «  ¯® ®á¨ x]
add ebx,op_size ;[ª®®à¤¨­ â  ­ ç «  + ¤«¨­  áâ®à®­ë ¯® ®á¨ å]
ror ebx,16 ;[ª®®à¤¨­ â  ­ ç «  + ¤¨­  áâ®à®­ë ¯® ®á¨ å]*65536
add ebx,op_size ;[ª®®à¤¨­ â  ­ ç « +¤«¨­  áâ®à®­ë ¯® ®á¨ å]*65536 + [ª®®à¤¨­ â  ­ ç « +¤«¨­  áâ®à®­ë ¯® ®á¨ x]
int 0x40
mov bx,bp ;¢®ááâ ­®¢¨¬ §­ ç¥­¨¥ ॣ¨áâà  bx
;pop bx
mov cx,si ;á®åà ­¨¬ §­ ç¥­¨¥ ॣ¨áâà  cx ¢ ॣ¨áâà 㪠§ â¥«ì
;pop cx
int 0x40
add ecx,op_size ;¤®¡ ¢¨¬ à §¬¥à áâ®à®­ë
mov esi,ecx ;á®åà ­¨¬ §­ ç¥­¨¥ ॣ¨áâà  cx ¢ ॣ¨áâà 㪠§ â¥«ì si
;push cx
shl ecx,16
mov cx,si
;pop cx
int 0x40 ;­ à¨á®¢ «¨ ¯àאַ㣮«ì­¨ª
mov eax,13 ;§ ªà è¨¢ ¥¬ ¥£®. ”ã­ªæ¨ï 13 - ­ à¨á®¢ âì ¯®«®áã
movzx ebx,word op_left ;§ £à㧨âì ¢ bx, ¯®«®¦¥­¨¥ ¯® å
add ebx,1 ;ᤢ¨­¥¬ ­  1 â.¥. ¯à¨¡ ¢¨¬ 1 ¨­ ç¥ § âà¥âáï à ¬ª 
shl ebx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov bx,op_size ;¯à¨¡ ¢¨¬ ¤«¨­ã áâ®à®­ë ¯àאַ㣮«ì­¨ª 
sub ebx,1 ;¢ëç⥬ 1 â.ª. ¨­ ç¥ § âà¥âáï à ¬ª 
mov bp,bx ;á®åà ­¨¬ ॣ¨áâà bx ¢ ॣ¨áâॠ㪠§ â¥«ï ¡ §ë
;push bx
movzx ecx,word op_top ;§ £à㧨¬ ª®®à¤¨­ âë ¯® y
add ecx,1 ;ᤢ¨­¥¬ ­  1 â.¥. ¯à¨¡ ¢¨¬ 1 ¨­ ç¥ § âà¥âáï à ¬ª 
shl ecx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov cx,bp ;¢®ááâ ­®¢¨¬ §­ ç¥­¨¥ ॣ¨áâà  cx
;pop cx
mov edx,op_color ;§ £à㧨¬ 梥⠯®«®áë
int 0x40 ;§ ªà á¨«¨
mov eax,op_optibox_gr
mov dword eax,[eax]
cmp eax,edi
jne @f
call .draw_op ;­ à¨á®¢ âì ¢ª«î祭­ë© 祪 ¡®ªá
;----------------------------
;à áç¥â ªã¤  ¡ã¤¥â ¯à®¨§¢¥¤¥­ ¢ë¢®¤ ⥪áâ 
;----------------------------
@@: movzx ebx,word op_left ;§ £à㧨âì §­ ç¥­¨¥ å ¤«ï 祪 ¡®ªá 
add ebx,(op_size+op_text_margin) ;¤®¡ ¢¨âì à §¬¥à áâ®à®­ë ¨ à ááâ®ï­¨¥ ­  ª®â®à®¬ ­ ç­¥âáï ¢ë¢®¤ ⥪áâ 
shl ebx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov bx,op_top ;§ £à㧨¬ §­ ç¥­¨¥ ¯® y
add ebx,(op_size-9+2) ;¤®¡ ¢¨¬ §­ ç¥­¨¥ ¤«¨­ë áâ®à®­ë -9+2
mov ecx,op_text_color ;§ £à㧨¬ 梥⠭ ¤¯¨á¨
mov edx,op_text_ptr ;㪠¦¥¬  ¤à¥á ®â ªã¤  ­ã¦­® ¢ë¢®¤¨âì áâபã
movzx esi,word op_text_length ;‡ £à㧨¬ ¤«¨­ã ­ ¤¯¨á¨ ¢ esi
;¢­¥á¥¬ ¢ eax §­ ç¥­¨¥ ¢ë¢®¤  ­ ¤¯¨á¨ ­  ª ­¢ã
mov eax,4
int 0x40 ;‚뢮¤
popa ;¢®ááâ ­®¢¨âì §­ ç¥­¨ï ॣ¨áâ஢ ¨§ á⥪ 
ret ;¢ë©¤¥¬ ¨§ ¯à®æ¥¤ãàë
.clear_op: ;®ç¨á⪠ 祪 ¡®ªá 
mov edx,op_color ;梥⠢­ãâਠ祪 ¡®ªá 
jmp @f ;¡¥§ãá«®¢­ë© ¯à릮ª ­  ­¨¦­îî ¬¥âªã @@
.draw_op: ;­ à¨á®¢ âì ¢ª«î祭­ë© 祪 ¡®ªá
mov edx,op_border_color ;§ £à㧨âì 梥â
@@:
movzx ebx,word op_left ;§ £à㧨âì ª®®à¤¨­ âã ¯® å
add ebx,(op_size/3) ;¤®¡ ¢¨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /3)
shl ebx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov bx,(op_size/2) ;§ £à㧨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /2)
mov bp,bx ;á®åà ­¨¬ ॣ¨áâà bx ¢ ॣ¨áâॠ㪠§ â¥«ï ¡ §ë
;push bx
movzx ecx,word op_top ;§ £à㧨âì ª®®à¤¨­ âã ¯® ã
mov eax,13 ;¢ eax - §­ ç¥­¨ï ä㭪樨 ¤«ï ¢ë¢®¤  ¯®«®áë â.¥. ¯® áã⨠¯àאַ㣮«ì­¨ª , ª®â®àë© ®â®¡à ¦ ¥â ¢ª«î祭­ë© ª®¬¯®­¥­â 祪 ¡®ªá
add ecx,(op_size/3) ;¤®¡ ¢¨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /3)
shl ecx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov cx,bp ;§ £à㧨¬ §­ ç¥­¨ï ॣ¨áâà  ãª § â¥«ï ¡ §ë ¢ cx
;pop cx
int 0x40 ;¢ë¢®¤
ret ;¢ë©â¨ ¨§ ¯à®æ¥¤ãàë
.mouse: ;®¡à ¡®âª  ¬ëè¨
pusha
mov eax,37 ;¡ã¤¥¬ çâ® â® ¤¥« âì ¥á«¨ ã ­ á çâ® - ­¨âì ­ ¦ â®
mov ebx,2 ;¢­¥á⨠¢ ॣ¨áâà §­ ç¥­¨¥ 2
int 0x40 ;¯à®¢¥àª  ­¥ ­ ¦ « «¨ ¯®«ì§®¢ â¥«ì ª­®¯ªã ¬ë誨
test eax,eax ;¯à®¢¥àª  ¥á«¨ ã ­ á ¢ eax=0, â® ãáâ ­®¢¨¬ ä« £ ¨ ¢ë©¤¥¬
jnz @f ;¯¥à¥©â¨ ­  ­¨¦­îî ¬¥âªã @@
popa ;¥á«¨ ­¨ç¥£® ­¥ ¯à®¨§®è«®, â® ¢®ááâ ­®¢¨¬ §­ ç¥­¨ï ॣ¨áâ஢ ¨§ á⥪ 
ret ;¢ë室
@@:
movzx esi,word op_text_length ;§ £à㧨âì ª®«-¢® ᨬ¢®«®¢ ¢ ⥪á⮢®© áâப¥
;“¬­®¦¥­¨¥ ­  6 <EFBFBD>ëáâ஥ 㬭®¦¥­¨¥ ¬®¦­® ¢®á¯®«ì§®¢ âìáï «î¡ë¬ ¬§ ¬¥â®¤®¢, ­® ­  áâ àëå <EFBFBD>à®æ¥áá®à å (386,486,P1)¡ëáâ॥ ¡ã¤¥â á ¨­áâàãªæ¨¥© Lea
;lea esi,[eax*2+eax]
;shl eax,1
imul esi,6 ; ¨«¨ ¬®¦­® ¨ â ª 㬭®¦¨âì ­  6
add esi,op_text_margin ;¤®¡ ¢¨âì 3 - à ááâ®ï­¨¥ ®â 祪 ¡®ªá  ¤® ­ ¤¯¨á¨
mov eax,37 ;¯®«ã稬 ª®®à¤¨­ âë ¬ë誨
mov ebx,1 ;¤®¡ ¢¨âì 1
int 0x40 ;¯®«ãç¨âì ª®®à¤¨­ âë ªãàá®à  ®â­®á¨â¥«ì­® ®ª­ 
movzx ebx,word op_top ;§ £à㧨âì ¢ bx §­ ç¥­¨¥ ª®®à¤¨­ âë ã
cmp ax,bx ;áà ¢­¨âì á á ª®®à¤¨­ â®© ªãàá®à 
jl .mouse_end ;SF <> OF ¥á«¨ ¬¥­ìè¥
add ebx,op_size ;¤®¡ ¢¨âì à §¬¥à
cmp ax,bx ;áà ¢­¨âì
jg .mouse_end ;ZF = 0 ¨ SF = OF ¥á«¨ ¡®«ìè¥
shr eax,16 ;à §¤¥«¨¬ ­  65536 ¨«¨ ¯à®á⮠ᤢ¨­¥¬ ¡¨âë ­  16 §­ ç¥­¨©
movzx ebx,word op_left ;¯à®¨§¢¥¤¥¬  ­ «®£¨ç­®¥ áà ¢­¥­¨¥
cmp ax,bx ;áà ¢­¨âì ॣ¨áâàë
jl .mouse_end ;¥á«¨ ¬¥­ìè¥
add ebx,op_size ;¤®¡ ¢¨âì ¤«¨­ã áâ®à®­ë ¯àאַ㣮«ì­¨ª 
add ebx,esi ;“ç¥áâì ¢ §­ ç¥­¨¨ ¯® å ¥é¥ ¨ ¤«¨­ã ­ ¤¯¨á¨ ª 祪¡®ªáã
cmp ax,bx ;áâà ¢­¨âì ॣ¨áâàë
jg .mouse_end ;¥á«¨ ¡®«ìè¥
mov eax,op_optibox_gr
mov [eax],edi
.mouse_end:
popa ;¢®ááâ ­®¢¨âì ॣ¨áâàë ¨§ á⥪ 
ret ;¢ë©â¨
}
struc option_box left,top,color,border_color,text_color,text,text_length,point_gr,flags
{ ;áâàãªâãà  ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá 
.left: dw left ;+0 ;¯®«®¦¥­¨¥ ¯® å
.top: dw top ;+2 ;¯®«®¦¥­¨¥ ¯® ã
.color: dd color ;+4 ;梥⠢­ãâਠ祪 ¡®ªá 
.border_color: dd border_color ;+8 梥â à ¬ª¨
.text_color: dd text_color ;+12 梥â ⥪áâ  ­ ¤¯¨á¨
.text: dd text ;+16  ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à á¯®«®¦¥­ ⥪áâà
.text_length: dw text_length ; +20 ¤«¨­  ⥪áâ 
.option_group: dd point_gr ;㪠§ â¥«ì ­  à §¬¥é¥­¨¥ edi - ¨¤¥­â¨ä¨ª â®à  optibox
}
op_struc_size=26 ;®¡é ï áâàãªâãà  24 ¡ ©â
op_flag_en=10b
macro draw_option_boxes start,end ;à¨á®¢ âì 祪 ¡®ªáë
{
mov edi,start ;“ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
mov ecx,((end-start)/op_struc_size) ;Š®«¨ç¥á⢮ 祪 ¡®ªá®¢
@@:
call option_box.draw ;Žâ®¡à §¨âì 祪 ¡®ªá
add edi,op_struc_size ;“ª § â¥«ì ­  ¯®á«¥¤ãî騥 祪 ¡®ªáë â.¥. +28
loop @b ;¯à룭ãâì ¥á«¨ ¢ ecx/cx §­ ç¥­¨¥ ­¥ 0 ­  ¢¥àå­îî @@
}
macro mouse_option_boxes start,end ;ãáâ ­®¢ª  祪 ¡®ªá®¢, ¢ § ¢¨á¨¬®á⨠®â ᮡëâ¨ï
{
mov edi,start ; “ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
mov ecx,((end-start)/op_struc_size) ;Š®«¨ç¥á⢮ 祪 ¡®ªá®¢
@@:
call option_box.mouse ;¯à®¢¥àª  ¬ë誨 ¨ ®¡à ¡®âª  ᮡë⨩
add edi,op_struc_size ;“ª § â¥«ì ­  ¯®á«¥¤ãî騥 祪 ¡®ªáë
loop @b ;¯à룭ãâì ¥á«¨ ¢ ecx/cx §­ ç¥­¨¥ ­¥ 0 ­  ¢¥àå­îî @@
mov edi,start ; “ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
mov ecx,((end-start)/op_struc_size) ;Š®«¨ç¥á⢮ 祪 ¡®ªá®¢
.home:
mov eax,[edi+22] ;op_optibox_gr
mov dword eax,[eax]
pusha
cmp eax,edi
jne @f
call option_box.draw_op
jmp .nxtm
@@: call option_box.clear_op
.nxtm: popa
add edi,op_struc_size ;“ª § â¥«ì ­  ¯®á«¥¤ãî騥 祪 ¡®ªáë â.¥. +28
loop .home
}