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

@ -36,7 +36,7 @@ ch_flags equ [edi+10] ;䫠
macro use_check_box
{
ch_text_margin=4 ;à ááâ®ï­¨¥ ®â ¯àאַ㣮«ì­¨ª  祪 ¡®ªá  ¤® ­ ¤¯¨á¨
ch_size=12 ;ŕ §ŹĽŕ Ş˘ ¤ŕ â  缪 ĄŽŞá 
ch_size=11 ;ŕ §ŹĽŕ Ş˘ ¤ŕ â  缪 ĄŽŞá 
check_box:
.draw:
pusha ;á®åà ­¨¬ ¢á¥ ॣ¨áâàë
@ -66,7 +66,7 @@ check_box:
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
add ebx,(ch_size-9+1) ;¤ŽĄ ˘¨Ź §­ çĽ­¨Ľ ¤Ť¨­ë áâŽŕŽ­ë -9+1
mov ecx,ch_text_color ;§ £à㧨¬ 梥⠭ ¤¯¨á¨
mov edx,ch_text_ptr ;㪠¦¥¬  ¤à¥á ®â ªã¤  ­ã¦­® ¢ë¢®¤¨âì áâபã
@ -85,14 +85,14 @@ ret ;
mov edx,ch_border_color ;§ £à㧨âì 梥â
@@:
movzx ebx,word ch_left ;§ £à㧨âì ª®®à¤¨­ âã ¯® å
add ebx,(ch_size/4) ;¤ŽĄ ˘¨âě (áâŽŕŽ­  Żŕ㣎Ťě­¨Ş /3)
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/4) ;¤ŽĄ ˘¨âě (áâŽŕŽ­  Żŕ㣎Ťě­¨Ş /3)
add ecx,(ch_size/3) ;¤ŽĄ ˘¨âě (áâŽŕŽ­  Żŕ㣎Ťě­¨Ş /3)
shl ecx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov cx,bp ;§ £à㧨¬ §­ ç¥­¨ï ॣ¨áâà  ãª § â¥«ï ¡ §ë ¢ cx
;pop cx

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
@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 --->