vesa 1.2 fixup

git-svn-id: svn://kolibrios.org@673 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-11-16 08:28:33 +00:00
parent e24551e65f
commit cd14d65fc6
4 changed files with 203 additions and 159 deletions

View File

@ -66,7 +66,6 @@ map_PE: ;stdcall base:dword, image:dword
shr ecx, 2 shr ecx, 2
rep movsd rep movsd
.L8: .L8:
mov ecx, [edx+256] mov ecx, [edx+256]
add ecx, 4095 add ecx, 4095
@ -80,7 +79,6 @@ map_PE: ;stdcall base:dword, image:dword
xor eax, eax xor eax, eax
rep stosb rep stosb
.L10: .L10:
inc dword [esp+36] inc dword [esp+36]
add edx, 40 add edx, 40

View File

@ -98,7 +98,7 @@ mres:
save_draw_mouse: save_draw_mouse:
cmp [set_hw_cursor], 0 cmp [set_hw_cursor], 0
jz .no_hw_cursor je .no_hw_cursor
pushad pushad
mov [X_UNDER],ax mov [X_UNDER],ax

View File

@ -444,9 +444,13 @@ select_cursor:
align 4 align 4
proc init_cursors proc init_cursors
cmp [SCR_MODE],word 0x13 cmp [SCR_MODE],word 0x13
jbe .fail jbe .fail
test word [SCR_MODE], 0x4000
jz .fail
movzx eax, byte [ScreenBPP] movzx eax, byte [ScreenBPP]
mov ebx, [BytesPerScanLine] mov ebx, [BytesPerScanLine]
cmp eax, 32 cmp eax, 32

View File

@ -18,6 +18,29 @@
$Revision$ $Revision$
TRIDENT equ 0
S3_VIDEO equ 0
INTEL_VIDEO equ 0
if TRIDENT
if S3_VIDEO or INTEL_VIDEO
stop
end if
end if
if S3_VIDEO
if TRIDENT or INTEL_VIDEO
stop
end if
end if
if INTEL_VIDEO
if S3_VIDEO or TRIDENT
stop
end if
end if
; A complete video driver should include the following types of function ; A complete video driver should include the following types of function
; ;
; Putpixel ; Putpixel
@ -35,167 +58,187 @@ $Revision$
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
; set_bank for Trident videocards, work on Trident 9440 ; set_bank for Trident videocards, work on Trident 9440
; modified by Mario79 ; modified by Mario79
;set_bank:
;cli
;cmp al,[BANK_RW]
;je retsb
;mov [BANK_RW],al
;push dx
;mov dx,3D8h
;out dx,al
;pop dx
;retsb:
;sti
;ret
if TRIDENT
set_bank:
pushfd
cli
cmp al,[BANK_RW]
je .retsb
mov [BANK_RW],al
push dx
mov dx,3D8h
out dx,al
pop dx
.retsb:
popfd
ret
end if
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
; set_bank for S3 videocards, work on S3 ViRGE PCI (325) ; set_bank for S3 videocards, work on S3 ViRGE PCI (325)
; modified by kmeaw ; modified by kmeaw
if S3_VIDEO
set_bank: set_bank:
pushfd pushfd
cli cli
cmp al,[BANK_RW] cmp al,[BANK_RW]
je retsb je .retsb
mov [BANK_RW],al
push ax mov [BANK_RW],al
push dx push ax
push cx push dx
mov cl, al push cx
mov dx, 0x3D4 mov cl, al
mov al, 0x38 mov dx, 0x3D4
out dx, al ;CR38 Register Lock 1 ;Note: Traditionally 48h is used to mov al, 0x38
;unlock and 00h to lock out dx, al ;CR38 Register Lock 1 ;Note: Traditionally 48h is used to
inc dx ;unlock and 00h to lock
mov al, 0x48 inc dx
out dx, al ;3d5 -? mov al, 0x48
dec dx out dx, al ;3d5 -?
mov al, 0x31 dec dx
out dx, al ;CR31 Memory Configuration Register mov al, 0x31
out dx, al ;CR31 Memory Configuration Register
;0 Enable Base Address Offset (CPUA BASE). Enables bank operation if set, ;disables if clear. ;0 Enable Base Address Offset (CPUA BASE). Enables bank operation if set, ;disables if clear.
;4-5 Bit 16-17 of the Display Start Address. For the 801/5,928 see index 51h, ;4-5 Bit 16-17 of the Display Start Address. For the 801/5,928 see index 51h,
;for the 864/964 see index 69h. ;for the 864/964 see index 69h.
inc dx inc dx
in al, dx in al, dx
dec dx dec dx
mov ah, al mov ah, al
mov al, 0x31 mov al, 0x31
out dx, ax out dx, ax
mov al, ah mov al, ah
or al, 9 or al, 9
inc dx inc dx
out dx, al out dx, al
dec dx dec dx
mov al, 0x35 mov al, 0x35
out dx, al ;CR35 CRT Register Lock out dx, al ;CR35 CRT Register Lock
inc dx inc dx
in al, dx in al, dx
dec dx dec dx
and al, 0xF0 and al, 0xF0
mov ch, cl mov ch, cl
and ch, 0x0F and ch, 0x0F
or ch, al or ch, al
mov al, 0x35 mov al, 0x35
out dx, al out dx, al
inc dx inc dx
mov al, ch mov al, ch
out dx, ax out dx, ax
dec dx dec dx
mov al, 0x51 ;Extended System Control 2 Register mov al, 0x51 ;Extended System Control 2 Register
out dx, al out dx, al
inc dx inc dx
in al, dx in al, dx
dec dx dec dx
and al, 0xF3 and al, 0xF3
shr cl, 2 shr cl, 2
and cl, 0x0C and cl, 0x0C
or cl, al or cl, al
mov al, 0x51 mov al, 0x51
out dx, al out dx, al
inc dx inc dx
mov al, cl mov al, cl
out dx, al out dx, al
dec dx dec dx
mov al, 0x38 mov al, 0x38
out dx, al out dx, al
inc dx inc dx
xor al, al xor al, al
out dx, al out dx, al
dec dx dec dx
pop cx pop cx
pop dx pop dx
pop ax pop ax
retsb: .retsb:
popfd popfd
ret ret
end if
;Set bank function for Intel 810/815 chipsets ;Set bank function for Intel 810/815 chipsets
; *****Modified by Protopopius, Russia.***** ; *****Modified by Protopopius, Russia.*****
; ********* http://menuetos.hut.ru ************** ; ********* http://menuetos.hut.ru **************
; ************************************************ ; ************************************************
;
;set_bank: if INTEL_VIDEO
;cli
;cmp al,[BANK_RW] set_bank:
;je retsb pushfd
;mov [BANK_RW],al cli
;push ax
;push dx cmp al,[BANK_RW]
;mov dx,3CEh je .retsb
;mov ah,al ; Save value for later use
;mov al,10h ; Index GR10 (Address Mapping) mov [BANK_RW],al
;out dx,al ; Select GR10 push ax
;inc dl push dx
;mov al,3 ; Set bits 0 and 1 (Enable linear page mapping) mov dx,3CEh
;out dx,al ; Write value mov ah,al ; Save value for later use
;dec dl mov al,10h ; Index GR10 (Address Mapping)
;mov al,11h ; Index GR11 (Page Selector) out dx,al ; Select GR10
;out dx,al ; Select GR11 inc dl
;inc dl mov al,3 ; Set bits 0 and 1 (Enable linear page mapping)
;mov al,ah ; Write address out dx,al ; Write value
;out dx,al ; Write the value dec dl
;pop dx mov al,11h ; Index GR11 (Page Selector)
;pop ax out dx,al ; Select GR11
;retsb: inc dl
;sti mov al,ah ; Write address
;ret out dx,al ; Write the value
pop dx
pop ax
.retsb:
popfd
ret
end if
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!} ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}
;set_bank: if (TRIDENT or S3_VIDEO or INTEL_VIDEO)
; cli else
; cmp al,[BANK_RW] set_bank:
; je retsb pushfd
; mov [BANK_RW],al cli
; push ax
; push dx
; mov ah,al
; mov dx,0x03D4
; mov al,0x39
; out dx,al
; inc dl
; mov al,0xA5
; out dx,al
; dec dl
; mov al,6Ah
; out dx,al
; inc dl
; mov al,ah
; out dx,al
; dec dl
; mov al,0x39
; out dx,al
; inc dl
; mov al,0x5A
; out dx,al
; dec dl
; pop dx
; pop ax
;
; retsb:
; ret
cmp al,[BANK_RW]
je .retsb
mov [BANK_RW],al
push ax
push dx
mov ah,al
mov dx,0x03D4
mov al,0x39
out dx,al
inc dl
mov al,0xA5
out dx,al
dec dl
mov al,6Ah
out dx,al
inc dl
mov al,ah
out dx,al
dec dl
mov al,0x39
out dx,al
inc dl
mov al,0x5A
out dx,al
dec dl
pop dx
pop ax
.retsb:
popfd
ret
end if
vesa12_drawbackground: vesa12_drawbackground:
@ -289,9 +332,8 @@ vesa12_drawbackground:
mov eax,[BytesPerScanLine] mov eax,[BytesPerScanLine]
mov ebx,edi mov ebx,edi
mul ebx mul ebx
add eax,esi add eax, esi
add eax,esi lea eax, [VGABasePtr+eax+esi*2]
add eax,esi
cmp [ScreenBPP],byte 24 cmp [ScreenBPP],byte 24
jz v12bgl3 jz v12bgl3
add eax,esi add eax,esi
@ -301,7 +343,7 @@ vesa12_drawbackground:
push ebx push ebx
push eax push eax
sub eax,[LFBAddress] sub eax,VGABasePtr
shr eax,16 shr eax,16
call set_bank call set_bank
@ -372,7 +414,7 @@ vesa12_drawbar:
dbpi2412: dbpi2412:
add eax,[LFBAddress] add eax,VGABasePtr
mov edi,eax mov edi,eax
; x size ; x size
@ -449,7 +491,7 @@ dbpi24bit12:
xor edx,edx xor edx,edx
mov eax,edi mov eax,edi
sub eax,[LFBAddress] sub eax,VGABasePtr
mov ebx,3 mov ebx,3
div ebx div ebx
add eax,WinMapAddress add eax,WinMapAddress
@ -472,7 +514,7 @@ dbpi24bit12:
push edi push edi
mov eax,edi mov eax,edi
sub eax,[LFBAddress] sub eax,VGABasePtr
shr eax,16 shr eax,16
call set_bank call set_bank
and edi,0xffff and edi,0xffff
@ -541,7 +583,7 @@ dbpi24bit12:
push ecx push ecx
mov eax,edi mov eax,edi
sub eax,[LFBAddress] sub eax,VGABasePtr
shr eax,2 shr eax,2
add eax,WinMapAddress add eax,WinMapAddress
mov ebx,[CURRENT_TASK] mov ebx,[CURRENT_TASK]
@ -563,7 +605,7 @@ dbpi24bit12:
push edi push edi
mov eax,edi mov eax,edi
sub eax,[LFBAddress] sub eax,VGABasePtr
shr eax,16 shr eax,16
call set_bank call set_bank
and edi,0xffff and edi,0xffff
@ -738,7 +780,7 @@ vesa12_putimage:
pi2412: pi2412:
add eax,[LFBAddress] add eax,VGABasePtr
mov edi,eax mov edi,eax
; x size ; x size
@ -785,7 +827,7 @@ vesa12_putimage:
push ebx push ebx
mov edx,edi mov edx,edi
sub edx,[LFBAddress] sub edx,VGABasePtr
mov ebx,3 mov ebx,3
div ebx div ebx
add edx,WinMapAddress add edx,WinMapAddress
@ -809,7 +851,7 @@ vesa12_putimage:
push edi push edi
push eax push eax
mov eax,edi mov eax,edi
sub eax,[LFBAddress] sub eax,VGABasePtr
shr eax,16 shr eax,16
call set_bank call set_bank
pop eax pop eax
@ -855,7 +897,7 @@ vesa12_putimage:
push ebx push ebx
mov edx,edi mov edx,edi
sub edx,[LFBAddress] sub edx,VGABasePtr
shr edx,2 shr edx,2
add edx,WinMapAddress add edx,WinMapAddress
mov ebx,[CURRENT_TASK] mov ebx,[CURRENT_TASK]
@ -878,7 +920,7 @@ vesa12_putimage:
push edi push edi
push eax push eax
mov eax,edi mov eax,edi
sub eax,[LFBAddress] sub eax,VGABasePtr
shr eax,16 shr eax,16
call set_bank call set_bank
pop eax pop eax