1) VESA draw some speedup

2) VGA draw fix

git-svn-id: svn://kolibrios.org@2436 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2012-03-08 13:45:18 +00:00
parent e89bf78ced
commit aede9dbee9
7 changed files with 809 additions and 407 deletions

View File

@ -7,15 +7,14 @@
$Revision$
; // Alver 22.06.2008 // {
;------------------------------------------------------------------------------
align 4
dtext_asciiz_esi: ; for skins title out
push eax
xor eax, eax
inc eax
jmp dtext.1
; } \\ Alver \\
;------------------------------------------------------------------------------
align 4
dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
; ebx x & y
@ -26,12 +25,11 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
; B = 1 <=> fill background with color eax
; edx start of text
; edi 1 force
; // Alver 22.06.2008 // {
push eax
xor eax, eax
;--------------------------------------
align 4
.1:
; } \\ Alver \\
pushad
movsx eax, bx ; eax=y
sar ebx, 16 ; ebx=x
@ -39,21 +37,26 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
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
.test_asciiz:
cmp byte [edx], 0
jz .end
; // Alver 22.06.2008 // {
cmp byte [esp+28], 1
jne @f
dec esi
js .end
; } \\ Alver \\
;--------------------------------------
align 4
@@:
inc edx
pushad
@ -62,9 +65,13 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
jnz .font2
mov esi, 9
lea ebp, [FONT_I+8*edx+edx]
;--------------------------------------
align 4
.symloop1:
mov dl, byte [ebp]
or dl, 1 shl 6
;--------------------------------------
align 4
.pixloop1:
shr dl, 1
jz .pixloop1end
@ -72,6 +79,8 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
jmp .pixloop1cont
;--------------------------------------
align 4
.nopix:
test ecx, 0x40000000
jz .pixloop1cont
@ -80,9 +89,13 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
pop ecx
;--------------------------------------
align 4
.pixloop1cont:
inc eax
jmp .pixloop1
;--------------------------------------
align 4
.pixloop1end:
sub eax, 6
inc ebx
@ -92,20 +105,28 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
popad
add eax, 6
jmp .loop
;--------------------------------------
align 4
.font2:
add edx, edx
lea ebp, [FONT_II+4*edx+edx+1]
push 9
movzx esi, byte [ebp-1]
;--------------------------------------
align 4
.symloop2:
mov dl, byte [ebp]
push esi
;--------------------------------------
align 4
.pixloop2:
shr dl, 1
jnc .nopix2
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
jmp .pixloop2cont
;--------------------------------------
align 4
.nopix2:
test ecx, 0x40000000
jz .pixloop2cont
@ -114,6 +135,8 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
pop ecx
;--------------------------------------
align 4
.pixloop2cont:
inc eax
dec esi
@ -128,7 +151,10 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
add dword [esp+28], esi
popad
jmp .loop
;--------------------------------------
align 4
.end:
popad
pop eax ; << // Alver 22.06.2008 // <<
pop eax
ret
;------------------------------------------------------------------------------

View File

@ -11,7 +11,8 @@ $Revision$
include "skindata.inc"
;skin_data = 0x00778000
;------------------------------------------------------------------------------
align 4
read_skin_file:
stdcall load_file, ebx
test eax, eax
@ -21,6 +22,8 @@ read_skin_file:
cmp ebx, 32*1024
jb @f
mov ebx, 32*1024
;--------------------------------------
align 4
@@:
lea ecx, [ebx+3]
shr ecx, 2
@ -32,16 +35,20 @@ read_skin_file:
call parse_skin_data
xor eax, eax
ret
;--------------------------------------
align 4
.notfound:
xor eax, eax
inc eax
ret
;--------------------------------------
align 4
.noskin:
stdcall kernel_free, eax
push 2
pop eax
ret
;------------------------------------------------------------------------------
struct SKIN_HEADER
ident dd ?
version dd ?
@ -81,13 +88,15 @@ struct SKIN_BITMAPS
type dw ?
data dd ?
ends
;------------------------------------------------------------------------------
align 4
load_default_skin:
mov [_skinh], 22
mov ebx, _skin_file_default
call read_skin_file
ret
;------------------------------------------------------------------------------
align 4
parse_skin_data:
mov ebp, skin_data
cmp [ebp+SKIN_HEADER.ident], 'SKIN'
@ -127,6 +136,8 @@ parse_skin_data:
mov ebx, [ebp+SKIN_HEADER.bitmaps]
add ebx, skin_data
;--------------------------------------
align 4
.lp1:
cmp dword[ebx], 0
je .end_bitmaps
@ -139,8 +150,12 @@ parse_skin_data:
or ecx, ecx
jnz @f
mov edx, skin_inactive.left.data
;--------------------------------------
align 4
@@:
jmp .next_bitmap
;--------------------------------------
align 4
.not_left:
dec eax
jnz .not_oper
@ -152,8 +167,12 @@ parse_skin_data:
or ecx, ecx
jnz @f
mov edx, skin_inactive.oper.data
;--------------------------------------
align 4
@@:
jmp .next_bitmap
;--------------------------------------
align 4
.not_oper:
dec eax
jnz .not_base
@ -163,11 +182,17 @@ parse_skin_data:
jnz @f
mov eax, [skin_inactive.left.width]
mov edx, skin_inactive.base.data
;--------------------------------------
align 4
@@:
jmp .next_bitmap
;--------------------------------------
align 4
.not_base:
add ebx, 8
jmp .lp1
;--------------------------------------
align 4
.next_bitmap:
mov ecx, [ebx+SKIN_BITMAPS.data]
add ecx, skin_data
@ -178,10 +203,13 @@ parse_skin_data:
mov [edx+0], ecx
add ebx, 8
jmp .lp1
;--------------------------------------
align 4
.end_bitmaps:
mov ebx, [ebp+SKIN_HEADER.buttons]
add ebx, skin_data
;--------------------------------------
align 4
.lp2:
cmp dword[ebx], 0
je .end_buttons
@ -190,14 +218,20 @@ parse_skin_data:
jnz .not_close
mov edx, skin_btn_close
jmp .next_button
;--------------------------------------
align 4
.not_close:
dec eax
jnz .not_minimize
mov edx, skin_btn_minimize
jmp .next_button
;--------------------------------------
align 4
.not_minimize:
add ebx, 12
jmp .lp2
;--------------------------------------
align 4
.next_button:
movsx eax, [ebx+SKIN_BUTTONS.left]
mov [edx+SKIN_BUTTON.left], eax
@ -209,26 +243,22 @@ parse_skin_data:
mov [edx+SKIN_BUTTON.height], eax
add ebx, 12
jmp .lp2
;--------------------------------------
align 4
.end_buttons:
.exit:
ret
sys_putimage_with_check:
or ebx, ebx
jz @f
call sys_putimage.forced
@@:
ret
;------------------------------------------------------------------------------
align 4
drawwindow_IV_caption:
mov ebp, skin_active
or al, al
jnz @f
mov ebp, skin_inactive
;--------------------------------------
align 4
@@:
mov esi, [esp+4]
mov eax, [esi+WDATA.box.width] ; window width
mov edx, [ebp+SKIN_DATA.left.left]
@ -238,8 +268,12 @@ drawwindow_IV_caption:
add ecx, [_skinh]
mov ebx, [ebp+SKIN_DATA.left.data]
call sys_putimage_with_check
or ebx, ebx
jz @f
call sys_putimage.forced
;--------------------------------------
align 4
@@:
mov esi, [esp+4]
mov eax, [esi+WDATA.box.width]
sub eax, [ebp+SKIN_DATA.left.width]
@ -260,17 +294,27 @@ drawwindow_IV_caption:
mov edx, [ebp+SKIN_DATA.base.left]
sub edx, [ebp+SKIN_DATA.base.width]
shl edx, 16
;--------------------------------------
align 4
.baseskinloop:
shr edx, 16
add edx, [ebp+SKIN_DATA.base.width]
shl edx, 16
push eax ebx ecx edx
call sys_putimage_with_check
or ebx, ebx
jz @f
call sys_putimage.forced
;--------------------------------------
align 4
@@:
pop edx ecx ebx eax
dec eax
jnz .baseskinloop
;--------------------------------------
align 4
.non_base:
mov esi, [esp+4]
@ -283,16 +327,18 @@ drawwindow_IV_caption:
mov ecx, [ebp+SKIN_DATA.oper.width]
shl ecx, 16
add ecx, [_skinh]
call sys_putimage_with_check
or ebx, ebx
jz @f
call sys_putimage.forced
;--------------------------------------
align 4
@@:
ret
;//mike.dld, 2006-08-02 ]
;------------------------------------------------------------------------------
align 4
drawwindow_IV:
;param1 - aw_yes
pusha
push edx
@ -303,8 +349,9 @@ drawwindow_IV:
cmp byte [esp+32+4+4], 0
jne @f
mov ebp, skin_inactive
;--------------------------------------
align 4
@@:
mov eax, [edi+WDATA.box.left]
shl eax, 16
mov ax, word [edi+WDATA.box.left]
@ -313,9 +360,6 @@ drawwindow_IV:
shl ebx, 16
mov bx, word [edi+WDATA.box.top]
add bx, word [edi+WDATA.box.height]
; mov esi,[edi+24]
; shr esi,1
; and esi,0x007f7f7f
mov esi, [ebp+SKIN_DATA.colors.outer]
or esi, 1 shl 25 ; 0x02000000 used for draw_rectangle without top line
ror ebx, 16
@ -324,6 +368,8 @@ drawwindow_IV:
rol ebx, 16
call draw_rectangle
mov ecx, 3
;--------------------------------------
align 4
_dw3l:
add eax, 1*65536-1
add ebx, 0*65536-1
@ -357,13 +403,14 @@ drawwindow_IV:
mov edi, [common_colours+4]; standard grab color
call [drawbar]
jmp draw_clientbar
;--------------------------------------
align 4
@@:
mov al, [esp+32+4+4]
call drawwindow_IV_caption
;--------------------------------------
align 4
draw_clientbar:
mov esi, [esp]
mov edx, [esi+WDATA.box.top] ; WORK AREA
@ -382,11 +429,11 @@ drawwindow_IV:
test edi, 0x40000000
jnz _noinside2
call [drawbar]
;--------------------------------------
align 4
_noinside2:
cmp dword[skin_data], 'SKIN'
jne no_skin_add_button
;* close button
mov edi, [BTN_ADDR]
movzx eax, word [edi]
@ -411,6 +458,8 @@ drawwindow_IV:
mov ebx, [esp]
mov ebx, [ebx+WDATA.box.width]
inc ebx
;--------------------------------------
align 4
_bCx_at_right:
add ebx, [skin_btn_close.left]
mov [eax], bx
@ -425,7 +474,6 @@ drawwindow_IV:
mov ebx, [skin_btn_close.height]
dec ebx
mov [eax], bx
;* minimize button
mov edi, [BTN_ADDR]
movzx eax, word [edi]
@ -450,6 +498,8 @@ drawwindow_IV:
mov ebx, [esp]
mov ebx, [ebx+WDATA.box.width]
inc ebx
;--------------------------------------
align 4
_bMx_at_right:
add ebx, [skin_btn_minimize.left]
mov [eax], bx
@ -464,10 +514,10 @@ drawwindow_IV:
mov ebx, [skin_btn_minimize.height]
dec ebx
mov [eax], bx
;--------------------------------------
align 4
no_skin_add_button:
pop edi
popa
ret 4
;------------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -419,14 +419,7 @@ high_code:
cmp [SCR_MODE], word 0x13 ; EGA 320*200 256 colors
je v20ga32
jmp v20ga24
; mov [PUTPIXEL], dword Vesa12_putpixel24 ; Vesa 1.2
; mov [GETPIXEL], dword Vesa12_getpixel24
; cmp [ScreenBPP], byte 24
; jz ga24
; mov [PUTPIXEL], dword Vesa12_putpixel32
; mov [GETPIXEL], dword Vesa12_getpixel32
; ga24:
; jmp v20ga24
setvesa20:
mov [PUTPIXEL], dword Vesa20_putpixel24 ; Vesa 2.0
mov [GETPIXEL], dword Vesa20_getpixel24

View File

@ -1000,6 +1000,19 @@ align 4
mov [_display.check_mouse], check_mouse_area_for_putpixel_new
mov [_display.check_m_pixel], check_mouse_area_for_getpixel_new
cmp [PUTPIXEL], dword VGA_putpixel
je @f
cmp [ScreenBPP], byte 32
je .32
mov [PUTPIXEL], dword Vesa20_putpixel24_new
jmp @f
;--------------------------------------
align 4
.32:
mov [PUTPIXEL], dword Vesa20_putpixel32_new
;--------------------------------------
align 4
@@:
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
mov [def_cursor], eax
ret

View File

@ -452,7 +452,12 @@ align 4
.finish:
add esp, putimg.stack_data
popad
cmp [SCR_MODE], dword 0x12
jne @f
call VGA__putimage
;--------------------------------------
align 4
@@:
mov [EGA_counter], 1
ret
;--------------------------------------
@ -600,7 +605,7 @@ Vesa20_putpixel24:
; check mouse area for putpixel
test eax, 0x04000000
jnz @f
call [_display.check_mouse]
call check_mouse_area_for_putpixel
;--------------------------------------
align 4
@@:
@ -608,7 +613,48 @@ align 4
mov [LFB_BASE+ebx+edi], ax
shr eax, 16
mov [LFB_BASE+ebx+edi+2], al
ret
;-----------------------------------------------------------------------------
align 4
Vesa20_putpixel24_new:
; eax = x
; ebx = y
mov ecx, eax
shl ecx, 16
mov cx, bx
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [eax+eax*2]; edi = x*3
mov eax, [esp+32-8+4]
;--------------------------------------
; check mouse area for putpixel
test eax, 0x04000000
jnz @f
;--------------------------------------
; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb @f
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae @f
rol ecx, 16
;--------------------------------------
; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb @f
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae @f
call check_mouse_area_for_putpixel_new.1
;--------------------------------------
align 4
@@:
; store to real LFB
mov [LFB_BASE+ebx+edi], ax
shr eax, 16
mov [LFB_BASE+ebx+edi+2], al
ret
;-----------------------------------------------------------------------------
align 4
@ -626,14 +672,54 @@ Vesa20_putpixel32:
; check mouse area for putpixel
test eax, 0x04000000
jnz @f
call [_display.check_mouse]
call check_mouse_area_for_putpixel
;--------------------------------------
align 4
@@:
and eax, 0xffffff
; store to real LFB
mov [LFB_BASE+edi], eax
ret
;-----------------------------------------------------------------------------
align 4
Vesa20_putpixel32_new:
; eax = x
; ebx = y
mov ecx, eax
shl ecx, 16
mov cx, bx
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
mov eax, [esp+32-8+4]; eax = color
;--------------------------------------
; check mouse area for putpixel
test eax, 0x04000000
jnz @f
;--------------------------------------
; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb @f
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae @f
rol ecx, 16
;--------------------------------------
; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb @f
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae @f
call check_mouse_area_for_putpixel_new.1
;--------------------------------------
align 4
@@:
and eax, 0xffffff
; store to real LFB
mov [LFB_BASE+edi], eax
ret
;-----------------------------------------------------------------------------
align 4
@ -1208,7 +1294,12 @@ align 4
.end:
add esp, drbar.stack_data
popad
cmp [SCR_MODE], dword 0x12
jne @f
call VGA_draw_bar
;--------------------------------------
align 4
@@:
xor eax, eax
mov [EGA_counter], 1
ret
@ -1391,7 +1482,12 @@ dp4:
jbe dp2
popad
mov [EGA_counter], 1
cmp [SCR_MODE], dword 0x12
jne @f
call VGA_drawbackground
;--------------------------------------
align 4
@@:
ret
;------------------------------------------------------------------------------
align 4
@ -1598,7 +1694,12 @@ sdpdone:
add esp, 44
popad
mov [EGA_counter], 1
cmp [SCR_MODE], dword 0x12
jne @f
call VGA_drawbackground
;--------------------------------------
align 4
@@:
ret
uglobal

View File

@ -13,7 +13,8 @@
$Revision$
;------------------------------------------------------------------------------
align 4
paletteVGA:
;16 colour palette
@ -24,9 +25,9 @@ paletteVGA:
mov ecx, 16
mov dx, 0x3c9
xor eax, eax
;--------------------------------------
align 4
palvganew:
mov al, 0
test ah, 4
jz palvgalbl1
@ -34,6 +35,8 @@ paletteVGA:
test ah, 8
jz palvgalbl1
add al, 32
;--------------------------------------
align 4
palvgalbl1:
out dx, al; red 0,31 or 63
mov al, 0
@ -43,6 +46,8 @@ paletteVGA:
test ah, 8
jz palvgalbl2
add al, 32
;--------------------------------------
align 4
palvgalbl2:
out dx, al; blue 0,31 or 63
mov al, 0
@ -52,6 +57,8 @@ paletteVGA:
test ah, 8
jz palvgalbl3
add al, 32
;--------------------------------------
align 4
palvgalbl3:
out dx, al; green 0,31 or 63
add ah, 1
@ -60,59 +67,76 @@ paletteVGA:
; mov ax, 0005h
; out dx, ax
ret
;------------------------------------------------------------------------------
align 4
palette320x200:
mov edx, 0x3c8
xor eax, eax
out dx, al
mov ecx, 256
mov edx, 0x3c9
xor eax, eax
;--------------------------------------
align 4
palnew:
mov al, 0
test ah, 64
jz pallbl1
add al, 21
;--------------------------------------
align 4
pallbl1:
test ah, 128
jz pallbl2
add al, 42
;--------------------------------------
align 4
pallbl2:
out dx, al
mov al, 0
test ah, 8
jz pallbl3
add al, 8
;--------------------------------------
align 4
pallbl3:
test ah, 16
jz pallbl4
add al, 15
;--------------------------------------
align 4
pallbl4:
test ah, 32
jz pallbl5
add al, 40
;--------------------------------------
align 4
pallbl5:
out dx, al
mov al, 0
test ah, 1
jz pallbl6
add al, 8
;--------------------------------------
align 4
pallbl6:
test ah, 2
jz pallbl7
add al, 15
;--------------------------------------
align 4
pallbl7:
test ah, 4
jz pallbl8
add al, 40
;--------------------------------------
align 4
pallbl8:
out dx, al
add ah, 1
loop palnew
ret
;------------------------------------------------------------------------------
align 4
uglobal
novesachecksum dd 0x0
@ -123,13 +147,12 @@ uglobal
temp:
.cx dd 0
endg
;------------------------------------------------------------------------------
align 4
checkVga_N13:
cmp [SCR_MODE], dword 0x13
jne @f
; cnvl:
pushad
cmp [EGA_counter], 1
je novesal
@ -137,9 +160,12 @@ checkVga_N13:
cmp ecx, [novesachecksum]
jne novesal
popad
;--------------------------------------
align 4
@@:
ret
;--------------------------------------
align 4
novesal:
mov [novesachecksum], ecx
mov ecx, 0
@ -147,10 +173,14 @@ checkVga_N13:
cmp eax, 100
jge m13l3
mov eax, 100
;--------------------------------------
align 4
m13l3:
cmp eax, 480-100
jbe m13l4
mov eax, 480-100
;--------------------------------------
align 4
m13l4:
sub eax, 100
imul eax, 640*4
@ -159,10 +189,14 @@ checkVga_N13:
cmp eax, 160
jge m13l1
mov eax, 160
;--------------------------------------
align 4
m13l1:
cmp eax, 640-160
jbe m13l2
mov eax, 640-160
;--------------------------------------
align 4
m13l2:
sub eax, 160
shl eax, 2
@ -173,6 +207,8 @@ checkVga_N13:
mov edx, 200
mov ecx, 320
cld
;--------------------------------------
align 4
m13pix:
lodsd
test eax, eax
@ -188,6 +224,8 @@ checkVga_N13:
and ebx, (128+64)*256*256; red
shr ebx, 8+8
add eax, ebx
;--------------------------------------
align 4
.save_pixel:
stosb
loop m13pix
@ -198,16 +236,17 @@ checkVga_N13:
mov [EGA_counter], 0
popad
ret
;------------------------------------------------------------------------------
align 4
VGA_drawbackground:
; draw all
cmp [SCR_MODE], dword 0x12
jne .end
pushad
mov esi, [LFBAddress]
mov edi, VGABasePtr
mov ebx, 640/32; 640*480/(8*4)
mov edx, 480
;--------------------------------------
align 4
@@:
push ebx edx esi edi
shl edx, 9
@ -221,9 +260,9 @@ VGA_drawbackground:
jnz @r
call VGA_draw_long_line_1
popad
.end:
ret
;------------------------------------------------------------------------------
align 4
VGA_draw_long_line:
mov dx, 3ceh
mov ax, 0ff08h
@ -231,6 +270,8 @@ VGA_draw_long_line:
out dx, ax
mov ax, 0005h
out dx, ax
;--------------------------------------
align 4
m12pix:
call VGA_draw_32_pixels
dec ebx
@ -246,7 +287,8 @@ VGA_draw_long_line:
out dx, al
sti
ret
;------------------------------------------------------------------------------
align 4
VGA_draw_32_pixels:
xor eax, eax
mov ebp, VGA_8_pixels
@ -255,8 +297,12 @@ VGA_draw_32_pixels:
mov [ebp+8], eax
mov [ebp+12], eax
mov ch, 4
;--------------------------------------
align 4
.main_loop:
mov cl, 8
;--------------------------------------
align 4
.convert_pixels_to_VGA:
lodsd ; eax = 24bit colour
test eax, eax
@ -273,6 +319,8 @@ VGA_draw_32_pixels:
cmp al, 170
jbe .p13green
or [ebp+12], ch
;--------------------------------------
align 4
.p13green:
cmp ah, 85
jbe .p13red
@ -280,6 +328,8 @@ VGA_draw_32_pixels:
cmp ah, 170
jbe .p13red
or [ebp+12], ch
;--------------------------------------
align 4
.p13red:
shr eax, 8
cmp ah, 85
@ -288,10 +338,14 @@ VGA_draw_32_pixels:
cmp ah, 170
jbe .p13cont
or [ebp+12], ch
;--------------------------------------
align 4
.p13cont:
ror eax, 8
mov ch, ah
inc cl
;--------------------------------------
align 4
.end:
dec cl
jnz .convert_pixels_to_VGA
@ -303,6 +357,8 @@ VGA_draw_32_pixels:
mov esi, ebp
mov dx, 3c4h
mov ah, 1h
;--------------------------------------
align 4
@@:
mov al, 02h
out dx, ax
@ -316,12 +372,25 @@ VGA_draw_32_pixels:
add edi, 4
pop esi
ret
;------------------------------------------------------------------------------
align 4
VGA_putpixel:
; eax = x
; ebx = y
mov ecx, eax
mov eax, [esp+32-8+4] ; color
;--------------------------------------
push ecx
shl ecx, 16
mov cx, bx
; check mouse area for putpixel
test eax, 0x04000000
jnz @f
call [_display.check_mouse]
;--------------------------------------
align 4
@@:
pop ecx
shl ebx, 9
lea ebx, [ebx+ebx*4] ; óìíîæåíèå íà 5
lea edx, [ebx+ecx*4] ; + x*BytesPerPixel (Vesa2.0 32)
@ -343,6 +412,8 @@ VGA_putpixel:
cmp al, 170
jbe .p13green
or dl, 0x08
;--------------------------------------
align 4
.p13green:
cmp ah, 85
jbe .p13red
@ -350,6 +421,8 @@ VGA_putpixel:
cmp ah, 170
jbe .p13red
or dl, 0x08
;--------------------------------------
align 4
.p13red:
shr eax, 8
cmp ah, 85
@ -358,6 +431,8 @@ VGA_putpixel:
cmp ah, 170
jbe .p13cont
or dl, 0x08
;--------------------------------------
align 4
.p13cont:
ror edx, 8
inc cl
@ -371,14 +446,12 @@ VGA_putpixel:
rol edx, 8
mov [edi], dl
popfd
;.end:
ret
;------------------------------------------------------------------------------
align 4
VGA__putimage:
; ecx = size [x|y]
; edx = coordinates [x|y]
cmp [SCR_MODE], dword 0x12
jne @f
pushad
rol edx, 16
movzx eax, dx
@ -389,16 +462,14 @@ VGA__putimage:
movzx ecx, cx
call VGA_draw_bar_1
popad
@@:
ret
;------------------------------------------------------------------------------
align 4
VGA_draw_bar:
; eax cx
; ebx cy
; ecx xe
; edx ye
cmp [SCR_MODE], dword 0x12
jne @f
pushad
sub ecx, eax
sub edx, ebx
@ -408,9 +479,9 @@ VGA_draw_bar:
and edx, 0xffff
call VGA_draw_bar_1
popad
@@:
ret
;------------------------------------------------------------------------------
align 4
VGA_draw_bar_1:
mov [temp.cx], eax
mov eax, [TASK_BASE]
@ -429,13 +500,16 @@ VGA_draw_bar_1:
mov ebx, ecx
shr ebx, 5
inc ebx
;--------------------------------------
align 4
.main_loop:
call VGA_draw_long_line_1
dec edx
jnz .main_loop
call VGA_draw_long_line_1
ret
;------------------------------------------------------------------------------
align 4
VGA_draw_long_line_1:
push ebx edx esi edi
shl edx, 9
@ -446,5 +520,4 @@ VGA_draw_long_line_1:
call VGA_draw_long_line
pop edi esi edx ebx
ret
;------------------------------------------------------------------------------