kolibrios/programs/develop/libraries/fontslib/trunk/font_ex.asm

216 lines
8.2 KiB
NASM
Raw Normal View History

; Copyright (c) 2009, <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 nickname <Lrz> ''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.
;*****************************************************************************
;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
use32 ; <20><EFBFBD><E0A0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><EFBFBD><E1AFAE><EFBFBD><EFBFBD><EFBFBD>騩 32 ࠧ<><EFBFBD><EFA4AD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
org 0x0 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><EFBFBD><E1A5A3> 0x0
db 'MENUET01' ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4A8AA><EFBFBD><EFBFBD> <20><EFBFBD><E1AFAE><EFBFBD><EFA5AC><EFBFBD><><E4A0A9> (8 <20><><EFBFBD><EFBFBD>)
dd 0x1 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0ACA0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E1AFAE><EFBFBD><EFA5AC><EFBFBD><><E4A0A9>
dd start ; <20><><EFBFBD><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><E0A5A4><EFBFBD> <20><><EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD>
; <20><><20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
dd mem ; ࠧ<><E0A0A7><EFBFBD> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
dd mem ; <20><><20><EFBFBD><E1AFAE><EFBFBD><EFBFBD><E3A5AC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><EFBFBD> <20><EFBFBD><E2A2A5><EFBFBD> 0<>100 <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><E0AEA2><EFBFBD> <20><> <20><EFBFBD><E0ADA8> 4 <20><><EFBFBD><EFBFBD><EFBFBD>
dd mem ; <20><><EFBFBD><E1AFAE><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><EFBFBD> <20><><><E2A5AB> <20>ணࠬ<E0AEA3><E0A0AC>. <20><><EFBFBD><EFBFBD> <20><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 㪠<><E3AAA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
dd 0x0 ; 㪠<><E3AAA0><EFBFBD> <20><> <20><><EFBFBD> <20> <20><><EFBFBD><E0A0AC><EFBFBD>.
dd way_of_ini
include '../../../../macros.inc'
include '../../box_lib/asm/trunk/editbox_ex.mac'
include '../../box_lib/load_lib.mac'
@use_library ;use load lib macros
start:
;universal load library/librarys
sys_load_libraries l_libs_start,end_l_libs
;if return code =-1 then exit, else nornary work
cmp eax,-1
jz exit
mcall 40,0x27 ;<3B><><EFBFBD><E2A0AD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>
mov eax,48
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
mcall
mov eax,dword [sc.work]
mov dword [con_colors+4],eax
; mcall 66,1,0
call [initialization_font] ; <20><><EFBFBD><EFBFBD><E6A8A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᯨ᪠ <20><><EFBFBD><EFBFBD>
push dword (8 shl 16 +16) ; <20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E3A6AD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>⮢ (<28><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> ⮫쪮 8<>16)
call [get_font]
test eax,eax ;<3B><>諨 ?
jnz exit
;;;;;;;;;;;;;;;;;;;;
mcall 40,0x27 ;<3B><><EFBFBD><E2A0AD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>
red_win:
call draw_window ;<3B><><EFBFBD><E0A2AE>砫쭮 <20><><EFBFBD><EFBFBD><EFBFBD><E5AEA4><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E1AEA2><EFBFBD> <20><><EFBFBD><EFBFBD>
align 4
still: ;<3B><EFBFBD><E1ADAE><EFBFBD><EFBFBD> <20><><EFBFBD><E0A0A1>
mcall 10 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1AEA1><EFBFBD><EFBFBD>
dec eax
jz red_win
dec eax
jz key
dec eax
jz button
push dword edit1
call [edit_box_mouse]
jmp still ;<3B><20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1ABA5><EFBFBD><EFBFBD><EFBFBD> <20><><><E1ADAE> <20><>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
button:
mcall 17 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4A8AA><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
test ah,ah ;<3B><20> ah 0, <20><> <20><><EFBFBD><E0A5A9> <20><> <20><><EFBFBD><E0A0A1>稪 ᮡ<>⨩ still
jz still
exit:
call [free_fulder_info]
call [free_font]
mcall -1
key:
mcall 2 ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E7A5AD> 2 <20><><E0A5A3><EFBFBD><EFBFBD><EFBFBD> eax <20> <20><><EFBFBD><EFBFBD><20><><EFBFBD> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
push dword edit1
call [edit_box_key]
mcall 13,<20,650>,<40,16>, dword[con_colors+4]
push dword 20 shl 16 + 40 ; esp+12= dd x shl 16 + y x- <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><> <20>, y - <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><> Y
push dword con_colors ; esp+8 = dd point to color of background and font
push dword text ; esp+4 = dd point to ASCIIZ
; esp+0 = dd back
call [font_draw_on_string] ; <20><EFBFBD><EBA2A5><EFBFBD> <20><> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
jmp still
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
align 4
draw_window: ;<3B><><EFBFBD><E1AEA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mcall 12,1
xor eax,eax ;<3B><><EFBFBD><EFBFBD><E3ABA8> eax
mov ebx,50*65536+680 ;[<5B><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> x]*65536 + [ࠧ<><E0A0A7><EFBFBD> <20><> <20><><EFBFBD> x]
mov ecx,30*65536+200 ;[<5B><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> y]*65536 + [ࠧ<><E0A0A7><EFBFBD> <20><> <20><><EFBFBD> y]
mov edx,[sc.work] ; color of work area RRGGBB,8->color gl
or edx,0x34000000
mov edi,hed
mcall ;<3B><><EFBFBD><EFBFBD><EFBFBD><E1AEA2><EFBFBD> <20><><EFBFBD><EFBFBD> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
push dword edit1
call [edit_box_draw]
;
push dword 20 shl 16 + 40 ; esp+12= dd x shl 16 + y x- <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><> <20>, y - <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><> Y
push dword con_colors ; esp+8 = dd point to color of background and font
push dword text; esp+4 = dd point to ASCIIZ
; esp+0 = dd back
call [font_draw_on_string] ; <20><EFBFBD><EBA2A5><EFBFBD> <20><> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov eax,12 ;<3B><EFBFBD><E3ADAA><EFBFBD> 12 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1AEA2> <20><><EFBFBD><EFBFBD>.
mov ebx,2 ;<3B><><EFBFBD><EFBFBD><EFBFBD><E3ADAA><EFBFBD> 2 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1AEA2> <20><><EFBFBD><EFBFBD>.
mcall
ret
;;;;;;;;;;;;
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;DATA <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
l_libs_start:
library01 l_libs library_name, way_of_ini, library_path, system_path, err_message_found_lib, head_f_l, font_import, err_message_import, head_f_i
library02 l_libs library_name1, way_of_ini, library_path, system_path1, err_message_found_lib1, head_f_l, import_box_lib, err_message_import1, head_f_i
end_l_libs:
;
system_path db '/sys/lib/'
library_name db 'fonts_lib.obj',0
system_path1 db '/sys/lib/'
library_name1 db 'box_lib.obj',0
err_message_found_lib db 'Sorry I cannot load library fonts_lib.obj',0
err_message_found_lib1 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 fonts_lib.obj',0
err_message_import1 db 'Error on load import library box_lib.obj',0
align 4
import_box_lib:
edit_box_draw dd aEdit_box_draw
edit_box_key dd aEdit_box_key
edit_box_mouse dd aEdit_box_mouse
version_ed dd aVersion_ed
dd 0
dd 0
aEdit_box_draw db 'edit_box',0
aEdit_box_key db 'edit_box_key',0
aEdit_box_mouse db 'edit_box_mouse',0
aVersion_ed db 'version_ed',0
font_import:
initialization_font dd a_initialization_font
get_font dd a_get_font
free_fulder_info dd a_free_fulder_info
free_font dd a_free_font
font_draw_on_string dd a_font_draw_on_string
show_all_glif dd a_show_all_glif
Version_fn dd a_Version_fn
dd 0,0
a_initialization_font db 'initialization_font',0
a_get_font db 'get_font',0
a_free_fulder_info db 'free_fulder_info',0
a_free_font db 'free_font',0
a_font_draw_on_string db 'font_draw_on_string',0
a_show_all_glif db 'show_all_glif',0
a_Version_fn db 'version_fn',0
edit1 edit_box 350,175,5,0xffffff,0x6f9480,0,0xAABBCC,0,test_leght,text,ed_focus,text_end-text-1,text_end-text-1
text db '<27><EFBFBD><E0A8AC> <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>⮢ fonts_lib.obj',0
text_end:
rb 256
test_leght = ($-text)-1
hed db "Font's demo <Lrz>",0
align 4
con_colors dd 0x1E1EFF, 0x96FFCF
align 4
sc system_colors
way_of_ini rb 4096
library_path rb 4096
align 4
i_end:
rb 1024
mem:
;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>