kms: pre rc8

git-svn-id: svn://kolibrios.org@1300 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2009-12-01 13:32:57 +00:00
parent 18d56a4087
commit 77f37d9ba0
10 changed files with 148 additions and 178 deletions

View File

@ -309,14 +309,12 @@ draw_data equ (OS_BASE+0x0338000);
BgrDrawMode equ (OS_BASE+0x033BFF4) BgrDrawMode equ (OS_BASE+0x033BFF4)
BgrDataWidth equ (OS_BASE+0x033BFF8) BgrDataWidth equ (OS_BASE+0x033BFF8)
BgrDataHeight equ (OS_BASE+0x033BFFC) BgrDataHeight equ (OS_BASE+0x033BFFC)
WinMapAddress equ (OS_BASE+0x033C000)
display_data equ (OS_BASE+0x033C000) ;1024*1280=0x140000
virtual at (OS_BASE+0x047CF80) virtual at (OS_BASE+0x033CF80)
tss TSS tss TSS
end virtual end virtual
sys_pgmap equ (OS_BASE+0x047F000) sys_pgmap equ (OS_BASE+0x033F000)
HEAP_BASE equ (OS_BASE+0x0800000) HEAP_BASE equ (OS_BASE+0x0800000)
HEAP_MIN_SIZE equ 0x01000000 HEAP_MIN_SIZE equ 0x01000000
@ -580,6 +578,7 @@ struc display_t
.show_cursor dd ? .show_cursor dd ?
.move_cursor dd ? .move_cursor dd ?
.restore_cursor dd ? .restore_cursor dd ?
.disable_mouse dd ?
} }
virtual at 0 virtual at 0
@ -677,7 +676,8 @@ struc SRV
.bk dd ? ;+0x1C ;prev SRV descriptor .bk dd ? ;+0x1C ;prev SRV descriptor
.base dd ? ;+0x20 ;service base address .base dd ? ;+0x20 ;service base address
.entry dd ? ;+0x24 ;service START function .entry dd ? ;+0x24 ;service START function
.srv_proc dd ? ;+0x28 ;main service handler .srv_proc dd ? ;+0x28 ;user mode service handler
.srv_proc_ex dd ? ;+0x2C ;kernel mode service handler
.sizeof: .sizeof:
} }

View File

@ -321,8 +321,17 @@ proc init_LFB
cmp dword [LFBAddress], -1 cmp dword [LFBAddress], -1
jne @f jne @f
mov [BOOT_VAR+0x901c],byte 2 mov [BOOT_VAR+0x901c],byte 2
stdcall kernel_alloc, 0x280000 stdcall alloc_pages, (0x280000 / 4096)
mov [LFBAddress], eax
push eax
call alloc_page
stdcall map_page_table, LFB_BASE, eax
pop eax
or eax, PG_UW
mov ebx, LFB_BASE
mov ecx, 0x280000 / 4096
call commit_pages
mov [LFBAddress], dword LFB_BASE
ret ret
@@: @@:
test [SCR_MODE],word 0100000000000000b test [SCR_MODE],word 0100000000000000b
@ -334,7 +343,7 @@ proc init_LFB
mov edx, LFB_BASE mov edx, LFB_BASE
mov esi, [LFBAddress] mov esi, [LFBAddress]
mov edi, 0x00800000 mov edi, 0x00C00000
mov dword [exp_lfb+4], edx mov dword [exp_lfb+4], edx
shr edi, 12 shr edi, 12
@ -558,14 +567,6 @@ proc page_fault_handler
push ebx ;that is locals: .err_addr = cr2 push ebx ;that is locals: .err_addr = cr2
inc [pg_data.pages_faults] inc [pg_data.pages_faults]
; push eax
; push edx
; mov edx, 0x400 ;bochs
; mov al,0xff ;bochs
; out dx, al ;bochs
; pop edx
; pop eax
mov eax, [pf_err_code] mov eax, [pf_err_code]
cmp ebx, OS_BASE ;ebx == .err_addr cmp ebx, OS_BASE ;ebx == .err_addr
@ -592,6 +593,11 @@ end if
pop ebx ;restore exception number (#PF) pop ebx ;restore exception number (#PF)
ret ret
; xchg bx, bx
; add esp,12 ;clear in stack: locals(.err_addr) + #PF + ret_to_caller
; restore_ring3_context
; iretd
.user_space: .user_space:
test eax, PG_MAP test eax, PG_MAP
jnz .err_access ;Ñòðàíèöà ïðèñóòñòâóåò jnz .err_access ;Ñòðàíèöà ïðèñóòñòâóåò

View File

@ -129,32 +129,11 @@ dll_cur_addr dd MIN_DEFAULT_DLL_ADDR
; supported videomodes ; supported videomodes
;mode_1280_1024_32:
; dw 1280,1024,32,60
;mode_1280_1024_24:
; dw 1280,1024,24,60
;mode_1024_768_32:
; dw 1024,768,32,60
;mode_1024_768_24:
; dw 1024,768,24,60
;mode_800_600_32:
; dw 800,600,32,60
;mode_800_600_24:
; dw 800,600,24,60
;mode_640_480_32:
; dw 640,480,32,60
;mode_640_480_24:
; dw 640,480,24,60
;mode_640_480_16:
; dw 640,480,16,60
;mode_320_240_8:
; dw 320,240,8,60
; mike.dld { ; mike.dld {
db 0 db 0
dd servetable-0x10000 dd servetable-0x10000
draw_line dd __sys_draw_line draw_line dd __sys_draw_line
disable_mouse dd __sys_disable_mouse
draw_pointer dd __sys_draw_pointer draw_pointer dd __sys_draw_pointer
;//mike.dld, 2006-08-02 [ ;//mike.dld, 2006-08-02 [
;drawbar dd __sys_drawbar ;drawbar dd __sys_drawbar
@ -337,8 +316,15 @@ os_stack_seg rd 1
srv.fd rd 1 srv.fd rd 1
srv.bk rd 1 srv.bk rd 1
align 16
_display display_t _display display_t
_WinMapAddress rd 1
_WinMapSize rd 1
scr_width rd 1 scr_width rd 1
scr_height rd 1 scr_height rd 1

View File

@ -372,7 +372,7 @@ negativebutton:
push edx push edx
push edi push edi
call [disable_mouse] call [_display.disable_mouse]
bdbnewline: bdbnewline:
mov edi,1 ; force mov edi,1 ; force
@ -389,7 +389,6 @@ negativebutton:
bneg: bneg:
;;;call [disable_mouse]
call [putpixel] call [putpixel]
nbneg: nbneg:

View File

@ -33,7 +33,7 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
.1: .1:
; } \\ Alver \\ ; } \\ Alver \\
pushad pushad
call [disable_mouse] call [_display.disable_mouse]
movsx eax, bx ; eax=y movsx eax, bx ; eax=y
sar ebx, 16 ; ebx=x sar ebx, 16 ; ebx=x

View File

@ -184,7 +184,7 @@ pushad
inc edi inc edi
imul edi, ebx imul edi, ebx
add edi, eax add edi, eax
add edi, WinMapAddress add edi, [_WinMapAddress]
.new_y: .new_y:
push ecx ; sx push ecx ; sx
@ -245,7 +245,7 @@ pushad
inc eax inc eax
imul eax, ebx imul eax, ebx
add eax, [esp] add eax, [esp]
add eax, WinMapAddress add eax, [_WinMapAddress]
mov ebp, eax mov ebp, eax
mov edi, [edi+APPDATA.wnd_shape] mov edi, [edi+APPDATA.wnd_shape]

View File

@ -111,17 +111,14 @@ save_draw_mouse:
mov ecx, [Screen_Max_X] mov ecx, [Screen_Max_X]
inc ecx inc ecx
mul ecx mul ecx
add eax, [_WinMapAddress]
movzx edx, byte [display_data+ebx+eax] movzx edx, byte [ebx+eax]
shl edx, 8 shl edx, 8
mov esi, [edx+SLOT_BASE+APPDATA.cursor] mov esi, [edx+SLOT_BASE+APPDATA.cursor]
cmp esi, [current_cursor] cmp esi, [current_cursor]
je .draw je .draw
; cmp [esi+CURSOR.magic], 'CURS'
; jne .fail
push esi push esi
call [select_hw_cursor] call [select_hw_cursor]
mov [current_cursor], esi mov [current_cursor], esi
@ -292,7 +289,7 @@ __sys_disable_mouse:
inc ecx inc ecx
imul ecx,ebx imul ecx,ebx
add ecx,eax add ecx,eax
add ecx, display_data add ecx, [_WinMapAddress]
mov eax, [CURRENT_TASK] mov eax, [CURRENT_TASK]
movzx ebx, byte [ecx] movzx ebx, byte [ecx]
cmp eax,ebx cmp eax,ebx

View File

@ -349,14 +349,20 @@ high_code:
; mov [0xF604],byte 1 ;al ; mov [0xF604],byte 1 ;al
mov al, [BOOT_VAR+0x901F] ; DMA access mov al, [BOOT_VAR+0x901F] ; DMA access
mov [allow_dma_access], al mov [allow_dma_access], al
mov al,[BOOT_VAR+0x9000] ; bpp movzx eax, byte [BOOT_VAR+0x9000] ; bpp
mov [ScreenBPP],al mov [ScreenBPP],al
mov [_display.bpp], eax
mov [_display.vrefresh], 60
mov [_display.disable_mouse], __sys_disable_mouse
movzx eax,word [BOOT_VAR+0x900A] ; X max movzx eax,word [BOOT_VAR+0x900A] ; X max
mov [_display.width], eax
dec eax dec eax
mov [Screen_Max_X],eax mov [Screen_Max_X],eax
mov [screen_workarea.right],eax mov [screen_workarea.right],eax
movzx eax,word [BOOT_VAR+0x900C] ; Y max movzx eax,word [BOOT_VAR+0x900C] ; Y max
mov [_display.height], eax
dec eax dec eax
mov [Screen_Max_Y],eax mov [Screen_Max_Y],eax
mov [screen_workarea.bottom],eax mov [screen_workarea.bottom],eax
@ -369,9 +375,14 @@ high_code:
je @f je @f
cmp [SCR_MODE],word 0x12 ; VGA 640x480 cmp [SCR_MODE],word 0x12 ; VGA 640x480
je @f je @f
mov ax,[BOOT_VAR+0x9001] ; for other modes movzx eax, word[BOOT_VAR+0x9001] ; for other modes
mov [BytesPerScanLine],ax mov [BytesPerScanLine],ax
mov [_display.pitch], eax
@@: @@:
mov eax, [_display.width]
mul [_display.height]
mov [_WinMapSize], eax
mov esi, BOOT_VAR+0x9080 mov esi, BOOT_VAR+0x9080
movzx ecx, byte [esi-1] movzx ecx, byte [esi-1]
mov [NumBiosDisks], ecx mov [NumBiosDisks], ecx
@ -541,6 +552,9 @@ high_code:
mov [graph_data_l+4],al mov [graph_data_l+4],al
mov [graph_data_l+7],ah mov [graph_data_l+7],ah
stdcall kernel_alloc, [_WinMapSize]
mov [_WinMapAddress], eax
xor eax,eax xor eax,eax
inc eax inc eax
mov [CURRENT_TASK],eax ;dword 1 mov [CURRENT_TASK],eax ;dword 1
@ -549,8 +563,7 @@ high_code:
mov [current_slot], SLOT_BASE+256 mov [current_slot], SLOT_BASE+256
; set background ; set background
; xor eax,eax
; inc eax
mov [BgrDrawMode],eax mov [BgrDrawMode],eax
mov [BgrDataWidth],eax mov [BgrDataWidth],eax
mov [BgrDataHeight],eax mov [BgrDataHeight],eax
@ -1805,7 +1818,6 @@ msset:
ret ret
app_load_cursor: app_load_cursor:
; add ebx, new_app_base
cmp ecx, OS_BASE cmp ecx, OS_BASE
jae msset jae msset
stdcall load_cursor, ecx, edx stdcall load_cursor, ecx, edx
@ -2894,9 +2906,9 @@ sys_drawwindow:
; cmp eax,0 ; type I - original style ; cmp eax,0 ; type I - original style
jne nosyswI jne nosyswI
inc [mouse_pause] inc [mouse_pause]
call [disable_mouse] call [_display.disable_mouse]
call sys_set_window call sys_set_window
call [disable_mouse] call [_display.disable_mouse]
call drawwindow_I call drawwindow_I
;dec [mouse_pause] ;dec [mouse_pause]
;call [draw_pointer] ;call [draw_pointer]
@ -2907,9 +2919,9 @@ sys_drawwindow:
cmp al,1 ; type II - only reserve area, no draw cmp al,1 ; type II - only reserve area, no draw
jne nosyswII jne nosyswII
inc [mouse_pause] inc [mouse_pause]
call [disable_mouse] call [_display.disable_mouse]
call sys_set_window call sys_set_window
call [disable_mouse] call [_display.disable_mouse]
call sys_window_mouse call sys_window_mouse
dec [mouse_pause] dec [mouse_pause]
call [draw_pointer] call [draw_pointer]
@ -2919,9 +2931,9 @@ sys_drawwindow:
cmp al,2 ; type III - new style cmp al,2 ; type III - new style
jne nosyswIII jne nosyswIII
inc [mouse_pause] inc [mouse_pause]
call [disable_mouse] call [_display.disable_mouse]
call sys_set_window call sys_set_window
call [disable_mouse] call [_display.disable_mouse]
call drawwindow_III call drawwindow_III
;dec [mouse_pause] ;dec [mouse_pause]
;call [draw_pointer] ;call [draw_pointer]
@ -2936,9 +2948,9 @@ sys_drawwindow:
draw_skin_window: draw_skin_window:
inc [mouse_pause] inc [mouse_pause]
call [disable_mouse] call [_display.disable_mouse]
call sys_set_window call sys_set_window
call [disable_mouse] call [_display.disable_mouse]
mov eax, [TASK_COUNT] mov eax, [TASK_COUNT]
movzx eax, word [WIN_POS + eax*2] movzx eax, word [WIN_POS + eax*2]
cmp eax, [CURRENT_TASK] cmp eax, [CURRENT_TASK]
@ -2957,7 +2969,7 @@ sys_drawwindow:
draw_window_caption: draw_window_caption:
inc [mouse_pause] inc [mouse_pause]
call [disable_mouse] call [_display.disable_mouse]
xor eax,eax xor eax,eax
mov edx,[TASK_COUNT] mov edx,[TASK_COUNT]
@ -3495,7 +3507,8 @@ checkpixel:
mov edx,[Screen_Max_X] ; screen x size mov edx,[Screen_Max_X] ; screen x size
inc edx inc edx
imul edx, ebx imul edx, ebx
mov dl, [eax+edx+display_data] ; lea eax, [...] add eax, [_WinMapAddress]
mov dl, [eax+edx] ; lea eax, [...]
xor ecx, ecx xor ecx, ecx
mov eax, [CURRENT_TASK] mov eax, [CURRENT_TASK]
@ -3584,7 +3597,7 @@ markz:
no_mark_system_shutdown: no_mark_system_shutdown:
call [disable_mouse] call [_display.disable_mouse]
dec byte [SYS_SHUTDOWN] dec byte [SYS_SHUTDOWN]
je system_shutdown je system_shutdown
@ -3742,9 +3755,10 @@ redrawscreen:
calculatebackground: ; background calculatebackground: ; background
mov edi,display_data ; set os to use all pixels mov edi, [_WinMapAddress] ; set os to use all pixels
mov eax,0x01010101 mov eax,0x01010101
mov ecx,1280*1024 / 4 mov ecx, [_WinMapSize]
shr ecx, 2
rep stosd rep stosd
mov byte [REDRAW_BACKGROUND], 0 ; do not draw background! mov byte [REDRAW_BACKGROUND], 0 ; do not draw background!
@ -5093,7 +5107,7 @@ syscall_setpixel: ; SetPixel
add ebx, [edi+APPDATA.wnd_clientbox.top] add ebx, [edi+APPDATA.wnd_clientbox.top]
xor edi, edi ; no force xor edi, edi ; no force
; mov edi, 1 ; mov edi, 1
call [disable_mouse] call [_display.disable_mouse]
jmp [putpixel] jmp [putpixel]
align 4 align 4
@ -5247,7 +5261,7 @@ syscall_getarea:
pushad pushad
inc [mouse_pause] inc [mouse_pause]
; Check of use of the hardware cursor. ; Check of use of the hardware cursor.
cmp [disable_mouse],__sys_disable_mouse cmp [_display.disable_mouse],__sys_disable_mouse
jne @f jne @f
; Since the test for the coordinates of the mouse should not be used, ; Since the test for the coordinates of the mouse should not be used,
; then use the call [disable_mouse] is not possible! ; then use the call [disable_mouse] is not possible!
@ -5311,7 +5325,7 @@ syscall_getarea:
jnz .start_y jnz .start_y
dec [mouse_pause] dec [mouse_pause]
; Check of use of the hardware cursor. ; Check of use of the hardware cursor.
cmp [disable_mouse],__sys_disable_mouse cmp [_display.disable_mouse],__sys_disable_mouse
jne @f jne @f
call [draw_pointer] call [draw_pointer]
@@: @@:
@ -5433,18 +5447,33 @@ set_screen:
mov [Screen_Max_X], eax mov [Screen_Max_X], eax
mov [Screen_Max_Y], edx mov [Screen_Max_Y], edx
mov [BytesPerScanLine], ecx
mov [screen_workarea.right],eax mov [screen_workarea.right],eax
mov [screen_workarea.bottom], edx mov [screen_workarea.bottom], edx
inc eax
shl eax, 2 ;32 bpp
mov [BytesPerScanLine], eax
push ebx push ebx
push esi push esi
push edi push edi
pushad
stdcall kernel_free, [_WinMapAddress]
mov eax, [_display.width]
mul [_display.height]
mov [_WinMapSize], eax
stdcall kernel_alloc, eax
mov [_WinMapAddress], eax
test eax, eax
jz .epic_fail
popad
call repos_windows call repos_windows
mov eax, 0 xor eax, eax
mov ebx, 0 xor ebx, ebx
mov ecx, [Screen_Max_X] mov ecx, [Screen_Max_X]
mov edx, [Screen_Max_Y] mov edx, [Screen_Max_Y]
call calculatescreen call calculatescreen
@ -5455,6 +5484,9 @@ set_screen:
popfd popfd
ret ret
.epic_fail:
hlt ; Houston, we've had a problem
; --------------- APM --------------------- ; --------------- APM ---------------------
apm_entry dp 0 apm_entry dp 0
apm_vf dd 0 apm_vf dd 0

View File

@ -242,7 +242,7 @@ end if
vesa12_drawbackground: vesa12_drawbackground:
call [disable_mouse] call [_display.disable_mouse]
push eax push eax
push ebx push ebx
@ -327,7 +327,8 @@ vesa12_drawbackground:
mov eax,[Screen_Max_X] mov eax,[Screen_Max_X]
add eax,1 add eax,1
mul ebx mul ebx
cmp [eax+esi+WinMapAddress],byte 1 add eax, [_WinMapAddress]
cmp [eax+esi],byte 1
jnz v12nbgp jnz v12nbgp
mov eax,[BytesPerScanLine] mov eax,[BytesPerScanLine]
mov ebx,edi mov ebx,edi
@ -386,7 +387,7 @@ vesa12_drawbackground:
vesa12_drawbar: vesa12_drawbar:
call [disable_mouse] call [_display.disable_mouse]
;; mov [novesachecksum],dword 0 ;; mov [novesachecksum],dword 0
sub edx,ebx sub edx,ebx
@ -494,7 +495,7 @@ dbpi24bit12:
sub eax,VGABasePtr sub eax,VGABasePtr
mov ebx,3 mov ebx,3
div ebx div ebx
add eax,WinMapAddress add eax, [_WinMapAddress]
mov ebx,[CURRENT_TASK] mov ebx,[CURRENT_TASK]
cld cld
@ -585,7 +586,7 @@ dbpi24bit12:
mov eax,edi mov eax,edi
sub eax,VGABasePtr sub eax,VGABasePtr
shr eax,2 shr eax,2
add eax,WinMapAddress add eax, [_WinMapAddress]
mov ebx,[CURRENT_TASK] mov ebx,[CURRENT_TASK]
cld cld
@ -753,7 +754,7 @@ vesa12_putimage:
; mov ecx,320*65536+240 ; mov ecx,320*65536+240
; mov edx,20*65536+20 ; mov edx,20*65536+20
call [disable_mouse] call [_display.disable_mouse]
mov [novesachecksum],dword 0 mov [novesachecksum],dword 0
push esi push esi
@ -830,7 +831,7 @@ vesa12_putimage:
sub edx,VGABasePtr sub edx,VGABasePtr
mov ebx,3 mov ebx,3
div ebx div ebx
add edx,WinMapAddress add edx, [_WinMapAddress]
mov ebx,[CURRENT_TASK] mov ebx,[CURRENT_TASK]
mov bh,[esp+4*3] mov bh,[esp+4*3]
@ -909,7 +910,7 @@ vesa12_putimage:
mov edx,edi mov edx,edi
sub edx,VGABasePtr sub edx,VGABasePtr
shr edx,2 shr edx,2
add edx,WinMapAddress add edx, [_WinMapAddress]
mov ebx,[CURRENT_TASK] mov ebx,[CURRENT_TASK]
mov bh,[esp+4*3] mov bh,[esp+4*3]

View File

@ -28,7 +28,6 @@ $Revision$
;BytesPerScanLine equ 0xfe08 ;BytesPerScanLine equ 0xfe08
;LFBAddress equ 0xfe80 ;LFBAddress equ 0xfe80
;ScreenBPP equ 0xfbf1 ;ScreenBPP equ 0xfbf1
;WinMapAddress equ 0x460000
@ -54,16 +53,14 @@ Vesa20_getpixel24:
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [eax+eax*2] ; edi = x*3 lea edi, [eax+eax*2] ; edi = x*3
add edi, ebx ; edi = x*3+(y*y multiplier) add edi, ebx ; edi = x*3+(y*y multiplier)
add edi, [LFBAddress] ; ebx = where pixel is in memory mov ecx, [LFB_BASE+edi]
mov ecx, [edi]
and ecx, 0xffffff and ecx, 0xffffff
ret ret
Vesa20_getpixel32: Vesa20_getpixel32:
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier) lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
add edi, [LFBAddress] ; ebx = where pixel is in memory mov ecx, [LFB_BASE+edi]
mov ecx, [edi]
and ecx, 0xffffff and ecx, 0xffffff
ret ret
@ -106,7 +103,7 @@ align 16
vesa20_putimage: vesa20_putimage:
pushad pushad
call [disable_mouse] call [_display.disable_mouse]
sub esp, putimg.stack_data sub esp, putimg.stack_data
; save pointer to image ; save pointer to image
mov [putimg.pti], ebx mov [putimg.pti], ebx
@ -194,13 +191,12 @@ vesa20_putimage:
shr ebx, 3 shr ebx, 3
imul eax, ebx imul eax, ebx
add edx, eax add edx, eax
add edx, [LFBAddress]
; pointer to pixel map ; pointer to pixel map
mov eax, [putimg.abs_cy] mov eax, [putimg.abs_cy]
imul eax, [Screen_Max_X] imul eax, [Screen_Max_X]
add eax, [putimg.abs_cy] add eax, [putimg.abs_cy]
add eax, [putimg.abs_cx] add eax, [putimg.abs_cx]
add eax, WinMapAddress add eax, [_WinMapAddress]
xchg eax, ebp xchg eax, ebp
; get process number ; get process number
mov ebx, [CURRENT_TASK] mov ebx, [CURRENT_TASK]
@ -220,9 +216,9 @@ align 4
cmp [ebp], bl cmp [ebp], bl
jne .skip jne .skip
; mov eax, [esi] ; eax = RRBBGGRR ; mov eax, [esi] ; eax = RRBBGGRR
mov [edx], ax mov [LFB_BASE+edx], ax
shr eax, 16 shr eax, 16
mov [edx+2], al mov [LFB_BASE+edx+2], al
.skip: .skip:
; add esi, 3 ;[putimg.source_bpp] ; add esi, 3 ;[putimg.source_bpp]
add edx, 3 add edx, 3
@ -265,7 +261,7 @@ align 4
cmp [ebp], bl cmp [ebp], bl
jne .skip jne .skip
; mov eax, [esi] ; ecx = RRBBGGRR ; mov eax, [esi] ; ecx = RRBBGGRR
mov [edx], eax mov [LFB_BASE+edx], eax
.skip: .skip:
; add esi, [putimg.source_bpp] ; add esi, [putimg.source_bpp]
add edx, 4 add edx, 4
@ -308,20 +304,25 @@ __sys_putpixel:
;;; mov [novesachecksum], dword 0 ;;; mov [novesachecksum], dword 0
pushad pushad
test edi,1 ; force ?
jnz .forced
; not forced:
push ecx ; save 24th bit in case negative pixel wanted
call checkpixel
test ecx,ecx
pop ecx
jnz .exit
.forced:
cmp [Screen_Max_X], eax cmp [Screen_Max_X], eax
jb .exit jb .exit
cmp [Screen_Max_Y], ebx cmp [Screen_Max_Y], ebx
jb .exit jb .exit
.ok: 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
.forced:
; check if negation ; check if negation
test ecx,0x01000000 test ecx,0x01000000
jz .noneg jz .noneg
@ -342,11 +343,9 @@ Vesa20_putpixel24:
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [eax+eax*2] ; edi = x*3 lea edi, [eax+eax*2] ; edi = x*3
mov eax, [esp+32-8+4] mov eax, [esp+32-8+4]
add edi, [LFBAddress] mov [LFB_BASE+ebx+edi], ax
add edi, ebx ; ebx = where to put pixel in memory
mov [edi], ax
shr eax, 16 shr eax, 16
mov [edi+2], al mov [LFB_BASE+ebx+edi+2], al
ret ret
@ -357,8 +356,7 @@ Vesa20_putpixel32:
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier) lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
mov eax, [esp+32-8+4] ; eax = color mov eax, [esp+32-8+4] ; eax = color
add edi, [LFBAddress] ; ebx = where to put pixel in memory mov [LFB_BASE+edi], eax
mov [edi], eax
ret ret
;************************************************* ;*************************************************
@ -378,7 +376,7 @@ calculate_edi:
align 4 align 4
__sys_draw_line: __sys_draw_line:
; inc [mouse_pause] ; inc [mouse_pause]
call [disable_mouse] call [_display.disable_mouse]
; draw a line ; draw a line
; eax = HIWORD = x1 ; eax = HIWORD = x1
@ -568,7 +566,7 @@ align 4
; edi color ; edi color
vesa20_drawbar: vesa20_drawbar:
pushad pushad
call [disable_mouse] call [_display.disable_mouse]
sub esp, drbar.stack_data sub esp, drbar.stack_data
mov [drbar.color], edi mov [drbar.color], edi
sub edx, ebx sub edx, ebx
@ -643,13 +641,12 @@ vesa20_drawbar:
; shr ebx, 3 ; shr ebx, 3
imul eax, ebx imul eax, ebx
add edx, eax add edx, eax
add edx, [LFBAddress]
; pointer to pixel map ; pointer to pixel map
mov eax, [drbar.abs_cy] mov eax, [drbar.abs_cy]
imul eax, [Screen_Max_X] imul eax, [Screen_Max_X]
add eax, [drbar.abs_cy] add eax, [drbar.abs_cy]
add eax, [drbar.abs_cx] add eax, [drbar.abs_cx]
add eax, WinMapAddress add eax, [_WinMapAddress]
xchg eax, ebp xchg eax, ebp
; get process number ; get process number
mov ebx, [CURRENT_TASK] mov ebx, [CURRENT_TASK]
@ -674,8 +671,9 @@ align 4
.new_x: .new_x:
cmp byte [ebp], bl cmp byte [ebp], bl
jne .skip jne .skip
mov [edx], bh
mov [edx + 1], ax mov [LFB_BASE+edx], bh
mov [LFB_BASE+edx + 1], ax
.skip: .skip:
; add pixel ; add pixel
add edx, 3 add edx, 3
@ -710,7 +708,8 @@ align 4
.new_x: .new_x:
cmp byte [ebp], bl cmp byte [ebp], bl
jne .skip jne .skip
mov [edx], eax
mov [LFB_BASE+edx], eax
.skip: .skip:
; add pixel ; add pixel
add edx, 4 add edx, 4
@ -737,62 +736,9 @@ align 4
mov [EGA_counter],1 mov [EGA_counter],1
ret ret
;voodoodbcplimit: align 4
; ebp:=(y+Ywin)*(ScreenXSize+1)+(x+Xwin)+AddrBuffer
; pusha
; xor edx,edx
; mov eax,ebp
; mov ebx,[Screen_Max_X] ; Screen_X_size
; inc ebx ; +1
; sub eax,WinMapAddress ; -AddrBuffer
; div ebx ;
; mov ebx,eax ; ebx:=Y
; mov eax,edx ; eax:=X
; call cplimit
; test ecx,ecx
; jne dbcpl12
; popa
; clc
; ret
; dbcpl12:
; popa
; stc
; ret
;dbcplimit:
; pusha
; xor edx,edx
; mov ebx,[Screen_Max_X]
; inc ebx
; sub eax,WinMapAddress
; div ebx
; mov ebx,eax
; mov eax,edx
; call cplimit
; test ecx,ecx
; jne dbcpl1
; popa
; clc
; ret
; dbcpl1:
; popa
; stc
; ret
vesa20_drawbackground_tiled: vesa20_drawbackground_tiled:
call [disable_mouse] call [_display.disable_mouse]
pushad pushad
; External loop for all y from start to end ; External loop for all y from start to end
mov ebx, [draw_data+32+RECT.top] ; y start mov ebx, [draw_data+32+RECT.top] ; y start
@ -810,10 +756,11 @@ dp2:
jz @f jz @f
add ebp, eax add ebp, eax
@@: @@:
add ebp, [LFBAddress] add ebp, LFB_BASE
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
call calculate_edi call calculate_edi
xchg edi, ebp xchg edi, ebp
add ebp, [_WinMapAddress]
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress ; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
; 2) Calculate offset in background memory block ; 2) Calculate offset in background memory block
push eax push eax
@ -842,7 +789,7 @@ dp2:
; esi -> bgr memory, edi -> output ; esi -> bgr memory, edi -> output
; ebp = offset in WinMapAddress ; ebp = offset in WinMapAddress
dp3: dp3:
cmp [ebp+WinMapAddress], dl cmp [ebp], dl
jnz nbgp jnz nbgp
movsb movsb
movsb movsb
@ -881,7 +828,7 @@ dp4:
vesa20_drawbackground_stretch: vesa20_drawbackground_stretch:
call [disable_mouse] call [_display.disable_mouse]
pushad pushad
; Helper variables ; Helper variables
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1) ; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
@ -917,7 +864,6 @@ vesa20_drawbackground_stretch:
jz @f jz @f
add ebp, eax add ebp, eax
@@: @@:
add ebp, [LFBAddress]
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
call calculate_edi call calculate_edi
xchg edi, ebp xchg edi, ebp
@ -985,7 +931,8 @@ sdp3:
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1) ; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1) ; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
sdp3a: sdp3a:
cmp [ebp+WinMapAddress], byte 1 mov eax, [_WinMapAddress]
cmp [ebp+eax], byte 1
jnz snbgp jnz snbgp
mov eax, [bgr_cur_line+esi] mov eax, [bgr_cur_line+esi]
test ecx, ecx test ecx, ecx
@ -993,9 +940,11 @@ sdp3a:
mov ebx, [bgr_next_line+esi] mov ebx, [bgr_next_line+esi]
call [overlapping_of_points_ptr] call [overlapping_of_points_ptr]
.novert: .novert:
mov [edi], ax
mov [LFB_BASE+edi], ax
shr eax, 16 shr eax, 16
mov [edi+2], al
mov [LFB_BASE+edi+2], al
snbgp: snbgp:
cmp [ScreenBPP], byte 25 cmp [ScreenBPP], byte 25
sbb edi, -4 sbb edi, -4