Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 350 → Rev 353

/programs/develop/examples/circle/trunk/build_ru.bat
File deleted
\ No newline at end of file
/programs/develop/examples/circle/trunk/build_en.bat
File deleted
\ No newline at end of file
/programs/develop/examples/circle/trunk/build.bat
0,0 → 1,2
@fasm circle.asm circle
@pause
/programs/develop/examples/circle/trunk/circle.asm
16,7 → 16,6
dd 0x1000 ; esp
dd 0x00000000 ; reserved=no extended header
 
include 'lang.inc'
include 'macros.inc'
 
 
24,7 → 23,7
START: ; start of execution
 
call shape_window ; function for shaping
 
red:
call draw_window ; at first, draw the window
 
still:
32,32 → 31,24
mov eax,10 ; wait here for event
int 0x40
 
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
dec eax ; redraw request ?
jz red
dec eax ; key in buffer ?
jz key
 
jmp still
button:
mov al,17 ; get id
int 0x40
 
red: ; redraw
call draw_window
jmp still
cmp ah,1 ; button id=1 ?
jne noclose
or eax,-1 ; close this program
int 0x40
 
key: ; key
mov eax,2 ; just read it and ignore
mov al,2 ; just read it and ignore
int 0x40
jmp still
 
button: ; button
mov eax,17 ; get id
int 0x40
 
cmp ah,1 ; button id=1 ?
jne noclose
mov eax,-1 ; close this program
int 0x40
noclose:
 
jmp still
130,7 → 121,7
int 0x40
 
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
xor eax,eax ; function 0 : define and draw window
mov ebx,100*65536 ; [x start] *65536 + [x size]
mov ecx,100*65536 ; [y start] *65536 + [y size]
mov bx,word [x_size]
/programs/develop/examples/optionbox/trunk/build.bat
0,0 → 1,2
@fasm optxampl.asm optxample
@pause
/programs/develop/examples/optionbox/trunk/macros.inc
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
/programs/develop/examples/optionbox/trunk/optbox.inc
0,0 → 1,112
;
;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 ?
/programs/develop/examples/optionbox/trunk/optxampl.asm
0,0 → 1,165
;
; 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
 
/programs/media/scrshoot/editbox.inc
File deleted
\ No newline at end of file
/programs/media/scrshoot/checkbox.inc
File deleted
\ No newline at end of file
/programs/media/scrshoot/macros.inc
1,9 → 1,9
;--- ¤à㣨¥ ¬ ªà®áë ---
include 'editbox.inc'
include '..\..\develop\examples\editbox\trunk\editbox.inc'
include 'txtbut.inc'
;include 'gp.inc'
include 'label.inc'
;include 'checkbox.inc'
;include '..\..\develop\examples\checkbox\trunk\checkbox.inc'
include 'check.inc'
include 'file_sys.inc'
include 'textwork.inc'
/programs/system/rdsave/trunk/editbox.inc
File deleted
\ No newline at end of file
/programs/system/rdsave/trunk/rdsave.asm
25,7 → 25,7
dd 0x0 ;  ¤à¥á ¡ãä¥à  ¤«ï ¯ à ¬¥â஢ (­¥ ¨á¯®«ì§ã¥âáï)
dd 0x0 ; § à¥§¥à¢¨à®¢ ­®
 
include 'editbox.inc'
include '..\..\..\develop\examples\editbox\trunk\editbox.inc'
use_edit_box
 
;---------------------------------------------------------------------
/programs/system/run/trunk/editbox.inc
File deleted
\ No newline at end of file