From 5638fe22ffca5d4826c788d254498771628d1001 Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Thu, 10 Aug 2006 18:18:33 +0000 Subject: [PATCH] 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 --- kernel/trunk/boot/shutdown.inc | 128 ++-- kernel/trunk/gui/window.inc | 140 ++-- kernel/trunk/kernel.asm | 172 +---- kernel/trunk/video/vesa20.inc | 11 +- kernel/trunk/video/vga.inc | 1102 +++++++++++--------------------- 5 files changed, 540 insertions(+), 1013 deletions(-) diff --git a/kernel/trunk/boot/shutdown.inc b/kernel/trunk/boot/shutdown.inc index a300002627..03cab4b630 100644 --- a/kernel/trunk/boot/shutdown.inc +++ b/kernel/trunk/boot/shutdown.inc @@ -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: diff --git a/kernel/trunk/gui/window.inc b/kernel/trunk/gui/window.inc index ce2e3fd947..5975808674 100644 --- a/kernel/trunk/gui/window.inc +++ b/kernel/trunk/gui/window.inc @@ -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] diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index cd5b45aa9f..9cd9f3f4c1 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -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 diff --git a/kernel/trunk/video/vesa20.inc b/kernel/trunk/video/vesa20.inc index 3dfaca5b2a..87734024d3 100644 --- a/kernel/trunk/video/vesa20.inc +++ b/kernel/trunk/video/vesa20.inc @@ -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 diff --git a/kernel/trunk/video/vga.inc b/kernel/trunk/video/vga.inc index 32fa50093d..e01d4dbf51 100644 --- a/kernel/trunk/video/vga.inc +++ b/kernel/trunk/video/vga.inc @@ -52,735 +52,401 @@ paletteVGA: out dx,al ; green 0,31 or 63 add ah,1 loop palvganew +; mov dx, 3ceh +; mov ax, 0005h +; out dx, ax + 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 +uglobal + novesachecksum dd 0x0 + EGA_counter db 0 + VGA_drawing_screen db 0 + VGA_8_pixels: + rb 16 + temp: + .cx dd 0 +endg -vga_putimage: -; pushad - call [disable_mouse] - push ebp ; - push esi ; - push edi ; +checkVga_N13: - push eax ; - push ebx ; +8 [ptrImage] - push ecx ; +4 [BH] - push edx ; +0 [xy] + cmp [0xfe0c],dword 0x13 + jne @f - movzx eax,word [esp+2] ; eax:=x - movzx ebx,word [esp+0] ; ebx:=y - mov ecx,[0x3010] ; - add eax,[ecx-twdw+WDATA.box.left] ; eax+=Xwin - add ebx,[ecx-twdw+WDATA.box.top] ; ebx+=Ywin - mov ecx,ebx ; ecx = y+Ywin - mov edx,eax ; edx = x+Xwin +; cnvl: + pushad + cmp [EGA_counter],1 + je novesal + mov ecx,[0xfb0a] + cmp ecx,[novesachecksum] + jne novesal + popad + @@: + ret - imul ebx, 640*4 ; (y+Ywin)*BytesPerScanLine - shl eax,2 ; (x+Xwin)*BytesPerPixel - add eax,ebx ; - mov edi,eax ; store copy - add eax,[0xfe80] ; +AddrLFB - ;entry point in LFB >> EAX:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+AddrLFB + 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 + cmp eax,0 + jne @f + xor eax,eax + jmp .save_pixel + @@: + push eax + mov ebx,eax + and eax,(128+64+32) ; blue + shr eax,5 + and ebx,(128+64+32)*256 ; green + shr ebx,8+2 + add eax,ebx + pop ebx + and ebx,(128+64)*256*256 ; red + shr ebx,8+8 + add eax,ebx + .save_pixel: + stosb + loop m13pix + mov ecx,320 + add esi,4*(640-320) + dec edx + jnz m13pix + mov [EGA_counter],0 + popad + ret - shr edi,5 ; change from 4 to 1/8 BytesPerPixel - add edi,0xa0000 ; + VGABasePtr - ;VGA start address >> EDI:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+AddrVGA + novesal_1: + pushad + mov esi,[0xfe80] + mov edi,0xa0000 + mov ebx,640/32 ; 640*480/(8*4) + mov edx,480 + @@: + push ebx edx esi edi + shl edx,9 + lea edx,[edx+edx*4] + add esi,edx + shr edx,5 + add edi,edx + call VGA_draw_long_line + pop edi esi edx ebx + dec edx + jnz @r + call VGA_draw_long_line_1 + popad + ret - mov ebx, [0xfe00] ; ScreenXSize - inc ebx ; +1 - imul ebx,ecx ; *(y+Ywin) - mov ebp, ebx ; - add ebp, edx ; +(x+Xwin) - add ebp, WinMapAddress ; ebp:=(y+Ywin)*(ScreenXSize+1)+(x+Xwin)+AddrBuffer - - mov esi,[esp+8] ; esi:=AddrImg - movzx ecx,word [esp+6] ; ecx:=B - movzx ebx,word [esp+4] ; ebx:=H - - ; check limits while draw ? - - push ecx ; B - push eax ; LFB address - - mov eax,[0x3010] - mov ecx,[eax+draw_data-0x3000+RECT.left] - cmp ecx,0 - jnz dbcblimitlset_vga - - mov ecx,[eax+draw_data-0x3000+RECT.top] - cmp ecx,0 - jnz dbcblimitlset_vga - - mov ecx,[eax+draw_data-0x3000+RECT.right] - cmp ecx,[0xfe00] ; ecx <> Screen X size - jnz dbcblimitlset_vga - - mov ecx,[eax+draw_data-0x3000+RECT.bottom] - cmp ecx,[0xfe04] ; ecx <> Screen Y size - jnz dbcblimitlset_vga - - pop eax ; LFB address - pop ecx ; B - - push dword 0 - - jmp pimvga - - dbcblimitlset_vga: - - pop eax ; LFB address - pop ecx ; B - - push dword 1 - -pimvga: - push edi - push esi - push eax ; LFB address - push ecx ; B - push ebx ; H - push edx ; x+Xwin - - mov ebx,[0x3000] - mov bh,[esp+6*4] - - cld - - npvga: - - cmp bl,[ds:ebp] - jnz impvgano - -; cmp bh,0 -; jz impvgayes - -; call voodoodbcplimit -; jnz impvgano - -; impvgayes: - - push eax ; LFB address - push ebx ; app no. - push ecx ; B - push edx ; x+Xwin - - mov edx,[esi] ; color - mov [eax],dx - shr edx,16 - mov [eax+2],dl - - mov eax,[esi] ; color - mov ecx,[esp] ; x+Xwin - and ecx,0x07 ; modulo 8 - call setvgapixel ; eax=color, ecx=x%8, edi=VGA address - - pop edx - pop ecx - pop ebx - pop eax - - impvgano: - - add esi,3 ; esi+=3 ptrImage+=3 - add eax,4 ; eax+=4 LFBaddr +=4 - inc ebp - inc edx ; x+Xwin+n - - test edx,0x07 ; test modulo 8 - jnz impvgacont - inc edi - - impvgacont: - dec ecx ; B-- - jnz npvga - - pop edx - pop ebx - pop ecx - pop eax - pop esi - pop edi - - add edi,640/8 ; add one VGA line - add eax,640*4 ; add one LFB line - - sub ebp, ecx ; -B - add ebp, [0xfe00] ; - inc ebp ; ptrBuffer:=ptrBuffer-B+Screen_Xsize+1 - - push ecx - lea ecx,[ecx+ecx*2] ; - add esi,ecx ; ptrImage:=ptrImage+B*3 - pop ecx - - dec ebx ; H-- - jnz pimvga - - add esp,4 ; jump saved limit byte - pop edx - pop ecx - pop ebx - pop eax - pop edi - pop esi - pop ebp - -; call [draw_pointer] -; call [disable_mouse] -; popad - ret +VGA_draw_long_line: + mov dx,3ceh + mov ax,0ff08h + cli + out dx, ax + mov ax,0005h + out dx, ax + m12pix: + call VGA_draw_32_pixels + dec ebx + jnz m12pix + mov dx,3c4h + mov ax,0ff02h + out dx,ax + mov dx,3ceh + mov ax,0205h + out dx,ax + mov dx,3ceh + mov al,08h + out dx,al + sti + ret +VGA_draw_32_pixels: + xor eax,eax + mov ebp,VGA_8_pixels + mov [ebp],eax + mov [ebp+4],eax + mov [ebp+8],eax + mov [ebp+12],eax + mov ch,4 + .main_loop: + mov cl,8 + .convert_pixels_to_VGA: + lodsd ; eax = 24bit colour + cmp eax,0 + je .end + rol eax,8 + mov al,ch + ror eax,8 + mov ch,1 + dec cl + shl ch,cl + cmp al,85 + jb .p13green + or [ebp],ch + cmp al,170 + jb .p13green + or [ebp+12],ch + .p13green: + cmp ah,85 + jb .p13red + or [ebp+4],ch + cmp ah,170 + jb .p13red + or [ebp+12],ch + .p13red: + shr eax,8 + cmp ah,85 + jb .p13cont + or [ebp+8],ch + cmp ah,170 + jb .p13cont + or [ebp+12],ch + .p13cont: + ror eax,8 + mov ch,ah + inc cl + .end: + dec cl + jnz .convert_pixels_to_VGA + inc ebp + dec ch + jnz .main_loop + push esi + sub ebp,4 + mov esi,ebp + mov dx, 3c4h + mov ah, 1h + @@: + mov al, 02h + out dx,ax + xchg ax,bp + lodsd + mov [edi],eax + xchg ax,bp + shl ah, 1 + cmp ah, 10h + jnz @r + add edi,4 + pop esi + ret VGA_putpixel: - ; eax = x ; ebx = y - - mov ecx,eax - mov eax, [esp+32-8+4] ; color - - imul ebx, 640*4 ; y*BytesPerLine (Vesa2.0 32) - lea edx, [ebx+ecx*4] ; + x*BytesPerPixel (Vesa2.0 32) - - mov edi,edx - add edi, [0xfe80] ; + LFB address - mov [edi], eax ; write to LFB for Vesa2.0 - - shr edx,5 ; change BytesPerPixel to 1/8 - mov edi,edx - add edi, 0x0a0000 ; address of pixel in VGA area - - and ecx,0x07 ; bit no. (modulo 8) - -setvgapixel: - pushfd - cli - ; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8) - - push eax - mov ebx,eax ; color - - ;mov al,0x08 - ;mov dx,0x03ce - ;out dx,al ; select GDC bit mask register - - inc cl - mov ax, 0x100 - shr ax,cl - mov dx,0x03cf - out dx,al ; set bit mask for pixel - - mov dl,0 - mov eax,ebx - and eax,0x000000ff ; blue - cmp eax,85 - jle p13green - or dl,0x01 - cmp eax,170 - jle p13green - or dl,0x08 - -p13green: - and ebx,0x0000ff00 ; green - cmp ebx,85*256 - jle p13red - or dl,0x02 - cmp ebx,170*256 - jle p13red - or dl,0x08 - -p13red: - pop ebx - and ebx,0x00ff0000 ; red - cmp ebx,85*256*256 - jle p13cont - or dl,0x04 - cmp ebx,170*256*256 - jle p13cont - or dl,0x08 - -p13cont: - mov al,[edi] ; dummy read - mov [edi],dl - - popfd - ret - - -vga_drawbar: -; pushad - call [disable_mouse] - sub edx,ebx ; edx:=Yend-Ystart=H - sub ecx,eax ; ecx:=Xend-Xstat=B - - push ebp ; +24 - push esi ; +20 - push edi ; +16 - push eax ; +12 - push ebx ; +8 - push ecx ; +4 - push edx ; +0 - - mov ecx,[0x3010] ; - add eax,[ecx-twdw+WDATA.box.left] ; eax:=Xwin+x - add ebx,[ecx-twdw+WDATA.box.top] ; ebx:=Ywin+y - mov ecx, eax ; ecx:=(x+Xwin) - mov edx, ebx ; edx:=(y+Ywin) - - imul ebx, 640/8 ; - mov edi, ebx ; edi:=BytesPerScanLine*(y+Ywin) - shr eax, 3 ; - add edi, eax ; + (x+Xwin)*BytesPerPixel - add edi,0xa0000 ; + VGAbaseaddress - - mov eax, [0xfe00] ; ScreenXSize - inc eax ; +1 - imul eax,edx ; *(y+Ywin) - mov ebp, eax ; - add ebp, ecx ; +(x+Win) - add ebp, WinMapAddress ; +AddrBuffer - - mov eax, [0xfe08] ; BytesPerScanLine - LFB - mul edx ; *(y+Ywin) - mov esi,eax - add esi,ecx - add esi,ecx - add esi,ecx - add esi,ecx ; + 4*(x+Xwin) - add esi,[0xfe80] ; +AddrLFB - -; edi:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel + AddrVGA -; esi:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel + AddrLFB -; ebp:=(y+Ywin)*(ScreenXSize+1)+(x+Xwin)+AddrBuffer - -; x size - - mov eax,[esp+4] ; B [esp+4] - mov ebx,[esp+0] ; H - - mov edx,[esp+16] ; color - test edx,0x80000000 - jz nodbglvga - - ; no color glide for VGA - set to half glide - shr ebx,1 ; H/2 - sub edx,ebx - mov [esp+16],edx - mov ebx,[esp+0] ; reset to H - - nodbglvga: - ; check limits ? - - push eax - push ecx - - mov eax,[0x3010] - - mov ecx,[eax+draw_data-0x3000+RECT.left] - cmp ecx,0 - jnz dbcblimitlset_vga2 - - mov ecx,[eax+draw_data-0x3000+RECT.top] - cmp ecx,0 - jnz dbcblimitlset_vga2 - - mov ecx,[eax+draw_data-0x3000+RECT.right] - cmp ecx,[0xfe00] - jnz dbcblimitlset_vga2 - - mov ecx,[eax+draw_data-0x3000+RECT.bottom] - cmp ecx,[0xfe04] - jnz dbcblimitlset_vga2 - - pop ecx - pop eax - - push dword 0 - - jmp dbnewpivga - - dbcblimitlset_vga2: - - pop ecx ; x+Xwin - pop eax ; B - - push dword 1 - - dbnewpivga: - - push eax; B - push ebx ; H - push edi - push esi - push ecx ; x+Xwin - - mov ebx,[0x3000] - - cld - - dbnpvga: - - mov dl,[ds:ebp] - - cmp dl,bl - jnz dbimpvgano - -; mov edx,[esp+5*4] ; check limit? -; cmp edx,0 -; jz dbimpvgayes - -; call voodoodbcplimit -; jnz dbimpvgano - -; dbimpvgayes: - - push eax ; B - push ebx - push ecx ; x+Xwin - - mov eax,[esp+12+20+16+4] ; color - mov ebx,eax - - mov [esi],bx ; write LFB pixel - shr ebx,16 - mov [esi+2],bl - - and ecx,0x07 ; modulo 8 - call setvgapixel ; eax=color, ecx=x%8, edi=VGA address - - pop ecx - pop ebx - pop eax - - dbimpvgano: - - add esi,4 ; ptrLFB+=4 - inc ebp ; address buffer - inc ecx ; x posn++ - test ecx,0x07 ; test modulo 8 - jnz dbvgacont - inc edi ; VGA screen ptr++ - - dbvgacont: - dec eax ; B-- NB ecx in Vesa20 fn? - jnz dbnpvga - - dbnpvgad: - - pop ecx - pop esi - pop edi - pop ebx - pop eax - - add esi,[0xfe08] ; ptrLFB+=BytesPerScanLine - add edi,640/8 ; ptrScreen+=BytesPerScanLine - - add ebp,[0xfe00] ; - sub ebp, eax ; was ecx in vesa20 fn? - inc ebp ; ptrBuffer:=ptrBuffer-B+BytesPerLine+1 - - dec ebx ; H-- - jz nodbnewpivga ; H<>0 - - jmp dbnewpivga - - nodbnewpivga: - - add esp,7*4 ; NB includes limit check flag - ;pop ebx - ;pop eax - ;pop edi - ;pop esi - pop ebp - - ;pop edx - ;pop ecx -; popad - ret - - -vga_drawbackground_tiled: - call [disable_mouse] - push ebp - push eax - push ebx - push ecx - push edx - - mov edx,dword [0x400000-8] ; B - add edx,dword [WinMapAddress-8] ; +B - add edx,dword [WinMapAddress-8] ; +B - push edx - - mov eax,[draw_data+32+RECT.left] ; x start:=(x+Xwin) - mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin) - mov ecx,eax - mov edx,ebx - - imul edx, 640*4 ; (y+Ywin)*BytesPerScanLine - shl ecx,2 ; (x+Xwin)*BytesPerPixel - add ecx,edx ; - mov ebp,ecx ; store copy - add ecx,[0xfe80] ; +AddrLFB - ;entry point in LFB >> ECX:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+Addr - - shr ebp,5 ; change from 4 to 1/8 BytesPerPixel - add ebp,0xa0000 ; + VGABasePtr - ;VGA start address >> EBP:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+AddrV - - - call calculate_edi - - dp3vga: ; MAIN LOOP - - cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1) - je ybgpvga - - jmp nbgpvga - - ybgpvga: - - push eax ; x - push ebx ; y - push ecx ; LFB address - - mov ecx,dword [WinMapAddress-8] ; B - xor edx,edx ; edx:=0 - div ecx ; Xstart/B - - ; eax=Int(qn) edx:=Rem - - lea esi,[edx+edx*2] ; esi:=edx*3 - - mov ecx,dword [WinMapAddress-4] ; ecx:=H - mov eax,[esp+4] ; eax:=Ystart - xor edx,edx ; - div ecx ; Ystart/H - - mov eax,edx ; eax:=Rem - xor edx,edx ; - mov ebx,[esp+12] ; ebx:=B*3 - mul ebx ; - add esi,eax ; - - mov eax,[esi+0x300000] ; color - and eax,0xffffff - - mov ecx, [esp] ; LFB address - mov ebx,eax ; copy color - mov [ecx],bx - shr ebx,16 - mov [ecx+2],bl - - xchg edi, ebp - mov ecx,[esp+8] ; x position - and ecx,0x07 ; x modulo 8 - call setvgapixel ; eax=color, ecx=x%8, edi=VGA address - xchg ebp, edi - - pop ecx - pop ebx - pop eax - - nbgpvga: - - inc eax ; x++ - cmp eax,[draw_data+32+RECT.right] ; X > xend? - jg nodp3vga - - test eax,0x07 ; x test modulo 8 - jnz hook1vga - inc ebp ; VGA address++ - - hook1vga: - add ecx,4 ; LFB address += 4 - inc edi ; ptrBuffer++ - add esi,3 ; ptrImage+=3 - jmp dp3vga - - nodp3vga: - - mov eax,[draw_data+32+RECT.left] ; x+Xwin - inc ebx ; y position - mov ecx,eax - mov edx,ebx - - imul edx, 640*4 ; (y+Ywin)*BytesPerScanLine - shl ecx,2 ; (x+Xwin)*BytesPerPixel - add ecx,edx ; - mov ebp,ecx ; store copy - add ecx,[0xfe80] ; +AddrLFB - ;entry point in LFB >> ECX:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+Addr - - - shr ebp,5 ; change from 4 to 1/8 BytesPerPixel - add ebp,0xa0000 ; + VGABasePtr - ;VGA start address >> EBP:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+AddrV - - - call calculate_edi - - cmp ebx,[draw_data+32+RECT.bottom] ; Y > yend - jg dp4vga - - jmp dp3vga - - dp4vga: - - add esp,4 - - pop edx - pop ecx - pop ebx - pop eax - pop ebp - - ret - -; ---------- - - - -vga_drawbackground_stretch: - call [disable_mouse] - - push ebp - push eax - push ebx - push ecx - push edx - - mov edx,dword [WinMapAddress-8] ; B - add edx,dword [WinMapAddress-8] ; +B - add edx,dword [WinMapAddress-8] ; +B - push edx - - mov eax,[draw_data+32+RECT.left] ; x start:=(x+Xwin) - mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin) - mov ecx,eax - mov edx,ebx - - imul edx, 640*4 ; (y+Ywin)*BytesPerScanLine - shl ecx,2 ; (x+Xwin)*BytesPerPixel - add ecx,edx ; - mov ebp,ecx ; store copy - add ecx,[0xfe80] ; +AddrLFB - ;entry point in LFB >> ECX:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+Addr - - shr ebp,5 ; change from 4 to 1/8 BytesPerPixel - add ebp,0xa0000 ; + VGABasePtr - ;VGA start address >> EBP:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+AddrV - - - call calculate_edi - - sdp3vga: ; MAIN LOOP - - cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1) - je sybgpvga - - jmp snbgpvga - - sybgpvga: - - push eax ; x - push ebx ; y - push ecx ; LFB address - - mov eax,dword [WinMapAddress-8] ; B - xor edx,edx - mov ebx,[esp+8] ; Xstart - mul ebx ; B*Xstart - xor edx,edx - mov ebx,[0xfe00] ; x screen width - div ebx ; B*Xstart/xwidth - lea esi,[eax+eax*2] ; *3 - mov eax,dword [WinMapAddress-4] ; H - xor edx,edx - mov ebx,[esp+4] ; Ystart - mul ebx ; H*Ystart - xor edx,edx - mov ebx,[0xfe04] ; y screen height - div ebx ; H*Ystart/yheight - - xor edx,edx - mov ebx,[esp+12] ; B*3 - mul ebx ; - add esi,eax - mov eax,[esi+0x300000] ; color - and eax,0xffffff - - mov ecx, [esp] ; LFB address - mov ebx,eax ; copy color - mov [ecx],bx - shr ebx,16 - mov [ecx+2],bl - - xchg edi, ebp - mov ecx,[esp+8] ; x position - and ecx,0x07 ; x modulo 8 - call setvgapixel ; eax=color, ecx=x%8, edi=VGA address - xchg ebp, edi ; ebp+=3 - - pop ecx - pop ebx - pop eax - - snbgpvga: - - inc eax ; x++ - cmp eax,[draw_data+32+RECT.right] ; X > xend? - jg snodp3vga - - test eax,0x07 ; x test modulo 8 - jnz shook1vga - inc ebp ; VGA address++ - - shook1vga: - add ecx,4 ; LFB address += 4 - inc edi ; ptrBuffer++ - add esi,3 ; ptrImage+=3 - jmp sdp3vga - - snodp3vga: - - mov eax,[draw_data+32+RECT.left] ; x+Xwin - inc ebx ; y position - mov ecx,eax - mov edx,ebx - - imul edx, 640*4 ; (y+Ywin)*BytesPerScanLine - shl ecx,2 ; (x+Xwin)*BytesPerPixel - add ecx,edx ; - mov ebp,ecx ; store copy - add ecx,[0xfe80] ; +AddrLFB - ;entry point in LFB >> ECX:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+Addr - - - shr ebp,5 ; change from 4 to 1/8 BytesPerPixel - add ebp,0xa0000 ; + VGABasePtr - ;VGA start address >> EBP:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+A - - - call calculate_edi - - cmp ebx,[draw_data+32+RECT.bottom] ; Y > yend - jg sdp4vga - - jmp sdp3vga - - sdp4vga: - - add esp,4 - - pop edx - pop ecx - pop ebx - pop eax - pop ebp - - ret - - + mov ecx,eax + mov eax, [esp+32-8+4] ; color + shl ebx,9 + lea ebx,[ebx+ebx*4] ; умножение на 5 + lea edx, [ebx+ecx*4] ; + x*BytesPerPixel (Vesa2.0 32) + mov edi,edx + add edi, [0xfe80] ; + LFB address + mov [edi], eax ; write to LFB for Vesa2.0 + shr edx,5 ; change BytesPerPixel to 1/8 + mov edi,edx + add edi, 0x0a0000 ; address of pixel in VGA area + and ecx,0x07 ; bit no. (modulo 8) + pushfd + ; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8) + xor edx,edx + cmp eax,0 + je .p13cont + cmp al,85 + jb .p13green + or dl,0x01 + cmp al,170 + jb .p13green + or dl,0x08 +.p13green: + cmp ah,85 + jb .p13red + or dl,0x02 + cmp ah,170 + jb .p13red + or dl,0x08 +.p13red: + shr eax,8 + cmp ah,85 + jb .p13cont + or dl,0x04 + cmp ah,170 + jb .p13cont + or dl,0x08 +.p13cont: + ror edx,8 + inc cl + xor eax,eax + inc ah + shr ax,cl + mov dx,3cfh + cli + out dx,al + mov al,[edi] ; dummy read + rol edx,8 + mov [edi],dl + popfd +;.end: + ret + +VGA__putimage: +; ecx = size [x|y] +; edx = coordinates [x|y] + cmp [0xfe0c],dword 0x12 + jne @f + pushad + ; calculate absolute (i.e. screen) coordinates + rol edx,16 + movzx eax,dx + rol edx,16 + movzx ebx,dx + movzx edx,cx + rol ecx,16 + movzx ecx,cx + call VGA_draw_bar_1 + popad +@@: + ret + +VGA_draw_bar: +; eax cx +; ebx cy +; ecx xe +; edx ye + cmp [0xfe0c],dword 0x12 + jne @f + pushad + sub ecx,eax + sub edx,ebx + and eax,0xffff + and ebx,0xffff + and ecx,0xffff + and edx,0xffff + call VGA_draw_bar_1 + popad +@@: + ret + +VGA_draw_bar_1: + mov [temp.cx],eax + mov eax, [0x3010] + add ebx, [eax-twdw + 4] + mov eax, [eax-twdw + 0] + add eax, [temp.cx] + and eax,0xfff8 + shl ebx,9 + lea ebx,[ebx+ebx*4] ; умножение на 5 + lea ebx, [ebx+eax*4] ; + x*BytesPerPixel (Vesa2.0 32) + mov esi,ebx + add esi, [0xfe80] ; + LFB address + shr ebx,5 ; change BytesPerPixel to 1/8 + mov edi,ebx + add edi, 0x0a0000 ; address of pixel in VGA area + mov ebx,ecx + shr ebx,5 + inc ebx +.main_loop: + call VGA_draw_long_line_1 + dec edx + jnz .main_loop + call VGA_draw_long_line_1 + ret + +VGA_draw_long_line_1: + push ebx edx esi edi + shl edx,9 + lea edx,[edx+edx*4] + add esi,edx + shr edx,5 + add edi,edx + call VGA_draw_long_line + pop edi esi edx ebx + ret + +VGA_drawbackground: +; draw all + cmp [0xfe0c],dword 0x12 + jne @f + call novesal_1 +@@: + ret