From 94f0f6c81809e22fcdf7b4e9a8c20530386fdd70 Mon Sep 17 00:00:00 2001 From: "Andrey Halyavin (halyavin)" Date: Tue, 25 Oct 2005 11:01:36 +0000 Subject: [PATCH] *Font functions have been rewritten. Now kernel use bit-compressed fonts. You must use char.mt and char2.mt from MeOsEmul or MeOsDebug program or download them at http://shade.msu.ru/~msu-se/temp/char.7z *Small fix in memmap.inc for memory manager. git-svn-id: svn://kolibrios.org@12 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/boot/bootcode.inc | 8 +- kernel/trunk/gui/font.inc | 219 ++++++++++++--------------------- kernel/trunk/kernel.asm | 10 +- kernel/trunk/memmap.inc | 7 +- 4 files changed, 90 insertions(+), 154 deletions(-) diff --git a/kernel/trunk/boot/bootcode.inc b/kernel/trunk/boot/bootcode.inc index e628adbefc..a8303e460f 100644 --- a/kernel/trunk/boot/bootcode.inc +++ b/kernel/trunk/boot/bootcode.inc @@ -127,9 +127,9 @@ start_of_code: mov es,ax mov ds,ax - mov ax,0x2000 + mov ax,0x3000 mov ss,ax - mov sp,0xffff + mov sp,0xec00 xor ax,ax xor bx,bx @@ -224,9 +224,9 @@ start_of_code: mov es,ax mov ds,ax - mov ax,0x2000 + mov ax,0x3000 mov ss,ax - mov esp,0xffff + mov esp,0xec00 xor eax,eax xor ebx,ebx diff --git a/kernel/trunk/gui/font.inc b/kernel/trunk/gui/font.inc index 0d47bb64b3..dcf7f03bc6 100644 --- a/kernel/trunk/gui/font.inc +++ b/kernel/trunk/gui/font.inc @@ -40,57 +40,36 @@ dtext: align 4 drawletter: - -; eax x -; ebx y -; ecx color -; edx letter -; esi shl size -; edi force - - pushad - call [disable_mouse] - xor eax, eax - xor ebx, ebx ; 0x37000+eax+ebx*8 - inc esi - align 4 - chc: - - push eax - push ebx - - mov edx,ebx - shl edx,3 - add edx,eax - add edx,0x37000+8 - mov ecx,[esp+32-12+8] - imul ecx,8*10 - add edx,ecx - cmp [edx],byte 'o' - jnz .nopix - mov eax,[esp+4] - mov ebx,[esp+0] - add eax,[esp+32+2*4-4] - add ebx,[esp+32+2*4-16] - mov ecx,[esp+32+2*4-8] - ;;;call [disable_mouse] - call [putpixel] - .nopix: - pop ebx - pop eax - - inc eax - cmp eax,5 ; ebp - jne chc - - xor eax, eax - - inc ebx - cmp ebx,9 ; ebp - jne chc - - popad - ret +;eax - x +;ebx - y +;ecx - color +;edx - ascii code + pushad + call [disable_mouse] + mov esi,9 + lea ebp,[0x3F600+8*edx+edx] +.symloop: + push esi + mov dl,byte [ebp] + mov esi,8 +.pixloop: + test dl,1 + jz .nopix + call [putpixel] +.nopix: + shr dl,1 + inc eax + dec esi + jnz .pixloop + sub eax,8 + inc ebx + inc ebp + pop esi + dec esi + jnz .symloop + popad + ret + dtext2: @@ -114,33 +93,17 @@ dtext2: align 4 letnew2: - push eax push ecx push edx movzx ebx,ax shr eax,16 movzx edx,byte [ecx] - mov ecx,[esp+3*4+32-16] + mov ecx,[esp+2*4+32-16] call drawletter2 + shl eax,16 + add eax,ebx pop edx pop ecx - pop eax - - push edx - movzx edx,byte [ecx] - imul edx,10*10 - add edx,0x30000 - cmp [edx+6],byte ' ' - jne nocharadd8 - add eax,8*65536 - jmp charaddok - nocharadd8: - movzx edx,byte [edx+6] - sub edx,47 - shl edx,16 - add eax,edx - charaddok: - pop edx inc ecx dec edx @@ -151,75 +114,47 @@ dtext2: align 4 drawletter2: - -; eax x -; ebx y -; ecx color -; edx letter -; esi shl size -; edi force - - pushad - call [disable_mouse] - xor eax, eax - xor ebx, ebx ; +eax+ebx*8 - inc esi - - align 4 - chc2: - - push eax - push ebx - -; cmp esi,1 -; je noldiv -; xor edx,edx -; div esi -; push eax -; xor edx,edx -; mov eax,ebx -; div esi -; mov ebx,eax -; pop eax -; noldiv: - - mov edx,ebx - ;shl edx,3 - imul edx,10 - add edx,eax - add edx,0x30000+8+2 - mov ecx,[esp+32-12+8] - ;shl ecx,6 - imul ecx,10*10 - add edx,ecx - cmp [edx],byte 'o' - jnz nopix2 - mov eax,[esp+4] - mov ebx,[esp+0] - add eax,[esp+32+2*4-4] - add ebx,[esp+32+2*4-16] - mov ecx,[esp+32+2*4-8] - ;;;call [disable_mouse] - call [putpixel] - nopix2: - pop ebx - pop eax - - ;mov ebp,7 - ;imul ebp,esi - - inc eax - cmp eax,7 ;ebp - jnz chc2 - - xor eax, eax - - ;mov ebp,9 - ;imul ebp,esi - - inc ebx - cmp ebx,9 ; ebp - jnz chc2 - - popad - ret +;eax - x +;ebx - y +;ecx - color +;edx - symbol +;edi - force? +;result - eax=eax+sym_size + pushad + call [disable_mouse] + mov esi,9 + lea ebp,[0x3EC00+8*edx+edx] + push dword -1 ;size +.symloop: + push esi + mov dl,byte [ebp] + xor esi,esi +.pixloop: + test dl,1 + jz .nopix + cmp [esp+4],esi + jge .no_inc + mov [esp+4],esi +.no_inc: + call [putpixel] +.nopix: + shr dl,1 + inc esi + inc eax + cmp esi,8 + jl .pixloop + sub eax,8 + inc ebx + pop esi + inc ebp + dec esi + jnz .symloop + pop edx + test edx,edx + jge .nospace + mov edx,4 +.nospace: + add edx,2 + add [esp+32-4],edx + popad + ret \ No newline at end of file diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index f4deff3e3a..8f3ce858f3 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -169,7 +169,7 @@ app_data equ 3+app_data_l-gdts mov fs,ax mov gs,ax mov ss,ax - mov esp,0x30000 ; Set stack + mov esp,0x3ec00 ; Set stack jmp pword os_code:B32 ; jmp to enable 32 bit mode use32 @@ -449,15 +449,15 @@ include 'vmodeld.inc' mov eax,char mov esi,12 xor ebx,ebx - mov ecx,26000 - mov edx,0x37000 + mov ecx,2560;26000 + mov edx,0x3F600;0x37000 call fileread mov eax,char2 mov esi,12 xor ebx,ebx - mov ecx,26000 - mov edx,0x30000 + mov ecx,2560;26000 + mov edx,0x3EC00;0x30000 call fileread mov esi,boot_fonts diff --git a/kernel/trunk/memmap.inc b/kernel/trunk/memmap.inc index 7051353364..1e707f3f2a 100644 --- a/kernel/trunk/memmap.inc +++ b/kernel/trunk/memmap.inc @@ -127,9 +127,9 @@ ; FFFF byte do not change task for 1/100 sec. ; ; 10000 -> 1FFFF 32 bit os -; 20000 -> 2FFFF 32 bit stack -; 30000 -> 36FFF basic text font II -; 37000 -> 3BFFF basic text font I +; 20000 -> 3EBFF 32 bit stack +; 3EC00 -> 3F5FF basic text font II +; 3F600 -> 3FFFF basic text font I ; 40000 -> 4FFFF data of retrieved disks and partitions (Mario79) ; 50000 -> 5FFFF free ; 60000 -> 7FFFF paging tables @@ -152,6 +152,7 @@ ; ; B0 dword int40 handler in use ; 0 if not in use ; B4 byte keyboard mode: 0 = keymap, 1 = scancodes +; B8 dword physical address of directory table ; ; 90000 -> 9FFFF tmp ; A0000 -> AFFFF screen access area