removed old optionbox, very small fixes in radiobutton, checkbox, modified template

git-svn-id: svn://kolibrios.org@383 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
heavyiron 2007-03-01 22:32:12 +00:00
parent 743dc85bed
commit c47aceb21f
13 changed files with 279 additions and 825 deletions

View File

@ -1,204 +1,204 @@
;Ž¯â¨¬¨§¨à®¢ ­­ë© ª®¬¯®­¥­â CheckBox (ˆá室­ë© ¢ à¨ ­â ®â Maxxxx32)
;Ž¯â¨¬¨§¨à®¢ ­ ¢ë¢®¤ áâப¨ ­ ¤¯¨á¨ ¤«ï CheckBox'a + ⥯¥àì, ¯à¨ ¯à®¢¥àª¥ ­¥ ¯à®¨á室¨â ¯®¤áç¥â ª®«-¢  ᨬ¢®«®¢ ¢ áâப¥
;Ž¯â¨¬¨§ æ¨ï ª®¬ ­¤ - ®âª § «áï ®â á®åà ­¥­¨ï ॣ¨áâ஢ ¢ á⥪¥.
;21.02.2007 ¤®¡ ¢¨« ª®¤ ®â Heavyiron, ¤®¯¨á « ¬ ªà®áë ¤«ï ¨á¯®«ì§®¢ ­¨ï á¨á⥬­ëå 梥⮢
;19.02.2007 ®¡é¥¥ ã«ãç襭¨¥ ª®¤ , 㬥­ì襭¨¥ à §¬¥à  ¨ ¨á¯®«ì§®¢ ­¨¥ á¨á⥬­ëå 梥⮢ ¤«ï ®â®¡à ¦¥­¨ï checkbox
;17.07.2006 ¯à®¨§¢¥¤¥­  ®¯â¨¬¨§ æ¨ï, ¯à¨ ãáâ ­®¢ª¥ 祪 ¡®ªá  ¢ ¯®«®¦¥­¨¥ ¢ª«î祭® ¯®á«¥¤ãî騥 祪 ¡®ªáë ¢ â®â ¦¥ ¯à®¬¥¦ã⮪ ¢à¥¬¥­¨ ­¥ ¯à®¢¥àïîâáï
;22.08.2006 ¯à®¨§¢¥¤¥­  ®¯â¨¬¨§ æ¨ï ª®¬ ­¤, ¯à¨­ïâë ¢® ¢­¨¬ ­¨¥ § ¬¥ç ­¨ï DIAMOND' .
;<Lrz> - ’¥¯«®¢ €«¥ªá¥© www.lrz.land.ru
macro version_ch ;¤«ï ᮢ¬¥á⨬®á⨠ᮠáâ à묨 ¢¥àá¨ï¬¨ checkbox ¢á¥ æ¢¥â  § ¤ îâáï àã窠¬¨
{
ch_struc_size=24
ch_left equ [edi] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® å
ch_top equ [edi+2] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® ã
ch_color equ [edi+4]
ch_border_color equ [edi+8] ; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦­® § ¤ âì á ¬®áâ®ï⥫쭮
ch_text_color equ [edi+12];[edi+4] ;梥â ⥪áâ 
ch_text_ptr equ [edi+16] ;㪠§ â¥«ì ­  ­ ç «® ⥪á⮢®© áâப¨
ch_text_length equ [edi+20] ;¤«¨­  ­ ¤¯¨á¨ (2^64 â ª®© ¤«¨­ë ¬®¦¥â ¡ëâì ⥪áâ)
ch_flags equ [edi+22] ;ä« £¨
}
macro version_ch1 ;¯à®¤¢¨­ãâ ï ¢¥àá¨ï, ¨á¯®«ì§ã¥â æ¢¥â  áª¨­ .
{
ch_struc_size=12
ch_left equ [edi] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® å
ch_top equ [edi+2] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® ã
ch_color equ [sc.work] ;
ch_border_color equ [sc.work_graph] ; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦­® § ¤ âì á ¬®áâ®ï⥫쭮
ch_text_color equ [sc.work_text];[edi+4] ;梥â ⥪áâ 
ch_text_ptr equ [edi+4] ;㪠§ â¥«ì ­  ­ ç «® ⥪á⮢®© áâப¨
ch_text_length equ [edi+8] ;¤«¨­  ­ ¤¯¨á¨ (2^64 â ª®© ¤«¨­ë ¬®¦¥â ¡ëâì ⥪áâ)
ch_flags equ [edi+10] ;ä« £¨
}
macro use_check_box
{
ch_text_margin=4 ;à ááâ®ï­¨¥ ®â ¯àאַ㣮«ì­¨ª  祪 ¡®ªá  ¤® ­ ¤¯¨á¨
ch_size=12 ;à §¬¥à ª¢ ¤à â  祪 ¡®ªá 
check_box:
.draw:
pusha ;á®åà ­¨¬ ¢á¥ ॣ¨áâàë
mov eax,13
mov ebx,ch_left
shl ebx,16
add ebx,ch_size
mov ecx,ch_top
shl ecx,16
add ecx,ch_size
mov edx,ch_border_color
int 0x40 ;à¨á㥬 à ¬ªã
mov edx,ch_color
add ebx,1 shl 16 - 2
add ecx,1 shl 16 - 2
int 0x40 ;§ ªà è¨¢ ¥¬ ¢­ãâ७­®á⨠祪¡®ªá 
test word ch_flags,2 ;¤®áâ âì §­ ç¥­¨¥ ¡¨â  ¨§ ¯¥à¥¬¥­­®© ¨ ¯®¬¥áâ¨âì ¢ ä« £ CF
jz @f ;¢ ¥á«¨ CF=1, â® ¢ë¯®«­¨¬ á«¥¤ãîéãî ¯à®æ¥¤ãàã ¨­ ç¥ ¯¥à¥©â¨ ­  ­¨¦­îî @@
call .draw_ch ;­ à¨á®¢ âì ¢ª«î祭­ë© 祪 ¡®ªá
@@:
;----------------------------
;à áç¥â ªã¤  ¡ã¤¥â ¯à®¨§¢¥¤¥­ ¢ë¢®¤ ⥪áâ 
;----------------------------
movzx ebx,word ch_left ;§ £à㧨âì §­ ç¥­¨¥ å ¤«ï 祪 ¡®ªá 
add ebx,(ch_size+ch_text_margin) ;¤®¡ ¢¨âì à §¬¥à áâ®à®­ë ¨ à ááâ®ï­¨¥ ­  ª®â®à®¬ ­ ç­¥âáï ¢ë¢®¤ ⥪áâ 
shl ebx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov bx,ch_top ;§ £à㧨¬ §­ ç¥­¨¥ ¯® y
add ebx,(ch_size-9+2) ;¤®¡ ¢¨¬ §­ ç¥­¨¥ ¤«¨­ë áâ®à®­ë -9+2
mov ecx,ch_text_color ;§ £à㧨¬ 梥⠭ ¤¯¨á¨
mov edx,ch_text_ptr ;㪠¦¥¬  ¤à¥á ®â ªã¤  ­ã¦­® ¢ë¢®¤¨âì áâபã
movzx esi,word ch_text_length ;‡ £à㧨¬ ¤«¨­ã ­ ¤¯¨á¨ ¢ esi
;¢­¥á¥¬ ¢ eax §­ ç¥­¨¥ ¢ë¢®¤  ­ ¤¯¨á¨ ­  ª ­¢ã
mov eax,4
int 0x40 ;‚뢮¤
popa ;¢®ááâ ­®¢¨âì §­ ç¥­¨ï ॣ¨áâ஢ ¨§ á⥪ 
ret ;¢ë©¤¥¬ ¨§ ¯à®æ¥¤ãàë
.clear_ch: ;®ç¨á⪠ 祪 ¡®ªá 
mov edx,ch_color ;梥⠢­ãâਠ祪 ¡®ªá 
jmp @f ;¡¥§ãá«®¢­ë© ¯à릮ª ­  ­¨¦­îî ¬¥âªã @@
.draw_ch: ;­ à¨á®¢ âì ¢ª«î祭­ë© 祪 ¡®ªá
mov edx,ch_border_color ;§ £à㧨âì 梥â
@@:
movzx ebx,word ch_left ;§ £à㧨âì ª®®à¤¨­ âã ¯® å
add ebx,(ch_size/4) ;¤®¡ ¢¨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /3)
shl ebx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov bx,(ch_size/2) ;§ £à㧨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /2)
mov bp,bx ;á®åà ­¨¬ ॣ¨áâà bx ¢ ॣ¨áâॠ㪠§ â¥«ï ¡ §ë
;push bx
movzx ecx,word ch_top ;§ £à㧨âì ª®®à¤¨­ âã ¯® ã
mov eax,13 ;¢ eax - §­ ç¥­¨ï ä㭪樨 ¤«ï ¢ë¢®¤  ¯®«®áë â.¥. ¯® áã⨠¯àאַ㣮«ì­¨ª , ª®â®àë© ®â®¡à ¦ ¥â ¢ª«î祭­ë© ª®¬¯®­¥­â 祪 ¡®ªá
add ecx,(ch_size/4) ;¤®¡ ¢¨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /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 ;¯¥à¥©â¨ ­  ­¨¦­îî ¬¥âªã @@
btr word ch_flags,2 ;¨§¢«¥ç¥­¨¥ §­ ç¥­¨ï § ¤ ­­®£® ¡¨â  ¢ ä« £ cf ¨ ¨§¬¥­¥­¨¥ ¥£® §­ ç¥­¨ï ­  ­ã«¥¢®¥.
popa ;¥á«¨ ­¨ç¥£® ­¥ ¯à®¨§®è«®, â® ¢®ááâ ­®¢¨¬ §­ ç¥­¨ï ॣ¨áâ஢ ¨§ á⥪ 
ret ;¢ë室
@@:
bts word ch_flags,2 ;¯à®¢¥àª  ä« £  â.¥. ¯¥à¥­®á ¢ cf §­ ç¥­¨¥ ¡¨â  ¨ ãáâ ­®¢ª  ¡¨â  ¢ á®áâ®ï­¨¥ ¢ª«î祭®
jc .mouse_end ;¥á«¨ CF=1 â® ¯¥à¥©â¨ ¢ ª®­¥æ â.¥. íâ® ¢ë室
movzx esi,word ch_text_length ;§ £à㧨âì ª®«-¢® ᨬ¢®«®¢ ¢ ⥪á⮢®© áâப¥
;“¬­®¦¥­¨¥ ­  6 <EFBFBD>ëáâ஥ 㬭®¦¥­¨¥ ¬®¦­® ¢®á¯®«ì§®¢ âìáï «î¡ë¬ ¬§ ¬¥â®¤®¢, ­® ­  áâ àëå <EFBFBD>à®æ¥áá®à å (386,486,P1)¡ëáâ॥ ¡ã¤¥â á ¨­áâàãªæ¨¥© Lea
;lea esi,[eax*2+eax]
;shl eax,1
imul esi,6 ; ¨«¨ ¬®¦­® ¨ â ª 㬭®¦¨âì ­  6
add esi,ch_text_margin ;¤®¡ ¢¨âì 3 - à ááâ®ï­¨¥ ®â 祪 ¡®ªá  ¤® ­ ¤¯¨á¨
mov eax,37 ;¯®«ã稬 ª®®à¤¨­ âë ¬ë誨
mov ebx,1 ;¤®¡ ¢¨âì 1
int 0x40 ;¯®«ãç¨âì ª®®à¤¨­ âë ªãàá®à  ®â­®á¨â¥«ì­® ®ª­ 
movzx ebx,word ch_top ;§ £à㧨âì ¢ bx §­ ç¥­¨¥ ª®®à¤¨­ âë ã
cmp ax,bx ;áà ¢­¨âì á á ª®®à¤¨­ â®© ªãàá®à 
jl .mouse_end ;SF <> OF ¥á«¨ ¬¥­ìè¥
add ebx,ch_size ;¤®¡ ¢¨âì à §¬¥à
cmp ax,bx ;áà ¢­¨âì
jg .mouse_end ;ZF = 0 ¨ SF = OF ¥á«¨ ¡®«ìè¥
shr eax,16 ;à §¤¥«¨¬ ­  65536 ¨«¨ ¯à®á⮠ᤢ¨­¥¬ ¡¨âë ­  16 §­ ç¥­¨©
movzx ebx,word ch_left ;¯à®¨§¢¥¤¥¬  ­ «®£¨ç­®¥ áà ¢­¥­¨¥
cmp ax,bx ;áà ¢­¨âì ॣ¨áâàë
jl .mouse_end ;¥á«¨ ¬¥­ìè¥
add ebx,ch_size ;¤®¡ ¢¨âì ¤«¨­ã áâ®à®­ë ¯àאַ㣮«ì­¨ª 
add ebx,esi ;“ç¥áâì ¢ §­ ç¥­¨¨ ¯® å ¥é¥ ¨ ¤«¨­ã ­ ¤¯¨á¨ ª 祪¡®ªáã
cmp ax,bx ;áâà ¢­¨âì ॣ¨áâàë
jg .mouse_end ;¥á«¨ ¡®«ìè¥
bts word ch_flags,1 ;¨§¢«¥ç¥­¨¥ §­ ç¥­¨ï § ¤ ­­®£® ¡¨â  ¢ ä« £ cf ¨ ¨§¬¥­¥­¨¥ ¥£® §­ ç¥­¨ï ­  1.
jc @f ;CF=1 â® ¯¥à¥©â¨ ­  ­¨¦­îî @@
call .draw_ch ;®â®¡à §¨âì ¢ª«î祭­ë© 祪 ¡®ªá
mov dword [esp+24],1 ;¤ «ì­¥©è ï ¯à®¢¥àª  祪 ¡®ªá®¢ ¡¥á¬ëá«¥­ , ¯® í⮬㠢 á⥪, £¤¥ à á¯®« £ ¥âáï ecx ¯®¬¥áâ¨â¬ 0
jmp .mouse_end ;¢ë©â¨
@@:
btr word ch_flags,1 ;¨§¢«¥ç¥­¨¥ §­ ç¥­¨ï § ¤ ­­®£® ¡¨â  ¢ ä« £ cf ¨ ¨§¬¥­¥­¨¥ ¥£® §­ ç¥­¨ï ­  ­ã«¥¢®¥.
call .clear_ch ;¢ëª«îç¨âì 祪 ¡®ªá â.¥. ­  ¬¥á⥠§ ªà è¥­­®£® ¯àאַ㣮«ì­¨ª  ®â®¡à §¨âì 梥â ä®­ .
.mouse_end:
popa ;¢®ááâ ­®¢¨âì ॣ¨áâàë ¨§ á⥪ 
ret ;¢ë©â¨
}
struc check_box1 left,top,text,text_length,flags
{ ;áâàãªâãà  ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá 
.left: dw left ;+0 ¯®«®¦¥­¨¥ ¯® å
.top: dw top ;+2 ¯®«®¦¥­¨¥ ¯® ã
.text: dd text ;+16  ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à á¯®«®¦¥­ ⥪áâà
.text_length: dw text_length ;+20 ¤«¨­  ⥪áâ 
.flags: dw flags+0 ;+22 ä« £¨
}
struc check_box left,top,color,border_color,text_color,text,text_length,flags
{ ;áâàãªâãà  ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá 
.left: dw left ;+0 ;¯®«®¦¥­¨¥ ¯® å
.top: dw top ;¯®«®¦¥­¨¥ ¯® ã
.color: dd color ;梥⠢­ãâਠ祪¡®ªá 
.border_color: dd border_color ;梥â à ¬ª¨
.text_color: dd text_color ;梥⠭ ¤¯¨á¨
.text: dd text ; ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à á¯®«®¦¥­ ⥪áâ
.text_length: dw text_length ;¤«¨­  ⥪áâ 
;Ž¯â¨¬¨§¨à®¢ ­­ë© ª®¬¯®­¥­â CheckBox (ˆá室­ë© ¢ à¨ ­â ®â Maxxxx32)
;Ž¯â¨¬¨§¨à®¢ ­ ¢ë¢®¤ áâப¨ ­ ¤¯¨á¨ ¤«ï CheckBox'a + ⥯¥àì, ¯à¨ ¯à®¢¥àª¥ ­¥ ¯à®¨á室¨â ¯®¤áç¥â ª®«-¢  ᨬ¢®«®¢ ¢ áâப¥
;Ž¯â¨¬¨§ æ¨ï ª®¬ ­¤ - ®âª § «áï ®â á®åà ­¥­¨ï ॣ¨áâ஢ ¢ á⥪¥.
;21.02.2007 ¤®¡ ¢¨« ª®¤ ®â Heavyiron, ¤®¯¨á « ¬ ªà®áë ¤«ï ¨á¯®«ì§®¢ ­¨ï á¨á⥬­ëå 梥⮢
;19.02.2007 ®¡é¥¥ ã«ãç襭¨¥ ª®¤ , 㬥­ì襭¨¥ à §¬¥à  ¨ ¨á¯®«ì§®¢ ­¨¥ á¨á⥬­ëå 梥⮢ ¤«ï ®â®¡à ¦¥­¨ï checkbox
;17.07.2006 ¯à®¨§¢¥¤¥­  ®¯â¨¬¨§ æ¨ï, ¯à¨ ãáâ ­®¢ª¥ 祪 ¡®ªá  ¢ ¯®«®¦¥­¨¥ ¢ª«î祭® ¯®á«¥¤ãî騥 祪 ¡®ªáë ¢ â®â ¦¥ ¯à®¬¥¦ã⮪ ¢à¥¬¥­¨ ­¥ ¯à®¢¥àïîâáï
;22.08.2006 ¯à®¨§¢¥¤¥­  ®¯â¨¬¨§ æ¨ï ª®¬ ­¤, ¯à¨­ïâë ¢® ¢­¨¬ ­¨¥ § ¬¥ç ­¨ï DIAMOND' .
;<Lrz> - ’¥¯«®¢ €«¥ªá¥© www.lrz.land.ru
macro version_ch ;¤«ï ᮢ¬¥á⨬®á⨠ᮠáâ à묨 ¢¥àá¨ï¬¨ checkbox ¢á¥ æ¢¥â  § ¤ îâáï àã窠¬¨
{
ch_struc_size=24
ch_left equ [edi] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® å
ch_top equ [edi+2] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® ã
ch_color equ [edi+4]
ch_border_color equ [edi+8] ; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦­® § ¤ âì á ¬®áâ®ï⥫쭮
ch_text_color equ [edi+12];[edi+4] ;梥â ⥪áâ 
ch_text_ptr equ [edi+16] ;㪠§ â¥«ì ­  ­ ç «® ⥪á⮢®© áâப¨
ch_text_length equ [edi+20] ;¤«¨­  ­ ¤¯¨á¨ (2^64 â ª®© ¤«¨­ë ¬®¦¥â ¡ëâì ⥪áâ)
ch_flags equ [edi+22] ;ä« £¨
}
macro version_ch1 ;¯à®¤¢¨­ãâ ï ¢¥àá¨ï, ¨á¯®«ì§ã¥â æ¢¥â  áª¨­ .
{
ch_struc_size=12
ch_left equ [edi] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® å
ch_top equ [edi+2] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® ã
ch_color equ [sc.work] ;
ch_border_color equ [sc.work_graph] ; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦­® § ¤ âì á ¬®áâ®ï⥫쭮
ch_text_color equ [sc.work_text];[edi+4] ;梥â ⥪áâ 
ch_text_ptr equ [edi+4] ;㪠§ â¥«ì ­  ­ ç «® ⥪á⮢®© áâப¨
ch_text_length equ [edi+8] ;¤«¨­  ­ ¤¯¨á¨ (2^64 â ª®© ¤«¨­ë ¬®¦¥â ¡ëâì ⥪áâ)
ch_flags equ [edi+10] ;ä« £¨
}
macro use_check_box
{
ch_text_margin=4 ;à ááâ®ï­¨¥ ®â ¯àאַ㣮«ì­¨ª  祪 ¡®ªá  ¤® ­ ¤¯¨á¨
ch_size=11 ;à §¬¥à ª¢ ¤à â  祪 ¡®ªá 
check_box:
.draw:
pusha ;á®åà ­¨¬ ¢á¥ ॣ¨áâàë
mov eax,13
mov ebx,ch_left
shl ebx,16
add ebx,ch_size
mov ecx,ch_top
shl ecx,16
add ecx,ch_size
mov edx,ch_border_color
int 0x40 ;à¨á㥬 à ¬ªã
mov edx,ch_color
add ebx,1 shl 16 - 2
add ecx,1 shl 16 - 2
int 0x40 ;§ ªà è¨¢ ¥¬ ¢­ãâ७­®á⨠祪¡®ªá 
test word ch_flags,2 ;¤®áâ âì §­ ç¥­¨¥ ¡¨â  ¨§ ¯¥à¥¬¥­­®© ¨ ¯®¬¥áâ¨âì ¢ ä« £ CF
jz @f ;¢ ¥á«¨ CF=1, â® ¢ë¯®«­¨¬ á«¥¤ãîéãî ¯à®æ¥¤ãàã ¨­ ç¥ ¯¥à¥©â¨ ­  ­¨¦­îî @@
call .draw_ch ;­ à¨á®¢ âì ¢ª«î祭­ë© 祪 ¡®ªá
@@:
;----------------------------
;à áç¥â ªã¤  ¡ã¤¥â ¯à®¨§¢¥¤¥­ ¢ë¢®¤ ⥪áâ 
;----------------------------
movzx ebx,word ch_left ;§ £à㧨âì §­ ç¥­¨¥ å ¤«ï 祪 ¡®ªá 
add ebx,(ch_size+ch_text_margin) ;¤®¡ ¢¨âì à §¬¥à áâ®à®­ë ¨ à ááâ®ï­¨¥ ­  ª®â®à®¬ ­ ç­¥âáï ¢ë¢®¤ ⥪áâ 
shl ebx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov bx,ch_top ;§ £à㧨¬ §­ ç¥­¨¥ ¯® y
add ebx,(ch_size-9+1) ;¤®¡ ¢¨¬ §­ ç¥­¨¥ ¤«¨­ë áâ®à®­ë -9+1
mov ecx,ch_text_color ;§ £à㧨¬ 梥⠭ ¤¯¨á¨
mov edx,ch_text_ptr ;㪠¦¥¬  ¤à¥á ®â ªã¤  ­ã¦­® ¢ë¢®¤¨âì áâபã
movzx esi,word ch_text_length ;‡ £à㧨¬ ¤«¨­ã ­ ¤¯¨á¨ ¢ esi
;¢­¥á¥¬ ¢ eax §­ ç¥­¨¥ ¢ë¢®¤  ­ ¤¯¨á¨ ­  ª ­¢ã
mov eax,4
int 0x40 ;‚뢮¤
popa ;¢®ááâ ­®¢¨âì §­ ç¥­¨ï ॣ¨áâ஢ ¨§ á⥪ 
ret ;¢ë©¤¥¬ ¨§ ¯à®æ¥¤ãàë
.clear_ch: ;®ç¨á⪠ 祪 ¡®ªá 
mov edx,ch_color ;梥⠢­ãâਠ祪 ¡®ªá 
jmp @f ;¡¥§ãá«®¢­ë© ¯à릮ª ­  ­¨¦­îî ¬¥âªã @@
.draw_ch: ;­ à¨á®¢ âì ¢ª«î祭­ë© 祪 ¡®ªá
mov edx,ch_border_color ;§ £à㧨âì 梥â
@@:
movzx ebx,word ch_left ;§ £à㧨âì ª®®à¤¨­ âã ¯® å
add ebx,(ch_size/3) ;¤®¡ ¢¨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /3)
shl ebx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov bx,(ch_size/2) ;§ £à㧨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /2)
mov bp,bx ;á®åà ­¨¬ ॣ¨áâà bx ¢ ॣ¨áâॠ㪠§ â¥«ï ¡ §ë
;push bx
movzx ecx,word ch_top ;§ £à㧨âì ª®®à¤¨­ âã ¯® ã
mov eax,13 ;¢ eax - §­ ç¥­¨ï ä㭪樨 ¤«ï ¢ë¢®¤  ¯®«®áë â.¥. ¯® áã⨠¯àאַ㣮«ì­¨ª , ª®â®àë© ®â®¡à ¦ ¥â ¢ª«î祭­ë© ª®¬¯®­¥­â 祪 ¡®ªá
add ecx,(ch_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 ;¯¥à¥©â¨ ­  ­¨¦­îî ¬¥âªã @@
btr word ch_flags,2 ;¨§¢«¥ç¥­¨¥ §­ ç¥­¨ï § ¤ ­­®£® ¡¨â  ¢ ä« £ cf ¨ ¨§¬¥­¥­¨¥ ¥£® §­ ç¥­¨ï ­  ­ã«¥¢®¥.
popa ;¥á«¨ ­¨ç¥£® ­¥ ¯à®¨§®è«®, â® ¢®ááâ ­®¢¨¬ §­ ç¥­¨ï ॣ¨áâ஢ ¨§ á⥪ 
ret ;¢ë室
@@:
bts word ch_flags,2 ;¯à®¢¥àª  ä« £  â.¥. ¯¥à¥­®á ¢ cf §­ ç¥­¨¥ ¡¨â  ¨ ãáâ ­®¢ª  ¡¨â  ¢ á®áâ®ï­¨¥ ¢ª«î祭®
jc .mouse_end ;¥á«¨ CF=1 â® ¯¥à¥©â¨ ¢ ª®­¥æ â.¥. íâ® ¢ë室
movzx esi,word ch_text_length ;§ £à㧨âì ª®«-¢® ᨬ¢®«®¢ ¢ ⥪á⮢®© áâப¥
;“¬­®¦¥­¨¥ ­  6 <EFBFBD>ëáâ஥ 㬭®¦¥­¨¥ ¬®¦­® ¢®á¯®«ì§®¢ âìáï «î¡ë¬ ¬§ ¬¥â®¤®¢, ­® ­  áâ àëå <EFBFBD>à®æ¥áá®à å (386,486,P1)¡ëáâ॥ ¡ã¤¥â á ¨­áâàãªæ¨¥© Lea
;lea esi,[eax*2+eax]
;shl eax,1
imul esi,6 ; ¨«¨ ¬®¦­® ¨ â ª 㬭®¦¨âì ­  6
add esi,ch_text_margin ;¤®¡ ¢¨âì 3 - à ááâ®ï­¨¥ ®â 祪 ¡®ªá  ¤® ­ ¤¯¨á¨
mov eax,37 ;¯®«ã稬 ª®®à¤¨­ âë ¬ë誨
mov ebx,1 ;¤®¡ ¢¨âì 1
int 0x40 ;¯®«ãç¨âì ª®®à¤¨­ âë ªãàá®à  ®â­®á¨â¥«ì­® ®ª­ 
movzx ebx,word ch_top ;§ £à㧨âì ¢ bx §­ ç¥­¨¥ ª®®à¤¨­ âë ã
cmp ax,bx ;áà ¢­¨âì á á ª®®à¤¨­ â®© ªãàá®à 
jl .mouse_end ;SF <> OF ¥á«¨ ¬¥­ìè¥
add ebx,ch_size ;¤®¡ ¢¨âì à §¬¥à
cmp ax,bx ;áà ¢­¨âì
jg .mouse_end ;ZF = 0 ¨ SF = OF ¥á«¨ ¡®«ìè¥
shr eax,16 ;à §¤¥«¨¬ ­  65536 ¨«¨ ¯à®á⮠ᤢ¨­¥¬ ¡¨âë ­  16 §­ ç¥­¨©
movzx ebx,word ch_left ;¯à®¨§¢¥¤¥¬  ­ «®£¨ç­®¥ áà ¢­¥­¨¥
cmp ax,bx ;áà ¢­¨âì ॣ¨áâàë
jl .mouse_end ;¥á«¨ ¬¥­ìè¥
add ebx,ch_size ;¤®¡ ¢¨âì ¤«¨­ã áâ®à®­ë ¯àאַ㣮«ì­¨ª 
add ebx,esi ;“ç¥áâì ¢ §­ ç¥­¨¨ ¯® å ¥é¥ ¨ ¤«¨­ã ­ ¤¯¨á¨ ª 祪¡®ªáã
cmp ax,bx ;áâà ¢­¨âì ॣ¨áâàë
jg .mouse_end ;¥á«¨ ¡®«ìè¥
bts word ch_flags,1 ;¨§¢«¥ç¥­¨¥ §­ ç¥­¨ï § ¤ ­­®£® ¡¨â  ¢ ä« £ cf ¨ ¨§¬¥­¥­¨¥ ¥£® §­ ç¥­¨ï ­  1.
jc @f ;CF=1 â® ¯¥à¥©â¨ ­  ­¨¦­îî @@
call .draw_ch ;®â®¡à §¨âì ¢ª«î祭­ë© 祪 ¡®ªá
mov dword [esp+24],1 ;¤ «ì­¥©è ï ¯à®¢¥àª  祪 ¡®ªá®¢ ¡¥á¬ëá«¥­ , ¯® í⮬㠢 á⥪, £¤¥ à á¯®« £ ¥âáï ecx ¯®¬¥áâ¨â¬ 0
jmp .mouse_end ;¢ë©â¨
@@:
btr word ch_flags,1 ;¨§¢«¥ç¥­¨¥ §­ ç¥­¨ï § ¤ ­­®£® ¡¨â  ¢ ä« £ cf ¨ ¨§¬¥­¥­¨¥ ¥£® §­ ç¥­¨ï ­  ­ã«¥¢®¥.
call .clear_ch ;¢ëª«îç¨âì 祪 ¡®ªá â.¥. ­  ¬¥á⥠§ ªà è¥­­®£® ¯àאַ㣮«ì­¨ª  ®â®¡à §¨âì 梥â ä®­ .
.mouse_end:
popa ;¢®ááâ ­®¢¨âì ॣ¨áâàë ¨§ á⥪ 
ret ;¢ë©â¨
}
struc check_box1 left,top,text,text_length,flags
{ ;áâàãªâãà  ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá 
.left: dw left ;+0 ¯®«®¦¥­¨¥ ¯® å
.top: dw top ;+2 ¯®«®¦¥­¨¥ ¯® ã
.text: dd text ;+16  ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à á¯®«®¦¥­ ⥪áâà
.text_length: dw text_length ;+20 ¤«¨­  ⥪áâ 
.flags: dw flags+0 ;+22 ä« £¨
}
struc check_box left,top,color,border_color,text_color,text,text_length,flags
{ ;áâàãªâãà  ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá 
.left: dw left ;+0 ;¯®«®¦¥­¨¥ ¯® å
.top: dw top ;¯®«®¦¥­¨¥ ¯® ã
.color: dd color ;梥⠢­ãâਠ祪¡®ªá 
.border_color: dd border_color ;梥â à ¬ª¨
.text_color: dd text_color ;梥⠭ ¤¯¨á¨
.text: dd text ; ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à á¯®«®¦¥­ ⥪áâ
.text_length: dw text_length ;¤«¨­  ⥪áâ 
.flags: dw flags+0 ;+22
}
ch_flag_en=10b
macro draw_check_boxes start,end ;à¨á®¢ âì 祪 ¡®ªáë
{
mov edi,start ;“ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
mov ecx,((end-start)/ch_struc_size) ;Š®«¨ç¥á⢮ 祪 ¡®ªá®¢
@@:
call check_box.draw ;Žâ®¡à §¨âì 祪 ¡®ªá
add edi,ch_struc_size ;“ª § â¥«ì ­  ¯®á«¥¤ãî騥 祪 ¡®ªáë â.¥. +28
loop @b ;¯à룭ãâì ¥á«¨ ¢ ecx/cx §­ ç¥­¨¥ ­¥ 0 ­  ¢¥àå­îî @@
}
macro mouse_check_boxes start,end ;ãáâ ­®¢ª  祪 ¡®ªá®¢, ¢ § ¢¨á¨¬®á⨠®â ᮡëâ¨ï
{
mov edi,start ; “ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
mov ecx,((end-start)/ch_struc_size) ;Š®«¨ç¥á⢮ 祪 ¡®ªá®¢
@@:
call check_box.mouse ;¯à®¢¥àª  ¬ë誨 ¨ ®¡à ¡®âª  ᮡë⨩
add edi,ch_struc_size ;“ª § â¥«ì ­  ¯®á«¥¤ãî騥 祪 ¡®ªáë
loop @b ;¯à룭ãâì ¥á«¨ ¢ ecx/cx §­ ç¥­¨¥ ­¥ 0 ­  ¢¥àå­îî @@
}
;…᫨ ­ã¦­® ®â®¡à §¨âì ®¤¨­ 祪¥à
macro draw_check_box start ;à¨á®¢ âì 祪 ¡®ªáë
{
mov edi,start ;“ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
call check_box.draw ;Žâ®¡à §¨âì 祪 ¡®ªá
}
macro mouse_check_box start ;ãáâ ­®¢ª  祪 ¡®ªá®¢, ¢ § ¢¨á¨¬®á⨠®â ᮡëâ¨ï
{
mov edi,start ; “ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
call check_box.mouse ;¯à®¢¥àª  ¬ë誨 ¨ ®¡à ¡®âª  ᮡë⨩
}
ch_flag_en=10b
macro draw_check_boxes start,end ;à¨á®¢ âì 祪 ¡®ªáë
{
mov edi,start ;“ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
mov ecx,((end-start)/ch_struc_size) ;Š®«¨ç¥á⢮ 祪 ¡®ªá®¢
@@:
call check_box.draw ;Žâ®¡à §¨âì 祪 ¡®ªá
add edi,ch_struc_size ;“ª § â¥«ì ­  ¯®á«¥¤ãî騥 祪 ¡®ªáë â.¥. +28
loop @b ;¯à룭ãâì ¥á«¨ ¢ ecx/cx §­ ç¥­¨¥ ­¥ 0 ­  ¢¥àå­îî @@
}
macro mouse_check_boxes start,end ;ãáâ ­®¢ª  祪 ¡®ªá®¢, ¢ § ¢¨á¨¬®á⨠®â ᮡëâ¨ï
{
mov edi,start ; “ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
mov ecx,((end-start)/ch_struc_size) ;Š®«¨ç¥á⢮ 祪 ¡®ªá®¢
@@:
call check_box.mouse ;¯à®¢¥àª  ¬ë誨 ¨ ®¡à ¡®âª  ᮡë⨩
add edi,ch_struc_size ;“ª § â¥«ì ­  ¯®á«¥¤ãî騥 祪 ¡®ªáë
loop @b ;¯à룭ãâì ¥á«¨ ¢ ecx/cx §­ ç¥­¨¥ ­¥ 0 ­  ¢¥àå­îî @@
}
;…᫨ ­ã¦­® ®â®¡à §¨âì ®¤¨­ 祪¥à
macro draw_check_box start ;à¨á®¢ âì 祪 ¡®ªáë
{
mov edi,start ;“ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
call check_box.draw ;Žâ®¡à §¨âì 祪 ¡®ªá
}
macro mouse_check_box start ;ãáâ ­®¢ª  祪 ¡®ªá®¢, ¢ § ¢¨á¨¬®á⨠®â ᮡëâ¨ï
{
mov edi,start ; “ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
call check_box.mouse ;¯à®¢¥àª  ¬ë誨 ¨ ®¡à ¡®âª  ᮡë⨩
}

View File

@ -1,2 +0,0 @@
@fasm optxampl.asm optxample
@pause

View File

@ -1,269 +0,0 @@
; 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

@ -1,112 +0,0 @@
;
;OptionBox for MenuetOS
;
;by Harald Weber
;kitemaster@gmx.at
;
;16.02.07 Heavyiorn - optimizations for kolibri system functions
;
;######### USAGE ############
;include "optionbox.inc"
;
;//in end of draw_window procedure
;draw_optionboxes:
; mov eax, [pos_x] shl 16 + [pos_y]
; mov cl, buttonid
; mov edx, Text ;pointer to text beginning
;call optionbox
;
;
;Text db 'Optionbox Text',0
;
;//for more info see optxampl.asm
;##########################
optionbox:
mov [optionbox_pos_y],ax
shr eax,16
mov [optionbox_pos_x],ax
mov [optionbox_text],edx
mov [optionbox_id],cl
;######### Draw Checkbox ########
optionbox_draw:
mov eax, 13
mov bx, [optionbox_pos_x]
shl ebx, 16
add bx, 11
mov cx, [optionbox_pos_y]
shl ecx, 16
add cx, 11
mov edx,[sc.work_text]
int 0x40
mov edx,[sc.work]
add ebx, 1 shl 16 - 2
add ecx, 1 shl 16 -2
int 0x40
;######### Draw Hidden Button ######
optionbox_hid_button:
mov eax,8
mov bx,[optionbox_pos_x]
sub bx,1
shl ebx,16
mov bx,13
mov cx,[optionbox_pos_y]
sub cx,1
shl ecx,16
mov cx,13
mov dl,[optionbox_id] ;buttonid
or edx,0x60000000 ;button in invisible without frame
int 0x40
;######### Draw X #######
optionbox_x_draw:
mov al,[optionbox_id]
cmp [optionbox_checked],al
jne optionbox_dis
mov eax, 13
mov bx, [optionbox_pos_x]
add bx, 3
shl ebx, 16
add bx, 5
mov cx, [optionbox_pos_y]
add cx, 3
shl ecx, 16
add cx, 5
mov edx,[sc.work_text]
int 0x40
optionbox_dis:
;######### Checkbox Text #####
optionbox_draw_text:
mov eax,4 ; function 4 : write text to window
mov bx,[optionbox_pos_x]
add bx, 14
shl ebx,16
mov bx,[optionbox_pos_y]
add bx, 2 ; [x start] *65536 + [y start]
mov ecx,[sc.work_text] ; color of text RRGGBB
or ecx,0x80000000
mov edx,[optionbox_text] ; pointer to text beginning
int 0x40
ret
;######### Set OptionBox #####
set_optionbox:
mov [optionbox_checked],ah
call draw_optionboxes
ret
;########## Data Area ########
optionbox_pos_x dw ?
optionbox_pos_y dw ?
optionbox_text dd ?
optionbox_checked db ?
optionbox_id db ?

View File

@ -1,165 +0,0 @@
;
; EXAMPLE APPLICATION
;
; Compile with FASM for Menuet
;
include 'macros.inc'
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x1000 ; memory for app
dd 0x1000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
START: ; start of execution
red:
call draw_window
still:
push 10 ; wait here for event
pop eax
int 0x40
dec eax ; redraw request ?
jz red
dec eax ; key in buffer ?
jz key
button: ; button
mov al,17 ; get id
int 0x40
cmp ah,2
je button2
cmp ah,3
je button3
cmp ah,4
je button4
cmp ah,5
je button5
cmp ah,1 ; button id=1 ?
jne noclose
or eax,-1 ; close this program
int 0x40
noclose:
jmp still
button2: ;option 1
call set_optionbox
jmp still
button3: ;option 2
call set_optionbox
jmp still
button4: ;option 3
call set_optionbox
jmp still
button5:
mov eax,4 ; function 4 : write text to window
mov ebx,170*65536+35 ; [x start] *65536 + [y start]
mov ecx,[sc.work_button_text] ; font 1 & color ( 0xF0RRGGBB )
mov edx,options-1
add dl, [optionbox_checked] ; pointer to text beginning
mov esi,1 ; text length
int 0x40
jmp still
key: ; key
mov al,2 ; just read it and ignore
int 0x40
jmp still
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
draw_window:
mov eax,48
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
int 0x40
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
; DRAW WINDOW
xor eax,eax ; function 0 : define and draw window
mov ebx,100*65536+300 ; [x start] *65536 + [x size]
mov ecx,100*65536+120 ; [y start] *65536 + [y size]
mov edx,[sc.work] ; color of work area RRGGBB,8->color gl
or edx,0x33000000
mov edi,header ; WINDOW LABEL
int 0x40
mov eax,8 ; function 8 : define and draw button
mov ebx,165*65536+15 ; [x start] *65536 + [x size]
mov ecx,30*65536+15 ; [y start] *65536 + [y size]
mov edx,5 ; button id
mov esi,[sc.work_button] ; button color RRGGBB
int 0x40
draw_optionboxes:
;draw optionbox1
mov eax, 45 shl 16 + 20 ; [x start] shl 16 + [y start]
mov cl, 2 ; button id
mov edx, optiontext1 ; pointer to text beginning
call optionbox
;draw optionbox2
mov eax, 45 shl 16 + 40 ; [x start] shl 16 + [y start]
mov cl, 3 ; button id
mov edx, optiontext2 ; pointer to text beginning
call optionbox
;draw optionbox3
mov eax, 45 shl 16 + 60 ; [x start] shl 16 + [y start]
mov cl, 4 ; button id
mov edx, optiontext3 ; pointer to text beginning
call optionbox
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
ret
include "optbox.inc"
; DATA AREA
optiontext1: db 'OptionBox1',0
optiontext2: db 'OptionBox2',0
optiontext3: db 'OptionBox3',0
options: db '0123'
header db 'OptionBox example',0
I_END:
sc system_colors

View File

@ -17,16 +17,16 @@ use32 ;
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' ;¢ª«îç¨âì ä ©« opeck.inc
version_op ;¢ à¨ ­â, ¯à¨ ª®â®à®¬ ¨á¯®«ì§ãîâáï 梥â , ª®â®àë¥ § ¤ ¥â ¯®«ì§®¢ â¥«ì
version_op ;¢ à¨ ­â, ¯à¨ ª®â®à®¬ ¨á¯®«ì§ãîâáï 梥â , ª®â®àë¥ § ¤ ¥â ¯®«ì§®¢ â¥«ì
; version_op1 ;æ¢¥â  ¡¥àãâáï ¨§ á¨á⥬ë
use_option_box ;¨á¯®«ì§ãï ¬ ªà®áë,¢­¥á⨠¯à®æ¥¤ãàë ¤«ï à¨á®¢ ­¨ï optionbox
align 16
@ -39,12 +39,12 @@ start: ;
int 0x40
mov eax,40 ;ãáâ ­®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
mov ebx,0x25 ;á¨á⥬  ¡ã¤¥â ॠ£¨à®¢ âì ⮫쪮 ­  á®®¡é¥­¨¥ ® ¯¥à¥à¨á®¢ª¥,­ ¦ â  ª­®¯ª , ®¯à¥¤¥«ñ­­ ï à ­¥¥, ᮡë⨥ ®â ¬ëè¨ (çâ®-â® á«ã稫®áì - ­ ¦ â¨¥ ­  ª­®¯ªã ¬ëè¨ ¨«¨ ¯¥à¥¬¥é¥­¨¥; á¡à á뢠¥âáï ¯à¨ ¯à®ç⥭¨¨)
int 0x40
mov ebx,0x25 ;á¨á⥬  ¡ã¤¥â ॠ£¨à®¢ âì ⮫쪮 ­  á®®¡é¥­¨¥ ® ¯¥à¥à¨á®¢ª¥,­ ¦ â  ª­®¯ª , ®¯à¥¤¥«ñ­­ ï à ­¥¥, ᮡë⨥ ®â ¬ëè¨ (çâ®-â® á«ã稫®áì - ­ ¦ â¨¥ ­  ª­®¯ªã ¬ëè¨ ¨«¨ ¯¥à¥¬¥é¥­¨¥; á¡à á뢠¥âáï ¯à¨ ¯à®ç⥭¨¨)
int 0x40
red_win:
call draw_window ;¯¥à¢®­ ç «ì­® ­¥®¡å®¤¨¬® ­ à¨á®¢ âì ®ª­®
still: ;®á­®¢­®© ®¡à ¡®â稪
mov eax,10 ;Ž¦¨¤ âì ᮡëâ¨ï
mov eax,10 ;Ž¦¨¤ âì ᮡëâ¨ï
int 0x40 ;®¦¨¤ âì ᮡë⨥ ¢ â¥ç¥­¨¥ 2 ¬¨««¨á¥ªã­¤
cmp al,0x1 ;¥á«¨ ¨§¬¥­¨«®áì ¯®«®¦¥­¨¥ ®ª­ 
@ -52,7 +52,7 @@ still: ;
cmp al,0x3 ;¥á«¨ ­ ¦ â  ª­®¯ª  â® ¯¥à¥©â¨
jz button
mouse_option_boxes option_boxes,option_boxes_end ;¯à®¢¥àª  祪 ¡®ªá 
jmp still ;¥á«¨ ­¨ç¥£® ¨§ ¯¥à¥ç¨á«¥­­®£® â® á­®¢  ¢ 横«
jmp still ;¥á«¨ ­¨ç¥£® ¨§ ¯¥à¥ç¨á«¥­­®£® â® á­®¢  ¢ 横«
button:
; mov eax,17 ;¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª« ¢¨è¨
; int 0x40
@ -74,7 +74,8 @@ draw_window: ;
or edx,0xb3000000
mov edi,hed
int 0x40 ;­ à¨á®¢ âì ®ª­® ¯à¨«®¦¥­¨ï
draw_option_boxes option_boxes,option_boxes_end ;à¨á®¢ ­¨¥ 祪¡®ªá®¢
draw_option_boxes option_boxes,option_boxes_end ;à¨á®¢ ­¨¥ 祪¡®ªá®¢
mov eax,12 ;”ã­ªæ¨ï 12 - ­ ç âì/§ ª®­ç¨âì ¯¥à¥à¨á®¢ªã ®ª­ .
mov ebx,2 ;<3B>®¤äã­ªæ¨ï 2 - § ª®­ç¨âì ¯¥à¥à¨á®¢ªã ®ª­ .
@ -121,7 +122,7 @@ op_text: ;
.3 db 'Option_Box #3'
.e3:
option_group1 dd op1 ;㪠§ â¥«¨, ®­¨ ®â®¡à ¦ îâáï ¯® 㬮«ç ­¨î, ª®£¤  ¢ë¢®¤¨âáï
option_group1 dd op1 ;㪠§ â¥«¨, ®­¨ ®â®¡à ¦ îâáï ¯® 㬮«ç ­¨î, ª®£¤  ¢ë¢®¤¨âáï
option_group2 dd op11 ;¯à¨«®¦¥­¨¥
hed db 'Optionbox [21.02.2007]',0 ;§ £®«®¢®ª ¯à¨«®¦¥­¨ï

View File

@ -1,3 +1,4 @@
@fasm.exe optionbox.asm optionbox
@kpack.exe optionbox
REM @klbrinwin.exe optionbox
REM @klbrinwin.exe optionbox
@pause

View File

@ -39,7 +39,7 @@ option_box:
.draw:
pusha ;á®åà ­¨¬ ¢á¥ ॣ¨áâàë
op_text_margin=4 ;à ááâ®ï­¨¥ ®â ¯àאַ㣮«ì­¨ª  祪 ¡®ªá  ¤® ­ ¤¯¨á¨
op_size=12 ;à §¬¥à ª¢ ¤à â  祪 ¡®ªá 
op_size=11 ;à §¬¥à ª¢ ¤à â  祪 ¡®ªá 
mov eax,13
mov ebx,op_left
shl ebx,16
@ -67,7 +67,7 @@ op_size=12 ;ࠧ
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
add ebx,(op_size-9+1) ;¤®¡ ¢¨¬ §­ ç¥­¨¥ ¤«¨­ë áâ®à®­ë -9+1
mov ecx,op_text_color ;§ £à㧨¬ 梥⠭ ¤¯¨á¨
mov edx,op_text_ptr ;㪠¦¥¬  ¤à¥á ®â ªã¤  ­ã¦­® ¢ë¢®¤¨âì áâபã
@ -87,14 +87,14 @@ ret ;
mov edx,op_border_color ;§ £à㧨âì 梥â
@@:
movzx ebx,word op_left ;§ £à㧨âì ª®®à¤¨­ âã ¯® å
add ebx,(op_size/4) ;¤®¡ ¢¨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /3)
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/4) ;¤®¡ ¢¨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /3)
add ecx,(op_size/3) ;¤®¡ ¢¨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /3)
shl ecx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov cx,bp ;§ £à㧨¬ §­ ç¥­¨ï ॣ¨áâà  ãª § â¥«ï ¡ §ë ¢ cx
int 0x40 ;¢ë¢®¤

View File

@ -1,4 +1,5 @@
@erase lang.inc
@echo lang fix en >lang.inc
@fasm template.asm template
@erase lang.inc
@pause

View File

@ -0,0 +1,5 @@
@erase lang.inc
@echo lang fix fr >lang.inc
@fasm template.asm template
@erase lang.inc
@pause

View File

@ -1,4 +1,5 @@
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm template.asm template
@erase lang.inc
@pause

View File

@ -123,8 +123,10 @@ macro mpack dest, hsrc, lsrc
end if
}
macro __mov reg,a { ; mike.dld
if ~a eq
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
}
@ -141,11 +143,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld
; language for programs
lang fix ru ; ru en fr ge fi
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
@ -177,7 +174,7 @@ macro sub arg1,arg2
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
@ -221,7 +218,13 @@ struc process_information
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
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

View File

@ -1,11 +1,11 @@
; <--- description --->
; compiler: FASM 1.50
; name: Basic window example for MenuetOS
; version: 1.01
; last update: 25/08/2004
; compiler: FASM 1.67
; name: Basic window example for KolibriOS
; version: 1.02
; last update: 1/03/2007
; written by: Ivan Poddubny
; e-mail: ivan-yar@bk.ru
;modified by: Heavyiron
; <--- include all MeOS stuff --->
include "lang.inc"
@ -18,64 +18,54 @@ MEOS_APP_START
; <--- start of code --->
CODE
call draw_window ; at first create and draw the window
mov eax,48 ; get system colors
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
int 0x40
redraw: ; redraw event handler
call draw_window ; at first create and draw the window
wait_event: ; main cycle
mov eax, 10
int 0x40
cmp eax, 1 ; if event == 1
je redraw ; jump to redraw handler
cmp eax, 2 ; else if event == 2
je key ; jump to key handler
cmp eax, 3 ; else if event == 3
je button ; jump to button handler
jmp wait_event ; else return to the start of main cycle
dec eax ; if event = 1
jz redraw ; jump to redraw handler
dec eax ; else if event = 2
jz key ; jump to key handler
redraw: ; redraw event handler
call draw_window
jmp wait_event
key: ; key event handler
mov eax, 2 ; get key code
int 0x40
jmp wait_event
button: ; button event handler
mov eax, 17 ; get button identifier
button: ; button event handler
mov al, 17 ; get button identifier
int 0x40
cmp ah, 1
jne wait_event ; return if button id != 1
jne wait_event ; return if button id != 1
or eax, -1 ; exit application
or eax, -1 ; exit application
int 0x40
key: ; key event handler
mov al, 2 ; get key code
int 0x40
jmp wait_event
draw_window:
mov eax, 12 ; start drawing
mov ebx, 1
int 0x40
mov eax, 0 ; create and draw the window
mov ebx, 100*65536+300 ; (window_cx)*65536+(window_sx)
mov ecx, 100*65536+200 ; (window_cy)*65536+(window_sy)
mov edx, 0x03ffffff ; work area color & window type 3
; mov esi, 0 ; grab color (not used)
; mov edi, 0 ; frame color (not used)
int 0x40
mov eax, 4 ; window header
mov ebx, 8*65536+8 ; coordinates
mov ecx, 0x10ffffff ; color & font N1
mov edx, header ; address of text
mov esi, header.size ; length of text
int 0x40
xor eax, eax ; create and draw the window
mov ebx, 100*65536+200 ; (window_cx)*65536+(window_sx)
mov ecx, 100*65536+100 ; (window_cy)*65536+(window_sy)
mov edx, [sc.work] ; work area color
or edx, 0x33000000 ; & window type 3
mov edi, header ; window header
int 0x40
mov eax, 12 ; finish drawing
mov ebx, 2
@ -83,20 +73,20 @@ CODE
ret
; <--- initialised data --->
DATA
lsz header,\
ru, "˜ ¡«®­ ¯à®£à ¬¬ë",\
en, "Template program",\
fr, "La programme poncive"
if lang eq ru
header db '˜ ¡«®­ ¯à®£à ¬¬ë',0
else if lang eq fr
header db 'La programme poncive',0
else
header db 'Template program',0
end if
; <--- uninitialised data --->
UDATA
sc system_colors
MEOS_APP_END
; <--- end of MenuetOS application --->