2007-03-26 14:18:08 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
2008-12-28 22:21:41 +01:00
|
|
|
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
|
2007-03-26 14:18:08 +02:00
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
;; ;;
|
|
|
|
;; VESA12.INC ;;
|
|
|
|
;; ;;
|
|
|
|
;; Vesa 1.2 functions for MenuetOS ;;
|
|
|
|
;; ;;
|
|
|
|
;; Copyright 2002 Ville Turjanmaa ;;
|
|
|
|
;; ;;
|
|
|
|
;; quickcode@mail.ru - bankswitch for S3 cards ;;
|
|
|
|
;; ;;
|
|
|
|
;; See file COPYING for details ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2005-10-06 19:56:22 +02:00
|
|
|
|
2007-07-27 15:52:03 +02:00
|
|
|
$Revision$
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
2007-11-16 09:28:33 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
; A complete video driver should include the following types of function
|
|
|
|
;
|
|
|
|
; Putpixel
|
|
|
|
; Getpixel
|
|
|
|
;
|
|
|
|
; Drawimage
|
|
|
|
; Drawbar
|
|
|
|
;
|
|
|
|
; Drawbackground
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; Modifying the set_bank -function is mostly enough
|
|
|
|
; for different Vesa 1.2 setups.
|
|
|
|
|
2005-10-13 07:34:10 +02:00
|
|
|
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
; set_bank for Trident videocards, work on Trident 9440
|
|
|
|
; modified by Mario79
|
2005-10-06 19:56:22 +02:00
|
|
|
|
2007-11-16 09:28:33 +01:00
|
|
|
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
|
2005-10-13 07:34:10 +02:00
|
|
|
|
|
|
|
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
; set_bank for S3 videocards, work on S3 ViRGE PCI (325)
|
2007-02-28 09:52:06 +01:00
|
|
|
; modified by kmeaw
|
2007-11-16 09:28:33 +01:00
|
|
|
|
|
|
|
if S3_VIDEO
|
2007-02-28 09:52:06 +01:00
|
|
|
set_bank:
|
2007-11-16 09:28:33 +01:00
|
|
|
pushfd
|
|
|
|
cli
|
|
|
|
cmp al,[BANK_RW]
|
|
|
|
je .retsb
|
|
|
|
|
|
|
|
mov [BANK_RW],al
|
|
|
|
push ax
|
|
|
|
push dx
|
|
|
|
push cx
|
|
|
|
mov cl, al
|
|
|
|
mov dx, 0x3D4
|
|
|
|
mov al, 0x38
|
|
|
|
out dx, al ;CR38 Register Lock 1 ;Note: Traditionally 48h is used to
|
|
|
|
;unlock and 00h to lock
|
|
|
|
inc dx
|
|
|
|
mov al, 0x48
|
|
|
|
out dx, al ;3d5 -?
|
|
|
|
dec dx
|
|
|
|
mov al, 0x31
|
|
|
|
out dx, al ;CR31 Memory Configuration Register
|
2005-10-06 19:56:22 +02:00
|
|
|
;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,
|
|
|
|
;for the 864/964 see index 69h.
|
|
|
|
|
2007-11-16 09:28:33 +01:00
|
|
|
inc dx
|
|
|
|
in al, dx
|
|
|
|
dec dx
|
|
|
|
mov ah, al
|
|
|
|
mov al, 0x31
|
|
|
|
out dx, ax
|
|
|
|
mov al, ah
|
|
|
|
or al, 9
|
|
|
|
inc dx
|
|
|
|
out dx, al
|
|
|
|
dec dx
|
|
|
|
mov al, 0x35
|
|
|
|
out dx, al ;CR35 CRT Register Lock
|
|
|
|
inc dx
|
|
|
|
in al, dx
|
|
|
|
dec dx
|
|
|
|
and al, 0xF0
|
|
|
|
mov ch, cl
|
|
|
|
and ch, 0x0F
|
|
|
|
or ch, al
|
|
|
|
mov al, 0x35
|
|
|
|
out dx, al
|
|
|
|
inc dx
|
|
|
|
mov al, ch
|
|
|
|
out dx, ax
|
|
|
|
dec dx
|
|
|
|
mov al, 0x51 ;Extended System Control 2 Register
|
|
|
|
out dx, al
|
|
|
|
inc dx
|
|
|
|
in al, dx
|
|
|
|
dec dx
|
|
|
|
and al, 0xF3
|
|
|
|
shr cl, 2
|
|
|
|
and cl, 0x0C
|
|
|
|
or cl, al
|
|
|
|
mov al, 0x51
|
|
|
|
out dx, al
|
|
|
|
inc dx
|
|
|
|
mov al, cl
|
|
|
|
out dx, al
|
|
|
|
dec dx
|
|
|
|
mov al, 0x38
|
|
|
|
out dx, al
|
|
|
|
inc dx
|
|
|
|
xor al, al
|
|
|
|
out dx, al
|
|
|
|
dec dx
|
|
|
|
pop cx
|
|
|
|
pop dx
|
|
|
|
pop ax
|
|
|
|
.retsb:
|
|
|
|
popfd
|
|
|
|
ret
|
|
|
|
end if
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
;Set bank function for Intel 810/815 chipsets
|
|
|
|
; *****Modified by Protopopius, Russia.*****
|
|
|
|
; ********* http://menuetos.hut.ru **************
|
|
|
|
; ************************************************
|
|
|
|
|
2007-11-16 09:28:33 +01:00
|
|
|
if INTEL_VIDEO
|
2005-10-06 19:56:22 +02:00
|
|
|
|
2007-11-16 09:28:33 +01:00
|
|
|
set_bank:
|
|
|
|
pushfd
|
|
|
|
cli
|
|
|
|
|
|
|
|
cmp al,[BANK_RW]
|
|
|
|
je .retsb
|
|
|
|
|
|
|
|
mov [BANK_RW],al
|
|
|
|
push ax
|
|
|
|
push dx
|
|
|
|
mov dx,3CEh
|
|
|
|
mov ah,al ; Save value for later use
|
|
|
|
mov al,10h ; Index GR10 (Address Mapping)
|
|
|
|
out dx,al ; Select GR10
|
|
|
|
inc dl
|
|
|
|
mov al,3 ; Set bits 0 and 1 (Enable linear page mapping)
|
|
|
|
out dx,al ; Write value
|
|
|
|
dec dl
|
|
|
|
mov al,11h ; Index GR11 (Page Selector)
|
|
|
|
out dx,al ; Select GR11
|
|
|
|
inc dl
|
|
|
|
mov al,ah ; Write address
|
|
|
|
out dx,al ; Write the value
|
|
|
|
pop dx
|
|
|
|
pop ax
|
|
|
|
.retsb:
|
|
|
|
popfd
|
|
|
|
ret
|
|
|
|
end if
|
|
|
|
|
|
|
|
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}
|
2005-10-06 19:56:22 +02:00
|
|
|
|
2007-11-16 09:28:33 +01:00
|
|
|
if (TRIDENT or S3_VIDEO or INTEL_VIDEO)
|
|
|
|
else
|
|
|
|
set_bank:
|
|
|
|
pushfd
|
|
|
|
cli
|
|
|
|
|
|
|
|
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
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
vesa12_drawbackground:
|
|
|
|
|
|
|
|
call [disable_mouse]
|
|
|
|
|
|
|
|
push eax
|
|
|
|
push ebx
|
|
|
|
push ecx
|
|
|
|
push edx
|
|
|
|
|
|
|
|
xor edx,edx
|
2007-05-30 15:48:21 +02:00
|
|
|
mov eax,dword[BgrDataWidth]
|
|
|
|
mov ebx,dword[BgrDataHeight]
|
2005-10-06 19:56:22 +02:00
|
|
|
mul ebx
|
|
|
|
mov ebx,3
|
|
|
|
mul ebx
|
|
|
|
mov [imax],eax
|
2006-08-06 12:29:45 +02:00
|
|
|
mov eax,[draw_data+32+RECT.left]
|
|
|
|
mov ebx,[draw_data+32+RECT.top]
|
2005-10-06 19:56:22 +02:00
|
|
|
mov edi,0 ;no force
|
|
|
|
|
|
|
|
v12dp3:
|
|
|
|
|
|
|
|
push eax
|
|
|
|
push ebx
|
|
|
|
|
2007-05-30 15:48:21 +02:00
|
|
|
cmp [BgrDrawMode],dword 1 ; tiled background
|
2005-10-06 19:56:22 +02:00
|
|
|
jne no_vesa12_tiled_bgr
|
|
|
|
|
|
|
|
push edx
|
|
|
|
|
|
|
|
xor edx,edx
|
2007-05-30 15:48:21 +02:00
|
|
|
div dword [BgrDataWidth]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
2007-05-30 15:48:21 +02:00
|
|
|
push edx
|
2005-10-06 19:56:22 +02:00
|
|
|
mov eax,ebx
|
|
|
|
xor edx,edx
|
2007-05-30 15:48:21 +02:00
|
|
|
div dword [BgrDataHeight]
|
2005-10-06 19:56:22 +02:00
|
|
|
mov ebx,edx
|
|
|
|
pop eax
|
|
|
|
|
|
|
|
pop edx
|
|
|
|
|
|
|
|
no_vesa12_tiled_bgr:
|
|
|
|
|
2007-05-30 15:48:21 +02:00
|
|
|
cmp [BgrDrawMode],dword 2 ; stretched background
|
2005-10-06 19:56:22 +02:00
|
|
|
jne no_vesa12_stretched_bgr
|
|
|
|
|
|
|
|
push edx
|
|
|
|
|
2007-05-30 15:48:21 +02:00
|
|
|
mul dword [BgrDataWidth]
|
2008-02-22 13:38:59 +01:00
|
|
|
mov ecx,[Screen_Max_X]
|
2005-10-06 19:56:22 +02:00
|
|
|
inc ecx
|
|
|
|
div ecx
|
|
|
|
|
|
|
|
push eax
|
|
|
|
mov eax,ebx
|
2007-05-30 15:48:21 +02:00
|
|
|
mul dword [BgrDataHeight]
|
2008-02-22 13:38:59 +01:00
|
|
|
mov ecx,[Screen_Max_Y]
|
2005-10-06 19:56:22 +02:00
|
|
|
inc ecx
|
|
|
|
div ecx
|
|
|
|
mov ebx,eax
|
|
|
|
pop eax
|
|
|
|
|
|
|
|
pop edx
|
|
|
|
|
|
|
|
no_vesa12_stretched_bgr:
|
|
|
|
|
|
|
|
|
2007-05-30 15:48:21 +02:00
|
|
|
mov esi,ebx
|
|
|
|
imul esi, dword [BgrDataWidth]
|
2005-10-06 19:56:22 +02:00
|
|
|
add esi,eax
|
2007-05-30 15:48:21 +02:00
|
|
|
lea esi,[esi*3]
|
2007-04-24 10:56:03 +02:00
|
|
|
add esi,[img_background] ;IMG_BACKGROUND
|
2005-10-06 19:56:22 +02:00
|
|
|
pop ebx
|
|
|
|
pop eax
|
|
|
|
|
|
|
|
v12di4:
|
|
|
|
|
2007-05-30 15:48:21 +02:00
|
|
|
mov cl,[esi+2]
|
|
|
|
shl ecx,16
|
|
|
|
mov cx,[esi]
|
2005-10-06 19:56:22 +02:00
|
|
|
pusha
|
|
|
|
mov esi,eax
|
|
|
|
mov edi,ebx
|
2008-02-22 13:38:59 +01:00
|
|
|
mov eax,[Screen_Max_X]
|
2005-10-06 19:56:22 +02:00
|
|
|
add eax,1
|
|
|
|
mul ebx
|
2007-05-30 15:48:21 +02:00
|
|
|
cmp [eax+esi+WinMapAddress],byte 1
|
2005-10-06 19:56:22 +02:00
|
|
|
jnz v12nbgp
|
2007-03-01 21:32:19 +01:00
|
|
|
mov eax,[BytesPerScanLine]
|
2005-10-06 19:56:22 +02:00
|
|
|
mov ebx,edi
|
|
|
|
mul ebx
|
2007-11-16 09:28:33 +01:00
|
|
|
add eax, esi
|
|
|
|
lea eax, [VGABasePtr+eax+esi*2]
|
2007-03-01 21:32:19 +01:00
|
|
|
cmp [ScreenBPP],byte 24
|
2005-10-06 19:56:22 +02:00
|
|
|
jz v12bgl3
|
|
|
|
add eax,esi
|
|
|
|
|
|
|
|
v12bgl3:
|
|
|
|
|
|
|
|
push ebx
|
|
|
|
push eax
|
|
|
|
|
2007-11-16 09:28:33 +01:00
|
|
|
sub eax,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
shr eax,16
|
|
|
|
call set_bank
|
|
|
|
pop eax
|
|
|
|
and eax,65535
|
2007-03-01 21:32:19 +01:00
|
|
|
add eax,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
pop ebx
|
|
|
|
|
|
|
|
mov [eax],cx
|
|
|
|
add eax,2
|
|
|
|
shr ecx,16
|
|
|
|
mov [eax],cl
|
|
|
|
sti
|
|
|
|
|
|
|
|
v12nbgp:
|
|
|
|
|
|
|
|
popa
|
|
|
|
add esi,3
|
|
|
|
inc eax
|
2006-08-06 12:29:45 +02:00
|
|
|
cmp eax,[draw_data+32+RECT.right]
|
2005-10-06 19:56:22 +02:00
|
|
|
jg v12nodp31
|
|
|
|
jmp v12dp3
|
|
|
|
|
|
|
|
v12nodp31:
|
|
|
|
|
2006-08-06 12:29:45 +02:00
|
|
|
mov eax,[draw_data+32+RECT.left]
|
2005-10-06 19:56:22 +02:00
|
|
|
inc ebx
|
2006-08-06 12:29:45 +02:00
|
|
|
cmp ebx,[draw_data+32+RECT.bottom]
|
2005-10-06 19:56:22 +02:00
|
|
|
jg v12dp4
|
|
|
|
jmp v12dp3
|
|
|
|
|
|
|
|
v12dp4:
|
|
|
|
|
|
|
|
pop edx
|
|
|
|
pop ecx
|
|
|
|
pop ebx
|
|
|
|
pop eax
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
vesa12_drawbar:
|
|
|
|
|
|
|
|
call [disable_mouse]
|
|
|
|
|
|
|
|
;; mov [novesachecksum],dword 0
|
|
|
|
sub edx,ebx
|
|
|
|
sub ecx,eax
|
|
|
|
push esi
|
|
|
|
push edi
|
|
|
|
push eax
|
|
|
|
push ebx
|
|
|
|
push ecx
|
|
|
|
push edx
|
2007-02-28 09:52:06 +01:00
|
|
|
mov ecx,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
add eax,[ecx-twdw+WDATA.box.left]
|
|
|
|
add ebx,[ecx-twdw+WDATA.box.top]
|
2005-10-06 19:56:22 +02:00
|
|
|
push eax
|
|
|
|
mov eax,ebx ; y
|
2007-03-01 21:32:19 +01:00
|
|
|
mov ebx,[BytesPerScanLine]
|
2005-10-06 19:56:22 +02:00
|
|
|
mul ebx
|
|
|
|
pop ecx
|
|
|
|
add eax,ecx ; x
|
|
|
|
add eax,ecx
|
|
|
|
add eax,ecx
|
2007-03-01 21:32:19 +01:00
|
|
|
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x start
|
2005-10-06 19:56:22 +02:00
|
|
|
jz dbpi2412
|
|
|
|
add eax,ecx
|
|
|
|
|
|
|
|
dbpi2412:
|
|
|
|
|
2007-11-16 09:28:33 +01:00
|
|
|
add eax,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
mov edi,eax
|
|
|
|
|
|
|
|
; x size
|
|
|
|
|
|
|
|
mov eax,[esp+4] ; [esp+6]
|
|
|
|
mov ecx,eax
|
|
|
|
add ecx,eax
|
|
|
|
add ecx,eax
|
2007-03-01 21:32:19 +01:00
|
|
|
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
|
2005-10-06 19:56:22 +02:00
|
|
|
jz dbpi24312
|
|
|
|
add ecx,eax
|
|
|
|
|
|
|
|
dbpi24312:
|
|
|
|
|
|
|
|
mov ebx,[esp+0]
|
|
|
|
|
|
|
|
; check limits ?
|
|
|
|
|
|
|
|
push eax
|
|
|
|
push ecx
|
2007-02-28 09:52:06 +01:00
|
|
|
mov eax,[TASK_BASE]
|
|
|
|
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.left]
|
2005-10-06 19:56:22 +02:00
|
|
|
cmp ecx,0
|
|
|
|
jnz dbcblimitlset12
|
2007-02-28 09:52:06 +01:00
|
|
|
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.top]
|
2005-10-06 19:56:22 +02:00
|
|
|
cmp ecx,0
|
|
|
|
jnz dbcblimitlset12
|
2007-02-28 09:52:06 +01:00
|
|
|
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right]
|
2008-02-22 13:38:59 +01:00
|
|
|
cmp ecx,[Screen_Max_X]
|
2005-10-06 19:56:22 +02:00
|
|
|
jnz dbcblimitlset12
|
2007-02-28 09:52:06 +01:00
|
|
|
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom]
|
2008-02-22 13:38:59 +01:00
|
|
|
cmp ecx,[Screen_Max_Y]
|
2005-10-06 19:56:22 +02:00
|
|
|
jnz dbcblimitlset12
|
|
|
|
pop ecx
|
|
|
|
pop eax
|
|
|
|
push dword 0
|
|
|
|
jmp dbcblimitlno12
|
|
|
|
|
|
|
|
dbcblimitlset12:
|
|
|
|
|
|
|
|
pop ecx
|
|
|
|
pop eax
|
|
|
|
push dword 1
|
|
|
|
|
|
|
|
dbcblimitlno12:
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ?
|
2005-10-06 19:56:22 +02:00
|
|
|
jz dbpi24bit12
|
|
|
|
jmp dbpi32bit12
|
|
|
|
|
|
|
|
|
|
|
|
; DRAWBAR 24 BBP
|
|
|
|
|
|
|
|
|
|
|
|
dbpi24bit12:
|
|
|
|
|
|
|
|
push eax
|
|
|
|
push ebx
|
|
|
|
push edx
|
|
|
|
mov eax,ecx
|
|
|
|
mov ebx,3
|
|
|
|
div ebx
|
|
|
|
mov ecx,eax
|
|
|
|
pop edx
|
|
|
|
pop ebx
|
|
|
|
pop eax
|
|
|
|
cld
|
|
|
|
|
|
|
|
dbnewpi12:
|
|
|
|
|
|
|
|
push ebx
|
|
|
|
push edi
|
|
|
|
push ecx
|
|
|
|
|
|
|
|
xor edx,edx
|
|
|
|
mov eax,edi
|
2007-11-16 09:28:33 +01:00
|
|
|
sub eax,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
mov ebx,3
|
|
|
|
div ebx
|
|
|
|
add eax,WinMapAddress
|
2007-02-28 09:52:06 +01:00
|
|
|
mov ebx,[CURRENT_TASK]
|
2005-10-06 19:56:22 +02:00
|
|
|
cld
|
|
|
|
|
|
|
|
dbnp2412:
|
|
|
|
|
|
|
|
mov dl,[eax]
|
|
|
|
push eax
|
|
|
|
push ecx
|
|
|
|
cmp dl,bl
|
|
|
|
jnz dbimp24no12
|
|
|
|
cmp [esp+5*4],dword 0
|
|
|
|
jz dbimp24yes12
|
|
|
|
; call dbcplimit
|
|
|
|
; jnz dbimp24no12
|
|
|
|
|
|
|
|
dbimp24yes12:
|
|
|
|
|
|
|
|
push edi
|
|
|
|
mov eax,edi
|
2007-11-16 09:28:33 +01:00
|
|
|
sub eax,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
shr eax,16
|
|
|
|
call set_bank
|
|
|
|
and edi,0xffff
|
2007-03-01 21:32:19 +01:00
|
|
|
add edi,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
mov eax,[esp+8+3*4+16+4+4]
|
|
|
|
stosw
|
|
|
|
shr eax,16
|
|
|
|
stosb
|
|
|
|
sti
|
|
|
|
pop edi
|
|
|
|
add edi,3
|
|
|
|
pop ecx
|
|
|
|
pop eax
|
|
|
|
inc eax
|
|
|
|
loop dbnp2412
|
|
|
|
jmp dbnp24d12
|
|
|
|
|
|
|
|
dbimp24no12:
|
|
|
|
|
|
|
|
pop ecx
|
|
|
|
pop eax
|
|
|
|
cld
|
|
|
|
add edi,3
|
|
|
|
inc eax
|
|
|
|
loop dbnp2412
|
|
|
|
|
|
|
|
dbnp24d12:
|
|
|
|
|
|
|
|
mov eax,[esp+3*4+16+4]
|
|
|
|
test eax,0x80000000
|
|
|
|
jz nodbgl2412
|
|
|
|
cmp al,0
|
|
|
|
jz nodbgl2412
|
|
|
|
dec eax
|
|
|
|
mov [esp+3*4+16+4],eax
|
|
|
|
|
|
|
|
nodbgl2412:
|
|
|
|
|
|
|
|
pop ecx
|
|
|
|
pop edi
|
|
|
|
pop ebx
|
2007-03-01 21:32:19 +01:00
|
|
|
add edi,[BytesPerScanLine]
|
2005-10-06 19:56:22 +02:00
|
|
|
dec ebx
|
|
|
|
jz dbnonewpi12
|
|
|
|
jmp dbnewpi12
|
|
|
|
|
|
|
|
dbnonewpi12:
|
|
|
|
|
|
|
|
add esp,7*4
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
; DRAWBAR 32 BBP
|
|
|
|
|
|
|
|
|
|
|
|
dbpi32bit12:
|
|
|
|
|
|
|
|
cld
|
|
|
|
shr ecx,2
|
|
|
|
|
|
|
|
dbnewpi3212:
|
|
|
|
|
|
|
|
push ebx
|
|
|
|
push edi
|
|
|
|
push ecx
|
|
|
|
|
|
|
|
mov eax,edi
|
2007-11-16 09:28:33 +01:00
|
|
|
sub eax,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
shr eax,2
|
|
|
|
add eax,WinMapAddress
|
2007-02-28 09:52:06 +01:00
|
|
|
mov ebx,[CURRENT_TASK]
|
2005-10-06 19:56:22 +02:00
|
|
|
cld
|
|
|
|
|
|
|
|
dbnp3212:
|
|
|
|
|
|
|
|
mov dl,[eax]
|
|
|
|
push eax
|
|
|
|
push ecx
|
|
|
|
cmp dl,bl
|
|
|
|
jnz dbimp32no12
|
|
|
|
cmp [esp+5*4],dword 0
|
|
|
|
jz dbimp32yes12
|
|
|
|
; call dbcplimit
|
|
|
|
; jnz dbimp32no12
|
|
|
|
|
|
|
|
dbimp32yes12:
|
|
|
|
|
|
|
|
push edi
|
|
|
|
mov eax,edi
|
2007-11-16 09:28:33 +01:00
|
|
|
sub eax,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
shr eax,16
|
|
|
|
call set_bank
|
|
|
|
and edi,0xffff
|
2007-03-01 21:32:19 +01:00
|
|
|
add edi,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
mov eax,[esp+8+3*4+16+4+4]
|
|
|
|
stosw
|
|
|
|
shr eax,16
|
|
|
|
stosb
|
|
|
|
sti
|
|
|
|
pop edi
|
|
|
|
add edi,4
|
|
|
|
inc ebp
|
|
|
|
pop ecx
|
|
|
|
pop eax
|
|
|
|
inc eax
|
|
|
|
loop dbnp3212
|
|
|
|
jmp dbnp32d12
|
|
|
|
|
|
|
|
dbimp32no12:
|
|
|
|
|
|
|
|
pop ecx
|
|
|
|
pop eax
|
|
|
|
inc eax
|
|
|
|
add edi,4
|
|
|
|
inc ebp
|
|
|
|
loop dbnp3212
|
|
|
|
|
|
|
|
dbnp32d12:
|
|
|
|
|
|
|
|
mov eax,[esp+12+16+4]
|
|
|
|
test eax,0x80000000
|
|
|
|
jz nodbgl3212
|
|
|
|
cmp al,0
|
|
|
|
jz nodbgl3212
|
|
|
|
dec eax
|
|
|
|
mov [esp+12+16+4],eax
|
|
|
|
|
|
|
|
nodbgl3212:
|
|
|
|
|
|
|
|
pop ecx
|
|
|
|
pop edi
|
|
|
|
pop ebx
|
2007-03-01 21:32:19 +01:00
|
|
|
add edi,[BytesPerScanLine]
|
2005-10-06 19:56:22 +02:00
|
|
|
dec ebx
|
|
|
|
jz nodbnewpi3212
|
|
|
|
jmp dbnewpi3212
|
|
|
|
|
|
|
|
nodbnewpi3212:
|
|
|
|
|
|
|
|
add esp,7*4
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
Vesa12_putpixel24:
|
|
|
|
|
|
|
|
mov edi,eax ; x
|
|
|
|
mov eax,ebx ; y
|
|
|
|
lea edi,[edi+edi*2]
|
2007-03-01 21:32:19 +01:00
|
|
|
mov ebx,[BytesPerScanLine]
|
2005-10-06 19:56:22 +02:00
|
|
|
mul ebx
|
|
|
|
add edi,eax
|
|
|
|
mov eax,edi
|
|
|
|
shr eax,16
|
|
|
|
call set_bank
|
|
|
|
and edi,65535
|
2007-03-01 21:32:19 +01:00
|
|
|
add edi,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
mov eax,[esp+28]
|
|
|
|
stosw
|
|
|
|
shr eax,16
|
|
|
|
mov [edi],al
|
|
|
|
sti
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Vesa12_putpixel32:
|
|
|
|
|
|
|
|
mov edi,eax ; x
|
|
|
|
mov eax,ebx ; y
|
|
|
|
shl edi,2
|
2007-03-01 21:32:19 +01:00
|
|
|
mov ebx,[BytesPerScanLine]
|
2005-10-06 19:56:22 +02:00
|
|
|
mul ebx
|
|
|
|
add edi,eax
|
|
|
|
mov eax,edi
|
|
|
|
shr eax,16
|
|
|
|
call set_bank
|
|
|
|
and edi,65535
|
2007-03-01 21:32:19 +01:00
|
|
|
add edi,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
mov ecx,[esp+28]
|
|
|
|
mov [edi],ecx
|
|
|
|
sti
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
Vesa12_getpixel24:
|
|
|
|
|
|
|
|
mov edi,eax ; x
|
|
|
|
mov eax,ebx ; y
|
|
|
|
lea edi,[edi+edi*2]
|
2007-03-01 21:32:19 +01:00
|
|
|
mov ebx,[BytesPerScanLine]
|
2005-10-06 19:56:22 +02:00
|
|
|
mul ebx
|
|
|
|
add edi,eax
|
|
|
|
mov eax,edi
|
|
|
|
shr eax,16
|
|
|
|
call set_bank
|
|
|
|
and edi,65535
|
2007-03-01 21:32:19 +01:00
|
|
|
add edi,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
mov ecx,[edi]
|
|
|
|
and ecx,255*256*256+255*256+255
|
|
|
|
sti
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
Vesa12_getpixel32:
|
|
|
|
|
|
|
|
mov edi,eax ; x
|
|
|
|
mov eax,ebx ; y
|
|
|
|
shl edi,2
|
2007-03-01 21:32:19 +01:00
|
|
|
mov ebx,[BytesPerScanLine]
|
2005-10-06 19:56:22 +02:00
|
|
|
xor edx,edx
|
|
|
|
mul ebx
|
|
|
|
add edi,eax
|
|
|
|
mov eax,edi
|
|
|
|
shr eax,16
|
|
|
|
call set_bank
|
|
|
|
and edi,65535
|
2007-03-01 21:32:19 +01:00
|
|
|
add edi,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
mov ecx,[edi]
|
|
|
|
and ecx,255*256*256+255*256+255
|
|
|
|
sti
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vesa12_putimage:
|
2007-01-19 16:02:33 +01:00
|
|
|
; ebx = pointer to image
|
|
|
|
; ecx = size [x|y]
|
|
|
|
; edx = coordinates [x|y]
|
|
|
|
; ebp = pointer to 'get' function
|
|
|
|
; esi = pointer to 'init' function
|
|
|
|
; edi = parameter for 'get' function
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
; mov ebx,image
|
|
|
|
; mov ecx,320*65536+240
|
|
|
|
; mov edx,20*65536+20
|
|
|
|
|
|
|
|
call [disable_mouse]
|
|
|
|
|
|
|
|
mov [novesachecksum],dword 0
|
|
|
|
push esi
|
|
|
|
push edi
|
|
|
|
push eax
|
|
|
|
push ebx
|
|
|
|
push ecx
|
|
|
|
push edx
|
|
|
|
movzx eax,word [esp+2]
|
|
|
|
movzx ebx,word [esp+0]
|
2007-02-28 09:52:06 +01:00
|
|
|
mov ecx,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
add eax,[ecx-twdw+WDATA.box.left]
|
|
|
|
add ebx,[ecx-twdw+WDATA.box.top]
|
2005-10-06 19:56:22 +02:00
|
|
|
push eax
|
|
|
|
mov eax,ebx ; y
|
2007-03-01 21:32:19 +01:00
|
|
|
mul dword [BytesPerScanLine]
|
2005-10-06 19:56:22 +02:00
|
|
|
pop ecx
|
|
|
|
add eax,ecx ; x
|
|
|
|
add eax,ecx
|
|
|
|
add eax,ecx
|
2007-03-01 21:32:19 +01:00
|
|
|
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x start
|
2005-10-06 19:56:22 +02:00
|
|
|
jz pi2412
|
|
|
|
add eax,ecx
|
|
|
|
|
|
|
|
pi2412:
|
|
|
|
|
2007-11-16 09:28:33 +01:00
|
|
|
add eax,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
mov edi,eax
|
|
|
|
|
|
|
|
; x size
|
|
|
|
|
2007-01-19 16:02:33 +01:00
|
|
|
movzx ecx,word [esp+6]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
mov esi,[esp+8]
|
|
|
|
movzx ebx,word [esp+4]
|
|
|
|
|
|
|
|
; check limits while draw ?
|
|
|
|
|
|
|
|
push ecx
|
2007-02-28 09:52:06 +01:00
|
|
|
mov eax,[TASK_BASE]
|
|
|
|
cmp dword [eax+draw_data-CURRENT_TASK+RECT.left], 0
|
2005-10-06 19:56:22 +02:00
|
|
|
jnz dbcblimitlset212
|
2007-02-28 09:52:06 +01:00
|
|
|
cmp dword [eax+draw_data-CURRENT_TASK+RECT.top], 0
|
2005-10-06 19:56:22 +02:00
|
|
|
jnz dbcblimitlset212
|
2007-02-28 09:52:06 +01:00
|
|
|
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right]
|
2008-02-22 13:38:59 +01:00
|
|
|
cmp ecx,[Screen_Max_X]
|
2005-10-06 19:56:22 +02:00
|
|
|
jnz dbcblimitlset212
|
2007-02-28 09:52:06 +01:00
|
|
|
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom]
|
2008-02-22 13:38:59 +01:00
|
|
|
cmp ecx,[Screen_Max_Y]
|
2005-10-06 19:56:22 +02:00
|
|
|
jnz dbcblimitlset212
|
|
|
|
pop ecx
|
2007-01-19 16:02:33 +01:00
|
|
|
push 0
|
2005-10-06 19:56:22 +02:00
|
|
|
jmp dbcblimitlno212
|
|
|
|
|
|
|
|
dbcblimitlset212:
|
|
|
|
|
|
|
|
pop ecx
|
2007-01-19 16:02:33 +01:00
|
|
|
push 1
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
dbcblimitlno212:
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ?
|
2007-01-19 16:02:33 +01:00
|
|
|
jnz pi32bit12
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
pi24bit12:
|
|
|
|
|
|
|
|
newpi12:
|
|
|
|
|
|
|
|
push edi
|
|
|
|
push ecx
|
|
|
|
push ebx
|
|
|
|
|
2007-01-19 16:02:33 +01:00
|
|
|
mov edx,edi
|
2007-11-16 09:28:33 +01:00
|
|
|
sub edx,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
mov ebx,3
|
|
|
|
div ebx
|
2007-01-19 16:02:33 +01:00
|
|
|
add edx,WinMapAddress
|
2007-02-28 09:52:06 +01:00
|
|
|
mov ebx,[CURRENT_TASK]
|
2007-01-19 16:02:33 +01:00
|
|
|
mov bh,[esp+4*3]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
np2412:
|
|
|
|
|
2007-01-19 16:02:33 +01:00
|
|
|
cmp bl,[edx]
|
2005-10-06 19:56:22 +02:00
|
|
|
jnz imp24no12
|
2007-01-19 16:02:33 +01:00
|
|
|
; mov eax,[esi]
|
|
|
|
push dword [esp+4*3+20]
|
|
|
|
call ebp
|
|
|
|
; cmp bh,0
|
|
|
|
; jz imp24yes12
|
2005-10-06 19:56:22 +02:00
|
|
|
; call dbcplimit
|
|
|
|
; jnz imp24no12
|
|
|
|
|
|
|
|
imp24yes12:
|
|
|
|
|
|
|
|
push edi
|
2007-01-19 16:02:33 +01:00
|
|
|
push eax
|
2005-10-06 19:56:22 +02:00
|
|
|
mov eax,edi
|
2007-11-16 09:28:33 +01:00
|
|
|
sub eax,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
shr eax,16
|
|
|
|
call set_bank
|
2007-01-19 16:02:33 +01:00
|
|
|
pop eax
|
2005-10-06 19:56:22 +02:00
|
|
|
and edi,0xffff
|
2007-03-01 21:32:19 +01:00
|
|
|
add edi,VGABasePtr
|
2007-01-19 16:02:33 +01:00
|
|
|
mov [edi],ax
|
|
|
|
shr eax,16
|
|
|
|
mov [edi+2],al
|
2005-10-06 19:56:22 +02:00
|
|
|
pop edi
|
|
|
|
|
|
|
|
imp24no12:
|
|
|
|
|
2007-01-19 16:02:33 +01:00
|
|
|
inc edx
|
|
|
|
; add esi,3
|
2005-10-06 19:56:22 +02:00
|
|
|
add edi,3
|
|
|
|
dec ecx
|
|
|
|
jnz np2412
|
|
|
|
|
|
|
|
np24d12:
|
|
|
|
|
|
|
|
pop ebx
|
|
|
|
pop ecx
|
|
|
|
pop edi
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
add edi,[BytesPerScanLine]
|
2007-02-02 16:09:14 +01:00
|
|
|
add esi,[esp+32]
|
2008-11-06 09:56:18 +01:00
|
|
|
cmp ebp,putimage_get1bpp
|
|
|
|
jz .correct
|
2008-11-11 11:55:26 +01:00
|
|
|
cmp ebp,putimage_get2bpp
|
|
|
|
jz .correct
|
2008-11-06 09:56:18 +01:00
|
|
|
cmp ebp,putimage_get4bpp
|
|
|
|
jnz @f
|
|
|
|
.correct:
|
|
|
|
mov eax,[esp+20]
|
|
|
|
mov byte[eax],80h
|
|
|
|
@@:
|
2005-10-06 19:56:22 +02:00
|
|
|
dec ebx
|
2007-01-19 16:02:33 +01:00
|
|
|
jnz newpi12
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
nonewpi12:
|
|
|
|
|
2007-01-19 16:02:33 +01:00
|
|
|
pop eax edx ecx ebx eax edi esi
|
|
|
|
xor eax, eax
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
pi32bit12:
|
|
|
|
|
|
|
|
newpi3212:
|
|
|
|
|
|
|
|
push edi
|
|
|
|
push ecx
|
|
|
|
push ebx
|
|
|
|
|
2007-01-19 16:02:33 +01:00
|
|
|
mov edx,edi
|
2007-11-16 09:28:33 +01:00
|
|
|
sub edx,VGABasePtr
|
2007-01-19 16:02:33 +01:00
|
|
|
shr edx,2
|
|
|
|
add edx,WinMapAddress
|
2007-02-28 09:52:06 +01:00
|
|
|
mov ebx,[CURRENT_TASK]
|
2007-01-19 16:02:33 +01:00
|
|
|
mov bh,[esp+4*3]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
np3212:
|
|
|
|
|
2007-01-19 16:02:33 +01:00
|
|
|
cmp bl,[edx]
|
2005-10-06 19:56:22 +02:00
|
|
|
jnz imp32no12
|
2007-01-19 16:02:33 +01:00
|
|
|
; mov eax,[esi]
|
|
|
|
push dword [esp+4*3+20]
|
|
|
|
call ebp
|
|
|
|
; cmp bh,0
|
|
|
|
; jz imp32yes12
|
2005-10-06 19:56:22 +02:00
|
|
|
; call dbcplimit
|
|
|
|
; jnz imp32no12
|
|
|
|
|
|
|
|
imp32yes12:
|
|
|
|
|
|
|
|
push edi
|
2007-01-19 16:02:33 +01:00
|
|
|
push eax
|
2005-10-06 19:56:22 +02:00
|
|
|
mov eax,edi
|
2007-11-16 09:28:33 +01:00
|
|
|
sub eax,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
shr eax,16
|
|
|
|
call set_bank
|
2007-01-19 16:02:33 +01:00
|
|
|
pop eax
|
2005-10-06 19:56:22 +02:00
|
|
|
and edi,0xffff
|
2007-03-01 21:32:19 +01:00
|
|
|
mov [edi+VGABasePtr],eax
|
2005-10-06 19:56:22 +02:00
|
|
|
pop edi
|
|
|
|
|
|
|
|
imp32no12:
|
|
|
|
|
2007-01-19 16:02:33 +01:00
|
|
|
inc edx
|
|
|
|
; add esi,3
|
2005-10-06 19:56:22 +02:00
|
|
|
add edi,4
|
|
|
|
dec ecx
|
|
|
|
jnz np3212
|
|
|
|
|
|
|
|
np32d12:
|
|
|
|
|
|
|
|
pop ebx
|
|
|
|
pop ecx
|
|
|
|
pop edi
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
add edi,[BytesPerScanLine]
|
2008-11-06 09:56:18 +01:00
|
|
|
cmp ebp,putimage_get1bpp
|
|
|
|
jz .correct
|
2008-11-11 11:55:26 +01:00
|
|
|
cmp ebp,putimage_get2bpp
|
|
|
|
jz .correct
|
2008-11-06 09:56:18 +01:00
|
|
|
cmp ebp,putimage_get4bpp
|
|
|
|
jnz @f
|
|
|
|
.correct:
|
|
|
|
mov eax,[esp+20]
|
|
|
|
mov byte[eax],80h
|
|
|
|
@@:
|
2005-10-06 19:56:22 +02:00
|
|
|
dec ebx
|
2007-01-19 16:02:33 +01:00
|
|
|
jnz newpi3212
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
nonewpi3212:
|
|
|
|
|
2007-01-19 16:02:33 +01:00
|
|
|
pop eax edx ecx ebx eax edi esi
|
|
|
|
xor eax, eax
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
vesa12_read_screen_pixel:
|
|
|
|
|
|
|
|
and eax,0x3FFFFF
|
2007-03-01 21:32:19 +01:00
|
|
|
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ?
|
2005-10-06 19:56:22 +02:00
|
|
|
jz v12rsp24
|
|
|
|
mov edi,eax
|
|
|
|
shl edi,2
|
|
|
|
mov eax,edi
|
|
|
|
shr eax,16
|
|
|
|
call set_bank
|
|
|
|
and edi,65535
|
2007-03-01 21:32:19 +01:00
|
|
|
add edi,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
mov eax,[edi]
|
|
|
|
and eax,0x00ffffff
|
|
|
|
ret
|
|
|
|
v12rsp24:
|
|
|
|
|
|
|
|
imul eax,3
|
|
|
|
mov edi,eax
|
|
|
|
shr eax,16
|
|
|
|
call set_bank
|
|
|
|
and edi,65535
|
2007-03-01 21:32:19 +01:00
|
|
|
add edi,VGABasePtr
|
2005-10-06 19:56:22 +02:00
|
|
|
mov eax,[edi]
|
|
|
|
and eax,0x00ffffff
|
|
|
|
ret
|
|
|
|
|
|
|
|
|