Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 1859 → Rev 1858

/kernel/branches/Kolibri-A/trunk/core/syscall.inc
44,28 → 44,10
 
align 32
syscall_entry:
; sti
push ecx
; sti
; and eax, 3
; call dword [servetable3 + eax * 4]
 
mov edi, [esp+4]
mov ecx, [esp+8]
mov edx, [esp+12]
mov ebx, [esp+16]
and al, 1
jz .hline
mov eax, [esp+20]
sti
call vline
jmp .done
.hline:
mov eax, [esp+20]
sti
call hline
.done:
 
 
and eax, 3
call dword [servetable3 + eax * 4]
pop ecx
sysret
 
173,8 → 155,8
align 4
servetable3: ; Kolibri-A special service
 
dd hline ; 0
dd vline ; 1
dd paleholder ; 0
dd paleholder ; 1
dd paleholder ; 2
dd sys_end ; last
 
/kernel/branches/Kolibri-A/trunk/gui/mouse.inc
378,11 → 378,9
 
mov eax, [mouse.state.pos.x]
sub eax, [mouse.active_sys_window.delta.x]
and al, 0xFC ; <<<<<<<<<<<<<<<<<<<
mov [mouse.active_sys_window.new_box.left], eax
mov eax, [mouse.state.pos.y]
sub eax, [mouse.active_sys_window.delta.y]
and al, 0xFE ; <<<<<<<<<<<<<<<<<<<
mov [mouse.active_sys_window.new_box.top], eax
 
mov eax, [mouse.active_sys_window.new_box.left]
413,16 → 411,15
 
mov eax, [mouse.state.pos.x]
sub eax, [mouse.active_sys_window.delta.x]
and al, 0xFC ; <<<<<<<<<<<<<<<<<<<
mov [mouse.active_sys_window.new_box.left], eax
sub eax, [mouse.active_sys_window.old_box.left]
sub [mouse.active_sys_window.new_box.width], eax
 
mov eax, [mouse.active_sys_window.new_box.width]
sub eax, 128
sub eax, 127
jge @f
add [mouse.active_sys_window.new_box.left], eax
mov [mouse.active_sys_window.new_box.width], 128
mov [mouse.active_sys_window.new_box.width], 127
@@: mov eax, [mouse.active_sys_window.new_box.left]
or eax, eax
jge .check_resize_s
437,7 → 434,6
mov eax, [mouse.state.pos.y]
add eax, [mouse.active_sys_window.delta.y]
sub eax, [mouse.active_sys_window.old_box.top]
and al, 0xFC ; <<<<<<<<<<<<<<<<<<<
mov [mouse.active_sys_window.new_box.height], eax
 
push eax
470,13 → 466,12
mov eax, [mouse.state.pos.x]
add eax, [mouse.active_sys_window.delta.x]
sub eax, [mouse.active_sys_window.old_box.left]
and al, 0xFC ; <<<<<<<<<<<<<<<<<<<
mov [mouse.active_sys_window.new_box.width], eax
 
mov eax, [mouse.active_sys_window.new_box.width]
cmp eax, 128
cmp eax, 127
jge @f
mov eax, 128
mov eax, 127
mov [mouse.active_sys_window.new_box.width], eax
@@: add eax, [mouse.active_sys_window.new_box.left]
cmp eax, [Screen_Max_X]
706,4 → 701,4
ret
 
diff16 "mouse code end ",0,$
diff10 "mouse code size",mouse_check_events,$
diff16 "mouse code size",mouse_check_events,$
/kernel/branches/Kolibri-A/trunk/gui/window.inc
328,19 → 328,15
cmp ebx, -1
jne @f
mov ebx, [edi + WDATA.box.left]
and bl, 0xFC
@@: cmp ecx, -1
jne @f
mov ecx, [edi + WDATA.box.top]
and cl, 0xFE
@@: cmp edx, -1
jne @f
mov edx, [edi + WDATA.box.width]
and dl, 0xFC
@@: cmp esi, -1
jne @f
mov esi, [edi + WDATA.box.height]
and esi, 0xFFFFFFFE
 
@@: push esi edx ecx ebx
mov eax, esp
348,6 → 344,14
call window._.set_window_box
add esp, BOX.sizeof
 
; NOTE: do we really need this? to be reworked
; mov byte[DONT_DRAW_MOUSE], 0 ; mouse pointer
; mov byte[MOUSE_BACKGROUND], 0 ; no mouse under
; mov byte[MOUSE_DOWN], 0 ; react to mouse up/down
 
; NOTE: do we really need this? to be reworked
; call [draw_pointer]
 
.exit:
ret
 
515,10 → 519,8
mov eax, [edi + WDATA.box.width]
sub eax, ebx
jle @f
and bl, 0xFC ; <<<<<<<
mov [edi + WDATA.box.width], ebx
@@: sub ebx, [edi + WDATA.box.width]
and bl, 0xFC ; <<<<<<<
mov [edi + WDATA.box.left], ebx
 
.fix_vertical:
530,10 → 532,8
mov eax, [edi + WDATA.box.height]
sub eax, ebx
jle @f
and bl, 0xFE ; <<<<<<<
mov [edi + WDATA.box.height], ebx
@@: sub ebx, [edi + WDATA.box.height]
and bl, 0xFE ; <<<<<<<
mov [edi + WDATA.box.top], ebx
jmp .fix_client_box
 
555,8 → 555,7
call window._.set_window_clientbox
 
add edi, WDATA.sizeof
dec ecx
jne .next_window ; <<<<<<<<<<<
loop .next_window
 
.exit:
ret
1455,9 → 1454,7
movzx eax, cx
mov [edi + WDATA.box.height], eax
sar ebx, 16
and bl, 0xFC ; <<<<<<<<
sar ecx, 16
and cl, 0xFE ; <<<<<<<<
mov [edi + WDATA.box.left], ebx
mov [edi + WDATA.box.top], ecx
 
1676,11 → 1673,10
 
; get WinMap start
push esi
mov edi, [_WinMapWidth]
mov edi, [Screen_Max_X]
inc edi
mov esi, edi
imul edi, ebx
shr eax, 1
shr eax, 1
add edi, eax
add edi, [_WinMapAddress]
pop eax
1719,13 → 1715,12
 
; get WinMap start -> ebp
push eax
mov eax, [_WinMapWidth] ; <<<<
mov eax, [Screen_Max_X] ; screen_sx
inc eax
imul eax, ebx
mov ebp, [esp]
shr ebp, 1
shr ebp, 1
add ebp, eax
add ebp, [_WinMapAddress]
add eax, [esp]
add eax, [_WinMapAddress]
mov ebp, eax
 
mov edi, [edi + APPDATA.wnd_shape]
pop eax
2090,4 → 2085,4
ret
 
diff16 "window code end",0,$
diff10 "window.inc size",syscall_draw_window,$
diff16 "window.inc size",syscall_draw_window,$
/kernel/branches/Kolibri-A/trunk/kernel.asm
320,9 → 320,11
mov eax, [BOOT_VAR + 0x9044] ; version & flags
mov [apm_vf], eax
; -----------------------------------------
; movzx eax,byte [BOOT_VAR+0x9010] ; mouse port
; mov [0xF604],byte 1 ;al
mov al, [BOOT_VAR+0x901F] ; DMA access
mov [allow_dma_access], al
mov eax, 32 ; <<<<<<<<< bpp
movzx eax, byte [BOOT_VAR+0x9000] ; bpp
mov [ScreenBPP],al
 
mov [_display.bpp], eax
334,9 → 336,6
dec eax
mov [Screen_Max_X],eax
mov [screen_workarea.right],eax
inc eax
shr eax, 2
mov [_WinMapWidth], eax ; 1 tyle = 4 pixels
movzx eax,word [BOOT_VAR+0x900C] ; Y max
mov [_display.height], eax
dec eax
346,13 → 345,17
mov [SCR_MODE],eax
mov eax,[BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add
mov [BANK_SWITCH],eax
mov [BytesPerScanLine],word 640*4 ; Bytes PerScanLine
cmp [SCR_MODE],word 0x13 ; 320x200
je @f
cmp [SCR_MODE],word 0x12 ; VGA 640x480
je @f
movzx eax, word[BOOT_VAR+0x9001] ; for other modes
mov [BytesPerScanLine],ax
mov [_display.pitch], eax
@@:
mov eax, [_display.height]
shr eax, 1
mul [_WinMapWidth]
mov eax, [_display.width]
mul [_display.height]
mov [_WinMapSize], eax
 
mov esi, BOOT_VAR+0x9080
497,10 → 500,10
mov [graph_data_l+4],al
mov [graph_data_l+7],ah
; or [KERNEL_ALLOC_FLAG], dword PG_NOCACHE
or [KERNEL_ALLOC_FLAG], dword PG_NOCACHE
stdcall kernel_alloc, [_WinMapSize]
mov [_WinMapAddress], eax
; xor [KERNEL_ALLOC_FLAG], dword PG_NOCACHE
xor [KERNEL_ALLOC_FLAG], dword PG_NOCACHE
 
xor eax,eax
inc eax
603,17 → 606,6
mov esi, boot_memdetect
call boot_log
 
; <<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>
mov ebx, img_test_struct
mov ecx, 3*65536 + 4
mov edx, 32*65536 + 512
mov esi, 32
xor edi, edi
mov ebp, edi
call sys_putimage_palette.forced
 
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>
 
movzx ecx, word [boot_y]
or ecx, (10+29*6) shl 16 ; "Determining amount of memory"
sub ecx, 10
2249,7 → 2241,6
; je nosb31
;draw_background_temp:
; mov [bgrchanged],1 ;0
 
mov [background_defined], 1
mov byte[BACKGROUND_CHANGED], 1
call force_redraw_background
2847,25 → 2838,24
 
 
; check if pixel is allowed to be drawn
; -- not in use any more ?
 
;checkpixel:
; push eax ebx edx
; shr ebx, 1
; mov edx, [_WinMapWidth] ; <<<<
; imul edx, ebx
; shr eax, 2
; add eax, [_WinMapAddress]
; mov dl, [eax+edx]
;
; xor ecx, ecx
; mov eax, [CURRENT_TASK]
; cmp al, dl
; setne cl
;
; pop edx ebx eax
; ret
checkpixel:
push eax edx
 
mov edx,[Screen_Max_X] ; screen x size
inc edx
imul edx, ebx
add eax, [_WinMapAddress]
mov dl, [eax+edx] ; lea eax, [...]
 
xor ecx, ecx
mov eax, [CURRENT_TASK]
cmp al, dl
setne cl
 
pop edx eax
ret
 
iglobal
cpustring db 'CPU',0
endg
2913,6 → 2903,12
jz nobackgr
cmp [background_defined], 0
jz nobackgr
; mov [draw_data+32 + RECT.left],dword 0
; mov [draw_data+32 + RECT.top],dword 0
; mov eax,[Screen_Max_X]
; mov ebx,[Screen_Max_Y]
; mov [draw_data+32 + RECT.right],eax
; mov [draw_data+32 + RECT.bottom],ebx
@@:
call drawbackground
xor eax, eax
2954,6 → 2950,8
je system_shutdown
 
noshutdown:
 
 
mov eax,[TASK_COUNT] ; termination
mov ebx,TASK_DATA+TASKDATA.state
mov esi,1
2972,13 → 2970,19
ret
 
; redraw screen
 
redrawscreen:
 
; eax , if process window_data base is eax, do not set flag/limits
 
redrawscreen:
pushad
push eax
 
xor ecx,ecx ; redraw flags for apps
;;; mov ebx,2
;;; call delay_hs
 
;mov ecx,0 ; redraw flags for apps
xor ecx,ecx
newdw2:
 
inc ecx
3030,6 → 3034,8
 
cmp dword[esp], 1
jnz .az
; cmp byte[BACKGROUND_CHANGED], 0
; jnz newdw8
cmp byte[REDRAW_BACKGROUND], 0
jz .az
mov dl, 0
3080,7 → 3086,6
jne nobgrd
inc byte[REDRAW_BACKGROUND]
 
 
newdw8:
nobgrd:
 
3101,6 → 3106,7
ret
 
calculatebackground: ; background
 
mov edi, [_WinMapAddress] ; set os to use all pixels
mov eax,0x01010101
mov ecx, [_WinMapSize]
3116,7 → 3122,11
imax dd 0x0
endg
 
 
 
delay_ms: ; delay in 1/1000 sec
 
 
push eax
push ecx
 
3144,6 → 3154,7
 
ret
 
 
set_app_param:
mov edi, [TASK_BASE]
mov eax, [edi + TASKDATA.event_mask]
3151,6 → 3162,8
mov [esp+32], eax
ret
 
 
 
delay_hs: ; delay in 1/100 secs
; ebx = delay time
push ecx
3176,6 → 3189,7
 
align 16 ;very often call this subrutine
memmove: ; memory move in bytes
 
; eax = from
; ebx = to
; ecx = no of bytes
3205,6 → 3219,54
ret
 
 
; <diamond> Sysfunction 34, read_floppy_file, is obsolete. Use 58 or 70 function instead.
;align 4
;
;read_floppy_file:
;
;; as input
;;
;; eax pointer to file
;; ebx file lenght
;; ecx start 512 byte block number
;; edx number of blocks to read
;; esi pointer to return/work area (atleast 20 000 bytes)
;;
;;
;; on return
;;
;; eax = 0 command succesful
;; 1 no fd base and/or partition defined
;; 2 yet unsupported FS
;; 3 unknown FS
;; 4 partition not defined at hd
;; 5 file not found
;; ebx = size of file
;
; mov edi,[TASK_BASE]
; add edi,0x10
; add esi,[edi]
; add eax,[edi]
;
; pushad
; mov edi,esi
; add edi,1024
; mov esi,0x100000+19*512
; sub ecx,1
; shl ecx,9
; add esi,ecx
; shl edx,9
; mov ecx,edx
; cld
; rep movsb
; popad
;
; mov [esp+36],eax
; mov [esp+24],ebx
; ret
 
 
 
align 4
 
sys_programirq:
3232,6 → 3294,7
 
 
reserve_free_irq:
 
xor esi, esi
inc esi
cmp ecx, 16
3254,6 → 3317,7
jmp ril1
 
reserve_irq:
 
cmp dword [ecx], 0
jne ril1
 
3291,26 → 3355,37
 
drawbackground:
inc [mouse_pause]
; cmp [BgrDrawMode],dword 1
; jne bgrstr
; call vesa20_drawbackground_tiled
call drawbackground
cmp [SCR_MODE],word 0x12
je dbrv20
dbrv12:
cmp [SCR_MODE],word 0100000000000000b
jge dbrv20
; cmp [SCR_MODE],word 0x13
; je dbrv20
; call vesa12_drawbackground
dec [mouse_pause]
call [draw_pointer]
ret
; bgrstr:
; call vesa20_drawbackground_stretch
; dec [mouse_pause]
; call [draw_pointer]
; ret
dbrv20:
cmp [BgrDrawMode],dword 1
jne bgrstr
call vesa20_drawbackground_tiled
dec [mouse_pause]
call [draw_pointer]
ret
bgrstr:
call vesa20_drawbackground_stretch
dec [mouse_pause]
call [draw_pointer]
ret
 
; ====================================================================
align 4
syscall_putimage: ; PutImage = SysFn07
 
syscall_putimage: ; PutImage
sys_putimage:
test ecx,0x80008000 ; ecx = { SizeX | SizeY }
jnz .exit ; edx = { OrigX | OrigY }
test ecx,0x0000FFFF ; ebx points to the 24bpp-image
test ecx,0x80008000
jnz .exit
test ecx,0x0000FFFF
jz .exit
test ecx,0xFFFF0000
jnz @f
3317,39 → 3392,39
.exit:
ret
@@:
push edi
mov edi,[current_slot]
add dx,word[edi+APPDATA.wnd_clientbox.top]
rol edx,16
add dx,word[edi+APPDATA.wnd_clientbox.left]
pop edi
rol edx,16
.forced: ; called from gui/skincode.inc [215]
push esi
mov esi, ecx
shr esi, 16 ; SizeX
lea esi, [esi*2+esi] ; 3 bytes per pixel
mov [img_buf_line_size], esi
mov [img_draw_core_fn], draw_core_24bpp
mov [img_draw_edge_fn], draw_edge_24bpp
mov [img_bytes_per_pix], 3
pop esi
 
sys_putimage_bpp: ; only called from sys_putimage_palette
.forced:
push ebp esi 0
mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp
sys_putimage_bpp:
; cmp [SCR_MODE], word 0x12
; jz @f ;.doit
; mov eax, vesa12_putimage
; cmp [SCR_MODE], word 0100000000000000b
; jae @f
; cmp [SCR_MODE], word 0x13
; jnz .doit
;@@:
mov eax, vesa20_putimage
.doit:
inc [mouse_pause]
call _putimage
call eax
dec [mouse_pause]
pop ebp esi ebp
jmp [draw_pointer]
 
 
align 4
sys_putimage_palette: ; sysFn 65
sys_putimage_palette:
; ebx = pointer to image
; ecx = [xsize]*65536 + [ysize]
; edx = [xstart]*65536 + [ystart]
; esi = number of bits per pixel, must be 1, 8, 24 or 32
; esi = number of bits per pixel, must be 8, 24 or 32
; edi = pointer to palette
; ebp = line offset
; ebp = row delta
mov eax, [CURRENT_TASK]
shl eax, 8
add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.top]
3357,48 → 3432,253
add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.left]
rol edx, 16
.forced:
mov [img_palette], edi
mov eax, esi
cmp eax, 32 ;>32bpp (stupid call)
ja .exit
shr al, 3 ; 0=1bpp, other lo-pix modes not supported
push esi
mov [img_bytes_per_pix], eax
mov esi, [eax*4 + img_core_proc_0]
mov [img_draw_core_fn], esi
mov esi, [eax*4 + img_edge_proc_0]
mov [img_draw_edge_fn], esi
mov esi, ecx
shr esi, 16 ; esi = SizeX
or al, al
jz .1bpp
imul esi, eax
jmp .done
.1bpp:
add esi, 7
shr esi, 3 ; 8 pixels per byte
.done:
add esi, ebp ; + line offset
mov [img_buf_line_size], esi
pop esi
jmp _putimage ;<<< sys_putimage_bpp
.exit:
cmp esi, 1
jnz @f
push edi
mov eax, [edi+4]
sub eax, [edi]
push eax
push dword [edi]
push 0ffffff80h
mov edi, esp
call put_mono_image
add esp, 12
pop edi
ret
@@:
cmp esi, 2
jnz @f
push edi
push 0ffffff80h
mov edi, esp
call put_2bit_image
pop eax
pop edi
ret
@@:
cmp esi, 4
jnz @f
push edi
push 0ffffff80h
mov edi, esp
call put_4bit_image
pop eax
pop edi
ret
@@:
push ebp esi ebp
cmp esi, 8
jnz @f
mov ebp, putimage_get8bpp
mov esi, putimage_init8bpp
jmp sys_putimage_bpp
@@:
cmp esi, 15
jnz @f
mov ebp, putimage_get15bpp
mov esi, putimage_init15bpp
jmp sys_putimage_bpp
@@:
cmp esi, 16
jnz @f
mov ebp, putimage_get16bpp
mov esi, putimage_init16bpp
jmp sys_putimage_bpp
@@:
cmp esi, 24
jnz @f
mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp
jmp sys_putimage_bpp
@@:
cmp esi, 32
jnz @f
mov ebp, putimage_get32bpp
mov esi, putimage_init32bpp
jmp sys_putimage_bpp
@@:
pop ebp esi ebp
ret
 
align 4
img_core_proc_0 dd draw_core_1bpp
img_core_proc_1 dd draw_core_8bpp
img_core_proc_2 dd draw_core_16bpp
img_core_proc_3 dd draw_core_24bpp
img_core_proc_4 dd draw_core_32bpp
put_mono_image:
push ebp esi ebp
mov ebp, putimage_get1bpp
mov esi, putimage_init1bpp
jmp sys_putimage_bpp
put_2bit_image:
push ebp esi ebp
mov ebp, putimage_get2bpp
mov esi, putimage_init2bpp
jmp sys_putimage_bpp
put_4bit_image:
push ebp esi ebp
mov ebp, putimage_get4bpp
mov esi, putimage_init4bpp
jmp sys_putimage_bpp
 
img_edge_proc_0 dd draw_edge_1bpp
img_edge_proc_1 dd draw_edge_8bpp
img_edge_proc_2 dd draw_edge_16bpp
img_edge_proc_3 dd draw_edge_24bpp
img_edge_proc_4 dd draw_edge_32bpp
putimage_init24bpp:
lea eax, [eax*3]
putimage_init8bpp:
ret
 
; ==================================================
align 16
putimage_get24bpp:
movzx eax, byte [esi+2]
shl eax, 16
mov ax, [esi]
add esi, 3
ret 4
align 16
putimage_get8bpp:
movzx eax, byte [esi]
push edx
mov edx, [esp+8]
mov eax, [edx+eax*4]
pop edx
inc esi
ret 4
 
putimage_init1bpp:
add eax, ecx
push ecx
add eax, 7
add ecx, 7
shr eax, 3
shr ecx, 3
sub eax, ecx
pop ecx
ret
align 16
putimage_get1bpp:
push edx
mov edx, [esp+8]
mov al, [edx]
add al, al
jnz @f
lodsb
adc al, al
@@:
mov [edx], al
sbb eax, eax
and eax, [edx+8]
add eax, [edx+4]
pop edx
ret 4
 
putimage_init2bpp:
add eax, ecx
push ecx
add ecx, 3
add eax, 3
shr ecx, 2
shr eax, 2
sub eax, ecx
pop ecx
ret
align 16
putimage_get2bpp:
push edx
mov edx, [esp+8]
mov al, [edx]
mov ah, al
shr al, 6
shl ah, 2
jnz .nonewbyte
lodsb
mov ah, al
shr al, 6
shl ah, 2
add ah, 1
.nonewbyte:
mov [edx], ah
mov edx, [edx+4]
movzx eax, al
mov eax, [edx+eax*4]
pop edx
ret 4
 
putimage_init4bpp:
add eax, ecx
push ecx
add ecx, 1
add eax, 1
shr ecx, 1
shr eax, 1
sub eax, ecx
pop ecx
ret
align 16
putimage_get4bpp:
push edx
mov edx, [esp+8]
add byte [edx], 80h
jc @f
movzx eax, byte [edx+1]
mov edx, [edx+4]
and eax, 0x0F
mov eax, [edx+eax*4]
pop edx
ret 4
@@:
movzx eax, byte [esi]
add esi, 1
mov [edx+1], al
shr eax, 4
mov edx, [edx+4]
mov eax, [edx+eax*4]
pop edx
ret 4
 
putimage_init32bpp:
shl eax, 2
ret
align 16
putimage_get32bpp:
lodsd
ret 4
 
putimage_init15bpp:
putimage_init16bpp:
add eax, eax
ret
align 16
putimage_get15bpp:
; 0RRRRRGGGGGBBBBB -> 00000000RRRRR000GGGGG000BBBBB000
push ecx edx
movzx eax, word [esi]
add esi, 2
mov ecx, eax
mov edx, eax
and eax, 0x1F
and ecx, 0x1F shl 5
and edx, 0x1F shl 10
shl eax, 3
shl ecx, 6
shl edx, 9
or eax, ecx
or eax, edx
pop edx ecx
ret 4
 
align 16
putimage_get16bpp:
; RRRRRGGGGGGBBBBB -> 00000000RRRRR000GGGGGG00BBBBB000
push ecx edx
movzx eax, word [esi]
add esi, 2
mov ecx, eax
mov edx, eax
and eax, 0x1F
and ecx, 0x3F shl 5
and edx, 0x1F shl 11
shl eax, 3
shl ecx, 5
shl edx, 8
or eax, ecx
or eax, edx
pop edx ecx
ret 4
 
; eax x beginning
; ebx y beginning
; ecx x end
3413,13 → 3693,28
add edx,[esi+APPDATA.wnd_clientbox.top]
.forced:
inc [mouse_pause]
; dbv20:
; call [disable_mouse]
cmp [SCR_MODE],word 0x12
je dbv20
sdbv20:
; cmp [SCR_MODE],word 0100000000000000b
; jge dbv20
; cmp [SCR_MODE],word 0x13
; je dbv20
; call vesa12_drawbar
; dec [mouse_pause]
; call [draw_pointer]
; ret
dbv20:
call vesa20_drawbar
dec [mouse_pause]
jmp [draw_pointer]
call [draw_pointer]
ret
 
 
 
kb_read:
 
push ecx edx
 
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
3450,6 → 3745,15
push ecx edx
 
mov dl,al
; mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
; kw_loop1:
; in al,0x64
; test al,0x20
; jz kw_ok1
; loop kw_loop1
; mov ah,1
; jmp kw_exit
; kw_ok1:
in al,0x60
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
kw_loop:
4187,12 → 4491,7
stdcall kernel_free, [_WinMapAddress]
 
mov eax, [_display.width]
shr eax, 1
shr eax, 1
mov [_WinMapWidth], eax
mov eax, [_display.height]
shr eax, 1
mul [_WinMapWidth]
mul [_display.height]
mov [_WinMapSize], eax
 
stdcall kernel_alloc, eax
/kernel/branches/Kolibri-A/trunk/video/graph32.inc
File deleted
/kernel/branches/Kolibri-A/trunk/video/vesa20.inc
0,0 → 1,1064
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; VESA20.INC ;;
;; ;;
;; Vesa 2.0 functions for MenuetOS ;;
;; ;;
;; Copyright 2002 Ville Turjanmaa ;;
;; Alexey, kgaz@crosswindws.net ;;
;; - Voodoo compatible graphics ;;
;; Juan M. Caravaca ;;
;; - Graphics optimimizations eg. drawline ;;
;; ;;
;; See file COPYING for details ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
$Revision$
 
 
;*************************************************
; getpixel
;
; in:
; eax = x coordinate
; ebx = y coordinate
;
; ret:
; ecx = 00 RR GG BB
 
 
get_pixel:
mov ecx, [BytesPerScanLine]
imul ecx, ebx
lea ecx, [ecx+eax*4] ; ecx = x*4+(y*y multiplier)
mov ecx, [ecx+LFB_BASE]
and ecx, 0xffffff
ret
 
;*************************************************
 
virtual at esp
putimg:
.real_sx dd ?
.real_sy dd ?
.image_sx dd ?
.image_sy dd ?
.image_cx dd ?
.image_cy dd ?
.pti dd ?
.abs_cx dd ?
.abs_cy dd ?
.line_increment dd ?
.winmap_newline dd ?
.screen_newline dd ?
.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 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 [_display.disable_mouse]
sub esp, putimg.stack_data
; save pointer to image
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
; unpack the coordinates
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
; real_sx = MIN(wnd_sx-image_cx, image_sx);
mov ebx, [eax-twdw + WDATA.box.width] ; ebx = wnd_sx
inc ebx ; WDATA.box.width is one pixel less than real window x-size
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]
.end_x:
mov [putimg.real_sx], ebx
; init real_sy
mov ebx, [eax-twdw + WDATA.box.height] ; ebx = wnd_sy
inc ebx
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]
.end_y:
mov [putimg.real_sy], ebx
; line increment
mov eax, [putimg.image_sx]
mov ecx, [putimg.real_sx]
sub eax, ecx
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
; screen new line increment
mov eax, [BytesPerScanLine]
shl ecx, 1
shl ecx, 1
sub eax, ecx
mov [putimg.screen_newline], eax
; pointer to image
mov esi, [putimg.pti]
; pointer to screen
mov edx, [putimg.abs_cy]
imul edx, [BytesPerScanLine]
mov eax, [putimg.abs_cx]
shl eax, 1
shl eax, 1
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
; get process number
mov ebx, [CURRENT_TASK]
 
put_image_end_32:
mov edi, [putimg.real_sy]
align 4
.new_line:
mov ecx, [putimg.real_sx]
align 4
.new_x:
push [putimg.edi]
mov eax, [putimg.ebp+4]
call eax
cmp [ebp], bl
jne .skip
mov [LFB_BASE+edx], eax
.skip:
add edx, 4
inc ebp
dec ecx
jnz .new_x
add esi, [putimg.line_increment]
add edx, [putimg.screen_newline] ;[BytesPerScanLine]
add ebp, [putimg.winmap_newline] ;[Screen_Max_X]
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
@@:
dec edi
jnz .new_line
.finish:
add esp, putimg.stack_data
popad
ret
 
;*************************************************
align 4
__sys_putpixel:
 
; eax = x coordinate
; ebx = y coordinate
; ecx = ?? RR GG BB ; 0x01000000 negation
; edi = 0x00000001 force
 
cmp [Screen_Max_X], eax
jb .exit
cmp [Screen_Max_Y], ebx
jb .exit
.check_forced:
test edi,1 ; force ?
jnz .checked
 
.not_forced:
push edx
mov edx,[_display.width] ; screen x size
imul edx, ebx
add edx, [_WinMapAddress]
movzx edx, byte [eax+edx]
cmp edx, [CURRENT_TASK]
pop edx
jne .exit
 
; OK to set pixel
.checked:
push ebx
imul ebx, [BytesPerScanLine]
lea ebx, [ebx+eax*4]
test ecx,0x01000000
jz .noneg
mov ecx, [LFB_BASE+ebx]
not ecx
and ecx, 0x01FFFFFF
.noneg:
mov [LFB_BASE+ebx], ecx
pop ebx
.exit:
ret
 
 
 
align 4
put_pixel: ; left for compatibility with 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], ecx
ret
 
 
;*************************************************
 
;align 4
calculate_edi:
mov edi, ebx
imul edi, [Screen_Max_X]
add edi, ebx
add edi, eax
ret
 
;*************************************************
 
; DRAWLINE
 
align 4
__sys_draw_line:
call [_display.disable_mouse]
 
; draw a line
; eax = HIWORD = x1
; LOWORD = x2
; ebx = HIWORD = y1
; LOWORD = y2
; ecx = color
; edi = force ?
pusha
 
dl_x1 equ esp+20
dl_y1 equ esp+16
dl_x2 equ esp+12
dl_y2 equ esp+8
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
; 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
.x2lx1:
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
 
.y2ly1:
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
.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
 
.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
.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
.y_rules:
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
; force last drawn pixel to be at (x2,y2)
mov eax, [dl_x2]
mov ebx, [dl_y2]
call [putpixel]
.exit:
add esp, 6*4
popa
call [draw_pointer]
ret
 
align 4
hline:
; ------------ draw a horizontal line -------------
; eax = x1
; edx = x2
; ebx = y
; ecx = color
; edi = force ?
cmp ebx, [Screen_Max_Y]
jge .out
push eax ebp esi ebx edx
bt ecx, 24 ; color inversion check
rcl edi,1 ; forced graphics check
 
mov ebp, [_display.width] ; ebp = screen co-ords base
imul ebp, ebx
add ebp, [_WinMapAddress]
 
cmp edx, eax ; to make sure x2 > x1
jge @f
xchg eax, edx
@@:
cmp eax, [Screen_Max_X]
jge .exit
imul ebx, [BytesPerScanLine]
add ebx, LFB_BASE
cmp edx, [Screen_Max_X] ; last check
jb .draw
mov edx, [Screen_Max_X]
 
.draw: ; -- the line ---
jmp dword [hline.drawtable + edi*4] ; a coolhack (C) Serge
 
align 4
.invert_color:
mov ecx, [ebx+eax*4]
xor ecx, 0x00FFFFFF
or ecx, 0x01000000 ; keep bit[24] high !
align 4
.check_overlap:
movzx esi, byte [ebp+eax] ; check whether the line covered by other windows
cmp esi, [CURRENT_TASK]
je .putpixel
jmp .nextpixel
align 4
.invert_force:
mov ecx, [ebx+eax*4]
xor ecx, 0x00FFFFFF
or ecx, 0x01000000 ; keep bit[24] high !
align 4
.putpixel:
mov [ebx+eax*4], ecx
align 4
.nextpixel:
inc eax
cmp eax, edx
ja .exit
jmp dword [hline.drawtable + edi*4] ; close the loop
 
.exit:
shr edi, 1 ; restore the 'force' bit
pop edx ebx esi ebp eax
.out:
ret
align 4
.drawtable:
dd .check_overlap ; general case
dd .invert_color
dd .putpixel ; force to draw it
dd .invert_force
 
 
align 4
vline:
; --------- draw a vertical line ------------
; eax = x
; ebx = y1
; edx = y2
; ecx = color
; edi = force ?
cmp eax, [Screen_Max_X]
jge .out
push eax ebp esi ebx edx
mov ebp, [_display.width] ; ebp = screen co-ords base
imul ebp, ebx
add ebp, [_WinMapAddress]
add ebp, eax
 
cmp edx, ebx ; to make sure y2 > y1
jge @f
xchg ebx, edx
@@:
cmp ebx, [Screen_Max_Y]
jge .exit
push ebx
imul ebx, [BytesPerScanLine]
shl eax, 1
shl eax, 1
add eax, ebx
add eax, LFB_BASE
pop ebx ; restore ebx = y1
cmp edx, [Screen_Max_Y] ; the last check
jb .draw
mov edx, [Screen_Max_Y] ; to prevent off-screen drawing
 
.draw:
jmp dword [vline.drawtable + edi*4]
align 4
.invert_color:
mov ecx, [eax]
xor ecx, 0x00FFFFFF
or ecx, 0x01000000
align 4
.check_overlap:
movzx esi, byte [ebp]
cmp esi, [CURRENT_TASK]
je .putpixel
jmp .nextpixel
 
align 4
.invert_force:
mov ecx, [eax]
xor ecx, 0x00FFFFFF
or ecx, 0x01000000
align 4
.putpixel:
mov [eax], ecx
align 4
.nextpixel:
add eax, [BytesPerScanLine]
add ebp, [_display.width]
inc ebx
cmp ebx, edx
ja .exit
jmp dword [vline.drawtable + edi*4]
.exit:
shr edi, 1
pop edx ebx esi ebp eax
.out:
ret
align 4
.drawtable:
dd .check_overlap ; general case
dd .invert_color
dd .putpixel ; force to draw it
dd .invert_force
 
 
;*************************************************
 
 
virtual at esp
drbar:
.bar_sx dd ?
.bar_sy dd ?
.bar_cx dd ?
.bar_cy dd ?
.abs_cx dd ?
.abs_cy dd ?
.real_sx dd ?
.real_sy dd ?
.color dd ?
.line_inc_scr dd ?
.line_inc_map dd ?
.stack_data = 4*11
end virtual
 
align 4
; eax cx
; ebx cy
; ecx xe
; 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
sub ecx, eax
jle .exit
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
; note that WDATA.box.width is one pixel less than real window x-size
inc ebx
sub ebx, [drbar.bar_cx]
ja @f
.exit:
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]
.end_x:
mov [drbar.real_sx], ebx
; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
mov ebx, [edi-twdw + WDATA.box.height] ; ebx = wnd_sy
inc ebx
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]
.end_y:
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
; line_inc_scr
mov eax, [drbar.real_sx]
shl eax, 1
shl eax, 1
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]
shl eax, 1
shl eax, 1
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
; get process number
mov ebx, [CURRENT_TASK]
 
draw_bar_end_32:
; eax - color high RRGG
; bl - process num
; bh - color low BB
; ecx - temp
; edx - pointer to screen
; esi - counter
; edi - counter
mov eax, [drbar.color] ;; BBGGRR00
mov esi, [drbar.real_sy]
align 4
.new_y:
mov edi, [drbar.real_sx]
align 4
.new_x:
cmp byte [ebp], bl
jne .skip
 
mov [LFB_BASE+edx], eax
.skip:
; add pixel
add edx, 4
inc ebp
dec edi
jnz .new_x
; add line
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
@@:
; </Ivan 15.10.04>
dec esi
jnz .new_y
add esp, drbar.stack_data
popad
xor eax, eax
ret
 
 
align 4
vesa20_drawbackground_tiled:
call [_display.disable_mouse]
pushad
; External loop for all y from start to end
mov ebx, [draw_data+32+RECT.top] ; y start
dp2:
mov ebp, [draw_data+32+RECT.left] ; x start
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
; and LFB data (output for our function) [edi]
mov eax, [BytesPerScanLine]
mul ebx
xchg ebp, eax
add ebp, eax
add ebp, eax
add ebp, eax
add ebp, eax
add ebp, LFB_BASE
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
call calculate_edi
xchg edi, ebp
add ebp, [_WinMapAddress]
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
; 2) Calculate offset in background memory block
push eax
xor edx, edx
mov eax, ebx
div dword [BgrDataHeight] ; edx := y mod BgrDataHeight
pop eax
push eax
mov ecx, [BgrDataWidth]
mov esi, edx
imul esi, ecx ; esi := (y mod BgrDataHeight) * BgrDataWidth
xor edx, edx
div ecx ; edx := x mod BgrDataWidth
sub ecx, edx
add esi, edx ; esi := (y mod BgrDataHeight)*BgrDataWidth + (x mod BgrDataWidth)
pop eax
lea esi, [esi*3]
add esi, [img_background]
xor edx, edx
inc edx
; 3) Loop through redraw rectangle and copy background data
; Registers meaning:
; eax = x, ebx = y (screen coordinates)
; ecx = deltax - number of pixels left in current tile block
; edx = 1
; esi -> bgr memory, edi -> output
; ebp = offset in WinMapAddress
dp3:
cmp [ebp], dl
jnz nbgp
movsb
movsb
movsb
jmp @f
nbgp:
add esi, 3
add edi, 3
@@:
inc edi ; +1 for 32 bpp
add ebp, edx
add eax, edx
cmp eax, [draw_data+32+RECT.right]
ja dp4
sub ecx, edx
jnz dp3
; next tile block on x-axis
mov ecx, [BgrDataWidth]
sub esi, ecx
sub esi, ecx
sub esi, ecx
jmp dp3
dp4:
; next scan line
inc ebx
cmp ebx, [draw_data+32+RECT.bottom]
jbe dp2
popad
ret
 
; ----------
 
 
vesa20_drawbackground_stretch:
call [_display.disable_mouse]
pushad
; Helper variables
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
mov eax, [BgrDataWidth]
dec eax
xor edx, edx
div dword [Screen_Max_X]
push eax ; high
xor eax, eax
div dword [Screen_Max_X]
push eax ; low
; the same for height
mov eax, [BgrDataHeight]
dec eax
xor edx, edx
div dword [Screen_Max_Y]
push eax ; high
xor eax, eax
div dword [Screen_Max_Y]
push eax ; low
; External loop for all y from start to end
mov ebx, [draw_data+32+RECT.top] ; y start
mov ebp, [draw_data+32+RECT.left] ; x start
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
; and LFB data (output for our function) [edi]
mov eax, [BytesPerScanLine]
mul ebx
xchg ebp, eax
add ebp, eax
add ebp, eax
add ebp, eax
add ebp, eax
 
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
call calculate_edi
xchg edi, ebp
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
push ebx
push eax
; 2) Calculate offset in background memory block
mov eax, ebx
imul ebx, dword [esp+12]
mul dword [esp+8]
add edx, ebx ; edx:eax = y * 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
mov esi, edx
imul esi, [BgrDataWidth]
push edx
push eax
mov eax, [esp+8]
mul dword [esp+28]
push eax
mov eax, [esp+12]
mul dword [esp+28]
add [esp], edx
pop edx ; edx:eax = x * 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
add esi, edx
lea esi, [esi*3]
add esi, [img_background]
push eax
push edx
push esi
; 3) Smooth horizontal
bgr_resmooth0:
mov ecx, [esp+8]
mov edx, [esp+4]
mov esi, [esp]
push edi
mov edi, bgr_cur_line
call smooth_line
bgr_resmooth1:
mov eax, [esp+16+4]
inc eax
cmp eax, [BgrDataHeight]
jae bgr.no2nd
mov ecx, [esp+8+4]
mov edx, [esp+4+4]
mov esi, [esp+4]
add esi, [BgrDataWidth]
add esi, [BgrDataWidth]
add esi, [BgrDataWidth]
mov edi, bgr_next_line
call smooth_line
bgr.no2nd:
pop edi
sdp3:
xor esi, esi
mov ecx, [esp+12]
; 4) Loop through redraw rectangle and copy background data
; Registers meaning:
; esi = offset in current line, edi -> output
; ebp = offset in WinMapAddress
; dword [esp] = offset in bgr data
; qword [esp+4] = x * 2^32 * (BgrDataWidth-1) / (ScreenWidth-1)
; qword [esp+12] = y * 2^32 * (BgrDataHeight-1) / (ScreenHeight-1)
; dword [esp+20] = x
; dword [esp+24] = y
; precalculated constants:
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
sdp3a:
mov eax, [_WinMapAddress]
cmp [ebp+eax], byte 1
jnz snbgp
mov eax, [bgr_cur_line+esi]
test ecx, ecx
jz .novert
mov ebx, [bgr_next_line+esi]
call [overlapping_of_points_ptr]
.novert:
 
mov [LFB_BASE+edi], ax
shr eax, 16
 
mov [LFB_BASE+edi+2], al
snbgp:
add edi, 4
inc ebp
mov eax, [esp+20]
inc eax
mov [esp+20], eax
add esi, 4
cmp eax, [draw_data+32+RECT.right]
jbe sdp3a
sdp4:
; next y
mov ebx, [esp+24]
inc ebx
mov [esp+24], ebx
cmp ebx, [draw_data+32+RECT.bottom]
ja sdpdone
; advance edi, ebp to next scan line
sub eax, [draw_data+32+RECT.left]
sub ebp, eax
add ebp, [Screen_Max_X]
inc ebp
sub edi, eax
sub edi, eax
sub edi, eax
sub edi, eax
add edi, [BytesPerScanLine]
; restore ecx,edx; advance esi to next background line
mov eax, [esp+28]
mov ebx, [esp+32]
add [esp+12], eax
mov eax, [esp+16]
adc [esp+16], ebx
sub eax, [esp+16]
mov ebx, eax
lea eax, [eax*3]
imul eax, [BgrDataWidth]
sub [esp], eax
mov eax, [draw_data+32+RECT.left]
mov [esp+20], eax
test ebx, ebx
jz sdp3
cmp ebx, -1
jnz bgr_resmooth0
push edi
mov esi, bgr_next_line
mov edi, bgr_cur_line
mov ecx, [Screen_Max_X]
inc ecx
rep movsd
jmp bgr_resmooth1
sdpdone:
add esp, 44
popad
ret
 
uglobal
align 4
bgr_cur_line rd 1920 ; maximum width of screen
bgr_next_line rd 1920
endg
 
smooth_line:
mov al, [esi+2]
shl eax, 16
mov ax, [esi]
test ecx, ecx
jz @f
mov ebx, [esi+2]
shr ebx, 8
call [overlapping_of_points_ptr]
@@:
stosd
mov eax, [esp+20+8]
inc eax
mov [esp+20+8], eax
cmp eax, [draw_data+32+RECT.right]
ja @f
add ecx, [esp+36+8]
mov eax, edx
adc edx, [esp+40+8]
sub eax, edx
lea eax, [eax*3]
sub esi, eax
jmp smooth_line
@@:
mov eax, [draw_data+32+RECT.left]
mov [esp+20+8], eax
ret
 
align 16
overlapping_of_points:
push ecx edx
mov edx, eax
push esi
shr ecx, 26
mov esi, ecx
mov ecx, ebx
shl esi, 9
movzx ebx, dl
movzx eax, cl
sub eax, ebx
movzx ebx, dh
add dl, [BgrAuxTable+(eax+0x100)+esi]
movzx eax, ch
sub eax, ebx
add dh, [BgrAuxTable+(eax+0x100)+esi]
ror ecx, 16
ror edx, 16
movzx eax, cl
movzx ebx, dl
sub eax, ebx
add dl, [BgrAuxTable+(eax+0x100)+esi]
pop esi
mov eax, edx
pop edx
ror eax, 16
pop ecx
ret
 
iglobal
align 4
overlapping_of_points_ptr dd overlapping_of_points
endg
 
init_background:
mov edi, BgrAuxTable
xor edx, edx
.loop2:
mov eax, edx
shl eax, 8
neg eax
mov ecx, 0x200
.loop1:
mov byte [edi], ah
inc edi
add eax, edx
loop .loop1
add dl, 4
jnz .loop2
test byte [cpu_caps+(CAPS_MMX/8)], 1 shl (CAPS_MMX mod 8)
jz @f
mov [overlapping_of_points_ptr], overlapping_of_points_mmx
@@:
ret
 
align 16
overlapping_of_points_mmx:
movd mm0, eax
movd mm4, eax
movd mm1, ebx
pxor mm2, mm2
punpcklbw mm0, mm2
punpcklbw mm1, mm2
psubw mm1, mm0
movd mm3, ecx
psrld mm3, 24
packuswb mm3, mm3
packuswb mm3, mm3
pmullw mm1, mm3
psrlw mm1, 8
packuswb mm1, mm2
paddb mm4, mm1
movd eax, mm4
ret
diff16 "VESA2 code end ",0,$
diff16 "VESA2 code size",get_pixel,$
 
Property changes:
Added: svn:keywords
+Rev
\ No newline at end of property
/kernel/branches/Kolibri-A/trunk/hid/mousedrv.inc
35,6 → 35,19
;include 'm_com.inc'
 
 
;test_mario79:
; push esi
; push eax
; mov [write_error_to],process_test_m79+43
; movzx eax,al ;[DevErrorCode]
; call writehex
; mov esi,process_test_m79
; call sys_msg_board_str
; pop eax
; pop esi
; ret
;process_test_m79 db 'K : Process - test Mario79 error 00000000',13,10,0
 
draw_mouse_under:
; return old picture
 
96,12 → 109,9
push eax
push ebx
mov ecx, ebx ; <<<<
shr ecx, 1
imul ecx, [_WinMapWidth]
shr eax, 1
shr eax, 1
add eax, ecx
mov ecx, [Screen_Max_X]
inc ecx
mul ecx
add eax, [_WinMapAddress]
movzx edx, byte [ebx+eax]
shl edx, 8
276,11 → 286,9
add edx,window_data
movzx eax, word [MOUSE_X]
movzx ebx, word [MOUSE_Y]
mov ecx, ebx ; <<<<
shr ecx, 1
imul ecx, [_WinMapWidth]
shr eax, 1
shr eax, 1
mov ecx,[Screen_Max_X]
inc ecx
imul ecx,ebx
add ecx, eax
add ecx, [_WinMapAddress]
mov eax, [CURRENT_TASK]
446,5 → 454,3
@@:
ret
 
diff16 "window code end",0,$
diff10 "mousedrv size ",draw_mouse_under,$
/kernel/branches/Kolibri-A/trunk/data32.inc
315,32 → 315,13
srv.bk rd 1
 
 
align 64
img_draw_core_fn rd 1 ; putimage variables & helpers
img_draw_edge_fn rd 1
img_lfb_origin rd 1
img_buf_origin rd 1
img_buf_line_size rd 1
img_palette rd 1
img_bitoffset rd 1
img_edgeoffset rd 1
img_bytes_per_pix rd 1
img_map_right rd 1
img_map_x rd 1
img_pix_x rd 1 ; real Xsize
img_pix_y rd 1 ; real Ysize
img_screen_x rd 1
img_screen_y rd 1
align 16
 
align 64
_WinMapWidth rd 1
_WinMapHeight rd 1
_display display_t
 
_WinMapAddress rd 1
_WinMapSize rd 1
 
align 16
_display display_t
 
def_cursor rd 1
current_cursor rd 1
hw_cursor rd 1
/kernel/branches/Kolibri-A/trunk/kernel32.inc
224,7 → 224,9
 
; display
 
include "video/graph32.inc" ; 32bpp graphics
;include "video/vesa12.inc" ; Vesa 1.2 functions
include "video/vesa20.inc" ; Vesa 2.0 functions
;include "video/vga.inc" ; VGA 16 color functions
include "video/cursors.inc" ; cursors functions
 
; Network Interface & TCPIP Stack