forked from KolibriOS/kolibrios
A simple fonts_lib library. That library support one font 8x16.
git-svn-id: svn://kolibrios.org@1158 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
d59b725fc3
commit
de54d697db
5
programs/develop/libraries/fontslib/trunk/build.bat
Normal file
5
programs/develop/libraries/fontslib/trunk/build.bat
Normal file
@ -0,0 +1,5 @@
|
||||
@fasm -m 16384 font_.asm font01.ksf
|
||||
@fasm -m 65536 fonts_lib.asm
|
||||
@fasm -m 65536 font_ex.asm font_ex.kex
|
||||
@kpack font_ex.kex
|
||||
@kpack fonts_lib.obj
|
41
programs/develop/libraries/fontslib/trunk/font_.asm
Normal file
41
programs/develop/libraries/fontslib/trunk/font_.asm
Normal file
@ -0,0 +1,41 @@
|
||||
; 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.
|
||||
;*****************************************************************************
|
||||
|
||||
version_head db 'kf01' ; ⨯® à §¬¥à èà¨ä⠢ᥣ¤ 4 ᨬ¢®«
|
||||
font_size dd 8 shl 16 +16 ;font_width shl +font_height
|
||||
font_start dd font_8x16
|
||||
;
|
||||
;font_size dd 16 shl 16 +32 ;font_width shl +font_height
|
||||
;font_start dd font_16_32
|
||||
|
||||
dd -1 ; ª®¥æ áâàãªâãàë
|
||||
font_name db 'Kolibri standart font',0
|
||||
align 4
|
||||
font_8x16:
|
||||
file 'font_8x16.fon'
|
||||
;align 4
|
||||
;font_16_32:
|
||||
;file 'font_16x32.fon'
|
BIN
programs/develop/libraries/fontslib/trunk/font_8x16.fon
Normal file
BIN
programs/develop/libraries/fontslib/trunk/font_8x16.fon
Normal file
Binary file not shown.
213
programs/develop/libraries/fontslib/trunk/font_ex.asm
Normal file
213
programs/develop/libraries/fontslib/trunk/font_ex.asm
Normal file
@ -0,0 +1,213 @@
|
||||
; 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.
|
||||
;*****************************************************************************
|
||||
|
||||
;§ £®«®¢®ª ¯à¨«®¦¥¨ï
|
||||
use32 ; âà á«ïâ®à, ¨á¯®«ì§ãî騩 32 à §àï¤ëå ª®¬ ¤ë
|
||||
org 0x0 ; ¡ §®¢ë© ¤à¥á ª®¤ , ¢á¥£¤ 0x0
|
||||
db 'MENUET01' ; ¨¤¥â¨ä¨ª â®à ¨á¯®«ï¥¬®£® ä ©« (8 ¡ ©â)
|
||||
dd 0x1 ; ¢¥àá¨ï ä®à¬ â § £®«®¢ª ¨á¯®«ï¥¬®£® ä ©«
|
||||
dd start ; ¤à¥á, ª®â®àë© á¨á⥬ ¯¥à¥¤ ñâ ã¯à ¢«¥¨¥
|
||||
; ¯®á«¥ § £à㧪¨ ¯à¨«®¦¥¨ï ¢ ¯ ¬ïâì
|
||||
dd mem ; à §¬¥à ¯à¨«®¦¥¨ï
|
||||
dd mem ; Ž¡ê¥¬ ¨á¯®«ì§ã¥¬®© ¯ ¬ïâ¨, ¤«ï á⥪ ®â¢¥¤¥¬ 0å100 ¡ ©â ¨ ¢ë஢¨¬ £à¨æã 4 ¡ ©â
|
||||
dd mem ; à ᯮ«®¦¨¬ ¯®§¨æ¨î á⥪ ¢ ®¡« á⨠¯ ¬ïâ¨, áà §ã § ⥫®¬ ¯à®£à ¬¬ë. ‚¥àè¨ á⥪ ¢ ¤¨ ¯ §®¥ ¯ ¬ïâ¨, 㪠§ ®¬ ¢ëè¥
|
||||
dd 0x0 ; 㪠§ ⥫ì áâபã á ¯ à ¬¥âà ¬¨.
|
||||
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 ;ãáâ ®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
|
||||
|
||||
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] ; ¨¨æ¨ «¨§ æ¨ï ᯨ᪠èà¨ä⮢
|
||||
push dword (8 shl 16 +16) ; ¯®¨áª 㦮£® èà¨äâ ¢ ¡®à¥ èà¨ä⮢ (¯®ª ¤®áâ㯥 ⮫쪮 8å16)
|
||||
call [get_font]
|
||||
test eax,eax ; 諨 ?
|
||||
jnz exit
|
||||
;;;;;;;;;;;;;;;;;;;;
|
||||
mcall 40,0x27 ;ãáâ ®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
|
||||
red_win:
|
||||
call draw_window ;¯¥à¢® ç «ì® ¥®¡å®¤¨¬® à¨á®¢ âì ®ª®
|
||||
align 4
|
||||
still: ;®á®¢®© ®¡à ¡®â稪
|
||||
mcall 10 ;Ž¦¨¤ âì ᮡëâ¨ï
|
||||
dec eax
|
||||
jz red_win
|
||||
dec eax
|
||||
jz key
|
||||
dec eax
|
||||
jz button
|
||||
|
||||
push dword edit1
|
||||
call [edit_box_mouse]
|
||||
|
||||
jmp still ;¥á«¨ ¨ç¥£® ¨§ ¯¥à¥ç¨á«¥®£® ⮠ᮢ ¢ 横«
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
button:
|
||||
mcall 17 ;¯®«ãç¨âì ¨¤¥â¨ä¨ª â®à ¦ ⮩ ª« ¢¨è¨
|
||||
test ah,ah ;¥á«¨ ¢ ah 0, â® ¯¥à¥©â¨ ®¡à ¡®â稪 ᮡë⨩ still
|
||||
jz still
|
||||
exit: mcall -1
|
||||
key:
|
||||
mcall 2 ;§ £à㧨¬ § 票¥ 2 ¢ ॣ¨áâ®à eax ¨ ¯®«ã稬 ª®¤ ¦ ⮩ ª« ¢¨è¨
|
||||
|
||||
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- ª®®à¤¨ â ¯® •, y - ª®®à¤¨ â ¯® 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] ; ¢ë¢¥á⨠¯® £«¨ä ¬ áâà®çªã
|
||||
|
||||
|
||||
jmp still
|
||||
|
||||
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
align 4
|
||||
draw_window: ;à¨á®¢ ¨¥ ®ª ¯à¨«®¦¥¨ï
|
||||
mcall 12,1
|
||||
xor eax,eax ;®¡ã«¨âì eax
|
||||
mov ebx,50*65536+680 ;[ª®®à¤¨ â ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ x]
|
||||
mov ecx,30*65536+500 ;[ª®®à¤¨ â ¯® ®á¨ y]*65536 + [à §¬¥à ¯® ®á¨ y]
|
||||
mov edx,[sc.work] ; color of work area RRGGBB,8->color gl
|
||||
or edx,0x34000000
|
||||
mov edi,hed
|
||||
mcall ; à¨á®¢ âì ®ª® ¯à¨«®¦¥¨ï
|
||||
|
||||
push dword edit1
|
||||
call [edit_box_draw]
|
||||
;
|
||||
push dword 20 shl 16 + 40 ; esp+12= dd x shl 16 + y x- ª®®à¤¨ â ¯® •, y - ª®®à¤¨ â ¯® 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] ; ¢ë¢¥á⨠¯® £«¨ä ¬ áâà®çªã
|
||||
mov eax,12 ;”ãªæ¨ï 12 - ç âì/§ ª®ç¨âì ¯¥à¥à¨á®¢ªã ®ª .
|
||||
mov ebx,2 ;<3B>®¤äãªæ¨ï 2 - § ª®ç¨âì ¯¥à¥à¨á®¢ªã ®ª .
|
||||
mcall
|
||||
ret
|
||||
;;;;;;;;;;;;
|
||||
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
;DATA ¤ ë¥
|
||||
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>ਬ¥à ¨á¯®«ì§®¢ ¨ï ¡¨¡«¨®â¥ª¨ èà¨ä⮢ 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:
|
||||
;ª®¥æ ª®¤
|
540
programs/develop/libraries/fontslib/trunk/fonts_lib.asm
Normal file
540
programs/develop/libraries/fontslib/trunk/fonts_lib.asm
Normal file
@ -0,0 +1,540 @@
|
||||
; 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.
|
||||
;*****************************************************************************
|
||||
|
||||
;Fonts library
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;
|
||||
|
||||
format MS COFF
|
||||
|
||||
public EXPORTS
|
||||
|
||||
section '.flat' code readable align 16
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Get info about
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
include '../../../../macros.inc'
|
||||
align 4
|
||||
initialization_font:
|
||||
; esp+0 = dd back
|
||||
; çàïîëíÿåì ìàññèâ - ñòðóêòó äëÿ ïîëó÷åíèÿ êîë-âà ôàéëîâ
|
||||
|
||||
pushad
|
||||
xor eax,eax
|
||||
inc eax
|
||||
mov [number_function],eax
|
||||
;structure is completed
|
||||
mov eax,70
|
||||
mov ebx,dword struct_f_info
|
||||
mcall
|
||||
;IF ERROR FT then exit
|
||||
test eax,eax
|
||||
jnz .exit
|
||||
;IF ERROR folder is not found then exit
|
||||
test ebx,ebx
|
||||
mov eax,ebx
|
||||
jnz .exit
|
||||
|
||||
;Get quantity files
|
||||
mov eax,[buffer_32.quantity_files]
|
||||
imul eax,304
|
||||
add eax,32 ; ??
|
||||
push eax ;save eax â eax ðàçìåð íóæíîé íàì ïàìÿòè â áàéòàõ
|
||||
;init memory
|
||||
mov eax,68
|
||||
mov ebx,11
|
||||
mcall
|
||||
test eax,eax
|
||||
jz .exit
|
||||
inc ebx ;âûäåëèòü áëîê â ecx áàéò
|
||||
|
||||
pop ecx
|
||||
mov eax,68
|
||||
mcall
|
||||
mov dword [fulder_array_point],eax ;save point for memory's fulder
|
||||
;â eax óêàçàòåëü íà áëîê
|
||||
mov [buffer_read_d],eax ;point to new array
|
||||
mov eax,[buffer_32.quantity_files]
|
||||
mov [read_block],eax
|
||||
;get in buffer info of files and sub dir current dir
|
||||
mov eax,70
|
||||
mov ebx,dword struct_f_info
|
||||
mcall
|
||||
;ïîëó÷èëè èíôîðìàöèþ î ôàéëàõ.
|
||||
mov ebp, dword [buffer_read_d] ;point to structure
|
||||
mov ecx, dword [ebp+4] ;êîë-âî áëîêîâ ÁÄÂÊ
|
||||
mov dword [save_ecx],ecx
|
||||
add ebp, 32 ;ñìåùàåìñÿ äî ÁÄÂÊ
|
||||
mov dword [save_ebp],ebp
|
||||
; mov dword [save_point_nt],ebp
|
||||
cld ;óñòàíîâêà ôëàãà íàïðàâëåíèÿ
|
||||
align 4
|
||||
.start_loop:
|
||||
push ecx
|
||||
lea edi,[ebp+0x28] ;â edi óêàçàòåëü íà íà÷àëî èìåíè.
|
||||
xor eax,eax
|
||||
mov ecx,263
|
||||
align 4
|
||||
.again: mov al,byte[edi]
|
||||
test al,al
|
||||
jz .next_a
|
||||
dec ecx
|
||||
inc edi
|
||||
jnz .again
|
||||
jmp @f
|
||||
; repe scasb ;íàéäåì êîíåö ñòðîêè
|
||||
; jnz @f
|
||||
;;;; èìÿ ïðèñóòñòâóåò, ïðîâåðèì ÿâëÿòñÿ ëè èìÿ ôàéëà ñ ðàñøèðåíèåì fnt )
|
||||
; sub edi,6 ;.ksf,0
|
||||
;;;;;;;;;;;;;;;;;;;;;;;
|
||||
.next_a:
|
||||
sub edi,4 ;.ksf,0
|
||||
mov esi,dword name_font
|
||||
mov ecx,name_font_e-name_font
|
||||
repe cmpsb
|
||||
jnz @f
|
||||
;;;;;;;; óðà ýòî íàø ôàéë ò.å. íàø øðèôò ìû íàøëè íóæíûé ôàéëèê ))
|
||||
;òåïåðü íóæíî òî÷íî óáåäèòüñÿ ÷òî ýòî íàø è òîëüêî íàø ôàéëèê
|
||||
;çàãðóçèì çàãîëîâîê ôàéëà è óçíàåì åãî ðàçìåð ãëèôà.
|
||||
call alloc_mem ; âûäåëèì îçó ñâîèõ ïåðåìåííûõ
|
||||
; ñåé÷àñ íàì íóæíî ñôîðìèðîâàòü èìÿ ôàéëà ñ ïîëíûì ïóòåì
|
||||
mov eax,dword [alloc_memory_point]
|
||||
lea edi,dword [eax+4]
|
||||
lea esi,[name_fulder]
|
||||
mov ecx,name_fuld_end
|
||||
rep movsb ;ïåðåíîñèì ïóòü
|
||||
mov al,'/'
|
||||
stosb
|
||||
lea esi,[ebp+0x28] ;â esi óêàçàòåëü íà íà÷àëî èìåíè.
|
||||
align 4
|
||||
.loop_b:
|
||||
lodsb
|
||||
stosb
|
||||
test al,al
|
||||
jnz .loop_b
|
||||
|
||||
; mov edi,name_of_file ; [ebp+0x28] ;â edi óêàçàòåëü íà íà÷àëî èìåíè.
|
||||
;get in buffer info above own file
|
||||
xor eax,eax
|
||||
mov dword [number_function],eax
|
||||
mov dword [index_start_block],eax ;ïîçèöèÿ â ôàéëå äëÿ ÷òåíèÿ äàííûõ
|
||||
mov dword [flags_],eax ;ñòàðøàÿ ïîçèöèÿ äëÿ ÷òåíèÿ äàííûõ
|
||||
mov dword [read_block],8 ;ñêîëüêî áàéò ÷èòàòü íàì íóæíî 8 áàéò
|
||||
mov dword [buffer_read_d],file_buffer ; óêàçàòåëü íà áóôåð êóäà áóäóò çàïèñàíû äàííûå
|
||||
|
||||
mov eax,dword [alloc_memory_point]
|
||||
lea edi,dword [eax+4]
|
||||
mov dword [offset_to_string],edi
|
||||
|
||||
mov eax,70
|
||||
mov ebx,dword struct_f_info
|
||||
mcall
|
||||
;;;;;;;;;;;;;;;; ïðîâåðèì ôîðìàò çàãîëîâêà
|
||||
mov eax,ebx
|
||||
mov eax,dword [file_buffer]
|
||||
mov ebx,dword [type_fnt]
|
||||
cmp eax,ebx
|
||||
jnz @f
|
||||
|
||||
;;;;;;; îòëè÷íî ñåé÷àñ ïðîâåðèëè ÷òî çàãîëîâîê èìåííî òîò êîòîðûé íàì íóæåí
|
||||
; ñåé÷àñ íóæíî ïåðåðàñïðåäåëèòü áëîêè ò.å. ïî ìåðå íàõîæäåíèÿ áóäåì ïåðåíîñèòü áëîêè
|
||||
; â íà÷àëî áóôåðà
|
||||
|
||||
mov dword [save_point_nt],ebp
|
||||
; mov esi, ebp
|
||||
; mov ecx,304/4
|
||||
|
||||
|
||||
|
||||
;align 4
|
||||
;.transfer:
|
||||
; lodsd
|
||||
; stosd
|
||||
; loop .transfer
|
||||
; add dword [save_point_nt],304 ;óêàçàòåëü íà ñëåäóþùèé áëîê
|
||||
;;; ñäåëàëè òàðíñôåð ïåðåìåùåíèå äàííûõ
|
||||
pop ecx
|
||||
mov dword [esp+28],0
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
align 4
|
||||
@@: pop ecx
|
||||
add ebp,304
|
||||
dec ecx
|
||||
jnz .start_loop
|
||||
; loop .start_loop
|
||||
; xor eax,eax
|
||||
;;;;;;;; ïðîøëèñü - âñå èíòåðåñóùþùèå øðèôòû ïåðåìåñòèëè â íà÷àëî áëîêà.
|
||||
|
||||
align 4
|
||||
.exit: mov dword [esp+28],eax
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
align 4
|
||||
get_font:
|
||||
; ïîèñê â ìàññèâå øðèôòà ïðè ñîâïàäåíèè ócëîâèé çàãðóçêà øðèôòà
|
||||
; esp+4 = dd width font shl 16 +hight font
|
||||
; esp+0 = dd back
|
||||
pop eax
|
||||
pop dword [font_x_y]
|
||||
push eax
|
||||
; pop eax
|
||||
; mov dword [font_x_y],eax
|
||||
pushad
|
||||
|
||||
|
||||
|
||||
xor eax,eax
|
||||
mov dword [number_function],eax
|
||||
mov dword [index_start_block],eax ;ïîçèöèÿ â ôàéëå äëÿ ÷òåíèÿ äàííûõ
|
||||
mov dword [flags_],eax ;ñòàðøàÿ ïîçèöèÿ äëÿ ÷òåíèÿ äàííûõ
|
||||
mov dword [read_block],8 ;ñêîëüêî áàéò ÷èòàòü íàì íóæíî 8 áàéò
|
||||
mov dword [buffer_read_d],file_buffer ; óêàçàòåëü íà áóôåð êóäà áóäóò çàïèñàíû äàííûå
|
||||
|
||||
mov eax,dword [alloc_memory_point]
|
||||
lea edi,dword [eax+4]
|
||||
mov dword [offset_to_string],edi
|
||||
|
||||
|
||||
; mov ecx,dword [save_ecx] ; êîë-âî èòåðàöèé ò.å. ïðîõîäîâ
|
||||
align 4
|
||||
;.start_check:
|
||||
; push ecx
|
||||
mov eax,70
|
||||
mov ebx,dword struct_f_info
|
||||
mcall
|
||||
;;;;;;;;;;;;;;;; ïðîâåðèì ôîðìàò çàãîëîâêà
|
||||
mov eax,ebx
|
||||
mov eax,dword [file_buffer]
|
||||
mov ebx,dword [type_fnt]
|
||||
cmp eax,ebx
|
||||
; jnz @f
|
||||
|
||||
|
||||
; xor eax,eax
|
||||
; mov dword [number_function],eax
|
||||
; add eax,8
|
||||
; mov dword [read_block],eax
|
||||
; mov dword [buffer_read_d],file_buffer
|
||||
; mov ebx,dword struct_f_info
|
||||
; mov eax,70
|
||||
;align 4
|
||||
;.start_check:
|
||||
;çàãðóçèì çàãîëîâîê ôàéëà è óçíàåì åãî ðàçìåð ãëèôà.
|
||||
; lea edi, [ebp+0x28] ;â edi óêàçàòåëü íà íà÷àëî èìåíè.
|
||||
; mov dword [offset_to_string],edi
|
||||
;get in buffer info above own file
|
||||
; mcall
|
||||
;;;;;;;;;;;;;;;; ïðîâåðèì ôîðìàò çàãîëîâêà
|
||||
; mov ecx,dword [file_buffer.type_fnt]
|
||||
; mov edx,dword [type_fnt]
|
||||
; cmp ecx,edx
|
||||
; jnz @f
|
||||
|
||||
mov ecx,dword [file_buffer.font_size]
|
||||
mov edx,dword [font_x_y]
|
||||
cmp ecx,edx
|
||||
; jnz @f ;óïñ íåóäà÷à âûøëà
|
||||
;øðèôò ñîâïàë ò.å. ýòî íàø,íóæíûé íàì øðèôò, ìû åãî äîëæíû çàãðóçèòü â ÎÇÓ
|
||||
|
||||
; mov ebp,dword [save_point_nt]
|
||||
mov ecx, 4096;dword [ebp+32] ;ðàçìåð ôàéëà äî 4294967296 áàéò ò.å. 4 Ãá
|
||||
|
||||
mov dword [read_block],ecx
|
||||
mov eax,68
|
||||
mov ebx,12
|
||||
mcall
|
||||
|
||||
mov dword [font_array_point],eax ;save point to array
|
||||
mov dword [buffer_read_d],eax
|
||||
|
||||
;load font
|
||||
mov ebx,dword struct_f_info
|
||||
mov eax,70
|
||||
mcall
|
||||
test eax,eax
|
||||
jnz @f
|
||||
|
||||
lea eax,[buffer_read_d]
|
||||
mov eax,dword [eax]
|
||||
mov ebx,dword [eax+8]
|
||||
add eax,ebx
|
||||
; add eax,dword [eax+8]
|
||||
; add eax,dword [buffer_read_d]
|
||||
mov dword [font_array_data],eax
|
||||
mov dword [esp+28],0
|
||||
; pop ecx
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
;here error file system
|
||||
align 4
|
||||
@@:
|
||||
; pop ecx
|
||||
; add ebp,304
|
||||
; dec ecx
|
||||
; jnz .start_check
|
||||
|
||||
or dword [esp+28],-1 ;âåðíåì îøèáêó
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
; ïîèñê âûâîä ñòîðî÷êè ïî ñèìâîëüíî ñôîðèðîâàííîãî øðèôòîì òåêñòà
|
||||
; esp+12= dd x shl 16 + y x- êîîðäèíàòà ïî Õ, y - êîîðäèíàòà ïî Y
|
||||
; esp+8 = dd point to color of background and font
|
||||
; esp+4 = dd point to ASCIIZ
|
||||
; esp+0 = dd back
|
||||
align 4
|
||||
font_draw_on_string:
|
||||
pushad
|
||||
|
||||
mov esi,dword [esp+4+32] ;ASCIIZ
|
||||
mov edx,dword [esp+12+32] ; x shl 16 +y
|
||||
mov ecx,dword [font_x_y] ;ðàçìåð ãëèôà x shl 16 +y
|
||||
mov edi,dword [esp+8+32] ;óêàçàòåëü íà ïàëèòðó èç öâåòà è ôîíà
|
||||
xor ebp,ebp ;ñì 65 ôóíêöèþ ))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
; pushad
|
||||
; mov ebp, dword [esp+4+32+32]
|
||||
; mov ebp, dword [save_point_nt]
|
||||
; lea edi, [ebp+0x28] ;â edi óêàçàòåëü íà íà÷àëî èìåíè.
|
||||
; sub edi,4 ;.ksf,0
|
||||
; mov eax,4
|
||||
; mov ebx,dword [show_dir]
|
||||
; add dword [show_dir],10
|
||||
; mov ecx,0x80000000;DDBBCC
|
||||
; mov edx,ebp;[ebp+0x28];eax;edi
|
||||
; xor esi,esi
|
||||
;mov esi,8
|
||||
; mcall
|
||||
; popad
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
cld
|
||||
align 4
|
||||
@@: ;pushad
|
||||
xor eax,eax
|
||||
lodsb
|
||||
test al,al
|
||||
jz .exit
|
||||
; movzx eax,al
|
||||
shl eax,4 ;óìíîæàåì íà 16 ò.ê. ýòî âûñîòà ãëèôà
|
||||
; imul eax,16
|
||||
|
||||
mov ebx,dword [font_array_data] ; òóò ðàñïîëîãàþòñÿ ãëèôû ñèìâîëîâ
|
||||
; add eax,ebx
|
||||
; mov ebx,dword [ebx+8] ; ñìåùåíèå
|
||||
; add eax,ebx
|
||||
add ebx,eax
|
||||
push esi
|
||||
mov esi,1
|
||||
mov eax,65
|
||||
mcall
|
||||
pop esi
|
||||
add edx,8 shl 16 ;ñëåäóþùèé ñèìâîë øèðèíà ñèìâîëà = 8 òî÷êàì
|
||||
jmp @b
|
||||
align 4
|
||||
.exit: ;popad
|
||||
|
||||
; add edx,16
|
||||
; loop .next
|
||||
|
||||
align 4
|
||||
.return:
|
||||
popad
|
||||
ret 12
|
||||
|
||||
|
||||
align 4
|
||||
; esp+4 = dd point to color of background and font
|
||||
show_all_glif:
|
||||
pushad
|
||||
|
||||
mov edx,10 shl 16+20 ;dword [esp+12+32] ; x shl 16 +y
|
||||
mov ecx,128 shl 16 +256;dword [font_x_y] ;ðàçìåð ãëèôà x shl 16 +y
|
||||
mov edi,dword [esp+4+32] ;óêàçàòåëü íà ïàëèòðó èç öâåòà è ôîíà
|
||||
xor ebp,ebp ;ñì 65 ôóíêöèþ ))
|
||||
|
||||
align 4
|
||||
@@:
|
||||
mov ebx,dword [font_array_data] ; òóò ðàñïîëîãàþòñÿ ãëèôû ñèìâîëîâ
|
||||
mov esi,1
|
||||
mov eax,65
|
||||
mcall
|
||||
|
||||
popad
|
||||
ret 4
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
align 4
|
||||
free_fulder_info:
|
||||
;îñâîáîäèòü ïàìÿòü âûäåëåíóþ äëÿ ïîëó÷åíèÿ áëîêîâ ÁÄÂÊ
|
||||
pushad
|
||||
mov ecx, dword [fulder_array_point]
|
||||
mov eax,68
|
||||
mov ebx,13
|
||||
mcall
|
||||
test eax,eax
|
||||
jnz @f
|
||||
or dword [esp+28],-1 ;âåðíåì îøèáêó
|
||||
align 4
|
||||
@@:
|
||||
popad
|
||||
ret
|
||||
align 4
|
||||
free_font:
|
||||
;îñâîáîäèòü ïàìÿòü âûäåëåíóþ äëÿ ïîëó÷åíèÿ áëîêîâ ÁÄÂÊ
|
||||
pushad
|
||||
mov ecx, dword [font_array_point]
|
||||
mov eax,68
|
||||
mov ebx,13
|
||||
mcall
|
||||
test eax,eax
|
||||
jnz @f
|
||||
or dword [esp+28],-1 ;âåðíåì îøèáêó
|
||||
align 4
|
||||
@@:
|
||||
popad
|
||||
ret
|
||||
|
||||
align 4
|
||||
; alloc mem get 4 Kb for own data
|
||||
alloc_mem:
|
||||
pushad
|
||||
mov eax, dword [alloc_memory_point]
|
||||
test eax,eax
|
||||
jnz .mem_allocating
|
||||
mov eax,68
|
||||
mov ebx,12
|
||||
mov ecx,4096
|
||||
mcall
|
||||
mov dword [alloc_memory_point],eax ; ïðè ïåðâîì âõîæäåíèè âûäåëÿåì 4 êá ÎÇÓ è ñîõðàíÿåì óêàçàòåëü
|
||||
mov dword [eax],-1
|
||||
popad
|
||||
ret
|
||||
align 4
|
||||
.mem_allocating:
|
||||
mov ebp, dword [eax]
|
||||
mov eax,ebp
|
||||
cmp eax, -1
|
||||
jnz .mem_allocating
|
||||
|
||||
mov eax,68
|
||||
mov ebx,12
|
||||
mov ecx,4096
|
||||
mcall
|
||||
mov dword [ebp],eax ; ïðè ïåðâîì âõîæäåíèè âûäåëÿåì 4 êá ÎÇÓ è ñîõðàíÿåì óêàçàòåëü
|
||||
mov dword [ebp],-1
|
||||
popad
|
||||
ret
|
||||
|
||||
align 16
|
||||
EXPORTS:
|
||||
|
||||
dd sz_initialization_font, initialization_font
|
||||
dd sz_get_font, get_font
|
||||
dd sz_free_fulder_info, free_fulder_info
|
||||
dd sz_free_font, free_font
|
||||
dd sz_font_draw_on_string, font_draw_on_string
|
||||
dd sz_show_all_glif, show_all_glif
|
||||
; dd szVersion_ch, 0x00000001
|
||||
; dd sz_option_box_draw, option_box_draw
|
||||
; dd sz_option_box_mouse, option_box_mouse
|
||||
dd szVersion_fn, 0x00000001
|
||||
dd 0,0
|
||||
|
||||
sz_initialization_font db 'initialization_font',0
|
||||
sz_get_font db 'get_font',0
|
||||
sz_free_fulder_info db 'free_fulder_info',0
|
||||
sz_free_font db 'free_font',0
|
||||
sz_font_draw_on_string db 'font_draw_on_string',0
|
||||
sz_show_all_glif db 'show_all_glif',0
|
||||
;sz_check_box_mouse db 'check_box_mouse',0
|
||||
;szVersion_ch db 'version_ch',0
|
||||
;sz_option_box_draw db 'option_box_draw',0
|
||||
;sz_option_box_mouse db 'option_box_mouse',0
|
||||
szVersion_fn db 'version_fn',0
|
||||
|
||||
;;;;;;;;;;;
|
||||
;;Data
|
||||
;;;;;;;;;;;
|
||||
align 4
|
||||
;buffer_font file 'font_8x16.fon' ;øðèôò êîòîðûì áóäåì âûâîäèòü raw ôîðìàò 1bpp
|
||||
save_ecx dd 0x0
|
||||
;buffer_font file 'font01.ksf' ;øðèôò êîòîðûì áóäåì âûâîäèòü raw ôîðìàò 1bpp
|
||||
alloc_memory_point dd 0x0 ; point to mem block in RAM 4096-4
|
||||
;ñòðóêòóðà òàêàÿ â íà÷àëå âûäåëåíîãî áëîêà ðàçìåùàåòñÿ óêàçàòåëü íà äðóãîé âûäåëëíûé áëîê â 4096-4, åñëè ýòî áëîê ïîñëåäíèé, òî dd -1
|
||||
font_x_y dd 0x0
|
||||
fulder_array_point dd 0x0
|
||||
font_array_point dd 0x0
|
||||
font_array_data dd 0x0 ; ðåàëüíûå äàííûå ò.å. ìàòðèöà øðèôòà
|
||||
save_ebp dd 0x0
|
||||
save_point_nt dd 0x0
|
||||
;name_of_file db 263 dup(0x0)
|
||||
;name_of_file db '/sys/FONTS/font01.ksf',0
|
||||
name_fulder db '/sys/FONTS',0
|
||||
name_fuld_end= ($-name_fulder) -1
|
||||
name_font db '.ksf'
|
||||
name_font_e:
|
||||
type_fnt db 'kf01'
|
||||
type_fnt_e:
|
||||
|
||||
|
||||
|
||||
align 16
|
||||
struct_f_info:
|
||||
number_function dd 0x0
|
||||
index_start_block dd 0x0
|
||||
flags_ dd 0x0
|
||||
read_block dd 0x0
|
||||
buffer_read_d dd buffer_32
|
||||
free_byte db 0x0
|
||||
offset_to_string dd name_fulder
|
||||
|
||||
align 16
|
||||
file_buffer:
|
||||
.type_fnt dd 0x0
|
||||
.font_size dd 0x0
|
||||
|
||||
align 16
|
||||
buffer_32:
|
||||
.head dd ?
|
||||
.quantity_block dd ?
|
||||
.quantity_files dd ?
|
||||
rb 20
|
32
programs/develop/libraries/fontslib/trunk/readme.txt
Normal file
32
programs/develop/libraries/fontslib/trunk/readme.txt
Normal file
@ -0,0 +1,32 @@
|
||||
; 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.
|
||||
;*****************************************************************************
|
||||
|
||||
Ïðîñòàÿ áèáëèîòåêà øðèôòîâ.
|
||||
Àëüôà âåðñèÿ 0.00002 Àâòîð Òåïëîâ Àëåêñåé. <Lrz>
|
||||
Äëÿ äåìîñòðàöèè ïðèìåðà âàì íåîáõîäèìî ñäåëàòü ñëåäóþùåå:
|
||||
1) ïîìåñòèòü áèáëèîòåêà fonts_lib.obj â äèððåêòîðèþ ñ ïðèìåðîì font_ex.kex èëè ëó÷øå áóäåò ïîìåñòèòü áèáëèîòåêó â /sys/lib
|
||||
2) ñêîïèðîâàòü ôàéë font01.ksf â äèððåêòîðèþ /sys/FONTS ïðè÷åì èìÿ ôàéëà ìîæåò áûòü ëþáîå îáÿçàòåëüíî òîëüêî ðàñøèðåíèå *.ksf
|
||||
3) ñ ëþáîãî ìåñòà ìîæíî çàïóñêàòü ïðèìåð font_ex.kex
|
Loading…
Reference in New Issue
Block a user