diff --git a/kernel/trunk/docs/sysfuncr.txt b/kernel/trunk/docs/sysfuncr.txt index fd29df3656..c78499fcde 100644 --- a/kernel/trunk/docs/sysfuncr.txt +++ b/kernel/trunk/docs/sysfuncr.txt @@ -197,16 +197,21 @@ Параметры: * eax = 4 - номер функции * ebx = [координата по оси x]*65536 + [координата по оси y] - * ecx = 0xX0RRGGBB, где + * ecx = 0xXYRRGGBB, где * RR, GG, BB задают цвет текста * X=ABnn (биты): - * nn задает используемый шрифт: 0=системный моноширинный, - 1=системный шрифт переменной ширины - * A=0 - выводить esi символов, A=1 - выводить ASCIIZ-строку - * B=1 - закрашивать фон цветом edi + * nn задает используемый шрифт: 0=системный моноширинный, + 1=системный шрифт переменной ширины + * A=0 - выводить esi символов, A=1 - выводить ASCIIZ-строку + * B=1 - закрашивать фон цветом edi + * Y=Cnnn (биты): + * C=1 перенаправить вывод в область пользователя, задано в edi + * nnn - не используется в текущем виде, должно быть 0 (zero) * edx = указатель на начало строки * esi = для A=0 длина строки, должна быть не больше 255; для A=1 игнорируется + * edi = цвет для закраски фона, если B=1 + * edi = указатель на область пользователя, если C=1 Возвращаемое значение: * функция не возвращает значения Замечания: @@ -214,7 +219,12 @@ второй - из char2.mt. * Оба шрифта имеют высоту 9 пикселей, ширина моноширинного шрифта равна 6 пикселей. - + * C=1, глубина точки = 32 бита, область пользователя выглядит так: + dword Xsize + dword Ysize + остаток области = Xsize * Y size * 4 + * Нельзя одновременно использовать B=1 и C=1, поскольку в обоих + случаях использован регистр edi для разных целей. ====================================================================== ========================= Функция 5 - пауза. ========================= ====================================================================== diff --git a/kernel/trunk/docs/sysfuncs.txt b/kernel/trunk/docs/sysfuncs.txt index e3a363e669..f2b120e095 100644 --- a/kernel/trunk/docs/sysfuncs.txt +++ b/kernel/trunk/docs/sysfuncs.txt @@ -194,16 +194,22 @@ Remarks: Parameters: * eax = 4 - function number * ebx = [coordinate on axis x]*65536 + [coordinate on axis y] - * ecx = 0xX0RRGGBB, where + * ecx = 0xXYRRGGBB, where * RR, GG, BB specify text color * X=ABnn (bits): - * nn specifies the used font: 0=system monospaced, - 1=system font of variable width - * A=0 - output esi characters, A=1 - output ASCIIZ-string - * B=1 - fill background with the color edi + * nn specifies the used font: 0=system monospaced, + 1=system font of variable width + * A=0 - output esi characters, A=1 - output ASCIIZ-string + * B=1 - fill background with the color edi + * Y = Cnnn + * C=1 redirect the output to the user area, specified in edi + * nnn - not used in the current, must be 0 (zero) * edx = pointer to the beginning of the string * esi = for A=0 length of the string, must not exceed 255; for A=1 is ignored + * edi = color to fill background, if B=1 + * edi = pointer to user area, for redirect, if C=1 + Returned value: * function does not return value Remarks: @@ -211,6 +217,12 @@ Remarks: second - from char2.mt. * Both fonts have height 9 pixels, width of the monospaced font is equal to 6 pixels. + * C=1, pixel depth = 32 bits, user area is as follows: + dword Xsize + dword Ysize + rest of the area = Xsize * Y size * 4 + * You can not use B = 1 and C = 1, at the same time. Since in both + cases, the register edi is used for different purposes. ====================================================================== ========================= Function 5 - delay. ======================== diff --git a/kernel/trunk/gui/font.inc b/kernel/trunk/gui/font.inc index c933392ca8..f7f2c192df 100644 --- a/kernel/trunk/gui/font.inc +++ b/kernel/trunk/gui/font.inc @@ -16,15 +16,15 @@ dtext_asciiz_esi: ; for skins title out jmp dtext.1 ;------------------------------------------------------------------------------ align 4 -dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org]) - ; ebx x & y - ; ecx style ( 0xX0000000 ) & color ( 0x00RRGGBB ) - ; X = ABnnb: - ; nn = font - ; A = 0 <=> output esi characters; otherwise output ASCIIZ string - ; B = 1 <=> fill background with color eax - ; edx start of text - ; edi 1 force +dtext: +; ebx x & y +; ecx style ( 0xX0000000 ) & color ( 0x00RRGGBB ) +; X = ABnnb: +; nn = font +; A = 0 <=> output esi characters; otherwise output ASCIIZ string +; B = 1 <=> fill background with color eax +; edx start of text +; edi 1 force or user area for redirect push eax xor eax, eax ;-------------------------------------- @@ -36,14 +36,17 @@ align 4 xchg eax, ebx ; eax=x, ebx=y cmp esi, 255 jb .loop + mov esi, 255 ;-------------------------------------- align 4 .loop: test ecx, ecx js .test_asciiz + dec esi js .end + jmp @f ;-------------------------------------- align 4 @@ -53,6 +56,7 @@ align 4 cmp byte [esp+28], 1 jne @f + dec esi js .end ;-------------------------------------- @@ -63,6 +67,7 @@ align 4 movzx edx, byte [edx-1] test ecx, 0x10000000 jnz .font2 + mov esi, 9 lea ebp, [FONT_I+8*edx+edx] ;-------------------------------------- @@ -75,7 +80,17 @@ align 4 .pixloop1: shr dl, 1 jz .pixloop1end + jnc .nopix + + test ecx, 0x08000000 ; redirect the output to the user area + jz @f + + call draw_text_to_user_area + jmp .pixloop1cont +;-------------------------------------- +align 4 +@@: and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area ; call [putpixel] call __sys_putpixel @@ -85,8 +100,19 @@ align 4 .nopix: test ecx, 0x40000000 jz .pixloop1cont + push ecx mov ecx, [esp+4+20h+20h] + + test ecx, 0x08000000 ; redirect the output to the user area + jz @f + + call draw_text_to_user_area + pop ecx + jmp .pixloop1cont +;-------------------------------------- +align 4 +@@: and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area ; call [putpixel] call __sys_putpixel @@ -104,6 +130,7 @@ align 4 inc ebp dec esi jnz .symloop1 + popad add eax, 6 jmp .loop @@ -124,6 +151,15 @@ align 4 .pixloop2: shr dl, 1 jnc .nopix2 + + test ecx, 0x08000000 ; redirect the output to the user area + jz @f + + call draw_text_to_user_area + jmp .pixloop2cont +;-------------------------------------- +align 4 +@@: and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area ; call [putpixel] call __sys_putpixel @@ -133,8 +169,19 @@ align 4 .nopix2: test ecx, 0x40000000 jz .pixloop2cont + push ecx mov ecx, [esp+12+20h+20h] + + test ecx, 0x08000000 ; redirect the output to the user area + jz @f + + call draw_text_to_user_area + pop ecx + jmp .pixloop2cont +;-------------------------------------- +align 4 +@@: and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area ; call [putpixel] call __sys_putpixel @@ -145,12 +192,14 @@ align 4 inc eax dec esi jnz .pixloop2 + pop esi sub eax, esi inc ebx inc ebp dec dword [esp] jnz .symloop2 + pop eax add dword [esp+28], esi popad @@ -162,3 +211,21 @@ align 4 pop eax ret ;------------------------------------------------------------------------------ +; eax = x coordinate +; ebx = y coordinate +; ecx = ?? RR GG BB +; edi = user area +align 4 +draw_text_to_user_area: + pushad + imul ebx, [edi+0] + add eax, ebx + shl eax, 2 + add eax, edi + add eax, 8 + and ecx, 0xffffff + or ecx, 0xff000000 ; not transparent + mov [eax], ecx ; store pixel + popad + ret +;------------------------------------------------------------------------------ \ No newline at end of file diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 0f867dd3e0..27b5ec61f9 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -4661,6 +4661,8 @@ syscall_writetext: ; WriteText pop esi add ebx, ebp mov eax, edi + test ecx, 0x08000000 ; redirect the output to the user area + jnz dtext xor edi, edi jmp dtext