/kernel/trunk/core/memory.inc |
---|
321,17 → 321,8 |
cmp dword [LFBAddress], -1 |
jne @f |
mov [BOOT_VAR+0x901c],byte 2 |
stdcall alloc_pages, (0x280000 / 4096) |
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 |
stdcall kernel_alloc, 0x280000 |
mov [LFBAddress], eax |
ret |
@@: |
test [SCR_MODE],word 0100000000000000b |
343,7 → 334,7 |
mov edx, LFB_BASE |
mov esi, [LFBAddress] |
mov edi, 0x00C00000 |
mov edi, 0x00800000 |
mov dword [exp_lfb+4], edx |
shr edi, 12 |
567,6 → 558,14 |
push ebx ;that is locals: .err_addr = cr2 |
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] |
cmp ebx, OS_BASE ;ebx == .err_addr |
593,11 → 592,6 |
pop ebx ;restore exception number (#PF) |
ret |
; xchg bx, bx |
; add esp,12 ;clear in stack: locals(.err_addr) + #PF + ret_to_caller |
; restore_ring3_context |
; iretd |
.user_space: |
test eax, PG_MAP |
jnz .err_access ;Ñòðàíèöà ïðèñóòñòâóåò |
/kernel/trunk/kernel.asm |
---|
349,20 → 349,14 |
; mov [0xF604],byte 1 ;al |
mov al, [BOOT_VAR+0x901F] ; DMA access |
mov [allow_dma_access], al |
movzx eax, byte [BOOT_VAR+0x9000] ; bpp |
mov al,[BOOT_VAR+0x9000] ; bpp |
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 |
mov [_display.width], eax |
dec eax |
mov [Screen_Max_X],eax |
mov [screen_workarea.right],eax |
movzx eax,word [BOOT_VAR+0x900C] ; Y max |
mov [_display.height], eax |
dec eax |
mov [Screen_Max_Y],eax |
mov [screen_workarea.bottom],eax |
375,14 → 369,9 |
je @f |
cmp [SCR_MODE],word 0x12 ; VGA 640x480 |
je @f |
movzx eax, word[BOOT_VAR+0x9001] ; for other modes |
mov ax,[BOOT_VAR+0x9001] ; for other modes |
mov [BytesPerScanLine],ax |
mov [_display.pitch], eax |
@@: |
mov eax, [_display.width] |
mul [_display.height] |
mov [_WinMapSize], eax |
mov esi, BOOT_VAR+0x9080 |
movzx ecx, byte [esi-1] |
mov [NumBiosDisks], ecx |
552,9 → 541,6 |
mov [graph_data_l+4],al |
mov [graph_data_l+7],ah |
stdcall kernel_alloc, [_WinMapSize] |
mov [_WinMapAddress], eax |
xor eax,eax |
inc eax |
mov [CURRENT_TASK],eax ;dword 1 |
563,7 → 549,8 |
mov [current_slot], SLOT_BASE+256 |
; set background |
; xor eax,eax |
; inc eax |
mov [BgrDrawMode],eax |
mov [BgrDataWidth],eax |
mov [BgrDataHeight],eax |
1818,6 → 1805,7 |
ret |
app_load_cursor: |
; add ebx, new_app_base |
cmp ecx, OS_BASE |
jae msset |
stdcall load_cursor, ecx, edx |
2906,9 → 2894,9 |
; cmp eax,0 ; type I - original style |
jne nosyswI |
inc [mouse_pause] |
call [_display.disable_mouse] |
call [disable_mouse] |
call sys_set_window |
call [_display.disable_mouse] |
call [disable_mouse] |
call drawwindow_I |
;dec [mouse_pause] |
;call [draw_pointer] |
2919,9 → 2907,9 |
cmp al,1 ; type II - only reserve area, no draw |
jne nosyswII |
inc [mouse_pause] |
call [_display.disable_mouse] |
call [disable_mouse] |
call sys_set_window |
call [_display.disable_mouse] |
call [disable_mouse] |
call sys_window_mouse |
dec [mouse_pause] |
call [draw_pointer] |
2931,9 → 2919,9 |
cmp al,2 ; type III - new style |
jne nosyswIII |
inc [mouse_pause] |
call [_display.disable_mouse] |
call [disable_mouse] |
call sys_set_window |
call [_display.disable_mouse] |
call [disable_mouse] |
call drawwindow_III |
;dec [mouse_pause] |
;call [draw_pointer] |
2948,9 → 2936,9 |
draw_skin_window: |
inc [mouse_pause] |
call [_display.disable_mouse] |
call [disable_mouse] |
call sys_set_window |
call [_display.disable_mouse] |
call [disable_mouse] |
mov eax, [TASK_COUNT] |
movzx eax, word [WIN_POS + eax*2] |
cmp eax, [CURRENT_TASK] |
2969,7 → 2957,7 |
draw_window_caption: |
inc [mouse_pause] |
call [_display.disable_mouse] |
call [disable_mouse] |
xor eax,eax |
mov edx,[TASK_COUNT] |
3507,8 → 3495,7 |
mov edx,[Screen_Max_X] ; screen x size |
inc edx |
imul edx, ebx |
add eax, [_WinMapAddress] |
mov dl, [eax+edx] ; lea eax, [...] |
mov dl, [eax+edx+display_data] ; lea eax, [...] |
xor ecx, ecx |
mov eax, [CURRENT_TASK] |
3597,7 → 3584,7 |
no_mark_system_shutdown: |
call [_display.disable_mouse] |
call [disable_mouse] |
dec byte [SYS_SHUTDOWN] |
je system_shutdown |
3755,10 → 3742,9 |
calculatebackground: ; background |
mov edi, [_WinMapAddress] ; set os to use all pixels |
mov edi,display_data ; set os to use all pixels |
mov eax,0x01010101 |
mov ecx, [_WinMapSize] |
shr ecx, 2 |
mov ecx,1280*1024 / 4 |
rep stosd |
mov byte [REDRAW_BACKGROUND], 0 ; do not draw background! |
5107,7 → 5093,7 |
add ebx, [edi+APPDATA.wnd_clientbox.top] |
xor edi, edi ; no force |
; mov edi, 1 |
call [_display.disable_mouse] |
call [disable_mouse] |
jmp [putpixel] |
align 4 |
5261,7 → 5247,7 |
pushad |
inc [mouse_pause] |
; Check of use of the hardware cursor. |
cmp [_display.disable_mouse],__sys_disable_mouse |
cmp [disable_mouse],__sys_disable_mouse |
jne @f |
; Since the test for the coordinates of the mouse should not be used, |
; then use the call [disable_mouse] is not possible! |
5325,7 → 5311,7 |
jnz .start_y |
dec [mouse_pause] |
; Check of use of the hardware cursor. |
cmp [_display.disable_mouse],__sys_disable_mouse |
cmp [disable_mouse],__sys_disable_mouse |
jne @f |
call [draw_pointer] |
@@: |
5447,33 → 5433,18 |
mov [Screen_Max_X], eax |
mov [Screen_Max_Y], edx |
mov [BytesPerScanLine], ecx |
mov [screen_workarea.right],eax |
mov [screen_workarea.bottom], edx |
inc eax |
shl eax, 2 ;32 bpp |
mov [BytesPerScanLine], eax |
push ebx |
push esi |
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 |
xor eax, eax |
xor ebx, ebx |
mov eax, 0 |
mov ebx, 0 |
mov ecx, [Screen_Max_X] |
mov edx, [Screen_Max_Y] |
call calculatescreen |
5484,9 → 5455,6 |
popfd |
ret |
.epic_fail: |
hlt ; Houston, we've had a problem |
; --------------- APM --------------------- |
apm_entry dp 0 |
apm_vf dd 0 |
/kernel/trunk/const.inc |
---|
309,12 → 309,14 |
BgrDrawMode equ (OS_BASE+0x033BFF4) |
BgrDataWidth equ (OS_BASE+0x033BFF8) |
BgrDataHeight equ (OS_BASE+0x033BFFC) |
WinMapAddress equ (OS_BASE+0x033C000) |
display_data equ (OS_BASE+0x033C000) ;1024*1280=0x140000 |
virtual at (OS_BASE+0x033CF80) |
virtual at (OS_BASE+0x047CF80) |
tss TSS |
end virtual |
sys_pgmap equ (OS_BASE+0x033F000) |
sys_pgmap equ (OS_BASE+0x047F000) |
HEAP_BASE equ (OS_BASE+0x0800000) |
HEAP_MIN_SIZE equ 0x01000000 |
578,7 → 580,6 |
.show_cursor dd ? |
.move_cursor dd ? |
.restore_cursor dd ? |
.disable_mouse dd ? |
} |
virtual at 0 |
676,8 → 677,7 |
.bk dd ? ;+0x1C ;prev SRV descriptor |
.base dd ? ;+0x20 ;service base address |
.entry dd ? ;+0x24 ;service START function |
.srv_proc dd ? ;+0x28 ;user mode service handler |
.srv_proc_ex dd ? ;+0x2C ;kernel mode service handler |
.srv_proc dd ? ;+0x28 ;main service handler |
.sizeof: |
} |
/kernel/trunk/data32.inc |
---|
129,11 → 129,32 |
; 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 { |
db 0 |
dd servetable-0x10000 |
draw_line dd __sys_draw_line |
disable_mouse dd __sys_disable_mouse |
draw_pointer dd __sys_draw_pointer |
;//mike.dld, 2006-08-02 [ |
;drawbar dd __sys_drawbar |
316,15 → 337,8 |
srv.fd rd 1 |
srv.bk rd 1 |
align 16 |
_display display_t |
_WinMapAddress rd 1 |
_WinMapSize rd 1 |
scr_width rd 1 |
scr_height rd 1 |
/kernel/trunk/hid/mousedrv.inc |
---|
111,8 → 111,8 |
mov ecx, [Screen_Max_X] |
inc ecx |
mul ecx |
add eax, [_WinMapAddress] |
movzx edx, byte [ebx+eax] |
movzx edx, byte [display_data+ebx+eax] |
shl edx, 8 |
mov esi, [edx+SLOT_BASE+APPDATA.cursor] |
119,6 → 119,9 |
cmp esi, [current_cursor] |
je .draw |
; cmp [esi+CURSOR.magic], 'CURS' |
; jne .fail |
push esi |
call [select_hw_cursor] |
mov [current_cursor], esi |
289,7 → 292,7 |
inc ecx |
imul ecx,ebx |
add ecx,eax |
add ecx, [_WinMapAddress] |
add ecx, display_data |
mov eax, [CURRENT_TASK] |
movzx ebx, byte [ecx] |
cmp eax,ebx |
/kernel/trunk/video/vesa12.inc |
---|
242,7 → 242,7 |
vesa12_drawbackground: |
call [_display.disable_mouse] |
call [disable_mouse] |
push eax |
push ebx |
327,8 → 327,7 |
mov eax,[Screen_Max_X] |
add eax,1 |
mul ebx |
add eax, [_WinMapAddress] |
cmp [eax+esi],byte 1 |
cmp [eax+esi+WinMapAddress],byte 1 |
jnz v12nbgp |
mov eax,[BytesPerScanLine] |
mov ebx,edi |
387,7 → 386,7 |
vesa12_drawbar: |
call [_display.disable_mouse] |
call [disable_mouse] |
;; mov [novesachecksum],dword 0 |
sub edx,ebx |
495,7 → 494,7 |
sub eax,VGABasePtr |
mov ebx,3 |
div ebx |
add eax, [_WinMapAddress] |
add eax,WinMapAddress |
mov ebx,[CURRENT_TASK] |
cld |
586,7 → 585,7 |
mov eax,edi |
sub eax,VGABasePtr |
shr eax,2 |
add eax, [_WinMapAddress] |
add eax,WinMapAddress |
mov ebx,[CURRENT_TASK] |
cld |
754,7 → 753,7 |
; mov ecx,320*65536+240 |
; mov edx,20*65536+20 |
call [_display.disable_mouse] |
call [disable_mouse] |
mov [novesachecksum],dword 0 |
push esi |
831,7 → 830,7 |
sub edx,VGABasePtr |
mov ebx,3 |
div ebx |
add edx, [_WinMapAddress] |
add edx,WinMapAddress |
mov ebx,[CURRENT_TASK] |
mov bh,[esp+4*3] |
910,7 → 909,7 |
mov edx,edi |
sub edx,VGABasePtr |
shr edx,2 |
add edx, [_WinMapAddress] |
add edx,WinMapAddress |
mov ebx,[CURRENT_TASK] |
mov bh,[esp+4*3] |
/kernel/trunk/video/vesa20.inc |
---|
28,6 → 28,7 |
;BytesPerScanLine equ 0xfe08 |
;LFBAddress equ 0xfe80 |
;ScreenBPP equ 0xfbf1 |
;WinMapAddress equ 0x460000 |
53,7 → 54,8 |
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] |
add edi, [LFBAddress] ; ebx = where pixel is in memory |
mov ecx, [edi] |
and ecx, 0xffffff |
ret |
60,7 → 62,8 |
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] |
add edi, [LFBAddress] ; ebx = where pixel is in memory |
mov ecx, [edi] |
and ecx, 0xffffff |
ret |
103,7 → 106,7 |
vesa20_putimage: |
pushad |
call [_display.disable_mouse] |
call [disable_mouse] |
sub esp, putimg.stack_data |
; save pointer to image |
mov [putimg.pti], ebx |
191,12 → 194,13 |
shr ebx, 3 |
imul eax, ebx |
add edx, eax |
add edx, [LFBAddress] |
; 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] |
add eax, WinMapAddress |
xchg eax, ebp |
; get process number |
mov ebx, [CURRENT_TASK] |
216,9 → 220,9 |
cmp [ebp], bl |
jne .skip |
; mov eax, [esi] ; eax = RRBBGGRR |
mov [LFB_BASE+edx], ax |
mov [edx], ax |
shr eax, 16 |
mov [LFB_BASE+edx+2], al |
mov [edx+2], al |
.skip: |
; add esi, 3 ;[putimg.source_bpp] |
add edx, 3 |
261,7 → 265,7 |
cmp [ebp], bl |
jne .skip |
; mov eax, [esi] ; ecx = RRBBGGRR |
mov [LFB_BASE+edx], eax |
mov [edx], eax |
.skip: |
; add esi, [putimg.source_bpp] |
add edx, 4 |
304,25 → 308,20 |
;;; mov [novesachecksum], dword 0 |
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 |
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 |
.forced: |
.ok: |
; check if negation |
test ecx,0x01000000 |
jz .noneg |
343,9 → 342,11 |
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 |
add edi, [LFBAddress] |
add edi, ebx ; ebx = where to put pixel in memory |
mov [edi], ax |
shr eax, 16 |
mov [LFB_BASE+ebx+edi+2], al |
mov [edi+2], al |
ret |
356,7 → 357,8 |
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 |
add edi, [LFBAddress] ; ebx = where to put pixel in memory |
mov [edi], eax |
ret |
;************************************************* |
376,7 → 378,7 |
align 4 |
__sys_draw_line: |
; inc [mouse_pause] |
call [_display.disable_mouse] |
call [disable_mouse] |
; draw a line |
; eax = HIWORD = x1 |
566,7 → 568,7 |
; edi color |
vesa20_drawbar: |
pushad |
call [_display.disable_mouse] |
call [disable_mouse] |
sub esp, drbar.stack_data |
mov [drbar.color], edi |
sub edx, ebx |
641,12 → 643,13 |
; shr ebx, 3 |
imul eax, ebx |
add edx, eax |
add edx, [LFBAddress] |
; 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] |
add eax, WinMapAddress |
xchg eax, ebp |
; get process number |
mov ebx, [CURRENT_TASK] |
671,9 → 674,8 |
.new_x: |
cmp byte [ebp], bl |
jne .skip |
mov [LFB_BASE+edx], bh |
mov [LFB_BASE+edx + 1], ax |
mov [edx], bh |
mov [edx + 1], ax |
.skip: |
; add pixel |
add edx, 3 |
708,8 → 710,7 |
.new_x: |
cmp byte [ebp], bl |
jne .skip |
mov [LFB_BASE+edx], eax |
mov [edx], eax |
.skip: |
; add pixel |
add edx, 4 |
736,9 → 737,62 |
mov [EGA_counter],1 |
ret |
align 4 |
;voodoodbcplimit: |
; 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: |
call [_display.disable_mouse] |
call [disable_mouse] |
pushad |
; External loop for all y from start to end |
mov ebx, [draw_data+32+RECT.top] ; y start |
756,11 → 810,10 |
jz @f |
add ebp, eax |
@@: |
add ebp, LFB_BASE |
add ebp, [LFBAddress] |
; 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 |
789,7 → 842,7 |
; esi -> bgr memory, edi -> output |
; ebp = offset in WinMapAddress |
dp3: |
cmp [ebp], dl |
cmp [ebp+WinMapAddress], dl |
jnz nbgp |
movsb |
movsb |
828,7 → 881,7 |
vesa20_drawbackground_stretch: |
call [_display.disable_mouse] |
call [disable_mouse] |
pushad |
; Helper variables |
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1) |
864,6 → 917,7 |
jz @f |
add ebp, eax |
@@: |
add ebp, [LFBAddress] |
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
call calculate_edi |
xchg edi, ebp |
931,8 → 985,7 |
; 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 |
cmp [ebp+WinMapAddress], byte 1 |
jnz snbgp |
mov eax, [bgr_cur_line+esi] |
test ecx, ecx |
940,11 → 993,9 |
mov ebx, [bgr_next_line+esi] |
call [overlapping_of_points_ptr] |
.novert: |
mov [LFB_BASE+edi], ax |
mov [edi], ax |
shr eax, 16 |
mov [LFB_BASE+edi+2], al |
mov [edi+2], al |
snbgp: |
cmp [ScreenBPP], byte 25 |
sbb edi, -4 |
/kernel/trunk/gui/window.inc |
---|
184,7 → 184,7 |
inc edi |
imul edi, ebx |
add edi, eax |
add edi, [_WinMapAddress] |
add edi, WinMapAddress |
.new_y: |
push ecx ; sx |
245,7 → 245,7 |
inc eax |
imul eax, ebx |
add eax, [esp] |
add eax, [_WinMapAddress] |
add eax, WinMapAddress |
mov ebp, eax |
mov edi, [edi+APPDATA.wnd_shape] |
/kernel/trunk/gui/button.inc |
---|
372,7 → 372,7 |
push edx |
push edi |
call [_display.disable_mouse] |
call [disable_mouse] |
bdbnewline: |
mov edi,1 ; force |
389,6 → 389,7 |
bneg: |
;;;call [disable_mouse] |
call [putpixel] |
nbneg: |
/kernel/trunk/gui/font.inc |
---|
33,7 → 33,7 |
.1: |
; } \\ Alver \\ |
pushad |
call [_display.disable_mouse] |
call [disable_mouse] |
movsx eax, bx ; eax=y |
sar ebx, 16 ; ebx=x |