1. Optimization of the mode 320*200*256. Load on CPU is less. Small increase of speed.

2. Optimization of the mode 640*480*16. Substantial growth of speed.
3. At the expense of deleting the superfluous code from vga.inc the size of a kernel has decreased.

git-svn-id: svn://kolibrios.org@117 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2006-08-10 18:18:33 +00:00
parent bf63dda480
commit 5638fe22ff
5 changed files with 540 additions and 1013 deletions

View File

@ -10,7 +10,7 @@
system_shutdown: ; shut down the system
push 3 ; stop playing cd
push 3 ; stop playing cd
pop eax
call sys_cd_audio
cld
@ -48,22 +48,22 @@ system_shutdown: ; shut down the system
mov eax,[0xfe00]
shr eax,1
lea esi,[eax+220] ; x end
sub eax,220 ; x start
lea esi,[eax+220] ; x end
sub eax,220 ; x start
mov ebx,[0xfe04]
shr ebx,1
mov [shutdownpos],ebx
lea ebp,[ebx+105] ; y end
sub ebx,120 ; y start
lea ebp,[ebx+105] ; y end
sub ebx,120 ; y start
xor edi,edi
inc edi ; force putpixel & dtext
inc edi ; force putpixel & dtext
mov ecx,0x0000ff
; vertical loop begin
sdnewpix1:
push eax ; save x start
push eax ; save x start
; horizontal loop begin
sdnewpix2:
@ -75,10 +75,10 @@ system_shutdown: ; shut down the system
jnz sdnewpix2
; horizontal loop end
dec ecx ; color
pop eax ; restore x start
dec ecx ; color
pop eax ; restore x start
inc ebx ; advance y pos
inc ebx ; advance y pos
cmp ebx,ebp
jnz sdnewpix1
; vertical loop end
@ -121,12 +121,12 @@ system_shutdown: ; shut down the system
push edx
push 12
pop esi
push edi ; may be destroyed
push edi ; may be destroyed
call fileread
pop edi
pop ecx
inc ecx ; do not display stars from rose.txt
inc ecx ; do not display stars from rose.txt
pop eax
add eax,20*10000h - 110
@ -142,7 +142,7 @@ system_shutdown: ; shut down the system
cmp cx,word 0x0001+25*31
jnz nrl
call checkEgaCga
call checkVga_N13
yes_shutdown_param:
cli
@ -185,12 +185,12 @@ pr_mode_exit:
org $-0x10000
; setup stack
mov ax, 3000h
mov ss, ax
mov esp, 0EC00h
mov ax, 3000h
mov ss, ax
mov esp, 0EC00h
; setup ds
push cs
pop ds
push cs
pop ds
lidt [old_ints_h-0x10000]
;remap IRQs
@ -259,21 +259,21 @@ org $-0x10000
nbw32:
dec ax ; 1 = write floppy
dec ax ; 1 = write floppy
js nbw
jnz no_floppy_write
call floppy_write
jmp temp_3456 ;nbw
no_floppy_write:
dec ax ; 2 = power off
dec ax ; 2 = power off
jnz no_apm_off
call APM_PowerOff
jmp $
no_apm_off:
dec ax ; 3 = reboot
jnz restart_kernel ; 4 = restart kernel
dec ax ; 3 = reboot
jnz restart_kernel ; 4 = restart kernel
push 0x40
pop ds
mov word[0x0072],0x1234
@ -332,20 +332,20 @@ restart_kernel_4000:
; add di,0x1000
; cmp di,0x2000
; jbe new_kernel_block_move
push ds
pop es
mov cx, 0x8000
push cx
mov ds, cx
xor si, si
xor di, di
rep movsw
push 0x9000
pop ds
push 0x2000
pop es
pop cx
rep movsw
push ds
pop es
mov cx, 0x8000
push cx
mov ds, cx
xor si, si
xor di, di
rep movsw
push 0x9000
pop ds
push 0x2000
pop es
pop cx
rep movsw
wbinvd ; write and invalidate cache
@ -355,27 +355,27 @@ restart_kernel_4000:
; mov ss,ax
; mov sp,0xec00
; restore timer
mov al, 00110100b
out 43h, al
jcxz $+2
mov al, 0xFF
out 40h, al
jcxz $+2
out 40h, al
jcxz $+2
mov al, 00110100b
out 43h, al
jcxz $+2
mov al, 0xFF
out 40h, al
jcxz $+2
out 40h, al
jcxz $+2
sti
; bootloader interface
push 0x1000
pop ds
mov si, .bootloader_block;-0x10000
mov ax, 'KL'
push 0x1000
pop ds
mov si, .bootloader_block;-0x10000
mov ax, 'KL'
jmp 0x1000:0000
.bootloader_block:
db 1 ; version
dw 1 ; floppy image is in memory
dd 0 ; cannot save parameters
db 1 ; version
dw 1 ; floppy image is in memory
dd 0 ; cannot save parameters
APM_PowerOff:
mov ax, 5304h
@ -428,46 +428,46 @@ floppy_write: ; write diskette image to physical floppy
je fwwritedone
mov [flm-0x10000],byte 1
xor ax, ax ; reset drive
xor dx, dx
xor ax, ax ; reset drive
xor dx, dx
int 0x13
mov cx,0x0001 ; startcyl,startsector
; mov dx,0x0000 ; starthead,drive
xor dx, dx
mov ax, 80*2 ; read no of sect
xor dx, dx
mov ax, 80*2 ; read no of sect
fwwrites:
push ax
push ax
; move 1mb+ -> 0:a000
pusha
pusha
mov si,fwmovedesc -0x10000
mov cx,256*18
mov ah,0x87
push ds
pop es
push ds
pop es
int 0x15
add dword [fwmovedesc-0x10000+0x12], 512*18
add dword [fwmovedesc-0x10000+0x12], 512*18
popa
xor si,si
mov es,si
mov es,si
fwnewwrite:
mov bx,0xa000 ; es:bx -> data area
mov ax,0x0300+18 ; read, no of sectors to read
int 0x13
test ah, ah
test ah, ah
jz fwgoodwrite
inc si
inc si
cmp si,10
jnz fwnewwrite
; can't access diskette - return
pop ax
pop ax
ret
fwgoodwrite:

View File

@ -90,19 +90,19 @@ calculatescreen:
cmp edx, [esp+RECT.top]
jb .out_of_bounds
cmp eax, [esp+RECT.left]
cmp eax, [esp+RECT.left]
jae @f
mov eax, [esp+RECT.left]
@@:
cmp ebx, [esp+RECT.top]
cmp ebx, [esp+RECT.top]
jae @f
mov ebx, [esp+RECT.top]
@@:
cmp ecx, [esp+RECT.right]
cmp ecx, [esp+RECT.right]
jbe @f
mov ecx, [esp+RECT.right]
@@:
cmp edx, [esp+RECT.bottom]
cmp edx, [esp+RECT.bottom]
jbe @f
mov edx, [esp+RECT.bottom]
@@:
@ -119,7 +119,7 @@ calculatescreen:
jnz .new_wnd
.finish:
pop eax ebx ecx edx
pop eax ebx ecx edx
popfd
popad
@ -431,13 +431,13 @@ display_settings:
@@: cmp ebx,[0xFE04]
jg .lp2
mov [screen_workarea.bottom],ebx
.lp2: call repos_windows
.lp2: call repos_windows
mov eax, 0
mov ebx, 0
mov ecx, [0xfe00]
mov edx, [0xfe04]
call calculatescreen
; jmp redraw_screen_direct
call calculatescreen
; jmp redraw_screen_direct
.exit:
popad
ret
@ -465,11 +465,11 @@ display_settings:
mov ecx,skin_data+64*512
sub ecx,[edi+0x10]
mov dword[ebx+12],ecx ; destination
push eax
push eax
pushad
call file_system
popad
pop eax
pop eax
popd [ebx+12] [ebx+8] [ebx+4] [ebx+0]
cmp eax,ERROR_SUCCESS
je @f
@ -483,13 +483,13 @@ display_settings:
mov ecx,(64*512)/4
rep movsd
call parse_skin_data
pushad
pushad
mov eax, 0
mov ebx, 0
mov ecx, [0xfe00]
mov edx, [0xfe04]
call calculatescreen
popad
popad
mov dword[esp+32+36],0
jmp redraw_screen_direct
.exit:
@ -505,12 +505,12 @@ display_settings:
repos_windows:
mov ecx,[0x3004]
mov esi,0x20*2
mov byte[0x0000fff0],1
mov byte[0x0000fff0],1
dec ecx
jge @f
jge @f
ret
@@: mov [esi+WDATA.fl_redraw],1
test [esi+WDATA.fl_wstate],WSTATE_MAXIMIZED
@@: mov [esi+WDATA.fl_redraw],1
test [esi+WDATA.fl_wstate],WSTATE_MAXIMIZED
jz .lp2
mov eax,[screen_workarea.left]
mov [esi+WDATA.box.left],eax
@ -529,31 +529,31 @@ repos_windows:
ret
.lp2: mov eax,[esi+WDATA.box.left]
add eax,[esi+WDATA.box.width]
mov ebx,[0x0000fe00]
; inc ebx
cmp eax,ebx
jle .lp4
mov ebx,[0x0000fe00]
; inc ebx
cmp eax,ebx
jle .lp4
mov eax,[esi+WDATA.box.width]
sub eax,ebx
jle .lp3
sub eax,ebx
jle .lp3
mov [esi+WDATA.box.width],ebx
.lp3: sub ebx,[esi+WDATA.box.width]
mov [esi+WDATA.box.left],ebx
.lp4: mov eax,[esi+WDATA.box.top]
add eax,[esi+WDATA.box.height]
mov ebx,[0x0000fe04]
; inc ebx
cmp eax,ebx
jle .lp6
mov ebx,[0x0000fe04]
; inc ebx
cmp eax,ebx
jle .lp6
mov eax,[esi+WDATA.box.height]
sub eax,ebx
jle .lp5
sub eax,ebx
jle .lp5
mov [esi+WDATA.box.height],ebx
.lp5: sub ebx,[esi+WDATA.box.height]
mov [esi+WDATA.box.top],ebx
.lp6: add esi,0x20
loop @b
ret
ret
uglobal
common_colours:
@ -824,12 +824,12 @@ drawwindow_III:
mov edi,edx ; RECTANGLE
mov eax,[edi+WDATA.box.left]
shl eax,16
mov ax, word [edi+WDATA.box.left]
add ax, word [edi+WDATA.box.width]
mov ax, word [edi+WDATA.box.left]
add ax, word [edi+WDATA.box.width]
mov ebx,[edi+WDATA.box.top]
shl ebx,16
mov bx, word [edi+WDATA.box.top]
add bx, word [edi+WDATA.box.height]
mov bx, word [edi+WDATA.box.top]
add bx, word [edi+WDATA.box.height]
mov esi,[edi+WDATA.cl_frames]
shr esi,1
and esi,0x007f7f7f
@ -1035,10 +1035,10 @@ waredraw: ; if redraw necessary at activate
add esi, window_data
; coordinates of the upper window
mov eax, [esi + WDATA.box.left] ; cx
mov ebx, [esi + WDATA.box.top] ; cy
mov ecx, [esi + WDATA.box.width] ; sx
mov edx, [esi + WDATA.box.height] ; sy
mov eax, [esi + WDATA.box.left] ; cx
mov ebx, [esi + WDATA.box.top] ; cy
mov ecx, [esi + WDATA.box.width] ; sx
mov edx, [esi + WDATA.box.height] ; sy
add ecx, eax ; ecx = x_end
add edx, ebx ; edx = y_end
@ -1048,8 +1048,8 @@ waredraw: ; if redraw necessary at activate
call setscreen
popad
mov [edi + WDATA.fl_redraw], 1 ; redraw flag for app
mov [0xfb44],byte 0 ; mouse down checks
mov [edi + WDATA.fl_redraw], 1 ; redraw flag for app
mov [0xfb44],byte 0 ; mouse down checks
ret
@ -1175,8 +1175,8 @@ checkwindows:
shl edi, 5
add edi, window_data
; mov edi, ebx
mov ecx, [edi + WDATA.box.left]
mov edx, [edi + WDATA.box.top]
mov ecx, [edi + WDATA.box.left]
mov edx, [edi + WDATA.box.top]
mov eax,ecx
mov ebx,edx
@ -1190,8 +1190,8 @@ checkwindows:
jae cwloop
cmp edx, ebx
jae cwloop
add ecx, [edi + WDATA.box.width]
add edx, [edi + WDATA.box.height]
add ecx, [edi + WDATA.box.width]
add edx, [edi + WDATA.box.height]
cmp eax, ecx
jae cwloop
cmp ebx, edx
@ -1218,7 +1218,7 @@ checkwindows:
popad
; Check for user enabled fixed window
mov edx, [edi + WDATA.cl_titlebar]
mov edx, [edi + WDATA.cl_titlebar]
and edx, 0x0f000000
cmp edx, 0x01000000
jne .window_move_enabled_for_user
@ -1226,17 +1226,17 @@ checkwindows:
ret
.window_move_enabled_for_user:
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
jnz .no_resize_2
mov [do_resize_from_corner],byte 0 ; resize for skinned window
mov edx, [edi + WDATA.cl_workarea]
mov edx, [edi + WDATA.cl_workarea]
and edx, 0x0f000000
cmp edx, 0x02000000
jb .no_resize_2 ; not type 2 wnd
mov edx, [edi + WDATA.box.top]
add edx, [edi + WDATA.box.height]
mov edx, [edi + WDATA.box.top]
add edx, [edi + WDATA.box.height]
sub edx, 6 ; edx = y_end - 6
cmp ebx, edx ; ebx = mouse_y
jb .no_resize_2
@ -1246,7 +1246,7 @@ checkwindows:
push eax
call get_titlebar_height
add eax,[edi + WDATA.box.top]
add eax,[edi + WDATA.box.top]
cmp ebx,eax
pop eax
jae .exit
@ -1267,15 +1267,15 @@ checkwindows:
mov cl, [0xfb40] ; save for shade check
mov [do_resize], cl
no_emulation_righ_button:
mov ecx, [edi + WDATA.box.left]
mov edx, [edi + WDATA.box.top]
mov ecx, [edi + WDATA.box.left]
mov edx, [edi + WDATA.box.top]
push eax ecx edx
mov [dlx], ecx ; save for drawlimits
mov [dly], edx
mov eax, [edi + WDATA.box.width]
mov eax, [edi + WDATA.box.width]
add ecx, eax
mov eax, [edi + WDATA.box.height]
mov eax, [edi + WDATA.box.height]
add edx, eax
mov [dlxe], ecx
mov [dlye], edx
@ -1290,21 +1290,21 @@ checkwindows:
pushad ; wait for putimages to finish
; mov eax,5
; call delay_hs
mov eax,[edi + WDATA.box.left]
mov eax,[edi + WDATA.box.left]
mov [npx],eax
mov eax,[edi + WDATA.box.top]
mov eax,[edi + WDATA.box.top]
mov [npy],eax
popad
push eax ; save old coordinates
mov ax, word [edi + WDATA.box.left]
mov ax, word [edi + WDATA.box.left]
mov word [oldc+BOX.left],ax
mov ax, word [edi + WDATA.box.top]
mov ax, word [edi + WDATA.box.top]
mov word [oldc+BOX.top],ax
mov ax, word [edi + WDATA.box.width]
mov ax, word [edi + WDATA.box.width]
mov word [oldc+BOX.width],ax
mov word [npxe],ax
mov ax, word [edi + WDATA.box.height]
mov ax, word [edi + WDATA.box.height]
mov word [oldc+BOX.height],ax
mov word [npye],ax
pop eax
@ -1325,7 +1325,7 @@ checkwindows:
call checkidle
call checkEgaCga
call checkVga_N13
mov [0xfff4],byte 0
@ -1391,12 +1391,12 @@ checkwindows:
;shr edx,5
;shl edx,8
;add edx,0x80000 ; process base at 0x80000+
lea edx, [0x80000 + edx*8]
lea edx, [0x80000 + edx*8]
movzx eax,word [0xfb0a]
cmp eax,[edi + WDATA.box.left]
cmp eax,[edi + WDATA.box.left]
jb nnepx
sub eax,[edi + WDATA.box.left]
sub eax,[edi + WDATA.box.left]
cmp eax,32 ; [edx+0x90+8]
jge nnepx2
mov eax,32 ; [edx+0x90+8]
@ -1407,9 +1407,9 @@ checkwindows:
call get_rolledup_height
mov ebx,eax
movzx eax,word [0xfb0c]
cmp eax,[edi + WDATA.box.top]
cmp eax,[edi + WDATA.box.top]
jb nnepy
sub eax,[edi + WDATA.box.top]
sub eax,[edi + WDATA.box.top]
cmp eax,ebx ; [edx+0x90+12]
jge nnepy2
mov eax,ebx ; [edx+0x90+12]
@ -1444,13 +1444,13 @@ checkwindows:
call drawwindowframes
mov eax,[npx]
mov [edi + WDATA.box.left],eax
mov [edi + WDATA.box.left],eax
mov eax,[npy]
mov [edi + WDATA.box.top],eax
mov [edi + WDATA.box.top],eax
mov eax,[npxe]
mov [edi + WDATA.box.width],eax
mov [edi + WDATA.box.width],eax
mov eax,[npye]
mov [edi + WDATA.box.height],eax
mov [edi + WDATA.box.height],eax
@@: mov [reposition],cl
@ -1493,7 +1493,7 @@ checkwindows:
jmp @f
wnd_rolldown:
and [edi+WDATA.fl_wstate],not WSTATE_ROLLEDUP
mov eax,[edx + APPDATA.saved_box.height] ; 0x90+BOX.height
mov eax,[edx + APPDATA.saved_box.height] ; 0x90+BOX.height
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
jz @f
mov eax,[screen_workarea.bottom]

View File

@ -208,7 +208,7 @@ boot_log:
call dtext
mov [novesachecksum],1000
call checkEgaCga
call checkVga_N13
cmp [preboot_blogesc],byte 1
je .bll2
@ -644,8 +644,8 @@ finit ;reset the registers, contents which are still equal RM
mov esi,boot_setostask
call boot_log
; name for OS/IDLE process
mov dword [0x80000+256+APPDATA.app_name], dword 'OS/I'
mov dword [0x80000+256+APPDATA.app_name+4], dword 'DLE '
mov dword [0x80000+256+APPDATA.app_name], dword 'OS/I'
mov dword [0x80000+256+APPDATA.app_name+4], dword 'DLE '
; task list
mov [0x3020+TASKDATA.wnd_number], 1 ; on screen number
mov [0x3020+TASKDATA.pid], 1 ; process id number
@ -835,7 +835,7 @@ osloop:
call checkwindows
; call check_window_move_request
call checkmisc
call checkEgaCga
call checkVga_N13
call stack_handler
call checkidle
call check_fdd_motor_status
@ -1042,134 +1042,6 @@ iglobal
process_number dd 0x1
endg
uglobal
novesachecksum dd 0x0
endg
checkEgaCga:
cmp [0xfe0c],dword 0x13
je cnvl
ret
cnvl:
pushad
; mov ecx,[0xfb0a]
; cmp ecx,[novesachecksum]
; jne novesal
; popad
; ret
novesal:
; mov [novesachecksum],ecx
mov ecx,0
movzx eax,word [0xfb0c]
cmp eax,100
jge m13l3
mov eax,100
m13l3:
cmp eax,480-100
jbe m13l4
mov eax,480-100
m13l4:
sub eax,100
imul eax,640*4
add ecx,eax
movzx eax,word [0xfb0a]
cmp eax,160
jge m13l1
mov eax,160
m13l1:
cmp eax,640-160
jbe m13l2
mov eax,640-160
m13l2:
sub eax,160
shl eax,2
add ecx,eax
mov esi,[0xfe80]
add esi,ecx
mov edi,0xa0000
mov edx,200
mov ecx,320
cld
m13pix:
lodsd
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
stosb
loop m13pix
mov ecx,320
add esi,4*(640-320)
dec edx
jnz m13pix
popad
ret
palette320x200:
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
pallbl1:
test ah,128
jz pallbl2
add al,42
pallbl2:
out dx,al
mov al,0
test ah,8
jz pallbl3
add al,8
pallbl3:
test ah,16
jz pallbl4
add al,15
pallbl4:
test ah,32
jz pallbl5
add al,40
pallbl5:
out dx,al
mov al,0
test ah,1
jz pallbl6
add al,8
pallbl6:
test ah,2
jz pallbl7
add al,15
pallbl7:
test ah,4
jz pallbl8
add al,40
pallbl8:
out dx,al
add ah,1
loop palnew
ret
set_variables:
mov ecx,0x100 ; flush port 0x60
@ -3448,12 +3320,12 @@ checkmisc:
jz nobackgr
mov [0xfff0],byte 2
call change_task
mov [draw_data+32 + RECT.left],dword 0
mov [draw_data+32 + RECT.top],dword 0
mov [draw_data+32 + RECT.left],dword 0
mov [draw_data+32 + RECT.top],dword 0
mov eax,[0xfe00]
mov ebx,[0xfe04]
mov [draw_data+32 + RECT.right],eax
mov [draw_data+32 + RECT.bottom],ebx
mov [draw_data+32 + RECT.right],eax
mov [draw_data+32 + RECT.bottom],ebx
call drawbackground
mov [0xfff0],byte 0
mov [0xfff4],byte 0
@ -3565,7 +3437,7 @@ redrawscreen:
mov edx, [edi + WDATA.box.height]
add ecx, eax
add edx, ebx
mov eax,[dly] ; eax = area y start edx = window y end
cmp edx,eax
jb ricino
@ -4104,20 +3976,8 @@ reserve_free_irq:
drawbackground:
inc [mouse_pause]
cmp [0xfe0c],word 0x12
jne dbrv12
cmp [display_data-12],dword 1
jne bgrstr12
call vga_drawbackground_tiled
dec [mouse_pause]
call [draw_pointer]
ret
bgrstr12:
call vga_drawbackground_stretch
dec [mouse_pause]
call [draw_pointer]
ret
je dbrv20
dbrv12:
cmp [0xfe0c],word 0100000000000000b
jge dbrv20
cmp [0xfe0c],word 0x13
@ -4164,9 +4024,9 @@ sys_putimage:
add dx,word[edi+0x80000+APPDATA.wnd_clientbox.left]
rol edx,16
.forced:
mov eax, vga_putimage
; mov eax, vga_putimage
cmp [0xfe0c], word 0x12
jz .doit
jz @f ;.doit
mov eax, vesa12_putimage
cmp [0xfe0c], word 0100000000000000b
jae @f
@ -4196,11 +4056,7 @@ __sys_drawbar:
.forced:
inc [mouse_pause]
cmp [0xfe0c],word 0x12
jne sdbv20
call vga_drawbar
dec [mouse_pause]
call [draw_pointer]
ret
je dbv20
sdbv20:
cmp [0xfe0c],word 0100000000000000b
jge dbv20
@ -4893,7 +4749,7 @@ syscall_writetext: ; WriteText
shl ebp,16
add ebp,[edi-twdw+WDATA.box.top]
add bp,word[esi+0x80000+APPDATA.wnd_clientbox.top]
add ecx,[edi+TASKDATA.mem_start]
add ecx,[edi+TASKDATA.mem_start]
add eax,ebp
xor edi,edi
jmp dtext

View File

@ -278,6 +278,8 @@ put_image_end_32:
.finish:
add esp, putimg.stack_data
popad
call VGA__putimage
mov [EGA_counter],1
ret
@ -773,8 +775,9 @@ draw_bar_end_32:
add esp, drbar.stack_data
popad
call VGA_draw_bar
xor eax, eax
mov [EGA_counter],1
ret
@ -976,7 +979,8 @@ vesa20_drawbackground_tiled:
pop ebx
pop eax
pop ebp
mov [EGA_counter],1
call VGA_drawbackground
ret
; ----------
@ -1103,5 +1107,6 @@ vesa20_drawbackground_stretch:
pop ebx
pop eax
pop ebp
mov [EGA_counter],1
call VGA_drawbackground
ret

File diff suppressed because it is too large Load Diff