1) small fix of code VGA.

2) decrease of an error "track of cursor ".

git-svn-id: svn://kolibrios.org@119 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2006-08-12 15:21:53 +00:00
parent d99e3ea921
commit df2e1aa3a9
3 changed files with 49 additions and 151 deletions

View File

@ -35,47 +35,32 @@ include 'm_com2.inc'
;process_test_m79 db 'K : Process - test Mario79 error 00000000',13,10,0 ;process_test_m79 db 'K : Process - test Mario79 error 00000000',13,10,0
draw_mouse_under: draw_mouse_under:
; return old picture ; return old picture
pushad pushad
xor ecx,ecx xor ecx,ecx
xor edx,edx xor edx,edx
;cli ; !!!****
align 4 align 4
mres: mres:
movzx eax,word [0xfb4a] movzx eax,word [0xfb4a]
movzx ebx,word [0xfb4c] movzx ebx,word [0xfb4c]
add eax,ecx add eax,ecx
add ebx,edx add ebx,edx
push ecx push ecx
push edx push edx
push eax push eax
push ebx push ebx
mov eax,edx mov eax,edx
shl eax,6 shl eax,6
shl ecx,2 shl ecx,2
add eax,ecx add eax,ecx
add eax,mouseunder add eax,mouseunder
mov ecx,[eax] mov ecx,[eax]
pop ebx pop ebx
pop eax pop eax
;;;push edi
mov edi, 1 ;force mov edi, 1 ;force
call [putpixel] call [putpixel]
;;;pop edi
pop edx pop edx
pop ecx pop ecx
inc ecx inc ecx
cmp ecx, 16 cmp ecx, 16
jnz mres jnz mres
@ -83,35 +68,26 @@ draw_mouse_under:
inc edx inc edx
cmp edx, 24 cmp edx, 24
jnz mres jnz mres
;sti ; !!!****
popad popad
ret ret
save_draw_mouse: save_draw_mouse:
pushad pushad
; save & draw ; save & draw
mov [0xfb4a],ax mov [0xfb4a],ax
mov [0xfb4c],bx mov [0xfb4c],bx
push eax push eax
push ebx push ebx
mov ecx,0 mov ecx,0
mov edx,0 mov edx,0
;cli ; !!!****
align 4 align 4
drm: drm:
push eax push eax
push ebx push ebx
push ecx push ecx
push edx push edx
; helloworld ; helloworld
push ecx push ecx
; push eax ebx ecx
add eax,ecx ; save picture under mouse add eax,ecx ; save picture under mouse
add ebx,edx add ebx,edx
push ecx push ecx
@ -125,9 +101,7 @@ save_draw_mouse:
add eax,mouseunder add eax,mouseunder
mov ebx,[0xfb30] mov ebx,[0xfb30]
mov [eax],ebx mov [eax],ebx
; pop ecx ebx eax
pop ecx pop ecx
mov edi,edx ; y cycle mov edi,edx ; y cycle
shl edi,4 ; *16 bytes per row shl edi,4 ; *16 bytes per row
add edi,ecx ; x cycle add edi,ecx ; x cycle
@ -142,29 +116,19 @@ save_draw_mouse:
call combine_colors call combine_colors
mov [0xfb10], ecx mov [0xfb10], ecx
pop ecx pop ecx
pop edx pop edx
pop ecx pop ecx
pop ebx pop ebx
pop eax pop eax
add eax,ecx ; we have x coord+cycle add eax,ecx ; we have x coord+cycle
add ebx,edx ; and y coord+cycle add ebx,edx ; and y coord+cycle
; push ecx edi
push ecx push ecx
mov ecx, [0xfb10] mov ecx, [0xfb10]
mov edi, 1 mov edi, 1
call [putpixel] call [putpixel]
pop ecx pop ecx
; pop edi ecx
; mnext:
mov ebx,[esp+0] ; pure y coord again mov ebx,[esp+0] ; pure y coord again
mov eax,[esp+4] ; and x mov eax,[esp+4] ; and x
inc ecx ; +1 cycle inc ecx ; +1 cycle
cmp ecx,16 ; if more than 16 cmp ecx,16 ; if more than 16
jnz drm jnz drm
@ -172,17 +136,12 @@ save_draw_mouse:
inc edx inc edx
cmp edx,24 cmp edx,24
jnz drm jnz drm
add esp,8
pop ebx
pop eax
;sti ; !!!****
popad popad
ret ret
combine_colors: combine_colors:
; in ; in
; ecx - color ( 00 RR GG BB ) ; ecx - color ( 00 RR GG BB )
; edi - ref to new color byte ; edi - ref to new color byte
@ -190,7 +149,6 @@ combine_colors:
; ;
; out ; out
; ecx - new color ( roughly (ecx*[esi]>>8)+([edi]*[esi]>>8) ) ; ecx - new color ( roughly (ecx*[esi]>>8)+([edi]*[esi]>>8) )
push eax push eax
push ebx push ebx
push edx push edx
@ -205,12 +163,10 @@ combine_colors:
mul ebx mul ebx
shr eax, 8 shr eax, 8
add ecx, eax add ecx, eax
; xor eax, eax xor eax, eax
; xor ebx, ebx xor ebx, ebx
; mov al, [edi+0] mov al, [edi+0]
; mov bl, [esi+0] mov bl, [esi+0]
movzx eax, byte [edi+0]
movzx ebx, byte [esi+0]
mul ebx mul ebx
shr eax, 8 shr eax, 8
add ecx, eax add ecx, eax
@ -224,12 +180,10 @@ combine_colors:
mul ebx mul ebx
shr eax, 8 shr eax, 8
add ecx, eax add ecx, eax
; xor eax, eax xor eax, eax
; xor ebx, ebx xor ebx, ebx
; mov al, [edi+1] mov al, [edi+1]
; mov bl, [esi+1] mov bl, [esi+1]
movzx eax, byte [edi+1]
movzx ebx, byte [esi+1]
mul ebx mul ebx
shr eax, 8 shr eax, 8
add ecx, eax add ecx, eax
@ -242,16 +196,13 @@ combine_colors:
mul ebx mul ebx
shr eax, 8 shr eax, 8
add ecx, eax add ecx, eax
; xor eax, eax xor eax, eax
; xor ebx, ebx xor ebx, ebx
; mov al, [edi+2] mov al, [edi+2]
; mov bl, [esi+2] mov bl, [esi+2]
movzx eax, byte [edi+2]
movzx ebx, byte [esi+2]
mul ebx mul ebx
shr eax, 8 shr eax, 8
add ecx, eax add ecx, eax
pop eax pop eax
pop edx pop edx
pop ebx pop ebx
@ -260,48 +211,30 @@ combine_colors:
__sys_disable_mouse: __sys_disable_mouse:
cmp dword [0xf204],dword 0 cmp dword [0xf204],dword 0
je @f je @f
ret ret
@@: @@:
; cli
pushad pushad
cmp [0x3000],dword 1 cmp [0x3000],dword 1
je disable_m je disable_m
mov edx,[0x3000] mov edx,[0x3000]
shl edx,5 shl edx,5
add edx,window_data add edx,window_data
movzx eax, word [0xfb0a] movzx eax, word [0xfb0a]
movzx ebx, word [0xfb0c] movzx ebx, word [0xfb0c]
mov ecx,[0xfe00] mov ecx,[0xfe00]
inc ecx inc ecx
imul ecx,ebx imul ecx,ebx
add ecx,eax add ecx,eax
add ecx, display_data add ecx, display_data
mov eax, [0x3000] mov eax, [0x3000]
movzx ebx, byte [ecx] movzx ebx, byte [ecx]
cmp eax,ebx cmp eax,ebx
je yes_mouse_disable je yes_mouse_disable
movzx ebx, byte [ecx+16] movzx ebx, byte [ecx+16]
cmp eax,ebx cmp eax,ebx
je yes_mouse_disable je yes_mouse_disable
; mov ebx,[0xfe00]
; inc ebx
; imul ebx,10
; add ecx,ebx
; movzx ebx, byte [ecx]
; cmp eax,ebx
; je yes_mouse_disable
mov ebx,[0xfe00] mov ebx,[0xfe00]
inc ebx inc ebx
imul ebx,10 imul ebx,10
@ -309,65 +242,48 @@ __sys_disable_mouse:
movzx ebx, byte [ecx] movzx ebx, byte [ecx]
cmp eax,ebx cmp eax,ebx
je yes_mouse_disable je yes_mouse_disable
movzx ebx, byte [ecx+16] movzx ebx, byte [ecx+16]
cmp eax,ebx cmp eax,ebx
je yes_mouse_disable je yes_mouse_disable
jmp no_mouse_disable jmp no_mouse_disable
yes_mouse_disable:
yes_mouse_disable:
mov edx,[0x3000] mov edx,[0x3000]
shl edx,5 shl edx,5
add edx,window_data add edx,window_data
movzx eax, word [0xfb0a] movzx eax, word [0xfb0a]
movzx ebx, word [0xfb0c] movzx ebx, word [0xfb0c]
mov ecx,[edx+0] ; mouse inside the area ? mov ecx,[edx+0] ; mouse inside the area ?
add eax,14 add eax,14
cmp eax,ecx cmp eax,ecx
jb no_mouse_disable jb no_mouse_disable
sub eax,14 sub eax,14
add ecx,[edx+8] add ecx,[edx+8]
cmp eax,ecx cmp eax,ecx
jg no_mouse_disable jg no_mouse_disable
mov ecx,[edx+4] mov ecx,[edx+4]
add ebx,20 add ebx,20
cmp ebx,ecx cmp ebx,ecx
jb no_mouse_disable jb no_mouse_disable
sub ebx,20 sub ebx,20
add ecx,[edx+12] add ecx,[edx+12]
cmp ebx,ecx cmp ebx,ecx
jg no_mouse_disable jg no_mouse_disable
disable_m:
disable_m:
cmp dword [0xf204],dword 0 cmp dword [0xf204],dword 0
jne @f jne no_mouse_disable
cli cli
call draw_mouse_under call draw_mouse_under
sti sti
; @@:
mov [0xf204],dword 1 mov [0xf204],dword 1
; inc dword [0xf204] no_mouse_disable:
@@:
no_mouse_disable:
popad popad
; sti
ret ret
__sys_draw_pointer: __sys_draw_pointer:
cmp [mouse_pause],0 cmp [mouse_pause],0
je @f je @f
ret ret
@@: @@:
push eax push eax
mov eax,[timer_ticks] mov eax,[timer_ticks]
sub eax,[MouseTickCounter] sub eax,[MouseTickCounter]
@ -375,49 +291,38 @@ __sys_draw_pointer:
ja @f ja @f
pop eax pop eax
ret ret
@@: @@:
mov eax,[timer_ticks] mov eax,[timer_ticks]
mov [MouseTickCounter],eax mov [MouseTickCounter],eax
pop eax pop eax
; cli
pushad pushad
cmp dword [0xf204],dword 0 ; mouse visible ? cmp dword [0xf204],dword 0 ; mouse visible ?
je chms00 je chms00
mov [0xf204], dword 0 mov [0xf204], dword 0
movzx ebx,word [0xfb0c] movzx ebx,word [0xfb0c]
movzx eax,word [0xfb0a] movzx eax,word [0xfb0a]
cli cli
call save_draw_mouse call save_draw_mouse
sti sti
nodmu2: nodmu2:
popad popad
ret ret
chms00:
chms00:
movzx ecx,word [0xfb4a] movzx ecx,word [0xfb4a]
movzx edx,word [0xfb4c] movzx edx,word [0xfb4c]
movzx ebx,word [0xfb0c] movzx ebx,word [0xfb0c]
movzx eax,word [0xfb0a] movzx eax,word [0xfb0a]
cmp eax,ecx cmp eax,ecx
jne redrawmouse jne redrawmouse
cmp ebx,edx cmp ebx,edx
jne redrawmouse jne redrawmouse
jmp nodmp jmp nodmp
redrawmouse:
redrawmouse:
cli cli
call draw_mouse_under call draw_mouse_under
call save_draw_mouse call save_draw_mouse
sti sti
nodmp: nodmp:
popad popad
; sti
ret ret

View File

@ -4035,9 +4035,9 @@ sys_putimage:
@@: @@:
mov eax, vesa20_putimage mov eax, vesa20_putimage
.doit: .doit:
; inc [mouse_pause] inc [mouse_pause]
call eax call eax
; dec [mouse_pause] dec [mouse_pause]
jmp [draw_pointer] jmp [draw_pointer]
; eax x beginning ; eax x beginning
@ -4881,7 +4881,6 @@ syscall_writeramdiskfile: ; WriteRamdiskFile
align 4 align 4
syscall_getpixel: ; GetPixel syscall_getpixel: ; GetPixel
mov ecx,[0xfe00] mov ecx,[0xfe00]
inc ecx inc ecx
xor edx,edx xor edx,edx

View File

@ -172,10 +172,7 @@ checkVga_N13:
m13pix: m13pix:
lodsd lodsd
cmp eax,0 cmp eax,0
jne @f je .save_pixel
xor eax,eax
jmp .save_pixel
@@:
push eax push eax
mov ebx,eax mov ebx,eax
and eax,(128+64+32) ; blue and eax,(128+64+32) ; blue
@ -198,7 +195,10 @@ checkVga_N13:
popad popad
ret ret
novesal_1: VGA_drawbackground:
; draw all
cmp [0xfe0c],dword 0x12
jne .end
pushad pushad
mov esi,[0xfe80] mov esi,[0xfe80]
mov edi,0xa0000 mov edi,0xa0000
@ -217,6 +217,7 @@ checkVga_N13:
jnz @r jnz @r
call VGA_draw_long_line_1 call VGA_draw_long_line_1
popad popad
.end:
ret ret
VGA_draw_long_line: VGA_draw_long_line:
@ -263,25 +264,25 @@ VGA_draw_32_pixels:
dec cl dec cl
shl ch,cl shl ch,cl
cmp al,85 cmp al,85
jb .p13green jbe .p13green
or [ebp],ch or [ebp],ch
cmp al,170 cmp al,170
jb .p13green jbe .p13green
or [ebp+12],ch or [ebp+12],ch
.p13green: .p13green:
cmp ah,85 cmp ah,85
jb .p13red jbe .p13red
or [ebp+4],ch or [ebp+4],ch
cmp ah,170 cmp ah,170
jb .p13red jbe .p13red
or [ebp+12],ch or [ebp+12],ch
.p13red: .p13red:
shr eax,8 shr eax,8
cmp ah,85 cmp ah,85
jb .p13cont jbe .p13cont
or [ebp+8],ch or [ebp+8],ch
cmp ah,170 cmp ah,170
jb .p13cont jbe .p13cont
or [ebp+12],ch or [ebp+12],ch
.p13cont: .p13cont:
ror eax,8 ror eax,8
@ -333,25 +334,25 @@ VGA_putpixel:
cmp eax,0 cmp eax,0
je .p13cont je .p13cont
cmp al,85 cmp al,85
jb .p13green jbe .p13green
or dl,0x01 or dl,0x01
cmp al,170 cmp al,170
jb .p13green jbe .p13green
or dl,0x08 or dl,0x08
.p13green: .p13green:
cmp ah,85 cmp ah,85
jb .p13red jbe .p13red
or dl,0x02 or dl,0x02
cmp ah,170 cmp ah,170
jb .p13red jbe .p13red
or dl,0x08 or dl,0x08
.p13red: .p13red:
shr eax,8 shr eax,8
cmp ah,85 cmp ah,85
jb .p13cont jbe .p13cont
or dl,0x04 or dl,0x04
cmp ah,170 cmp ah,170
jb .p13cont jbe .p13cont
or dl,0x08 or dl,0x08
.p13cont: .p13cont:
ror edx,8 ror edx,8
@ -375,7 +376,6 @@ VGA__putimage:
cmp [0xfe0c],dword 0x12 cmp [0xfe0c],dword 0x12
jne @f jne @f
pushad pushad
; calculate absolute (i.e. screen) coordinates
rol edx,16 rol edx,16
movzx eax,dx movzx eax,dx
rol edx,16 rol edx,16
@ -443,10 +443,4 @@ VGA_draw_long_line_1:
pop edi esi edx ebx pop edi esi edx ebx
ret ret
VGA_drawbackground:
; draw all
cmp [0xfe0c],dword 0x12
jne @f
call novesal_1
@@:
ret