Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 30 → Rev 31

/programs/bgitest/trunk/FONTS/EURO.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/GOTH.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/LCOM.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/LITT.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/SANS.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/SCRI.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/SIMP.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/SMAL.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/TRIP.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/TSCR.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/bgifont.inc
0,0 → 1,691
; BGIFONT.INC v1.0 beta
;
; Written in pure assembler by Ivushkin Andrey aka Willow
;
; Created: December 16, 2004
;
; Last changed: February 2, 2005
;
; Compile with FASM
 
; BGI constants
BGI_NODRAW equ 0x10000
BGI_ITALIC equ 0x20000
BGI_BOLD equ 0x40000
BGI_HALEFT equ 0x0
BGI_HARIGHT equ 0x1000
BGI_HACENTER equ 0x2000
BGI_VABOTTOM equ 0x0
BGI_VATOP equ 0x4000
BGI_VACENTER equ 0x8000
 
BGI_FREE equ 0x80000000
BGI_HAMASK equ 0x3000
BGI_VAMASK equ 0xc000
 
; Freetext structure
struc BGIfree FontName,XY,Angle,ScaleX,ScaleY,StrPtr,StrLen,Color,Align
{
dd FontName ;0
dd XY ;4
dd Angle ;8
dd ScaleX ;12
dd ScaleY ;16
dd StrPtr ;20
dd StrLen ;24
dd Color ;28
dd Align ;32
}
 
; font options structure
struc BGIrec FontName,CharsCount,FirstChar,UpperMargin,LowerMargin,\
Widths,FirstData,EOF,font_data
{
.FontName dd ? ; 0
.CharsCount db ? ; 4
.FirstChar db ? ; 5
.UpperMargin db ? ; 6
.LowerMargin db ? ; 7
.Widths dd ? ; 8
.FirstData dd ? ; 12
.EOF dd ? ; 16
.font_data dd ? ; 20 follows (Offsets)
}
 
macro BGIfont_GetID
{
call _BGIfont_GetID
}
 
macro BGIfont_Prepare
{
call _BGIfont_Prepare
}
 
macro BGIfont_Freetext
{
call _BGIfont_Freetext
}
 
macro BGIfont_Outtext
{
call _BGIfont_Outtext
}
 
macro _FI name,_size
{
db name
if BGI_LEVEL eq KERNEL
dw _size
end if
}
 
BGIfont_names:
_FI 'LCOM',11485 ;7
_FI 'EURO',8117 ;5
_FI 'GOTH',13816 ;6
_FI 'LITT',3596 ;8
_FI 'TRIP',11932 ;14
_FI 'SCRI',8490 ;11
_FI 'SMAL',4162 ;13
_FI 'TSCR',12134 ;15
_FI 'SANS',8453 ;10
_FI 'SIMP',9522 ;12
BGIfont_names_end:
 
macro BGIfont_Init
{
; in: ecx - number of fonts to load;
; esi-> _FI structure
; edi-> where to load
push edi
if BGI_LEVEL eq KERNEL
mov edi,0x40000
end if
.nfont:
mov edx,[esi]
if BGI_LEVEL eq KERNEL
movzx ebx,word[esi+4]
mov [BGIfont_Prepare.okflag],'N'
end if
call _BGIfont_Prepare
if ~ BGI_LEVEL eq KERNEL
add esi,4
else
push esi
test eax,eax
jz .fail
mov [BGIfont_Prepare.okflag],'*'
.fail:
mov esi,BGIfont_Prepare.font
call boot_log
pop esi
add esi,6
end if
loop .nfont
dph2 _BGI_BOLD,300,550
; movzx edi,byte[0x40000]
pop edi
}
 
BGIfont_get2head:
shr ecx,28 ; font #
sub ecx,4
jb .exit2 ; invalid #
mov edi,[BGIfont_Ptr]
inc edi
cmp cl,[edi-1]
jae .exit2 ; # too large
jecxz .ex
.fnext:
mov edi,[edi+16]
loop .fnext
jmp .ex
.exit2:
xor edi,edi
.ex:
ret
 
BGIfont_GetName:
; in: ecx-fontID;
; out: edx-font name.
call BGIfont_get2head
xor edx,edx
test edi,edi
jz .ex
mov edx,[edi]
.ex:
ret
 
macro dps2 _str
{
if ~ BGI_LEVEL eq KERNEL
if LOAD_MSG eq 1
dps _str
end if
else
pusha
mov esi,BGIfont_Prepare.okflag
mov byte[esi], _str
call boot_log
popa
end if
}
 
macro dph2 num,x,y
{
if BGI_LEVEL eq KERNEL
pusha
mov eax,0x00080100
mov ebx,num
mov ecx,x shl 16+y
mov edx,0xFF0000
call display_number
popa
end if
}
 
_BGIfont_GetID:
; in: edx-font name;
; out: eax-fontID, edi->BGIrec
push ecx edi
mov edi,[BGIfont_Ptr]
movzx ecx,byte[edi] ; ecx-font count
mov eax,ecx
inc edi ; edi->FontName
jecxz .ex
.fnext:
cmp edx,[edi]
jne .floop
sub eax,ecx
add eax,4
shl eax,28
jmp .ex
.floop:
mov edi,[edi+16]
loop .fnext
.num0:
xor eax,eax
.ex:
pop edi ecx
ret
 
_BGIfont_Prepare:
; in: edx-font name, edi->pointer to load fonts (fonts_count)
; out: eax-ID of new font loaded; eax=0 error
cmp [BGIfont_Ptr],0
jne .already
mov [BGIfont_Ptr],edi
.already:
pusha
mov edi,[BGIfont_Ptr]
movzx ecx,byte[edi] ; ecx-font count
mov eax,ecx
inc edi ; edi->FontName
jecxz .fload
.fnext:
cmp edx,[edi]
jne .loop
sub eax,ecx
inc eax
jmp .cr_id
.loop:
mov edi,[edi+16]
loop .fnext
.fload:
mov dword[.font],edx ; filename
mov esi,edi ; esi->FontName
mov [.dest],edi ; ptr to load font
if ~ BGI_LEVEL eq KERNEL
mov [.fsize],1
mov eax,58
mov ebx,.fontinfo
int 0x40
test eax,eax
jnz .fail
dps2 '1'
shr ebx,9
inc ebx
mov [.fsize],ebx
mov ebx,.fontinfo
mov eax,58
int 0x40 ; ebx - file size
else
push edi esi edx
mov eax,.font
xor ebx,ebx
mov esi,12
mov ecx,ebx
mov edx,edi
call fileread
pop edx esi edi
mov ebp,edi
add ebp,ebx
cmp ebp,0x50000
ja .fail
end if
cmp dword[edi],0x08084b50 ; 'PK',8,8
jne .fail
dps2 '2'
inc edi
mov eax,26 ; #EOF
mov ecx,253
cld
repne scasb ; skip Copyright
test ecx,ecx
jz .fail
dps2 '3'
cmp edx,[edi+2] ; FontName
jne .fail
dps2 '4'
movzx ecx,word[edi] ; HeaderSize
sub ebx,ecx ; Filesize-Headersize
movzx eax,word[edi+6] ; FontSize
cmp eax,ebx
jb .fail ; file truncated
add ecx,[.dest]
dps2 '5'
cmp byte[ecx],'+' ; ParPrefix
jne .fail
; font is valid, let's fill parameter table
dps2 '>'
mov [esi],edx ; FontName
mov edx,eax
add eax,ecx
mov [esi+16],eax ; Font EOF
movzx eax,word[ecx+5]
add eax,ecx
mov [esi+12],eax
lea edi,[esi+4] ; edi->CharsCount
lea esi,[ecx+1] ; esi->ParPrefix+1
xor eax,eax
lodsw
stosb ; CharsCount
inc esi
movsb ; FirstChar
add esi,3
lodsw
stosb ; UpperMargin
movsb ; LowerMargin
add esi,5 ; esi->offsets
mov eax,[esi]
push edi ; edi->Widths
; prepare moving data
add edi,12 ; edi->offsets
lea ecx,[edx-16]
rep movsb
pop edi ; edi->Widths
mov [edi+8],esi ; EOF
; mov eax,[edi]
movzx ecx,byte[edi-4] ; CharsCount
lea eax,[edi+12+ecx*2] ; eax->widths
stosd ; edi->FirstData
add eax,ecx
stosd ; edi->EOF
mov eax,[esp] ; eax->fonts_count
inc byte[eax] ; increase font counter
movzx eax,byte[eax]
.cr_id:
add eax,0x3 ; create unique ID
shl eax,28 ; to easy use in color(ecx)
jmp .exit
.fail:
xor eax,eax
.exit:
mov [esp+28],eax
popa
ret
 
if ~ BGI_LEVEL eq KERNEL
.fontinfo:
dd 0
dd 0
.fsize dd 0
.dest dd 0
dd 0x10000
db BGIFONT_PATH
.font db 'FONT.CHR',0
else
.dest dd 0
.font db 'FONT CHR'
.okflag db ' ',0
end if
 
BGIfont_Coo:
; y->word[txt.y1], x->word[txt.x1]
fild [txt.y1] ;y
fmul st0,st0; y*y
fild [txt.x1] ;x
fmul st0,st0; x*x
faddp ; x*x+y*y
fsqrt ; sqrt, angle
fild [txt.y1];y
fabs
fild [txt.x1] ; x
fabs
fpatan ; arctg(y/x)
.skip:
cmp [txt.x1],0
jge .xplus
fchs
fadd st0,st3
.xplus:
cmp [txt.y1],0
jge .yplus
fchs
.yplus:
fadd st0,st2
fsincos
fmul st0,st2
fiadd [txt.x0]
fistp [txt.x1] ; x=r*cos a
fmulp ; y=r*sin a,angle
fiadd [txt.y0]
fistp [txt.y1]
ret
 
_BGIfont_Freetext:
; in: ebx-BGIfree structure
; out: eax-new drawing coords
mov edx,[ebx]
call _BGIfont_GetID
test eax,eax
jnz .fexists
ret
.fexists:
pusha
fninit
fldpi
fld [pi180]
fimul dword[ebx+8]
fst [BGIangle]
mov esi,[ebx+28]
and esi,0xffffff
add esi,eax
mov eax,[ebx+32]
and [deform],0
test eax,BGI_ITALIC
jz .norm
mov [deform],0.4
.norm:
mov ebp,eax
or ebp,BGI_FREE
mov eax,[ebx+12]
mov [Xscale],eax
mov eax,[ebx+16]
mov [Yscale],eax
mov ecx,[ebx+20]
mov edx,ebp
and edx,BGI_FREE+BGI_VAMASK+BGI_HAMASK
add edx,[ebx+24]
mov eax,[ebx+4]
mov ebx,esi
add ebx,0x6000000
mov [esp+4],edx
mov [esp+20],ecx
jmp txt
 
pi180 dd 0.017453
 
_BGIfont_Outtext:
; in: ebx-[x][y], ecx-color, edx-string, esi-length
pusha
mov ebp,esi
if ~ BGI_LEVEL eq KERNEL
mov eax,ebx
mov ebx,ecx
mov ecx,edx
mov edx,esi
end if
; in: eax-[x][y], ebx-color, ecx-string, edx-length
txt:
if ~ BGI_LEVEL eq KERNEL
if BGI_WINDOW_CLIP eq 1
pusha
mov eax,9
mov ebx,BGI_PRC_INFO
mov ecx,-1
int 0x40
popa
end if
end if
mov [.y0],ax
shr eax,16
mov [.x0],ax
mov ecx,ebx ; color
and ebx,0xfffffff
mov [.color],ebx
call BGIfont_get2head
test edi,edi
jz .exit
mov ecx,[esp+4]; str length
mov esi,[esp+20]; str ptr
movzx eax,byte[edi+5]
push ecx
and ecx,0xff
jnz .lenok
add esp,4
jmp .ex2
.lenok:
pusha
push dword[txt.y0]
and dword[txt.y0],0
xor edx,edx
mov ebx,[edi+8]
.next:
call txt.BGIfont_GetChar
movzx eax,byte[ebx+eax]
add edx,eax
loop .next
mov ecx,edx ; ecx - x size
movzx dx,byte[edi+6]
mov ebx,[esp+36]
and ebx,BGI_HAMASK
cmp ebx,BGI_HARIGHT
je .nova
ja .subv
xor ecx,ecx
jmp .nova
.subv:
shr cx,1
.nova:
mov ebx,[esp+36]
and ebx,BGI_VAMASK
cmp ebx,BGI_VATOP
je .def
ja .subh
xor edx,edx
jmp .def
.subh:
shr dx,1
.def:
call txt.BGIfont_Deform
pop dword[txt.y0]
popa
pop ebx
mov ax,[txt.y1]
sub [txt.y0],ax
mov ax,[txt.x1]
sub [txt.x0],ax
xor eax,eax
cld
.mloop:
push [.y0]
pop [.y]
push [.x0]
pop [.x]
call .BGIfont_GetChar
push esi
lea esi,[edi+20] ; offset
movzx edx,word[esi+eax*2] ; ofs1
add edx,[edi+12]
inc eax
cmp al,[edi+4]
je .eof
movzx eax,word[esi+eax*2]; ofs2
add eax,[edi+12]
jmp .prc_vec
.eof:
mov eax,[edi+16] ; ofs2=eof
.prc_vec: ; edx-vec cmd ifs, eax-cmd limit
mov [.vec_end],eax
push ecx
.vec_loop:
mov ax,word[edx]
push edx
mov ecx,eax
and eax,0x8080 ; op
and ecx,0x7f ; xx
mov edx,[edx+1]
and edx,0x7f ; yy
cmp edx,63
jbe .positive
sub edx,128 ; yy-=128
.positive:
cmp ecx,63
jbe .positive2
sub ecx,128 ; xx-=128
.positive2:
call .BGIfont_Deform
cmp eax,0x8080
jne .noline
test ebp,BGI_NODRAW
jnz .noline
; draw vector
if ~ BGI_LEVEL eq KERNEL
push eax
mov ebx,dword[.x1]
mov ecx,dword[.y1]
if BGI_WINDOW_CLIP eq 1
movzx eax,[.x]
cmp eax,dword[BGI_PRC_INFO+42]
ja .nobold
movzx eax,[.y]
cmp eax,dword[BGI_PRC_INFO+46]
ja .nobold
xor eax,eax
cmp ax,bx
jg .nobold
cmp ax,cx
jg .nobold
end if
mov edx,[.color]
mov eax,38
int 0x40
test ebp,BGI_BOLD
jz .nobold
test ebp,BGI_FREE
jnz .free5
.free5:
add ebx,1 shl 16+1
int 0x40
.nobold:
pop eax
else
pusha
mov eax,dword[.x1]
mov ebx,dword[.y1]
mov ecx,[.color]
; call syscall_drawline
test dword[esp+8],BGI_BOLD
jz .nobold
add eax,1 shl 16+1
; call syscall_drawline
.nobold:
popa
end if
.noline:
pop edx
test eax,eax
je .eovecs ; op=0
push [.y1]
pop [.y]
push [.x1]
pop [.x]
add edx,2
cmp edx,[.vec_end]
jb .vec_loop
.eovecs:
pop ecx esi
push [.y]
pop [.y0]
push [.x]
pop [.x0]
loop .mloop1
jmp .exit
.mloop1:
jmp .mloop
.exit:
mov eax,dword[.y0]
mov [esp+28],eax
.ex2:
popa
ret
 
.BGIfont_Deform:
test ebp,BGI_FREE
jnz .free0
movzx ebx,byte[.color+3] ;ebx=scale
imul ecx,ebx
add ecx,2
shr ecx,2
imul edx,ebx
add edx,2
shr edx,2
neg edx
mov [.x1],cx
mov [.y1],dx
jmp .add
.free0:
mov [.x1],cx
mov [.y1],dx
fild [.y1]
fld st0
fmul [Yscale]
fchs
fistp [.y1]
fmul [deform]
fiadd [.x1]
fmul [Xscale]
fistp [.x1]
cmp [BGIangle],0
je .add
call BGIfont_Coo
jmp .eax
.add:
mov cx,[.x0]
add [.x1],cx
mov cx,[.y0]
add [.y1],cx
.eax:
ret
 
.BGIfont_GetChar:
; in: esi -> string; edi -> BGIrec
; out: esi -> next char; al - char obtained
lodsb ; al - char from str
sub al,[edi+5]
jb .out
cmp al,[edi+4]
jb .in
.out:
xor al,al ; al - 1st symbol available
.in:
ret
 
.y0 dw ?
.x0 dw ?
 
.x1 dw ?
.x dw ?
.y1 dw ?
.y dw ?
 
.color dd ?
.vec_end dd ?
BGIfont_Ptr dd 0
width dd ?
deform dd ?
BGIangle dd ?
Xscale dd ?
Yscale dd ?
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/bgitest/trunk/bgitest.asm
0,0 → 1,444
; BGI Font Test
;
; Written in pure assembler by Ivushkin Andrey aka Willow
;
; Created: December 20, 2004
;
; Last changed: February 2, 2005
;
 
BGIFONT_PATH equ '/RD/1/'
_X equ 340
_Y equ 240
 
BGI_WINDOW_CLIP equ 1
BGI_PRC_INFO equ pinfo
 
macro ListFonts
{
mov eax,lf_head
call PixelPrint
mov ebx,20 shl 16+60
mov ecx,(BGIfont_names_end-BGIfont_names)/4
mov esi,BGIfont_names
.l1:
pusha
pusha
mcall 4,,0x10777fac,esi,4
popa
mov edx,[esi]
BGIfont_GetID
mov dword[_BGIfont_Prepare.font],edx
mov ecx,eax
add ebx,140 shl 16
mov edx,ebx
mcall 47,0x80100,,,0x10ffffff
jecxz .nofont
lea ebx,[edx+80 shl 16+12]
mov edx,_BGIfont_Prepare.dest+8
mov esi,BGIfont_Coo-1
sub esi,edx
add ecx,0x3b800b8
BGIfont_Outtext
sub ebx,155 shl 16+12
mcall 4,,0x1000f000,load_ok,load_fail-load_ok
jmp .pop
.nofont:
lea ebx,[edx-80 shl 16]
mcall 4,,0x10f00010,load_fail,font_msg-load_fail
.pop:
popa
add esi,4
add ebx,39
loop .l2
jmp .ex
.l2:
jmp .l1
.ex:
}
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd START
dd I_END
dd 0x100000
dd 0x0cfff0
dd 0x0
not1strun dd 0x0
 
include 'lang.inc'
include 'macros.inc'
;include 'debug.inc'
include 'bgifont.inc'
lang equ en;ru;en
 
START:
mov [help],0
mov ecx,(BGIfont_names_end-BGIfont_names)/4
mov esi,BGIfont_names
mov edi,I_END
BGIfont_Init
reset:
mov esi,[BGIfont_Ptr]
inc esi
mov edi,freeconst
movsd
mov esi,freeconst
mov edi,freetest
mov ecx,36
rep movsb
red:
mov eax,[freetest]
mov dword[title+19],eax
call draw_window
cmp [not1strun],0
jnz still
mcall 5,300
not [not1strun]
inc [help]
jmp red
still:
 
mov eax,10
int 0x40
 
cmp eax,1
je red
cmp eax,2
je key
cmp eax,3
je button
 
jmp still
 
button:
mov eax,17
int 0x40
cmp ah,1
jnz noclose
close:
xor eax,eax
dec eax
int 0x40
noclose:
jmp still
 
key:
mov eax,2
int 0x40
shr eax,8
cmp al,27 ; esc - close
je close
cmp al,32 ; Space - help
jne .noh
inc [help]
cmp [help],3
jne red
and [help],0
jmp red
.noh:
cmp [help],2
jne still
cmp al,50
jb .noff
cmp al,57
ja .noff
sub al,46
.gn:
movzx ecx,al
shl ecx,28
call BGIfont_GetName
mov [freetest],edx
jmp red
.noff:
mov ecx,4
mov edi,Fkeys
.fkey:
cmp al,[edi]
je .fndkey
inc edi
loop .fkey
jmp .notfnd
.fndkey:
lea eax,[edi-Fkeys+0xc]
jmp .gn
.notfnd:
cmp al,114 ; r - reset
je reset
cmp al,176
jne .nol ; left
sub dword[freetest+8],5
jmp red
.nol:
cmp al,179
jne .nor ; right
add dword[freetest+8],5
jmp red
.nor:
cmp al,105 ; i -italic
jne .noi
xor dword[freetest+32],BGI_ITALIC
jmp red
.noi:
cmp al,98 ; b -bold
jne .nob
xor dword[freetest+32],BGI_BOLD
jmp red
.nob:
mov ecx,2
mov esi,ali
.ol2:
cmp al,[esi]
jne .othl2
mov ax,[freetest+32]
add ax,[esi+3]
mov bx,ax
mov dx,[esi+1]
and bx,dx
cmp bx,dx
jne .ok
not dx
and ax,dx
.ok:
mov [freetest+32],ax
jmp red
.othl2:
add esi,5
loop .ol2
.other:
mov esi,delt
mov ecx,4
.ol:
cmp al,[esi]
jne .othl
fld dword[esi+1]
movzx eax,byte[esi+5]
fadd dword[freetest+eax]
fstp dword[freetest+eax]
jmp red
.othl:
add esi,6
loop .ol
jmp still
 
draw_window:
mov eax,12
mov ebx,1
int 0x40
 
xor eax,eax
mov ebx,10*65536+_X*2
mov ecx,100*65536+_Y*2
mov edx,0x03261212
mov esi,0x805080d0
mov edi,0x005080d0
int 0x40
 
mov eax,4
mov ebx,8*65536+8
mov ecx,0x10ddeeff
mov edx,title
mov esi,title_end-title
cmp [help],2
je .int
sub esi,12
.int:
int 0x40
 
cmp [help],0
jnz .help
cmp byte[I_END],0
jnz .fontsok
mov eax,font_msg
call PixelPrint
.fontsok:
ListFonts
jmp .eod
.help:
cmp [help],1
jne .nohelp
mov eax,helptxt
cmp byte[I_END],0
jnz .fontsok2
mov word[eax+2],_X-80
call PixelPrint
jmp .eod
.fontsok2:
mov word[eax+2],_X
call Print
jmp .eod
.nohelp:
mov edi,cross
mov eax,38
mov edx,0x4b331a
mov ebx,[edi]
mov ecx,[edi+4]
int 0x40
mov ebx,[edi+8]
mov ecx,[edi+12]
int 0x40
mov ebx,freetest
BGIfont_Freetext
.eod:
mov eax,12
mov ebx,2
int 0x40
ret
 
Print: ; eax-pointer to _txt struc
pusha
mov ebx,[eax]
movzx ecx,byte[eax+12]
lea edx,[eax+13]
mov edi,eax
.nextstr:
mov esi,[edx]
add edx,4
push ecx
mov ecx,[edi+8]
BGIfont_Outtext
add ebx,[edi+4]
pop ecx
and esi,0xfff
add edx,esi
loop .nextstr
popa
ret
 
PixelPrint: ; eax-pointer to _txt struc, but used differently
pusha
mov ebp,eax
mov ebx,[ebp]
movzx ecx,byte[ebp+12]
mov eax,4
lea edx,[ebp+17]
.l:
mov esi,[edx-4]
and esi,0xfff
push ecx
mov ecx,[ebp+8]
int 0x40
pop ecx
lea edx,[esi+edx+4]
add ebx,[ebp+4]
loop .l
popa
ret
 
macro _txt _xy,_vert,_color,_opt,[_str]
{
common
_counter=0
forward
_counter=_counter+1
common
dd _xy ; 0
dd _vert ; 4
dd _color ; 8
db _counter ;_str_count ; 12
forward
local .str_beg,.str_end
dd (.str_end-.str_beg) or _opt ; 13
.str_beg:
db _str ;17
.str_end:
}
 
title db 'BGIFONT.INC demo - FONT font'
title_end:
_M equ 30
cross dd _M shl 16+_X*2-_M,_Y shl 16+_Y,_X shl 16+_X,_M shl 16+_Y*2-_M
helptxt:
if lang eq ru
_txt _X shl 16+60,40,0x434ba010,BGI_HACENTER,\
"ƒŽŸ—ˆ… Š‹€‚ˆ˜ˆ:",\
"à®¡¥« - èà¨äâë/íâ®â ⥪áâ/¤¥¬ª ;",\
"<-> áâ५ª¨ - ¢à é¥­¨¥ áâப¨;",\
"V - ¢ëà ¢­¨¢ ­¨¥ ¯® ¢¥à⨪ «¨;",\
"H - ¢ëà ¢­¨¢ ­¨¥ ¯® £®à¨§®­â «¨;",\
"[,] - ¬ áèâ ¡ ¯® ®á¨ X;",\
"A,Z - ¬ áèâ ¡ ¯® ®á¨ Y;",\
"B,I - ¯®«ã¦¨à­ë© èà¨äâ ¨ ªãàᨢ;",\
"R - á¡à®á ¯ à ¬¥â஢ èà¨äâ ;",\
"F1..F12 - ¢ë¡®à èà¨äâ ;",\
"Esc - § ªàëâì ¯à®£ã :-("
alpha:
db "‚®â ¯à¨¬¥à ⥪áâ !"
lf_head:
_txt 10 shl 16+30,85 shl 16,0x6e00f7,0,"ˆ¬ï èà¨äâ ","‘â âãá","ID",\
"ãâì ª ä ©«ã"
load_ok:
db "§ £à㦥­"
load_fail:
db "­¥ ­ ©¤¥­"
font_msg:
_txt (_X+20) shl 16+180,25,0x10ff0000,0,\
"Š ᮦ «¥­¨î, ­¥ ­ ©¤¥­® ­¨ ®¤­®£®",\
"¢¥ªâ®à­®£® èà¨äâ  *.CHR. ‚®§¬®¦­®,",\
"¢ ¬ á«¥¤ã¥â ¨á¯à ¢¨âì ª®­áâ ­âã",\
"BGIFONT_PATH ¢ ­ ç «¥ ä ©«  BGITEST.ASM",\
"¨ ¯¥à¥ª®¬¯¨«¨à®¢ âì ¥£® :-("
else
_txt _X shl 16+60,40,0x434ba010, BGI_HACENTER,\
"HOT KEYS:",\
"Space - font list/this message/demo;",\
"<-> arrows - rotate text string;",\
"V - toggle vertical alignment;",\
"H - toggle horizontal alignment;",\
"[,] - scale on X axis;",\
"A,Z - scale on Y axis;",\
"B,I - toggle bold & italic mode;",\
"R - reset font options;",\
"F1..F12 - select font;",\
"Esc - close demo :-("
alpha:
db 'This is a Sample text!'
; db 'ABCDEFGHIGKLMNOPQRSTUVWXWZ'
lf_head:
_txt 10 shl 16+30,85 shl 16,0x6e00f7,0,"Font name","Status","ID",\
"Filename"
load_ok:
db "loaded"
load_fail:
db "not found"
font_msg:
_txt (_X+20) shl 16+180,25,0x10ff0000,0,\
"Sorry, no vector font *.CHR found.",\
"Maybe you should correct BGIFONT_PATH",\
"constant at the beginning of file",\
"BGITEST.ASM and recompile it :-("
end if
 
macro Deltas _key,_scale,_ofs
{
db _key
dd _scale
db _ofs
}
 
delt:
Deltas 91, -0.15,12
Deltas 93, 0.15,12
Deltas 97, 0.15,16
Deltas 122,-0.15,16
Fkeys db 48,49,68,255
 
macro Aligns _key,_mask,_add
{
db _key
dw _mask,_add
}
ali:
Aligns 118,BGI_VAMASK,BGI_VATOP
Aligns 104,BGI_HAMASK,BGI_HARIGHT
freeconst BGIfree 'FONT',_X shl 16+_Y,0, 1.0, 1.0, alpha,\
lf_head-alpha,0xb800e7,\
BGI_VACENTER or BGI_HACENTER
freetest BGIfree ?,?,?,?,?,?,?,?,?
help db ?
pinfo:
times 1024 db ?
rb 10000 ; reserve, unless process info will corrupt our fonts (why?)
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/bgitest/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm bgitest.asm bgitest
@pause
/programs/bgitest/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm bgitest.asm bgitest
@pause
/programs/bgitest/trunk/macros.inc
0,0 → 1,267
; 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)
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
rb (1024-52)
}
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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/bgitest/trunk/read_eng.txt
0,0 → 1,140
BGIFONT.INC v1.0 beta
 
Written in pure assembler by Ivushkin Andrey aka Willow
 
At present Menuet operation system has poor means to draw charaters. Its
distro contains 2 raster fonts (CHAR.MT & CHAR2.MT files). The kernel supports
them internally. That is Jarek Pelczar who makes certain efforts to develop
scalable TTF-like fonts but huge Menuet C Library does not become widespread
inside our assembly-written OS. Bulgarian MenuetOS team also tries to include
third scalable font into the kernel, though, as far as I know, its characters
are still under design and are incomplete. Therefore Bulgarian developing is
not valuable for ordinary users. It is obvious that scalable fonts will help
to develop such products as browsers and word processors where character
formatting is of great importance.
Let me introduce for public domain an include file BGIFONT.INC to process
vector fonts (*.CHR) worked out by famous Borland Corporation to use in Turbo
Pascal, Turbo C and Borland C++ compilers under MS-DOS. Sorry, I still fail to
add BGI font support into kernel - deeper knowledge on memory allocation and
system calls needed. I hope that Menuet system programmers will be glad to help
me. Module compiling within kernel is supposed using constant BGI_LEVEL equ
KERNEL. By means of conditional compiling it will be possible to use the module
at both kernel and application levels. Following is concerned using the include
file while programming an application.
 
BGI fonts may reside in any folder on HD or RD. They are searched using value
of constant BGI_PATH. If constant BGI_WINDOW_CLIP is equal to 1, module routines
perform window bounds check to avoid artifacts while drawing. Use this if you
aren't sure that strings are fit in window. All BGIFONT.INC routines are
declared as macros, that is they are used without "call". To load 11 fonts into
application's memory a contiguous free space up to 120 kb is needed. When
loading, font data relocation is performed to save memory. Let us see a chart:
 
| Font | | BGIrec | | Font | | BGIrec | | Font | | BGIrec |
| counter | | structure| | data | | structure| | data | | structure| ...
| (1 byte)| | | | | |
| ------------->------ -------------->----- ----------
- referenced by [BGIfont_Ptr]
 
BGIrec structure fields have following meaning:
 
+00 dword .FontName font name (4 characters)
+04 byte .CharsCount amount of font characters
+05 byte .FirstChar code of the first character present
+06 byte .UpperMargin high bound of characters
+07 byte .LowerMargin low bound of characters
+08 dword .Widths offset to width array
+12 dword .FirstData offset to vector table
+16 dword .EOF pointer to the following BGIrec
+20 dword .font_data here font data begin
 
Font loading and verification are carried out by BGIfont_Prepare procedure.
 
BGIfont_Prepare
in: EDX - font name (4 characters) to be loaded. It must to be the same as
the font filename (without extension)
EDI - address to where font have to be loaded. Used only for the
first time. Then you may find this value in [BGIfont_Ptr]
out: EAX=0, if an error occured, otherwise EAX is identifier (ID) of the
loaded font. Later it is possible to get font ID with BGIfont_GetID
function.
 
For the simultaneous loading of few fonts you may use BGIfont_Init routine.
 
BGIfont_Init
in: ESI - pointer to array of font names (for example db 'TRIPSIMPEURO')
ECX is amount of fonts to load
EDI - see BGIfont_Prepare
out: nothing.
 
To load 10 standard fonts the module defines an array BGIfont_names (see in
BGITEST for usage demonstration).
 
For compatibility and subsequent kernel introduction, the module offers 2
routines for drawing vector characters. One of them uses registers (like sysfunc
4), another uses a structure.
 
BGIfont_Outtext
in: EAX - "pivot point" of a string [x] shl 16+[y]
ECX - text color and font size 0xXYRRGGBB,
where X - vector font ID(4..F),
Y - size of caracters divided by 4, e.g. 0x1 - 1/4 of
ordinary size, 0xC - triple size.
EDX - pointer to the string
ESI - string length + formatting flags (see below). BGI_ITALIC and
BGI_NODRAW flags are ignored.
out: EAX - coords at the end of the string drawn [x] shl 16+[y].
 
As you can see, BGIfont_Outtext is similar to the 4th system function,
but provides an extended management of drawing symbols.
 
The most complete use of vector fonts is provided by BGIfont_Freetext routine.
Parameters are passed in a BGIfree structure.
 
BGIfree structure fields have following meaning:
 
+00 dword font name (4 characters)
+04 dword "pivot point" of a string [x] shl 16+[y]
+08 dword turn angle (clockwise, 0 is horizontal)
+12 dword X scale (floating point value!)
+16 dword Y scale (floating point value!)
+20 dword pointer to the string
+24 dword string length WITHOUT formatting flags
+28 dword text color 0x00RRGGBB
+32 dword formatting flags
 
The module defines following formatting flags:
BGI_NODRAW - do not draw
BGI_ITALIC - italic
BGI_BOLD - bold
BGI_HALEFT - left alignment
BGI_HARIGHT - right alignment
BGI_HACENTER - center alignment
BGI_VABOTTOM - bottom alignment
BGI_VATOP - top alignment
BGI_VACENTER - middle vertical alignment
 
Combination of flags can be performed by addition or the OR operation.
 
BGIfont_Freetext
in: EBX - pointer to BGIfree structure
out: EAX coords at the end of the string drawn [x] shl 16+[y].
 
BGIfont_GetID routine returns font ID by its name.
 
BGIfont_GetID
in: EDX - font name (4 characters)
out: EAX - ID of the font
EDI - pointer on font's BGIrec structure.
 
Using functions of BGIFONT.INC module is demonstrated by BGITEST app.
 
Todo list:
1. An insidious bug sometimes shows up while loading multiple fonts (as in
BGITEST), that corrupts some characters. It disappears when font loading
order is changed... :-(
2. To correct a hardly reproduceable bug when moving along the font list.
3. To perfect drawing of bold fonts.
4. To add number drawing routines.
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/bgitest/trunk/read_rus.txt
0,0 → 1,149
BGIFONT.INC v1.0 beta for MenuetOS
Œ®¤ã«ì ¤«ï à ¡®âë á ¢¥ªâ®à­ë¬¨ èà¨äâ ¬¨ ä®à¬ â  BGI
 
 ¯¨á ­ ­  ç¨á⮬  áᥬ¡«¥à¥ ˆ¢ã誨­ë¬ €­¤à¥¥¬ aka Willow
 
‚ ­ áâ®ï饥 ¢à¥¬ï ®¯¥à æ¨®­­ ï á¨á⥬  Menuet ®¡« ¤ ¥â áªã¤­ë¬¨ á।á⢠¬¨
®â®¡à ¦¥­¨ï ᨬ¢®«®¢. ‚ ¤¨áâਡã⨢¥ ¨¬¥îâáï 2 à áâ஢ëå èà¨äâ  (ä ©«ë CHAR.MT ¨
CHAR2.MT).  ¡®â  á ­¨¬¨ ¦¥á⪮ § è¨â  ¢ ï¤à¥. Ž¯à¥¤¥«¥­­ë¥ ãᨫ¨ï ¯® ¢­¥¤à¥­¨î
¬ áèâ ¡¨à㥬ëå èà¨ä⮢ TTF-¯®¤®¡­®£® ä®à¬ â  ¯à¥¤¯à¨­¨¬ ¥â Jarek Pelczar, ®¤­ ª®
£à®¬®§¤ª ï MenuetOS C Library ­¥ ¯®«ã稫  ¤® á¨å ¯®à ¡®«ì让 ¯®¯ã«ïà­®á⨠¢
 áᥬ¡«¥à­®© Ž‘. ®«£ à᪮© ª®¬ ­¤®© Menuet ¤¥« «¨áì ¯®¯ë⪨ ¢áâநâì ¢ ï¤à®
âà¥â¨© ¬ áèâ ¡¨àã¥¬ë© èà¨äâ, ­®, ­ áª®«ìª® ¬­¥ ¨§¢¥áâ­®, ¥£® ᨬ¢®«ë ­ å®¤ïâáï ¢
áâ ¤¨¨ ¤¨§ ©­ . ’ ª¨¬ ®¡à §®¬, ࠧࠡ®âª  ¡®«£ à ¯®ª  ­¥ ¯à¥¤áâ ¢«ï¥â 業­®áâ¨
¤«ï à冷¢ëå ¯®«ì§®¢ â¥«¥©. Žç¥¢¨¤­®, çâ® ¬ áèâ ¡¨àã¥¬ë¥ èà¨äâë ¯®¬®£ãâ
ࠧࠡ®âª¥ â ª¨å ¢ ¦­ëå ª â¥£®à¨© ¯à®£à ¬¬­ëå ¯à®¤ãªâ®¢, ª ª ¡à ã§¥àë ¨
⥪áâ®¢ë¥ ¯à®æ¥áá®àë, £¤¥ ¡®«ìèãî à®«ì ¨£à ¥â ä®à¬ â¨à®¢ ­¨¥ ᨬ¢®«®¢.
à¥¤áâ ¢«ïî ¢ ®¡é¥á⢥­­®¥ ¯®«ì§®¢ ­¨¥ ¢ª«îç ¥¬ë© ä ©« BGIFONT.INC ¤«ï à ¡®âë á
¢¥ªâ®à­ë¬¨ èà¨äâ ¬¨ *.CHR, ࠧࠡ®â ­­ë¥ §­ ¬¥­¨â®© ä¨à¬®© Borland ¤«ï
¨á¯®«ì§®¢ ­¨ï ¢ ª®¬¯¨«ïâ®à å Turbo Pascal, Turbo C ¨ Borland C++ ¥é¥ ¢ á।¥ MS-
DOS. Š ᮦ «¥­¨î, ¯®ª  çâ® ¬­¥ ­¥ 㤠¥âáï ®¡¥á¯¥ç¨âì ¯®¤¤¥à¦ªã BGI-èà¨ä⮢ ­ 
ã஢­¥ ï¤à  - ­ã¦­® £«ã¡¦¥ ¨§ãç âì ­î ­áë à á¯à¥¤¥«¥­¨ï ¯ ¬ï⨠¨ ¢ë§®¢ 
á¨á⥬­ëå ä㭪権. Ÿ ­ ¤¥îáì, çâ® á¨á⥬騪¨ Menuet á £®â®¢­®áâìî ¬­¥ ¯®¬®£ãâ.
Š®¬¯¨«ïæ¨ï ¬®¤ã«ï ¢ á®áâ ¢¥ ï¤à  ¯à¥¤¯®« £ ¥âáï á ¨á¯®«ì§®¢ ­¨¥¬ ª®­áâ ­âë
BGI_LEVEL equ KERNEL. « £®¤ àï ãá«®¢­®© ª®¬¯¨«ï樨 ¬®¤ã«ì ¬®¦­® ¡ã¤¥â
¨á¯®«ì§®¢ âì á ­¥§­ ç¨â¥«ì­ë¬¨ ¨§¬¥­¥­¨ï¬¨ ­  ã஢­¥ ª ª ï¤à , â ª ¨ ¯à¨«®¦¥­¨ï.
¨¦¥¨§«®¦¥­­®¥ ª á ¥âáï à ¡®âë ¬®¤ã«ï ­  ã஢­¥ ¯à¨«®¦¥­¨ï.
 
BGI-èà¨äâë ¬®£ãâ à á¯®« £ âìáï ¢ «î¡®¬ ª â «®£¥ HD ¨«¨ RD. ˆå ¯®¨áª
®áãé¥á⢫ï¥âáï ¯® §­ ç¥­¨î ª®­áâ ­âë BGI_PATH. …᫨ ª®­áâ ­â  BGI_WINDOW_CLIP
ãáâ ­®¢«¥­  ¢ 1, ¯à®æ¥¤ãà ¬¨ ¬®¤ã«ï ¢ ¯à®æ¥áᥠ¢ë¢®¤  ¢¥ªâ®à®¢ èà¨äâ 
®áãé¥á⢫ï¥âáï ¯à®¢¥àª  ¢ë室  §  £à ­¨æë ®ª­ , çâ®¡ë ¨§¡¥¦ âì  àâ¥ä ªâ®¢.
ˆá¯®«ì§ã©â¥ íâ®, ¥á«¨ ¢ë ­¥ 㢥७ë, çâ® ­ ¤¯¨á¨ ¡ã¤ãâ ¯®¬¥é âìáï ¢ ®ª­¥. ‚
í⮬ á«ãç ¥ ­¥®¡å®¤¨¬® ¤®¯®«­¨â¥«ì­® ®¯à¥¤¥«¨âì ª®­áâ ­âã BGI_PRC_INFO -  ¤à¥á
¢ ¯ ¬ï⨠(1024 ¡ ©â ), ªã¤  ¯à¨«®¦¥­¨¥ ¬®¦¥â ¯®«ãç âì ¨­ä®à¬ æ¨î ® ᢮¥¬ ®ª­¥
ç¥à¥§ 9-î á¨á⥬­ãî äã­ªæ¨î. ‚ᥠ¯à®æ¥¤ãàë ¬®¤ã«ï BGIFONT.INC ®¡ê¥­ë ª ª
¬ ªà®áë, â.¥. ¢ë§ë¢ îâáï ¡¥§ call. „«ï § £à㧪¨ 11 èà¨ä⮢ ¢  ¤à¥á­®¥
¯à®áâà ­á⢮ ¯à¨«®¦¥­¨ï ­¥®¡å®¤¨¬ ­¥¯à¥àë¢­ë© ãç á⮪ à §¬¥à®¬ ®ª®«® 120 ª¡.
à¨ § £à㧪¥ ®áãé¥á⢫ï¥âáï ¯¥à¥¬¥é¥­¨¥ ¤ ­­ëå á 楫ìî íª®­®¬¨¨ ¯ ¬ïâ¨. ‘奬 
à §¬¥é¥­¨ï èà¨ä⮢:
 
| ‘ç¥â稪 | | ‘âàãªâãà | |„ ­­ë¥| |‘âàãªâãà | | „ ­­ë¥| |‘âàãªâãà |
| èà¨ä⮢ | | BGIrec | |èà¨äâ | | BGIrec | | èà¨äâ | | BGIrec | ...
| (1 ¡ ©â)| | | | | |
| ------------->------ -------------->----- ----------
- á ááë« ¥âáï [BGIfont_Ptr]
 
®«ï áâàãªâãàë BGIrec ¨¬¥îâ á«¥¤ãî饥 ­ §­ ç¥­¨¥:
 
+00 dword .FontName ç¥âëà¥å¡ãª¢¥­­®¥ ¨¬ï èà¨äâ 
+04 byte .CharsCount ª®«¨ç¥á⢮ ᨬ¢®«®¢ ¢ èà¨äâ¥
+05 byte .FirstChar ª®¤ ¯¥à¢®£® ॠ«¨§®¢ ­­®£® ᨬ¢®« 
+06 byte .UpperMargin ¢¥àå­ïï £à ­¨æ  ᨬ¢®« 
+07 byte .LowerMargin ­¨¦­ïï £à ­¨æ  ᨬ¢®« 
+08 dword .Widths ᬥ饭¨¥ ¬ áᨢ  è¨à¨­ ᨬ¢®«®¢
+12 dword .FirstData ᬥ饭¨¥ â ¡«¨æë ¢¥ªâ®à®¢
+16 dword .EOF 㪠§ â¥«ì ­  á«¥¤ãî騩 BGIrec
+20 dword .font_data §¤¥áì ­ ç¨­ îâáï ¤ ­­ë¥ èà¨äâ 
 
‘®¡á⢥­­® § £à㧪㠨 ¢¥à¨ä¨ª æ¨î èà¨äâ  ®áãé¥á⢫ï¥â ¯à®æ¥¤ãà 
BGIfont_Prepare.
 
BGIfont_Prepare
¢å®¤: EDX - ç¥âëà¥å¡ãª¢¥­­®¥ ¨¬ï èà¨äâ , ¯®¤«¥¦ é¥£® § £à㧪¥. „®«¦­®
ᮢ¯ ¤ âì á ¨¬¥­¥¬ ä ©«  èà¨äâ  (¡¥§ à áè¨à¥­¨ï)
EDI -  ¤à¥á ãç á⪠ ¯ ¬ïâ¨, ªã¤  á«¥¤ã¥â ¯®¬¥áâ¨âì ¤ ­­ë¥ èà¨äâ .
ˆá¯®«ì§ã¥âáï ⮫쪮 ¯à¨ § £à㧪¥ ¯¥à¢®£® èà¨äâ . â® §­ ç¥­¨¥
§ ­®á¨âáï ¢ [BGIfont_Ptr]
¢ë室: EAX=0, ¥á«¨ ¯à®¨§®è«  ®è¨¡ª , ¨­ ç¥ ¢ EAX - ¨¤¥­â¨ä¨ª â®à (ID)
§ £à㦥­­®£® èà¨äâ . ‚¯®á«¥¤á⢨¨ ID ¬®¦­® ¯®«ãç¨âì äã­ªæ¨ï¬¨
BGIfont_GetID ¨ BGIfont_GetName.
 
„«ï ¥¤¨­®¢à¥¬¥­­®© § £à㧪¨ ­¥áª®«ìª¨å èà¨ä⮢ ¬®¦­® ¨á¯®«ì§®¢ âì ¯à®æ¥¤ãàã
BGIfont_Init.
 
BGIfont_Init
¢å®¤: ESI - 㪠§ â¥«ì ­  ᯨ᮪ ¨¬¥­ èà¨ä⮢ (­ ¯à¨¬¥à db 'TRIPSIMPEURO')
ECX - ª®«¨ç¥á⢮ èà¨ä⮢ ¤«ï § £à㧪¨
EDI - á¬. BGIfont_Prepare
¢ë室: ­¨ç¥£®.
 
„«ï § £à㧪¨ 10 áâ ­¤ àâ­ëå èà¨ä⮢ ¢ ¬®¤ã«¥ ®¯à¥¤¥«¥­ ¬ áᨢ BGIfont_names
(¨á¯®«ì§®¢ ­¨¥ á¬. ¢ BGITEST).
 
‚ 楫ïå ᮢ¬¥á⨬®á⨠¨ ¯®á«¥¤ãî饣® ¢­¥¤à¥­¨ï ¢ ï¤à® ¬®¤ã«ì ¯à¥¤« £ ¥â 2
¯à®æ¥¤ãàë ¤«ï ¢ë¢®¤  ᨬ¢®«®¢ ¢¥ªâ®à­ë¬¨ èà¨äâ ¬¨. Ž¤­  ¨§ ­¨å ¨á¯®«ì§ã¥â
ॣ¨áâàë (¯®¤®¡­® 4-© á¨á⥬­®© ä㭪樨), ¤à㣠ï - áâàãªâãàã.
 
BGIfont_Outtext
¢å®¤: EAX - "â®çª  ®âáç¥â " ¯à¨ ¢ë¢®¤¥ áâப¨ [x] shl 16+[y]
ECX - 梥â ⥪áâ  ¨ à §¬¥à èà¨äâ  0xXYRRGGBB,
£¤¥ X - ID ¢¥ªâ®à­®£® èà¨äâ  (4..F),
Y - ¢¥«¨ç¨­  ᨬ¢®«®¢/4, ­ ¯à¨¬¥à 0x1 - 1/4 ®¡ëç­®£® à §¬¥à ,
0xC - âன­®© à §¬¥à.
EDX - 㪠§ â¥«ì ­  áâபã
ESI - ¤«¨­  áâப¨ + ä« £¨ ä®à¬ â¨à®¢ ­¨ï (á¬. ­¨¦¥). ”« £¨
BGI_ITALIC ¨ BGI_NODRAW ¨£­®à¨àãîâáï.
¢ë室: EAX - ª®®à¤¨­ âë ª®­æ  ­ ¤¯¨á¨ [x] shl 16+[y].
 
Š ª ¢¨¤¨¬, BGIfont_Outtext ¯® ᢮¨¬ ¯ à ¬¥âà ¬ á宦  á 4-© á¨á⥬­®© ä㭪樥©,
­® ¤®¯ã᪠¥â à áè¨à¥­­®¥ ã¯à ¢«¥­¨¥ ¢ë¢®¤®¬ ᨬ¢®«®¢.
 
 ¨¡®«¥¥ ¯®«­®¥ ¨á¯®«ì§®¢ ­¨¥ ¢¥ªâ®à­ëå èà¨ä⮢ ®¡¥á¯¥ç¨¢ ¥â äã­ªæ¨ï
BGIfont_Freetext.  à ¬¥âàë ¢ë¢®¤  áâப¨ ¯¥à¥¤ îâáï ¢ áâàãªâãॠBGIfree.
 
®«ï áâàãªâãàë BGIfree ¨¬¥îâ á«¥¤ãî饥 ­ §­ ç¥­¨¥:
 
+00 dword ç¥âëà¥å¡ãª¢¥­­®¥ ¨¬ï èà¨äâ 
+04 dword "â®çª  ®âáç¥â " ¯à¨ ¢ë¢®¤¥ áâப¨ [x] shl 16+[y]
+08 dword 㣮« ¯®¢®à®â  (0 - £®à¨§®­â «ì, ®âáç¥â ¯® ç á®¢®© áâ५ª¥)
+12 dword ¬ áèâ ¡ ¯® ®á¨ X (§­ ç¥­¨¥ á ¯« ¢ î饩 â®çª®©!)
+16 dword ¬ áèâ ¡ ¯® ®á¨ Y (§­ ç¥­¨¥ á ¯« ¢ î饩 â®çª®©!)
+20 dword 㪠§ â¥«ì ­  áâபã
+24 dword ¤«¨­  áâப¨ …‡ ä« £®¢ ä®à¬ â¨à®¢ ­¨ï
+28 dword 梥â ⥪áâ  0x00RRGGBB
+32 dword ä« £¨ ä®à¬ â¨à®¢ ­¨ï
 
Œ®¤ã«ì ®¯à¥¤¥«ï¥â á«¥¤ãî騥 ä« £¨ ä®à¬ â¨à®¢ ­¨ï:
BGI_NODRAW - ­¥ à¨á®¢ âì ᨬ¢®«ë
BGI_ITALIC - ªãàᨢ
BGI_BOLD - ¯®«ã¦¨à­ë© èà¨äâ
BGI_HALEFT - ¢ë஢­ïâì ¯® «¥¢®¬ã ªà î
BGI_HARIGHT - ¢ë஢­ïâì ¯® ¯à ¢®¬ã ªà î
BGI_HACENTER - ¢ë஢­ïâì ¯® 業âàã
BGI_VABOTTOM - ¢ë஢­ïâì ¯® ­¨¦­¥¬ã ªà î
BGI_VATOP - ¢ë஢­ïâì ¯® ¢¥àå­¥¬ã ªà î
BGI_VACENTER - ¢ë஢­ïâì ¯® á¥à¥¤¨­¥
 
Š®¬¡¨­ æ¨ï ä« £®¢ ®¡à §ã¥âáï ¨å á«®¦¥­¨¥¬ ¨«¨ ®¯¥à æ¨¥© OR.
 
BGIfont_Freetext
¢å®¤: EBX - 㪠§ â¥«ì ­  áâàãªâãàã BGIfree
¢ë室: EAX - ª®®à¤¨­ âë ª®­æ  ­ ¤¯¨á¨ [x] shl 16+[y].
 
”ã­ªæ¨ï BGIfont_GetID ¢®§¢à é ¥â ID èà¨äâ  ¯® § ¤ ­­®¬ã ¨¬¥­¨.
 
BGIfont_GetID
¢å®¤: EDX - ç¥âëà¥å¡ãª¢¥­­®¥ ¨¬ï èà¨äâ 
¢ë室: EAX - ID èà¨äâ 
EDI - 㪠§ â¥«ì ­  BGIrec èà¨äâ .
 
ˆá¯®«ì§®¢ ­¨¥ ä㭪権 ¬®¤ã«ï BGIFONT.INC ¤¥¬®­áâà¨àã¥â ¯à®£à ¬¬  BGITEST.
 
—â® ¥é¥ ­ã¦­® ᤥ« âì:
1. à¨ ¬­®¦¥á⢥­­®© § £à㧪¥ èà¨ä⮢ (ª ª ¢ BGITEST) ¨­®£¤  ¯à®ï¢«ï¥âáï
ª®¢ à­ë© ¡ £, ¯®àâï騩 ­¥áª®«ìª® ᨬ¢®«®¢. à¨ ¨§¬¥­¥­¨¨ ¯®à浪  § £à㧪¨
èà¨ä⮢ ®­ ¨á祧 ¥â... :-(
2. ˆá¯à ¢¨âì âà㤮¢®á¯à®¨§¢®¤¨¬ë© ¡ £ ¯à¨ ¤¢¨¦¥­¨¨ ¯® ᯨáªã èà¨ä⮢.
3. “ᮢ¥à襭á⢮¢ âì ¯à®à¨á®¢ªã ¯®«ã¦¨à­ëå èà¨ä⮢.
4. „®¡ ¢¨âì ä㭪樨 ¢ë¢®¤  ç¨á¥«.
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property