new font engine

git-svn-id: svn://kolibrios.org@2322 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Artem Jerdev (art_zh) 2011-11-29 09:40:16 +00:00
parent 9e4294fe02
commit 57c28de885
3 changed files with 73 additions and 50 deletions

View File

@ -133,7 +133,7 @@ iglobal
dd stack_driver_stat ; 52-Stack driver status dd stack_driver_stat ; 52-Stack driver status
dd cross_order ; 53-Socket interface dd cross_order ; 53-Socket interface
dd undefined_syscall ; 54-reserved dd undefined_syscall ; 54-reserved
dd sound_interface ; 55-Sound interface dd undefined_syscall ; sound_interface ; 55-Sound interface
dd undefined_syscall ; 56-reserved dd undefined_syscall ; 56-reserved
dd sys_pcibios ; 57-PCI BIOS32 dd sys_pcibios ; 57-PCI BIOS32
dd cross_order ; 58-Common file system interface dd cross_order ; 58-Common file system interface
@ -159,7 +159,7 @@ servetable3: ; Kolibri-A special service
dd sys_rdmsr ; 0 = read MSR dd sys_rdmsr ; 0 = read MSR
dd sys_map1 ; 1 = get sys data (test only) dd sys_map1 ; 1 = get sys data (test only)
dd paleholder ; 2 dd draw_char ; 2 = hew char (test)
dd paleholder ; 3 dd paleholder ; 3
dd paleholder ; 4 dd paleholder ; 4
dd paleholder ; 5 dd paleholder ; 5

View File

@ -1,4 +1,4 @@
.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
@ -131,6 +131,8 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
pop eax ; << // Alver 22.06.2008 // << pop eax ; << // Alver 22.06.2008 // <<
ret ret
diff10 "old font code size",dtext,$
;===================================================== ;=====================================================
; NEW FONTS ; NEW FONTS
;_____________________________________________________ ;_____________________________________________________
@ -139,7 +141,7 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
align 8 align 8
sdsh_data: sdsh_data:
include 'sdsh.inc' include 'fonts/sd_data.asm'
sdsh_code: sdsh_code:
@ -152,14 +154,25 @@ sdsh_code:
; then dl = single char to write ; then dl = single char to write
; else edx= pointer to asciiz-string ; else edx= pointer to asciiz-string
draw_char:
; font test
; bl=y; bh=x
; dl=ascii
movzx eax, bh
movzx ebx, bl
movzx ecx, dl
xor edi, edi
mov ebp, edi
sdsh_draw_char: sdsh_draw_char:
; eax = left side X ; eax = left side X
; ebx = bottom Y ; ebx = bottom Y
; edi = color 0x0RRGGBB ; edi = color 0x0RRGGBB
; ebp = font@ ; ebp = font@
; ecx = ascii, zero-extended to 32bits ; ecx = ascii, zero-extended to 32bits
push ecx, edx, ebp push ecx
push edx
push ebp
shl ebp, 4 shl ebp, 4
add ebp, sdsh_data.info add ebp, sdsh_data.info
call ch_checkscreen call ch_checkscreen
@ -181,7 +194,9 @@ sdsh_draw_char:
jnz .next_tick jnz .next_tick
.blank: .blank:
.exit: .exit:
pop ebp, edx, ecx pop ebp
pop edx
pop ecx
ret ret
@ -241,7 +256,8 @@ parse_tick:
cmp dl, (sdsh_data.v13-sdsh_data.v9) cmp dl, (sdsh_data.v13-sdsh_data.v9)
jae .gptick.4 jae .gptick.4
mov esi, sdsh_data.v9 mov esi, sdsh_data.v9
lea esi,[esi+edx*2+edx] ; 3-byte tickgroups .v9-12: 4 ticks each lea esi,[esi+edx*2]
add esi, edx ; 3-byte tickgroups .v9-12: 4 ticks each
mov dh, 9 mov dh, 9
shr dl, 2 shr dl, 2
add dl, dh add dl, dh
@ -357,18 +373,18 @@ draw_tick:
mov ch, dl mov ch, dl
and ch, 3 and ch, 3
jz .moved jz .moved
btc ch, 0 btc ecx, 8
jz .2 jz .2
.1: .1:
dec cl ; right turns (1 and 3) dec cl ; right turns (1 and 3)
and cl, 7 and cl, 7
@@: btc ch, 1 ; straight angle (3) ? @@: btc ecx, 9 ; straight angle (3) ?
jc .1 jc .1
jmp .moved jmp .moved
.2: .2:
inc cl ; left turn (2) inc cl ; left turn (2)
and cl, 7 and cl, 7
btc ch, 1 ; just to zero ah btc ecx, 9 ; just to zero ah
.moved: .moved:
call [.moves + ecx*4] ; go new way call [.moves + ecx*4] ; go new way
call ch_putpixel call ch_putpixel
@ -427,7 +443,8 @@ ch_checkwin:
; ebx = y coordinate ; ebx = y coordinate
; ebp -> font info ; ebp -> font info
;!destroys ch, edx! ;!destroys ch, edx!
push eax, ebx push eax
push ebx
mov ch, byte[CURRENT_TASK] mov ch, byte[CURRENT_TASK]
mov al, byte [ebp] ; char X-width mov al, byte [ebp] ; char X-width
mov edx, [_display.width] ; screen X-size mov edx, [_display.width] ; screen X-size
@ -436,10 +453,10 @@ ch_checkwin:
add edx, eax add edx, eax
cmp ch, byte [edx] cmp ch, byte [edx]
jne .fail jne .fail
moxzx eax, byte [ebp] movzx eax, byte [ebp]
cmp ch, byte [edx+eax] cmp ch, byte [edx+eax]
jne .fail jne .fail
moxzx ebx, byte [ebp+1] movzx ebx, byte [ebp+1]
imul ebx, [_display.width] imul ebx, [_display.width]
cmp ch, byte [edx+ebx] cmp ch, byte [edx+ebx]
jne .fail jne .fail
@ -450,7 +467,8 @@ ch_checkwin:
.fail: .fail:
stc ; CF means the charbox is invisible stc ; CF means the charbox is invisible
.done: .done:
pop ebx, eax pop ebx
pop eax
ret ret
align 4 align 4
@ -463,9 +481,9 @@ ch_putpixel:
imul edx, [BytesPerScanLine] imul edx, [BytesPerScanLine]
lea edx, [edx+eax*4] lea edx, [edx+eax*4]
mov [LFB_BASE+edx], edi mov [LFB_BASE+edx], edi
pop edx pop edx
ret ret
;) ;)
;diff16 "font code end ",0,$
diff10 "font code size",dtext,$ diff10 "new font code size",sdsh_code,$

View File

@ -10,17 +10,19 @@ macro gptick origin, r, tick
{ dw (origin mod 32) shl 11 + (r mod 8) shl 8 + (tick mod 256) } { dw (origin mod 32) shl 11 + (r mod 8) shl 8 + (tick mod 256) }
macro ritick x, y, tick macro ritick x, y, tick
{ dw (x mod 16) shl 12 + (y mod 32) shl 8 + (tick mod 2) } { dw (x mod 16) shl 12 + (y mod 16) shl 8 + (tick mod 2) }
macro cstick x, y, r, tick macro cstick x, y, r, tick
{ dw (x mod 16) shl 12 + (y mod 32) shl 8 + 0xC0 + (r mod 2) shl 2 + (tick mod 4) } { dw (x mod 16) shl 12 + (y mod 16) shl 8 + 0xC0 + (r mod 2) shl 2 + (tick mod 4) }
macro lntick x, y, r, len macro lntick x, y, r, len
{ if len < 8 {
dw (x mod 16) shl 12 + (y mod 32) shl 8 + (rmod 4) shl 3 + len if len in <2, 3, 4, 5, 6, 7>
else dw ((x mod 16) shl 12 + (y mod 16) shl 8 + (r mod 4) shl 3 + len)
dw (x mod 16) shl 12 + (y mod 32) shl 8 + (rmod 4) shl 3 + ((len-8) mod 8) + 0xE0 else
end if} dw ((x mod 16) shl 12 + (y mod 16) shl 8 + (r mod 4) shl 3 + ((len-8) mod 8) + 0xE0)
end if
}
;align 8 ;align 8
;sdsh_data: ;sdsh_data:
@ -28,13 +30,13 @@ dw (x mod 16) shl 12 + (y mod 32) shl 8 + (rmod 4) shl 3 + ((len-8) mod 8) + 0x
.numfonts db 2 ; number of system fonts .numfonts db 2 ; number of system fonts
.numsptks db 32 ; number of special ticks .numsptks db 32 ; number of special ticks
.numticks dw ? ; total number of ticks .numticks dw ? ; total number of ticks
.sp_ticks dd .special_ticks ; special table ;.sp_ticks dd .special_ticks ; special table
.ticktble dd .tick_table ; general table .ticktble dd .tick_table ; general table
.pix4 db 34 ;.pix4 db 34
.pix5 db 42 ;.pix5 db 42
.pix6 db 50 ;.pix6 db 50
.pix7 db 58 ;.pix7 db 58
.pix8 db 66 ;.pix8 db 66
align 4 align 4
; ---- special tickfields ---- ; ---- special tickfields ----
@ -54,18 +56,18 @@ align 16
.fnt0.tab dd .table0 ; + 4 .fnt0.tab dd .table0 ; + 4
.fnt0.org dd .origs0 ; + 8 .fnt0.org dd .origs0 ; + 8
align 16 ;align 16
; System font #1: 7x10 ;; System font #1: 7x10
.fnt1.x db 7 ; X-width ;.fnt1.x db 7 ; X-width
.fnt1.y db 9 ; Y-heigth ;.fnt1.y db 9 ; Y-heigth
.fnt1.rs dw 0 ; reserved ;.fnt1.rs dw 0 ; reserved
.fnt1.tab dd .table1 ;.fnt1.tab dd .table1
.fnt1.org dd .origs1 ;.fnt1.org dd .origs1
align 4 align 4
.origs0: .origs0:
db 0x00 ; zero db 0x00 ; zero
db 0x02 ; 1 s/7Xæëÿ db 0x02 ; 1 s/7XæëÿW
db 0x05 ; 2 6W~ç db 0x05 ; 2 6W~ç
db 0x06 ; 3 ^*Sâú db 0x06 ; 3 ^*Sâú
db 0x08 ; 4 \ÆÚ db 0x08 ; 4 \ÆÚ
@ -77,7 +79,7 @@ align 4
db 0x44 ; 10 *8B db 0x44 ; 10 *8B
db 0x03 ; 11 $ db 0x03 ; 11 $
db 0x46 ; 12 vJVgæ db 0x46 ; 12 vJVgæ
db 0x35 ; 13 5}ßì db 0x35 ; 13 5}ßìM
db 0x15 ; 14 4 db 0x15 ; 14 4
db 0x45 ; 15 9e db 0x45 ; 15 9e
db 0x16 ; 16 abphinÛ db 0x16 ; 16 abphinÛ
@ -167,7 +169,7 @@ align 4
db 0, 0 ;83: db 0, 0 ;83:
db 0, 0 ;84: db 0, 0 ;84:
db 0, 0 ;85: db 0, 0 ;85:
times 4 (db 0, 0) ;86..89 db 0, 0, 0, 0, 0, 0, 0, 0 ;86..89
.v9: .v9:
db 0, 0, 0 ;90: db 0, 0, 0 ;90:
db 0, 0, 0 ;91: db 0, 0, 0 ;91:
@ -253,6 +255,7 @@ align 4
dw (.ch0_74 -.chars)*16 + 2 ; #74 J dw (.ch0_74 -.chars)*16 + 2 ; #74 J
dw (.ch0_75 -.chars)*16 + 3 ; #75 K dw (.ch0_75 -.chars)*16 + 3 ; #75 K
dw (.ch0_76 -.chars)*16 + 2 ; #76 L dw (.ch0_76 -.chars)*16 + 2 ; #76 L
dw (.ch0_77 -.chars)*16 + 3 ; #77 M
dw (.ch0_78 -.chars)*16 + 3 ; #78 N dw (.ch0_78 -.chars)*16 + 3 ; #78 N
dw (.ch0_79 -.chars)*16 + 2 ; #79 O dw (.ch0_79 -.chars)*16 + 2 ; #79 O
dw (.ch0_80 -.chars)*16 + 2 ; #80 P dw (.ch0_80 -.chars)*16 + 2 ; #80 P
@ -415,12 +418,13 @@ align 4
dw (.ch0_240-.chars)*16 + 5 ; #240 ¨ dw (.ch0_240-.chars)*16 + 5 ; #240 ¨
dw (.ch0_241-.chars)*16 + 4 ; #241 ¸ dw (.ch0_241-.chars)*16 + 4 ; #241 ¸
times 14 dw 0 ; #242-255 times 14 dw 0 ; #242-255
diff10 "check font0 table size: ", .table0, $
; ---------------------------------------------------- ; ----------------------------------------------------
align 4 align 4
.chars: .chars:
dw 0 dw 0
.ch0_33: ! .ch0_33: ; !
ritick 2, 2, 0 ritick 2, 2, 0
lntick 2, 4, 2, 5 lntick 2, 4, 2, 5
.ch0_34: ; " .ch0_34: ; "
@ -429,7 +433,7 @@ align 4
lntick 3, 8, 2, 2 lntick 3, 8, 2, 2
.ch0_36: ; $ .ch0_36: ; $
lntick 2, 2, 2, 5 lntick 2, 2, 2, 5
gptick 11, 0, v11_1 gptick 11, 0, 98
.ch0_37: ; % .ch0_37: ; %
cstick 0, 9, 0, 0 cstick 0, 9, 0, 0
lntick 0, 3, 1, 5 lntick 0, 3, 1, 5
@ -471,7 +475,7 @@ align 4
.ch0_79: ; O .ch0_79: ; O
.ch0_142: ; Î .ch0_142: ; Î
.ch0_81: ; Q .ch0_81: ; Q
gptick 5, 4, v10_1 gptick 5, 4, 94
lntick 4, 4, 2, 4 lntick 4, 4, 2, 4
lntick 3, 1, 0, 2 lntick 3, 1, 0, 2
.ch0_49: ; 1 .ch0_49: ; 1
@ -494,12 +498,12 @@ align 4
lntick 0, 4, 0, 5 lntick 0, 4, 0, 5
lntick 3, 2, 2, 7 lntick 3, 2, 2, 7
.ch0_54: ; 6 .ch0_54: ; 6
gptick 14, 0, v10_2 gptick 14, 0, 95
gptick 2, 0, 44 gptick 2, 0, 44
.ch0_56: ; 8 .ch0_56: ; 8
gptick 10, 6, 60 gptick 10, 6, 60
.ch0_57: ; 9 .ch0_57: ; 9
gptick 9, 0, v10_2 gptick 9, 0, 95
gptick 15, 0, 44 gptick 15, 0, 44
.ch0_60: ; < .ch0_60: ; <
gptick 7, 4, 74 gptick 7, 4, 74
@ -524,7 +528,7 @@ align 4
.ch0_145: ; Ñ .ch0_145: ; Ñ
ritick 5, 3, 0 ritick 5, 3, 0
.ch0_71: ; G .ch0_71: ; G
gptick 5, 4, v10_1 gptick 5, 4, 94
gptick 4, 5, 43 gptick 4, 5, 43
.ch0_68: ; D .ch0_68: ; D
gptick 9, 0, 74 gptick 9, 0, 74
@ -556,7 +560,7 @@ align 4
lntick 0, 8, 0, 5 lntick 0, 8, 0, 5
.ch0_77: ; M .ch0_77: ; M
.ch0_140: ; M .ch0_140: ; M
gptick 3, 5, 2, 32 gptick 13, 2, 32
ritick 1, 7, 0 ritick 1, 7, 0
.ch0_78: ; N .ch0_78: ; N
lntick 0, 2, 2, 7 lntick 0, 2, 2, 7
@ -567,7 +571,7 @@ align 4
.ch0_87: ; W .ch0_87: ; W
lntick 0, 3, 2, 6 lntick 0, 3, 2, 6
lntick 4, 3, 2, 6 lntick 4, 3, 2, 6
gptick 0, 2, 1, 48 gptick 1, 1, 48
.ch0_86: ; V .ch0_86: ; V
lntick 0, 7, 0, 2 lntick 0, 7, 0, 2
lntick 4, 7, 0, 2 lntick 4, 7, 0, 2
@ -666,7 +670,7 @@ align 4
lntick 1, 2, 2, 5 lntick 1, 2, 2, 5
gptick 21, 1, 32 gptick 21, 1, 32
.ch0_115: ; s .ch0_115: ; s
gptick 1, 0, v11_1 gptick 1, 0, 98
.ch0_116: ; t .ch0_116: ; t
gptick 16, 0, 43 gptick 16, 0, 43
gptick 20, 3, 32 gptick 20, 3, 32
@ -970,6 +974,7 @@ align 4
lntick 2, 4, 0, 3 lntick 2, 4, 0, 3
lntick 2, 0, 2, 4 lntick 2, 0, 2, 4
diff10 "font0 size ", .chars, $