Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 133 → Rev 384

/kernel/branches/gfx_kernel/video/arrow.cur
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/kernel/branches/gfx_kernel/video/cursors.inc
0,0 → 1,746
 
LOAD_FROM_FILE equ 0
LOAD_FROM_MEM equ 1
LOAD_INDIRECT equ 2
LOAD_SYSTEM equ 3
VIDEO_FREE equ 2
 
struc BITMAPINFOHEADER {
.biSize dd ? ; DWORD
.biWidth dd ? ; LONG
.biHeight dd ? ; LONG
.biPlanes dw ? ; WORD
.biBitCount dw ? ; WORD
.biCompression dd ? ; DWORD
.biSizeImage dd ? ; DWORD
.biXPelsPerMeter dd ? ; LONG
.biYPelsPerMeter dd ? ; LONG
.biClrUsed dd ? ; DWORD
.biClrImportant dd ? ; DWORD
}
 
virtual at 0
BI BITMAPINFOHEADER
end virtual
 
align 4
proc vesa_init_cursor stdcall, dst:dword, src:dword
locals
rBase dd ?
pQuad dd ?
pBits dd ?
pAnd dd ?
width dd ?
height dd ?
counter dd ?
endl
 
mov esi, [src]
add esi,[esi+18]
mov eax,esi
 
cmp [esi+BI.biBitCount], 24
je .img_24
cmp [esi+BI.biBitCount], 8
je .img_8
cmp [esi+BI.biBitCount], 4
je .img_4
 
.img_2:
add eax, [esi]
mov [pQuad],eax
add eax,8
mov [pBits],eax
add eax, 128
mov [pAnd],eax
mov eax,[esi+4]
mov [width],eax
mov ebx,[esi+8]
shr ebx,1
mov [height],ebx
 
mov edi, [dst]
add edi, 32*31*4
mov [rBase],edi
 
mov esi,[pQuad]
.l21:
mov ebx, [pBits]
mov ebx, [ebx]
bswap ebx
mov eax, [pAnd]
mov eax, [eax]
bswap eax
mov [counter], 32
@@:
xor edx, edx
shl eax,1
setc dl
dec edx
 
xor ecx, ecx
shl ebx,1
setc cl
mov ecx, [esi+ecx*4]
and ecx, edx
and edx, 0xFF000000
or edx, ecx
mov [edi], edx
 
add edi, 4
dec [counter]
jnz @B
 
add [pBits], 4
add [pAnd], 4
mov edi,[rBase]
sub edi,128
mov [rBase],edi
sub [height],1
jnz .l21
ret
 
.img_4:
add eax, [esi]
mov [pQuad],eax
add eax,64
mov [pBits],eax
add eax, 0x200
mov [pAnd],eax
mov eax,[esi+4]
mov [width],eax
mov ebx,[esi+8]
shr ebx,1
mov [height],ebx
 
mov edi, [dst]
add edi, 32*31*4
mov [rBase],edi
 
mov esi,[pQuad]
mov ebx, [pBits]
.l4:
mov eax, [pAnd]
mov eax, [eax]
bswap eax
mov [counter], 16
@@:
xor edx, edx
shl eax,1
setc dl
dec edx
 
movzx ecx, byte [ebx]
and cl, 0xF0
shr ecx, 2
mov ecx, [esi+ecx]
and ecx, edx
and edx, 0xFF000000
or edx, ecx
mov [edi], edx
 
xor edx, edx
shl eax,1
setc dl
dec edx
 
movzx ecx, byte [ebx]
and cl, 0x0F
mov ecx, [esi+ecx*4]
and ecx, edx
and edx, 0xFF000000
or edx, ecx
mov [edi+4], edx
 
inc ebx
add edi, 8
dec [counter]
jnz @B
 
add [pAnd], 4
mov edi,[rBase]
sub edi,128
mov [rBase],edi
sub [height],1
jnz .l4
ret
.img_8:
add eax, [esi]
mov [pQuad],eax
add eax,1024
mov [pBits],eax
add eax, 1024
mov [pAnd],eax
mov eax,[esi+4]
mov [width],eax
mov ebx,[esi+8]
shr ebx,1
mov [height],ebx
 
mov edi, [dst]
add edi, 32*31*4
mov [rBase],edi
 
mov esi,[pQuad]
mov ebx, [pBits]
.l81:
mov eax, [pAnd]
mov eax, [eax]
bswap eax
mov [counter], 32
@@:
xor edx, edx
shl eax,1
setc dl
dec edx
 
movzx ecx, byte [ebx]
mov ecx, [esi+ecx*4]
and ecx, edx
and edx, 0xFF000000
or edx, ecx
mov [edi], edx
 
inc ebx
add edi, 4
dec [counter]
jnz @B
 
add [pAnd], 4
mov edi,[rBase]
sub edi,128
mov [rBase],edi
sub [height],1
jnz .l81
ret
.img_24:
add eax, [esi]
mov [pQuad],eax
add eax, 0xC00
mov [pAnd],eax
mov eax,[esi+BI.biWidth]
mov [width],eax
mov ebx,[esi+BI.biHeight]
shr ebx,1
mov [height],ebx
 
mov edi, [dst]
add edi, 32*31*4
mov [rBase],edi
 
mov esi,[pAnd]
mov ebx, [pQuad]
.row_24:
mov eax, [esi]
bswap eax
mov [counter], 32
@@:
xor edx, edx
shl eax,1
setc dl
dec edx
 
mov ecx, [ebx]
and ecx, 0x00FFFFFF
and ecx, edx
and edx, 0xFF000000
or edx, ecx
mov [edi], edx
add ebx, 3
add edi, 4
dec [counter]
jnz @B
 
add esi, 4
mov edi,[rBase]
sub edi,128
mov [rBase],edi
sub [height],1
jnz .row_24
ret
endp
 
align 4
proc set_cursor stdcall, hcursor:dword
mov eax, [hcursor]
cmp [eax+CURSOR.magic], 'CURS'
jne .fail
; cmp [eax+CURSOR.size], CURSOR_SIZE
; jne .fail
mov ebx, [CURRENT_TASK]
shl ebx, 8
xchg eax, [ebx+SLOT_BASE+APPDATA.cursor]
ret
.fail:
mov eax, [def_cursor]
mov ebx, [CURRENT_TASK]
shl ebx, 8
xchg eax, [ebx+SLOT_BASE+APPDATA.cursor]
ret
endp
 
; param
; eax= pid
; ebx= src
; ecx= flags
 
vesa_cursor:
.src equ esp
.flags equ esp+4
.hcursor equ esp+8
 
sub esp, 4 ;space for .hcursor
push ecx
push ebx
 
mov ebx, eax
mov eax, CURSOR_SIZE
call create_kernel_object
test eax, eax
jz .fail
 
mov [.hcursor],eax
 
xor ebx, ebx
mov [eax+CURSOR.magic], 'CURS'
mov [eax+CURSOR.destroy], destroy_cursor
mov [eax+CURSOR.hot_x], ebx
mov [eax+CURSOR.hot_y], ebx
 
stdcall kernel_alloc, 0x1000
test eax, eax
jz .fail
 
mov edi, [.hcursor]
mov [edi+CURSOR.base], eax
 
mov esi, [.src]
mov ebx, [.flags]
cmp bx, LOAD_INDIRECT
je .indirect
 
movzx ecx, word [esi+10]
movzx edx, word [esi+12]
mov [edi+CURSOR.hot_x], ecx
mov [edi+CURSOR.hot_y], edx
 
stdcall vesa_init_cursor, eax, esi
mov eax, [.hcursor]
.fail:
add esp, 12
ret
.indirect:
shr ebx, 16
movzx ecx, bh
movzx edx, bl
mov [eax+CURSOR.hot_x], ecx
mov [eax+CURSOR.hot_y], edx
 
xchg edi, eax
mov ecx, 1024
cld
rep movsd
add esp, 12
ret
 
align 4
proc load_cursor stdcall, src:dword, flags:dword
locals
handle dd ?
endl
 
xor eax, eax
mov [handle], eax
cmp word [flags], LOAD_FROM_FILE
jne @F
 
stdcall load_file, [src]
test eax, eax
jz .exit
mov [src], eax
@@:
mov eax, [CURRENT_TASK]
shl eax, 5
mov eax, [CURRENT_TASK+eax+4]
mov ebx, [src]
mov ecx, [flags]
call [create_cursor] ;eax, ebx, ecx
mov [handle], eax
.fail:
cmp word [flags], LOAD_FROM_FILE
jne .exit
stdcall kernel_free, [src]
.exit:
mov eax, [handle]
ret
endp
 
align 4
proc delete_cursor stdcall, hcursor:dword
locals
hsrv dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
 
mov esi, [hcursor]
cmp [esi+CURSOR.magic], 'CURS'
jne .fail
; cmp [esi+CURSOR.size], CURSOR_SIZE
; jne .fail
 
mov ebx, [CURRENT_TASK]
shl ebx, 5
mov ebx, [CURRENT_TASK+ebx+4]
cmp ebx, [esi+CURSOR.pid]
jne .fail
 
mov ebx, [CURRENT_TASK]
shl ebx, 8
cmp esi, [ebx+SLOT_BASE+APPDATA.cursor]
jne @F
mov eax, [def_cursor]
mov [ebx+SLOT_BASE+APPDATA.cursor], eax
@@:
mov eax, [hcursor]
call [eax+APPOBJ.destroy]
.fail:
ret
endp
 
; param
; eax= cursor
 
align 4
destroy_cursor:
 
push eax
stdcall kernel_free, [eax+CURSOR.base]
pop eax
 
call destroy_kernel_object
ret
 
align 4
proc init_cursors
cmp [SCR_MODE],word 0x13
jbe .fail
 
movzx eax, byte [ScreenBPP]
mov ebx, [BytesPerScanLine]
cmp eax, 32
jne @F
sub ebx, 128
jmp .init
@@:
cmp eax, 24
jne .fail
sub ebx, 96
.init:
mov [cur_def_interl], ebx
 
stdcall load_driver, szHwMouse
mov [hw_cursor], eax
test eax, eax
jz .sw_mouse
 
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
mov [def_cursor], eax
ret
.sw_mouse:
mov [create_cursor], vesa_cursor
 
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
mov [def_cursor], eax
 
mov ecx, [ScreenWidth]
mov edx, [ScreenHeight]
inc ecx
inc edx
mov [scr_width], ecx
mov [scr_height], edx
 
movzx ebx, byte [ScreenBPP]
cmp ebx, 32
jne @F
 
mov dword [set_hw_cursor], cursor_32
mov dword [hw_restore], restore_32
ret
@@:
mov dword [set_hw_cursor], cursor_24
mov dword [hw_restore], restore_24
ret
.fail:
xor eax, eax
mov dword [set_hw_cursor], eax
mov dword [hw_restore], eax
ret
endp
 
align 4
proc restore_24 stdcall, x:dword, y:dword
locals
w dd ?
endl
 
mov edi, [cur_saved_base]
mov edx, [cur_saved_h]
mov ebx, [cur_saved_interl]
 
mov esi, cur_saved_data
@@:
mov ecx, [cur_saved_w]
lea ecx, [ecx+ecx*2]
rep movsb
add edi, ebx
dec edx
jnz @B
ret
endp
 
align 4
proc restore_32 stdcall, x:dword, y:dword
locals
w dd ?
endl
 
mov edi, [cur_saved_base]
mov edx, [cur_saved_h]
mov ebx, [cur_saved_interl]
 
mov esi, cur_saved_data
@@:
mov ecx, [cur_saved_w]
rep movsd
add edi, ebx
dec edx
jnz @B
ret
endp
 
align 4
proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword
locals
w dd ?
h dd ?
st dd ?
_dx dd ?
_dy dd ?
endl
 
mov esi, [hcursor]
mov ecx, [x]
mov eax, [y]
mov ebx, [BytesPerScanLine]
 
xor edx, edx
sub ecx, [esi+CURSOR.hot_x]
mov [x], ecx
sets dl
dec edx
and ecx, edx ;clip x to 0<=x
mov edi, ecx
sub edi, [x]
mov [_dx], edi
 
xor edx, edx
sub eax, [esi+CURSOR.hot_y]
mov [y], eax
sets dl
dec edx
and eax, edx ;clip y to 0<=y
mov edi, eax
sub edi, [y]
mov [_dy], edi
 
mul ebx
lea esi, [ecx+ecx*2]
add esi, [LFBAddress]
add esi, eax
mov [cur_saved_base],esi
 
mov edi, [scr_width]
mov edx, [scr_height]
mov eax, 32
 
sub edi, ecx
cmp edi, eax
jng @F
mov edi, eax
@@:
sub edi, [_dx]
 
sub edx, [y]
cmp edx, eax
jng @F
mov edx, eax
@@:
sub edx, [_dy]
 
mov [w], edi
mov [h], edx
mov [cur_saved_w], edi
mov [cur_saved_h], edx
 
sub eax, edi
shl eax, 2 ;lea eax, [eax+eax*2]
lea edi, [edi+edi*2]
sub ebx, edi
mov [cur_saved_interl], ebx
 
mov edi, cur_saved_data
@@:
mov ecx, [w]
lea ecx, [ecx+ecx*2]
rep movsb
add esi, ebx
dec edx
jnz @B
 
;draw cursor
mov edx, eax
mov edi, [cur_saved_base]
mov eax, [_dy]
shl eax, 5
add eax, [_dx]
shl eax, 2
 
mov esi, [hcursor]
mov esi, [esi+CURSOR.base]
add esi, eax
.row:
mov ecx, [w]
.pix:
lodsd
test eax, 0xFF000000
jz @F
 
mov word [edi], ax
shr eax, 16
mov [edi+2],al
@@:
add edi, 3
dec ecx
jnz .pix
 
add esi, edx
add edi, ebx
dec [h]
jnz .row
ret
endp
 
align 4
proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword
locals
w dd ?
h dd ?
st dd ?
_dx dd ?
_dy dd ?
endl
 
mov esi, [hcursor]
mov ecx, [x]
mov eax, [y]
mov ebx, [BytesPerScanLine]
 
xor edx, edx
sub ecx, [esi+CURSOR.hot_x]
mov [x], ecx
sets dl
dec edx
and ecx, edx ;clip x to 0<=x
mov edi, ecx
sub edi, [x]
mov [_dx], edi
 
xor edx, edx
sub eax, [esi+CURSOR.hot_y]
mov [y], eax
sets dl
dec edx
and eax, edx ;clip y to 0<=y
mov edi, eax
sub edi, [y]
mov [_dy], edi
 
mul ebx
lea esi, [eax+ecx*4]
add esi, [LFBAddress]
mov [cur_saved_base],esi
 
mov edi, [scr_width]
mov edx, [scr_height]
mov eax, 32
 
sub edi, ecx
cmp edi, eax
jng @F
mov edi, eax
@@:
sub edi, [_dx]
 
sub edx, [y]
cmp edx, eax
jng @F
mov edx, eax
@@:
sub edx, [_dy]
 
mov [w], edi
mov [h], edx
mov [cur_saved_w], edi
mov [cur_saved_h], edx
 
sub eax, edi
shl eax, 2
shl edi, 2
sub ebx, edi
mov [cur_saved_interl], ebx
 
mov edi, cur_saved_data
@@:
mov ecx, [w]
rep movsd
add esi, ebx
dec edx
jnz @B
 
;draw cursor
mov edx, eax
mov edi, [cur_saved_base]
mov eax, [_dy]
shl eax, 5
add eax, [_dx]
shl eax, 2
 
mov esi, [hcursor]
mov esi, [esi+CURSOR.base]
add esi, eax
.row:
mov ecx, [w]
.pix:
lodsd
test eax, 0xFF000000
jz @F
mov [edi], eax
@@:
add edi, 4
dec ecx
jnz .pix
add esi, edx
add edi, ebx
dec [h]
jnz .row
ret
endp
 
align 4
def_arrow:
file 'arrow.cur'
 
/kernel/branches/gfx_kernel/video/vesa12.inc
32,9 → 32,9
; modified by Mario79
;set_bank:
;cli
;cmp al,[0xfff2]
;cmp al,[BANK_RW]
;je retsb
;mov [0xfff2],al
;mov [BANK_RW],al
;push dx
;mov dx,3D8h
;out dx,al
50,9 → 50,9
set_bank:
pushfd
cli
cmp al,[0xfff2]
cmp al,[BANK_RW]
je retsb
mov [0xfff2],al
mov [BANK_RW],al
push ax
push dx
push cx
132,9 → 132,9
;
;set_bank:
;cli
;cmp al,[0xfff2]
;cmp al,[BANK_RW]
;je retsb
;mov [0xfff2],al
;mov [BANK_RW],al
;push ax
;push dx
;mov dx,3CEh
160,9 → 160,9
 
;set_bank:
; cli
; cmp al,[0xfff2]
; cmp al,[BANK_RW]
; je retsb
; mov [0xfff2],al
; mov [BANK_RW],al
; push ax
; push dx
; mov ah,al
216,7 → 216,7
 
push eax
push ebx
mov esi,0x300000
mov esi,IMG_BACKGROUND
 
cmp [WinMapAddress-12],dword 1 ; tiled background
jne no_vesa12_tiled_bgr
247,7 → 247,7
 
imul eax,dword [WinMapAddress-8]
xor edx,edx
mov ecx,[0xfe00]
mov ecx,[ScreenWidth]
inc ecx
div ecx
 
255,7 → 255,7
mov eax,ebx
imul eax,dword [WinMapAddress-4]
xor edx,edx
mov ecx,[0xfe04]
mov ecx,[ScreenHeight]
inc ecx
div ecx
mov ebx,eax
278,7 → 278,7
add esi,eax
add esi,eax
add esi,eax
add esi,0x300000
add esi,IMG_BACKGROUND
pop ebx
pop eax
 
288,7 → 288,7
pusha
mov esi,eax
mov edi,ebx
mov eax,[0xfe00]
mov eax,[ScreenWidth]
add eax,1
mul ebx
add eax,esi
295,13 → 295,13
add eax,WinMapAddress
cmp [eax],byte 1
jnz v12nbgp
mov eax,[0xfe08]
mov eax,[BytesPerScanLine]
mov ebx,edi
mul ebx
add eax,esi
add eax,esi
add eax,esi
cmp [0xFBF1],byte 24
cmp [ScreenBPP],byte 24
jz v12bgl3
add eax,esi
 
310,13 → 310,13
push ebx
push eax
 
sub eax,[0xfe80]
sub eax,[LFBAddress]
 
shr eax,16
call set_bank
pop eax
and eax,65535
add eax,0xa0000
add eax,VGABasePtr
pop ebx
 
mov [eax],cx
364,24 → 364,24
push ebx
push ecx
push edx
mov ecx,[0x3010]
mov ecx,[TASK_BASE]
add eax,[ecx-twdw+WDATA.box.left]
add ebx,[ecx-twdw+WDATA.box.top]
push eax
mov eax,ebx ; y
mov ebx,[0xfe08]
mov ebx,[BytesPerScanLine]
mul ebx
pop ecx
add eax,ecx ; x
add eax,ecx
add eax,ecx
cmp [0xfbf1],byte 24 ; 24 or 32 bpp ? - x start
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x start
jz dbpi2412
add eax,ecx
 
dbpi2412:
 
add eax,[0xfe80]
add eax,[LFBAddress]
mov edi,eax
 
; x size
390,7 → 390,7
mov ecx,eax
add ecx,eax
add ecx,eax
cmp [0xfbf1],byte 24 ; 24 or 32 bpp ? - x size
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
jz dbpi24312
add ecx,eax
 
402,18 → 402,18
 
push eax
push ecx
mov eax,[0x3010]
mov ecx,[eax+draw_data-0x3000+RECT.left]
mov eax,[TASK_BASE]
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.left]
cmp ecx,0
jnz dbcblimitlset12
mov ecx,[eax+draw_data-0x3000+RECT.top]
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.top]
cmp ecx,0
jnz dbcblimitlset12
mov ecx,[eax+draw_data-0x3000+RECT.right]
cmp ecx,[0xfe00]
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right]
cmp ecx,[ScreenWidth]
jnz dbcblimitlset12
mov ecx,[eax+draw_data-0x3000+RECT.bottom]
cmp ecx,[0xfe04]
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom]
cmp ecx,[ScreenHeight]
jnz dbcblimitlset12
pop ecx
pop eax
428,7 → 428,7
 
dbcblimitlno12:
 
cmp [0xfbf1],byte 24 ; 24 or 32 bpp ?
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ?
jz dbpi24bit12
jmp dbpi32bit12
 
458,11 → 458,11
 
xor edx,edx
mov eax,edi
sub eax,[0xfe80]
sub eax,[LFBAddress]
mov ebx,3
div ebx
add eax,WinMapAddress
mov ebx,[0x3000]
mov ebx,[CURRENT_TASK]
cld
 
dbnp2412:
481,11 → 481,11
 
push edi
mov eax,edi
sub eax,[0xfe80]
sub eax,[LFBAddress]
shr eax,16
call set_bank
and edi,0xffff
add edi,0xa0000
add edi,VGABasePtr
mov eax,[esp+8+3*4+16+4+4]
stosw
shr eax,16
523,7 → 523,7
pop ecx
pop edi
pop ebx
add edi,[0xfe08]
add edi,[BytesPerScanLine]
dec ebx
jz dbnonewpi12
jmp dbnewpi12
550,10 → 550,10
push ecx
 
mov eax,edi
sub eax,[0xfe80]
sub eax,[LFBAddress]
shr eax,2
add eax,WinMapAddress
mov ebx,[0x3000]
mov ebx,[CURRENT_TASK]
cld
 
dbnp3212:
572,11 → 572,11
 
push edi
mov eax,edi
sub eax,[0xfe80]
sub eax,[LFBAddress]
shr eax,16
call set_bank
and edi,0xffff
add edi,0xa0000
add edi,VGABasePtr
mov eax,[esp+8+3*4+16+4+4]
stosw
shr eax,16
615,7 → 615,7
pop ecx
pop edi
pop ebx
add edi,[0xfe08]
add edi,[BytesPerScanLine]
dec ebx
jz nodbnewpi3212
jmp dbnewpi3212
631,7 → 631,7
mov edi,eax ; x
mov eax,ebx ; y
lea edi,[edi+edi*2]
mov ebx,[0xfe08]
mov ebx,[BytesPerScanLine]
mul ebx
add edi,eax
mov eax,edi
638,7 → 638,7
shr eax,16
call set_bank
and edi,65535
add edi,0xa0000
add edi,VGABasePtr
mov eax,[esp+28]
stosw
shr eax,16
653,7 → 653,7
mov edi,eax ; x
mov eax,ebx ; y
shl edi,2
mov ebx,[0xfe08]
mov ebx,[BytesPerScanLine]
mul ebx
add edi,eax
mov eax,edi
660,7 → 660,7
shr eax,16
call set_bank
and edi,65535
add edi,0xa0000
add edi,VGABasePtr
mov ecx,[esp+28]
mov [edi],ecx
sti
672,7 → 672,7
mov edi,eax ; x
mov eax,ebx ; y
lea edi,[edi+edi*2]
mov ebx,[0xfe08]
mov ebx,[BytesPerScanLine]
mul ebx
add edi,eax
mov eax,edi
679,7 → 679,7
shr eax,16
call set_bank
and edi,65535
add edi,0xa0000
add edi,VGABasePtr
mov ecx,[edi]
and ecx,255*256*256+255*256+255
sti
691,7 → 691,7
mov edi,eax ; x
mov eax,ebx ; y
shl edi,2
mov ebx,[0xfe08]
mov ebx,[BytesPerScanLine]
xor edx,edx
mul ebx
add edi,eax
699,7 → 699,7
shr eax,16
call set_bank
and edi,65535
add edi,0xa0000
add edi,VGABasePtr
mov ecx,[edi]
and ecx,255*256*256+255*256+255
sti
709,6 → 709,12
 
 
vesa12_putimage:
; 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
 
; mov ebx,image
; mov ecx,320*65536+240
725,137 → 731,108
push edx
movzx eax,word [esp+2]
movzx ebx,word [esp+0]
mov ecx,[0x3010]
mov ecx,[TASK_BASE]
add eax,[ecx-twdw+WDATA.box.left]
add ebx,[ecx-twdw+WDATA.box.top]
push eax
mov eax,ebx ; y
mov ebx,[0xfe08]
mul ebx
mul dword [BytesPerScanLine]
pop ecx
add eax,ecx ; x
add eax,ecx
add eax,ecx
cmp [0xfbf1],byte 24 ; 24 or 32 bpp ? - x start
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x start
jz pi2412
add eax,ecx
 
pi2412:
 
add eax,[0xfe80]
add eax,[LFBAddress]
mov edi,eax
 
; x size
 
movzx eax,word [esp+6]
mov ecx,eax
add ecx,eax
add ecx,eax
cmp [0xfbf1],byte 24 ; 24 or 32 bpp ? - x size
jz pi24312
add ecx,eax
movzx ecx,word [esp+6]
 
pi24312:
 
mov esi,[esp+8]
movzx ebx,word [esp+4]
 
; check limits while draw ?
 
push eax
push ecx
mov eax,[0x3010]
mov ecx,[eax+draw_data-0x3000+RECT.left]
cmp ecx,0
mov eax,[TASK_BASE]
cmp dword [eax+draw_data-CURRENT_TASK+RECT.left], 0
jnz dbcblimitlset212
mov ecx,[eax+draw_data-0x3000+RECT.top]
cmp ecx,0
cmp dword [eax+draw_data-CURRENT_TASK+RECT.top], 0
jnz dbcblimitlset212
mov ecx,[eax+draw_data-0x3000+RECT.right]
cmp ecx,[0xfe00]
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right]
cmp ecx,[ScreenWidth]
jnz dbcblimitlset212
mov ecx,[eax+draw_data-0x3000+RECT.bottom]
cmp ecx,[0xfe04]
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom]
cmp ecx,[ScreenHeight]
jnz dbcblimitlset212
pop ecx
pop eax
push dword 0
push 0
jmp dbcblimitlno212
 
dbcblimitlset212:
 
pop ecx
pop eax
push dword 1
push 1
 
dbcblimitlno212:
 
cmp [0xfbf1],byte 24 ; 24 or 32 bpp ?
jz pi24bit12
jmp pi32bit12
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ?
jnz pi32bit12
 
pi24bit12:
 
cld
push eax
push ebx
push edx
xor edx,edx
mov eax,ecx
mov ebx,3
div ebx
mov ecx,eax
pop edx
pop ebx
pop eax
 
newpi12:
 
push edi
push esi
push ecx
push ebx
 
xor edx,edx
mov eax,edi
sub eax,[0xfe80]
mov edx,edi
sub edx,[LFBAddress]
mov ebx,3
div ebx
add eax,WinMapAddress
mov ebx,[0x3000]
mov bh,[esp+4*4]
add edx,WinMapAddress
mov ebx,[CURRENT_TASK]
mov bh,[esp+4*3]
 
np2412:
 
cmp bl,[eax]
cmp bl,[edx]
jnz imp24no12
mov edx,[esi]
cmp bh,0
jz imp24yes12
; mov eax,[esi]
push dword [esp+4*3+20]
call ebp
; cmp bh,0
; jz imp24yes12
; call dbcplimit
; jnz imp24no12
 
imp24yes12:
 
push edi
push eax
push edi
mov eax,edi
sub eax,[0xfe80]
sub eax,[LFBAddress]
shr eax,16
call set_bank
pop eax
and edi,0xffff
add edi,0xa0000
mov [edi],edx
shr edx,2
mov [edi+2],dl
sti
add edi,VGABasePtr
mov [edi],ax
shr eax,16
mov [edi+2],al
pop edi
pop eax
 
imp24no12:
 
inc eax
add esi,3
inc edx
; add esi,3
add edi,3
dec ecx
jnz np2412
864,73 → 841,64
 
pop ebx
pop ecx
pop esi
pop edi
 
add edi,[0xfe08]
xor eax,eax
mov ax,[esp+4+2+4]
lea eax,[eax+eax*2]
add esi,eax
add edi,[BytesPerScanLine]
add esi,[esp+32]
dec ebx
jz nonewpi12
jmp newpi12
jnz newpi12
 
nonewpi12:
 
add esp,7*4
mov eax,0
pop eax edx ecx ebx eax edi esi
xor eax, eax
ret
 
 
pi32bit12:
 
cld
shr ecx,2
 
newpi3212:
 
push edi
push esi
push ecx
push ebx
 
mov eax,edi
sub eax,[0xfe80]
shr eax,2
add eax,WinMapAddress
mov ebx,[0x3000]
mov bh,[esp+4*4]
mov edx,edi
sub edx,[LFBAddress]
shr edx,2
add edx,WinMapAddress
mov ebx,[CURRENT_TASK]
mov bh,[esp+4*3]
 
np3212:
 
cmp bl,[eax]
cmp bl,[edx]
jnz imp32no12
mov edx,[esi]
cmp bh,0
jz imp32yes12
; mov eax,[esi]
push dword [esp+4*3+20]
call ebp
; cmp bh,0
; jz imp32yes12
; call dbcplimit
; jnz imp32no12
 
imp32yes12:
 
push edi
push eax
push edi
mov eax,edi
sub eax,[0xfe80]
sub eax,[LFBAddress]
shr eax,16
call set_bank
pop eax
and edi,0xffff
add edi,0xa0000
mov [edi],edx
sti
mov [edi+VGABasePtr],eax
pop edi
pop eax
 
imp32no12:
 
inc eax
add esi,3
inc edx
; add esi,3
add edi,4
dec ecx
jnz np3212
939,21 → 907,16
 
pop ebx
pop ecx
pop esi
pop edi
 
add edi,[0xfe08]
movzx eax,word [esp+4+2+4]
lea eax,[eax+eax*2]
add esi,eax
add edi,[BytesPerScanLine]
dec ebx
jz nonewpi3212
jmp newpi3212
jnz newpi3212
 
nonewpi3212:
 
add esp,7*4
mov eax,0
pop eax edx ecx ebx eax edi esi
xor eax, eax
ret
 
 
960,7 → 923,7
vesa12_read_screen_pixel:
 
and eax,0x3FFFFF
cmp [0xfbf1],byte 24 ; 24 or 32 bpp ?
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ?
jz v12rsp24
mov edi,eax
shl edi,2
968,7 → 931,7
shr eax,16
call set_bank
and edi,65535
add edi,0xa0000
add edi,VGABasePtr
mov eax,[edi]
and eax,0x00ffffff
ret
979,7 → 942,7
shr eax,16
call set_bank
and edi,65535
add edi,0xa0000
add edi,VGABasePtr
mov eax,[edi]
and eax,0x00ffffff
ret
/kernel/branches/gfx_kernel/video/vesa20.inc
17,12 → 17,12
; If you're planning to write your own video driver I suggest
; you replace the VESA12.INC file and see those instructions.
 
ScreenWidth equ 0xfe00
ScreenHeight equ 0xfe04
BytesPerScanLine equ 0xfe08
LFBAddress equ 0xfe80
ScreenBPP equ 0xfbf1
WinMapAddress equ 0x460000
;ScreenWidth equ 0xfe00
;ScreenHeight equ 0xfe04
;BytesPerScanLine equ 0xfe08
;LFBAddress equ 0xfe80
;ScreenBPP equ 0xfbf1
;WinMapAddress equ 0x460000
 
 
 
76,16 → 76,28
.abs_cx dd ?
.abs_cy dd ?
.line_increment dd ?
.source_bpp dd ?
.winmap_newline dd ?
.screen_newline dd ?
.stack_data = 4*13
.stack_data = 4*12
.edi dd ?
.esi dd ?
.ebp dd ?
.esp dd ?
.ebx dd ?
.edx dd ?
.ecx dd ?
.eax dd ?
.ret_addr dd ?
.arg_0 dd ?
end virtual
 
align 4
align 16
; ebx = pointer
; ecx = size [x|y]
; edx = coordinates [x|y]
; ebp = pointer to 'get' function
; esi = pointer to 'init' function
; edi = parameter for 'get' function
vesa20_putimage:
pushad
call [disable_mouse]
92,13 → 104,6
 
sub esp, putimg.stack_data
 
mov [putimg.source_bpp], 3
; test ebx, 0x80000000
; jz @f
; inc [putimg.source_bpp]
; @@:
; and ebx, 0x7FFFFFFF
 
; save pointer to image
mov [putimg.pti], ebx
 
117,7 → 122,7
mov [putimg.image_cy], edx
 
; calculate absolute (i.e. screen) coordinates
mov eax, [0x3010]
mov eax, [TASK_BASE]
mov ebx, [eax-twdw + WDATA.box.left]
add ebx, [putimg.image_cx]
mov [putimg.abs_cx], ebx
164,7 → 169,9
mov eax, [putimg.image_sx]
sub eax, [putimg.real_sx]
;; imul eax, [putimg.source_bpp]
lea eax, [eax + eax * 2]
; lea eax, [eax + eax * 2]
call esi
add eax, [putimg.arg_0]
mov [putimg.line_increment], eax
 
; winmap new line increment
183,7 → 190,7
mov [putimg.screen_newline], eax
 
; pointer to image
mov ecx, [putimg.pti]
mov esi, [putimg.pti]
 
; pointer to screen
mov edx, [putimg.abs_cy]
204,7 → 211,7
xchg eax, ebp
 
; get process number
mov ebx, [0x3000]
mov ebx, [CURRENT_TASK]
 
cmp byte [ScreenBPP], 32
je put_image_end_32
213,29 → 220,32
mov edi, [putimg.real_sy]
align 4
.new_line:
mov esi, [putimg.real_sx]
mov ecx, [putimg.real_sx]
 
; push ebp edx
align 4
.new_x:
 
push [putimg.edi]
mov eax, [putimg.ebp+4]
call eax
cmp [ebp], bl
jne .skip
mov eax, [ecx] ; ecx = RRBBGGRR
; mov eax, [esi] ; eax = RRBBGGRR
mov [edx], ax
shr eax, 16
mov [edx+2], al
.skip:
 
add ecx, 3 ;[putimg.source_bpp]
; add esi, 3 ;[putimg.source_bpp]
add edx, 3
inc ebp
 
dec esi
dec ecx
jnz .new_x
; pop edx ebp
 
add ecx, [putimg.line_increment]
add esi, [putimg.line_increment]
add edx, [putimg.screen_newline] ;[BytesPerScanLine]
add ebp, [putimg.winmap_newline] ;[ScreenWidth]
;inc ebp
251,27 → 261,30
mov edi, [putimg.real_sy]
align 4
.new_line:
mov esi, [putimg.real_sx]
mov ecx, [putimg.real_sx]
 
; push ebp edx
align 4
.new_x:
 
push [putimg.edi]
mov eax, [putimg.ebp+4]
call eax
cmp [ebp], bl
jne .skip
mov eax, [ecx] ; ecx = RRBBGGRR
; mov eax, [esi] ; ecx = RRBBGGRR
mov [edx], eax
.skip:
 
add ecx, [putimg.source_bpp]
; add esi, [putimg.source_bpp]
add edx, 4
inc ebp
 
dec esi
dec ecx
jnz .new_x
; pop edx ebp
 
add ecx, [putimg.line_increment]
add esi, [putimg.line_increment]
add edx, [putimg.screen_newline] ;[BytesPerScanLine]
add ebp, [putimg.winmap_newline] ;[ScreenWidth]
;inc ebp
315,12 → 328,12
; check if negation
test ecx,0x01000000
jz .noneg
call __sys_getpixel
call getpixel
not ecx
mov [esp+32-8],ecx
.noneg:
; OK to set pixel
call dword [0xe020] ; call the real put_pixel function
call dword [PUTPIXEL] ; call the real put_pixel function
.exit:
popad
 
606,7 → 619,7
mov [drbar.bar_cx], eax
mov [drbar.bar_cy], ebx
 
mov edi, [0x3010]
mov edi, [TASK_BASE]
add eax, [edi-twdw + WDATA.box.left] ; win_cx
add ebx, [edi-twdw + WDATA.box.top] ; win_cy
mov [drbar.abs_cx], eax
688,7 → 701,7
xchg eax, ebp
 
; get process number
mov ebx, [0x3000]
mov ebx, [CURRENT_TASK]
 
cmp byte [ScreenBPP], 24
jne draw_bar_end_32
917,7 → 930,7
mov ebx,[esp+8] ; ebx:=B*3
mul ebx ;
add esi,eax ;
mov eax,[esi+0x300000]
mov eax,[esi+IMG_BACKGROUND]
and eax,0xffffff
 
xchg edi, ebp
1033,18 → 1046,16
 
 
sdp3: ; MAIN LOOP
 
cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1)
jne snbgp
 
push eax
push ebx
 
mov eax,dword [WinMapAddress-8]
imul eax, [esp+4] ;4
xor edx,edx
mov ebx,[ScreenWidth]
div ebx
mov cx,dx
lea esi,[eax+eax*2]
mov eax,dword [WinMapAddress-4]
imul eax, [esp+0] ;0
1051,12 → 1062,47
xor edx,edx
mov ebx,[ScreenHeight]
div ebx
shl ecx,16
mov cx,dx
imul eax, [esp+8] ;8
add esi,eax
 
mov eax,[esi+0x300000]
mov eax,[esi+IMG_BACKGROUND]
push eax
ror ecx,16
xor eax,eax
mov ax,cx
shl eax,1 ; óìíîæåíèå íà 2
lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
xor edx,edx
mov ebx,[ScreenWidth]
div ebx
cmp eax,5
pop eax
jb @f
mov ebx,[esi+IMG_BACKGROUND+3]
call overlapping_of_points
@@:
push eax
ror ecx,16
xor eax,eax
mov ax,cx
shl eax,1 ; óìíîæåíèå íà 2
lea eax,[eax+eax*4] ; óìíîæåíèå íà
xor edx,edx
mov ebx,[ScreenHeight]
div ebx
cmp eax,5
pop eax
jb @f
mov ebx,[display_data-8]
shl ebx,1
add ebx,[display_data-8]
add ebx,IMG_BACKGROUND
add ebx,esi
mov ebx,[ebx]
call overlapping_of_points
@@:
and eax,0xffffff
 
xchg edi, ebp
stosw
shr eax,16
1066,12 → 1112,44
jz @f
inc ebp ; +1
@@:
 
pop ebx
pop eax
 
jmp shook1
 
overlapping_of_points:
push ecx edi
mov ecx,eax
mov edx,ebx
xor eax,eax
mov al,cl
xor ebx,ebx
mov bl,dl
add eax,ebx
rcr eax,1
xor edi,edi
mov di,ax
xor eax,eax
mov al,ch
xor ebx,ebx
mov bl,dh
add eax,ebx
rcr eax,1
ror edi,8
add edi,eax
ror ecx,8
ror edx,8
xor eax,eax
mov al,ch
xor ebx,ebx
mov bl,dh
add eax,ebx
rcr eax,1
ror edi,8
add eax,edi
ror eax,16
pop edi ecx
ret
 
snbgp:
add ebp,3 ; +3
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
/kernel/branches/gfx_kernel/video/vga.inc
122,7 → 122,7
 
checkVga_N13:
 
cmp [0xfe0c],dword 0x13
cmp [SCR_MODE],dword 0x13
jne @f
 
; cnvl:
129,7 → 129,7
pushad
cmp [EGA_counter],1
je novesal
mov ecx,[0xfb0a]
mov ecx,[MOUSE_X]
cmp ecx,[novesachecksum]
jne novesal
popad
151,7 → 151,7
sub eax,100
imul eax,640*4
add ecx,eax
movzx eax,word [0xfb0a]
movzx eax,word [MOUSE_X]
cmp eax,160
jge m13l1
mov eax,160
163,9 → 163,9
sub eax,160
shl eax,2
add ecx,eax
mov esi,[0xfe80]
mov esi,[LFBAddress]
add esi,ecx
mov edi,0xa0000
mov edi,VGABasePtr
mov edx,200
mov ecx,320
cld
197,11 → 197,11
 
VGA_drawbackground:
; draw all
cmp [0xfe0c],dword 0x12
cmp [SCR_MODE],dword 0x12
jne .end
pushad
mov esi,[0xfe80]
mov edi,0xa0000
mov esi,[LFBAddress]
mov edi,VGABasePtr
mov ebx,640/32 ; 640*480/(8*4)
mov edx,480
@@:
322,11 → 322,11
lea ebx,[ebx+ebx*4] ; óìíîæåíèå íà 5
lea edx, [ebx+ecx*4] ; + x*BytesPerPixel (Vesa2.0 32)
mov edi,edx
add edi, [0xfe80] ; + LFB address
add edi, [LFBAddress] ; + LFB address
mov [edi], eax ; write to LFB for Vesa2.0
shr edx,5 ; change BytesPerPixel to 1/8
mov edi,edx
add edi, 0x0a0000 ; address of pixel in VGA area
add edi, VGABasePtr ; address of pixel in VGA area
and ecx,0x07 ; bit no. (modulo 8)
pushfd
; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8)
373,7 → 373,7
VGA__putimage:
; ecx = size [x|y]
; edx = coordinates [x|y]
cmp [0xfe0c],dword 0x12
cmp [SCR_MODE],dword 0x12
jne @f
pushad
rol edx,16
393,7 → 393,7
; ebx cy
; ecx xe
; edx ye
cmp [0xfe0c],dword 0x12
cmp [SCR_MODE],dword 0x12
jne @f
pushad
sub ecx,eax
409,7 → 409,7
 
VGA_draw_bar_1:
mov [temp.cx],eax
mov eax, [0x3010]
mov eax, [TASK_BASE]
add ebx, [eax-twdw + 4]
mov eax, [eax-twdw + 0]
add eax, [temp.cx]
418,10 → 418,10
lea ebx,[ebx+ebx*4] ; óìíîæåíèå íà 5
lea ebx, [ebx+eax*4] ; + x*BytesPerPixel (Vesa2.0 32)
mov esi,ebx
add esi, [0xfe80] ; + LFB address
add esi, [LFBAddress] ; + LFB address
shr ebx,5 ; change BytesPerPixel to 1/8
mov edi,ebx
add edi, 0x0a0000 ; address of pixel in VGA area
add edi, VGABasePtr ; address of pixel in VGA area
mov ebx,ecx
shr ebx,5
inc ebx