/kernel/branches/net/video/blitter.inc |
---|
0,0 → 1,444 |
struc BLITTER |
{ |
.dc.xmin rd 1 ; 0 |
.dc.ymin rd 1 ; 4 |
.dc.xmax rd 1 ; 8 |
.dc.ymax rd 1 ; 12 |
.sc: |
.sc.xmin rd 1 ; 16 |
.sc.ymin rd 1 ; 20 |
.sc.xmax rd 1 ; 24 |
.sc.ymax rd 1 ; 28 |
.dst_x rd 1 ; 32 |
.dst_y rd 1 ; 36 |
.src_x rd 1 ; 40 |
.src_y rd 1 ; 44 |
.w rd 1 ; 48 |
.h rd 1 ; 52 |
.bitmap rd 1 ; 56 |
.stride rd 1 ; 60 |
} |
virtual at 0 |
BLITTER BLITTER |
end virtual |
align 4 |
__L1OutCode: |
push ebx |
mov ebx, 8 |
cmp edx, [eax] |
jl .L2 |
xor ebx, ebx |
cmp edx, [eax+8] |
setg bl |
sal ebx, 2 |
.L2: |
cmp ecx, [eax+4] |
jge .L3 |
or ebx, 1 |
jmp .L4 |
.L3: |
cmp ecx, [eax+12] |
jle .L4 |
or ebx, 2 |
.L4: |
mov eax, ebx |
pop ebx |
ret |
align 4 |
block_clip: |
push ebp |
push edi |
push esi |
push ebx |
sub esp, 4 |
mov ebx, eax |
mov [esp], edx |
mov ebp, ecx |
mov ecx, [ecx] |
mov edx, [edx] |
call __L1OutCode |
mov esi, eax |
mov edx, [esp+28] |
mov ecx, [edx] |
.L21: |
mov eax, [esp+24] |
mov edx, [eax] |
mov eax, ebx |
call __L1OutCode |
mov edi, eax |
.L20: |
mov eax, edi |
and eax, esi |
jne .L9 |
cmp esi, edi |
je .L9 |
test esi, esi |
jne .L10 |
test edi, 1 |
je .L11 |
mov eax, [ebx+4] |
jmp .L25 |
.L11: |
test edi, 2 |
je .L13 |
mov eax, [ebx+12] |
.L25: |
mov edx, [esp+28] |
jmp .L22 |
.L13: |
test edi, 4 |
je .L14 |
mov eax, [ebx+8] |
jmp .L26 |
.L14: |
and edi, 8 |
je .L12 |
mov eax, [ebx] |
.L26: |
mov edx, [esp+24] |
.L22: |
mov [edx], eax |
.L12: |
mov eax, [esp+28] |
mov ecx, [eax] |
jmp .L21 |
.L10: |
test esi, 1 |
je .L16 |
mov eax, [ebx+4] |
jmp .L23 |
.L16: |
test esi, 2 |
je .L18 |
mov eax, [ebx+12] |
.L23: |
mov [ebp+0], eax |
jmp .L17 |
.L18: |
test esi, 4 |
je .L19 |
mov eax, [ebx+8] |
jmp .L24 |
.L19: |
and esi, 8 |
je .L17 |
mov eax, [ebx] |
.L24: |
mov edx, [esp] |
mov [edx], eax |
.L17: |
mov ecx, [ebp+0] |
mov eax, [esp] |
mov edx, [eax] |
mov eax, ebx |
call __L1OutCode |
mov esi, eax |
jmp .L20 |
.L9: |
add esp, 4 |
pop ebx |
pop esi |
pop edi |
pop ebp |
ret |
align 4 |
blit_clip: |
.sx0 equ 36 |
.sy0 equ 32 |
.sx1 equ 28 |
.sy1 equ 24 |
.dx0 equ 20 |
.dy0 equ 16 |
.dx1 equ 12 |
.dy1 equ 8 |
push edi |
push esi |
push ebx |
sub esp, 40 |
mov ebx, ecx |
mov edx, [ecx+BLITTER.src_x] |
mov [esp+.sx0], edx |
mov eax, [ecx+BLITTER.src_y] |
mov [esp+.sy0], eax |
add edx, [ecx+BLITTER.w] |
dec edx |
mov [esp+.sx1], edx |
add eax, [ecx+BLITTER.h] |
dec eax |
mov [esp+.sy1], eax |
lea ecx, [esp+.sy0] |
lea edx, [esp+.sx0] |
lea eax, [ebx+BLITTER.sc] |
lea esi, [esp+.sy1] |
mov [esp+4], esi |
lea esi, [esp+.sx1] |
mov [esp], esi |
call block_clip |
mov esi, 1 |
test eax, eax |
jne .L28 |
mov edi, [esp+.sx0] |
mov edx, [ebx+BLITTER.dst_x] |
add edx, edi |
sub edx, [ebx+BLITTER.src_x] |
mov [esp+.dx0], edx |
mov ecx, [esp+.sy0] |
mov eax, [ebx+BLITTER.dst_y] |
add eax, ecx |
sub eax, [ebx+BLITTER.src_y] |
mov [esp+.dy0], eax |
sub edx, edi |
add edx, [esp+.sx1] |
mov [esp+.dx1], edx |
sub eax, ecx |
add eax, [esp+.sy1] |
mov [esp+.dy1], eax |
lea ecx, [esp+.dy0] |
lea edx, [esp+.dx0] |
lea eax, [esp+.dy1] |
mov [esp+4], eax |
lea eax, [esp+.dx1] |
mov [esp], eax |
mov eax, ebx |
call block_clip |
test eax, eax |
jne .L28 |
mov edx, [esp+.dx0] |
mov eax, [esp+.dx1] |
inc eax |
sub eax, edx |
mov [ebx+BLITTER.w], eax |
mov eax, [esp+.dy0] |
mov ecx, [esp+.dy1] |
inc ecx |
sub ecx, eax |
mov [ebx+BLITTER.h], ecx |
mov ecx, [ebx+BLITTER.src_x] |
add ecx, edx |
sub ecx, [ebx+BLITTER.dst_x] |
mov [ebx+BLITTER.src_x], ecx |
mov ecx, [ebx+BLITTER.src_y] |
add ecx, eax |
sub ecx, [ebx+BLITTER.dst_y] |
mov [ebx+BLITTER.src_y], ecx |
mov [ebx+BLITTER.dst_x], edx |
mov [ebx+BLITTER.dst_y], eax |
xor esi, esi |
.L28: |
mov eax, esi |
add esp, 40 |
pop ebx |
pop esi |
pop edi |
purge .sx0 |
purge .sy0 |
purge .sx1 |
purge .sy1 |
purge .dx0 |
purge .dy0 |
purge .dx1 |
purge .dy1 |
ret |
align 4 |
blit_32: |
push ebp |
push edi |
push esi |
push ebx |
sub esp, 72 |
mov eax, [TASK_BASE] |
mov ebx, [eax-twdw + WDATA.box.width] |
mov edx, [eax-twdw + WDATA.box.height] |
xor eax, eax |
mov [esp+BLITTER.dc.xmin], eax |
mov [esp+BLITTER.dc.ymin], eax |
mov [esp+BLITTER.dc.xmax], ebx |
mov [esp+BLITTER.dc.ymax], edx |
mov [esp+BLITTER.sc.xmin], eax |
mov [esp+BLITTER.sc.ymin], eax |
mov eax, [ecx+24] |
dec eax |
mov [esp+BLITTER.sc.xmax], eax |
mov eax, [ecx+28] |
dec eax |
mov [esp+BLITTER.sc.ymax], eax |
mov eax, [ecx] |
mov [esp+BLITTER.dst_x], eax |
mov eax, [ecx+4] |
mov [esp+BLITTER.dst_y], eax |
mov eax, [ecx+16] |
mov [esp+BLITTER.src_x], eax |
mov eax, [ecx+20] |
mov [esp+BLITTER.src_y], eax |
mov eax, [ecx+8] |
mov [esp+BLITTER.w], eax |
mov eax, [ecx+12] |
mov [esp+BLITTER.h], eax |
mov eax, [ecx+32] |
mov [esp+56], eax |
mov eax, [ecx+36] |
mov [esp+60], eax |
mov ecx, esp |
call blit_clip |
test eax, eax |
jne .L57 |
inc [mouse_pause] |
call [_display.disable_mouse] |
mov eax, [TASK_BASE] |
mov ebx, [esp+BLITTER.dst_x] |
mov ebp, [esp+BLITTER.dst_y] |
add ebx, [eax-twdw + WDATA.box.left] |
add ebp, [eax-twdw + WDATA.box.top] |
mov edi, ebp |
imul edi, [_display.pitch] |
imul ebp, [_display.width] |
add ebp, ebx |
add ebp, [_WinMapAddress] |
mov eax, [esp+BLITTER.src_y] |
imul eax, [esp+BLITTER.stride] |
mov esi, [esp+BLITTER.src_x] |
lea esi, [eax+esi*4] |
add esi, [esp+BLITTER.bitmap] |
mov ecx, [esp+BLITTER.h] |
mov edx, [esp+BLITTER.w] |
test ecx, ecx ;FIXME check clipping |
jz .L57 |
test edx, edx |
jz .L57 |
cmp [_display.bpp], 32 |
jne .core_24 |
lea edi, [edi+ebx*4] |
mov ebx, [CURRENT_TASK] |
align 4 |
.outer32: |
xor ecx, ecx |
align 4 |
.inner32: |
cmp [ebp+ecx], bl |
jne @F |
mov eax, [esi+ecx*4] |
mov [LFB_BASE+edi+ecx*4], eax |
@@: |
inc ecx |
dec edx |
jnz .inner32 |
add esi, [esp+BLITTER.stride] |
add edi, [_display.pitch] |
add ebp, [_display.width] |
mov edx, [esp+BLITTER.w] |
dec [esp+BLITTER.h] |
jnz .outer32 |
.done: |
dec [mouse_pause] |
call [draw_pointer] |
.L57: |
add esp, 72 |
pop ebx |
pop esi |
pop edi |
pop ebp |
ret |
.core_24: |
lea ebx, [ebx+ebx*2] |
lea edi, [LFB_BASE+edi+ebx] |
mov ebx, [CURRENT_TASK] |
align 4 |
.outer24: |
mov [esp+64], edi |
xor ecx, ecx |
align 4 |
.inner24: |
cmp [ebp+ecx], bl |
jne @F |
mov eax, [esi+ecx*4] |
lea edi, [edi+ecx*2] |
mov [edi+ecx], ax |
shr eax, 16 |
mov [edi+ecx+2], al |
@@: |
mov edi, [esp+64] |
inc ecx |
dec edx |
jnz .inner24 |
add esi, [esp+BLITTER.stride] |
add edi, [_display.pitch] |
add ebp, [_display.width] |
mov edx, [esp+BLITTER.w] |
dec [esp+BLITTER.h] |
jnz .outer24 |
jmp .done |
/kernel/branches/net/video/cursors.inc |
---|
43,246 → 43,246 |
counter dd ? |
endl |
mov esi, [src] |
add esi,[esi+18] |
mov eax,esi |
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 |
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 |
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 edi, [dst] |
add edi, 32*31*4 |
mov [rBase], edi |
mov esi,[pQuad] |
mov esi, [pQuad] |
.l21: |
mov ebx, [pBits] |
mov ebx, [ebx] |
bswap ebx |
mov eax, [pAnd] |
mov eax, [eax] |
bswap eax |
mov [counter], 32 |
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 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 |
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 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 |
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 |
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 edi, [dst] |
add edi, 32*31*4 |
mov [rBase], edi |
mov esi,[pQuad] |
mov ebx, [pBits] |
mov esi, [pQuad] |
mov ebx, [pBits] |
.l4: |
mov eax, [pAnd] |
mov eax, [eax] |
bswap eax |
mov [counter], 16 |
mov eax, [pAnd] |
mov eax, [eax] |
bswap eax |
mov [counter], 16 |
@@: |
xor edx, edx |
shl eax,1 |
setc dl |
dec edx |
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 |
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 |
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 |
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 |
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 |
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 |
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 edi, [dst] |
add edi, 32*31*4 |
mov [rBase], edi |
mov esi,[pQuad] |
mov ebx, [pBits] |
mov esi, [pQuad] |
mov ebx, [pBits] |
.l81: |
mov eax, [pAnd] |
mov eax, [eax] |
bswap eax |
mov [counter], 32 |
mov eax, [pAnd] |
mov eax, [eax] |
bswap eax |
mov [counter], 32 |
@@: |
xor edx, edx |
shl eax,1 |
setc dl |
dec edx |
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 |
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 |
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 |
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 |
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 edi, [dst] |
add edi, 32*31*4 |
mov [rBase], edi |
mov esi,[pAnd] |
mov ebx, [pQuad] |
mov esi, [pAnd] |
mov ebx, [pQuad] |
.row_24: |
mov eax, [esi] |
bswap eax |
mov [counter], 32 |
mov eax, [esi] |
bswap eax |
mov [counter], 32 |
@@: |
xor edx, edx |
shl eax,1 |
setc dl |
dec edx |
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 |
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 |
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 |
mov eax, [hcursor] |
cmp [eax+CURSOR.magic], 'CURS' |
jne .fail |
; cmp [eax+CURSOR.size], CURSOR_SIZE |
; jne .fail |
mov ebx, [current_slot] |
xchg eax, [ebx+APPDATA.cursor] |
ret |
mov ebx, [current_slot] |
xchg eax, [ebx+APPDATA.cursor] |
ret |
.fail: |
mov eax, [def_cursor] |
mov ebx, [current_slot] |
xchg eax, [ebx+APPDATA.cursor] |
ret |
mov eax, [def_cursor] |
mov ebx, [current_slot] |
xchg eax, [ebx+APPDATA.cursor] |
ret |
endp |
; param |
295,83 → 295,77 |
.flags equ esp+4 |
.hcursor equ esp+8 |
sub esp, 4 ;space for .hcursor |
push ecx |
push ebx |
sub esp, 4 ;space for .hcursor |
push ecx |
push ebx |
mov ebx, eax |
mov eax, CURSOR.sizeof |
call create_kernel_object |
test eax, eax |
jz .fail |
mov ebx, eax |
mov eax, CURSOR.sizeof |
call create_kernel_object |
test eax, eax |
jz .fail |
mov [.hcursor],eax |
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 |
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 |
stdcall kernel_alloc, 0x1000 |
test eax, eax |
jz .fail |
mov edi, [.hcursor] |
mov [edi+CURSOR.base], eax |
mov edi, [.hcursor] |
mov [edi+CURSOR.base], eax |
mov esi, [.src] |
mov ebx, [.flags] |
cmp bx, LOAD_INDIRECT |
je .indirect |
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 |
movzx ecx, word [esi+10] |
movzx edx, word [esi+12] |
mov [edi+CURSOR.hot_x], ecx |
mov [edi+CURSOR.hot_y], edx |
stdcall init_cursor, eax, esi |
stdcall init_cursor, eax, esi |
mov eax, [.hcursor] |
lea eax, [eax+CURSOR.list_next] |
lea edx, [_display.cr_list.next] |
mov ecx, [.hcursor] |
lea ecx, [ecx+CURSOR.list_next] |
lea edx, [_display.cr_list.next] |
pushfd |
cli |
mov ecx, [edx] |
pushfd |
cli |
list_add ecx, edx ;list_add_tail(new, head) |
popfd |
mov [eax], ecx |
mov [eax+4], edx |
mov [ecx+4], eax |
mov [edx], eax |
popfd |
mov eax, [.hcursor] |
mov eax, [.hcursor] |
.check_hw: |
cmp [_display.init_cursor], 0 |
je .fail |
cmp [_display.init_cursor], 0 |
je .fail |
push eax |
call [_display.init_cursor] |
add esp, 4 |
push eax |
call [_display.init_cursor] |
add esp, 4 |
mov eax, [.hcursor] |
mov eax, [.hcursor] |
.fail: |
add esp, 12 |
ret |
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 |
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 |
jmp .check_hw |
xchg edi, eax |
mov ecx, 1024 |
cld |
rep movsd |
jmp .check_hw |
align 4 |
proc load_cursor stdcall, src:dword, flags:dword |
379,42 → 373,42 |
handle dd ? |
endl |
xor eax, eax |
cmp [create_cursor], eax |
je .fail2 |
xor eax, eax |
cmp [create_cursor], eax |
je .fail2 |
mov [handle], eax |
cmp word [flags], LOAD_FROM_FILE |
jne @F |
mov [handle], eax |
cmp word [flags], LOAD_FROM_FILE |
jne @F |
stdcall load_file, [src] |
test eax, eax |
jz .fail |
mov [src], eax |
stdcall load_file, [src] |
test eax, eax |
jz .fail |
mov [src], eax |
@@: |
push ebx |
push esi |
push edi |
push ebx |
push esi |
push edi |
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 |
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 |
cmp word [flags], LOAD_FROM_FILE |
jne .exit |
stdcall kernel_free, [src] |
cmp word [flags], LOAD_FROM_FILE |
jne .exit |
stdcall kernel_free, [src] |
.exit: |
pop edi |
pop esi |
pop ebx |
pop edi |
pop esi |
pop ebx |
.fail: |
mov eax, [handle] |
mov eax, [handle] |
.fail2: |
ret |
ret |
endp |
align 4 |
428,26 → 422,26 |
out_size dd ? |
endl |
mov esi, [hcursor] |
cmp [esi+CURSOR.magic], 'CURS' |
jne .fail |
mov esi, [hcursor] |
cmp [esi+CURSOR.magic], 'CURS' |
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, 5 |
mov ebx, [CURRENT_TASK+ebx+4] |
cmp ebx, [esi+CURSOR.pid] |
jne .fail |
mov ebx, [current_slot] |
cmp esi, [ebx+APPDATA.cursor] |
jne @F |
mov eax, [def_cursor] |
mov [ebx+APPDATA.cursor], eax |
mov ebx, [current_slot] |
cmp esi, [ebx+APPDATA.cursor] |
jne @F |
mov eax, [def_cursor] |
mov [ebx+APPDATA.cursor], eax |
@@: |
mov eax, [hcursor] |
call [eax+APPOBJ.destroy] |
mov eax, [hcursor] |
call [eax+APPOBJ.destroy] |
.fail: |
ret |
ret |
endp |
; param |
456,81 → 450,89 |
align 4 |
destroy_cursor: |
push eax |
stdcall kernel_free, [eax+CURSOR.base] |
pop eax |
push eax |
stdcall kernel_free, [eax+CURSOR.base] |
call destroy_kernel_object |
ret |
mov eax, [esp] |
lea eax, [eax+CURSOR.list_next] |
pushfd |
cli |
list_del eax |
popfd |
pop eax |
call destroy_kernel_object |
ret |
align 4 |
select_cursor: |
mov eax, [esp+4] |
mov [_display.cursor], eax |
ret 4 |
mov eax, [esp+4] |
mov [_display.cursor], eax |
ret 4 |
align 4 |
proc restore_24 stdcall, x:dword, y:dword |
push ebx |
push ebx |
mov ebx, [cur_saved_base] |
mov edx, [cur.h] |
test edx, edx |
jz .ret |
mov ebx, [cur_saved_base] |
mov edx, [cur.h] |
test edx, edx |
jz .ret |
push esi |
push edi |
push esi |
push edi |
mov esi, cur_saved_data |
mov ecx, [cur.w] |
lea ecx, [ecx+ecx*2] |
push ecx |
mov esi, cur_saved_data |
mov ecx, [cur.w] |
lea ecx, [ecx+ecx*2] |
push ecx |
@@: |
mov edi, ebx |
add ebx, [BytesPerScanLine] |
mov edi, ebx |
add ebx, [BytesPerScanLine] |
mov ecx, [esp] |
rep movsb |
dec edx |
jnz @B |
mov ecx, [esp] |
rep movsb |
dec edx |
jnz @B |
pop ecx |
pop edi |
pop esi |
pop ecx |
pop edi |
pop esi |
.ret: |
pop ebx |
ret |
pop ebx |
ret |
endp |
align 4 |
proc restore_32 stdcall, x:dword, y:dword |
push ebx |
push ebx |
mov ebx, [cur_saved_base] |
mov edx, [cur.h] |
test edx, edx |
jz .ret |
mov ebx, [cur_saved_base] |
mov edx, [cur.h] |
test edx, edx |
jz .ret |
push esi |
push edi |
push esi |
push edi |
mov esi, cur_saved_data |
mov esi, cur_saved_data |
@@: |
mov edi, ebx |
add ebx, [BytesPerScanLine] |
mov edi, ebx |
add ebx, [BytesPerScanLine] |
mov ecx, [cur.w] |
rep movsd |
dec edx |
jnz @B |
mov ecx, [cur.w] |
rep movsd |
dec edx |
jnz @B |
pop edi |
pop edi |
.ret: |
pop esi |
pop ebx |
ret |
pop esi |
pop ebx |
ret |
endp |
align 4 |
541,101 → 543,101 |
_dy dd ? |
endl |
mov esi, [hcursor] |
mov ecx, [x] |
mov eax, [y] |
mov ebx, [BytesPerScanLine] |
mov esi, [hcursor] |
mov ecx, [x] |
mov eax, [y] |
mov ebx, [BytesPerScanLine] |
xor edx, edx |
sub ecx, [esi+CURSOR.hot_x] |
lea ebx, [ecx+32-1] |
mov [x], ecx |
sets dl |
dec edx |
and ecx, edx ;clip x to 0<=x |
mov [cur.left], ecx |
mov edi, ecx |
sub edi, [x] |
mov [_dx], edi |
xor edx, edx |
sub ecx, [esi+CURSOR.hot_x] |
lea ebx, [ecx+32-1] |
mov [x], ecx |
sets dl |
dec edx |
and ecx, edx ;clip x to 0<=x |
mov [cur.left], ecx |
mov edi, ecx |
sub edi, [x] |
mov [_dx], edi |
xor edx, edx |
sub eax, [esi+CURSOR.hot_y] |
lea edi, [eax+32-1] |
mov [y], eax |
sets dl |
dec edx |
and eax, edx ;clip y to 0<=y |
mov [cur.top], eax |
mov edx, eax |
sub edx, [y] |
mov [_dy], edx |
xor edx, edx |
sub eax, [esi+CURSOR.hot_y] |
lea edi, [eax+32-1] |
mov [y], eax |
sets dl |
dec edx |
and eax, edx ;clip y to 0<=y |
mov [cur.top], eax |
mov edx, eax |
sub edx, [y] |
mov [_dy], edx |
mul dword [BytesPerScanLine] |
lea edx, [LFB_BASE+ecx*3] |
add edx, eax |
mov [cur_saved_base],edx |
mul dword [BytesPerScanLine] |
lea edx, [LFB_BASE+ecx*3] |
add edx, eax |
mov [cur_saved_base], edx |
cmp ebx, [Screen_Max_X] |
jbe @F |
mov ebx, [Screen_Max_X] |
cmp ebx, [Screen_Max_X] |
jbe @F |
mov ebx, [Screen_Max_X] |
@@: |
cmp edi, [Screen_Max_Y] |
jbe @F |
mov edi, [Screen_Max_Y] |
cmp edi, [Screen_Max_Y] |
jbe @F |
mov edi, [Screen_Max_Y] |
@@: |
mov [cur.right], ebx |
mov [cur.bottom], edi |
mov [cur.right], ebx |
mov [cur.bottom], edi |
sub ebx, [x] |
sub edi, [y] |
inc ebx |
inc edi |
sub ebx, [x] |
sub edi, [y] |
inc ebx |
inc edi |
mov [cur.w], ebx |
mov [cur.h], edi |
mov [h], edi |
mov [cur.w], ebx |
mov [cur.h], edi |
mov [h], edi |
mov eax, edi |
mov edi, cur_saved_data |
mov eax, edi |
mov edi, cur_saved_data |
@@: |
mov esi, edx |
add edx, [BytesPerScanLine] |
mov ecx, [cur.w] |
lea ecx, [ecx+ecx*2] |
rep movsb |
dec eax |
jnz @B |
mov esi, edx |
add edx, [BytesPerScanLine] |
mov ecx, [cur.w] |
lea ecx, [ecx+ecx*2] |
rep movsb |
dec eax |
jnz @B |
;draw cursor |
mov ebx, [cur_saved_base] |
mov eax, [_dy] |
shl eax, 5 |
add eax, [_dx] |
mov ebx, [cur_saved_base] |
mov eax, [_dy] |
shl eax, 5 |
add eax, [_dx] |
mov esi, [hcursor] |
mov esi, [esi+CURSOR.base] |
lea edx, [esi+eax*4] |
mov esi, [hcursor] |
mov esi, [esi+CURSOR.base] |
lea edx, [esi+eax*4] |
.row: |
mov ecx, [cur.w] |
mov esi, edx |
mov edi, ebx |
add edx, 32*4 |
add ebx, [BytesPerScanLine] |
mov ecx, [cur.w] |
mov esi, edx |
mov edi, ebx |
add edx, 32*4 |
add ebx, [BytesPerScanLine] |
.pix: |
lodsd |
test eax, 0xFF000000 |
jz @F |
mov [edi], ax |
shr eax, 16 |
mov [edi+2],al |
lodsd |
test eax, 0xFF000000 |
jz @F |
mov [edi], ax |
shr eax, 16 |
mov [edi+2], al |
@@: |
add edi, 3 |
dec ecx |
jnz .pix |
add edi, 3 |
dec ecx |
jnz .pix |
dec [h] |
jnz .row |
ret |
dec [h] |
jnz .row |
ret |
endp |
647,159 → 649,151 |
_dy dd ? |
endl |
mov esi, [hcursor] |
mov ecx, [x] |
mov eax, [y] |
mov esi, [hcursor] |
mov ecx, [x] |
mov eax, [y] |
xor edx, edx |
sub ecx, [esi+CURSOR.hot_x] |
lea ebx, [ecx+32-1] |
mov [x], ecx |
sets dl |
dec edx |
and ecx, edx ;clip x to 0<=x |
mov [cur.left], ecx |
mov edi, ecx |
sub edi, [x] |
mov [_dx], edi |
xor edx, edx |
sub ecx, [esi+CURSOR.hot_x] |
lea ebx, [ecx+32-1] |
mov [x], ecx |
sets dl |
dec edx |
and ecx, edx ;clip x to 0<=x |
mov [cur.left], ecx |
mov edi, ecx |
sub edi, [x] |
mov [_dx], edi |
xor edx, edx |
sub eax, [esi+CURSOR.hot_y] |
lea edi, [eax+32-1] |
mov [y], eax |
sets dl |
dec edx |
and eax, edx ;clip y to 0<=y |
mov [cur.top], eax |
mov edx, eax |
sub edx, [y] |
mov [_dy], edx |
xor edx, edx |
sub eax, [esi+CURSOR.hot_y] |
lea edi, [eax+32-1] |
mov [y], eax |
sets dl |
dec edx |
and eax, edx ;clip y to 0<=y |
mov [cur.top], eax |
mov edx, eax |
sub edx, [y] |
mov [_dy], edx |
mul dword [BytesPerScanLine] |
lea edx, [LFB_BASE+eax+ecx*4] |
mov [cur_saved_base],edx |
mul dword [BytesPerScanLine] |
lea edx, [LFB_BASE+eax+ecx*4] |
mov [cur_saved_base], edx |
cmp ebx, [Screen_Max_X] |
jbe @F |
mov ebx, [Screen_Max_X] |
cmp ebx, [Screen_Max_X] |
jbe @F |
mov ebx, [Screen_Max_X] |
@@: |
cmp edi, [Screen_Max_Y] |
jbe @F |
mov edi, [Screen_Max_Y] |
cmp edi, [Screen_Max_Y] |
jbe @F |
mov edi, [Screen_Max_Y] |
@@: |
mov [cur.right], ebx |
mov [cur.bottom], edi |
mov [cur.right], ebx |
mov [cur.bottom], edi |
sub ebx, [x] |
sub edi, [y] |
inc ebx |
inc edi |
sub ebx, [x] |
sub edi, [y] |
inc ebx |
inc edi |
mov [cur.w], ebx |
mov [cur.h], edi |
mov [h], edi |
mov [cur.w], ebx |
mov [cur.h], edi |
mov [h], edi |
mov eax, edi |
mov edi, cur_saved_data |
mov eax, edi |
mov edi, cur_saved_data |
@@: |
mov esi, edx |
add edx, [BytesPerScanLine] |
mov ecx, [cur.w] |
rep movsd |
dec eax |
jnz @B |
mov esi, edx |
add edx, [BytesPerScanLine] |
mov ecx, [cur.w] |
rep movsd |
dec eax |
jnz @B |
;draw cursor |
mov ebx, [cur_saved_base] |
mov eax, [_dy] |
shl eax, 5 |
add eax, [_dx] |
mov ebx, [cur_saved_base] |
mov eax, [_dy] |
shl eax, 5 |
add eax, [_dx] |
mov esi, [hcursor] |
mov esi, [esi+CURSOR.base] |
lea edx, [esi+eax*4] |
mov esi, [hcursor] |
mov esi, [esi+CURSOR.base] |
lea edx, [esi+eax*4] |
.row: |
mov ecx, [cur.w] |
mov esi, edx |
mov edi, ebx |
add edx, 32*4 |
add ebx, [BytesPerScanLine] |
mov ecx, [cur.w] |
mov esi, edx |
mov edi, ebx |
add edx, 32*4 |
add ebx, [BytesPerScanLine] |
.pix: |
lodsd |
test eax, 0xFF000000 |
jz @F |
mov [edi], eax |
lodsd |
test eax, 0xFF000000 |
jz @F |
mov [edi], eax |
@@: |
add edi, 4 |
dec ecx |
jnz .pix |
add edi, 4 |
dec ecx |
jnz .pix |
dec [h] |
jnz .row |
ret |
dec [h] |
jnz .row |
ret |
endp |
align 4 |
get_display: |
mov eax, _display |
ret |
mov eax, _display |
ret |
align 4 |
init_display: |
xor eax, eax |
mov edi, _display |
xor eax, eax |
mov edi, _display |
mov [edi+display_t.init_cursor], eax |
mov [edi+display_t.select_cursor], eax |
mov [edi+display_t.show_cursor], eax |
mov [edi+display_t.move_cursor], eax |
mov [edi+display_t.restore_cursor], eax |
mov [edi+display_t.init_cursor], eax |
mov [edi+display_t.select_cursor], eax |
mov [edi+display_t.show_cursor], eax |
mov [edi+display_t.move_cursor], eax |
mov [edi+display_t.restore_cursor], eax |
lea ecx, [edi+display_t.cr_list.next] |
mov [edi+display_t.cr_list.next], ecx |
mov [edi+display_t.cr_list.prev], ecx |
lea ecx, [edi+display_t.cr_list.next] |
mov [edi+display_t.cr_list.next], ecx |
mov [edi+display_t.cr_list.prev], ecx |
cmp [SCR_MODE],word 0x13 |
jbe .fail |
cmp [SCR_MODE], word 0x13 |
jbe .fail |
test word [SCR_MODE], 0x4000 |
jz .fail |
test word [SCR_MODE], 0x4000 |
jz .fail |
mov ebx, restore_32 |
mov ecx, move_cursor_32 |
movzx eax, byte [ScreenBPP] |
cmp eax, 32 |
je @F |
mov ebx, restore_32 |
mov ecx, move_cursor_32 |
movzx eax, byte [ScreenBPP] |
cmp eax, 32 |
je @F |
mov ebx, restore_24 |
mov ecx, move_cursor_24 |
cmp eax, 24 |
jne .fail |
mov ebx, restore_24 |
mov ecx, move_cursor_24 |
cmp eax, 24 |
jne .fail |
@@: |
mov [_display.select_cursor], select_cursor |
mov [_display.move_cursor], ecx |
mov [_display.restore_cursor], ebx |
mov [_display.select_cursor], select_cursor |
mov [_display.move_cursor], ecx |
mov [_display.restore_cursor], ebx |
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM |
mov [def_cursor], eax |
ret |
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM |
mov [def_cursor], eax |
ret |
.fail: |
xor eax, eax |
mov [_display.select_cursor], eax |
mov [_display.move_cursor], eax |
ret |
xor eax, eax |
mov [_display.select_cursor], eax |
mov [_display.move_cursor], eax |
ret |
align 4 |
def_arrow: |
file 'arrow.cur' |
/kernel/branches/net/video/vesa12.inc |
---|
61,19 → 61,19 |
if TRIDENT |
set_bank: |
pushfd |
cli |
cmp al,[BANK_RW] |
je .retsb |
pushfd |
cli |
cmp al, [BANK_RW] |
je .retsb |
mov [BANK_RW],al |
push dx |
mov dx,3D8h |
out dx,al |
pop dx |
mov [BANK_RW], al |
push dx |
mov dx, 3D8h |
out dx, al |
pop dx |
.retsb: |
popfd |
ret |
popfd |
ret |
end if |
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
82,83 → 82,83 |
if S3_VIDEO |
set_bank: |
pushfd |
cli |
cmp al,[BANK_RW] |
je .retsb |
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 |
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 |
inc dx |
mov al, 0x48 |
out dx, al ;3d5 -? |
dec dx |
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. |
;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. |
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 |
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 |
popfd |
ret |
end if |
;Set bank function for Intel 810/815 chipsets |
169,33 → 169,33 |
if INTEL_VIDEO |
set_bank: |
pushfd |
cli |
pushfd |
cli |
cmp al,[BANK_RW] |
je .retsb |
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 |
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 |
popfd |
ret |
end if |
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!} |
203,268 → 203,268 |
if (TRIDENT or S3_VIDEO or INTEL_VIDEO) |
else |
set_bank: |
pushfd |
cli |
pushfd |
cli |
cmp al,[BANK_RW] |
je .retsb |
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 |
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 |
popfd |
ret |
end if |
vesa12_drawbackground: |
call [_display.disable_mouse] |
call [_display.disable_mouse] |
push eax |
push ebx |
push ecx |
push edx |
push eax |
push ebx |
push ecx |
push edx |
xor edx,edx |
mov eax,dword[BgrDataWidth] |
mov ebx,dword[BgrDataHeight] |
mul ebx |
mov ebx,3 |
mul ebx |
mov [imax],eax |
mov eax,[draw_data+32+RECT.left] |
mov ebx,[draw_data+32+RECT.top] |
xor edi,edi ;no force |
xor edx, edx |
mov eax, dword[BgrDataWidth] |
mov ebx, dword[BgrDataHeight] |
mul ebx |
mov ebx, 3 |
mul ebx |
mov [imax], eax |
mov eax, [draw_data+32+RECT.left] |
mov ebx, [draw_data+32+RECT.top] |
xor edi, edi;no force |
v12dp3: |
push eax |
push ebx |
push eax |
push ebx |
cmp [BgrDrawMode],dword 1 ; tiled background |
jne no_vesa12_tiled_bgr |
cmp [BgrDrawMode], dword 1 ; tiled background |
jne no_vesa12_tiled_bgr |
push edx |
push edx |
xor edx,edx |
div dword [BgrDataWidth] |
xor edx, edx |
div dword [BgrDataWidth] |
push edx |
mov eax,ebx |
xor edx,edx |
div dword [BgrDataHeight] |
mov ebx,edx |
pop eax |
push edx |
mov eax, ebx |
xor edx, edx |
div dword [BgrDataHeight] |
mov ebx, edx |
pop eax |
pop edx |
pop edx |
no_vesa12_tiled_bgr: |
cmp [BgrDrawMode],dword 2 ; stretched background |
jne no_vesa12_stretched_bgr |
cmp [BgrDrawMode], dword 2 ; stretched background |
jne no_vesa12_stretched_bgr |
push edx |
push edx |
mul dword [BgrDataWidth] |
mov ecx,[Screen_Max_X] |
inc ecx |
div ecx |
mul dword [BgrDataWidth] |
mov ecx, [Screen_Max_X] |
inc ecx |
div ecx |
push eax |
mov eax,ebx |
mul dword [BgrDataHeight] |
mov ecx,[Screen_Max_Y] |
inc ecx |
div ecx |
mov ebx,eax |
pop eax |
push eax |
mov eax, ebx |
mul dword [BgrDataHeight] |
mov ecx, [Screen_Max_Y] |
inc ecx |
div ecx |
mov ebx, eax |
pop eax |
pop edx |
pop edx |
no_vesa12_stretched_bgr: |
mov esi,ebx |
imul esi, dword [BgrDataWidth] |
add esi,eax |
lea esi,[esi*3] |
add esi,[img_background] ;IMG_BACKGROUND |
pop ebx |
pop eax |
mov esi, ebx |
imul esi, dword [BgrDataWidth] |
add esi, eax |
lea esi, [esi*3] |
add esi, [img_background];IMG_BACKGROUND |
pop ebx |
pop eax |
v12di4: |
mov cl,[esi+2] |
shl ecx,16 |
mov cx,[esi] |
mov cl, [esi+2] |
shl ecx, 16 |
mov cx, [esi] |
pusha |
mov esi,eax |
mov edi,ebx |
mov eax,[Screen_Max_X] |
add eax,1 |
mul ebx |
add eax, [_WinMapAddress] |
cmp [eax+esi],byte 1 |
jnz v12nbgp |
mov eax,[BytesPerScanLine] |
mov ebx,edi |
mul ebx |
add eax, esi |
lea eax, [VGABasePtr+eax+esi*2] |
cmp [ScreenBPP],byte 24 |
jz v12bgl3 |
add eax,esi |
mov esi, eax |
mov edi, ebx |
mov eax, [Screen_Max_X] |
add eax, 1 |
mul ebx |
add eax, [_WinMapAddress] |
cmp [eax+esi], byte 1 |
jnz v12nbgp |
mov eax, [BytesPerScanLine] |
mov ebx, edi |
mul ebx |
add eax, esi |
lea eax, [VGABasePtr+eax+esi*2] |
cmp [ScreenBPP], byte 24 |
jz v12bgl3 |
add eax, esi |
v12bgl3: |
push ebx |
push eax |
push ebx |
push eax |
sub eax,VGABasePtr |
sub eax, VGABasePtr |
shr eax,16 |
call set_bank |
pop eax |
and eax,65535 |
add eax,VGABasePtr |
pop ebx |
shr eax, 16 |
call set_bank |
pop eax |
and eax, 65535 |
add eax, VGABasePtr |
pop ebx |
mov [eax],cx |
add eax,2 |
shr ecx,16 |
mov [eax],cl |
mov [eax], cx |
add eax, 2 |
shr ecx, 16 |
mov [eax], cl |
sti |
v12nbgp: |
popa |
add esi,3 |
inc eax |
cmp eax,[draw_data+32+RECT.right] |
jg v12nodp31 |
jmp v12dp3 |
add esi, 3 |
inc eax |
cmp eax, [draw_data+32+RECT.right] |
jg v12nodp31 |
jmp v12dp3 |
v12nodp31: |
mov eax,[draw_data+32+RECT.left] |
inc ebx |
cmp ebx,[draw_data+32+RECT.bottom] |
jg v12dp4 |
jmp v12dp3 |
mov eax, [draw_data+32+RECT.left] |
inc ebx |
cmp ebx, [draw_data+32+RECT.bottom] |
jg v12dp4 |
jmp v12dp3 |
v12dp4: |
pop edx |
pop ecx |
pop ebx |
pop eax |
pop edx |
pop ecx |
pop ebx |
pop eax |
ret |
vesa12_drawbar: |
call [_display.disable_mouse] |
call [_display.disable_mouse] |
;; mov [novesachecksum],dword 0 |
sub edx,ebx |
sub ecx,eax |
push esi |
push edi |
push eax |
push ebx |
push ecx |
push edx |
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,[BytesPerScanLine] |
mul ebx |
pop ecx |
add eax,ecx ; x |
add eax,ecx |
add eax,ecx |
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x start |
jz dbpi2412 |
add eax,ecx |
sub edx, ebx |
sub ecx, eax |
push esi |
push edi |
push eax |
push ebx |
push ecx |
push edx |
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, [BytesPerScanLine] |
mul ebx |
pop ecx |
add eax, ecx ; x |
add eax, ecx |
add eax, ecx |
cmp [ScreenBPP], byte 24; 24 or 32 bpp ? - x start |
jz dbpi2412 |
add eax, ecx |
dbpi2412: |
add eax,VGABasePtr |
mov edi,eax |
add eax, VGABasePtr |
mov edi, eax |
; x size |
mov eax,[esp+4] ; [esp+6] |
mov ecx,eax |
add ecx,eax |
add ecx,eax |
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
jz dbpi24312 |
add ecx,eax |
mov eax, [esp+4]; [esp+6] |
mov ecx, eax |
add ecx, eax |
add ecx, eax |
cmp [ScreenBPP], byte 24; 24 or 32 bpp ? - x size |
jz dbpi24312 |
add ecx, eax |
dbpi24312: |
mov ebx,[esp+0] |
mov ebx, [esp+0] |
; check limits ? |
push eax |
push ecx |
mov eax,[TASK_BASE] |
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.left] |
cmp ecx,0 |
jnz dbcblimitlset12 |
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.top] |
cmp ecx,0 |
jnz dbcblimitlset12 |
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right] |
cmp ecx,[Screen_Max_X] |
jnz dbcblimitlset12 |
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom] |
cmp ecx,[Screen_Max_Y] |
jnz dbcblimitlset12 |
pop ecx |
pop eax |
push dword 0 |
jmp dbcblimitlno12 |
push eax |
push ecx |
mov eax, [TASK_BASE] |
mov ecx, [eax+draw_data-CURRENT_TASK+RECT.left] |
cmp ecx, 0 |
jnz dbcblimitlset12 |
mov ecx, [eax+draw_data-CURRENT_TASK+RECT.top] |
cmp ecx, 0 |
jnz dbcblimitlset12 |
mov ecx, [eax+draw_data-CURRENT_TASK+RECT.right] |
cmp ecx, [Screen_Max_X] |
jnz dbcblimitlset12 |
mov ecx, [eax+draw_data-CURRENT_TASK+RECT.bottom] |
cmp ecx, [Screen_Max_Y] |
jnz dbcblimitlset12 |
pop ecx |
pop eax |
push dword 0 |
jmp dbcblimitlno12 |
dbcblimitlset12: |
pop ecx |
pop eax |
push dword 1 |
pop ecx |
pop eax |
push dword 1 |
dbcblimitlno12: |
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? |
jz dbpi24bit12 |
jmp dbpi32bit12 |
cmp [ScreenBPP], byte 24; 24 or 32 bpp ? |
jz dbpi24bit12 |
jmp dbpi32bit12 |
; DRAWBAR 24 BBP |
472,101 → 472,101 |
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 |
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 |
push ebx |
push edi |
push ecx |
xor edx,edx |
mov eax,edi |
sub eax,VGABasePtr |
mov ebx,3 |
div ebx |
add eax, [_WinMapAddress] |
mov ebx,[CURRENT_TASK] |
cld |
xor edx, edx |
mov eax, edi |
sub eax, VGABasePtr |
mov ebx, 3 |
div ebx |
add eax, [_WinMapAddress] |
mov ebx, [CURRENT_TASK] |
cld |
dbnp2412: |
mov dl,[eax] |
push eax |
push ecx |
cmp dl,bl |
jnz dbimp24no12 |
cmp [esp+5*4],dword 0 |
jz dbimp24yes12 |
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 |
sub eax,VGABasePtr |
shr eax,16 |
call set_bank |
and edi,0xffff |
add edi,VGABasePtr |
mov eax,[esp+8+3*4+16+4+4] |
push edi |
mov eax, edi |
sub eax, VGABasePtr |
shr eax, 16 |
call set_bank |
and edi, 0xffff |
add edi, VGABasePtr |
mov eax, [esp+8+3*4+16+4+4] |
stosw |
shr eax,16 |
shr eax, 16 |
stosb |
sti |
pop edi |
add edi,3 |
pop ecx |
pop eax |
inc eax |
loop dbnp2412 |
jmp dbnp24d12 |
pop edi |
add edi, 3 |
pop ecx |
pop eax |
inc eax |
loop dbnp2412 |
jmp dbnp24d12 |
dbimp24no12: |
pop ecx |
pop eax |
pop ecx |
pop eax |
cld |
add edi,3 |
inc eax |
loop dbnp2412 |
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 |
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 |
add edi,[BytesPerScanLine] |
dec ebx |
jz dbnonewpi12 |
jmp dbnewpi12 |
pop ecx |
pop edi |
pop ebx |
add edi, [BytesPerScanLine] |
dec ebx |
jz dbnonewpi12 |
jmp dbnewpi12 |
dbnonewpi12: |
add esp,7*4 |
add esp, 7*4 |
ret |
ret |
; DRAWBAR 32 BBP |
574,109 → 574,109 |
dbpi32bit12: |
cld |
shr ecx,2 |
cld |
shr ecx, 2 |
dbnewpi3212: |
push ebx |
push edi |
push ecx |
push ebx |
push edi |
push ecx |
mov eax,edi |
sub eax,VGABasePtr |
shr eax,2 |
add eax, [_WinMapAddress] |
mov ebx,[CURRENT_TASK] |
cld |
mov eax, edi |
sub eax, VGABasePtr |
shr eax, 2 |
add eax, [_WinMapAddress] |
mov ebx, [CURRENT_TASK] |
cld |
dbnp3212: |
mov dl,[eax] |
push eax |
push ecx |
cmp dl,bl |
jnz dbimp32no12 |
cmp [esp+5*4],dword 0 |
jz dbimp32yes12 |
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 |
sub eax,VGABasePtr |
shr eax,16 |
call set_bank |
and edi,0xffff |
add edi,VGABasePtr |
mov eax,[esp+8+3*4+16+4+4] |
push edi |
mov eax, edi |
sub eax, VGABasePtr |
shr eax, 16 |
call set_bank |
and edi, 0xffff |
add edi, VGABasePtr |
mov eax, [esp+8+3*4+16+4+4] |
stosw |
shr eax,16 |
shr eax, 16 |
stosb |
sti |
pop edi |
add edi,4 |
inc ebp |
pop ecx |
pop eax |
inc eax |
loop dbnp3212 |
jmp dbnp32d12 |
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 |
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 |
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 |
add edi,[BytesPerScanLine] |
dec ebx |
jz nodbnewpi3212 |
jmp dbnewpi3212 |
pop ecx |
pop edi |
pop ebx |
add edi, [BytesPerScanLine] |
dec ebx |
jz nodbnewpi3212 |
jmp dbnewpi3212 |
nodbnewpi3212: |
add esp,7*4 |
ret |
add esp, 7*4 |
ret |
Vesa12_putpixel24: |
mov edi,eax ; x |
mov eax,ebx ; y |
lea edi,[edi+edi*2] |
mov ebx,[BytesPerScanLine] |
mul ebx |
add edi,eax |
mov eax,edi |
shr eax,16 |
call set_bank |
and edi,65535 |
add edi,VGABasePtr |
mov eax,[esp+28] |
mov edi, eax; x |
mov eax, ebx; y |
lea edi, [edi+edi*2] |
mov ebx, [BytesPerScanLine] |
mul ebx |
add edi, eax |
mov eax, edi |
shr eax, 16 |
call set_bank |
and edi, 65535 |
add edi, VGABasePtr |
mov eax, [esp+28] |
stosw |
shr eax,16 |
mov [edi],al |
shr eax, 16 |
mov [edi], al |
sti |
ret |
684,19 → 684,19 |
Vesa12_putpixel32: |
mov edi,eax ; x |
mov eax,ebx ; y |
shl edi,2 |
mov ebx,[BytesPerScanLine] |
mul ebx |
add edi,eax |
mov eax,edi |
shr eax,16 |
call set_bank |
and edi,65535 |
add edi,VGABasePtr |
mov ecx,[esp+28] |
mov [edi],ecx |
mov edi, eax; x |
mov eax, ebx; y |
shl edi, 2 |
mov ebx, [BytesPerScanLine] |
mul ebx |
add edi, eax |
mov eax, edi |
shr eax, 16 |
call set_bank |
and edi, 65535 |
add edi, VGABasePtr |
mov ecx, [esp+28] |
mov [edi], ecx |
sti |
ret |
703,19 → 703,19 |
Vesa12_getpixel24: |
mov edi,eax ; x |
mov eax,ebx ; y |
lea edi,[edi+edi*2] |
mov ebx,[BytesPerScanLine] |
mul ebx |
add edi,eax |
mov eax,edi |
shr eax,16 |
call set_bank |
and edi,65535 |
add edi,VGABasePtr |
mov ecx,[edi] |
and ecx,255*256*256+255*256+255 |
mov edi, eax; x |
mov eax, ebx; y |
lea edi, [edi+edi*2] |
mov ebx, [BytesPerScanLine] |
mul ebx |
add edi, eax |
mov eax, edi |
shr eax, 16 |
call set_bank |
and edi, 65535 |
add edi, VGABasePtr |
mov ecx, [edi] |
and ecx, 255*256*256+255*256+255 |
sti |
ret |
722,20 → 722,20 |
Vesa12_getpixel32: |
mov edi,eax ; x |
mov eax,ebx ; y |
shl edi,2 |
mov ebx,[BytesPerScanLine] |
xor edx,edx |
mul ebx |
add edi,eax |
mov eax,edi |
shr eax,16 |
call set_bank |
and edi,65535 |
add edi,VGABasePtr |
mov ecx,[edi] |
and ecx,255*256*256+255*256+255 |
mov edi, eax; x |
mov eax, ebx; y |
shl edi, 2 |
mov ebx, [BytesPerScanLine] |
xor edx, edx |
mul ebx |
add edi, eax |
mov eax, edi |
shr eax, 16 |
call set_bank |
and edi, 65535 |
add edi, VGABasePtr |
mov ecx, [edi] |
and ecx, 255*256*256+255*256+255 |
sti |
ret |
754,91 → 754,91 |
; mov ecx,320*65536+240 |
; mov edx,20*65536+20 |
call [_display.disable_mouse] |
call [_display.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] |
mov ecx,[TASK_BASE] |
add eax,[ecx-twdw+WDATA.box.left] |
add ebx,[ecx-twdw+WDATA.box.top] |
push eax |
mov eax,ebx ; y |
mul dword [BytesPerScanLine] |
pop ecx |
add eax,ecx ; x |
add eax,ecx |
add eax,ecx |
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x start |
jz pi2412 |
add eax,ecx |
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] |
mov ecx, [TASK_BASE] |
add eax, [ecx-twdw+WDATA.box.left] |
add ebx, [ecx-twdw+WDATA.box.top] |
push eax |
mov eax, ebx ; y |
mul dword [BytesPerScanLine] |
pop ecx |
add eax, ecx ; x |
add eax, ecx |
add eax, ecx |
cmp [ScreenBPP], byte 24; 24 or 32 bpp ? - x start |
jz pi2412 |
add eax, ecx |
pi2412: |
add eax,VGABasePtr |
mov edi,eax |
add eax, VGABasePtr |
mov edi, eax |
; x size |
movzx ecx,word [esp+6] |
movzx ecx, word [esp+6] |
mov esi,[esp+8] |
movzx ebx,word [esp+4] |
mov esi, [esp+8] |
movzx ebx, word [esp+4] |
; check limits while draw ? |
push ecx |
mov eax,[TASK_BASE] |
cmp dword [eax+draw_data-CURRENT_TASK+RECT.left], 0 |
jnz dbcblimitlset212 |
cmp dword [eax+draw_data-CURRENT_TASK+RECT.top], 0 |
jnz dbcblimitlset212 |
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right] |
cmp ecx,[Screen_Max_X] |
jnz dbcblimitlset212 |
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom] |
cmp ecx,[Screen_Max_Y] |
jnz dbcblimitlset212 |
pop ecx |
push 0 |
jmp dbcblimitlno212 |
push ecx |
mov eax, [TASK_BASE] |
cmp dword [eax+draw_data-CURRENT_TASK+RECT.left], 0 |
jnz dbcblimitlset212 |
cmp dword [eax+draw_data-CURRENT_TASK+RECT.top], 0 |
jnz dbcblimitlset212 |
mov ecx, [eax+draw_data-CURRENT_TASK+RECT.right] |
cmp ecx, [Screen_Max_X] |
jnz dbcblimitlset212 |
mov ecx, [eax+draw_data-CURRENT_TASK+RECT.bottom] |
cmp ecx, [Screen_Max_Y] |
jnz dbcblimitlset212 |
pop ecx |
push 0 |
jmp dbcblimitlno212 |
dbcblimitlset212: |
pop ecx |
push 1 |
pop ecx |
push 1 |
dbcblimitlno212: |
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? |
jnz pi32bit12 |
cmp [ScreenBPP], byte 24; 24 or 32 bpp ? |
jnz pi32bit12 |
pi24bit12: |
newpi12: |
push edi |
push ecx |
push ebx |
push edi |
push ecx |
push ebx |
mov edx,edi |
sub edx,VGABasePtr |
mov ebx,3 |
div ebx |
add edx, [_WinMapAddress] |
mov ebx,[CURRENT_TASK] |
mov bh,[esp+4*3] |
mov edx, edi |
sub edx, VGABasePtr |
mov ebx, 3 |
div ebx |
add edx, [_WinMapAddress] |
mov ebx, [CURRENT_TASK] |
mov bh, [esp+4*3] |
np2412: |
cmp bl,[edx] |
jnz imp24no12 |
cmp bl, [edx] |
jnz imp24no12 |
; mov eax,[esi] |
push dword [esp+4*3+20] |
call ebp |
849,48 → 849,48 |
imp24yes12: |
push edi |
push eax |
mov eax,edi |
sub eax,VGABasePtr |
shr eax,16 |
call set_bank |
pop eax |
and edi,0xffff |
add edi,VGABasePtr |
mov [edi],ax |
shr eax,16 |
mov [edi+2],al |
pop edi |
push edi |
push eax |
mov eax, edi |
sub eax, VGABasePtr |
shr eax, 16 |
call set_bank |
pop eax |
and edi, 0xffff |
add edi, VGABasePtr |
mov [edi], ax |
shr eax, 16 |
mov [edi+2], al |
pop edi |
imp24no12: |
inc edx |
inc edx |
; add esi,3 |
add edi,3 |
dec ecx |
jnz np2412 |
add edi, 3 |
dec ecx |
jnz np2412 |
np24d12: |
pop ebx |
pop ecx |
pop edi |
pop ebx |
pop ecx |
pop edi |
add edi,[BytesPerScanLine] |
add esi,[esp+32] |
cmp ebp,putimage_get1bpp |
jz .correct |
cmp ebp,putimage_get2bpp |
jz .correct |
cmp ebp,putimage_get4bpp |
jnz @f |
add edi, [BytesPerScanLine] |
add esi, [esp+32] |
cmp ebp, putimage_get1bpp |
jz .correct |
cmp ebp, putimage_get2bpp |
jz .correct |
cmp ebp, putimage_get4bpp |
jnz @f |
.correct: |
mov eax,[esp+20] |
mov byte[eax],80h |
mov eax, [esp+20] |
mov byte[eax], 80h |
@@: |
dec ebx |
jnz newpi12 |
dec ebx |
jnz newpi12 |
nonewpi12: |
903,21 → 903,21 |
newpi3212: |
push edi |
push ecx |
push ebx |
push edi |
push ecx |
push ebx |
mov edx,edi |
sub edx,VGABasePtr |
shr edx,2 |
add edx, [_WinMapAddress] |
mov ebx,[CURRENT_TASK] |
mov bh,[esp+4*3] |
mov edx, edi |
sub edx, VGABasePtr |
shr edx, 2 |
add edx, [_WinMapAddress] |
mov ebx, [CURRENT_TASK] |
mov bh, [esp+4*3] |
np3212: |
cmp bl,[edx] |
jnz imp32no12 |
cmp bl, [edx] |
jnz imp32no12 |
; mov eax,[esi] |
push dword [esp+4*3+20] |
call ebp |
928,44 → 928,44 |
imp32yes12: |
push edi |
push eax |
mov eax,edi |
sub eax,VGABasePtr |
shr eax,16 |
call set_bank |
pop eax |
and edi,0xffff |
mov [edi+VGABasePtr],eax |
pop edi |
push edi |
push eax |
mov eax, edi |
sub eax, VGABasePtr |
shr eax, 16 |
call set_bank |
pop eax |
and edi, 0xffff |
mov [edi+VGABasePtr], eax |
pop edi |
imp32no12: |
inc edx |
inc edx |
; add esi,3 |
add edi,4 |
dec ecx |
jnz np3212 |
add edi, 4 |
dec ecx |
jnz np3212 |
np32d12: |
pop ebx |
pop ecx |
pop edi |
pop ebx |
pop ecx |
pop edi |
add edi,[BytesPerScanLine] |
cmp ebp,putimage_get1bpp |
jz .correct |
cmp ebp,putimage_get2bpp |
jz .correct |
cmp ebp,putimage_get4bpp |
jnz @f |
add edi, [BytesPerScanLine] |
cmp ebp, putimage_get1bpp |
jz .correct |
cmp ebp, putimage_get2bpp |
jz .correct |
cmp ebp, putimage_get4bpp |
jnz @f |
.correct: |
mov eax,[esp+20] |
mov byte[eax],80h |
mov eax, [esp+20] |
mov byte[eax], 80h |
@@: |
dec ebx |
jnz newpi3212 |
dec ebx |
jnz newpi3212 |
nonewpi3212: |
976,29 → 976,29 |
vesa12_read_screen_pixel: |
and eax,0x3FFFFF |
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? |
jz v12rsp24 |
mov edi,eax |
shl edi,2 |
mov eax,edi |
shr eax,16 |
call set_bank |
and edi,65535 |
add edi,VGABasePtr |
mov eax,[edi] |
and eax,0x00ffffff |
ret |
and eax, 0x3FFFFF |
cmp [ScreenBPP], byte 24; 24 or 32 bpp ? |
jz v12rsp24 |
mov edi, eax |
shl edi, 2 |
mov eax, edi |
shr eax, 16 |
call set_bank |
and edi, 65535 |
add edi, VGABasePtr |
mov eax, [edi] |
and eax, 0x00ffffff |
ret |
v12rsp24: |
imul eax,3 |
mov edi,eax |
shr eax,16 |
call set_bank |
and edi,65535 |
add edi,VGABasePtr |
mov eax,[edi] |
and eax,0x00ffffff |
ret |
imul eax, 3 |
mov edi, eax |
shr eax, 16 |
call set_bank |
and edi, 65535 |
add edi, VGABasePtr |
mov eax, [edi] |
and eax, 0x00ffffff |
ret |
/kernel/branches/net/video/vesa20.inc |
---|
42,27 → 42,27 |
; ecx = 00 RR GG BB |
getpixel: |
push eax ebx edx edi |
call dword [GETPIXEL] |
pop edi edx ebx eax |
ret |
push eax ebx edx edi |
call dword [GETPIXEL] |
pop edi edx ebx eax |
ret |
Vesa20_getpixel24: |
; eax = x |
; ebx = y |
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
lea edi, [eax+eax*2] ; edi = x*3 |
add edi, ebx ; edi = x*3+(y*y multiplier) |
mov ecx, [LFB_BASE+edi] |
and ecx, 0xffffff |
ret |
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
lea edi, [eax+eax*2]; edi = x*3 |
add edi, ebx ; edi = x*3+(y*y multiplier) |
mov ecx, [LFB_BASE+edi] |
and ecx, 0xffffff |
ret |
Vesa20_getpixel32: |
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier) |
mov ecx, [LFB_BASE+edi] |
and ecx, 0xffffff |
ret |
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier) |
mov ecx, [LFB_BASE+edi] |
and ecx, 0xffffff |
ret |
;************************************************* |
102,195 → 102,195 |
; edi = parameter for 'get' function |
vesa20_putimage: |
pushad |
call [_display.disable_mouse] |
sub esp, putimg.stack_data |
pushad |
call [_display.disable_mouse] |
sub esp, putimg.stack_data |
; save pointer to image |
mov [putimg.pti], ebx |
mov [putimg.pti], ebx |
; unpack the size |
mov eax, ecx |
and ecx, 0xFFFF |
shr eax, 16 |
mov [putimg.image_sx], eax |
mov [putimg.image_sy], ecx |
mov eax, ecx |
and ecx, 0xFFFF |
shr eax, 16 |
mov [putimg.image_sx], eax |
mov [putimg.image_sy], ecx |
; unpack the coordinates |
mov eax, edx |
and edx, 0xFFFF |
shr eax, 16 |
mov [putimg.image_cx], eax |
mov [putimg.image_cy], edx |
mov eax, edx |
and edx, 0xFFFF |
shr eax, 16 |
mov [putimg.image_cx], eax |
mov [putimg.image_cy], edx |
; calculate absolute (i.e. screen) coordinates |
mov eax, [TASK_BASE] |
mov ebx, [eax-twdw + WDATA.box.left] |
add ebx, [putimg.image_cx] |
mov [putimg.abs_cx], ebx |
mov ebx, [eax-twdw + WDATA.box.top] |
add ebx, [putimg.image_cy] |
mov [putimg.abs_cy], ebx |
mov eax, [TASK_BASE] |
mov ebx, [eax-twdw + WDATA.box.left] |
add ebx, [putimg.image_cx] |
mov [putimg.abs_cx], ebx |
mov ebx, [eax-twdw + WDATA.box.top] |
add ebx, [putimg.image_cy] |
mov [putimg.abs_cy], ebx |
; real_sx = MIN(wnd_sx-image_cx, image_sx); |
mov ebx, [eax-twdw + WDATA.box.width] ; ebx = wnd_sx |
mov ebx, [eax-twdw + WDATA.box.width]; ebx = wnd_sx |
; \begin{diamond}[20.08.2006] |
; note that WDATA.box.width is one pixel less than real window x-size |
inc ebx |
inc ebx |
; \end{diamond}[20.08.2006] |
sub ebx, [putimg.image_cx] |
ja @f |
add esp, putimg.stack_data |
popad |
ret |
sub ebx, [putimg.image_cx] |
ja @f |
add esp, putimg.stack_data |
popad |
ret |
@@: |
cmp ebx, [putimg.image_sx] |
jbe .end_x |
mov ebx, [putimg.image_sx] |
cmp ebx, [putimg.image_sx] |
jbe .end_x |
mov ebx, [putimg.image_sx] |
.end_x: |
mov [putimg.real_sx], ebx |
mov [putimg.real_sx], ebx |
; init real_sy |
mov ebx, [eax-twdw + WDATA.box.height] ; ebx = wnd_sy |
mov ebx, [eax-twdw + WDATA.box.height]; ebx = wnd_sy |
; \begin{diamond}[20.08.2006] |
inc ebx |
inc ebx |
; \end{diamond}[20.08.2006] |
sub ebx, [putimg.image_cy] |
ja @f |
add esp, putimg.stack_data |
popad |
ret |
sub ebx, [putimg.image_cy] |
ja @f |
add esp, putimg.stack_data |
popad |
ret |
@@: |
cmp ebx, [putimg.image_sy] |
jbe .end_y |
mov ebx, [putimg.image_sy] |
cmp ebx, [putimg.image_sy] |
jbe .end_y |
mov ebx, [putimg.image_sy] |
.end_y: |
mov [putimg.real_sy], ebx |
mov [putimg.real_sy], ebx |
; line increment |
mov eax, [putimg.image_sx] |
mov ecx, [putimg.real_sx] |
sub eax, ecx |
mov eax, [putimg.image_sx] |
mov ecx, [putimg.real_sx] |
sub eax, ecx |
;; imul eax, [putimg.source_bpp] |
; lea eax, [eax + eax * 2] |
call esi |
add eax, [putimg.arg_0] |
mov [putimg.line_increment], eax |
call esi |
add eax, [putimg.arg_0] |
mov [putimg.line_increment], eax |
; winmap new line increment |
mov eax, [Screen_Max_X] |
inc eax |
sub eax, [putimg.real_sx] |
mov [putimg.winmap_newline], eax |
mov eax, [Screen_Max_X] |
inc eax |
sub eax, [putimg.real_sx] |
mov [putimg.winmap_newline], eax |
; screen new line increment |
mov eax, [BytesPerScanLine] |
movzx ebx, byte [ScreenBPP] |
shr ebx, 3 |
imul ecx, ebx |
sub eax, ecx |
mov [putimg.screen_newline], eax |
mov eax, [BytesPerScanLine] |
movzx ebx, byte [ScreenBPP] |
shr ebx, 3 |
imul ecx, ebx |
sub eax, ecx |
mov [putimg.screen_newline], eax |
; pointer to image |
mov esi, [putimg.pti] |
mov esi, [putimg.pti] |
; pointer to screen |
mov edx, [putimg.abs_cy] |
imul edx, [BytesPerScanLine] |
mov eax, [putimg.abs_cx] |
movzx ebx, byte [ScreenBPP] |
shr ebx, 3 |
imul eax, ebx |
add edx, eax |
mov edx, [putimg.abs_cy] |
imul edx, [BytesPerScanLine] |
mov eax, [putimg.abs_cx] |
movzx ebx, byte [ScreenBPP] |
shr ebx, 3 |
imul eax, ebx |
add edx, eax |
; pointer to pixel map |
mov eax, [putimg.abs_cy] |
imul eax, [Screen_Max_X] |
add eax, [putimg.abs_cy] |
add eax, [putimg.abs_cx] |
add eax, [_WinMapAddress] |
xchg eax, ebp |
mov eax, [putimg.abs_cy] |
imul eax, [Screen_Max_X] |
add eax, [putimg.abs_cy] |
add eax, [putimg.abs_cx] |
add eax, [_WinMapAddress] |
xchg eax, ebp |
; get process number |
mov ebx, [CURRENT_TASK] |
cmp byte [ScreenBPP], 32 |
je put_image_end_32 |
mov ebx, [CURRENT_TASK] |
cmp byte [ScreenBPP], 32 |
je put_image_end_32 |
;put_image_end_24: |
mov edi, [putimg.real_sy] |
mov edi, [putimg.real_sy] |
align 4 |
.new_line: |
mov ecx, [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 |
push [putimg.edi] |
mov eax, [putimg.ebp+4] |
call eax |
cmp [ebp], bl |
jne .skip |
; mov eax, [esi] ; eax = RRBBGGRR |
mov [LFB_BASE+edx], ax |
shr eax, 16 |
mov [LFB_BASE+edx+2], al |
mov [LFB_BASE+edx], ax |
shr eax, 16 |
mov [LFB_BASE+edx+2], al |
.skip: |
; add esi, 3 ;[putimg.source_bpp] |
add edx, 3 |
inc ebp |
dec ecx |
jnz .new_x |
add edx, 3 |
inc ebp |
dec ecx |
jnz .new_x |
; pop edx ebp |
add esi, [putimg.line_increment] |
add edx, [putimg.screen_newline] ;[BytesPerScanLine] |
add ebp, [putimg.winmap_newline] ;[Screen_Max_X] |
add esi, [putimg.line_increment] |
add edx, [putimg.screen_newline];[BytesPerScanLine] |
add ebp, [putimg.winmap_newline];[Screen_Max_X] |
; inc ebp |
cmp [putimg.ebp], putimage_get1bpp |
jz .correct |
cmp [putimg.ebp], putimage_get2bpp |
jz .correct |
cmp [putimg.ebp], putimage_get4bpp |
jnz @f |
cmp [putimg.ebp], putimage_get1bpp |
jz .correct |
cmp [putimg.ebp], putimage_get2bpp |
jz .correct |
cmp [putimg.ebp], putimage_get4bpp |
jnz @f |
.correct: |
mov eax, [putimg.edi] |
mov byte [eax], 80h |
mov eax, [putimg.edi] |
mov byte [eax], 80h |
@@: |
dec edi |
jnz .new_line |
dec edi |
jnz .new_line |
.finish: |
add esp, putimg.stack_data |
popad |
ret |
add esp, putimg.stack_data |
popad |
ret |
put_image_end_32: |
mov edi, [putimg.real_sy] |
mov edi, [putimg.real_sy] |
align 4 |
.new_line: |
mov ecx, [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 |
push [putimg.edi] |
mov eax, [putimg.ebp+4] |
call eax |
cmp [ebp], bl |
jne .skip |
; mov eax, [esi] ; ecx = RRBBGGRR |
mov [LFB_BASE+edx], eax |
mov [LFB_BASE+edx], eax |
.skip: |
; add esi, [putimg.source_bpp] |
add edx, 4 |
inc ebp |
dec ecx |
jnz .new_x |
add edx, 4 |
inc ebp |
dec ecx |
jnz .new_x |
; pop edx ebp |
add esi, [putimg.line_increment] |
add edx, [putimg.screen_newline] ;[BytesPerScanLine] |
add ebp, [putimg.winmap_newline] ;[Screen_Max_X] |
add esi, [putimg.line_increment] |
add edx, [putimg.screen_newline];[BytesPerScanLine] |
add ebp, [putimg.winmap_newline];[Screen_Max_X] |
; inc ebp |
cmp [putimg.ebp], putimage_get1bpp |
jz .correct |
cmp [putimg.ebp], putimage_get2bpp |
jz .correct |
cmp [putimg.ebp], putimage_get4bpp |
jnz @f |
cmp [putimg.ebp], putimage_get1bpp |
jz .correct |
cmp [putimg.ebp], putimage_get2bpp |
jz .correct |
cmp [putimg.ebp], putimage_get4bpp |
jnz @f |
.correct: |
mov eax, [putimg.edi] |
mov byte [eax], 80h |
mov eax, [putimg.edi] |
mov byte [eax], 80h |
@@: |
dec edi |
jnz .new_line |
dec edi |
jnz .new_line |
.finish: |
add esp, putimg.stack_data |
popad |
call VGA__putimage |
mov [EGA_counter],1 |
ret |
add esp, putimg.stack_data |
popad |
call VGA__putimage |
mov [EGA_counter], 1 |
ret |
;************************************************* |
303,50 → 303,50 |
; edi = 0x00000001 force |
;;; mov [novesachecksum], dword 0 |
pushad |
cmp [Screen_Max_X], eax |
jb .exit |
cmp [Screen_Max_Y], ebx |
jb .exit |
test edi,1 ; force ? |
jnz .forced |
pushad |
cmp [Screen_Max_X], eax |
jb .exit |
cmp [Screen_Max_Y], ebx |
jb .exit |
test edi, 1 ; force ? |
jnz .forced |
; not forced: |
push eax |
mov edx,[_display.width] ; screen x size |
imul edx, ebx |
add eax, [_WinMapAddress] |
movzx edx, byte [eax+edx] |
cmp edx, [CURRENT_TASK] |
pop eax |
jne .exit |
push eax |
mov edx, [_display.width]; screen x size |
imul edx, ebx |
add eax, [_WinMapAddress] |
movzx edx, byte [eax+edx] |
cmp edx, [CURRENT_TASK] |
pop eax |
jne .exit |
.forced: |
; check if negation |
test ecx,0x01000000 |
jz .noneg |
call getpixel |
not ecx |
mov [esp+32-8],ecx |
test ecx, 0x01000000 |
jz .noneg |
call getpixel |
not ecx |
mov [esp+32-8], ecx |
.noneg: |
; OK to set pixel |
call dword [PUTPIXEL] ; call the real put_pixel function |
call dword [PUTPIXEL]; call the real put_pixel function |
.exit: |
popad |
ret |
popad |
ret |
align 4 |
Vesa20_putpixel24: |
; eax = x |
; ebx = y |
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
lea edi, [eax+eax*2] ; edi = x*3 |
mov eax, [esp+32-8+4] |
mov [LFB_BASE+ebx+edi], ax |
shr eax, 16 |
mov [LFB_BASE+ebx+edi+2], al |
ret |
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
lea edi, [eax+eax*2]; edi = x*3 |
mov eax, [esp+32-8+4] |
mov [LFB_BASE+ebx+edi], ax |
shr eax, 16 |
mov [LFB_BASE+ebx+edi+2], al |
ret |
align 4 |
353,21 → 353,21 |
Vesa20_putpixel32: |
; eax = x |
; ebx = y |
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 |
mov [LFB_BASE+edi], eax |
ret |
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 |
mov [LFB_BASE+edi], eax |
ret |
;************************************************* |
;align 4 |
calculate_edi: |
mov edi, ebx |
imul edi, [Screen_Max_X] |
add edi, ebx |
add edi, eax |
ret |
mov edi, ebx |
imul edi, [Screen_Max_X] |
add edi, ebx |
add edi, eax |
ret |
;************************************************* |
376,7 → 376,7 |
align 4 |
__sys_draw_line: |
; inc [mouse_pause] |
call [_display.disable_mouse] |
call [_display.disable_mouse] |
; draw a line |
; eax = HIWORD = x1 |
394,107 → 394,138 |
dl_dx equ esp+4 |
dl_dy equ esp+0 |
xor edx, edx ; clear edx |
xor esi, esi ; unpack arguments |
xor ebp, ebp |
mov si, ax ; esi = x2 |
mov bp, bx ; ebp = y2 |
shr eax, 16 ; eax = x1 |
shr ebx, 16 ; ebx = y1 |
push eax ; save x1 |
push ebx ; save y1 |
push esi ; save x2 |
push ebp ; save y2 |
xor edx, edx ; clear edx |
xor esi, esi ; unpack arguments |
xor ebp, ebp |
mov si, ax ; esi = x2 |
mov bp, bx ; ebp = y2 |
shr eax, 16 ; eax = x1 |
shr ebx, 16 ; ebx = y1 |
push eax ; save x1 |
push ebx ; save y1 |
push esi ; save x2 |
push ebp ; save y2 |
; checking x-axis... |
sub esi, eax ; esi = x2-x1 |
push esi ; save y2-y1 |
jl .x2lx1 ; is x2 less than x1 ? |
jg .no_vline ; x1 > x2 ? |
mov edx, ebp ; else (if x1=x2) |
call vline |
push edx ; necessary to rightly restore stack frame at .exit |
jmp .exit |
sub esi, eax ; esi = x2-x1 |
push esi ; save y2-y1 |
jl .x2lx1 ; is x2 less than x1 ? |
jg .no_vline ; x1 > x2 ? |
mov edx, ebp ; else (if x1=x2) |
call vline |
push edx ; necessary to rightly restore stack frame at .exit |
jmp .exit |
.x2lx1: |
neg esi ; get esi absolute value |
neg esi ; get esi absolute value |
.no_vline: |
; checking y-axis... |
sub ebp, ebx ; ebp = y2-y1 |
push ebp ; save y2-y1 |
jl .y2ly1 ; is y2 less than y1 ? |
jg .no_hline ; y1 > y2 ? |
mov edx, [dl_x2] ; else (if y1=y2) |
call hline |
jmp .exit |
sub ebp, ebx ; ebp = y2-y1 |
push ebp ; save y2-y1 |
jl .y2ly1 ; is y2 less than y1 ? |
jg .no_hline ; y1 > y2 ? |
mov edx, [dl_x2]; else (if y1=y2) |
call hline |
jmp .exit |
.y2ly1: |
neg ebp ; get ebp absolute value |
neg ebp ; get ebp absolute value |
.no_hline: |
cmp ebp, esi |
jle .x_rules ; |y2-y1| < |x2-x1| ? |
cmp [dl_y2], ebx ; make sure y1 is at the begining |
jge .no_reverse1 |
neg dword [dl_dx] |
mov edx, [dl_x2] |
mov [dl_x2], eax |
mov [dl_x1], edx |
mov edx, [dl_y2] |
mov [dl_y2], ebx |
mov [dl_y1], edx |
cmp ebp, esi |
jle .x_rules ; |y2-y1| < |x2-x1| ? |
cmp [dl_y2], ebx; make sure y1 is at the begining |
jge .no_reverse1 |
neg dword [dl_dx] |
mov edx, [dl_x2] |
mov [dl_x2], eax |
mov [dl_x1], edx |
mov edx, [dl_y2] |
mov [dl_y2], ebx |
mov [dl_y1], edx |
.no_reverse1: |
mov eax, [dl_dx] |
cdq ; extend eax sing to edx |
shl eax, 16 ; using 16bit fix-point maths |
idiv ebp ; eax = ((x2-x1)*65536)/(y2-y1) |
mov edx, ebp ; edx = counter (number of pixels to draw) |
mov ebp, 1 *65536 ; <<16 ; ebp = dy = 1.0 |
mov esi, eax ; esi = dx |
jmp .y_rules |
mov eax, [dl_dx] |
cdq ; extend eax sing to edx |
shl eax, 16 ; using 16bit fix-point maths |
idiv ebp ; eax = ((x2-x1)*65536)/(y2-y1) |
;-------------------------------------- |
; correction for the remainder of the division |
shl edx, 1 |
cmp ebp, edx |
jb @f |
inc eax |
@@: |
;-------------------------------------- |
mov edx, ebp ; edx = counter (number of pixels to draw) |
mov ebp, 1 *65536; <<16 ; ebp = dy = 1.0 |
mov esi, eax ; esi = dx |
jmp .y_rules |
.x_rules: |
cmp [dl_x2], eax ; make sure x1 is at the begining |
jge .no_reverse2 |
neg dword [dl_dy] |
mov edx, [dl_x2] |
mov [dl_x2], eax |
mov [dl_x1], edx |
mov edx, [dl_y2] |
mov [dl_y2], ebx |
mov [dl_y1], edx |
cmp [dl_x2], eax ; make sure x1 is at the begining |
jge .no_reverse2 |
neg dword [dl_dy] |
mov edx, [dl_x2] |
mov [dl_x2], eax |
mov [dl_x1], edx |
mov edx, [dl_y2] |
mov [dl_y2], ebx |
mov [dl_y1], edx |
.no_reverse2: |
xor edx, edx |
mov eax, [dl_dy] |
cdq ; extend eax sing to edx |
shl eax, 16 ; using 16bit fix-point maths |
idiv esi ; eax = ((y2-y1)*65536)/(x2-x1) |
mov edx, esi ; edx = counter (number of pixels to draw) |
mov esi, 1 *65536 ;<< 16 ; esi = dx = 1.0 |
mov ebp, eax ; ebp = dy |
xor edx, edx |
mov eax, [dl_dy] |
cdq ; extend eax sing to edx |
shl eax, 16 ; using 16bit fix-point maths |
idiv esi ; eax = ((y2-y1)*65536)/(x2-x1) |
;-------------------------------------- |
; correction for the remainder of the division |
shl edx, 1 |
cmp esi, edx |
jb @f |
inc eax |
@@: |
;-------------------------------------- |
mov edx, esi ; edx = counter (number of pixels to draw) |
mov esi, 1 *65536;<< 16 ; esi = dx = 1.0 |
mov ebp, eax ; ebp = dy |
.y_rules: |
mov eax, [dl_x1] |
mov ebx, [dl_y1] |
shl eax, 16 |
shl ebx, 16 |
mov eax, [dl_x1] |
mov ebx, [dl_y1] |
shl eax, 16 |
shl ebx, 16 |
;----------------------------------------------------------------------------- |
align 4 |
.draw: |
push eax ebx |
shr eax, 16 |
shr ebx, 16 |
call [putpixel] |
pop ebx eax |
add ebx, ebp ; y = y+dy |
add eax, esi ; x = x+dx |
dec edx |
jnz .draw |
push eax ebx |
;-------------------------------------- |
; correction for the remainder of the division |
test ah, 0x80 |
jz @f |
add eax, 1 shl 16 |
@@: |
;-------------------------------------- |
shr eax, 16 |
;-------------------------------------- |
; correction for the remainder of the division |
test bh, 0x80 |
jz @f |
add ebx, 1 shl 16 |
@@: |
;-------------------------------------- |
shr ebx, 16 |
call [putpixel] |
pop ebx eax |
add ebx, ebp ; y = y+dy |
add eax, esi ; x = x+dx |
dec edx |
jnz .draw |
; force last drawn pixel to be at (x2,y2) |
mov eax, [dl_x2] |
mov ebx, [dl_y2] |
call [putpixel] |
mov eax, [dl_x2] |
mov ebx, [dl_y2] |
call [putpixel] |
.exit: |
add esp, 6*4 |
popa |
add esp, 6*4 |
popa |
; dec [mouse_pause] |
call [draw_pointer] |
ret |
call [draw_pointer] |
ret |
hline: |
504,18 → 535,18 |
; ebx = y |
; ecx = color |
; edi = force ? |
push eax edx |
cmp edx, eax ; make sure x2 is above x1 |
jge @f |
xchg eax, edx |
push eax edx |
cmp edx, eax ; make sure x2 is above x1 |
jge @f |
xchg eax, edx |
align 4 |
@@: |
call [putpixel] |
inc eax |
cmp eax, edx |
jle @b |
pop edx eax |
ret |
call [putpixel] |
inc eax |
cmp eax, edx |
jle @b |
pop edx eax |
ret |
vline: |
525,18 → 556,18 |
; edx = y2 |
; ecx = color |
; edi = force ? |
push ebx edx |
cmp edx, ebx ; make sure y2 is above y1 |
jge @f |
xchg ebx, edx |
push ebx edx |
cmp edx, ebx ; make sure y2 is above y1 |
jge @f |
xchg ebx, edx |
align 4 |
@@: |
call [putpixel] |
inc ebx |
cmp ebx, edx |
jle @b |
pop edx ebx |
ret |
call [putpixel] |
inc ebx |
cmp ebx, edx |
jle @b |
pop edx ebx |
ret |
;************************************************* |
565,97 → 596,97 |
; edx ye |
; edi color |
vesa20_drawbar: |
pushad |
call [_display.disable_mouse] |
sub esp, drbar.stack_data |
mov [drbar.color], edi |
sub edx, ebx |
jle .exit ;// mike.dld, 2005-01-29 |
sub ecx, eax |
jle .exit ;// mike.dld, 2005-01-29 |
mov [drbar.bar_sy], edx |
mov [drbar.bar_sx], ecx |
mov [drbar.bar_cx], eax |
mov [drbar.bar_cy], ebx |
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 |
mov [drbar.abs_cy], ebx |
pushad |
call [_display.disable_mouse] |
sub esp, drbar.stack_data |
mov [drbar.color], edi |
sub edx, ebx |
jle .exit ;// mike.dld, 2005-01-29 |
sub ecx, eax |
jle .exit ;// mike.dld, 2005-01-29 |
mov [drbar.bar_sy], edx |
mov [drbar.bar_sx], ecx |
mov [drbar.bar_cx], eax |
mov [drbar.bar_cy], ebx |
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 |
mov [drbar.abs_cy], ebx |
; real_sx = MIN(wnd_sx-bar_cx, bar_sx); |
mov ebx, [edi-twdw + WDATA.box.width] ; ebx = wnd_sx |
mov ebx, [edi-twdw + WDATA.box.width]; ebx = wnd_sx |
; \begin{diamond}[20.08.2006] |
; note that WDATA.box.width is one pixel less than real window x-size |
inc ebx |
inc ebx |
; \end{diamond}[20.08.2006] |
sub ebx, [drbar.bar_cx] |
ja @f |
sub ebx, [drbar.bar_cx] |
ja @f |
.exit: ;// mike.dld, 2005-01-29 |
add esp, drbar.stack_data |
popad |
xor eax, eax |
inc eax |
ret |
add esp, drbar.stack_data |
popad |
xor eax, eax |
inc eax |
ret |
@@: |
cmp ebx, [drbar.bar_sx] |
jbe .end_x |
mov ebx, [drbar.bar_sx] |
cmp ebx, [drbar.bar_sx] |
jbe .end_x |
mov ebx, [drbar.bar_sx] |
.end_x: |
mov [drbar.real_sx], ebx |
mov [drbar.real_sx], ebx |
; real_sy = MIN(wnd_sy-bar_cy, bar_sy); |
mov ebx, [edi-twdw + WDATA.box.height] ; ebx = wnd_sy |
mov ebx, [edi-twdw + WDATA.box.height]; ebx = wnd_sy |
; \begin{diamond}[20.08.2006] |
inc ebx |
inc ebx |
; \end{diamond} |
sub ebx, [drbar.bar_cy] |
ja @f |
add esp, drbar.stack_data |
popad |
xor eax, eax |
inc eax |
ret |
sub ebx, [drbar.bar_cy] |
ja @f |
add esp, drbar.stack_data |
popad |
xor eax, eax |
inc eax |
ret |
@@: |
cmp ebx, [drbar.bar_sy] |
jbe .end_y |
mov ebx, [drbar.bar_sy] |
cmp ebx, [drbar.bar_sy] |
jbe .end_y |
mov ebx, [drbar.bar_sy] |
.end_y: |
mov [drbar.real_sy], ebx |
mov [drbar.real_sy], ebx |
; line_inc_map |
mov eax, [Screen_Max_X] |
sub eax, [drbar.real_sx] |
inc eax |
mov [drbar.line_inc_map], eax |
mov eax, [Screen_Max_X] |
sub eax, [drbar.real_sx] |
inc eax |
mov [drbar.line_inc_map], eax |
; line_inc_scr |
mov eax, [drbar.real_sx] |
movzx ebx, byte [ScreenBPP] |
shr ebx, 3 |
imul eax, ebx |
neg eax |
add eax, [BytesPerScanLine] |
mov [drbar.line_inc_scr], eax |
mov eax, [drbar.real_sx] |
movzx ebx, byte [ScreenBPP] |
shr ebx, 3 |
imul eax, ebx |
neg eax |
add eax, [BytesPerScanLine] |
mov [drbar.line_inc_scr], eax |
; pointer to screen |
mov edx, [drbar.abs_cy] |
imul edx, [BytesPerScanLine] |
mov eax, [drbar.abs_cx] |
mov edx, [drbar.abs_cy] |
imul edx, [BytesPerScanLine] |
mov eax, [drbar.abs_cx] |
; movzx ebx, byte [ScreenBPP] |
; shr ebx, 3 |
imul eax, ebx |
add edx, eax |
imul eax, ebx |
add edx, eax |
; pointer to pixel map |
mov eax, [drbar.abs_cy] |
imul eax, [Screen_Max_X] |
add eax, [drbar.abs_cy] |
add eax, [drbar.abs_cx] |
add eax, [_WinMapAddress] |
xchg eax, ebp |
mov eax, [drbar.abs_cy] |
imul eax, [Screen_Max_X] |
add eax, [drbar.abs_cy] |
add eax, [drbar.abs_cx] |
add eax, [_WinMapAddress] |
xchg eax, ebp |
; get process number |
mov ebx, [CURRENT_TASK] |
cmp byte [ScreenBPP], 24 |
jne draw_bar_end_32 |
mov ebx, [CURRENT_TASK] |
cmp byte [ScreenBPP], 24 |
jne draw_bar_end_32 |
draw_bar_end_24: |
mov eax, [drbar.color] ;; BBGGRR00 |
mov bh, al ;; bh = BB |
shr eax, 8 ;; eax = RRGG |
mov eax, [drbar.color] ;; BBGGRR00 |
mov bh, al ;; bh = BB |
shr eax, 8 ;; eax = RRGG |
; eax - color high RRGG |
; bl - process num |
; bh - color low BB |
663,78 → 694,78 |
; edx - pointer to screen |
; esi - counter |
; edi - counter |
mov esi, [drbar.real_sy] |
mov esi, [drbar.real_sy] |
align 4 |
.new_y: |
mov edi, [drbar.real_sx] |
mov edi, [drbar.real_sx] |
align 4 |
.new_x: |
cmp byte [ebp], bl |
jne .skip |
cmp byte [ebp], bl |
jne .skip |
mov [LFB_BASE+edx], bh |
mov [LFB_BASE+edx + 1], ax |
mov [LFB_BASE+edx], bh |
mov [LFB_BASE+edx + 1], ax |
.skip: |
; add pixel |
add edx, 3 |
inc ebp |
dec edi |
jnz .new_x |
add edx, 3 |
inc ebp |
dec edi |
jnz .new_x |
; add line |
add edx, [drbar.line_inc_scr] |
add ebp, [drbar.line_inc_map] |
add edx, [drbar.line_inc_scr] |
add ebp, [drbar.line_inc_map] |
; <Ivan 15.10.04> drawing gradient bars |
test eax, 0x00800000 |
jz @f |
test bh, bh |
jz @f |
dec bh |
test eax, 0x00800000 |
jz @f |
test bh, bh |
jz @f |
dec bh |
@@: |
; </Ivan 15.10.04> |
dec esi |
jnz .new_y |
add esp, drbar.stack_data |
popad |
xor eax, eax |
ret |
dec esi |
jnz .new_y |
add esp, drbar.stack_data |
popad |
xor eax, eax |
ret |
draw_bar_end_32: |
mov eax, [drbar.color] ;; BBGGRR00 |
mov esi, [drbar.real_sy] |
mov eax, [drbar.color] ;; BBGGRR00 |
mov esi, [drbar.real_sy] |
align 4 |
.new_y: |
mov edi, [drbar.real_sx] |
mov edi, [drbar.real_sx] |
align 4 |
.new_x: |
cmp byte [ebp], bl |
jne .skip |
cmp byte [ebp], bl |
jne .skip |
mov [LFB_BASE+edx], eax |
mov [LFB_BASE+edx], eax |
.skip: |
; add pixel |
add edx, 4 |
inc ebp |
dec edi |
jnz .new_x |
add edx, 4 |
inc ebp |
dec edi |
jnz .new_x |
; add line |
add edx, [drbar.line_inc_scr] |
add ebp, [drbar.line_inc_map] |
add edx, [drbar.line_inc_scr] |
add ebp, [drbar.line_inc_map] |
; <Ivan 15.10.04> drawing gradient bars |
test eax, 0x80000000 |
jz @f |
test al, al |
jz @f |
dec al |
test eax, 0x80000000 |
jz @f |
test al, al |
jz @f |
dec al |
@@: |
; </Ivan 15.10.04> |
dec esi |
jnz .new_y |
add esp, drbar.stack_data |
popad |
call VGA_draw_bar |
xor eax, eax |
mov [EGA_counter],1 |
ret |
dec esi |
jnz .new_y |
add esp, drbar.stack_data |
popad |
call VGA_draw_bar |
xor eax, eax |
mov [EGA_counter], 1 |
ret |
align 4 |
vesa20_drawbackground_tiled: |
760,7 → 791,7 |
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
call calculate_edi |
xchg edi, ebp |
add ebp, [_WinMapAddress] |
add ebp, [_WinMapAddress] |
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress |
; 2) Calculate offset in background memory block |
push eax |
931,7 → 962,7 |
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1) |
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1) |
sdp3a: |
mov eax, [_WinMapAddress] |
mov eax, [_WinMapAddress] |
cmp [ebp+eax], byte 1 |
jnz snbgp |
mov eax, [bgr_cur_line+esi] |
997,12 → 1028,12 |
mov edi, bgr_cur_line |
mov ecx, [Screen_Max_X] |
inc ecx |
rep movsd |
rep movsd |
jmp bgr_resmooth1 |
sdpdone: |
add esp, 44 |
popad |
mov [EGA_counter],1 |
mov [EGA_counter], 1 |
call VGA_drawbackground |
ret |
/kernel/branches/net/video/vga.inc |
---|
17,102 → 17,102 |
paletteVGA: |
;16 colour palette |
mov dx,0x3c8 |
mov al,0 |
out dx,al |
mov dx, 0x3c8 |
mov al, 0 |
out dx, al |
mov ecx,16 |
mov dx,0x3c9 |
xor eax,eax |
mov ecx, 16 |
mov dx, 0x3c9 |
xor eax, eax |
palvganew: |
mov al,0 |
test ah,4 |
jz palvgalbl1 |
add al,31 |
test ah,8 |
jz palvgalbl1 |
add al,32 |
mov al, 0 |
test ah, 4 |
jz palvgalbl1 |
add al, 31 |
test ah, 8 |
jz palvgalbl1 |
add al, 32 |
palvgalbl1: |
out dx,al ; red 0,31 or 63 |
mov al,0 |
test ah,2 |
jz palvgalbl2 |
add al,31 |
test ah,8 |
jz palvgalbl2 |
add al,32 |
out dx, al; red 0,31 or 63 |
mov al, 0 |
test ah, 2 |
jz palvgalbl2 |
add al, 31 |
test ah, 8 |
jz palvgalbl2 |
add al, 32 |
palvgalbl2: |
out dx,al ; blue 0,31 or 63 |
mov al,0 |
test ah,1 |
jz palvgalbl3 |
add al,31 |
test ah,8 |
jz palvgalbl3 |
add al,32 |
out dx, al; blue 0,31 or 63 |
mov al, 0 |
test ah, 1 |
jz palvgalbl3 |
add al, 31 |
test ah, 8 |
jz palvgalbl3 |
add al, 32 |
palvgalbl3: |
out dx,al ; green 0,31 or 63 |
add ah,1 |
loop palvganew |
out dx, al; green 0,31 or 63 |
add ah, 1 |
loop palvganew |
; mov dx, 3ceh |
; mov ax, 0005h |
; out dx, ax |
ret |
ret |
palette320x200: |
mov edx,0x3c8 |
xor eax, eax |
out dx,al |
mov ecx,256 |
mov edx,0x3c9 |
xor eax,eax |
mov edx, 0x3c8 |
xor eax, eax |
out dx, al |
mov ecx, 256 |
mov edx, 0x3c9 |
xor eax, eax |
palnew: |
mov al,0 |
test ah,64 |
jz pallbl1 |
add al,21 |
mov al, 0 |
test ah, 64 |
jz pallbl1 |
add al, 21 |
pallbl1: |
test ah,128 |
jz pallbl2 |
add al,42 |
test ah, 128 |
jz pallbl2 |
add al, 42 |
pallbl2: |
out dx,al |
mov al,0 |
test ah,8 |
jz pallbl3 |
add al,8 |
out dx, al |
mov al, 0 |
test ah, 8 |
jz pallbl3 |
add al, 8 |
pallbl3: |
test ah,16 |
jz pallbl4 |
add al,15 |
test ah, 16 |
jz pallbl4 |
add al, 15 |
pallbl4: |
test ah,32 |
jz pallbl5 |
add al,40 |
test ah, 32 |
jz pallbl5 |
add al, 40 |
pallbl5: |
out dx,al |
mov al,0 |
test ah,1 |
jz pallbl6 |
add al,8 |
out dx, al |
mov al, 0 |
test ah, 1 |
jz pallbl6 |
add al, 8 |
pallbl6: |
test ah,2 |
jz pallbl7 |
add al,15 |
test ah, 2 |
jz pallbl7 |
add al, 15 |
pallbl7: |
test ah,4 |
jz pallbl8 |
add al,40 |
test ah, 4 |
jz pallbl8 |
add al, 40 |
pallbl8: |
out dx,al |
add ah,1 |
loop palnew |
out dx, al |
add ah, 1 |
loop palnew |
ret |
ret |
align 4 |
uglobal |
novesachecksum dd 0x0 |
126,250 → 126,250 |
align 4 |
checkVga_N13: |
cmp [SCR_MODE],dword 0x13 |
jne @f |
cmp [SCR_MODE], dword 0x13 |
jne @f |
; cnvl: |
pushad |
cmp [EGA_counter],1 |
je novesal |
mov ecx,[MOUSE_X] |
cmp ecx,[novesachecksum] |
jne novesal |
cmp [EGA_counter], 1 |
je novesal |
mov ecx, [MOUSE_X] |
cmp ecx, [novesachecksum] |
jne novesal |
popad |
@@: |
ret |
novesal: |
mov [novesachecksum],ecx |
mov ecx,0 |
movzx eax,word [MOUSE_Y] |
cmp eax,100 |
jge m13l3 |
mov eax,100 |
mov [novesachecksum], ecx |
mov ecx, 0 |
movzx eax, word [MOUSE_Y] |
cmp eax, 100 |
jge m13l3 |
mov eax, 100 |
m13l3: |
cmp eax,480-100 |
jbe m13l4 |
mov eax,480-100 |
cmp eax, 480-100 |
jbe m13l4 |
mov eax, 480-100 |
m13l4: |
sub eax,100 |
imul eax,640*4 |
add ecx,eax |
movzx eax,word [MOUSE_X] |
cmp eax,160 |
jge m13l1 |
mov eax,160 |
sub eax, 100 |
imul eax, 640*4 |
add ecx, eax |
movzx eax, word [MOUSE_X] |
cmp eax, 160 |
jge m13l1 |
mov eax, 160 |
m13l1: |
cmp eax,640-160 |
jbe m13l2 |
mov eax,640-160 |
cmp eax, 640-160 |
jbe m13l2 |
mov eax, 640-160 |
m13l2: |
sub eax,160 |
shl eax,2 |
add ecx,eax |
mov esi,[LFBAddress] |
add esi,ecx |
mov edi,VGABasePtr |
mov edx,200 |
mov ecx,320 |
sub eax, 160 |
shl eax, 2 |
add ecx, eax |
mov esi, [LFBAddress] |
add esi, ecx |
mov edi, VGABasePtr |
mov edx, 200 |
mov ecx, 320 |
cld |
m13pix: |
lodsd |
test eax,eax |
jz .save_pixel |
push eax |
mov ebx,eax |
and eax,(128+64+32) ; blue |
shr eax,5 |
and ebx,(128+64+32)*256 ; green |
shr ebx,8+2 |
add eax,ebx |
pop ebx |
and ebx,(128+64)*256*256 ; red |
shr ebx,8+8 |
add eax,ebx |
test eax, eax |
jz .save_pixel |
push eax |
mov ebx, eax |
and eax, (128+64+32) ; blue |
shr eax, 5 |
and ebx, (128+64+32)*256; green |
shr ebx, 8+2 |
add eax, ebx |
pop ebx |
and ebx, (128+64)*256*256; red |
shr ebx, 8+8 |
add eax, ebx |
.save_pixel: |
stosb |
loop m13pix |
mov ecx,320 |
add esi,4*(640-320) |
dec edx |
jnz m13pix |
mov [EGA_counter],0 |
loop m13pix |
mov ecx, 320 |
add esi, 4*(640-320) |
dec edx |
jnz m13pix |
mov [EGA_counter], 0 |
popad |
ret |
VGA_drawbackground: |
; draw all |
cmp [SCR_MODE],dword 0x12 |
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 |
mov esi, [LFBAddress] |
mov edi, VGABasePtr |
mov ebx, 640/32; 640*480/(8*4) |
mov edx, 480 |
@@: |
push ebx edx esi edi |
shl edx,9 |
lea edx,[edx+edx*4] |
add esi,edx |
shr edx,5 |
add edi,edx |
call VGA_draw_long_line |
pop edi esi edx ebx |
dec edx |
jnz @r |
call VGA_draw_long_line_1 |
push ebx edx esi edi |
shl edx, 9 |
lea edx, [edx+edx*4] |
add esi, edx |
shr edx, 5 |
add edi, edx |
call VGA_draw_long_line |
pop edi esi edx ebx |
dec edx |
jnz @r |
call VGA_draw_long_line_1 |
popad |
.end: |
ret |
VGA_draw_long_line: |
mov dx,3ceh |
mov ax,0ff08h |
mov dx, 3ceh |
mov ax, 0ff08h |
cli |
out dx, ax |
mov ax,0005h |
out dx, ax |
out dx, ax |
mov ax, 0005h |
out dx, ax |
m12pix: |
call VGA_draw_32_pixels |
dec ebx |
jnz m12pix |
mov dx,3c4h |
mov ax,0ff02h |
out dx,ax |
mov dx,3ceh |
mov ax,0205h |
out dx,ax |
mov dx,3ceh |
mov al,08h |
out dx,al |
call VGA_draw_32_pixels |
dec ebx |
jnz m12pix |
mov dx, 3c4h |
mov ax, 0ff02h |
out dx, ax |
mov dx, 3ceh |
mov ax, 0205h |
out dx, ax |
mov dx, 3ceh |
mov al, 08h |
out dx, al |
sti |
ret |
VGA_draw_32_pixels: |
xor eax,eax |
mov ebp,VGA_8_pixels |
mov [ebp],eax |
mov [ebp+4],eax |
mov [ebp+8],eax |
mov [ebp+12],eax |
mov ch,4 |
xor eax, eax |
mov ebp, VGA_8_pixels |
mov [ebp], eax |
mov [ebp+4], eax |
mov [ebp+8], eax |
mov [ebp+12], eax |
mov ch, 4 |
.main_loop: |
mov cl,8 |
mov cl, 8 |
.convert_pixels_to_VGA: |
lodsd ; eax = 24bit colour |
test eax,eax |
jz .end |
rol eax,8 |
mov al,ch |
ror eax,8 |
mov ch,1 |
dec cl |
shl ch,cl |
cmp al,85 |
test eax, eax |
jz .end |
rol eax, 8 |
mov al, ch |
ror eax, 8 |
mov ch, 1 |
dec cl |
shl ch, cl |
cmp al, 85 |
jbe .p13green |
or [ebp],ch |
cmp al,170 |
or [ebp], ch |
cmp al, 170 |
jbe .p13green |
or [ebp+12],ch |
or [ebp+12], ch |
.p13green: |
cmp ah,85 |
cmp ah, 85 |
jbe .p13red |
or [ebp+4],ch |
cmp ah,170 |
or [ebp+4], ch |
cmp ah, 170 |
jbe .p13red |
or [ebp+12],ch |
or [ebp+12], ch |
.p13red: |
shr eax,8 |
cmp ah,85 |
shr eax, 8 |
cmp ah, 85 |
jbe .p13cont |
or [ebp+8],ch |
cmp ah,170 |
or [ebp+8], ch |
cmp ah, 170 |
jbe .p13cont |
or [ebp+12],ch |
or [ebp+12], ch |
.p13cont: |
ror eax,8 |
mov ch,ah |
inc cl |
ror eax, 8 |
mov ch, ah |
inc cl |
.end: |
dec cl |
jnz .convert_pixels_to_VGA |
inc ebp |
dec ch |
jnz .main_loop |
push esi |
sub ebp,4 |
mov esi,ebp |
mov dx, 3c4h |
mov ah, 1h |
dec cl |
jnz .convert_pixels_to_VGA |
inc ebp |
dec ch |
jnz .main_loop |
push esi |
sub ebp, 4 |
mov esi, ebp |
mov dx, 3c4h |
mov ah, 1h |
@@: |
mov al, 02h |
out dx,ax |
xchg ax,bp |
mov al, 02h |
out dx, ax |
xchg ax, bp |
lodsd |
mov [edi],eax |
xchg ax,bp |
shl ah, 1 |
cmp ah, 10h |
jnz @r |
add edi,4 |
pop esi |
mov [edi], eax |
xchg ax, bp |
shl ah, 1 |
cmp ah, 10h |
jnz @r |
add edi, 4 |
pop esi |
ret |
VGA_putpixel: |
; eax = x |
; ebx = y |
mov ecx,eax |
mov ecx, eax |
mov eax, [esp+32-8+4] ; color |
shl ebx,9 |
lea ebx,[ebx+ebx*4] ; óìíîæåíèå íà 5 |
shl ebx, 9 |
lea ebx, [ebx+ebx*4] ; óìíîæåíèå íà 5 |
lea edx, [ebx+ecx*4] ; + x*BytesPerPixel (Vesa2.0 32) |
mov edi,edx |
mov edi, edx |
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 |
shr edx, 5 ; change BytesPerPixel to 1/8 |
mov edi, edx |
add edi, VGABasePtr ; address of pixel in VGA area |
and ecx,0x07 ; bit no. (modulo 8) |
and ecx, 0x07 ; bit no. (modulo 8) |
pushfd |
; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8) |
xor edx,edx |
test eax,eax |
jz .p13cont |
cmp al,85 |
jbe .p13green |
or dl,0x01 |
cmp al,170 |
jbe .p13green |
or dl,0x08 |
xor edx, edx |
test eax, eax |
jz .p13cont |
cmp al, 85 |
jbe .p13green |
or dl, 0x01 |
cmp al, 170 |
jbe .p13green |
or dl, 0x08 |
.p13green: |
cmp ah,85 |
jbe .p13red |
or dl,0x02 |
cmp ah,170 |
jbe .p13red |
or dl,0x08 |
cmp ah, 85 |
jbe .p13red |
or dl, 0x02 |
cmp ah, 170 |
jbe .p13red |
or dl, 0x08 |
.p13red: |
shr eax,8 |
cmp ah,85 |
jbe .p13cont |
or dl,0x04 |
cmp ah,170 |
jbe .p13cont |
or dl,0x08 |
shr eax, 8 |
cmp ah, 85 |
jbe .p13cont |
or dl, 0x04 |
cmp ah, 170 |
jbe .p13cont |
or dl, 0x08 |
.p13cont: |
ror edx,8 |
inc cl |
xor eax,eax |
inc ah |
shr ax,cl |
mov dx,3cfh |
ror edx, 8 |
inc cl |
xor eax, eax |
inc ah |
shr ax, cl |
mov dx, 3cfh |
cli |
out dx,al |
mov al,[edi] ; dummy read |
rol edx,8 |
mov [edi],dl |
out dx, al |
mov al, [edi] ; dummy read |
rol edx, 8 |
mov [edi], dl |
popfd |
;.end: |
ret |
377,20 → 377,20 |
VGA__putimage: |
; ecx = size [x|y] |
; edx = coordinates [x|y] |
cmp [SCR_MODE],dword 0x12 |
cmp [SCR_MODE], dword 0x12 |
jne @f |
pushad |
rol edx,16 |
movzx eax,dx |
rol edx,16 |
movzx ebx,dx |
movzx edx,cx |
rol ecx,16 |
movzx ecx,cx |
call VGA_draw_bar_1 |
popad |
pushad |
rol edx, 16 |
movzx eax, dx |
rol edx, 16 |
movzx ebx, dx |
movzx edx, cx |
rol ecx, 16 |
movzx ecx, cx |
call VGA_draw_bar_1 |
popad |
@@: |
ret |
ret |
VGA_draw_bar: |
; eax cx |
397,54 → 397,54 |
; ebx cy |
; ecx xe |
; edx ye |
cmp [SCR_MODE],dword 0x12 |
cmp [SCR_MODE], dword 0x12 |
jne @f |
pushad |
sub ecx,eax |
sub edx,ebx |
and eax,0xffff |
and ebx,0xffff |
and ecx,0xffff |
and edx,0xffff |
call VGA_draw_bar_1 |
popad |
pushad |
sub ecx, eax |
sub edx, ebx |
and eax, 0xffff |
and ebx, 0xffff |
and ecx, 0xffff |
and edx, 0xffff |
call VGA_draw_bar_1 |
popad |
@@: |
ret |
ret |
VGA_draw_bar_1: |
mov [temp.cx],eax |
mov [temp.cx], eax |
mov eax, [TASK_BASE] |
add ebx, [eax-twdw + 4] |
mov eax, [eax-twdw + 0] |
add eax, [temp.cx] |
and eax,0xfff8 |
shl ebx,9 |
lea ebx,[ebx+ebx*4] ; óìíîæåíèå íà 5 |
and eax, 0xfff8 |
shl ebx, 9 |
lea ebx, [ebx+ebx*4]; óìíîæåíèå íà 5 |
lea ebx, [ebx+eax*4] ; + x*BytesPerPixel (Vesa2.0 32) |
mov esi,ebx |
mov esi, ebx |
add esi, [LFBAddress] ; + LFB address |
shr ebx,5 ; change BytesPerPixel to 1/8 |
mov edi,ebx |
shr ebx, 5 ; change BytesPerPixel to 1/8 |
mov edi, ebx |
add edi, VGABasePtr ; address of pixel in VGA area |
mov ebx,ecx |
shr ebx,5 |
mov ebx, ecx |
shr ebx, 5 |
inc ebx |
.main_loop: |
call VGA_draw_long_line_1 |
dec edx |
jnz .main_loop |
call VGA_draw_long_line_1 |
call VGA_draw_long_line_1 |
dec edx |
jnz .main_loop |
call VGA_draw_long_line_1 |
ret |
VGA_draw_long_line_1: |
push ebx edx esi edi |
shl edx,9 |
lea edx,[edx+edx*4] |
add esi,edx |
shr edx,5 |
add edi,edx |
call VGA_draw_long_line |
pop edi esi edx ebx |
push ebx edx esi edi |
shl edx, 9 |
lea edx, [edx+edx*4] |
add esi, edx |
shr edx, 5 |
add edi, edx |
call VGA_draw_long_line |
pop edi esi edx ebx |
ret |