remove fixed memory variables

git-svn-id: svn://kolibrios.org@996 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2009-01-17 16:04:50 +00:00
parent a371bf6d5a
commit f7e7dc15e2
23 changed files with 524 additions and 697 deletions

View File

@ -14,7 +14,7 @@ $Revision$
; Автор части исходного текста Кулаков Владимир Геннадьевич ; Автор части исходного текста Кулаков Владимир Геннадьевич
; Адаптация, доработка и разработка Mario79 ; Адаптация, доработка и разработка Mario79
; Максимальное количество повторений операции чтения ; Максимальное количество повторений операции чтени
MaxRetr equ 10 MaxRetr equ 10
; Предельное время ожидания готовности к приему команды ; Предельное время ожидания готовности к приему команды
; (в тиках) ; (в тиках)
@ -38,7 +38,7 @@ ReadCD:
mov [CDBlockSize],2048 ;2352 mov [CDBlockSize],2048 ;2352
; Очистить буфер пакетной команды ; Очистить буфер пакетной команды
call clear_packet_buffer call clear_packet_buffer
; Сформировать пакетную команду для считывания ; Сформировать пакетную команду для считывани
; сектора данных ; сектора данных
; Задать код команды Read CD ; Задать код команды Read CD
mov [PacketCommand],byte 0x28 ;0xBE mov [PacketCommand],byte 0x28 ;0xBE
@ -168,7 +168,6 @@ MaxCDWaitTime equ 1000 ;200 ;10
; Область памяти для формирования пакетной команды ; Область памяти для формирования пакетной команды
PacketCommand: rb 12 ;DB 12 DUP (?) PacketCommand: rb 12 ;DB 12 DUP (?)
; Область памяти для приема данных от дисковода ; Область памяти для приема данных от дисковода
;CDDataBuf DB 4096 DUP (0)
; Размер принимаемого блока данных в байтах ; Размер принимаемого блока данных в байтах
CDBlockSize DW ? CDBlockSize DW ?
; Адрес считываемого сектора данных ; Адрес считываемого сектора данных
@ -177,7 +176,7 @@ CDSectorAddress: DD ?
TickCounter_1 DD 0 TickCounter_1 DD 0
; Время начала ожидания готовности устройства ; Время начала ожидания готовности устройства
WURStartTime DD 0 WURStartTime DD 0
; указатель буфера для считывания ; указатель буфера для считывани
CDDataBuf_pointer dd 0 CDDataBuf_pointer dd 0
;**************************************************** ;****************************************************
@ -342,7 +341,7 @@ SendPacketNoDatCommand:
add DX,7 ;порт 1х7h add DX,7 ;порт 1х7h
@@WaitDevice0_1: @@WaitDevice0_1:
call change_task call change_task
; Проверить время ожидания ; Проверить время ожидани
mov EAX,[timer_ticks] mov EAX,[timer_ticks]
sub EAX,[TickCounter_1] sub EAX,[TickCounter_1]
cmp EAX,BSYWaitTime cmp EAX,BSYWaitTime
@ -464,12 +463,12 @@ SendCommandToHDD_1:
jmp .test jmp .test
@@: @@:
call change_task call change_task
; Проверить время ожидания ; Проверить время ожидани
mov eax,[timer_ticks] mov eax,[timer_ticks]
sub eax,[TickCounter_1] sub eax,[TickCounter_1]
cmp eax,BSYWaitTime ;300 ;ожидать 3 сек. cmp eax,BSYWaitTime ;300 ;ожидать 3 сек.
ja @@Err1_4 ;ошибка тайм-аута ja @@Err1_4 ;ошибка тайм-аута
; Прочитать регистр состояния ; Прочитать регистр состояни
.test: .test:
in AL,DX in AL,DX
; Проверить состояние сигнала BSY ; Проверить состояние сигнала BSY
@ -645,7 +644,7 @@ LoadMedium:
; Сформировать команду START/STOP UNIT ; Сформировать команду START/STOP UNIT
; Задать код команды ; Задать код команды
mov [PacketCommand],word 1Bh mov [PacketCommand],word 1Bh
; Задать операцию загрузки носителя ; Задать операцию загрузки носител
mov [PacketCommand+4],word 00000011b mov [PacketCommand+4],word 00000011b
; Подать команду ; Подать команду
call SendPacketNoDatCommand call SendPacketNoDatCommand
@ -666,7 +665,7 @@ EjectMedium:
; Сформировать команду START/STOP UNIT ; Сформировать команду START/STOP UNIT
; Задать код команды ; Задать код команды
mov [PacketCommand],word 1Bh mov [PacketCommand],word 1Bh
; Задать операцию извлечения носителя ; Задать операцию извлечения носител
mov [PacketCommand+4],word 00000010b mov [PacketCommand+4],word 00000010b
; Подать команду ; Подать команду
call SendPacketNoDatCommand call SendPacketNoDatCommand

View File

@ -478,10 +478,10 @@ wait_for_sector_dma_ide1:
ret ret
iglobal iglobal
align 4 align 8
; note that IDE descriptor table must be 4-byte aligned and do not cross 4K boundary ; note that IDE descriptor table must be 4-byte aligned and do not cross 4K boundary
IDE_descriptor_table: IDE_descriptor_table:
dd IDE_DMA dd IDE_DMA+(0x100000000-OS_BASE)
dw 0x2000 dw 0x2000
dw 0x8000 dw 0x8000
@ -579,7 +579,7 @@ hd_read_dma:
mov eax, [esp+4] mov eax, [esp+4]
sub eax, [dma_cur_sector] sub eax, [dma_cur_sector]
shl eax, 9 shl eax, 9
add eax, (OS_BASE+IDE_DMA) add eax, IDE_DMA
push ecx esi edi push ecx esi edi
mov esi, eax mov esi, eax
shl edi, 9 shl edi, 9
@ -598,7 +598,7 @@ hd_read_dma:
ret ret
.notread: .notread:
mov eax, IDE_descriptor_table mov eax, IDE_descriptor_table
mov dword [eax], IDE_DMA mov dword [eax], IDE_DMA+(0x100000000-OS_BASE)
mov word [eax+4], 0x2000 mov word [eax+4], 0x2000
sub eax, OS_BASE sub eax, OS_BASE
mov dx, [IDEContrRegsBaseAddr] mov dx, [IDEContrRegsBaseAddr]
@ -694,8 +694,8 @@ write_cache_chain:
shl esi, 9 shl esi, 9
call calculate_cache_2 call calculate_cache_2
add esi,eax add esi,eax
mov edi, (OS_BASE+IDE_DMA) mov edi, IDE_DMA
mov dword [edx], IDE_DMA mov dword [edx], IDE_DMA+(0x100000000-OS_BASE)
movzx ecx, [cache_chain_size] movzx ecx, [cache_chain_size]
shl ecx, 9 shl ecx, 9
mov word [edx+4], cx mov word [edx+4], cx

View File

@ -208,68 +208,35 @@ LOAD_BASE equ 0x00100000
OS_BASE equ 0xE0000000 OS_BASE equ 0xE0000000
IMAGE_BASE equ (OS_BASE+LOAD_BASE) IMAGE_BASE equ (OS_BASE+LOAD_BASE)
window_data equ OS_BASE BOOT_VAR equ OS_BASE
CURRENT_TASK equ (OS_BASE+0x0003000) SB16Buffer equ (OS_BASE+0x10000)
TASK_COUNT equ (OS_BASE+0x0003004)
TASK_BASE equ (OS_BASE+0x0003010)
TASK_DATA equ (OS_BASE+0x0003020)
TASK_EVENT equ (OS_BASE+0x0003020)
mouseunder equ (OS_BASE+0x0006900) TASK_COUNT equ (CURRENT_TASK+0x04)
CDDataBuf equ (OS_BASE+0x0007000) TASK_BASE equ (CURRENT_TASK+0x10)
FLOPPY_BUFF equ (OS_BASE+0x0008000) TASK_DATA equ (CURRENT_TASK+0x20)
ACTIVE_PROC_STACK equ (OS_BASE+0x000A400) ;unused TASK_EVENT equ (CURRENT_TASK+0x20)
WIN_STACK equ (OS_BASE+0x000C000)
WIN_POS equ (OS_BASE+0x000C400)
FDD_BUFF equ (OS_BASE+0x000D000) FDD_BUFF equ (OS_BASE+0x000D000)
DRIVE_DATA equ (OS_BASE+0x0070000)
SLOT_BASE equ (OS_BASE+0x0080000)
VGABasePtr equ (OS_BASE+0x00A0000) VGABasePtr equ (OS_BASE+0x00A0000)
RAMDISK_FAT equ (OS_BASE+0x0180000) IRQ_SAVE equ (OS_BASE+0x0190000)
FLOPPY_FAT equ (OS_BASE+0x0182000)
IDE_DMA equ 0x184000 stack_data_start equ (OS_BASE+0x01A0000)
eth_data_start equ (OS_BASE+0x01A0000)
stack_data equ (OS_BASE+0x01A4000)
stack_data_end equ (OS_BASE+0x01Bffff)
resendQ equ (OS_BASE+0x01C0000)
BgrAuxTable equ (OS_BASE+0x0198000) virtual at (OS_BASE+0x01C8F80)
; unused?
SB16Buffer equ (OS_BASE+0x01A0000)
SB16_Status equ (OS_BASE+0x01B0000)
BUTTON_INFO equ (OS_BASE+0x01C0000)
RESERVED_PORTS equ (OS_BASE+0x01D0000)
IRQ_SAVE equ (OS_BASE+0x01E0000)
BOOT_VAR equ (OS_BASE+0x01f0000)
stack_data_start equ (OS_BASE+0x0200000)
eth_data_start equ (OS_BASE+0x0200000)
stack_data equ (OS_BASE+0x0204000)
stack_data_end equ (OS_BASE+0x021ffff)
resendQ equ (OS_BASE+0x0220000)
VMODE_BASE equ (OS_BASE+0x0228000)
skin_data equ (OS_BASE+0x0230000)
draw_data equ (OS_BASE+0x0238000);
BgrDrawMode equ (OS_BASE+0x023BFF4)
BgrDataWidth equ (OS_BASE+0x023BFF8)
BgrDataHeight equ (OS_BASE+0x023BFFC)
virtual at (OS_BASE+0x023CF80)
tss TSS tss TSS
end virtual end virtual
LAST_PAGE equ 0x0240000 LAST_PAGE equ 0x01CB000
;sys_pgmap equ (OS_BASE+LAST_PAGE) twdw equ (CURRENT_TASK-window_data)
twdw equ 0x3000 ;(CURRENT_TASK-window_data)
std_application_base_address equ new_app_base
RING0_STACK_SIZE equ (0x2000 - 512) ;512 áàéò äëÿ êîíòåêñòà FPU RING0_STACK_SIZE equ (0x2000 - 512) ;512 áàéò äëÿ êîíòåêñòà FPU
REG_SS equ (RING0_STACK_SIZE-4) REG_SS equ (RING0_STACK_SIZE-4)
@ -303,6 +270,8 @@ PG_NOCACHE equ 0x018
PG_LARGE equ 0x080 PG_LARGE equ 0x080
PG_GLOBAL equ 0x100 PG_GLOBAL equ 0x100
PG_SHARED equ 0x200
;;;;;;;;;;;boot time variables ;;;;;;;;;;;boot time variables
;BOOT_BPP equ 0x9000 ;byte bits per pixel ;BOOT_BPP equ 0x9000 ;byte bits per pixel
@ -487,14 +456,6 @@ struc PG_DATA
.pg_mutex dd ? .pg_mutex dd ?
} }
;struc LIB
;{ .lib_name rb 16
; .lib_base dd ?
; .lib_start dd ?
; .export dd ?
; .import dd ?
;}
struc SRV struc SRV
{ .srv_name rb 16 ;ASCIIZ string { .srv_name rb 16 ;ASCIIZ string
.magic dd ? ;+0x10 ;'SRV ' .magic dd ? ;+0x10 ;'SRV '

View File

@ -454,10 +454,10 @@ void sys_app_entry(addr_t raw, thr_stack_t *thr_stack, exec_stack_t *ex_stack)
thr_stack->ecx = 0; thr_stack->ecx = 0;
thr_stack->eax = 0; thr_stack->eax = 0;
thr_stack->eip = entry; thr_stack->eip = entry;
thr_stack->cs = 0x1b; thr_stack->cs = sel_app_code;
thr_stack->eflags = EFL_IOPL3 | EFL_IF; thr_stack->eflags = EFL_IOPL3 | EFL_IF;
thr_stack->pe_sp = 0x7FFFF000 + ((u32_t)ex_stack & 0xFFF); thr_stack->pe_sp = 0x7FFFF000 + ((u32_t)ex_stack & 0xFFF);
thr_stack->pe_ss = 0x23; thr_stack->pe_ss = sel_app_data;
}; };
@ -585,12 +585,11 @@ bool link_pe(addr_t img_base)
DBG("import from %s\n",libname); DBG("import from %s\n",libname);
exp_dll = find_dll(&current_slot->dll_list, libname); exp_dll = find_dll(&core_dll.link, libname);
if(exp_dll != NULL) if(exp_dll == NULL)
{ {
DBG("find %s\n", exp_dll->img_name); exp_dll = find_dll(&current_slot->dll_list, libname);
} if(exp_dll == NULL)
else
{ {
int len = strlen(libname)+1; int len = strlen(libname)+1;
@ -604,6 +603,8 @@ bool link_pe(addr_t img_base)
return false; return false;
}; };
} }
};
DBG("find %s\n", exp_dll->img_name);
exp = exp_dll->img_exp; exp = exp_dll->img_exp;

View File

@ -218,26 +218,9 @@ core_init:
; SAVE & CLEAR 0-0xffff ; SAVE & CLEAR 0-0xffff
cld
xor esi, esi
mov edi,BOOT_VAR
mov ecx,0x10000 / 4
rep movsd
xor edi, edi
xor eax, eax
mov ecx,0x10000 / 4
rep stosd
mov edi, 0x40000
mov ecx, (0x90000-0x40000)/4
rep stosd
mov dword [_sys_pdbr], eax mov dword [_sys_pdbr], eax
mov dword [_sys_pdbr+4], eax mov dword [_sys_pdbr+4], eax
xchg bx, bx
movzx eax,word [BOOT_VAR+0x9008] ; screen mode movzx eax,word [BOOT_VAR+0x9008] ; screen mode
mov [scr_mode],eax mov [scr_mode],eax
@ -256,8 +239,6 @@ if 0
mov [_current_thread], eax mov [_current_thread], eax
xchg bx, bx
mov ebx, [eax+THR.pdir] mov ebx, [eax+THR.pdir]
mov ecx, cr3 mov ecx, cr3
cmp ebx, ecx cmp ebx, ecx

View File

@ -592,26 +592,25 @@ term9:
pusha ; save window coordinates for window restoring pusha ; save window coordinates for window restoring
cld cld
shl esi,5 shl esi,5
add esi,window_data mov eax,[window_data+esi+WDATA.box.left]
mov eax,[esi+WDATA.box.left]
mov [dlx],eax mov [dlx],eax
add eax,[esi+WDATA.box.width] add eax,[window_data+esi+WDATA.box.width]
mov [dlxe],eax mov [dlxe],eax
mov eax,[esi+WDATA.box.top] mov eax,[window_data+esi+WDATA.box.top]
mov [dly],eax mov [dly],eax
add eax,[esi+WDATA.box.height] add eax,[window_data+esi+WDATA.box.height]
mov [dlye],eax mov [dlye],eax
xor eax, eax xor eax, eax
mov [esi+WDATA.box.left],eax mov [window_data+esi+WDATA.box.left],eax
mov [esi+WDATA.box.width],eax mov [window_data+esi+WDATA.box.width],eax
mov [esi+WDATA.box.top],eax mov [window_data+esi+WDATA.box.top],eax
mov [esi+WDATA.box.height],eax mov [window_data+esi+WDATA.box.height],eax
mov [esi+WDATA.cl_workarea],eax mov [window_data+esi+WDATA.cl_workarea],eax
mov [esi+WDATA.cl_titlebar],eax mov [window_data+esi+WDATA.cl_titlebar],eax
mov [esi+WDATA.cl_frames],eax mov [window_data+esi+WDATA.cl_frames],eax
mov dword [esi+WDATA.reserved],eax ; clear all flags: wstate, redraw, wdrawn mov dword [window_data+esi+WDATA.reserved],eax ; clear all flags: wstate, redraw, wdrawn
lea edi, [esi-window_data+draw_data] lea edi, [esi+draw_data]
mov ecx,32/4 mov ecx,32/4
rep stosd rep stosd
popa popa
@ -812,9 +811,6 @@ term9:
xor esi, esi xor esi, esi
call redrawscreen call redrawscreen
mov [mouse_background], 0 ; no mouse background
mov [dont_draw_mouse], 0 ; draw mouse
mov [application_table_status],0 mov [application_table_status],0
;mov esi,process_terminated ;mov esi,process_terminated
;call sys_msg_board_str ;call sys_msg_board_str

View File

@ -432,7 +432,7 @@ proc pe_app_param stdcall path:dword, raw:dword, ex_pg_dir:dword, ex_stack:dword
mov [ecx*8+SLOT_BASE+APPDATA.saved_esp], ebx mov [ecx*8+SLOT_BASE+APPDATA.saved_esp], ebx
mov [CURRENT_TASK+ecx+TASKDATA.state], 0 mov [CURRENT_TASK+ecx+TASKDATA.state], 0
DEBUGF 1,"%s",new_process_running ; DEBUGF 1,"%s",new_process_running
.err: .err:
mov eax,[process_number] ;set result mov eax,[process_number] ;set result
mov [application_table_status], 0 ;unlock application_table_status mutex mov [application_table_status], 0 ;unlock application_table_status mutex
@ -446,7 +446,6 @@ endp
align 4 align 4
_pe_restart: _pe_restart:
xchg bx, bx
add esp, 12 add esp, 12
popad popad
iretd iretd

View File

@ -94,9 +94,9 @@ v86_create:
pop eax pop eax
; first page - BIOS data (shared between all machines!) ; first page - BIOS data (shared between all machines!)
; physical address = 0x1f0000 ; physical address = 0x1f0000
; linear address = BOOT_VAR = OS_BASE + 0x1f0000 ; linear address = 0
mov dword [eax], (BOOT_VAR - OS_BASE) or 111b mov dword [eax], 111b
mov dword [eax+800h], BOOT_VAR mov dword [eax+800h], OS_BASE
; page before 0xA0000 - Extended BIOS Data Area (shared between all machines!) ; page before 0xA0000 - Extended BIOS Data Area (shared between all machines!)
; physical address = 0x9C000 ; physical address = 0x9C000
; linear address = 0x8009C000 ; linear address = 0x8009C000

View File

@ -282,14 +282,50 @@ section '.bss' data writeable align 4096
align 4096 align 4096
_sys_pdbr rd 1024 SLOT_BASE:
rb 64*1024
DRIVE_DATA:
rb 64*1024
RESERVED_PORTS:
rb 64*1024
FLOPPY_BUFF:
rb 16*1024
BUTTON_INFO:
rb 16*1024
BgrAuxTable:
rb 32*1024
skin_data:
rb 32*1024
IDE_DMA: rb 32*1024
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
window_data:
rb 8192
CURRENT_TASK:
_current_task:
rb 8192
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
draw_data:
rb 4096
CDDataBuf:
rb 4096
cur_saved_data rb 4096 cur_saved_data rb 4096
fpu_data: rb 512 _sys_pdbr rd 1024
idts rq 0x42
fpu_data:
rb 512
WIN_STACK:
rb 0x400
WIN_POS:
rb 0x800
idts rq 0x42
; device irq owners ; device irq owners
irq_owner rd 16 ; process id irq_owner rd 16 ; process id
@ -318,6 +354,9 @@ irq_tab rd 16
FONT_I rb 2304 ;16*144 FONT_I rb 2304 ;16*144
FONT_II rb 2560 ;16*160 FONT_II rb 2560 ;16*160
RAMDISK_FAT: rb 2856*2 +16 ;16*357
FLOPPY_FAT: rb 2856*2 +16
_z_core rd 52 _z_core rd 52
mem_block_map rb 512 mem_block_map rb 512
@ -357,9 +396,6 @@ sys_page_map rd 1
srv.fd rd 1 srv.fd rd 1
srv.bk rd 1 srv.bk rd 1
scr_width rd 1
scr_height rd 1
_HwCursorCreate: _HwCursorCreate:
create_cursor rd 1 create_cursor rd 1
@ -375,11 +411,15 @@ hw_restore rd 1
def_cursor rd 1 def_cursor rd 1
current_cursor rd 1 current_cursor rd 1
hw_cursor rd 1 hw_cursor rd 1
cur_def_interl rd 1
cur_saved_base rd 1 cur_saved_base rd 1
cur_saved_interl rd 1
cur_saved_w rd 1 cur.lock rd 1 ;1 - lock update, 2- hide
cur_saved_h rd 1 cur.left rd 1 ;cursor clip box
cur.top rd 1
cur.right rd 1
cur.bottom rd 1
cur.w rd 1
cur.h rd 1
ipc_tmp rd 1 ipc_tmp rd 1
ipc_pdir rd 1 ipc_pdir rd 1
@ -417,14 +457,18 @@ BytesPerScanLine rd 1
put_pixel rd 1 put_pixel rd 1
get_pixel rd 1 get_pixel rd 1
_screen_width rd 1
_screen_height rd 1
Screen_Max_X rd 1 Screen_Max_X rd 1
Screen_Max_Y rd 1 Screen_Max_Y rd 1
btn_addr rd 1 btn_addr rd 1
redraw_background rd 1 redraw_background rd 1
mouse_background rd 1 BgrDrawMode rd 1
dont_draw_mouse rd 1 BgrDataWidth rd 1
BgrDataHeight rd 1
MOUSE_VISIBLE rd 1 MOUSE_VISIBLE rd 1
WIN_TEMP_XY rd 1 WIN_TEMP_XY rd 1
@ -439,9 +483,6 @@ BTN_BUFF rd 1
KEY_COUNT rd 1 KEY_COUNT rd 1
KEY_BUFF rb 128 KEY_BUFF rb 128
mouse_color_mem rd 1
color_temp rd 1
btn_down rd 1 btn_down rd 1
x_under rd 1 x_under rd 1
y_under rd 1 y_under rd 1

View File

@ -6,10 +6,8 @@ use_cli_sti equ 1 ;driver become more stable (theoretically)
API_VERSION equ 0 ;debug API_VERSION equ 0 ;debug
OS_BASE equ 0xE0000000 OS_BASE equ 0xE0000000
new_app_base equ 0x0 ;PROC_BASE equ (OS_BASE+0x080000)
PROC_BASE equ (OS_BASE+0x080000) SB16Buffer equ (OS_BASE+0x10000)
SB16Buffer equ (OS_BASE+0x1A0000)
SB16_Status equ (OS_BASE+0x1B0000)
DMAPage equ ((SB16Buffer-OS_BASE) shr 16) DMAPage equ ((SB16Buffer-OS_BASE) shr 16)
SB16Buffer0 equ SB16Buffer SB16Buffer0 equ SB16Buffer

View File

@ -584,8 +584,6 @@ checkbuttons:
popad popad
call negativebutton call negativebutton
mov [mouse_background], 0 ; no mouse background
mov [dont_draw_mouse], 0 ; draw mouse
;..................................... start 5/5 : modified by vhanla ............................. ;..................................... start 5/5 : modified by vhanla .............................
; check coordinates ; check coordinates
iglobal iglobal

View File

@ -10,8 +10,6 @@ $Revision$
include "skindata.inc" include "skindata.inc"
;skin_data = 0x00778000
read_skin_file: read_skin_file:
stdcall load_file, ebx stdcall load_file, ebx
test eax, eax test eax, eax
@ -213,7 +211,7 @@ parse_skin_data:
ret ret
sys_putimage_with_check: sys_putimage_with_check:
or ebx,ebx test ebx,ebx
jz @f jz @f
call sys_putimage.forced call sys_putimage.forced
@@: ret @@: ret
@ -257,7 +255,7 @@ drawwindow_IV_caption:
mov edx,[ebp+SKIN_DATA.base.left] mov edx,[ebp+SKIN_DATA.base.left]
sub edx,[ebp+SKIN_DATA.base.width] sub edx,[ebp+SKIN_DATA.base.width]
shl edx,16 shl edx,16
.baseskinloop: .baseskinloop:
shr edx,16 shr edx,16
add edx,[ebp+SKIN_DATA.base.width] add edx,[ebp+SKIN_DATA.base.width]
shl edx,16 shl edx,16
@ -268,7 +266,7 @@ drawwindow_IV_caption:
dec eax dec eax
jnz .baseskinloop jnz .baseskinloop
.non_base: .non_base:
mov esi,[esp+4] mov esi,[esp+4]
mov edx,[esi+WDATA.box.width] mov edx,[esi+WDATA.box.width]
@ -317,7 +315,7 @@ drawwindow_IV:
or [edi+WDATA.fl_wdrawn], 4 or [edi+WDATA.fl_wdrawn], 4
call draw_rectangle call draw_rectangle
mov ecx,3 mov ecx,3
_dw3l: _dw3l:
add eax,1*65536-1 add eax,1*65536-1
add ebx,1*65536-1 add ebx,1*65536-1
test ax,ax test ax,ax
@ -353,7 +351,7 @@ drawwindow_IV:
mov al,[esp+32+4+4] mov al,[esp+32+4+4]
call drawwindow_IV_caption call drawwindow_IV_caption
draw_clientbar: draw_clientbar:
mov esi,[esp] mov esi,[esp]
@ -373,7 +371,7 @@ drawwindow_IV:
test edi,0x40000000 test edi,0x40000000
jnz _noinside2 jnz _noinside2
call [drawbar] call [drawbar]
_noinside2: _noinside2:
cmp dword[skin_data],'SKIN' cmp dword[skin_data],'SKIN'
jne no_skin_add_button jne no_skin_add_button
@ -402,7 +400,7 @@ drawwindow_IV:
mov ebx,[esp] mov ebx,[esp]
mov ebx,[ebx+WDATA.box.width] mov ebx,[ebx+WDATA.box.width]
inc ebx inc ebx
_bCx_at_right: _bCx_at_right:
add ebx,[skin_btn_close.left] add ebx,[skin_btn_close.left]
mov [eax],bx mov [eax],bx
add eax,2 ; x size add eax,2 ; x size
@ -441,7 +439,7 @@ drawwindow_IV:
mov ebx,[esp] mov ebx,[esp]
mov ebx,[ebx+WDATA.box.width] mov ebx,[ebx+WDATA.box.width]
inc ebx inc ebx
_bMx_at_right: _bMx_at_right:
add ebx,[skin_btn_minimize.left] add ebx,[skin_btn_minimize.left]
mov [eax],bx mov [eax],bx
add eax,2 ; x size add eax,2 ; x size
@ -456,7 +454,7 @@ drawwindow_IV:
dec ebx dec ebx
mov [eax],bx mov [eax],bx
no_skin_add_button: no_skin_add_button:
pop edi pop edi
and [edi+WDATA.fl_wdrawn], not 4 and [edi+WDATA.fl_wdrawn], not 4
test [edi+WDATA.fl_wdrawn], 2 test [edi+WDATA.fl_wdrawn], 2

View File

@ -54,6 +54,8 @@ skin_udata:
skin_btn_close SKIN_BUTTON skin_btn_close SKIN_BUTTON
skin_btn_minimize SKIN_BUTTON skin_btn_minimize SKIN_BUTTON
public _skin_active
_skin_active:
skin_active SKIN_DATA skin_active SKIN_DATA
skin_inactive SKIN_DATA skin_inactive SKIN_DATA

View File

@ -73,8 +73,8 @@ calculatescreen:
mov ebp, [TASK_COUNT] ; number of processes mov ebp, [TASK_COUNT] ; number of processes
cmp ebp, 1 cmp ebp, 1
jbe .finish jbe .finish
align 4 align 4
.new_wnd: .new_wnd:
movzx edi, word [WIN_POS + esi * 2] movzx edi, word [WIN_POS + esi * 2]
shl edi, 5 shl edi, 5
@ -103,37 +103,37 @@ calculatescreen:
cmp eax, [esp+RECT.left] cmp eax, [esp+RECT.left]
jae @f jae @f
mov eax, [esp+RECT.left] mov eax, [esp+RECT.left]
@@: @@:
cmp ebx, [esp+RECT.top] cmp ebx, [esp+RECT.top]
jae @f jae @f
mov ebx, [esp+RECT.top] mov ebx, [esp+RECT.top]
@@: @@:
cmp ecx, [esp+RECT.right] cmp ecx, [esp+RECT.right]
jbe @f jbe @f
mov ecx, [esp+RECT.right] mov ecx, [esp+RECT.right]
@@: @@:
cmp edx, [esp+RECT.bottom] cmp edx, [esp+RECT.bottom]
jbe @f jbe @f
mov edx, [esp+RECT.bottom] mov edx, [esp+RECT.bottom]
@@: @@:
push esi push esi
movzx esi, word [WIN_POS + esi * 2] movzx esi, word [WIN_POS + esi * 2]
call setscreen call setscreen
pop esi pop esi
.not_wnd: .not_wnd:
.out_of_bounds: .out_of_bounds:
inc esi inc esi
dec ebp dec ebp
jnz .new_wnd jnz .new_wnd
.finish: .finish:
pop eax ebx ecx edx pop eax ebx ecx edx
popfd popfd
popad popad
ret ret
@ -185,13 +185,13 @@ pushad
add edi, eax add edi, eax
add edi, [_display_data] add edi, [_display_data]
.new_y: .new_y:
push ecx ; sx push ecx ; sx
push edx push edx
mov edx, esi mov edx, esi
align 4 align 4
.new_x: .new_x:
mov byte [edi], dl mov byte [edi], dl
inc edi inc edi
dec ecx dec ecx
@ -498,7 +498,7 @@ display_settings:
repos_windows: repos_windows:
mov ecx,[TASK_COUNT] mov ecx,[TASK_COUNT]
mov edi, OS_BASE+0x20*2 mov edi, window_data+0x20*2
call force_redraw_background call force_redraw_background
dec ecx dec ecx
jge @f jge @f
@ -616,33 +616,6 @@ check_window_position:
ret ret
uglobal
new_window_starting dd 0
endg
sys_window_mouse:
push eax
mov eax,[timer_ticks]
cmp [new_window_starting],eax
jb swml1
mov [mouse_background], 0 ; no mouse background
mov [dont_draw_mouse], 0 ; draw mouse
mov [new_window_starting],eax
swml1:
pop eax
ret
drawwindow_I_caption: drawwindow_I_caption:
mov ecx,[edx+WDATA.cl_titlebar] ; grab bar mov ecx,[edx+WDATA.cl_titlebar] ; grab bar
@ -657,9 +630,9 @@ drawwindow_I_caption:
cmp ebx,eax cmp ebx,eax
jb .wdsizeok jb .wdsizeok
mov ebx,eax mov ebx,eax
.wdsizeok: .wdsizeok:
push ebx push ebx
.drwi: .drwi:
mov ebx,edx mov ebx,edx
shl ebx,16 shl ebx,16
add ebx,edx add ebx,edx
@ -680,10 +653,10 @@ drawwindow_I_caption:
mov [esi+WDATA.cl_titlebar],ecx mov [esi+WDATA.cl_titlebar],ecx
and ecx,0x00ffffff and ecx,0x00ffffff
jmp .faj jmp .faj
.nofa: .nofa:
mov ecx,[esi+WDATA.cl_titlebar] mov ecx,[esi+WDATA.cl_titlebar]
and ecx,0x00ffffff and ecx,0x00ffffff
.faj: .faj:
pop edx pop edx
mov edi,0 mov edi,0
call [draw_line] call [draw_line]
@ -735,7 +708,7 @@ drawwindow_I:
test edi,0x40000000 test edi,0x40000000
jnz noinside jnz noinside
call [drawbar] call [drawbar]
noinside: noinside:
popad popad
@ -799,9 +772,9 @@ drawwindow_III_caption:
cmp ebx,eax cmp ebx,eax
jb .wdsizeok jb .wdsizeok
mov ebx,eax mov ebx,eax
.wdsizeok: .wdsizeok:
push ebx push ebx
.drwi: .drwi:
mov ebx,edx mov ebx,edx
shl ebx,16 shl ebx,16
add ebx,edx add ebx,edx
@ -814,11 +787,11 @@ drawwindow_III_caption:
test ecx,0x40000000 test ecx,0x40000000
jz .nofa jz .nofa
add ecx,0x040404 add ecx,0x040404
.nofa: .nofa:
test ecx,0x80000000 test ecx,0x80000000
jz .nofa2 jz .nofa2
sub ecx,0x040404 sub ecx,0x040404
.nofa2: .nofa2:
mov [esi+WDATA.cl_titlebar],ecx mov [esi+WDATA.cl_titlebar],ecx
and ecx,0xffffff and ecx,0xffffff
xor edi, edi xor edi, edi
@ -858,7 +831,7 @@ drawwindow_III:
call drawwindowframes2 call drawwindowframes2
@@: @@:
mov ecx,3 mov ecx,3
dw3l: dw3l:
add eax,1*65536-1 add eax,1*65536-1
add ebx,1*65536-1 add ebx,1*65536-1
mov esi,[edi+WDATA.cl_frames] mov esi,[edi+WDATA.cl_frames]
@ -888,7 +861,7 @@ drawwindow_III:
test edi,0x40000000 test edi,0x40000000
jnz noinside2 jnz noinside2
call [drawbar] call [drawbar]
noinside2: noinside2:
popad popad
@ -989,7 +962,7 @@ checkwindowdraw:
push esi push esi
.new_check: .new_check:
pop esi pop esi
add esi, 2 add esi, 2
@ -1045,8 +1018,6 @@ checkwindowdraw:
ret ret
waredraw: ; if redraw necessary at activate waredraw: ; if redraw necessary at activate
pushad pushad
@ -1083,14 +1054,12 @@ waredraw: ; if redraw necessary at activate
ret ret
.do_not_draw: .do_not_draw:
popad popad
call windowactivate call windowactivate
mov [mouse_background], 0 ; no mouse background ret
mov [dont_draw_mouse], 0 ; draw mouse
ret
; eax = window number on screen ; eax = window number on screen
@ -1156,7 +1125,6 @@ restore_minimized_window:
add edx, [edi+WDATA.box.height] add edx, [edi+WDATA.box.height]
call calculatescreen call calculatescreen
.done: .done:
mov [mouse_background], 0 ; no mouse under
.skip_redrawings: .skip_redrawings:
popfd popfd
ret ret
@ -1167,6 +1135,8 @@ iglobal
window_moved db 'K : Window - done',13,10,0 window_moved db 'K : Window - done',13,10,0
endg endg
bPressedMouseXY_W db 0x0
; check window touch ; check window touch
align 4 align 4
checkwindows: checkwindows:
@ -1181,10 +1151,10 @@ checkwindows:
jne .restore jne .restore
call minimize_window call minimize_window
jmp .continue jmp .continue
.restore: .restore:
call restore_minimized_window call restore_minimized_window
.continue: .continue:
.no_minimizing: .no_minimizing:
cmp byte [btn_down], 0 ; mouse buttons pressed ? cmp byte [btn_down], 0 ; mouse buttons pressed ?
jne .mouse_buttons_pressed jne .mouse_buttons_pressed
@ -1193,59 +1163,34 @@ checkwindows:
;..................................... end 1/4 : modified by vhanla ................... ;..................................... end 1/4 : modified by vhanla ...................
popad popad
ret ret
.mouse_buttons_pressed: .mouse_buttons_pressed:
;..................................... start 2/4 : modified by vhanla .................
jmp @f
bPressedMouseXY_W db 0x0
@@:
;..................................... end 2/4 : modified by vhanla ...................
mov esi,[TASK_COUNT] mov esi,[TASK_COUNT]
inc esi inc esi
;..................................... start 3/4 : modified by vhanla ................. ;..................................... start 3/4 : modified by vhanla .................
push eax
cmp [bPressedMouseXY_W],0 cmp [bPressedMouseXY_W],0
jnz @f jnz @f
mov [bPressedMouseXY_W],1 mov [bPressedMouseXY_W],1
mov ax,[MOUSE_X] @@:
mov [mx],ax
mov ax,[MOUSE_Y]
mov [my],ax
@@:
pop eax
;..................................... end 3/4 : modified by vhanla ................... ;..................................... end 3/4 : modified by vhanla ...................
cwloop: movzx eax,word [MOUSE_Y]
cmp esi,2 movzx ebx,word [MOUSE_X]
jb .exit mov ecx, [Screen_Max_X]
add ebx, [_display_data]
inc ecx
mul ecx
movzx edi, byte [ebx+eax]
cwloop:
movzx esi, word [WIN_STACK + edi * 2]
dec esi
movzx edi, word [WIN_POS + esi * 2] ; ebx
shl edi, 5 shl edi, 5
add edi, window_data add edi, window_data
; mov edi, ebx
mov ecx, [edi + WDATA.box.left]
mov edx, [edi + WDATA.box.top]
mov eax,ecx movzx eax,word [MOUSE_X]
mov ebx,edx movzx ebx,word [MOUSE_Y]
test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED
jnz cwloop
;..................................... start 4/4 : modified by vhanla .................
movzx eax, word [mx]; movzx eax,word[mouse_x]
movzx ebx, word [my]; movzx ebx,word[MOUSE_Y]
;..................................... endt 4/4 : modified by vhanla ..................
cmp ecx, eax
jae cwloop
cmp edx, ebx
jae cwloop
add ecx, [edi + WDATA.box.width]
add edx, [edi + WDATA.box.height]
cmp eax, ecx
jae cwloop
cmp ebx, edx
jae cwloop
pushad pushad
mov eax, esi mov eax, esi
@ -1259,11 +1204,11 @@ checkwindows:
call waredraw call waredraw
add esp, 32 add esp, 32
.exit: .exit:
popad popad
ret ret
.move_resize_window: ; MOVE OR RESIZE WINDOW .move_resize_window: ; MOVE OR RESIZE WINDOW
popad popad
; Check for user enabled fixed window ; Check for user enabled fixed window
@ -1273,7 +1218,7 @@ checkwindows:
jne .window_move_enabled_for_user jne .window_move_enabled_for_user
popad popad
ret ret
.window_move_enabled_for_user: .window_move_enabled_for_user:
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
jnz .no_resize_2 jnz .no_resize_2
@ -1369,15 +1314,12 @@ checkwindows:
; move window ; move window
newchm: newchm:
mov [dont_draw_mouse], 1
call checkidle call checkidle
call checkVga_N13 call checkVga_N13
mov [mouse_background], 0
call [draw_pointer] call [draw_pointer]
@ -1433,8 +1375,8 @@ checkwindows:
je norepos_size je norepos_size
pushad pushad
mov edx,edi mov edx, edi
sub edx,window_data sub edx, window_data
;shr edx,5 ;shr edx,5
;shl edx,8 ;shl edx,8
;add edx,0x80000 ; process base at 0x80000+ ;add edx,0x80000 ; process base at 0x80000+
@ -1467,7 +1409,7 @@ checkwindows:
mov [reposition],1 mov [reposition],1
popad popad
norepos_size: norepos_size:
pop bx pop bx
pop ax pop ax
@ -1480,8 +1422,7 @@ checkwindows:
cmp byte [btn_down], 0 cmp byte [btn_down], 0
jne newchm jne newchm
; new position done ; new position done
mov [dont_draw_mouse], 1 mov cl,0
mov cl,0
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
jnz @f jnz @f
mov cl,[reposition] mov cl,[reposition]
@ -1507,7 +1448,8 @@ checkwindows:
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP or WSTATE_MAXIMIZED test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP or WSTATE_MAXIMIZED
jnz @f jnz @f
add ecx,2 add ecx,2
@@: sub edi,window_data @@:
sub edi,window_data
shr edi,5 shr edi,5
shl edi,8 shl edi,8
add edi,SLOT_BASE+APPDATA.saved_box add edi,SLOT_BASE+APPDATA.saved_box
@ -1561,7 +1503,7 @@ checkwindows:
@@: call check_window_position @@: call check_window_position
call set_window_clientbox call set_window_clientbox
no_window_shade: no_window_shade:
push edx push edx
mov edx, [edi + WDATA.cl_workarea] mov edx, [edi + WDATA.cl_workarea]
@ -1626,16 +1568,13 @@ checkwindows:
sub eax,[edi+WDATA.box.height] sub eax,[edi+WDATA.box.height]
mov [edi+WDATA.box.top],eax mov [edi+WDATA.box.top],eax
call set_window_clientbox call set_window_clientbox
no_window_sizing: no_window_sizing:
popad popad
cmp [reposition],0 cmp [reposition],0
je retwm je retwm
mov [dont_draw_mouse], 1 ; no mouse
push eax ebx ecx edx push eax ebx ecx edx
mov eax,[edi+WDATA.box.left] mov eax,[edi+WDATA.box.left]
mov ebx,[edi+WDATA.box.top] mov ebx,[edi+WDATA.box.top]
@ -1661,17 +1600,13 @@ checkwindows:
mov [edi+WDATA.fl_redraw],1 mov [edi+WDATA.fl_redraw],1
mov ecx,100 ; wait to avoid mouse residuals mov ecx,100 ; wait to avoid mouse residuals
waitre2: waitre2:
mov [dont_draw_mouse], 1 call checkidle
call checkidle
cmp [edi+WDATA.fl_redraw],0 cmp [edi+WDATA.fl_redraw],0
jz retwm jz retwm
loop waitre2 loop waitre2
retwm: retwm:
mov [dont_draw_mouse], 0 ; mouse pointer
mov [mouse_background], 0 ; no mouse under
mov esi,window_moved mov esi,window_moved
call sys_msg_board_str call sys_msg_board_str

View File

@ -33,225 +33,49 @@ align 4
draw_mouse_under: draw_mouse_under:
; return old picture ; return old picture
cmp [set_hw_cursor], 0 cmp [set_hw_cursor], 0
jz @F jz .exit
pushad pushad
mov eax, [x_under] mov eax, [x_under]
mov ebx, [y_under] mov ebx, [y_under]
stdcall [hw_restore], eax, ebx stdcall [hw_restore], eax, ebx
popad popad
ret .exit:
@@: ret
pushad
xor ecx,ecx
xor edx,edx
align 4
mres:
mov eax, [x_under]
mov ebx, [y_under]
add eax,ecx
add ebx,edx
push ecx
push edx
push eax
push ebx
mov eax,edx
shl eax,6
shl ecx,2
add eax,ecx
add eax,mouseunder
mov ecx,[eax]
pop ebx
pop eax
mov edi, 1 ;force
call [putpixel]
pop edx
pop ecx
inc ecx
cmp ecx, 16
jnz mres
xor ecx, ecx
inc edx
cmp edx, 24
jnz mres
popad
ret
save_draw_mouse: save_draw_mouse:
cmp [set_hw_cursor], 0 cmp [set_hw_cursor], 0
je .no_hw_cursor je .exit
pushad
mov [x_under], eax pushad
mov [y_under], ebx
movzx eax,word [MOUSE_Y]
movzx ebx,word [MOUSE_X]
push eax
push ebx
mov ecx, [Screen_Max_X] mov [x_under], eax
inc ecx mov [y_under], ebx
mul ecx movzx eax,word [MOUSE_Y]
add eax, [_display_data] movzx ebx,word [MOUSE_X]
movzx edx, byte [ebx+eax] push eax
shl edx, 8 push ebx
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
cmp esi, [current_cursor] mov ecx, [Screen_Max_X]
je .draw inc ecx
mul ecx
add eax, [_display_data]
movzx edx, byte [ebx+eax]
shl edx, 8
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
; cmp [esi+CURSOR.magic], 'CURS' cmp esi, [current_cursor]
; jne .fail je .draw
push esi push esi
call [select_hw_cursor] call [select_hw_cursor]
mov [current_cursor], esi mov [current_cursor], esi
.draw: .draw:
stdcall [set_hw_cursor], esi stdcall [set_hw_cursor], esi
popad popad
ret .exit:
.fail: ret
mov ecx, [def_cursor]
mov [edx+SLOT_BASE+APPDATA.cursor], ecx
stdcall [set_hw_cursor], ecx ; stdcall: [esp]=ebx,eax
popad
ret
.no_hw_cursor:
pushad
; save & draw
mov [x_under], eax
mov [y_under], ebx
push eax
push ebx
mov ecx,0
mov edx,0
align 4
drm:
push eax
push ebx
push ecx
push edx
; helloworld
push ecx
add eax,ecx ; save picture under mouse
add ebx,edx
push ecx
call getpixel
mov [color_temp],ecx
pop ecx
mov eax,edx
shl eax,6
shl ecx,2
add eax,ecx
add eax,mouseunder
mov ebx,[color_temp]
mov [eax],ebx
pop ecx
mov edi,edx ; y cycle
shl edi,4 ; *16 bytes per row
add edi,ecx ; x cycle
lea edi, [mousepointer+edi+edi*2] ; we have our str address
mov esi, edi
add esi, 16*24*3
push ecx
mov ecx, [color_temp]
call combine_colors
mov [mouse_color_mem], ecx
pop ecx
pop edx
pop ecx
pop ebx
pop eax
add eax,ecx ; we have x coord+cycle
add ebx,edx ; and y coord+cycle
push ecx
mov ecx, [mouse_color_mem]
mov edi, 1
call [putpixel]
pop ecx
mov ebx,[esp+0] ; pure y coord again
mov eax,[esp+4] ; and x
inc ecx ; +1 cycle
cmp ecx,16 ; if more than 16
jnz drm
xor ecx, ecx
inc edx
cmp edx,24
jnz drm
add esp,8
popad
ret
combine_colors:
; in
; ecx - color ( 00 RR GG BB )
; edi - ref to new color byte
; esi - ref to alpha byte
;
; out
; ecx - new color ( roughly (ecx*[esi]>>8)+([edi]*[esi]>>8) )
push eax
push ebx
push edx
push ecx
xor ecx, ecx
; byte 2
mov eax, 0xff
sub al, [esi+0]
mov ebx, [esp]
shr ebx, 16
and ebx, 0xff
mul ebx
shr eax, 8
add ecx, eax
xor eax, eax
xor ebx, ebx
mov al, [edi+0]
mov bl, [esi+0]
mul ebx
shr eax, 8
add ecx, eax
shl ecx, 8
; byte 1
mov eax, 0xff
sub al, [esi+1]
mov ebx, [esp]
shr ebx, 8
and ebx, 0xff
mul ebx
shr eax, 8
add ecx, eax
xor eax, eax
xor ebx, ebx
mov al, [edi+1]
mov bl, [esi+1]
mul ebx
shr eax, 8
add ecx, eax
shl ecx, 8
; byte 2
mov eax, 0xff
sub al, [esi+2]
mov ebx, [esp]
and ebx, 0xff
mul ebx
shr eax, 8
add ecx, eax
xor eax, eax
xor ebx, ebx
mov al, [edi+2]
mov bl, [esi+2]
mul ebx
shr eax, 8
add ecx, eax
pop eax
pop edx
pop ebx
pop eax
ret
__sys_disable_mouse: __sys_disable_mouse:
@ -276,7 +100,7 @@ __sys_disable_mouse:
movzx ebx, byte [ecx] movzx ebx, byte [ecx]
cmp eax,ebx cmp eax,ebx
je yes_mouse_disable je yes_mouse_disable
movzx ebx, byte [ecx+16] movzx ebx, byte [ecx+32]
cmp eax,ebx cmp eax,ebx
je yes_mouse_disable je yes_mouse_disable
mov ebx,[Screen_Max_X] mov ebx,[Screen_Max_X]
@ -286,7 +110,7 @@ __sys_disable_mouse:
movzx ebx, byte [ecx] movzx ebx, byte [ecx]
cmp eax,ebx cmp eax,ebx
je yes_mouse_disable je yes_mouse_disable
movzx ebx, byte [ecx+16] movzx ebx, byte [ecx+32]
cmp eax,ebx cmp eax,ebx
je yes_mouse_disable je yes_mouse_disable
jmp no_mouse_disable jmp no_mouse_disable
@ -435,3 +259,78 @@ mouse_acceleration:
@@: @@:
ret ret
;[ecx] x
;[ecx+4] y
;[ecx+8] w
;[ecx+12] h
align 4
lock_cursor:
pushfd
cli
xor eax, eax
mov edx, [ecx]
mov ebx, [ecx+4]
cmp edx, [cur.right]
jg .done
cmp ebx, [cur.bottom]
jg .done
add edx, [ecx+8]
add ebx, [ecx+12]
cmp edx, [cur.left]
jle .done
cmp ebx, [cur.top]
jle .done
mov ecx, [CURRENT_TASK]
mov ebx, [cur.left]
mov eax, [cur.top]
add ebx, [_display_data]
mul [_screen_width]
add ebx, eax
cmp cl, [ebx]
je .disable
cmp cl, [ebx+31]
je .disable
mov eax, [_screen_width]
shl eax, 5
sub eax, [_screen_width]
cmp cl, [ebx+eax]
je .disable
cmp cl, [ebx+eax+31]
jne .done
.disable:
call draw_mouse_under
mov eax, 1
.done:
inc eax
mov [cur.lock], eax
popfd
ret
align 4
unlock_cursor:
pushfd
cli
cmp [cur.lock], 2
jne .done
call save_draw_mouse
.done:
mov [cur.lock], 1
popfd
ret

View File

@ -189,3 +189,54 @@ typedef struct
#define EFL_IOPL1 0x1000 #define EFL_IOPL1 0x1000
#define EFL_IOPL2 0x2000 #define EFL_IOPL2 0x2000
#define EFL_IOPL3 0x3000 #define EFL_IOPL3 0x3000
typedef struct
{
u32_t handle;
u32_t io_code;
void *input;
int inp_size;
void *output;
int out_size;
}ioctl_t;
typedef struct
{
u32_t code;
union
{
struct /* window event */
{
u32_t win; /* window handle */
u32_t val1;
u32_t val2;
u16_t x; /* cursor x */
u16_t y; /* cursor y */
u32_t unused;
}__attribute__ ((packed));
struct /* realtime io */
{
u32_t sender; /* service handler */
u32_t stream; /* io stream id, if present */
addr_t offset;
size_t size;
};
struct /* ipc event */
{
u32_t sender;
u32_t io_code;
addr_t *input;
size_t inp_size;
addr_t *output;
size_t out_size;
};
};
}event_t;

View File

@ -14,7 +14,7 @@ typedef u32_t count_t;
typedef u32_t size_t; typedef u32_t size_t;
typedef u32_t index_t; typedef u32_t index_t;
typedef u32_t eflags_t; typedef u32_t eflags_t;
typedef u32_t color_t;
typedef int bool; typedef int bool;

View File

@ -134,6 +134,7 @@ public _rd_fat_end
public _rd_root public _rd_root
public _rd_root_end public _rd_root_end
public _current_task
public _current_slot public _current_slot
public _current_thread public _current_thread
public _k_reenter public _k_reenter
@ -196,6 +197,11 @@ public scr_mode
public LFBAddress public LFBAddress
public LFBSize public LFBSize
public _screen_width
public _screen_height
public _vesa20_drawbar
extrn __edata extrn __edata
@ -294,12 +300,12 @@ include 'printf.inc'
align 4 align 4
init_apm: init_apm:
; init selectors ; init selectors
mov ebx, [BOOT_VAR +0x9040] ; offset of APM entry point mov ebx, [OS_BASE +0x9040] ; offset of APM entry point
movzx eax, word [BOOT_VAR+0x9050] ; real-mode segment base address of movzx eax, word [OS_BASE+0x9050] ; real-mode segment base address of
; protected-mode 32-bit code segment ; protected-mode 32-bit code segment
movzx ecx, word [BOOT_VAR+0x9052] ; real-mode segment base address of movzx ecx, word [OS_BASE+0x9052] ; real-mode segment base address of
; protected-mode 16-bit code segment ; protected-mode 16-bit code segment
movzx edx, word [BOOT_VAR+0x9054] ; real-mode segment base address of movzx edx, word [OS_BASE+0x9054] ; real-mode segment base address of
; protected-mode 16-bit data segment ; protected-mode 16-bit data segment
shl eax, 4 shl eax, 4
@ -320,7 +326,7 @@ init_apm:
mov dword[apm_entry], ebx mov dword[apm_entry], ebx
mov word [apm_entry + 4], apm_code_32 - _gdts mov word [apm_entry + 4], apm_code_32 - _gdts
mov eax, [BOOT_VAR + 0x9044] ; version & flags mov eax, [OS_BASE + 0x9044] ; version & flags
mov [apm_vf], eax mov [apm_vf], eax
ret ret
@ -332,33 +338,35 @@ system_init:
call init_apm call init_apm
; SAVE REAL MODE VARIABLES ; SAVE REAL MODE VARIABLES
mov ax, [BOOT_VAR + 0x9031] mov ax, [OS_BASE + 0x9031]
mov [IDEContrRegsBaseAddr], ax mov [IDEContrRegsBaseAddr], ax
mov al, [BOOT_VAR+0x901F] ; DMA access mov al, [OS_BASE+0x901F] ; DMA access
mov [allow_dma_access], al mov [allow_dma_access], al
movzx eax, byte [BOOT_VAR+0x9000] ; bpp movzx eax, byte [OS_BASE+0x9000] ; bpp
mov [ScreenBPP], eax mov [ScreenBPP], eax
movzx eax,word [BOOT_VAR+0x900A] ; X max movzx eax,word [OS_BASE+0x900A] ; X max
movzx ebx,word [OS_BASE+0x900C] ; Y max
mov [_screen_width], eax
mov [_screen_height], ebx
dec eax dec eax
dec ebx
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 mov [Screen_Max_Y],ebx
dec eax mov [screen_workarea.bottom],ebx
mov [Screen_Max_Y],eax
mov [screen_workarea.bottom],eax
mov [BytesPerScanLine], 640*4 mov [BytesPerScanLine], 640*4
cmp [scr_mode], 0x13 ; 320x200 cmp [scr_mode], 0x13 ; 320x200
je @f je @f
cmp [scr_mode], 0x12 ; VGA 640x480 cmp [scr_mode], 0x12 ; VGA 640x480
je @f je @f
movzx eax, word [BOOT_VAR+0x9001] ; for other modes movzx eax, word [OS_BASE+0x9001] ; for other modes
mov [BytesPerScanLine], eax mov [BytesPerScanLine], eax
@@: @@:
mov esi, BOOT_VAR+0x9080 mov esi, OS_BASE+0x9080
movzx ecx, byte [esi-1] movzx ecx, byte [esi-1]
mov [NumBiosDisks], ecx mov [NumBiosDisks], ecx
mov edi, BiosDisksData mov edi, BiosDisksData
@ -366,7 +374,7 @@ system_init:
; GRAPHICS ADDRESSES ; GRAPHICS ADDRESSES
mov byte [BOOT_VAR+0x901e],0x0 mov byte [OS_BASE+0x901e],0x0
cmp [scr_mode], 0100000000000000b cmp [scr_mode], 0100000000000000b
jge setvesa20 jge setvesa20
@ -987,10 +995,10 @@ set_variables:
mov [BTN_COUNT], 0 ; button buffer mov [BTN_COUNT], 0 ; button buffer
push eax push eax
mov ax,[BOOT_VAR+0x900c] mov ax,[OS_BASE+0x900c]
shr ax,1 shr ax,1
shl eax,16 shl eax,16
mov ax,[BOOT_VAR+0x900A] mov ax,[OS_BASE+0x900A]
shr ax,1 shr ax,1
mov dword [MOUSE_X], eax mov dword [MOUSE_X], eax
pop eax pop eax
@ -1446,10 +1454,6 @@ no_set_lba_read:
ret ret
no_set_pci_access: no_set_pci_access:
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
include 'vmodeint.inc'
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
sys_setup_err: sys_setup_err:
mov [esp+36],dword -1 mov [esp+36],dword -1
ret ret
@ -1799,7 +1803,7 @@ sysfn_shutdown: ; 18.9 = system shutdown
jl exit_for_anyone jl exit_for_anyone
cmp ecx,4 cmp ecx,4
jg exit_for_anyone jg exit_for_anyone
mov [BOOT_VAR+0x9030],cl mov [OS_BASE+0x9030],cl
mov eax,[TASK_COUNT] mov eax,[TASK_COUNT]
mov [sys_shutdown], eax mov [sys_shutdown], eax
@ -1925,17 +1929,17 @@ sysfn_minimize: ; 18.10 = minimize window
sysfn_getdiskinfo: ; 18.11 = get disk info table sysfn_getdiskinfo: ; 18.11 = get disk info table
cmp ecx,1 cmp ecx,1
jnz full_table jnz full_table
small_table: small_table:
call for_all_tables call for_all_tables
mov ecx,10 mov ecx,10
cld cld
rep movsb rep movsb
ret ret
for_all_tables: for_all_tables:
mov edi,edx mov edi,edx
mov esi,DRIVE_DATA mov esi,DRIVE_DATA
ret ret
full_table: full_table:
cmp ecx,2 cmp ecx,2
jnz exit_for_anyone jnz exit_for_anyone
call for_all_tables call for_all_tables
@ -2317,7 +2321,7 @@ sys_getbackground:
jnz nogb1 jnz nogb1
mov eax,[BgrDataWidth] mov eax,[BgrDataWidth]
shl eax,16 shl eax,16
mov ax,[BgrDataHeight] mov ax, word [BgrDataHeight]
mov [esp+36],eax mov [esp+36],eax
ret ret
@ -2593,14 +2597,14 @@ sys_redrawstat:
jne no_widgets_away jne no_widgets_away
; buttons away ; buttons away
mov ecx,[CURRENT_TASK] mov ecx,[CURRENT_TASK]
sys_newba2: sys_newba2:
mov edi,[btn_addr] mov edi,[btn_addr]
cmp [edi], dword 0 ; empty button list ? cmp [edi], dword 0 ; empty button list ?
je end_of_buttons_away je end_of_buttons_away
movzx ebx, word [edi] movzx ebx, word [edi]
inc ebx inc ebx
mov eax,edi mov eax,edi
sys_newba: sys_newba:
dec ebx dec ebx
jz end_of_buttons_away jz end_of_buttons_away
@ -2630,17 +2634,16 @@ sys_redrawstat:
jnz srl1 jnz srl1
mov edx, [TASK_BASE] ; return whole screen draw area for this app mov edx, [TASK_BASE] ; return whole screen draw area for this app
add edx, draw_data - CURRENT_TASK sub edx, CURRENT_TASK
mov [edx + RECT.left], 0 mov [edx +draw_data + RECT.left], 0
mov [edx + RECT.top], 0 mov [edx +draw_data+ RECT.top], 0
mov eax, [Screen_Max_X] mov eax, [Screen_Max_X]
mov [edx + RECT.right], eax mov [edx +draw_data+ RECT.right], eax
mov eax, [Screen_Max_Y] mov eax, [Screen_Max_Y]
mov [edx + RECT.bottom], eax mov [edx +draw_data+ RECT.bottom], eax
mov edi, [TASK_BASE] mov edi, [TASK_BASE]
or [edi - twdw + WDATA.fl_wdrawn], 1 ; no new position & buttons from app or [edi - twdw + WDATA.fl_wdrawn], 1 ; no new position & buttons from app
call sys_window_mouse
ret ret
srl1: srl1:
@ -2664,7 +2667,7 @@ sys_drawwindow:
;call [draw_pointer] ;call [draw_pointer]
;ret ;ret
jmp draw_window_caption.2 jmp draw_window_caption.2
nosyswI: nosyswI:
cmp al,1 ; type II - only reserve area, no draw cmp al,1 ; type II - only reserve area, no draw
jne nosyswII jne nosyswII
@ -2672,7 +2675,6 @@ sys_drawwindow:
call [disable_mouse] call [disable_mouse]
call sys_set_window call sys_set_window
call [disable_mouse] call [disable_mouse]
call sys_window_mouse
dec [mouse_pause] dec [mouse_pause]
call [draw_pointer] call [draw_pointer]
ret ret
@ -2695,7 +2697,7 @@ sys_drawwindow:
je draw_skin_window je draw_skin_window
cmp al,4 ; type V - skinned window not sized! {not_sized_skin_window} cmp al,4 ; type V - skinned window not sized! {not_sized_skin_window}
jne nosyswV jne nosyswV
draw_skin_window: draw_skin_window:
inc [mouse_pause] inc [mouse_pause]
call [disable_mouse] call [disable_mouse]
@ -2910,10 +2912,6 @@ sys_set_window:
test [edi+WDATA.fl_wdrawn],1 test [edi+WDATA.fl_wdrawn],1
jnz newd jnz newd
mov eax,[timer_ticks] ;[0xfdf0]
add eax,100
mov [new_window_starting],eax
movsx eax,bx movsx eax,bx
mov [edi+WDATA.box.width],eax mov [edi+WDATA.box.width],eax
movsx eax,cx movsx eax,cx
@ -2945,7 +2943,7 @@ sys_set_window:
je set_APPDATA_wnd_caption je set_APPDATA_wnd_caption
jmp @f jmp @f
set_APPDATA_wnd_caption: set_APPDATA_wnd_caption:
mov [edi+APPDATA.wnd_caption],eax mov [edi+APPDATA.wnd_caption],eax
@@: mov esi,[esp+0] @@: mov esi,[esp+0]
@ -2974,7 +2972,7 @@ sys_set_window:
mov [KEY_COUNT], 0 ; empty keyboard buffer mov [KEY_COUNT], 0 ; empty keyboard buffer
mov [BTN_COUNT], 0 ; empty button buffer mov [BTN_COUNT], 0 ; empty button buffer
newd: newd:
mov [edi+WDATA.fl_redraw],byte 0 ; no redraw mov [edi+WDATA.fl_redraw],byte 0 ; no redraw
mov edx,edi mov edx,edi
@ -3100,14 +3098,11 @@ sys_window_move:
xor esi,esi xor esi,esi
call redrawscreen call redrawscreen
mov [dont_draw_mouse], 0 ; mouse pointer
mov [mouse_background], 0 ; no mouse under
call [draw_pointer] call [draw_pointer]
mov [window_move_pr],0 mov [window_move_pr],0
.window_move_return: .window_move_return:
ret ret
@ -3425,41 +3420,41 @@ redrawscreen:
cmp ecx,eax cmp ecx,eax
jb ricino jb ricino
bgli: bgli:
cmp ecx,1 cmp ecx,1
jnz .az jnz .az
mov al, byte [redraw_background] mov al, byte [redraw_background]
cmp al,2 cmp al,2
jz newdw8 jz newdw8
test al,al test al,al
jz .az jz .az
lea eax,[edi+draw_data-window_data] lea eax,[edi+draw_data+(0x100000000-OS_BASE)]
mov ebx,[dlx] mov ebx,[dlx]
cmp ebx,[eax+RECT.left] cmp ebx,[eax+RECT.left]
jae @f jae @f
mov [eax+RECT.left],ebx mov [eax+RECT.left],ebx
@@: @@:
mov ebx,[dly] mov ebx,[dly]
cmp ebx,[eax+RECT.top] cmp ebx,[eax+RECT.top]
jae @f jae @f
mov [eax+RECT.top],ebx mov [eax+RECT.top],ebx
@@: @@:
mov ebx,[dlxe] mov ebx,[dlxe]
cmp ebx,[eax+RECT.right] cmp ebx,[eax+RECT.right]
jbe @f jbe @f
mov [eax+RECT.right],ebx mov [eax+RECT.right],ebx
@@: @@:
mov ebx,[dlye] mov ebx,[dlye]
cmp ebx,[eax+RECT.bottom] cmp ebx,[eax+RECT.bottom]
jbe @f jbe @f
mov [eax+RECT.bottom],ebx mov [eax+RECT.bottom],ebx
@@: @@:
jmp newdw8 jmp newdw8
.az: .az:
mov eax,edi mov eax,edi
add eax,draw_data-window_data add eax, draw_data+(0x100000000-OS_BASE)
mov ebx,[dlx] ; set limits mov ebx,[dlx] ; set limits
mov [eax + RECT.left], ebx mov [eax + RECT.left], ebx
@ -3470,20 +3465,20 @@ redrawscreen:
mov ebx,[dlye] mov ebx,[dlye]
mov [eax + RECT.bottom], ebx mov [eax + RECT.bottom], ebx
sub eax,draw_data-window_data sub eax,draw_data+(0x100000000-OS_BASE)
cmp dword [esp],1 cmp dword [esp],1
jne nobgrd jne nobgrd
mov [redraw_background], 1 mov [redraw_background], 1
newdw8: newdw8:
nobgrd: nobgrd:
mov [eax + WDATA.fl_redraw],byte 1 ; mark as redraw mov [eax + WDATA.fl_redraw],byte 1 ; mark as redraw
ricino: ricino:
not_this_task: not_this_task:
pop ecx pop ecx
@ -3710,7 +3705,7 @@ get_irq_data:
dec edx dec edx
jmp gid1 jmp gid1
gidril1: gidril1:
shl ebx, 12 shl ebx, 12
lea eax, [ebx + IRQ_SAVE] ; calculate address of the beginning of buffer + 0x0 - data size lea eax, [ebx + IRQ_SAVE] ; calculate address of the beginning of buffer + 0x0 - data size
@ -4046,15 +4041,15 @@ sys_putimage:
jz .exit jz .exit
test ecx,0xFFFF0000 test ecx,0xFFFF0000
jnz @f jnz @f
.exit: .exit:
ret ret
@@: @@:
mov edi,[current_slot] mov edi,[current_slot]
add dx,word[edi+APPDATA.wnd_clientbox.top] add dx,word[edi+APPDATA.wnd_clientbox.top]
rol edx,16 rol edx,16
add dx,word[edi+APPDATA.wnd_clientbox.left] add dx,word[edi+APPDATA.wnd_clientbox.left]
rol edx,16 rol edx,16
.forced: .forced:
push ebp esi 0 push ebp esi 0
mov ebp, putimage_get24bpp mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp mov esi, putimage_init24bpp
@ -5094,7 +5089,7 @@ undefined_syscall: ; Undefined system call
align 4 align 4
system_shutdown: ; shut down the system system_shutdown: ; shut down the system
cmp byte [BOOT_VAR+0x9030], 1 cmp byte [OS_BASE+0x9030], 1
jne @F jne @F
ret ret
@@: @@:
@ -5107,10 +5102,10 @@ yes_shutdown_param:
cli cli
cmp byte [BOOT_VAR+0x9030], 3 cmp byte [OS_BASE+0x9030], 3
je _sys_reboot je _sys_reboot
cmp byte [BOOT_VAR+0x9030], 4 cmp byte [OS_BASE+0x9030], 4
je _sys_restart je _sys_restart
cld cld
@ -5148,10 +5143,6 @@ _sys_restart:
call restorefatchain call restorefatchain
cld cld
mov esi, BOOT_VAR ; restore 0x0 - 0xffff
mov edi, OS_BASE
mov ecx,0x10000/4
rep movsd
; mov eax, [_copy_pg_balloc] ; mov eax, [_copy_pg_balloc]
mov [_pg_balloc], eax mov [_pg_balloc], eax

View File

@ -219,13 +219,6 @@ include "video/cursors.inc" ; cursors functions
include "network/stack.inc" include "network/stack.inc"
;include "drivers/uart.inc"
; Mouse pointer
include "gui/mouse.inc"
; Window skinning ; Window skinning
include "gui/skincode.inc" include "gui/skincode.inc"

View File

@ -6,11 +6,12 @@ INCLUDE = include/
DEFS = -DUSE_SMP -DCONFIG_DEBUG DEFS = -DUSE_SMP -DCONFIG_DEBUG
CFLAGS = -c -O2 -I $(INCLUDE) -fomit-frame-pointer -fno-builtin CFLAGS = -c -O2 -DCONFIG_DEBUG -I $(INCLUDE) -fomit-frame-pointer -fno-builtin
LDFLAGS = -shared -s -Map kernel.map --image-base 0x100000 --file-alignment 32 LDFLAGS = -shared -s -Map kernel.map --image-base 0x100000 --file-alignment 32
KERNEL_SRC:= \ KERNEL_SRC:= \
kernel.asm \ kernel.asm \
const.inc \
data32.inc \ data32.inc \
core/memory.inc \ core/memory.inc \
core/heap.inc \ core/heap.inc \
@ -18,13 +19,15 @@ KERNEL_SRC:= \
core/taskman.inc \ core/taskman.inc \
core/v86.inc \ core/v86.inc \
core/sys32.inc \ core/sys32.inc \
core/syscall.inc \
core/dll.inc \ core/dll.inc \
core/exports.inc \ core/exports.inc \
fs/ntfs.inc \ fs/ntfs.inc \
gui/window.inc \ gui/window.inc \
gui/event.inc \ gui/event.inc \
video/vesa20.inc \ video/vesa20.inc \
video/cursors.inc video/cursors.inc \
hid/mousedrv.inc
PE_SRC:= \ PE_SRC:= \

View File

@ -470,7 +470,6 @@ proc init_cursors
jne .fail jne .fail
sub ebx, 96 sub ebx, 96
.init: .init:
mov [cur_def_interl], ebx
; stdcall load_driver, szHwMouse ; stdcall load_driver, szHwMouse
; mov [hw_cursor], eax ; mov [hw_cursor], eax
@ -486,13 +485,6 @@ proc init_cursors
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
mov [def_cursor], eax mov [def_cursor], eax
mov ecx, [Screen_Max_X]
mov edx, [Screen_Max_Y]
inc ecx
inc edx
mov [scr_width], ecx
mov [scr_height], edx
mov ebx, [ScreenBPP] mov ebx, [ScreenBPP]
cmp ebx, 32 cmp ebx, 32
jne @F jne @F
@ -517,22 +509,20 @@ endp
align 4 align 4
proc restore_24 stdcall, x:dword, y:dword proc restore_24 stdcall, x:dword, y:dword
locals
w dd ?
endl
mov edi, [cur_saved_base] mov ebx, [cur_saved_base]
mov edx, [cur_saved_h] mov edx, [cur.h]
mov ebx, [cur_saved_interl]
test edx, edx test edx, edx
jz .ret jz .ret
mov esi, cur_saved_data mov esi, cur_saved_data
@@: @@:
mov ecx, [cur_saved_w] mov edi, ebx
add ebx, [BytesPerScanLine]
mov ecx, [cur.w]
lea ecx, [ecx+ecx*2] lea ecx, [ecx+ecx*2]
rep movsb rep movsb
add edi, ebx
dec edx dec edx
jnz @B jnz @B
.ret: .ret:
@ -541,21 +531,19 @@ endp
align 4 align 4
proc restore_32 stdcall, x:dword, y:dword proc restore_32 stdcall, x:dword, y:dword
locals
w dd ?
endl
mov edi, [cur_saved_base] mov ebx, [cur_saved_base]
mov edx, [cur_saved_h] mov edx, [cur.h]
mov ebx, [cur_saved_interl]
test edx, edx test edx, edx
jz .ret jz .ret
mov esi, cur_saved_data mov esi, cur_saved_data
@@: @@:
mov ecx, [cur_saved_w] mov edi, ebx
add ebx, [BytesPerScanLine]
mov ecx, [cur.w]
rep movsd rep movsd
add edi, ebx
dec edx dec edx
jnz @B jnz @B
.ret: .ret:
@ -565,9 +553,7 @@ endp
align 4 align 4
proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword
locals locals
w dd ?
h dd ? h dd ?
st dd ?
_dx dd ? _dx dd ?
_dy dd ? _dy dd ?
endl endl
@ -579,95 +565,92 @@ proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword
xor edx, edx xor edx, edx
sub ecx, [esi+CURSOR.hot_x] sub ecx, [esi+CURSOR.hot_x]
lea ebx, [ecx+32-1]
mov [x], ecx mov [x], ecx
sets dl sets dl
dec edx dec edx
and ecx, edx ;clip x to 0<=x and ecx, edx ;clip x to 0<=x
mov [cur.left], ecx
mov edi, ecx mov edi, ecx
sub edi, [x] sub edi, [x]
mov [_dx], edi mov [_dx], edi
xor edx, edx xor edx, edx
sub eax, [esi+CURSOR.hot_y] sub eax, [esi+CURSOR.hot_y]
lea edi, [eax+32-1]
mov [y], eax mov [y], eax
sets dl sets dl
dec edx dec edx
and eax, edx ;clip y to 0<=y and eax, edx ;clip y to 0<=y
mov edi, eax mov [cur.top], eax
sub edi, [y]
mov [_dy], edi
mul ebx
lea esi, [LFB_BASE+ecx+ecx*2]
add esi, eax
mov [cur_saved_base],esi
mov edi, [scr_width]
mov edx, [scr_height]
mov eax, 32
sub edi, ecx
cmp edi, eax
jng @F
mov edi, eax
@@:
sub edi, [_dx]
sub edx, [y]
cmp edx, eax
jng @F
mov edx, eax mov edx, eax
sub edx, [y]
mov [_dy], edx
mul [BytesPerScanLine]
lea edx, [LFB_BASE+ecx*3]
add edx, eax
mov [cur_saved_base],edx
cmp ebx, [Screen_Max_X]
jbe @F
mov ebx, [Screen_Max_X]
@@: @@:
sub edx, [_dy] cmp edi, [Screen_Max_Y]
jbe @F
mov edi, [Screen_Max_Y]
@@:
mov [cur.right], ebx
mov [cur.bottom], edi
mov [w], edi sub ebx, [x]
mov [h], edx sub edi, [y]
mov [cur_saved_w], edi inc ebx
mov [cur_saved_h], edx inc edi
sub eax, edi mov [cur.w], ebx
shl eax, 2 ;lea eax, [eax+eax*2] mov [cur.h], edi
lea edi, [edi+edi*2] mov [h], edi
sub ebx, edi
mov [cur_saved_interl], ebx
mov eax, edi
mov edi, cur_saved_data mov edi, cur_saved_data
@@: @@:
mov ecx, [w] mov esi, edx
add edx, [BytesPerScanLine]
mov ecx, [cur.w]
lea ecx, [ecx+ecx*2] lea ecx, [ecx+ecx*2]
rep movsb rep movsb
add esi, ebx dec eax
dec edx
jnz @B jnz @B
;draw cursor ;draw cursor
mov edx, eax mov ebx, [cur_saved_base]
mov edi, [cur_saved_base]
mov eax, [_dy] mov eax, [_dy]
shl eax, 5 shl eax, 5
add eax, [_dx] add eax, [_dx]
shl eax, 2
mov esi, [hcursor] mov esi, [hcursor]
mov esi, [esi+CURSOR.base] mov esi, [esi+CURSOR.base]
add esi, eax lea edx, [esi+eax*4]
.row: .row:
mov ecx, [w] mov ecx, [cur.w]
mov esi, edx
mov edi, ebx
add edx, 32*4
add ebx, [BytesPerScanLine]
.pix: .pix:
lodsd lodsd
test eax, 0xFF000000 test eax, 0xFF000000
jz @F jz @F
mov word [edi], ax mov [edi], ax
shr eax, 16 shr eax, 16
mov [edi+2],al mov [edi+2], al
@@: @@:
add edi, 3 add edi, 3
dec ecx dec ecx
jnz .pix jnz .pix
add esi, edx
add edi, ebx
dec [h] dec [h]
jnz .row jnz .row
ret ret
@ -676,9 +659,7 @@ endp
align 4 align 4
proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword
locals locals
w dd ?
h dd ? h dd ?
st dd ?
_dx dd ? _dx dd ?
_dy dd ? _dy dd ?
endl endl
@ -686,82 +667,80 @@ proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword
mov esi, [hcursor] mov esi, [hcursor]
mov ecx, [x] mov ecx, [x]
mov eax, [y] mov eax, [y]
mov ebx, [BytesPerScanLine]
xor edx, edx xor edx, edx
sub ecx, [esi+CURSOR.hot_x] sub ecx, [esi+CURSOR.hot_x]
lea ebx, [ecx+32-1]
mov [x], ecx mov [x], ecx
sets dl sets dl
dec edx dec edx
and ecx, edx ;clip x to 0<=x and ecx, edx ;clip x to 0<=x
mov [cur.left], ecx
mov edi, ecx mov edi, ecx
sub edi, [x] sub edi, [x]
mov [_dx], edi mov [_dx], edi
xor edx, edx xor edx, edx
sub eax, [esi+CURSOR.hot_y] sub eax, [esi+CURSOR.hot_y]
lea edi, [eax+32-1]
mov [y], eax mov [y], eax
sets dl sets dl
dec edx dec edx
and eax, edx ;clip y to 0<=y and eax, edx ;clip y to 0<=y
mov edi, eax mov [cur.top], eax
sub edi, [y]
mov [_dy], edi
mul ebx
lea esi, [LFB_BASE+eax+ecx*4]
mov [cur_saved_base],esi
mov edi, [scr_width]
mov edx, [scr_height]
mov eax, 32
sub edi, ecx
cmp edi, eax
jng @F
mov edi, eax
@@:
sub edi, [_dx]
sub edx, [y]
cmp edx, eax
jng @F
mov edx, eax mov edx, eax
sub edx, [y]
mov [_dy], edx
mul [BytesPerScanLine]
lea edx, [LFB_BASE+eax+ecx*4]
mov [cur_saved_base],edx
cmp ebx, [Screen_Max_X]
jbe @F
mov ebx, [Screen_Max_X]
@@: @@:
sub edx, [_dy] cmp edi, [Screen_Max_Y]
jbe @F
mov edi, [Screen_Max_Y]
@@:
mov [cur.right], ebx
mov [cur.bottom], edi
mov [w], edi sub ebx, [x]
mov [h], edx sub edi, [y]
mov [cur_saved_w], edi inc ebx
mov [cur_saved_h], edx inc edi
sub eax, edi mov [cur.w], ebx
shl eax, 2 mov [cur.h], edi
shl edi, 2 mov [h], edi
sub ebx, edi
mov [cur_saved_interl], ebx
mov eax, edi
mov edi, cur_saved_data mov edi, cur_saved_data
@@: @@:
mov ecx, [w] mov esi, edx
add edx, [BytesPerScanLine]
mov ecx, [cur.w]
rep movsd rep movsd
add esi, ebx dec eax
dec edx
jnz @B jnz @B
;draw cursor ;draw cursor
mov edx, eax mov ebx, [cur_saved_base]
mov edi, [cur_saved_base]
mov eax, [_dy] mov eax, [_dy]
shl eax, 5 shl eax, 5
add eax, [_dx] add eax, [_dx]
shl eax, 2
mov esi, [hcursor] mov esi, [hcursor]
mov esi, [esi+CURSOR.base] mov esi, [esi+CURSOR.base]
add esi, eax lea edx, [esi+eax*4]
.row: .row:
mov ecx, [w] mov ecx, [cur.w]
mov esi, edx
mov edi, ebx
add edx, 32*4
add ebx, [BytesPerScanLine]
.pix: .pix:
lodsd lodsd
test eax, 0xFF000000 test eax, 0xFF000000
@ -771,8 +750,7 @@ proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword
add edi, 4 add edi, 4
dec ecx dec ecx
jnz .pix jnz .pix
add esi, edx
add edi, ebx
dec [h] dec [h]
jnz .row jnz .row
ret ret

View File

@ -438,16 +438,17 @@ vesa12_drawbar:
push eax push eax
push ecx push ecx
mov eax,[TASK_BASE] mov eax,[TASK_BASE]
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.left] sub eax, CURRENT_TASK
mov ecx,[eax+draw_data+RECT.left]
cmp ecx,0 cmp ecx,0
jnz dbcblimitlset12 jnz dbcblimitlset12
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.top] mov ecx,[eax+draw_data+RECT.top]
cmp ecx,0 cmp ecx,0
jnz dbcblimitlset12 jnz dbcblimitlset12
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right] mov ecx,[eax+draw_data+RECT.right]
cmp ecx,[Screen_Max_X] cmp ecx,[Screen_Max_X]
jnz dbcblimitlset12 jnz dbcblimitlset12
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom] mov ecx,[eax+draw_data+RECT.bottom]
cmp ecx,[Screen_Max_Y] cmp ecx,[Screen_Max_Y]
jnz dbcblimitlset12 jnz dbcblimitlset12
pop ecx pop ecx
@ -796,14 +797,15 @@ vesa12_putimage:
push ecx push ecx
mov eax,[TASK_BASE] mov eax,[TASK_BASE]
cmp dword [eax+draw_data-CURRENT_TASK+RECT.left], 0 sub eax, CURRENT_TASK
cmp dword [eax+draw_data+RECT.left], 0
jnz dbcblimitlset212 jnz dbcblimitlset212
cmp dword [eax+draw_data-CURRENT_TASK+RECT.top], 0 cmp dword [eax+draw_data+RECT.top], 0
jnz dbcblimitlset212 jnz dbcblimitlset212
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right] mov ecx,[eax+draw_data+RECT.right]
cmp ecx,[Screen_Max_X] cmp ecx,[Screen_Max_X]
jnz dbcblimitlset212 jnz dbcblimitlset212
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom] mov ecx,[eax+draw_data+RECT.bottom]
cmp ecx,[Screen_Max_Y] cmp ecx,[Screen_Max_Y]
jnz dbcblimitlset212 jnz dbcblimitlset212
pop ecx pop ecx

View File

@ -574,6 +574,7 @@ align 4
; ecx xe ; ecx xe
; edx ye ; edx ye
; edi color ; edi color
_vesa20_drawbar:
vesa20_drawbar: vesa20_drawbar:
pushad pushad
call [disable_mouse] call [disable_mouse]