Syncing net branch with trunk.

git-svn-id: svn://kolibrios.org@3187 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2013-01-21 20:59:27 +00:00
parent 575dd00f15
commit fbf1d3eec3
35 changed files with 5307 additions and 4931 deletions

View File

@ -350,8 +350,10 @@ disk_add:
inc eax inc eax
cmp byte [ebx+eax-1], 0 cmp byte [ebx+eax-1], 0
jnz @b jnz @b
; 2b. Call the heap manager. ; 2b. Call the heap manager. Note that it can change ebx.
push ebx
call malloc call malloc
pop ebx
; 2c. Check the result. If allocation failed, go to 7. ; 2c. Check the result. If allocation failed, go to 7.
pop esi ; restore allocated pointer to DISK pop esi ; restore allocated pointer to DISK
test eax, eax test eax, eax
@ -418,7 +420,7 @@ disk_del:
push esi ; save used registers to be stdcall push esi ; save used registers to be stdcall
; 1. Force media to be removed. If the media is already removed, the ; 1. Force media to be removed. If the media is already removed, the
; call does nothing. ; call does nothing.
mov esi, [esp+4+8] ; esi = handle of the disk mov esi, [esp+4+4] ; esi = handle of the disk
stdcall disk_media_changed, esi, 0 stdcall disk_media_changed, esi, 0
; 2. Delete the structure from the global list. ; 2. Delete the structure from the global list.
; 2a. Acquire the mutex. ; 2a. Acquire the mutex.
@ -624,8 +626,8 @@ disk_default_flush:
; The default implementation of DISKFUNC.adjust_cache_size. ; The default implementation of DISKFUNC.adjust_cache_size.
disk_default_adjust_cache_size: disk_default_adjust_cache_size:
mov eax, [esp+4] mov eax, [esp+8]
ret 4 ret 8
; This is an internal function called from 'disk_media_changed' when a new media ; This is an internal function called from 'disk_media_changed' when a new media
; is detected. It creates the list of partitions for the media. ; is detected. It creates the list of partitions for the media.
@ -975,15 +977,33 @@ virtual at ebp+8
.start dq ? .start dq ?
.length dq ? .length dq ?
end virtual end virtual
; Currently no file systems are supported, so just allocate the PARTITION ; When disk_add_partition is called, ebx contains a pointer to
; a two-sectors-sized buffer. This function saves ebx in the stack
; immediately before ebp.
virtual at ebp-4
.buffer dd ?
end virtual
; 1. Read the bootsector to the buffer.
mov al, DISKFUNC.read
mov ebx, [.buffer]
add ebx, 512
push 1
stdcall disk_call_driver, ebx, dword [.start], dword [.start+4], esp
; 2. Run tests for all supported filesystems. If at least one test succeeded,
; go to 4.
; For tests: qword [ebp+8] = partition start, qword [ebp+10h] = partition
; length, [esp] = 0 if reading bootsector failed or 1 if succeeded,
; ebx points to the buffer for bootsector.
call fat_create_partition
test eax, eax
jnz .success
; 3. No file system has recognized the volume, so just allocate the PARTITION
; structure without extra fields. ; structure without extra fields.
; 1. Allocate and check result.
push sizeof.PARTITION push sizeof.PARTITION
pop eax pop eax
call malloc call malloc
test eax, eax test eax, eax
jz .nothing jz .nothing
; 2. Fill the common fields: copy .start and .length.
mov edx, dword [.start] mov edx, dword [.start]
mov dword [eax+PARTITION.FirstSector], edx mov dword [eax+PARTITION.FirstSector], edx
mov edx, dword [.start+4] mov edx, dword [.start+4]
@ -992,8 +1012,12 @@ end virtual
mov dword [eax+PARTITION.Length], edx mov dword [eax+PARTITION.Length], edx
mov edx, dword [.length+4] mov edx, dword [.length+4]
mov dword [eax+PARTITION.Length+4], edx mov dword [eax+PARTITION.Length+4], edx
mov [eax+PARTITION.Disk], esi
and [eax+PARTITION.FSUserFunctions], 0
.success:
.nothing: .nothing:
; 3. Return with eax = pointer to PARTITION or NULL. ; 4. Return with eax = pointer to PARTITION or NULL.
pop ecx
ret ret
; This function is called from file_system_lfn. ; This function is called from file_system_lfn.
@ -1061,6 +1085,7 @@ dyndisk_handler:
; 6. Now we are sure that the DISK structure is not going to die at least ; 6. Now we are sure that the DISK structure is not going to die at least
; while we are working with it, so release the global mutex. ; while we are working with it, so release the global mutex.
call mutex_unlock call mutex_unlock
pop ecx ; pop from the stack saved value of esi
; 7. Acquire the mutex for media object. ; 7. Acquire the mutex for media object.
pop edi ; restore edi pop edi ; restore edi
lea ecx, [ebx+DISK.MediaLock] lea ecx, [ebx+DISK.MediaLock]
@ -1175,15 +1200,36 @@ fs_dyndisk:
.main: .main:
cmp ecx, [edx+DISK.NumPartitions] cmp ecx, [edx+DISK.NumPartitions]
jae .notfound jae .notfound
mov dword [esp+32], ERROR_UNKNOWN_FS mov eax, [edx+DISK.Partitions]
mov eax, [eax+ecx*4]
mov edi, [eax+PARTITION.FSUserFunctions]
test edi, edi
jz .nofs
mov ecx, [ebx]
cmp [edi], ecx
jbe .unsupported
push edx
push ebp
mov ebp, eax
call dword [edi+4+ecx*4]
pop ebp
pop edx
mov dword [esp+32], eax
mov dword [esp+20], ebx
.cleanup: .cleanup:
mov esi, edx mov esi, edx
call disk_media_dereference call disk_media_dereference
call disk_dereference call disk_dereference
ret ret
.nofs:
mov dword [esp+32], ERROR_UNKNOWN_FS
jmp .cleanup
.notfound: .notfound:
mov dword [esp+32], ERROR_FILE_NOT_FOUND mov dword [esp+32], ERROR_FILE_NOT_FOUND
jmp .cleanup jmp .cleanup
.unsupported:
mov dword [esp+32], ERROR_UNSUPPORTED_FS
jmp .cleanup
.nomedia: .nomedia:
test ecx, ecx test ecx, ecx
jnz .notfound jnz .notfound
@ -1192,7 +1238,6 @@ fs_dyndisk:
; if the driver does not support insert notifications and we are the only fs ; if the driver does not support insert notifications and we are the only fs
; operation with this disk, issue the fake insert notification; if media is ; operation with this disk, issue the fake insert notification; if media is
; still not inserted, 'disk_media_changed' will detect this and do nothing ; still not inserted, 'disk_media_changed' will detect this and do nothing
;;; push ebx
lea ecx, [edx+DISK.MediaLock] lea ecx, [edx+DISK.MediaLock]
call mutex_lock call mutex_lock
cmp [edx+DISK.MediaRefCount], 1 cmp [edx+DISK.MediaRefCount], 1

View File

@ -18,9 +18,11 @@ fs_read32_sys:
; this request should be processed by hd_read. ; this request should be processed by hd_read.
cmp [ebp+PARTITION.Disk], 'old' cmp [ebp+PARTITION.Disk], 'old'
jnz @f jnz @f
add eax, dword [ebp+PARTITION.FirstSector]
mov [hdd_appl_data], 0 mov [hdd_appl_data], 0
call hd_read call hd_read
mov [hdd_appl_data], 1 ; restore to default state mov [hdd_appl_data], 1 ; restore to default state
mov eax, [hd_error]
ret ret
@@: @@:
; In the normal case, save ecx, set ecx to SysCache and let the common part ; In the normal case, save ecx, set ecx to SysCache and let the common part
@ -41,8 +43,11 @@ fs_read32_app:
; this request should be processed by hd_read. ; this request should be processed by hd_read.
cmp [ebp+PARTITION.Disk], 'old' cmp [ebp+PARTITION.Disk], 'old'
jnz @f jnz @f
add eax, dword [ebp+PARTITION.FirstSector]
mov [hdd_appl_data], 1 mov [hdd_appl_data], 1
jmp hd_read call hd_read
mov eax, [hd_error]
ret
@@: @@:
; In the normal case, save ecx, set ecx to AppCache and let the common part ; In the normal case, save ecx, set ecx to AppCache and let the common part
; do its work. ; do its work.
@ -63,7 +68,7 @@ fs_read32_common:
ret ret
@@: @@:
; 2. Get the absolute sector on the disk. ; 2. Get the absolute sector on the disk.
push edx push edx esi
xor edx, edx xor edx, edx
add eax, dword [ebp+PARTITION.FirstSector] add eax, dword [ebp+PARTITION.FirstSector]
adc edx, dword [ebp+PARTITION.FirstSector+4] adc edx, dword [ebp+PARTITION.FirstSector+4]
@ -75,15 +80,16 @@ fs_read32_common:
push edx ; startsector push edx ; startsector
push eax ; startsector push eax ; startsector
push ebx ; buffer push ebx ; buffer
mov esi, [ebp+PARTITION.Disk]
mov al, DISKFUNC.read mov al, DISKFUNC.read
call disk_call_driver call disk_call_driver
pop ecx pop ecx
pop edx pop esi edx
pop ecx pop ecx
ret ret
.scancache: .scancache:
; 4. Scan the cache. ; 4. Scan the cache.
push esi edi ecx ; scan cache push edi ecx ; scan cache
push edx eax push edx eax
virtual at esp virtual at esp
.sector_lo dd ? .sector_lo dd ?
@ -129,7 +135,7 @@ end virtual
push esp push esp
push edx push edx
push [.sector_lo+12] push [.sector_lo+12]
mov ecx, [.cache] mov ecx, [.cache+16]
mov eax, edi mov eax, edi
shl eax, 9 shl eax, 9
add eax, [ecx+DISKCACHE.data] add eax, [ecx+DISKCACHE.data]
@ -183,9 +189,11 @@ fs_write32_sys:
; this request should be processed by hd_write. ; this request should be processed by hd_write.
cmp [ebp+PARTITION.Disk], 'old' cmp [ebp+PARTITION.Disk], 'old'
jnz @f jnz @f
add eax, dword [ebp+PARTITION.FirstSector]
mov [hdd_appl_data], 0 mov [hdd_appl_data], 0
call hd_write call hd_write
mov [hdd_appl_data], 1 ; restore to default state mov [hdd_appl_data], 1 ; restore to default state
mov eax, [hd_error]
ret ret
@@: @@:
; In the normal case, save ecx, set ecx to SysCache and let the common part ; In the normal case, save ecx, set ecx to SysCache and let the common part
@ -206,8 +214,11 @@ fs_write32_app:
; this request should be processed by hd_write. ; this request should be processed by hd_write.
cmp [ebp+PARTITION.Disk], 'old' cmp [ebp+PARTITION.Disk], 'old'
jnz @f jnz @f
add eax, dword [ebp+PARTITION.FirstSector]
mov [hdd_appl_data], 1 mov [hdd_appl_data], 1
jmp hd_write call hd_write
mov eax, [hd_error]
ret
@@: @@:
; In the normal case, save ecx, set ecx to AppCache and let the common part ; In the normal case, save ecx, set ecx to AppCache and let the common part
; do its work. ; do its work.
@ -227,7 +238,7 @@ fs_write32_common:
pop ecx pop ecx
ret ret
@@: @@:
push edx push edx esi
; 2. Get the absolute sector on the disk. ; 2. Get the absolute sector on the disk.
xor edx, edx xor edx, edx
add eax, dword [ebp+PARTITION.FirstSector] add eax, dword [ebp+PARTITION.FirstSector]
@ -240,15 +251,16 @@ fs_write32_common:
push edx ; startsector push edx ; startsector
push eax ; startsector push eax ; startsector
push ebx ; buffer push ebx ; buffer
mov esi, [ebp+PARTITION.Disk]
mov al, DISKFUNC.write mov al, DISKFUNC.write
call disk_call_driver call disk_call_driver
pop ecx pop ecx
pop edx pop esi edx
pop ecx pop ecx
ret ret
.scancache: .scancache:
; 4. Scan the cache. ; 4. Scan the cache.
push esi edi ecx ; scan cache push edi ecx ; scan cache
push edx eax push edx eax
virtual at esp virtual at esp
.sector_lo dd ? .sector_lo dd ?
@ -305,7 +317,7 @@ end virtual
.yes_in_cache_write: .yes_in_cache_write:
mov dword [esi+4], 2 ; write - differs from hd mov dword [esi+8], 2 ; write - differs from hd
shl edi, 9 shl edi, 9
mov ecx, [.cache] mov ecx, [.cache]
@ -348,7 +360,7 @@ find_empty_slot64:
jb .found_slot ; it's empty or read jb .found_slot ; it's empty or read
dec ecx dec ecx
jnz .search_for_empty jnz .search_for_empty
call write_cache64 ; no empty slots found, write all stdcall write_cache64, [ebp+PARTITION.Disk] ; no empty slots found, write all
test eax, eax test eax, eax
jne .found_slot_access_denied jne .found_slot_access_denied
jmp .search_again ; and start again jmp .search_again ; and start again
@ -359,13 +371,14 @@ find_empty_slot64:
ret ret
; This function is intended to replace the old 'write_cache' function. ; This function is intended to replace the old 'write_cache' function.
proc write_cache64 uses ecx edx esi edi proc write_cache64 uses ecx edx esi edi, disk:dword
locals locals
cache_chain_started dd ? cache_chain_started dd 0
cache_chain_size dd ? cache_chain_size dd ?
cache_chain_pos dd ? cache_chain_pos dd ?
cache_chain_ptr dd ? cache_chain_ptr dd ?
endl endl
saved_esi_pos = 16+12 ; size of local variables + size of registers before esi
; If there is no cache for this disk, nothing to do. ; If there is no cache for this disk, nothing to do.
cmp [esi+DISKCACHE.pointer], 0 cmp [esi+DISKCACHE.pointer], 0
jz .flush jz .flush
@ -432,8 +445,7 @@ endl
test eax, eax test eax, eax
jnz .nothing jnz .nothing
.flush: .flush:
mov esi, [ebp] mov esi, [disk]
mov esi, [esi+PARTITION.Disk]
mov al, DISKFUNC.flush mov al, DISKFUNC.flush
call disk_call_driver call disk_call_driver
.nothing: .nothing:
@ -454,7 +466,7 @@ endl
.write_cache_chain: .write_cache_chain:
pusha pusha
mov edi, [cache_chain_pos] mov edi, [cache_chain_pos]
mov ecx, [ebp-12] mov ecx, [ebp-saved_esi_pos]
shl edi, 9 shl edi, 9
add edi, [ecx+DISKCACHE.data] add edi, [ecx+DISKCACHE.data]
mov ecx, [cache_chain_size] mov ecx, [cache_chain_size]
@ -538,7 +550,7 @@ disk_init_cache:
mov eax, [esi+DISK.SysCache.data_size] mov eax, [esi+DISK.SysCache.data_size]
push ebx push ebx
call calculate_for_hd call calculate_for_hd64
pop ebx pop ebx
add eax, [esi+DISK.SysCache.pointer] add eax, [esi+DISK.SysCache.pointer]
mov [esi+DISK.SysCache.data], eax mov [esi+DISK.SysCache.data], eax
@ -553,7 +565,7 @@ disk_init_cache:
mov eax, [esi+DISK.AppCache.data_size] mov eax, [esi+DISK.AppCache.data_size]
push ebx push ebx
call calculate_for_hd call calculate_for_hd64
pop ebx pop ebx
add eax, [esi+DISK.AppCache.pointer] add eax, [esi+DISK.AppCache.pointer]
mov [esi+DISK.AppCache.data], eax mov [esi+DISK.AppCache.data], eax
@ -579,6 +591,22 @@ disk_init_cache:
mov al, 1 mov al, 1
ret ret
calculate_for_hd64:
push eax
mov ebx, eax
shr eax, 9
lea eax, [eax*3]
shl eax, 2
sub ebx, eax
shr ebx, 9
mov ecx, ebx
shl ebx, 9
pop eax
sub eax, ebx
dec ecx
ret
; This internal function is called from disk_media_dereference to free the ; This internal function is called from disk_media_dereference to free the
; allocated cache, if there is one. ; allocated cache, if there is one.
; esi = pointer to DISK structure ; esi = pointer to DISK structure
@ -590,3 +618,26 @@ disk_free_cache:
stdcall kernel_free, eax stdcall kernel_free, eax
.nothing: .nothing:
ret ret
; This function flushes all modified data from both caches for the given DISK.
; esi = pointer to DISK
disk_sync:
; Compatibility hack: if PARTITION.Disk is 'old', there is no DISK structure,
; this request should be processed by write_cache.
cmp esi, 'old'
jnz @f
mov [hdd_appl_data], 0
call write_cache
mov [hdd_appl_data], 1
jmp write_cache
@@:
; The algorithm is straightforward.
push esi
push esi ; for second write_cache64
push esi ; for first write_cache64
add esi, DISK.SysCache
call write_cache64
add esi, DISK.AppCache - DISK.SysCache
call write_cache64
pop esi
ret

View File

@ -945,3 +945,83 @@ int13_call:
@@: @@:
ret ret
; \end{diamond} ; \end{diamond}
reserve_hd1:
cli
cmp [hd1_status], 0
je reserve_ok1
sti
call change_task
jmp reserve_hd1
reserve_ok1:
push eax
mov eax, [CURRENT_TASK]
shl eax, 5
mov eax, [eax+CURRENT_TASK+TASKDATA.pid]
mov [hd1_status], eax
pop eax
sti
ret
;********************************************
uglobal
hd_in_cache db ?
endg
reserve_hd_channel:
; BIOS disk accesses are protected with common mutex hd1_status
; This must be modified when hd1_status will not be valid!
cmp [hdpos], 0x80
jae .ret
cmp [hdbase], 0x1F0
jne .IDE_Channel_2
.IDE_Channel_1:
cli
cmp [IDE_Channel_1], 0
je .reserve_ok_1
sti
call change_task
jmp .IDE_Channel_1
.IDE_Channel_2:
cli
cmp [IDE_Channel_2], 0
je .reserve_ok_2
sti
call change_task
jmp .IDE_Channel_2
.reserve_ok_1:
mov [IDE_Channel_1], 1
push eax
mov al, 1
jmp @f
.reserve_ok_2:
mov [IDE_Channel_2], 1
push eax
mov al, 3
@@:
cmp [hdid], 1
sbb al, -1
mov [hd_in_cache], al
pop eax
sti
.ret:
ret
free_hd_channel:
; see comment at reserve_hd_channel
cmp [hdpos], 0x80
jae .ret
cmp [hdbase], 0x1F0
jne .IDE_Channel_2
.IDE_Channel_1:
mov [IDE_Channel_1], 0
.ret:
ret
.IDE_Channel_2:
mov [IDE_Channel_2], 0
ret
;********************************************

View File

@ -137,8 +137,6 @@ found_slot_access_denied:
;-------------------------------------------------------------------- ;--------------------------------------------------------------------
align 4 align 4
clear_hd_cache: clear_hd_cache:
mov [fat_in_cache], -1
mov [fat_change], 0
ret ret
;-------------------------------------------------------------------- ;--------------------------------------------------------------------
align 4 align 4

View File

@ -86,16 +86,25 @@ $Revision $
jz image_present jz image_present
ret ret
image_present: image_present:
mov [image_retrieved],1 mov [image_retrieved], 1
ret ret
iglobal
align 4
read_image_fsinfo:
dd 0 ; function: read
dq 0 ; offset: zero
dd 1474560/512 ; size
dd RAMDISK ; buffer
db 0
dd hdsysimage+OS_BASE+0x10000
endg
read_image: read_image:
mov eax, hdsysimage+OS_BASE+0x10000 mov ebx, read_image_fsinfo
mov ebx, 1474560/512 pushad
mov ecx, RAMDISK call file_system_lfn
mov esi, 0 popad
mov edi, 12
call file_read
ret ret
image_retrieved db 0 image_retrieved db 0

View File

@ -263,9 +263,6 @@ DONT_SWITCH equ (OS_BASE+0x000FFFF)
TMP_STACK_TOP equ 0x006CC00 TMP_STACK_TOP equ 0x006CC00
FONT_II equ (OS_BASE+0x006DC00)
FONT_I equ (OS_BASE+0x006E600)
sys_pgdir equ (OS_BASE+0x006F000) sys_pgdir equ (OS_BASE+0x006F000)
DRIVE_DATA equ (OS_BASE+0x0070000) DRIVE_DATA equ (OS_BASE+0x0070000)

View File

@ -810,15 +810,7 @@ proc load_driver stdcall, driver_name:dword
jnz .ok jnz .ok
stdcall kernel_free, [img_base] stdcall kernel_free, [img_base]
cmp dword [file_name+13], 'SOUN'
jnz @f
cmp dword [file_name+17], 'D.ob'
jnz @f
cmp word [file_name+21], 'j'
jnz @f
mov esi, aHDA
jmp .redo
@@:
xor eax, eax xor eax, eax
ret ret
.ok: .ok:

View File

@ -72,6 +72,9 @@ iglobal
szLoadFile db 'LoadFile',0 szLoadFile db 'LoadFile',0
szSendEvent db 'SendEvent',0 szSendEvent db 'SendEvent',0
szSetMouseData db 'SetMouseData',0 szSetMouseData db 'SetMouseData',0
szSetKeyboardData db 'SetKeyboardData',0
szRegKeyboard db 'RegKeyboard',0
szDelKeyboard db 'DelKeyboard',0
szSleep db 'Sleep',0 szSleep db 'Sleep',0
szGetTimerTicks db 'GetTimerTicks',0 szGetTimerTicks db 'GetTimerTicks',0
@ -161,6 +164,9 @@ kernel_export:
dd szLoadFile , load_file ;retval eax, ebx dd szLoadFile , load_file ;retval eax, ebx
dd szSendEvent , send_event ;see EVENT.inc for specification dd szSendEvent , send_event ;see EVENT.inc for specification
dd szSetMouseData , set_mouse_data ;stdcall dd szSetMouseData , set_mouse_data ;stdcall
dd szSetKeyboardData , set_keyboard_data
dd szRegKeyboard , register_keyboard
dd szDelKeyboard , delete_keyboard
dd szSleep , delay_ms dd szSleep , delay_ms
dd szGetTimerTicks , get_timer_ticks dd szGetTimerTicks , get_timer_ticks

View File

@ -341,10 +341,9 @@ free:
; insert_chunk(p,psize); ; insert_chunk(p,psize);
mov eax, esi mov eax, esi
pop esi
mov ecx, edi mov ecx, edi
pop edi call insert_chunk
jmp insert_chunk jmp .fail2
.unl_large: .unl_large:
; unlink_large_chunk((tchunkptr)next); ; unlink_large_chunk((tchunkptr)next);
@ -364,10 +363,9 @@ free:
; insert_chunk(p,psize); ; insert_chunk(p,psize);
mov eax, esi mov eax, esi
pop esi
mov ecx, edi mov ecx, edi
pop edi call insert_chunk
jmp insert_chunk jmp .fail2
.fix_next: .fix_next:
; (p+psize)->prev_foot = psize; ; (p+psize)->prev_foot = psize;
@ -386,10 +384,9 @@ free:
; insert_chunk(p,psize); ; insert_chunk(p,psize);
mov eax, esi mov eax, esi
pop esi
mov ecx, edi mov ecx, edi
pop edi call insert_chunk
jmp insert_chunk jmp .fail2
; param ; param
; ecx = chunk ; ecx = chunk
@ -418,15 +415,11 @@ insert_chunk:
mov [esi+8], edx ;P->fd = F mov [esi+8], edx ;P->fd = F
mov [esi+12], eax ;P->bk = B mov [esi+12], eax ;P->bk = B
pop esi pop esi
mov ecx, mst.mutex
call mutex_unlock
ret ret
.large: .large:
mov ebx, eax mov ebx, eax
call insert_large_chunk call insert_large_chunk
pop esi pop esi
mov ecx, mst.mutex
call mutex_unlock
ret ret

View File

@ -442,72 +442,83 @@ endp
align 4 align 4
proc new_mem_resize stdcall, new_size:dword proc new_mem_resize stdcall, new_size:dword
mov ecx, pg_data.mutex push ebx
call mutex_lock push esi
push edi
mov edx, [current_slot]
cmp [edx+APPDATA.heap_base], 0
jne .exit
mov edi, [new_size] mov edi, [new_size]
add edi, 4095 add edi, 4095
and edi, not 4095 and edi, not 4095
mov [new_size], edi mov [new_size], edi
mov edx, [current_slot]
cmp [edx+APPDATA.heap_base], 0
jne .exit
mov esi, [edx+APPDATA.mem_size] mov esi, [edx+APPDATA.mem_size]
add esi, 4095 add esi, 4095
and esi, not 4095 and esi, not 4095
cmp edi, esi cmp edi, esi
jae .expand ja .expand
je .exit
mov ebx, edi
shr edi, 12 shr edi, 12
shr esi, 12 shr esi, 12
mov ecx, pg_data.mutex
call mutex_lock
@@: @@:
mov eax, [app_page_tabs+edi*4] mov eax, [app_page_tabs+edi*4]
test eax, 1 test eax, 1
jz .next jz .next
mov dword [app_page_tabs+edi*4], 2
mov ebx, edi mov dword [app_page_tabs+edi*4], 0
shl ebx, 12
push eax
invlpg [ebx] invlpg [ebx]
pop eax
call free_page call free_page
.next: .next:
add edi, 1 inc edi
add ebx, 0x1000
cmp edi, esi cmp edi, esi
jb @B jb @B
.update_size:
mov ebx, [new_size]
call update_mem_size
mov ecx, pg_data.mutex mov ecx, pg_data.mutex
call mutex_unlock call mutex_unlock
.update_size:
mov edx, [current_slot]
mov ebx, [new_size]
call update_mem_size
.exit:
pop edi
pop esi
pop ebx
xor eax, eax xor eax, eax
ret ret
.expand: .expand:
push esi mov ecx, pg_data.mutex
push edi call mutex_lock
xchg esi, edi
push esi ;new size
push edi ;old size
add edi, 0x3FFFFF add edi, 0x3FFFFF
and edi, not(0x3FFFFF) and edi, not(0x3FFFFF)
add esi, 0x3FFFFF add esi, 0x3FFFFF
and esi, not(0x3FFFFF) and esi, not(0x3FFFFF)
cmp esi, edi cmp edi, esi
jae .grow jae .grow
@@:
xchg esi, edi
@@:
call alloc_page call alloc_page
test eax, eax test eax, eax
jz .exit_pop jz .exit_fail
stdcall map_page_table, edi, eax stdcall map_page_table, edi, eax
@ -524,51 +535,38 @@ proc new_mem_resize stdcall, new_size:dword
cmp edi, esi cmp edi, esi
jb @B jb @B
.grow: .grow:
;//- pop edi ;old size
pop edi pop ecx ;new size
push edi
mov esi, [pg_data.pages_free]
sub esi, 1
shr edi, 12
cmp esi, edi
jle .out_of_memory
;//-
pop edi
pop esi
@@:
call alloc_page
test eax, eax
jz .exit
stdcall map_page, esi, eax, dword PG_UW
push edi shr edi, 10
mov edi, esi shr ecx, 10
xor eax, eax sub ecx, edi
mov ecx, 1024 shr ecx, 2 ;pages count
cld mov eax, 2
add edi, app_page_tabs
rep stosd rep stosd
pop edi
add esi, 0x1000
cmp esi, edi
jb @B
jmp .update_size
;//-
.exit_pop:
.out_of_memory:
;//-
pop edi
pop esi
.exit:
mov ecx, pg_data.mutex mov ecx, pg_data.mutex
call mutex_unlock call mutex_unlock
jmp .update_size
.exit_fail:
mov ecx, pg_data.mutex
call mutex_unlock
add esp, 8
pop edi
pop esi
pop ebx
xor eax, eax xor eax, eax
inc eax inc eax
ret ret
endp endp
align 4
update_mem_size: update_mem_size:
; in: edx = slot base ; in: edx = slot base
; ebx = new memory size ; ebx = new memory size
@ -608,8 +606,12 @@ update_mem_size:
align 4 align 4
get_pg_addr: get_pg_addr:
sub eax, OS_BASE
cmp eax, 0x400000
jb @f
shr eax, 12 shr eax, 12
mov eax, [page_tabs+eax*4] mov eax, [page_tabs+(eax+(OS_BASE shr 12))*4]
@@:
and eax, 0xFFFFF000 and eax, 0xFFFFF000
ret ret
@ -1253,7 +1255,7 @@ f68:
cmp ecx, OS_BASE cmp ecx, OS_BASE
jae .fail jae .fail
cmp ebx, OS_BASE cmp edx, OS_BASE
jae .fail jae .fail
mov edi, edx mov edi, edx

View File

@ -300,6 +300,7 @@ __exports:
malloc, 'Kmalloc', \ malloc, 'Kmalloc', \
free, 'Kfree', \ free, 'Kfree', \
map_io_mem, 'MapIoMem', \ ; stdcall map_io_mem, 'MapIoMem', \ ; stdcall
map_page, 'MapPage', \ ; stdcall
get_pg_addr, 'GetPgAddr', \ ; eax get_pg_addr, 'GetPgAddr', \ ; eax
\ \
mutex_init, 'MutexInit', \ ; gcc fastcall mutex_init, 'MutexInit', \ ; gcc fastcall

View File

@ -431,6 +431,17 @@ term9:
add eax, 16 add eax, 16
cmp eax, hotkey_list+256*16 cmp eax, hotkey_list+256*16
jb .loop jb .loop
; get process PID
mov eax, esi
shl eax, 5
mov eax, [eax+CURRENT_TASK+TASKDATA.pid]
; compare current lock input with process PID
cmp eax, [PID_lock_input]
jne @f
xor eax, eax
mov [PID_lock_input], eax
@@:
; remove hotkeys in buffer ; remove hotkeys in buffer
mov eax, hotkey_buffer mov eax, hotkey_buffer
.loop2: .loop2:
@ -683,24 +694,22 @@ term9:
ret ret
restore .slot restore .slot
iglobal ;iglobal
if lang eq ru ;if lang eq ru
boot_sched_1 db '‘®§¤ ­¨¥ GDT TSS 㪠§ â¥«ï',0 ; boot_sched_1 db '‘®§¤ ­¨¥ GDT TSS 㪠§ â¥«ï',0
boot_sched_2 db '‘®§¤ ­¨¥ IDT â ¡«¨æë',0 ; boot_sched_2 db '‘®§¤ ­¨¥ IDT â ¡«¨æë',0
else ;else
boot_sched_1 db 'Building gdt tss pointer',0 ; boot_sched_1 db 'Building gdt tss pointer',0
boot_sched_2 db 'Building IDT table',0 ; boot_sched_2 db 'Building IDT table',0
end if ;end if
endg ;endg
build_scheduler: ;build_scheduler:
; mov esi, boot_sched_1
; call boot_log
; call build_process_gdt_tss_pointer
mov esi, boot_sched_1 ; mov esi,boot_sched_2
call boot_log ; call boot_log
; call build_process_gdt_tss_pointer ; ret
; mov esi,boot_sched_2
; call boot_log
ret

View File

@ -84,13 +84,15 @@ proc fs_execute
pushad pushad
cmp [SCR_MODE], word 0x13
jbe @f
pushad pushad
stdcall set_cursor, [def_cursor_clock] stdcall set_cursor, [def_cursor_clock]
mov [handle], eax mov [handle], eax
mov [redrawmouse_unconditional], 1 mov [redrawmouse_unconditional], 1
call __sys_draw_pointer call __sys_draw_pointer
popad popad
@@:
mov [flags], edx mov [flags], edx
; [ebp] pointer to filename ; [ebp] pointer to filename
@ -185,7 +187,7 @@ proc fs_execute
jnz @F jnz @F
lea esi, [filename] lea esi, [filename]
@@: @@:
mov ecx, 8; 8 chars for name mov ecx, 11 ; 11 chars for name! 8 - is old value!
mov edi, [slot_base] mov edi, [slot_base]
.copy_process_name_loop: .copy_process_name_loop:
lodsb lodsb
@ -261,11 +263,14 @@ end if
mov [application_table_status], eax mov [application_table_status], eax
mov eax, esi mov eax, esi
.final: .final:
cmp [SCR_MODE], word 0x13
jbe @f
pushad pushad
stdcall set_cursor, [handle] stdcall set_cursor, [handle]
mov [redrawmouse_unconditional], 1 mov [redrawmouse_unconditional], 1
call __sys_draw_pointer call __sys_draw_pointer
popad popad
@@:
ret ret
endp endp

View File

@ -50,12 +50,12 @@ run_test2:
ret ret
run_test3: run_test3:
; 1024000 times run random operation. ; 1024 times run random operation.
; Randomly select malloc(random size from 1 to 1023) ; Randomly select malloc(random size from 1 to 1023)
; or free(random of previously allocated areas) ; or free(random of previously allocated areas)
mov edi, 0x12345678 mov edi, 0x12345678
xor esi, esi ; 0 areas allocated xor esi, esi ; 0 areas allocated
mov ebx, 1024000 mov ebx, 1024
.loop: .loop:
imul edi, 1103515245 imul edi, 1103515245
add edi, 12345 add edi, 12345
@ -78,7 +78,11 @@ run_test3:
push eax push eax
; mov ecx, [saved_state_num] ; mov ecx, [saved_state_num]
; mov [saved_state+ecx*8], eax ; mov [saved_state+ecx*8], eax
push edi
call malloc_with_test call malloc_with_test
pop ecx
cmp ecx, edi
jnz edi_destroyed
; mov ecx, [saved_state_num] ; mov ecx, [saved_state_num]
; mov [saved_state+ecx*8+4], eax ; mov [saved_state+ecx*8+4], eax
; inc [saved_state_num] ; inc [saved_state_num]
@ -113,7 +117,11 @@ run_test3:
jnz memory_destroyed jnz memory_destroyed
pop eax edi pop eax edi
push ebx edx push ebx edx
push edi
call free call free
pop ecx
cmp ecx, edi
jnz edi_destroyed
pop edx ebx pop edx ebx
dec esi dec esi
pop eax ecx pop eax ecx
@ -150,8 +158,14 @@ malloc_with_test:
ret ret
; Stubs for kernel procedures used by heap code ; Stubs for kernel procedures used by heap code
wait_mutex: mutex_init:
inc dword [ebx] and dword [ecx], 0
ret
mutex_lock:
inc dword [ecx]
ret
mutex_unlock:
dec dword [ecx]
ret ret
kernel_alloc: kernel_alloc:
@ -174,7 +188,7 @@ generic_malloc_fail:
jmp error_with_code jmp error_with_code
check_mutex: check_mutex:
cmp [mst.mutex], 0 cmp dword [mst.mutex], 0
jnz @f jnz @f
ret ret
@@: @@:
@ -195,6 +209,10 @@ memory_destroyed:
mov eax, 5 mov eax, 5
jmp error_with_code jmp error_with_code
edi_destroyed:
mov eax, 6
jmp error_with_code
error_with_code: error_with_code:
mov edx, saved_state_num mov edx, saved_state_num
; eax = error code ; eax = error code
@ -208,6 +226,7 @@ error_with_code:
; Include main heap code ; Include main heap code
include '../proc32.inc' include '../proc32.inc'
include '../struct.inc'
include '../const.inc' include '../const.inc'
include 'malloc.inc' include 'malloc.inc'

View File

@ -49,11 +49,23 @@ keymap_alt:
if lang eq ru if lang eq ru
boot_fonts db '˜à¨äâë § £à㦥­ë',0 boot_initirq db 'ˆ­¨æ¨ «¨§ æ¨ï IRQ',0
boot_picinit db 'ˆ­¨æ¨ «¨§ æ¨ï PIC',0
boot_v86machine db 'ˆ­¨æ¨ «¨§ æ¨ï á¨á⥬ë V86 ¬ è¨­ë',0
boot_inittimer db 'ˆ­¨æ¨ «¨§ æ¨ï á¨á⥬­®£® â ©¬¥à  (IRQ0)',0
boot_initapic db '<27>®¯ë⪠ ¨­¨æ¨ «¨§ æ¨¨ APIC',0
boot_enableirq db '‚ª«îç¨âì ¯à¥à뢠­¨ï 2, 6, 13, 14, 15',0
boot_enablint_ide db '<27> §à¥è¥­¨¥ ¯à¥à뢠­¨© ¢ ª®­â஫«¥à¥ IDE',0
boot_detectfloppy db '<27>®¨áª floppy ¤¨áª®¢®¤®¢',0
boot_detecthdcd db '<27>®¨áª ¦¥áâª¨å ¤¨áª®¢ ¨ ATAPI ¯à¨¢®¤®¢',0
boot_getcache db '<27>®«ã祭¨¥ ¯ ¬ï⨠¤«ï ªíè ',0
boot_detectpart db '<27>®¨áª à §¤¥«®¢ ­  ¤¨áª®¢ëå ãáâனá⢠å',0
boot_init_sys db 'ˆ­¨æ¨ «¨§ æ¨ï á¨á⥬­®£® ª â «®£  /sys',0
boot_loadlibs db '‡ £à㧪  ¡¨¡«¨®â¥ª (.obj)',0
boot_memdetect db 'Š®«¨ç¥á⢮ ®¯¥à â¨¢­®© ¯ ¬ïâ¨',' ',' Œ¡',0 boot_memdetect db 'Š®«¨ç¥á⢮ ®¯¥à â¨¢­®© ¯ ¬ïâ¨',' ',' Œ¡',0
boot_tss db '“áâ ­®¢ª  TSSs',0 boot_tss db '“áâ ­®¢ª  TSSs',0
boot_cpuid db '—⥭¨¥ CPUIDs',0 boot_cpuid db '—⥭¨¥ CPUIDs',0
boot_devices db '<27>®¨áª ãáâனáâ¢',0 ; boot_devices db '<27>®¨áª ãáâனáâ¢',0
boot_timer db '“áâ ­®¢ª  â ©¬¥à ',0 boot_timer db '“áâ ­®¢ª  â ©¬¥à ',0
boot_irqs db '<27>¥à¥®¯à¥¤¥«¥­¨¥ IRQ',0 boot_irqs db '<27>¥à¥®¯à¥¤¥«¥­¨¥ IRQ',0
boot_setmouse db '“áâ ­®¢ª  ¬ëè¨',0 boot_setmouse db '“áâ ­®¢ª  ¬ëè¨',0
@ -69,15 +81,30 @@ if lang eq ru
boot_pal_vga db '“áâ ­®¢ª  VGA 640x480 ¯ «¨âàë',0 boot_pal_vga db '“áâ ­®¢ª  VGA 640x480 ¯ «¨âàë',0
boot_failed db '‡ £à㧪  ¯¥à¢®£® ¯à¨«®¦¥­¨ï ­¥ 㤠« áì',0 boot_failed db '‡ £à㧪  ¯¥à¢®£® ¯à¨«®¦¥­¨ï ­¥ 㤠« áì',0
boot_mtrr db '“áâ ­®¢ª  MTRR',0 boot_mtrr db '“áâ ­®¢ª  MTRR',0
boot_APIC_found db 'APIC ¢ª«î祭', 0
boot_APIC_nfound db 'APIC ­¥ ­ ©¤¥­', 0
if preboot_blogesc if preboot_blogesc
boot_tasking db '‚ᥠ£®â®¢® ¤«ï § ¯ã᪠, ­ ¦¬¨âॠESC ¤«ï áâ àâ ',0 boot_tasking db '‚ᥠ£®â®¢® ¤«ï § ¯ã᪠, ­ ¦¬¨âॠESC ¤«ï áâ àâ ',0
end if end if
else else
boot_fonts db 'Fonts loaded',0 boot_initirq db 'Initialize IRQ',0
boot_picinit db 'Initialize PIC',0
boot_v86machine db 'Initialize system V86 machine',0
boot_inittimer db 'Initialize system timer (IRQ0)',0
boot_initapic db 'Try to initialize APIC',0
boot_enableirq db 'Enable interrupts 2, 6, 13, 14, 15',0
boot_enablint_ide db 'Enable interrupts in IDE controller',0
boot_detectfloppy db 'Search floppy drives',0
boot_detecthdcd db 'Search hard drives and ATAPI drives',0
boot_getcache db 'Get memory for cache',0
boot_detectpart db 'Search partitions on disk devices',0
boot_init_sys db 'Initialize system directory /sys',0
boot_loadlibs db 'Loading librares (.obj)',0
boot_memdetect db 'Determining amount of memory',0 boot_memdetect db 'Determining amount of memory',0
boot_tss db 'Setting TSSs',0 boot_tss db 'Setting TSSs',0
boot_cpuid db 'Reading CPUIDs',0 boot_cpuid db 'Reading CPUIDs',0
boot_devices db 'Detecting devices',0 ; boot_devices db 'Detecting devices',0
boot_setmouse db 'Setting mouse',0 boot_setmouse db 'Setting mouse',0
boot_windefs db 'Setting window defaults',0 boot_windefs db 'Setting window defaults',0
boot_bgr db 'Calculating background',0 boot_bgr db 'Calculating background',0
@ -90,14 +117,14 @@ else
boot_pal_vga db 'Setting VGA 640x480 palette',0 boot_pal_vga db 'Setting VGA 640x480 palette',0
boot_failed db 'Failed to start first app',0 boot_failed db 'Failed to start first app',0
boot_mtrr db 'Setting MTRR',0 boot_mtrr db 'Setting MTRR',0
boot_APIC_found db 'APIC enabled', 0
boot_APIC_nfound db 'APIC not found', 0
if preboot_blogesc if preboot_blogesc
boot_tasking db 'All set - press ESC to start',0 boot_tasking db 'All set - press ESC to start',0
end if end if
end if end if
boot_APIC_found db 'APIC enabled', 0
boot_APIC_nfound db 'APIC not found', 0
;new_process_loading db 'K : New Process - loading',13,10,0 ;new_process_loading db 'K : New Process - loading',13,10,0
;new_process_running db 'K : New Process - done',13,10,0 ;new_process_running db 'K : New Process - done',13,10,0
start_not_enough_memory db 'K : New Process - not enough memory',13,10,0 start_not_enough_memory db 'K : New Process - not enough memory',13,10,0
@ -107,13 +134,10 @@ msg_module db 'in module ',0
msg_version db 'incompatible driver version',13,10,0 msg_version db 'incompatible driver version',13,10,0
msg_www db 'please visit www.kolibrios.org',13,10,0 msg_www db 'please visit www.kolibrios.org',13,10,0
msg_CR db 13,10,0 msg_CR db 13,10,0
aHDA db 'INTEL_HDA',0
intel_str db "GenuineIntel",0 intel_str db "GenuineIntel",0
AMD_str db "AuthenticAMD",0 AMD_str db "AuthenticAMD",0
;szSound db 'SOUND',0
;szInfinity db 'INFINITY',0
szHwMouse db 'ATI2D',0 szHwMouse db 'ATI2D',0
szPS2MDriver db 'PS2MOUSE',0 szPS2MDriver db 'PS2MOUSE',0
;szCOM_MDriver db 'COM_MOUSE',0 ;szCOM_MDriver db 'COM_MOUSE',0
@ -135,9 +159,6 @@ else
ud_user_message db 'Error: unsupported processor instruction',0 ud_user_message db 'Error: unsupported processor instruction',0
end if end if
char db '/sys/FONTS/CHAR.MT',0
char2 db '/sys/FONTS/CHAR2.MT',0
bootpath db '/KOLIBRI ' bootpath db '/KOLIBRI '
bootpath2 db 0 bootpath2 db 0
vmode db '/sys/drivers/VMODE.MDR',0 vmode db '/sys/drivers/VMODE.MDR',0

View File

@ -133,6 +133,10 @@ end_search_partitions_bd:
loop start_search_partitions_bd loop start_search_partitions_bd
jmp end_search_partitions jmp end_search_partitions
problem_partition db 0 ; used for partitions search
include '../fs/part_set.inc'
partition_data_transfer: partition_data_transfer:
mov edi, [transfer_adress] mov edi, [transfer_adress]
mov esi, PARTITION_START ;start of file_system_data mov esi, PARTITION_START ;start of file_system_data

File diff suppressed because it is too large Load Diff

View File

@ -634,31 +634,34 @@ fat_find_lfn:
; [esp+4] = next ; [esp+4] = next
; [esp+8] = first ; [esp+8] = first
; [esp+C]... - possibly parameters for first and next ; [esp+C]... - possibly parameters for first and next
; out: CF=1 - file not found ; out: CF=1 - file not found, eax=error code
; else CF=0, esi->next name component, edi->direntry ; else CF=0, esi->next name component, edi->direntry
pusha pusha
lea eax, [esp+0Ch+20h] lea eax, [esp+0Ch+20h]
call dword [eax-4] call dword [eax-4]
jc .reterr jc .reterr
sub esp, 262*2 ; reserve place for LFN sub esp, 262*2 ; reserve place for LFN
mov ebp, esp
push 0 ; for fat_get_name: read ASCII name push 0 ; for fat_get_name: read ASCII name
.l1: .l1:
lea ebp, [esp+4]
call fat_get_name call fat_get_name
jc .l2 jc .l2
call fat_compare_name call fat_compare_name
jz .found jz .found
.l2: .l2:
mov ebp, [esp+8+262*2+4]
lea eax, [esp+0Ch+20h+262*2+4] lea eax, [esp+0Ch+20h+262*2+4]
call dword [eax-8] call dword [eax-8]
jnc .l1 jnc .l1
add esp, 262*2+4 add esp, 262*2+4
.reterr: .reterr:
mov [esp+28], eax
stc stc
popa popa
ret ret
.found: .found:
add esp, 262*2+4 add esp, 262*2+4
mov ebp, [esp+8]
; if this is LFN entry, advance to true entry ; if this is LFN entry, advance to true entry
cmp byte [edi+11], 0xF cmp byte [edi+11], 0xF
jnz @f jnz @f

File diff suppressed because it is too large Load Diff

View File

@ -169,10 +169,6 @@ endg
fs_info: ;start of code - Mihasik fs_info: ;start of code - Mihasik
push eax push eax
cmp [eax+21], byte 'h'
je fs_info_h
cmp [eax+21], byte 'H'
je fs_info_h
cmp [eax+21], byte 'r' cmp [eax+21], byte 'r'
je fs_info_r je fs_info_r
cmp [eax+21], byte 'R' cmp [eax+21], byte 'R'
@ -189,9 +185,6 @@ endg
mov ebx, 2847 ;total clusters mov ebx, 2847 ;total clusters
mov edx, 512 ;cluster size mov edx, 512 ;cluster size
xor eax, eax ;always 0 xor eax, eax ;always 0
jmp fs_info1
fs_info_h: ;if harddisk
call get_hd_info
fs_info1: fs_info1:
pop edi pop edi
mov [esp+36], eax mov [esp+36], eax
@ -437,32 +430,6 @@ hd_err_return:
jmp file_system_return jmp file_system_return
@@: @@:
cmp dword [esp+20], 0; READ
jne fs_noharddisk_read
mov eax, [esp+0] ; /fname
lea edi, [eax+12]
mov byte [eax], 0 ; path to asciiz
inc eax ; filename start
mov ebx, [esp+12] ; count to read
mov ecx, [esp+8] ; buffer
mov edx, [esp+4]
add edx, 12*2 ; dir start
sub edi, edx ; path length
mov esi, [esp+16] ; blocks to read
call file_read
mov edi, [esp+0]
mov byte [edi], '/'
call free_hd_channel
and [hd1_status], 0
jmp file_system_return
fs_noharddisk_read:
call free_hd_channel call free_hd_channel
and [hd1_status], 0 and [hd1_status], 0

View File

@ -7,6 +7,19 @@
$Revision $ $Revision $
ERROR_SUCCESS = 0
ERROR_DISK_BASE = 1
ERROR_UNSUPPORTED_FS = 2
ERROR_UNKNOWN_FS = 3
ERROR_PARTITION = 4
ERROR_FILE_NOT_FOUND = 5
ERROR_END_OF_FILE = 6
ERROR_MEMORY_POINTER = 7
ERROR_DISK_FULL = 8
ERROR_FAT_TABLE = 9 ;deprecated
ERROR_FS_FAIL = 9
ERROR_ACCESS_DENIED = 10
ERROR_DEVICE = 11
image_of_eax EQU esp+32 image_of_eax EQU esp+32
image_of_ebx EQU esp+20 image_of_ebx EQU esp+20

View File

@ -33,24 +33,8 @@ align 4
fs_dependent_data_start: fs_dependent_data_start:
; FATxx data ; FATxx data
SECTORS_PER_FAT dd 0x1f3a .partition dd ?
NUMBER_OF_FATS dd 0x2 rb 80
SECTORS_PER_CLUSTER dd 0x8
BYTES_PER_SECTOR dd 0x200 ; Note: if BPS <> 512 need lots of changes
ROOT_CLUSTER dd 2 ; first rootdir cluster
FAT_START dd 0 ; start of fat table
ROOT_START dd 0 ; start of rootdir (only fat16)
ROOT_SECTORS dd 0 ; count of rootdir sectors (only fat16)
DATA_START dd 0 ; start of data area (=first cluster 2)
LAST_CLUSTER dd 0 ; last availabe cluster
ADR_FSINFO dd 0 ; used only by fat32
fatRESERVED dd 0x0FFFFFF6
fatBAD dd 0x0FFFFFF7
fatEND dd 0x0FFFFFF8
fatMASK dd 0x0FFFFFFF
fatStartScan dd 2
fs_dependent_data_end: fs_dependent_data_end:
file_system_data_size = $ - PARTITION_START file_system_data_size = $ - PARTITION_START
@ -88,7 +72,6 @@ ext2_data:
.block_size dd ? .block_size dd ?
.count_block_in_block dd ? .count_block_in_block dd ?
.blocks_per_group dd ? .blocks_per_group dd ?
.inodes_per_group dd ?
.global_desc_table dd ? .global_desc_table dd ?
.root_inode dd ? ; pointer to root inode in memory .root_inode dd ? ; pointer to root inode in memory
.inode_size dd ? .inode_size dd ?
@ -427,108 +410,27 @@ boot_read_ok:
cmp [hd_error], 0 cmp [hd_error], 0
jnz problem_fat_dec_count jnz problem_fat_dec_count
cmp word [ebx+0x1fe], 0xaa55; is it valid boot sector? push 0
jnz problem_fat_dec_count mov eax, [PARTITION_END]
sub eax, [PARTITION_START]
movzx eax, word [ebx+0xe]; sectors reserved inc eax
add eax, [PARTITION_START] push eax
mov [FAT_START], eax; fat_start = partition_start + reserved push 0
push [PARTITION_START]
movzx eax, byte [ebx+0xd]; sectors per cluster push ebp
push ebp
mov ebp, esp
mov esi, 'old' ; special value: there is no DISK structure
push 1 ; bootsector read successfully
call fat_create_partition
add esp, 4*7
test eax, eax test eax, eax
jz problem_fat_dec_count jz problem_fat_dec_count
mov [SECTORS_PER_CLUSTER], eax mov [fs_dependent_data_start.partition], eax
mov al, [eax+FAT.fs_type]
movzx ecx, word [ebx+0xb]; bytes per sector mov [fs_type], al
cmp ecx, 0x200
jnz problem_fat_dec_count
mov [BYTES_PER_SECTOR], ecx
movzx eax, word [ebx+0x11]; count of rootdir entries (=0 fat32)
mov edx, 32
mul edx
dec ecx
add eax, ecx ; round up if not equal count
inc ecx ; bytes per sector
div ecx
mov [ROOT_SECTORS], eax; count of rootdir sectors
movzx eax, word [ebx+0x16]; sectors per fat <65536
test eax, eax
jnz fat16_fatsize
mov eax, [ebx+0x24] ; sectors per fat
fat16_fatsize:
mov [SECTORS_PER_FAT], eax
movzx eax, byte [ebx+0x10]; number of fats
test eax, eax ; if 0 it's not fat partition
jz problem_fat_dec_count
mov [NUMBER_OF_FATS], eax
imul eax, [SECTORS_PER_FAT]
add eax, [FAT_START]
mov [ROOT_START], eax; rootdir = fat_start + fat_size * fat_count
add eax, [ROOT_SECTORS]; rootdir sectors should be 0 on fat32
mov [DATA_START], eax; data area = rootdir + rootdir_size
movzx eax, word [ebx+0x13]; total sector count <65536
test eax, eax
jnz fat16_total
mov eax, [ebx+0x20] ; total sector count
fat16_total:
add eax, [PARTITION_START]
dec eax
mov [PARTITION_END], eax
inc eax
sub eax, [DATA_START]; eax = count of data sectors
xor edx, edx
div dword [SECTORS_PER_CLUSTER]
inc eax
mov [LAST_CLUSTER], eax
dec eax ; cluster count
mov [fatStartScan], 2
; limits by Microsoft Hardware White Paper v1.03
cmp eax, 4085 ; 0xff5
jb problem_fat_dec_count; fat12 not supported
cmp eax, 65525 ; 0xfff5
jb fat16_partition
fat32_partition:
mov eax, [ebx+0x2c] ; rootdir cluster
mov [ROOT_CLUSTER], eax
movzx eax, word [ebx+0x30]; fs info sector
add eax, [PARTITION_START]
mov [ADR_FSINFO], eax
call hd_read
mov eax, [ebx+0x1ec]
cmp eax, -1
jz @f
mov [fatStartScan], eax
@@:
popad popad
mov [fatRESERVED], 0x0FFFFFF6
mov [fatBAD], 0x0FFFFFF7
mov [fatEND], 0x0FFFFFF8
mov [fatMASK], 0x0FFFFFFF
mov [fs_type], 32 ; Fat32
call free_hd_channel call free_hd_channel
mov [hd1_status], 0 ; free mov [hd1_status], 0 ; free
ret ret
fat16_partition:
xor eax, eax
mov [ROOT_CLUSTER], eax
popad
mov [fatRESERVED], 0x0000FFF6
mov [fatBAD], 0x0000FFF7
mov [fatEND], 0x0000FFF8
mov [fatMASK], 0x0000FFFF
mov [fs_type], 16 ; Fat16
call free_hd_channel
mov [hd1_status], 0 ; free
ret

Binary file not shown.

Binary file not shown.

View File

@ -229,3 +229,11 @@ draw_text_to_user_area:
popad popad
ret ret
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4
FONT_I:
file 'char.mt'
;------------------------------------------------------------------------------
align 4
FONT_II:
file 'char2.mt'
;------------------------------------------------------------------------------

View File

@ -258,8 +258,8 @@ mouse._.left_button_press_handler: ;///////////////////////////////////////////
call .calculate_e_delta call .calculate_e_delta
.call_window_handler: .call_window_handler:
mov eax, mouse.active_sys_window.old_box ; mov eax, mouse.active_sys_window.old_box
call sys_window_start_moving_handler ; call sys_window_start_moving_handler
.exit: .exit:
ret ret

View File

@ -1026,6 +1026,55 @@ align 4
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 align 4
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
minimize_all_window:
push ebx ecx edx esi edi
pushfd
cli
xor edx, edx
mov eax, 2 ; we do not minimize the kernel thread N1
mov ebx, [TASK_COUNT]
;--------------------------------------
align 4
.loop:
movzx edi, word[WIN_POS + eax * 2]
shl edi, 5
; it is a unused slot?
cmp dword [edi+CURRENT_TASK+TASKDATA.state], 9
je @f
; it is a hidden thread?
lea esi, [edi*8+SLOT_BASE+APPDATA.app_name]
cmp [esi], byte '@'
je @f
; is it already minimized?
test [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED
jnz @f
; no it's not, let's do that
or [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED
inc edx
;--------------------------------------
align 4
@@:
inc eax
cmp eax, ebx
jbe .loop
; If nothing has changed
test edx, edx
jz @f
push edx
call syscall_display_settings._.calculate_whole_screen
call syscall_display_settings._.redraw_whole_screen
pop edx
;--------------------------------------
align 4
@@:
mov eax, edx
popfd
pop edi esi edx ecx ebx
ret
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
minimize_window: ;///////////////////////////////////////////////////////////// minimize_window: ;/////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
;> eax = window number on screen ;> eax = window number on screen
@ -1047,6 +1096,13 @@ minimize_window: ;/////////////////////////////////////////////////////////////
; no it's not, let's do that ; no it's not, let's do that
or [edi + WDATA.fl_wstate], WSTATE_MINIMIZED or [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
; If the window width is 0, then the action is not needed.
cmp [edi + WDATA.box.width], dword 0
je @f
; If the window height is 0, then the action is not needed.
cmp [edi + WDATA.box.height], dword 0
je @f
mov eax, [edi + WDATA.box.left] mov eax, [edi + WDATA.box.left]
mov [draw_limits.left], eax mov [draw_limits.left], eax
mov ecx, eax mov ecx, eax
@ -1057,11 +1113,20 @@ minimize_window: ;/////////////////////////////////////////////////////////////
mov edx, ebx mov edx, ebx
add edx, [edi + WDATA.box.height] add edx, [edi + WDATA.box.height]
mov [draw_limits.bottom], edx mov [draw_limits.bottom], edx
call calculatescreen
xor esi, esi
xor eax, eax
call redrawscreen
; DEBUGF 1, "K : minimize_window\n"
; DEBUGF 1, "K : dl_left %x\n",[draw_limits.left]
; DEBUGF 1, "K : dl_right %x\n",[draw_limits.right]
; DEBUGF 1, "K : dl_top %x\n",[draw_limits.top]
; DEBUGF 1, "K : dl_bottom %x\n",[draw_limits.bottom]
call calculatescreen
; xor esi, esi
; xor eax, eax
mov eax, edi
call redrawscreen
;--------------------------------------
align 4
@@:
pop esi edx ecx ebx eax pop esi edx ecx ebx eax
;-------------------------------------- ;--------------------------------------
align 4 align 4
@ -1266,16 +1331,16 @@ align 4
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 align 4
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
sys_window_start_moving_handler: ;///////////////////////////////////////////// ;sys_window_start_moving_handler: ;/////////////////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
;? <description> ;? <description>
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
;> eax = old (original) window box ;> eax = old (original) window box
;> esi = process slot ;> esi = process slot
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
mov edi, eax ; mov edi, eax
call window._.draw_negative_box ; call window._.draw_negative_box
ret ; ret
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 align 4
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -1287,8 +1352,8 @@ sys_window_end_moving_handler: ;///////////////////////////////////////////////
;> ebx = new (final) window box ;> ebx = new (final) window box
;> esi = process slot ;> esi = process slot
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
mov edi, ebx ; mov edi, ebx
call window._.end_moving__box ; call window._.end_moving__box
mov edi, esi mov edi, esi
shl edi, 5 shl edi, 5
@ -2319,17 +2384,17 @@ align 4
pop esi ebx eax pop esi ebx eax
ret ret
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 ;align 4
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
window._.end_moving__box: ;////////////////////////////////////////////////// ;window._.end_moving__box: ;//////////////////////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
;? Draw positive box ;? Draw positive box
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
;> edi = pointer to BOX struct ;> edi = pointer to BOX struct
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
push eax ebx esi ; push eax ebx esi
xor esi, esi ; xor esi, esi
jmp window._.draw_negative_box.1 ; jmp window._.draw_negative_box.1
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 align 4
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------

View File

@ -5,7 +5,7 @@
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$Revision$ $Revision $
VKEY_LSHIFT = 0000000000000001b VKEY_LSHIFT = 0000000000000001b
@ -34,6 +34,7 @@ uglobal
ctrl_alt_del db 0 ctrl_alt_del db 0
kb_lights db 0 kb_lights db 0
old_kb_lights db 0
align 4 align 4
hotkey_scancodes rd 256 ; we have 256 scancodes hotkey_scancodes rd 256 ; we have 256 scancodes
@ -113,6 +114,83 @@ set_keyboard_data:
pop ebp edi esi ebx pop ebp edi esi ebx
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
struct KEYBOARD
next dd ?
prev dd ?
functions dd ?
userdata dd ?
ends
struct KBDFUNC
strucsize dd ?
close dd ?
setlights dd ?
ends
iglobal
keyboards:
dd keyboards
dd keyboards
endg
uglobal
keyboard_list_mutex MUTEX
endg
register_keyboard:
push ebx
push sizeof.KEYBOARD
pop eax
call malloc
test eax, eax
jz .nothing
mov ecx, [esp+4+4]
mov [eax+KEYBOARD.functions], ecx
mov ecx, [esp+8+4]
mov [eax+KEYBOARD.userdata], ecx
xchg eax, ebx
mov ecx, keyboard_list_mutex
call mutex_lock
mov ecx, keyboards
mov edx, [ecx+KEYBOARD.prev]
mov [ebx+KEYBOARD.next], ecx
mov [ebx+KEYBOARD.prev], edx
mov [edx+KEYBOARD.next], ebx
mov [ecx+KEYBOARD.prev], ebx
mov ecx, [ebx+KEYBOARD.functions]
cmp [ecx+KBDFUNC.strucsize], KBDFUNC.setlights
jbe .unlock
mov ecx, [ecx+KBDFUNC.setlights]
test ecx, ecx
jz .unlock
stdcall ecx, [ebx+KEYBOARD.userdata], dword [kb_lights]
.unlock:
mov ecx, keyboard_list_mutex
call mutex_unlock
xchg eax, ebx
.nothing:
pop ebx
ret 8
delete_keyboard:
push ebx
mov ebx, [esp+4+4]
mov ecx, keyboard_list_mutex
call mutex_lock
mov eax, [ebx+KEYBOARD.next]
mov edx, [ebx+KEYBOARD.prev]
mov [eax+KEYBOARD.prev], edx
mov [edx+KEYBOARD.next], eax
call mutex_unlock
mov ecx, [ebx+KEYBOARD.functions]
cmp [ecx+KBDFUNC.strucsize], KBDFUNC.close
jbe .nothing
mov ecx, [ecx+KBDFUNC.close]
test ecx, ecx
jz .nothing
stdcall ecx, [ebx+KEYBOARD.userdata]
.nothing:
pop ebx
ret 4
;---------------------------------------------------------------------
align 4 align 4
irq1: irq1:
movzx eax, word[TASK_COUNT]; top window process movzx eax, word[TASK_COUNT]; top window process
@ -281,8 +359,11 @@ send_scancode:
xor [kb_state], eax xor [kb_state], eax
xor [kb_lights], bl xor [kb_lights], bl
push ecx
call set_lights call set_lights
pop ecx
.writekey: .writekey:
pushad
; test for system hotkeys ; test for system hotkeys
movzx eax, ch movzx eax, ch
cmp bh, 1 cmp bh, 1
@ -335,9 +416,16 @@ send_scancode:
mov [edi+4], ax mov [edi+4], ax
mov eax, [kb_state] mov eax, [kb_state]
mov [edi+6], ax mov [edi+6], ax
cmp [PID_lock_input], dword 0
je .nohotkey
popad
jmp .exit.irq1 jmp .exit.irq1
;-------------------------------------- ;--------------------------------------
.nohotkey: .nohotkey:
popad
cmp [keyboard_mode], 0; return from keymap cmp [keyboard_mode], 0; return from keymap
jne .scancode jne .scancode
@ -384,10 +472,43 @@ send_scancode:
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
set_lights: set_lights:
push ebx esi
mov ecx, keyboard_list_mutex
call mutex_lock
mov esi, keyboards
.loop:
mov esi, [esi+KEYBOARD.next]
cmp esi, keyboards
jz .done
mov eax, [esi+KEYBOARD.functions]
cmp dword [eax], KBDFUNC.setlights
jbe .loop
mov eax, [eax+KBDFUNC.setlights]
test eax, eax
jz .loop
stdcall eax, [esi+KEYBOARD.userdata], dword [kb_lights]
jmp .loop
.done:
mov ecx, keyboard_list_mutex
call mutex_unlock
pop esi ebx
ret
ps2_set_lights:
mov al, 0xED mov al, 0xED
call kb_write call kb_write
mov al, [kb_lights] mov al, [esp+8]
call kb_write call kb_write
ret 8
;// mike.dld ]
check_lights_state:
mov al, [kb_lights]
cmp al, [old_kb_lights]
jz .nothing
mov [old_kb_lights], al
call set_lights
.nothing:
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
numlock_map: numlock_map:

View File

@ -26,14 +26,14 @@ uglobal
align 4 align 4
mousecount dd 0x0 mousecount dd 0x0
mousedata dd 0x0 mousedata dd 0x0
Y_UNDER_subtraction_CUR_hot_y:
dd 0
X_UNDER_subtraction_CUR_hot_x:
dd 0
Y_UNDER_sub_CUR_hot_y_add_curh: Y_UNDER_sub_CUR_hot_y_add_curh:
dd 0 dw 0
Y_UNDER_subtraction_CUR_hot_y:
dw 0
X_UNDER_sub_CUR_hot_x_add_curh: X_UNDER_sub_CUR_hot_x_add_curh:
dd 0 dw 0
X_UNDER_subtraction_CUR_hot_x:
dw 0
endg endg
iglobal iglobal
@ -124,6 +124,18 @@ save_draw_mouse:
cmp esi, [current_cursor] cmp esi, [current_cursor]
je .draw je .draw
mov eax, [TASK_COUNT]
movzx eax, word [WIN_POS+eax*2]
shl eax, 8
cmp eax, edx
je @F
mov esi, [def_cursor]
cmp esi, [current_cursor]
je .draw
@@:
push esi push esi
call [_display.select_cursor] call [_display.select_cursor]
mov [current_cursor], esi mov [current_cursor], esi
@ -447,15 +459,15 @@ redrawmouse:
mov ax, [Y_UNDER] mov ax, [Y_UNDER]
sub eax, [esi+CURSOR.hot_y] sub eax, [esi+CURSOR.hot_y]
mov [Y_UNDER_subtraction_CUR_hot_y], eax mov [Y_UNDER_subtraction_CUR_hot_y], ax
add eax, [cur.h] add eax, [cur.h]
mov [Y_UNDER_sub_CUR_hot_y_add_curh], eax mov [Y_UNDER_sub_CUR_hot_y_add_curh], ax
mov ax, [X_UNDER] mov ax, [X_UNDER]
sub eax, [esi+CURSOR.hot_x] sub eax, [esi+CURSOR.hot_x]
mov [X_UNDER_subtraction_CUR_hot_x], eax mov [X_UNDER_subtraction_CUR_hot_x], ax
add eax, [cur.w] add eax, [cur.w]
mov [X_UNDER_sub_CUR_hot_x_add_curh], eax mov [X_UNDER_sub_CUR_hot_x_add_curh], ax
;-------------------------------------- ;--------------------------------------
align 4 align 4
@@: @@:

View File

@ -334,6 +334,9 @@ high_code:
mov ecx, disk_list_mutex mov ecx, disk_list_mutex
call mutex_init call mutex_init
mov ecx, keyboard_list_mutex
call mutex_init
mov ecx, unpack_mutex mov ecx, unpack_mutex
call mutex_init call mutex_init
@ -382,11 +385,13 @@ high_code:
movzx eax, word [BOOT_VAR+BOOT_X_RES]; X max movzx eax, word [BOOT_VAR+BOOT_X_RES]; X max
mov [_display.width], eax mov [_display.width], eax
mov [display_width_standard], eax
dec eax dec eax
mov [Screen_Max_X], eax mov [Screen_Max_X], eax
mov [screen_workarea.right], eax mov [screen_workarea.right], eax
movzx eax, word [BOOT_VAR+BOOT_Y_RES]; Y max movzx eax, word [BOOT_VAR+BOOT_Y_RES]; Y max
mov [_display.height], eax mov [_display.height], eax
mov [display_height_standard], eax
dec eax dec eax
mov [Screen_Max_Y], eax mov [Screen_Max_Y], eax
mov [screen_workarea.bottom], eax mov [screen_workarea.bottom], eax
@ -446,6 +451,10 @@ v20ga24:
mov [GETPIXEL], dword Vesa20_getpixel32 mov [GETPIXEL], dword Vesa20_getpixel32
no_mode_0x12: no_mode_0x12:
mov [MOUSE_PICTURE], dword mousepointer
mov [_display.check_mouse], check_mouse_area_for_putpixel
mov [_display.check_m_pixel], check_mouse_area_for_getpixel
; -------- Fast System Call init ---------- ; -------- Fast System Call init ----------
; Intel SYSENTER/SYSEXIT (AMD CPU support it too) ; Intel SYSENTER/SYSEXIT (AMD CPU support it too)
bt [cpu_caps], CAPS_SEP bt [cpu_caps], CAPS_SEP
@ -531,7 +540,7 @@ no_mode_0x12:
mov ax, tss0 mov ax, tss0
ltr ax ltr ax
mov [LFBSize], 0x800000 mov [LFBSize], 0xC00000
call init_LFB call init_LFB
call init_fpu call init_fpu
call init_malloc call init_malloc
@ -602,19 +611,31 @@ no_mode_0x12:
mov [SLOT_BASE + 256 + APPDATA.dir_table], sys_pgdir - OS_BASE mov [SLOT_BASE + 256 + APPDATA.dir_table], sys_pgdir - OS_BASE
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f ; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
mov esi, boot_initirq
call boot_log
call init_irqs call init_irqs
mov esi, boot_picinit
call boot_log
call PIC_init call PIC_init
mov esi, boot_v86machine
call boot_log
; Initialize system V86 machine ; Initialize system V86 machine
call init_sys_v86 call init_sys_v86
mov esi, boot_inittimer
call boot_log
; Initialize system timer (IRQ0) ; Initialize system timer (IRQ0)
call PIT_init call PIT_init
mov esi, boot_initapic
call boot_log
; Try to Initialize APIC ; Try to Initialize APIC
call APIC_init call APIC_init
mov esi, boot_enableirq
call boot_log
; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15) ; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15)
; they are used: when partitions are scanned, hd_read relies on timer ; they are used: when partitions are scanned, hd_read relies on timer
call unmask_timer call unmask_timer
@ -624,6 +645,8 @@ no_mode_0x12:
stdcall enable_irq, 14 stdcall enable_irq, 14
stdcall enable_irq, 15 stdcall enable_irq, 15
mov esi, boot_enablint_ide
call boot_log
; Enable interrupts in IDE controller ; Enable interrupts in IDE controller
mov al, 0 mov al, 0
mov dx, 0x3F6 mov dx, 0x3F6
@ -632,9 +655,25 @@ no_mode_0x12:
out dx, al out dx, al
;!!!!!!!!!!!!!!!!!!!!!!!!!! ;!!!!!!!!!!!!!!!!!!!!!!!!!!
include 'detect/disks.inc' ; mov esi, boot_detectdisks
; call boot_log
;include 'detect/disks.inc'
mov esi, boot_detectfloppy
call boot_log
include 'detect/dev_fd.inc'
mov esi, boot_detecthdcd
call boot_log
include 'detect/dev_hdcd.inc'
mov esi, boot_getcache
call boot_log
include 'detect/getcache.inc'
mov esi, boot_detectpart
call boot_log
include 'detect/sear_par.inc'
;!!!!!!!!!!!!!!!!!!!!!!!!!! ;!!!!!!!!!!!!!!!!!!!!!!!!!!
mov esi, boot_init_sys
call boot_log
call Parser_params call Parser_params
if ~ defined extended_primary_loader if ~ defined extended_primary_loader
@ -654,6 +693,9 @@ if 0
mov ax, [OS_BASE+0x10000+bx_from_load] mov ax, [OS_BASE+0x10000+bx_from_load]
cmp ax, 'r1'; if using not ram disk, then load librares and parameters {SPraid.simba} cmp ax, 'r1'; if using not ram disk, then load librares and parameters {SPraid.simba}
je no_lib_load je no_lib_load
mov esi, boot_loadlibs
call boot_log
; LOADING LIBRARES ; LOADING LIBRARES
stdcall dll.Load, @IMPORT ; loading librares for kernel (.obj files) stdcall dll.Load, @IMPORT ; loading librares for kernel (.obj files)
call load_file_parse_table ; prepare file parse table call load_file_parse_table ; prepare file parse table
@ -661,24 +703,13 @@ if 0
no_lib_load: no_lib_load:
end if end if
; LOAD FONTS I and II
stdcall read_file, char, FONT_I, 0, 2304
stdcall read_file, char2, FONT_II, 0, 2560
mov [MOUSE_PICTURE], dword mousepointer
mov [_display.check_mouse], check_mouse_area_for_putpixel
mov [_display.check_m_pixel], check_mouse_area_for_getpixel
mov esi, boot_fonts
call boot_log
; Display APIC status ; Display APIC status
mov esi, boot_APIC_found mov esi, boot_APIC_found
cmp [irq_mode], IRQ_APIC cmp [irq_mode], IRQ_APIC
je @f je @f
mov esi, boot_APIC_nfound mov esi, boot_APIC_nfound
@@: @@:
call boot_log
; PRINT AMOUNT OF MEMORY ; PRINT AMOUNT OF MEMORY
mov esi, boot_memdetect mov esi, boot_memdetect
@ -701,10 +732,10 @@ end if
; BUILD SCHEDULER ; BUILD SCHEDULER
call build_scheduler; sys32.inc ; call build_scheduler; sys32.inc
mov esi, boot_devices ; mov esi, boot_devices
call boot_log ; call boot_log
mov [pci_access_enabled], 1 mov [pci_access_enabled], 1
@ -901,6 +932,8 @@ first_app_found:
; SET KEYBOARD PARAMETERS ; SET KEYBOARD PARAMETERS
mov al, 0xf6 ; reset keyboard, scan enabled mov al, 0xf6 ; reset keyboard, scan enabled
call kb_write call kb_write
test ah, ah
jnz .no_keyboard
; wait until 8042 is ready ; wait until 8042 is ready
xor ecx, ecx xor ecx, ecx
@ -909,6 +942,15 @@ first_app_found:
and al, 00000010b and al, 00000010b
loopnz @b loopnz @b
iglobal
align 4
ps2_keyboard_functions:
dd .end - $
dd 0 ; no close
dd ps2_set_lights
.end:
endg
stdcall register_keyboard, ps2_keyboard_functions, 0
; mov al, 0xED ; Keyboard LEDs - only for testing! ; mov al, 0xED ; Keyboard LEDs - only for testing!
; call kb_write ; call kb_write
; call kb_read ; call kb_read
@ -926,6 +968,7 @@ first_app_found:
call set_lights call set_lights
;// mike.dld ] ;// mike.dld ]
stdcall attach_int_handler, 1, irq1, 0 stdcall attach_int_handler, 1, irq1, 0
.no_keyboard:
; SET MOUSE ; SET MOUSE
@ -1047,6 +1090,7 @@ osloop:
call checkidle call checkidle
call check_fdd_motor_status call check_fdd_motor_status
call check_ATAPI_device_event call check_ATAPI_device_event
call check_lights_state
call check_timers call check_timers
jmp osloop jmp osloop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -2010,6 +2054,8 @@ sys_system_table:
dd sysfn_meminfo ; 20 = get extended memory info dd sysfn_meminfo ; 20 = get extended memory info
dd sysfn_pid_to_slot ; 21 = get slot number for pid dd sysfn_pid_to_slot ; 21 = get slot number for pid
dd sysfn_min_rest_window ; 22 = minimize and restore any window dd sysfn_min_rest_window ; 22 = minimize and restore any window
dd sysfn_min_windows ; 23 = minimize all windows
dd sysfn_set_screen_sizes ; 24 = set screen sizes for Vesa
sysfn_num = ($ - sys_system_table)/4 sysfn_num = ($ - sys_system_table)/4
endg endg
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -2083,8 +2129,6 @@ sysfn_terminate: ; 18.2 = TERMINATE
jne noatsc jne noatsc
and [application_table_status], 0 and [application_table_status], 0
noatsc: noatsc:
; for guarantee the updating data
call change_task
noprocessterminate: noprocessterminate:
add esp, 4 add esp, 4
ret ret
@ -2324,20 +2368,19 @@ sysfn_getfreemem:
shl eax, 2 shl eax, 2
mov [esp+32], eax mov [esp+32], eax
ret ret
;------------------------------------------------------------------------------
sysfn_getallmem: sysfn_getallmem:
mov eax, [MEM_AMOUNT] mov eax, [MEM_AMOUNT]
shr eax, 10 shr eax, 10
mov [esp+32], eax mov [esp+32], eax
ret ret
;------------------------------------------------------------------------------
; // Alver, 2007-22-08 // {
sysfn_pid_to_slot: sysfn_pid_to_slot:
mov eax, ecx mov eax, ecx
call pid_to_slot call pid_to_slot
mov [esp+32], eax mov [esp+32], eax
ret ret
;------------------------------------------------------------------------------
sysfn_min_rest_window: sysfn_min_rest_window:
pushad pushad
mov eax, edx ; ebx - operating mov eax, edx ; ebx - operating
@ -2368,14 +2411,52 @@ sysfn_min_rest_window:
dec eax dec eax
mov [esp+32], eax mov [esp+32], eax
ret ret
; } \\ Alver, 2007-22-08 \\ ;------------------------------------------------------------------------------
sysfn_min_windows:
call minimize_all_window
mov [esp+32], eax
call change_task
ret
;------------------------------------------------------------------------------
sysfn_set_screen_sizes:
cmp [SCR_MODE], word 0x13
jbe .exit
cmp [_display.select_cursor], select_cursor
jne .exit
cmp ecx, [display_width_standard]
ja .exit
cmp edx, [display_height_standard]
ja .exit
pushfd
cli
mov eax, ecx
mov ecx, [BytesPerScanLine]
mov [_display.width], eax
dec eax
mov [_display.height], edx
dec edx
; eax - new Screen_Max_X
; edx - new Screen_Max_Y
mov [do_not_touch_winmap], 1
call set_screen
mov [do_not_touch_winmap], 0
popfd
call change_task
.exit:
ret
;------------------------------------------------------------------------------
uglobal uglobal
;// mike.dld, 2006-29-01 [
screen_workarea RECT screen_workarea RECT
;// mike.dld, 2006-29-01 ] display_width_standard dd 0
display_height_standard dd 0
do_not_touch_winmap db 0
window_minimize db 0 window_minimize db 0
sound_flag db 0 sound_flag db 0
endg endg
UID_NONE=0 UID_NONE=0
@ -2430,10 +2511,9 @@ sys_background:
cmp ebx, 1 ; BACKGROUND SIZE cmp ebx, 1 ; BACKGROUND SIZE
jnz nosb1 jnz nosb1
test ecx, ecx test ecx, ecx
; cmp ecx,0
jz sbgrr jz sbgrr
test edx, edx test edx, edx
; cmp edx,0
jz sbgrr jz sbgrr
;-------------------------------------- ;--------------------------------------
align 4 align 4
@ -2703,6 +2783,49 @@ nosb7:
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 align 4
nosb8: nosb8:
cmp ebx, 9
jnz nosb9
; ecx = [left]*65536 + [right]
; edx = [top]*65536 + [bottom]
mov eax, [Screen_Max_X]
mov ebx, [Screen_Max_Y]
; check [right]
cmp cx, ax
ja .exit
; check [left]
ror ecx, 16
cmp cx, ax
ja .exit
; check [bottom]
cmp dx, bx
ja .exit
; check [top]
ror edx, 16
cmp dx, bx
ja .exit
movzx eax, cx ; [left]
movzx ebx, dx ; [top]
shr ecx, 16 ; [right]
shr edx, 16 ; [bottom]
mov [background_defined], 1
mov [draw_data+32 + RECT.left], eax
mov [draw_data+32 + RECT.top], ebx
mov [draw_data+32 + RECT.right], ecx
mov [draw_data+32 + RECT.bottom], edx
inc byte[REDRAW_BACKGROUND]
;--------------------------------------
align 4
.exit:
ret
;------------------------------------------------------------------------------
align 4
nosb9:
ret ret
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 align 4
@ -3297,9 +3420,7 @@ align 4
;-------------------------------------- ;--------------------------------------
align 4 align 4
mouse_not_active: mouse_not_active:
xor eax, eax cmp byte[REDRAW_BACKGROUND], 0 ; background update ?
xchg al, [REDRAW_BACKGROUND]
test al, al ; background update ?
jz nobackgr jz nobackgr
cmp [background_defined], 0 cmp [background_defined], 0
@ -3320,6 +3441,9 @@ align 4
pop eax pop eax
call drawbackground call drawbackground
; DEBUGF 1, "K : drawbackground\n"
; DEBUGF 1, "K : backg x %x\n",[BG_Rect_X_left_right]
; DEBUGF 1, "K : backg y %x\n",[BG_Rect_Y_top_bottom]
;--------- set event 5 start ---------- ;--------- set event 5 start ----------
push ecx edi push ecx edi
xor edi, edi xor edi, edi
@ -3334,9 +3458,7 @@ set_bgr_event:
; call change_task - because the application must have time to call f.15.8 ; call change_task - because the application must have time to call f.15.8
call change_task call change_task
;--------- set event 5 stop ----------- ;--------- set event 5 stop -----------
xor eax, eax dec byte[REDRAW_BACKGROUND] ; got new update request?
xchg al, [REDRAW_BACKGROUND]
test al, al ; got new update request?
jnz @b jnz @b
mov [draw_data+32 + RECT.left], eax mov [draw_data+32 + RECT.left], eax
@ -3993,6 +4115,14 @@ align 4
jmp sys_putimage_bpp jmp sys_putimage_bpp
;-------------------------------------- ;--------------------------------------
align 4 align 4
@@:
cmp esi, 9
jnz @f
mov ebp, putimage_get9bpp
mov esi, putimage_init9bpp
jmp sys_putimage_bpp
;--------------------------------------
align 4
@@: @@:
cmp esi, 15 cmp esi, 15
jnz @f jnz @f
@ -4054,6 +4184,7 @@ align 4
putimage_init24bpp: putimage_init24bpp:
lea eax, [eax*3] lea eax, [eax*3]
putimage_init8bpp: putimage_init8bpp:
putimage_init9bpp:
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 16 align 16
@ -4074,6 +4205,14 @@ putimage_get8bpp:
inc esi inc esi
ret 4 ret 4
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 16
putimage_get9bpp:
lodsb
mov ah, al
shl eax, 8
mov al, ah
ret 4
;-----------------------------------------------------------------------------
align 4 align 4
putimage_init1bpp: putimage_init1bpp:
add eax, ecx add eax, ecx
@ -4500,17 +4639,17 @@ f66call:
dd sys_process_def.1 ; 1 = set keyboard mode dd sys_process_def.1 ; 1 = set keyboard mode
dd sys_process_def.2 ; 2 = get keyboard mode dd sys_process_def.2 ; 2 = get keyboard mode
dd sys_process_def.3 ; 3 = get keyboard ctrl, alt, shift dd sys_process_def.3 ; 3 = get keyboard ctrl, alt, shift
dd sys_process_def.4 dd sys_process_def.4 ; 4 = set system-wide hotkey
dd sys_process_def.5 dd sys_process_def.5 ; 5 = delete installed hotkey
dd sys_process_def.6 ; 6 = disable input, work only hotkeys
dd sys_process_def.7 ; 7 = enable input, opposition to f.66.6
endg endg
;-----------------------------------------------------------------------------
align 4
sys_process_def: sys_process_def:
dec ebx dec ebx
cmp ebx, 5 cmp ebx, 7
jae .not_support ;if >=6 then or eax,-1 jae .not_support ;if >=8 then or eax,-1
mov edi, [CURRENT_TASK] mov edi, [CURRENT_TASK]
jmp dword [f66call+ebx*4] jmp dword [f66call+ebx*4]
@ -4518,33 +4657,28 @@ sys_process_def:
.not_support: .not_support:
or eax, -1 or eax, -1
ret ret
;-----------------------------------------------------------------------------
align 4
.1: .1:
shl edi, 8 shl edi, 8
mov [edi+SLOT_BASE + APPDATA.keyboard_mode], cl mov [edi+SLOT_BASE + APPDATA.keyboard_mode], cl
ret ret
;-----------------------------------------------------------------------------
align 4
.2: ; 2 = get keyboard mode .2: ; 2 = get keyboard mode
shl edi, 8 shl edi, 8
movzx eax, byte [SLOT_BASE+edi + APPDATA.keyboard_mode] movzx eax, byte [SLOT_BASE+edi + APPDATA.keyboard_mode]
mov [esp+32], eax mov [esp+32], eax
ret ret
; xor eax,eax ;-----------------------------------------------------------------------------
; movzx eax,byte [shift] align 4
; movzx ebx,byte [ctrl]
; shl ebx,2
; add eax,ebx
; movzx ebx,byte [alt]
; shl ebx,3
; add eax,ebx
.3: ;3 = get keyboard ctrl, alt, shift .3: ;3 = get keyboard ctrl, alt, shift
;// mike.dld [
mov eax, [kb_state] mov eax, [kb_state]
;// mike.dld ]
mov [esp+32], eax mov [esp+32], eax
ret ret
;-----------------------------------------------------------------------------
align 4
.4: .4:
mov eax, hotkey_list mov eax, hotkey_list
@@: @@:
@ -4569,7 +4703,8 @@ sys_process_def:
@@: @@:
and dword [esp+32], 0 and dword [esp+32], 0
ret ret
;-----------------------------------------------------------------------------
align 4
.5: .5:
movzx ebx, cl movzx ebx, cl
lea ebx, [hotkey_scancodes+ebx*4] lea ebx, [hotkey_scancodes+ebx*4]
@ -4603,8 +4738,45 @@ sys_process_def:
mov [eax], edx mov [eax], edx
mov [esp+32], edx mov [esp+32], edx
ret ret
;-----------------------------------------------------------------------------
align 4
.6:
pushfd
cli
mov eax, [PID_lock_input]
test eax, eax
jnz @f
; get current PID
mov eax, [CURRENT_TASK]
shl eax, 5
mov eax, [eax+CURRENT_TASK+TASKDATA.pid]
; set current PID for lock input
mov [PID_lock_input], eax
@@:
popfd
ret
;-----------------------------------------------------------------------------
align 4
.7:
mov eax, [PID_lock_input]
test eax, eax
jz @f
; get current PID
mov ebx, [CURRENT_TASK]
shl ebx, 5
mov ebx, [ebx+CURRENT_TASK+TASKDATA.pid]
; compare current lock input with current PID
cmp ebx, eax
jne @f
xor eax, eax
mov [PID_lock_input], eax
@@:
ret
;-----------------------------------------------------------------------------
uglobal
PID_lock_input dd 0x0
endg
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 61 sys function. ;; ;; 61 sys function. ;;
;; in eax=61,ebx in [1..3] ;; ;; in eax=61,ebx in [1..3] ;;
@ -5020,22 +5192,6 @@ syscall_threads: ; CreateThreads
mov [esp+32], eax mov [esp+32], eax
ret ret
align 4
read_from_hd: ; Read from hd - fn not in use
mov edi, [TASK_BASE]
add edi, TASKDATA.mem_start
add eax, [edi]
add ecx, [edi]
add edx, [edi]
call file_read
mov [esp+36], eax
mov [esp+24], ebx
ret
paleholder: paleholder:
ret ret
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -5071,6 +5227,10 @@ calculate_fast_getting_offset_for_LFB:
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 align 4
set_screen: set_screen:
; in:
; eax - new Screen_Max_X
; ecx - new BytesPerScanLine
; edx - new Screen_Max_Y
cmp eax, [Screen_Max_X] cmp eax, [Screen_Max_X]
jne .set jne .set
@ -5094,6 +5254,9 @@ set_screen:
pushad pushad
cmp [do_not_touch_winmap], 1
je @f
stdcall kernel_free, [_WinMapAddress] stdcall kernel_free, [_WinMapAddress]
mov eax, [_display.width] mov eax, [_display.width]
@ -5104,9 +5267,18 @@ set_screen:
mov [_WinMapAddress], eax mov [_WinMapAddress], eax
test eax, eax test eax, eax
jz .epic_fail jz .epic_fail
; store for f.18.24
mov eax, [_display.width]
mov [display_width_standard], eax
mov eax, [_display.height]
mov [display_height_standard], eax
@@:
call calculate_fast_getting_offset_for_WinMapAddress call calculate_fast_getting_offset_for_WinMapAddress
; for Qemu or non standart video cards
; Unfortunately [BytesPerScanLine] does not always
; equal to [_display.width] * [ScreenBPP] / 8
call calculate_fast_getting_offset_for_LFB
popad popad
call repos_windows call repos_windows

View File

@ -147,8 +147,8 @@
; 0x8006CC00 -> 6DBFF stack at boot time (4Kb) ; 0x8006CC00 -> 6DBFF stack at boot time (4Kb)
; ;
; 0x8006DC00 -> 6E5FF basic text font II ; 0x8006DC00 -> 6E5FF free (2560)
; 0x8006E600 -> 6Efff basic text font I ; 0x8006E600 -> 6Efff free (2560)
; 0x8006F000 -> 6FFFF main page directory ; 0x8006F000 -> 6FFFF main page directory
; 0x80070000 -> 7FFFF data of retrieved disks and partitions (Mario79) ; 0x80070000 -> 7FFFF data of retrieved disks and partitions (Mario79)

View File

@ -14,8 +14,8 @@ ends
struct BLITTER struct BLITTER
dc BLITTER_BLOCK dc RECT
sc BLITTER_BLOCK sc RECT
dst_x dd ? ; 32 dst_x dd ? ; 32
dst_y dd ? ; 36 dst_y dd ? ; 36
src_x dd ? ; 40 src_x dd ? ; 40
@ -28,145 +28,84 @@ struct BLITTER
ends ends
align 4
__L1OutCode:
push ebx
mov ebx, 8
cmp edx, [eax]
jl .L2
xor ebx, ebx
cmp edx, [eax+8]
setg bl
sal ebx, 2
.L2:
cmp ecx, [eax+4]
jge .L3
or ebx, 1
jmp .L4
.L3:
cmp ecx, [eax+12]
jle .L4
or ebx, 2
.L4:
mov eax, ebx
pop ebx
ret
align 4 align 4
block_clip: block_clip:
push ebp ;esi= clip RECT ptr
push edi ;edi= RECT ptr
push esi ;return code:
;eax= 0 - draw, 1 - don't draw
push ebx push ebx
sub esp, 4
mov ebx, eax mov eax, [edi+RECT.left]
mov [esp], edx mov ebx, [edi+RECT.right]
mov ebp, ecx mov ecx, [esi+RECT.left] ;clip.left
mov ecx, [ecx] mov edx, [esi+RECT.right] ;clip.right
mov edx, [edx]
call __L1OutCode
mov esi, eax cmp eax, edx ;left >= clip.right
mov edx, [esp+28] jge .fail
mov ecx, [edx]
.L21:
mov eax, [esp+24]
mov edx, [eax]
mov eax, ebx
call __L1OutCode
mov edi, eax cmp ebx, ecx ;right < clip.left
.L20: jl .fail
mov eax, edi
and eax, esi cmp eax, ecx ;left >= clip.left
jne .L9 jae @F
cmp esi, edi
je .L9 mov eax, ecx
test esi, esi @@:
jne .L10 mov [edi+RECT.left], eax
test edi, 1
je .L11 cmp ebx, edx ;right <= clip.right
mov eax, [ebx+4] jle @f
jmp .L25 mov ebx, edx
.L11: @@:
test edi, 2 mov [edi+RECT.right], ebx
je .L13
mov eax, [ebx+12] mov eax, [edi+RECT.top]
.L25: mov ebx, [edi+RECT.bottom]
mov edx, [esp+28] mov ecx, [esi+RECT.top] ;clip.top
jmp .L22 mov edx, [esi+RECT.bottom] ;clip.bottom
.L13:
test edi, 4 cmp eax, edx ;top >= clip.bottom
je .L14 jge .fail
mov eax, [ebx+8]
jmp .L26 cmp ebx, ecx ;bottom < clip.top
.L14: jl .fail
and edi, 8
je .L12 cmp eax, ecx ;top >= clip.top
mov eax, [ebx] jae @F
.L26:
mov edx, [esp+24] mov eax, ecx
.L22: @@:
mov [edx], eax mov [edi+RECT.top], eax
.L12:
mov eax, [esp+28] cmp ebx, edx ;bottom <= clip.bottom
mov ecx, [eax] jle @f
jmp .L21 mov ebx, edx
.L10: @@:
test esi, 1 mov [edi+RECT.bottom], ebx
je .L16
mov eax, [ebx+4]
jmp .L23
.L16:
test esi, 2
je .L18
mov eax, [ebx+12]
.L23:
mov [ebp+0], eax
jmp .L17
.L18:
test esi, 4
je .L19
mov eax, [ebx+8]
jmp .L24
.L19:
and esi, 8
je .L17
mov eax, [ebx]
.L24:
mov edx, [esp]
mov [edx], eax
.L17:
mov ecx, [ebp+0]
mov eax, [esp]
mov edx, [eax]
mov eax, ebx
call __L1OutCode
mov esi, eax
jmp .L20
.L9:
add esp, 4
pop ebx pop ebx
pop esi xor eax, eax
pop edi
pop ebp
ret ret
.fail:
pop ebx
mov eax, 1
ret
align 4 align 4
blit_clip: blit_clip:
.sx0 equ 36 .sx0 equ 8
.sy0 equ 32 .sy0 equ 12
.sx1 equ 28 .sx1 equ 16
.sy1 equ 24 .sy1 equ 20
.dx0 equ 20 .dx0 equ 24
.dy0 equ 16 .dy0 equ 28
.dx1 equ 12 .dx1 equ 32
.dy1 equ 8 .dy1 equ 36
push edi push edi
@ -180,25 +119,17 @@ blit_clip:
mov eax, [ecx+BLITTER.src_y] mov eax, [ecx+BLITTER.src_y]
mov [esp+.sy0], eax mov [esp+.sy0], eax
add edx, [ecx+BLITTER.w] add edx, [ecx+BLITTER.w]
dec edx
mov [esp+.sx1], edx
add eax, [ecx+BLITTER.h] add eax, [ecx+BLITTER.h]
dec eax mov [esp+.sx1], edx
mov [esp+.sy1], eax mov [esp+.sy1], eax
lea ecx, [esp+.sy0] lea edi, [esp+.sx0]
lea edx, [esp+.sx0] lea esi, [ebx+BLITTER.sc]
lea eax, [ebx+BLITTER.sc]
lea esi, [esp+.sy1]
mov [esp+4], esi
lea esi, [esp+.sx1]
mov [esp], esi
call block_clip call block_clip
mov esi, 1
test eax, eax test eax, eax
jne .L28 mov esi, 1
jnz .done
mov edi, [esp+.sx0] mov edi, [esp+.sx0]
mov edx, [ebx+BLITTER.dst_x] mov edx, [ebx+BLITTER.dst_x]
@ -211,6 +142,7 @@ blit_clip:
add eax, ecx add eax, ecx
sub eax, [ebx+BLITTER.src_y] sub eax, [ebx+BLITTER.src_y]
mov [esp+.dy0], eax mov [esp+.dy0], eax
sub edx, edi sub edx, edi
add edx, [esp+.sx1] add edx, [esp+.sx1]
mov [esp+.dx1], edx mov [esp+.dx1], edx
@ -219,26 +151,20 @@ blit_clip:
add eax, [esp+.sy1] add eax, [esp+.sy1]
mov [esp+.dy1], eax mov [esp+.dy1], eax
lea ecx, [esp+.dy0] lea edi, [esp+.dx0]
lea edx, [esp+.dx0] lea esi, [ebx+BLITTER.dc]
lea eax, [esp+.dy1]
mov [esp+4], eax
lea eax, [esp+.dx1]
mov [esp], eax
mov eax, ebx
call block_clip call block_clip
test eax, eax test eax, eax
jne .L28 mov esi, 1
jnz .done
mov edx, [esp+.dx0] mov edx, [esp+.dx0]
mov eax, [esp+.dx1] mov eax, [esp+.dx1]
inc eax
sub eax, edx sub eax, edx
mov [ebx+BLITTER.w], eax mov [ebx+BLITTER.w], eax
mov eax, [esp+.dy0] mov eax, [esp+.dy0]
mov ecx, [esp+.dy1] mov ecx, [esp+.dy1]
inc ecx
sub ecx, eax sub ecx, eax
mov [ebx+BLITTER.h], ecx mov [ebx+BLITTER.h], ecx
@ -254,7 +180,7 @@ blit_clip:
mov [ebx+BLITTER.dst_x], edx mov [ebx+BLITTER.dst_x], edx
mov [ebx+BLITTER.dst_y], eax mov [ebx+BLITTER.dst_y], eax
xor esi, esi xor esi, esi
.L28: .done:
mov eax, esi mov eax, esi
add esp, 40 add esp, 40
pop ebx pop ebx
@ -274,10 +200,7 @@ purge .dy1
ret ret
align 4 align 4
blit_32: blit_32:
push ebp push ebp
push edi push edi
@ -288,22 +211,24 @@ blit_32:
mov eax, [TASK_BASE] mov eax, [TASK_BASE]
mov ebx, [eax-twdw + WDATA.box.width] mov ebx, [eax-twdw + WDATA.box.width]
mov edx, [eax-twdw + WDATA.box.height] mov edx, [eax-twdw + WDATA.box.height]
inc ebx
inc edx
xor eax, eax xor eax, eax
mov [esp+BLITTER.dc.xmin], eax mov [esp+BLITTER.dc.left], eax
mov [esp+BLITTER.dc.ymin], eax mov [esp+BLITTER.dc.top], eax
mov [esp+BLITTER.dc.xmax], ebx mov [esp+BLITTER.dc.right], ebx
mov [esp+BLITTER.dc.ymax], edx mov [esp+BLITTER.dc.bottom], edx
mov [esp+BLITTER.sc.xmin], eax mov [esp+BLITTER.sc.left], eax
mov [esp+BLITTER.sc.ymin], eax mov [esp+BLITTER.sc.top], eax
mov eax, [ecx+24] mov eax, [ecx+24]
dec eax
mov [esp+BLITTER.sc.xmax], eax mov [esp+BLITTER.sc.right], eax
mov eax, [ecx+28] mov eax, [ecx+28]
dec eax
mov [esp+BLITTER.sc.ymax], eax mov [esp+BLITTER.sc.bottom], eax
mov eax, [ecx] mov eax, [ecx]
mov [esp+BLITTER.dst_x], eax mov [esp+BLITTER.dst_x], eax
@ -429,7 +354,7 @@ align 4
.done: .done:
; call [draw_pointer] ; call [draw_pointer]
call __sys_draw_pointer ; call __sys_draw_pointer
.L57: .L57:
add esp, 72 add esp, 72
pop ebx pop ebx

View File

@ -447,16 +447,11 @@ endp
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 align 4
proc delete_cursor stdcall, hcursor:dword proc delete_cursor stdcall, hcursor:dword
locals
hsrv dd ? ; DEBUGF 1,'K : delete_cursor %x\n', [hcursor]
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
mov esi, [hcursor] mov esi, [hcursor]
cmp [esi+CURSOR.magic], 'CURS' cmp [esi+CURSOR.magic], 'CURS'
jne .fail jne .fail
@ -642,6 +637,8 @@ align 4
sub edi, [y] sub edi, [y]
inc ebx inc ebx
inc edi inc edi
sub ebx, [_dx]
sub edi, [_dy]
mov [cur.w], ebx mov [cur.w], ebx
mov [cur.h], edi mov [cur.h], edi
@ -758,6 +755,8 @@ align 4
sub edi, [y] sub edi, [y]
inc ebx inc ebx
inc edi inc edi
sub ebx, [_dx]
sub edi, [_dy]
mov [cur.w], ebx mov [cur.w], ebx
mov [cur.h], edi mov [cur.h], edi
@ -835,10 +834,10 @@ check_mouse_area_for_getpixel_new:
;-------------------------------------- ;--------------------------------------
push eax ebx push eax ebx
; offset X ; offset X
mov ecx, [X_UNDER_subtraction_CUR_hot_x] movzx ecx, word [X_UNDER_subtraction_CUR_hot_x]
sub eax, ecx ; x1 sub eax, ecx ; x1
; offset Y ; offset Y
mov ecx, [Y_UNDER_subtraction_CUR_hot_y] movzx ecx, word [Y_UNDER_subtraction_CUR_hot_y]
sub ebx, ecx ; y1 sub ebx, ecx ; y1
;-------------------------------------- ;--------------------------------------
; ebx = offset y ; ebx = offset y
@ -874,41 +873,49 @@ check_mouse_area_for_putpixel_new:
; eax = new color ; eax = new color
;-------------------------------------- ;--------------------------------------
; check for Y ; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae .no_mouse_area jae .no_mouse_area
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
rol ecx, 16 rol ecx, 16
;-------------------------------------- ;--------------------------------------
; check for X ; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae .no_mouse_area jae .no_mouse_area
sub cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
ror ecx, 16
;-------------------------------------- ;--------------------------------------
align 4 align 4
.1: .1:
push eax push eax
; offset X
mov ax, [X_UNDER_subtraction_CUR_hot_x]
sub cx, ax ; x1
ror ecx, 16
; offset Y
mov ax, [Y_UNDER_subtraction_CUR_hot_y]
sub cx, ax ; y1
;-------------------------------------- ;--------------------------------------
; ecx = (offset x) shl 16 + (offset y) ; ecx = (offset x) shl 16 + (offset y)
push ebx push ebx
mov ebx, ecx mov ebx, ecx
shr ebx, 16 ; x shr ebx, 16 ; x
and ecx, 0xffff ; y and ecx, 0xffff ; y
cmp ecx, [cur.h]
jae @f
cmp ebx, [cur.w]
jb .ok
;--------------------------------------
align 4
@@:
; DEBUGF 1, "K : SHIT HAPPENS: %x %x \n", ecx,ebx
pop ebx
jmp .sh ; SORRY! SHIT HAPPENS!
;--------------------------------------
align 4
.ok:
; ecx = offset y ; ecx = offset y
; ebx = offset x ; ebx = offset x
mov eax, [esp + 4]
push ebx ecx push ebx ecx
imul ecx, [cur.w] ;y imul ecx, [cur.w] ;y
add ecx, ebx add ecx, ebx
@ -944,10 +951,14 @@ align 4
test eax, 0xFF000000 test eax, 0xFF000000
jz @f jz @f
pop ecx add esp, 4
ret ret
;-------------------------------------- ;--------------------------------------
align 4 align 4
.sh:
mov ecx, -1
;--------------------------------------
align 4
@@: @@:
pop eax pop eax
;-------------------------------------- ;--------------------------------------

View File

@ -406,29 +406,38 @@ align 4
jne .skip jne .skip
;-------------------------------------- ;--------------------------------------
push ecx push ecx
mov ecx, [putimg.real_sy_and_abs_cy + 4] ;--------------------------------------
align 4
.sh:
neg ecx
add ecx, [putimg.real_sx_and_abs_cx + 4]
;--------------------------------------
; check for X
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae .no_mouse_area
sub cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
shl ecx, 16
add ecx, [putimg.real_sy_and_abs_cy + 4]
sub ecx, edi sub ecx, edi
;-------------------------------------- ;--------------------------------------
; check for Y ; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae .no_mouse_area jae .no_mouse_area
rol ecx, 16 sub cx, [Y_UNDER_subtraction_CUR_hot_y]
add ecx, [putimg.real_sx_and_abs_cx + 4]
sub ecx, [esp]
;--------------------------------------
; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area jb .no_mouse_area
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae .no_mouse_area
;-------------------------------------- ;--------------------------------------
; check mouse area for putpixel ; check mouse area for putpixel
call check_mouse_area_for_putpixel_new.1 call check_mouse_area_for_putpixel_new.1
cmp ecx, -1 ;SHIT HAPPENS?
jne .no_mouse_area
mov ecx, [esp]
jmp .sh
;-------------------------------------- ;--------------------------------------
align 4 align 4
.no_mouse_area: .no_mouse_area:
@ -608,29 +617,38 @@ align 4
jne .skip jne .skip
;-------------------------------------- ;--------------------------------------
push ecx push ecx
mov ecx, [putimg.real_sy_and_abs_cy + 4] ;--------------------------------------
align 4
.sh:
neg ecx
add ecx, [putimg.real_sx_and_abs_cx + 4]
;--------------------------------------
; check for X
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae .no_mouse_area
sub cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
shl ecx, 16
add ecx, [putimg.real_sy_and_abs_cy + 4]
sub ecx, edi sub ecx, edi
;-------------------------------------- ;--------------------------------------
; check for Y ; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae .no_mouse_area jae .no_mouse_area
rol ecx, 16 sub cx, [Y_UNDER_subtraction_CUR_hot_y]
add ecx, [putimg.real_sx_and_abs_cx + 4]
sub ecx, [esp]
;--------------------------------------
; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area jb .no_mouse_area
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae .no_mouse_area
;-------------------------------------- ;--------------------------------------
; check mouse area for putpixel ; check mouse area for putpixel
call check_mouse_area_for_putpixel_new.1 call check_mouse_area_for_putpixel_new.1
cmp ecx, -1 ;SHIT HAPPENS?
jne .no_mouse_area
mov ecx, [esp]
jmp .sh
;-------------------------------------- ;--------------------------------------
align 4 align 4
.no_mouse_area: .no_mouse_area:
@ -767,21 +785,23 @@ Vesa20_putpixel24_new:
jnz @f jnz @f
;-------------------------------------- ;--------------------------------------
; check for Y ; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb @f
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae @f jae @f
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
jb @f
rol ecx, 16 rol ecx, 16
;-------------------------------------- ;--------------------------------------
; check for X ; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb @f
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae @f jae @f
sub cx, [X_UNDER_subtraction_CUR_hot_x]
jb @f
ror ecx, 16
call check_mouse_area_for_putpixel_new.1 call check_mouse_area_for_putpixel_new.1
;-------------------------------------- ;--------------------------------------
align 4 align 4
@ -841,21 +861,23 @@ Vesa20_putpixel32_new:
jnz @f jnz @f
;-------------------------------------- ;--------------------------------------
; check for Y ; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb @f
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae @f jae @f
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
jb @f
rol ecx, 16 rol ecx, 16
;-------------------------------------- ;--------------------------------------
; check for X ; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb @f
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae @f jae @f
sub cx, [X_UNDER_subtraction_CUR_hot_x]
jb @f
ror ecx, 16
call check_mouse_area_for_putpixel_new.1 call check_mouse_area_for_putpixel_new.1
;-------------------------------------- ;--------------------------------------
align 4 align 4
@ -1372,22 +1394,24 @@ align 4
sub ecx, esi sub ecx, esi
;-------------------------------------- ;--------------------------------------
; check for Y ; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae .no_mouse_area jae .no_mouse_area
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
rol ecx, 16 rol ecx, 16
add ecx, [drbar.real_sx_and_abs_cx] add ecx, [drbar.real_sx_and_abs_cx]
sub ecx, edi sub ecx, edi
;-------------------------------------- ;--------------------------------------
; check for X ; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae .no_mouse_area jae .no_mouse_area
sub cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
ror ecx, 16
;-------------------------------------- ;--------------------------------------
; check mouse area for putpixel ; check mouse area for putpixel
push eax push eax
@ -1557,22 +1581,24 @@ align 4
sub ecx, esi sub ecx, esi
;-------------------------------------- ;--------------------------------------
; check for Y ; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae .no_mouse_area jae .no_mouse_area
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
rol ecx, 16 rol ecx, 16
add ecx, [drbar.real_sx_and_abs_cx] add ecx, [drbar.real_sx_and_abs_cx]
sub ecx, edi sub ecx, edi
;-------------------------------------- ;--------------------------------------
; check for X ; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae .no_mouse_area jae .no_mouse_area
sub cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
ror ecx, 16
;-------------------------------------- ;--------------------------------------
; check mouse area for putpixel ; check mouse area for putpixel
push eax push eax