2010-10-03 21:19:43 +04:00
;*****************************************************************************
; Example for Box_lib: checkbox
; Copyright (c) 2007-2010, Alexey Teplov aka <Lrz>
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> nor the
; names of its contributors may be used to endorse or promote products
; derived from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov ''AS IS'' AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;******************************************************************************
use32
org 0x0
;------------ <head> from kolibrios programm
db 'MENUET01'
dd 0x01
dd START
dd MEM_END
dd PRIL_END
dd PRIL_END
dd 0x0
dd cur_dir_path
;------------ </head>
;------------ <include macros>
include '../../../../macros.inc'
include '../load_lib.mac'
include 'box_lib.mac'
;include 'macros.inc'
;include 'load_lib.mac'
;------------ </include macros>
;------------ <init library>
@ use_library
;------------ </init library>
;---------------------------------------------------------------------
;--- Start of program ----------------------------------------------
;---------------------------------------------------------------------
START:
2010-10-12 15:55:19 +04:00
mcall 40 , 0x27
2010-10-03 21:19:43 +04:00
sys_load_library library_name , cur_dir_path , library_path , system_path , \
err_message_found_lib , head_f_l , myimport , err_message_import , head_f_i
test eax , eax
jnz exit
2010-10-12 15:55:19 +04:00
;init checkboxes
push dword ch eck1
call [ init_checkbox ]
push dword ch eck2
call [ init_checkbox ]
push dword ch eck3
call [ init_checkbox ]
2010-10-03 21:19:43 +04:00
2010-10-15 11:08:53 +04:00
push dword ch eck4
call [ init_checkbox ]
push dword ch eck5
call [ init_checkbox ]
push dword ch eck6
call [ init_checkbox ]
2010-10-12 15:55:19 +04:00
2010-10-03 21:19:43 +04:00
window:
call draw_window ;<3B> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD>
align 4
still: ;<3B> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
mcall 10 ;<3B> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
dec eax
jz window
dec eax
jz key
dec eax
jz button
push dword ch eck1
call [ ch eck_box_mouse ]
push dword ch eck2
call [ ch eck_box_mouse ]
2010-10-12 15:55:19 +04:00
push dword ch eck3
call [ ch eck_box_mouse ]
2010-10-15 11:08:53 +04:00
push dword ch eck4
call [ ch eck_box_mouse ]
push dword ch eck5
call [ ch eck_box_mouse ]
push dword ch eck6
call [ ch eck_box_mouse ]
2010-10-03 21:19:43 +04:00
jmp still ;<3B> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
button:
mcall 17 ;<3B> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
test ah , ah ;<3B> <> <EFBFBD> <EFBFBD> <20> ah 0, <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> still
jz still
exit: mcall - 1
key:
mcall 2 ;<3B> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 2 <20> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> eax <20> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
jmp still
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
align 4
draw_window: ;<3B> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
mcall 12 , 1
mcall 0 ,( 50 * 65536 + 390 ),( 30 * 65536 + 200 ), 0x33AABBCC , 0x805080DD , hed
push dword ch eck1
call [ ch eck_box_draw ]
push dword ch eck2
call [ ch eck_box_draw ]
2010-10-12 15:55:19 +04:00
push dword ch eck3
call [ ch eck_box_draw ]
2010-10-15 11:08:53 +04:00
push dword ch eck4
call [ ch eck_box_draw ]
push dword ch eck5
call [ ch eck_box_draw ]
push dword ch eck6
call [ ch eck_box_draw ]
2010-10-12 15:55:19 +04:00
2010-10-03 21:19:43 +04:00
mcall 12 , 2
ret
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;DATA <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
;<3B> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> .
system_path db '/sys/lib/'
library _name db 'box_lib.obj' , 0
; <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> , <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
;system_path db '/sys/lib/box_lib.obj',0
;... <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .
;library_name db 'box_lib.obj',0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
err_message_found_lib db 'Sorry I cannot load library box_lib.obj' , 0
head_f_i:
head_f_l db 'System error' , 0
err_message_import db 'Error on load import library box_lib.obj' , 0
myimport:
2010-10-12 15:55:19 +04:00
init_checkbox dd aInit_checkbox
2010-10-03 21:19:43 +04:00
check_box_draw dd aCheck_box_draw
check_box_mouse dd aCheck_box_mouse
version_ch dd aVersion_ch
dd 0 , 0
2010-11-01 11:17:46 +03:00
aInit_checkbox db 'init_checkbox2' , 0
aCheck_box_draw db 'check_box_draw2' , 0
aCheck_box_mouse db 'check_box_mouse2' , 0
aVersion_ch db 'version_ch2' , 0
2010-10-03 21:19:43 +04:00
;---------------------------------------------------------------------
2010-11-01 11:17:46 +03:00
check1 ch eck_box2 ( 10 shl 16 + 12 ),( 10 shl 16 + 12 ), 6 , 0xC0AABBCC , 0 , 0x80000000 , ch eck_text , ch _flag_en
check2 ch eck_box2 ( 10 shl 16 + 22 ),( 25 shl 16 + 12 ), 6 , 0xC0AABBCC , 0 , 0x80000000 , ch eck_text2
check3 ch eck_box2 ( 10 shl 16 + 12 ),( 40 shl 16 + 22 ), 6 , 0xC0AABBCC , 0 , 0x80000000 , ch eck_text3
check4 ch eck_box2 ( 10 shl 16 + 12 ),( 70 shl 16 + 22 ), 6 , 0xC0AABBCC , 0 , 0x80000000 , ch eck_text4 , ch _flag_top
check5 ch eck_box2 ( 10 shl 16 + 12 ),( 100 shl 16 + 22 ), 6 , 0xC0AABBCC , 0 , 0x80000000 , ch eck_text5 , ch _flag_middle
check6 ch eck_box2 ( 10 shl 16 + 12 ),( 130 shl 16 + 22 ), 6 , 0xC0AABBCC , 0 , 0x80000000 , ch eck_text6 , ch _flag_bottom
2010-10-03 21:19:43 +04:00
;---------------------------------------------------------------------
2010-10-15 11:08:53 +04:00
hed db 'CheckBox Exemples <Lrz> date 15.10.2010' , 0
2010-10-03 21:19:43 +04:00
hed_end:
;---------------------------------------------------------------------
2010-10-15 11:08:53 +04:00
check_text db 'First checkbox, set flag ch_flag_en' , 0
check_text2 db 'Second checkbox,not set any flag' , 0
check_text3 db 'Number 3 checkbox, not set any flag' , 0
check_text4 db 'Set flag is ch_flag_top' , 0
check_text5 db 'Set flag is ch_flag_middle' , 0
check_text6 db 'Set flag is ch_flag_bottom' , 0
2010-10-03 21:19:43 +04:00
;---------------------------------------------------------------------
MEM_END:
cur_dir_path rb 1024
library _path rb 1024
rb 1024 ;for stack
PRIL_END: