mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-25 08:06:49 +03:00
Syncing net branch with trunk.
git-svn-id: svn://kolibrios.org@3187 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
575dd00f15
commit
fbf1d3eec3
@ -347,14 +347,16 @@ disk_add:
|
|||||||
push eax ; save allocated pointer to DISK
|
push eax ; save allocated pointer to DISK
|
||||||
xor eax, eax ; the argument of malloc() is in eax
|
xor eax, eax ; the argument of malloc() is in eax
|
||||||
@@:
|
@@:
|
||||||
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.
|
||||||
call malloc
|
push ebx
|
||||||
; 2c. Check the result. If allocation failed, go to 7.
|
call malloc
|
||||||
pop esi ; restore allocated pointer to DISK
|
pop ebx
|
||||||
test eax, eax
|
; 2c. Check the result. If allocation failed, go to 7.
|
||||||
|
pop esi ; restore allocated pointer to DISK
|
||||||
|
test eax, eax
|
||||||
jz .free
|
jz .free
|
||||||
; 2d. Store the allocated pointer to the DISK structure.
|
; 2d. Store the allocated pointer to the DISK structure.
|
||||||
mov [esi+DISK.Name], eax
|
mov [esi+DISK.Name], eax
|
||||||
@ -415,13 +417,13 @@ disk_add:
|
|||||||
; [esp+4] = handle of the disk, i.e. the pointer to the DISK structure.
|
; [esp+4] = handle of the disk, i.e. the pointer to the DISK structure.
|
||||||
; Return value: none.
|
; Return value: none.
|
||||||
disk_del:
|
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.
|
||||||
mov ecx, disk_list_mutex
|
mov ecx, disk_list_mutex
|
||||||
call mutex_lock
|
call mutex_lock
|
||||||
; 2b. Delete item from double-linked list.
|
; 2b. Delete item from double-linked list.
|
||||||
@ -621,14 +623,14 @@ disk_default_closemedia:
|
|||||||
disk_default_flush:
|
disk_default_flush:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret 4
|
ret 4
|
||||||
|
|
||||||
; 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.
|
||||||
; If media is not partitioned, then the list consists of one partition which
|
; If media is not partitioned, then the list consists of one partition which
|
||||||
; covers all the media.
|
; covers all the media.
|
||||||
; esi = pointer to the DISK structure.
|
; esi = pointer to the DISK structure.
|
||||||
@ -972,31 +974,53 @@ disk_detect_partition:
|
|||||||
; with ebp-based frame arguments start from ebp+8, since [ebp]=saved ebp
|
; with ebp-based frame arguments start from ebp+8, since [ebp]=saved ebp
|
||||||
; and [ebp+4]=return address.
|
; and [ebp+4]=return address.
|
||||||
virtual at ebp+8
|
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
|
||||||
; structure without extra fields.
|
; a two-sectors-sized buffer. This function saves ebx in the stack
|
||||||
; 1. Allocate and check result.
|
; immediately before ebp.
|
||||||
push sizeof.PARTITION
|
virtual at ebp-4
|
||||||
pop eax
|
.buffer dd ?
|
||||||
call malloc
|
end virtual
|
||||||
test eax, eax
|
; 1. Read the bootsector to the buffer.
|
||||||
jz .nothing
|
mov al, DISKFUNC.read
|
||||||
; 2. Fill the common fields: copy .start and .length.
|
mov ebx, [.buffer]
|
||||||
mov edx, dword [.start]
|
add ebx, 512
|
||||||
mov dword [eax+PARTITION.FirstSector], edx
|
push 1
|
||||||
mov edx, dword [.start+4]
|
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.
|
||||||
|
push sizeof.PARTITION
|
||||||
|
pop eax
|
||||||
|
call malloc
|
||||||
|
test eax, eax
|
||||||
|
jz .nothing
|
||||||
|
mov edx, dword [.start]
|
||||||
|
mov dword [eax+PARTITION.FirstSector], edx
|
||||||
|
mov edx, dword [.start+4]
|
||||||
mov dword [eax+PARTITION.FirstSector+4], edx
|
mov dword [eax+PARTITION.FirstSector+4], edx
|
||||||
mov edx, dword [.length]
|
mov edx, dword [.length]
|
||||||
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
|
||||||
.nothing:
|
mov [eax+PARTITION.Disk], esi
|
||||||
; 3. Return with eax = pointer to PARTITION or NULL.
|
and [eax+PARTITION.FSUserFunctions], 0
|
||||||
ret
|
.success:
|
||||||
|
.nothing:
|
||||||
; This function is called from file_system_lfn.
|
; 4. Return with eax = pointer to PARTITION or NULL.
|
||||||
|
pop ecx
|
||||||
|
ret
|
||||||
|
|
||||||
|
; This function is called from file_system_lfn.
|
||||||
; This handler gets the control each time when fn 70 is called
|
; This handler gets the control each time when fn 70 is called
|
||||||
; with unknown item of root subdirectory.
|
; with unknown item of root subdirectory.
|
||||||
; in: esi -> name
|
; in: esi -> name
|
||||||
@ -1058,12 +1082,13 @@ dyndisk_handler:
|
|||||||
; We found the addressed DISK structure.
|
; We found the addressed DISK structure.
|
||||||
; 5. Reference the disk.
|
; 5. Reference the disk.
|
||||||
lock inc [ebx+DISK.RefCount]
|
lock inc [ebx+DISK.RefCount]
|
||||||
; 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
|
||||||
; 7. Acquire the mutex for media object.
|
pop ecx ; pop from the stack saved value of esi
|
||||||
pop edi ; restore edi
|
; 7. Acquire the mutex for media object.
|
||||||
lea ecx, [ebx+DISK.MediaLock]
|
pop edi ; restore edi
|
||||||
|
lea ecx, [ebx+DISK.MediaLock]
|
||||||
call mutex_lock
|
call mutex_lock
|
||||||
; 8. Get the media object. If it is not NULL, reference it.
|
; 8. Get the media object. If it is not NULL, reference it.
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
@ -1172,30 +1197,50 @@ fs_dyndisk:
|
|||||||
pop edx edx edx eax ; edx = pointer to DISK, eax = NULL or edx
|
pop edx edx edx eax ; edx = pointer to DISK, eax = NULL or edx
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .nomedia
|
jz .nomedia
|
||||||
.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]
|
||||||
.cleanup:
|
mov eax, [eax+ecx*4]
|
||||||
mov esi, edx
|
mov edi, [eax+PARTITION.FSUserFunctions]
|
||||||
call disk_media_dereference
|
test edi, edi
|
||||||
call disk_dereference
|
jz .nofs
|
||||||
ret
|
mov ecx, [ebx]
|
||||||
.notfound:
|
cmp [edi], ecx
|
||||||
mov dword [esp+32], ERROR_FILE_NOT_FOUND
|
jbe .unsupported
|
||||||
jmp .cleanup
|
push edx
|
||||||
.nomedia:
|
push ebp
|
||||||
test ecx, ecx
|
mov ebp, eax
|
||||||
jnz .notfound
|
call dword [edi+4+ecx*4]
|
||||||
|
pop ebp
|
||||||
|
pop edx
|
||||||
|
mov dword [esp+32], eax
|
||||||
|
mov dword [esp+20], ebx
|
||||||
|
.cleanup:
|
||||||
|
mov esi, edx
|
||||||
|
call disk_media_dereference
|
||||||
|
call disk_dereference
|
||||||
|
ret
|
||||||
|
.nofs:
|
||||||
|
mov dword [esp+32], ERROR_UNKNOWN_FS
|
||||||
|
jmp .cleanup
|
||||||
|
.notfound:
|
||||||
|
mov dword [esp+32], ERROR_FILE_NOT_FOUND
|
||||||
|
jmp .cleanup
|
||||||
|
.unsupported:
|
||||||
|
mov dword [esp+32], ERROR_UNSUPPORTED_FS
|
||||||
|
jmp .cleanup
|
||||||
|
.nomedia:
|
||||||
|
test ecx, ecx
|
||||||
|
jnz .notfound
|
||||||
test byte [edx+DISK.DriverFlags], DISK_NO_INSERT_NOTIFICATION
|
test byte [edx+DISK.DriverFlags], DISK_NO_INSERT_NOTIFICATION
|
||||||
jz .deverror
|
jz .deverror
|
||||||
; 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
|
|
||||||
jnz .noluck
|
jnz .noluck
|
||||||
call mutex_unlock
|
call mutex_unlock
|
||||||
push edx
|
push edx
|
||||||
|
@ -15,15 +15,17 @@ $Revision: 2381 $
|
|||||||
; out: eax = error code; 0 = ok
|
; out: eax = error code; 0 = ok
|
||||||
fs_read32_sys:
|
fs_read32_sys:
|
||||||
; Compatibility hack: if PARTITION.Disk is 'old', there is no DISK structure,
|
; Compatibility hack: if PARTITION.Disk is 'old', there is no DISK structure,
|
||||||
; 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
|
||||||
mov [hdd_appl_data], 0
|
add eax, dword [ebp+PARTITION.FirstSector]
|
||||||
call hd_read
|
mov [hdd_appl_data], 0
|
||||||
mov [hdd_appl_data], 1 ; restore to default state
|
call hd_read
|
||||||
ret
|
mov [hdd_appl_data], 1 ; restore to default state
|
||||||
@@:
|
mov eax, [hd_error]
|
||||||
; In the normal case, save ecx, set ecx to SysCache and let the common part
|
ret
|
||||||
|
@@:
|
||||||
|
; In the normal case, save ecx, set ecx to SysCache and let the common part
|
||||||
; do its work.
|
; do its work.
|
||||||
push ecx
|
push ecx
|
||||||
mov ecx, [ebp+PARTITION.Disk]
|
mov ecx, [ebp+PARTITION.Disk]
|
||||||
@ -38,14 +40,17 @@ fs_read32_sys:
|
|||||||
; out: eax = error code; 0 = ok
|
; out: eax = error code; 0 = ok
|
||||||
fs_read32_app:
|
fs_read32_app:
|
||||||
; Compatibility hack: if PARTITION.Disk is 'old', there is no DISK structure,
|
; Compatibility hack: if PARTITION.Disk is 'old', there is no DISK structure,
|
||||||
; 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
|
||||||
mov [hdd_appl_data], 1
|
add eax, dword [ebp+PARTITION.FirstSector]
|
||||||
jmp hd_read
|
mov [hdd_appl_data], 1
|
||||||
@@:
|
call hd_read
|
||||||
; In the normal case, save ecx, set ecx to AppCache and let the common part
|
mov eax, [hd_error]
|
||||||
; do its work.
|
ret
|
||||||
|
@@:
|
||||||
|
; In the normal case, save ecx, set ecx to AppCache and let the common part
|
||||||
|
; do its work.
|
||||||
push ecx
|
push ecx
|
||||||
mov ecx, [ebp+PARTITION.Disk]
|
mov ecx, [ebp+PARTITION.Disk]
|
||||||
add ecx, DISK.AppCache
|
add ecx, DISK.AppCache
|
||||||
@ -60,33 +65,34 @@ fs_read32_common:
|
|||||||
ja @f
|
ja @f
|
||||||
mov eax, DISK_STATUS_END_OF_MEDIA
|
mov eax, DISK_STATUS_END_OF_MEDIA
|
||||||
pop ecx
|
pop ecx
|
||||||
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]
|
||||||
; 3. If there is no cache for this disk, just pass the request to the driver.
|
; 3. If there is no cache for this disk, just pass the request to the driver.
|
||||||
cmp [ecx+DISKCACHE.pointer], 0
|
cmp [ecx+DISKCACHE.pointer], 0
|
||||||
jnz .scancache
|
jnz .scancache
|
||||||
push 1
|
push 1
|
||||||
push esp ; numsectors
|
push esp ; numsectors
|
||||||
push edx ; startsector
|
push edx ; startsector
|
||||||
push eax ; startsector
|
push eax ; startsector
|
||||||
push ebx ; buffer
|
push ebx ; buffer
|
||||||
mov al, DISKFUNC.read
|
mov esi, [ebp+PARTITION.Disk]
|
||||||
call disk_call_driver
|
mov al, DISKFUNC.read
|
||||||
pop ecx
|
call disk_call_driver
|
||||||
pop edx
|
pop ecx
|
||||||
pop ecx
|
pop esi edx
|
||||||
ret
|
pop ecx
|
||||||
.scancache:
|
ret
|
||||||
; 4. Scan the cache.
|
.scancache:
|
||||||
push esi edi ecx ; scan cache
|
; 4. Scan the cache.
|
||||||
push edx eax
|
push edi ecx ; scan cache
|
||||||
virtual at esp
|
push edx eax
|
||||||
.sector_lo dd ?
|
virtual at esp
|
||||||
|
.sector_lo dd ?
|
||||||
.sector_hi dd ?
|
.sector_hi dd ?
|
||||||
.cache dd ?
|
.cache dd ?
|
||||||
end virtual
|
end virtual
|
||||||
@ -126,13 +132,13 @@ end virtual
|
|||||||
jnz .read_done
|
jnz .read_done
|
||||||
|
|
||||||
push 1
|
push 1
|
||||||
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]
|
||||||
push eax
|
push eax
|
||||||
mov esi, [ebp+PARTITION.Disk]
|
mov esi, [ebp+PARTITION.Disk]
|
||||||
mov al, DISKFUNC.read
|
mov al, DISKFUNC.read
|
||||||
@ -180,15 +186,17 @@ end virtual
|
|||||||
; out: eax = error code; 0 = ok
|
; out: eax = error code; 0 = ok
|
||||||
fs_write32_sys:
|
fs_write32_sys:
|
||||||
; Compatibility hack: if PARTITION.Disk is 'old', there is no DISK structure,
|
; Compatibility hack: if PARTITION.Disk is 'old', there is no DISK structure,
|
||||||
; 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
|
||||||
mov [hdd_appl_data], 0
|
add eax, dword [ebp+PARTITION.FirstSector]
|
||||||
call hd_write
|
mov [hdd_appl_data], 0
|
||||||
mov [hdd_appl_data], 1 ; restore to default state
|
call hd_write
|
||||||
ret
|
mov [hdd_appl_data], 1 ; restore to default state
|
||||||
@@:
|
mov eax, [hd_error]
|
||||||
; In the normal case, save ecx, set ecx to SysCache and let the common part
|
ret
|
||||||
|
@@:
|
||||||
|
; In the normal case, save ecx, set ecx to SysCache and let the common part
|
||||||
; do its work.
|
; do its work.
|
||||||
push ecx
|
push ecx
|
||||||
mov ecx, [ebp+PARTITION.Disk]
|
mov ecx, [ebp+PARTITION.Disk]
|
||||||
@ -203,14 +211,17 @@ fs_write32_sys:
|
|||||||
; out: eax = error code; 0 = ok
|
; out: eax = error code; 0 = ok
|
||||||
fs_write32_app:
|
fs_write32_app:
|
||||||
; Compatibility hack: if PARTITION.Disk is 'old', there is no DISK structure,
|
; Compatibility hack: if PARTITION.Disk is 'old', there is no DISK structure,
|
||||||
; 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
|
||||||
mov [hdd_appl_data], 1
|
add eax, dword [ebp+PARTITION.FirstSector]
|
||||||
jmp hd_write
|
mov [hdd_appl_data], 1
|
||||||
@@:
|
call hd_write
|
||||||
; In the normal case, save ecx, set ecx to AppCache and let the common part
|
mov eax, [hd_error]
|
||||||
; do its work.
|
ret
|
||||||
|
@@:
|
||||||
|
; In the normal case, save ecx, set ecx to AppCache and let the common part
|
||||||
|
; do its work.
|
||||||
push ecx
|
push ecx
|
||||||
mov ecx, [ebp+PARTITION.Disk]
|
mov ecx, [ebp+PARTITION.Disk]
|
||||||
add ecx, DISK.AppCache
|
add ecx, DISK.AppCache
|
||||||
@ -224,34 +235,35 @@ fs_write32_common:
|
|||||||
cmp dword [ebp+PARTITION.Length], eax
|
cmp dword [ebp+PARTITION.Length], eax
|
||||||
ja @f
|
ja @f
|
||||||
mov eax, DISK_STATUS_END_OF_MEDIA
|
mov eax, DISK_STATUS_END_OF_MEDIA
|
||||||
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]
|
||||||
adc edx, dword [ebp+PARTITION.FirstSector+4]
|
adc edx, dword [ebp+PARTITION.FirstSector+4]
|
||||||
; 3. If there is no cache for this disk, just pass request to the driver.
|
; 3. If there is no cache for this disk, just pass request to the driver.
|
||||||
cmp [ecx+DISKCACHE.pointer], 0
|
cmp [ecx+DISKCACHE.pointer], 0
|
||||||
jnz .scancache
|
jnz .scancache
|
||||||
push 1
|
push 1
|
||||||
push esp ; numsectors
|
push esp ; numsectors
|
||||||
push edx ; startsector
|
push edx ; startsector
|
||||||
push eax ; startsector
|
push eax ; startsector
|
||||||
push ebx ; buffer
|
push ebx ; buffer
|
||||||
mov al, DISKFUNC.write
|
mov esi, [ebp+PARTITION.Disk]
|
||||||
call disk_call_driver
|
mov al, DISKFUNC.write
|
||||||
pop ecx
|
call disk_call_driver
|
||||||
pop edx
|
pop ecx
|
||||||
pop ecx
|
pop esi edx
|
||||||
ret
|
pop ecx
|
||||||
.scancache:
|
ret
|
||||||
; 4. Scan the cache.
|
.scancache:
|
||||||
push esi edi ecx ; scan cache
|
; 4. Scan the cache.
|
||||||
push edx eax
|
push edi ecx ; scan cache
|
||||||
virtual at esp
|
push edx eax
|
||||||
.sector_lo dd ?
|
virtual at esp
|
||||||
|
.sector_lo dd ?
|
||||||
.sector_hi dd ?
|
.sector_hi dd ?
|
||||||
.cache dd ?
|
.cache dd ?
|
||||||
end virtual
|
end virtual
|
||||||
@ -302,13 +314,13 @@ end virtual
|
|||||||
mov edx, [.sector_hi]
|
mov edx, [.sector_hi]
|
||||||
mov [esi], eax ; sector number
|
mov [esi], eax ; sector number
|
||||||
mov [esi+4], edx ; sector number
|
mov [esi+4], edx ; sector number
|
||||||
|
|
||||||
.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]
|
||||||
add edi, [ecx+DISKCACHE.data]
|
add edi, [ecx+DISKCACHE.data]
|
||||||
|
|
||||||
mov esi, ebx
|
mov esi, ebx
|
||||||
@ -345,30 +357,31 @@ find_empty_slot64:
|
|||||||
shl eax, 2
|
shl eax, 2
|
||||||
add eax, [esi+DISKCACHE.pointer]
|
add eax, [esi+DISKCACHE.pointer]
|
||||||
cmp dword [eax+8], 2
|
cmp dword [eax+8], 2
|
||||||
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
|
||||||
.found_slot:
|
.found_slot:
|
||||||
mov [esi+DISKCACHE.search_start], edi
|
mov [esi+DISKCACHE.search_start], edi
|
||||||
xor eax, eax ; success
|
xor eax, eax ; success
|
||||||
.found_slot_access_denied:
|
.found_slot_access_denied:
|
||||||
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
|
||||||
; If there is no cache for this disk, nothing to do.
|
saved_esi_pos = 16+12 ; size of local variables + size of registers before esi
|
||||||
cmp [esi+DISKCACHE.pointer], 0
|
; If there is no cache for this disk, nothing to do.
|
||||||
jz .flush
|
cmp [esi+DISKCACHE.pointer], 0
|
||||||
|
jz .flush
|
||||||
;-----------------------------------------------------------
|
;-----------------------------------------------------------
|
||||||
; write all changed sectors to disk
|
; write all changed sectors to disk
|
||||||
;-----------------------------------------------------------
|
;-----------------------------------------------------------
|
||||||
@ -429,14 +442,13 @@ endl
|
|||||||
dec ecx
|
dec ecx
|
||||||
jnz .write_cache_more
|
jnz .write_cache_more
|
||||||
call .flush_cache_chain
|
call .flush_cache_chain
|
||||||
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:
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.flush_cache_chain:
|
.flush_cache_chain:
|
||||||
@ -451,13 +463,13 @@ endl
|
|||||||
.write_cache_sector:
|
.write_cache_sector:
|
||||||
mov [cache_chain_size], 1
|
mov [cache_chain_size], 1
|
||||||
mov [cache_chain_pos], edi
|
mov [cache_chain_pos], edi
|
||||||
.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]
|
||||||
push ecx
|
push ecx
|
||||||
push esp ; numsectors
|
push esp ; numsectors
|
||||||
mov eax, [cache_chain_ptr]
|
mov eax, [cache_chain_ptr]
|
||||||
@ -535,13 +547,13 @@ disk_init_cache:
|
|||||||
imul eax, 7
|
imul eax, 7
|
||||||
mov [esi+DISK.AppCache.data_size], eax
|
mov [esi+DISK.AppCache.data_size], eax
|
||||||
mov [esi+DISK.AppCache.pointer], edx
|
mov [esi+DISK.AppCache.pointer], edx
|
||||||
|
|
||||||
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
|
||||||
mov [esi+DISK.SysCache.sad_size], ecx
|
mov [esi+DISK.SysCache.sad_size], ecx
|
||||||
|
|
||||||
push edi
|
push edi
|
||||||
@ -550,13 +562,13 @@ disk_init_cache:
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
rep stosd
|
rep stosd
|
||||||
pop edi
|
pop edi
|
||||||
|
|
||||||
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
|
||||||
mov [esi+DISK.AppCache.sad_size], ecx
|
mov [esi+DISK.AppCache.sad_size], ecx
|
||||||
|
|
||||||
push edi
|
push edi
|
||||||
@ -576,17 +588,56 @@ disk_init_cache:
|
|||||||
.nocache:
|
.nocache:
|
||||||
mov [esi+DISK.SysCache.pointer], eax
|
mov [esi+DISK.SysCache.pointer], eax
|
||||||
mov [esi+DISK.AppCache.pointer], eax
|
mov [esi+DISK.AppCache.pointer], eax
|
||||||
mov al, 1
|
mov al, 1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; This internal function is called from disk_media_dereference to free the
|
calculate_for_hd64:
|
||||||
; allocated cache, if there is one.
|
push eax
|
||||||
; esi = pointer to DISK structure
|
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
|
||||||
|
; allocated cache, if there is one.
|
||||||
|
; esi = pointer to DISK structure
|
||||||
disk_free_cache:
|
disk_free_cache:
|
||||||
; The algorithm is straightforward.
|
; The algorithm is straightforward.
|
||||||
mov eax, [esi+DISK.SysCache.pointer]
|
mov eax, [esi+DISK.SysCache.pointer]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .nothing
|
jz .nothing
|
||||||
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
|
||||||
|
@ -942,6 +942,86 @@ int13_call:
|
|||||||
test byte [int13_regs_out+v86_regs.eflags], 1
|
test byte [int13_regs_out+v86_regs.eflags], 1
|
||||||
jnz @f
|
jnz @f
|
||||||
mov edx, ecx
|
mov edx, ecx
|
||||||
@@:
|
@@:
|
||||||
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
|
||||||
|
;********************************************
|
||||||
|
@ -134,14 +134,12 @@ found_slot:
|
|||||||
call calculate_cache_5
|
call calculate_cache_5
|
||||||
found_slot_access_denied:
|
found_slot_access_denied:
|
||||||
ret
|
ret
|
||||||
;--------------------------------------------------------------------
|
;--------------------------------------------------------------------
|
||||||
align 4
|
align 4
|
||||||
clear_hd_cache:
|
clear_hd_cache:
|
||||||
mov [fat_in_cache], -1
|
ret
|
||||||
mov [fat_change], 0
|
;--------------------------------------------------------------------
|
||||||
ret
|
align 4
|
||||||
;--------------------------------------------------------------------
|
|
||||||
align 4
|
|
||||||
calculate_cache:
|
calculate_cache:
|
||||||
; mov ecx,cache_max ; entries in cache
|
; mov ecx,cache_max ; entries in cache
|
||||||
; mov esi,HD_CACHE+8
|
; mov esi,HD_CACHE+8
|
||||||
|
@ -33,6 +33,6 @@ preboot_biosdisk db 0 ; use V86 to access disks through BIOS (1-yes, 2-no)
|
|||||||
|
|
||||||
if $>0x200
|
if $>0x200
|
||||||
ERROR: prebooting parameters must fit in first sector!!!
|
ERROR: prebooting parameters must fit in first sector!!!
|
||||||
end if
|
end if
|
||||||
hdsysimage db 'KOLIBRI IMG' ; load from
|
hdsysimage db 'KOLIBRI IMG' ; load from
|
||||||
image_save db 'KOLIBRI IMG' ; save to
|
image_save db 'KOLIBRI IMG' ; save to
|
||||||
|
@ -86,19 +86,28 @@ $Revision $
|
|||||||
jz image_present
|
jz image_present
|
||||||
ret
|
ret
|
||||||
image_present:
|
image_present:
|
||||||
mov [image_retrieved],1
|
mov [image_retrieved], 1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
read_image:
|
iglobal
|
||||||
mov eax, hdsysimage+OS_BASE+0x10000
|
align 4
|
||||||
mov ebx, 1474560/512
|
read_image_fsinfo:
|
||||||
mov ecx, RAMDISK
|
dd 0 ; function: read
|
||||||
mov esi, 0
|
dq 0 ; offset: zero
|
||||||
mov edi, 12
|
dd 1474560/512 ; size
|
||||||
call file_read
|
dd RAMDISK ; buffer
|
||||||
ret
|
db 0
|
||||||
|
dd hdsysimage+OS_BASE+0x10000
|
||||||
image_retrieved db 0
|
endg
|
||||||
|
|
||||||
|
read_image:
|
||||||
|
mov ebx, read_image_fsinfo
|
||||||
|
pushad
|
||||||
|
call file_system_lfn
|
||||||
|
popad
|
||||||
|
ret
|
||||||
|
|
||||||
|
image_retrieved db 0
|
||||||
counter_of_partitions db 0
|
counter_of_partitions db 0
|
||||||
no_sys_on_hd:
|
no_sys_on_hd:
|
||||||
; test_to_format_ram_disk (need if not using ram disk)
|
; test_to_format_ram_disk (need if not using ram disk)
|
||||||
|
@ -260,15 +260,12 @@ BANK_RW equ (OS_BASE+0x000FFF2)
|
|||||||
MOUSE_BACKGROUND equ (OS_BASE+0x000FFF4)
|
MOUSE_BACKGROUND equ (OS_BASE+0x000FFF4)
|
||||||
DONT_DRAW_MOUSE equ (OS_BASE+0x000FFF5)
|
DONT_DRAW_MOUSE equ (OS_BASE+0x000FFF5)
|
||||||
DONT_SWITCH equ (OS_BASE+0x000FFFF)
|
DONT_SWITCH equ (OS_BASE+0x000FFFF)
|
||||||
|
|
||||||
TMP_STACK_TOP equ 0x006CC00
|
TMP_STACK_TOP equ 0x006CC00
|
||||||
|
|
||||||
FONT_II equ (OS_BASE+0x006DC00)
|
sys_pgdir equ (OS_BASE+0x006F000)
|
||||||
FONT_I equ (OS_BASE+0x006E600)
|
|
||||||
|
DRIVE_DATA equ (OS_BASE+0x0070000)
|
||||||
sys_pgdir equ (OS_BASE+0x006F000)
|
|
||||||
|
|
||||||
DRIVE_DATA equ (OS_BASE+0x0070000)
|
|
||||||
|
|
||||||
SLOT_BASE equ (OS_BASE+0x0080000)
|
SLOT_BASE equ (OS_BASE+0x0080000)
|
||||||
|
|
||||||
|
@ -807,21 +807,13 @@ proc load_driver stdcall, driver_name:dword
|
|||||||
mov ebx, [start]
|
mov ebx, [start]
|
||||||
stdcall ebx, DRV_ENTRY
|
stdcall ebx, DRV_ENTRY
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .ok
|
jnz .ok
|
||||||
|
|
||||||
stdcall kernel_free, [img_base]
|
stdcall kernel_free, [img_base]
|
||||||
cmp dword [file_name+13], 'SOUN'
|
|
||||||
jnz @f
|
xor eax, eax
|
||||||
cmp dword [file_name+17], 'D.ob'
|
ret
|
||||||
jnz @f
|
.ok:
|
||||||
cmp word [file_name+21], 'j'
|
|
||||||
jnz @f
|
|
||||||
mov esi, aHDA
|
|
||||||
jmp .redo
|
|
||||||
@@:
|
|
||||||
xor eax, eax
|
|
||||||
ret
|
|
||||||
.ok:
|
|
||||||
mov ebx, [img_base]
|
mov ebx, [img_base]
|
||||||
mov [eax+SRV.base], ebx
|
mov [eax+SRV.base], ebx
|
||||||
mov ecx, [start]
|
mov ecx, [start]
|
||||||
|
@ -69,12 +69,15 @@ iglobal
|
|||||||
szSysMsgBoardChar db 'SysMsgBoardChar', 0
|
szSysMsgBoardChar db 'SysMsgBoardChar', 0
|
||||||
szGetCurrentTask db 'GetCurrentTask',0
|
szGetCurrentTask db 'GetCurrentTask',0
|
||||||
szLFBAddress db 'LFBAddress',0
|
szLFBAddress db 'LFBAddress',0
|
||||||
szLoadFile db 'LoadFile',0
|
szLoadFile db 'LoadFile',0
|
||||||
szSendEvent db 'SendEvent',0
|
szSendEvent db 'SendEvent',0
|
||||||
szSetMouseData db 'SetMouseData',0
|
szSetMouseData db 'SetMouseData',0
|
||||||
szSleep db 'Sleep',0
|
szSetKeyboardData db 'SetKeyboardData',0
|
||||||
szGetTimerTicks db 'GetTimerTicks',0
|
szRegKeyboard db 'RegKeyboard',0
|
||||||
|
szDelKeyboard db 'DelKeyboard',0
|
||||||
|
szSleep db 'Sleep',0
|
||||||
|
szGetTimerTicks db 'GetTimerTicks',0
|
||||||
|
|
||||||
szGetDisplay db 'GetDisplay',0
|
szGetDisplay db 'GetDisplay',0
|
||||||
szSetScreen db 'SetScreen',0
|
szSetScreen db 'SetScreen',0
|
||||||
|
|
||||||
@ -158,12 +161,15 @@ kernel_export:
|
|||||||
dd szSysMsgBoardStr , sys_msg_board_str
|
dd szSysMsgBoardStr , sys_msg_board_str
|
||||||
dd szSysMsgBoardChar , sys_msg_board
|
dd szSysMsgBoardChar , sys_msg_board
|
||||||
dd szGetCurrentTask , get_curr_task
|
dd szGetCurrentTask , get_curr_task
|
||||||
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 szSleep , delay_ms
|
dd szSetKeyboardData , set_keyboard_data
|
||||||
dd szGetTimerTicks , get_timer_ticks
|
dd szRegKeyboard , register_keyboard
|
||||||
|
dd szDelKeyboard , delete_keyboard
|
||||||
|
dd szSleep , delay_ms
|
||||||
|
dd szGetTimerTicks , get_timer_ticks
|
||||||
|
|
||||||
dd szGetDisplay , get_display
|
dd szGetDisplay , get_display
|
||||||
dd szSetScreen , set_screen
|
dd szSetScreen , set_screen
|
||||||
|
|
||||||
|
@ -338,16 +338,15 @@ free:
|
|||||||
|
|
||||||
mov [esi+edi], esi
|
mov [esi+edi], esi
|
||||||
|
|
||||||
; insert_chunk(p,psize);
|
; insert_chunk(p,psize);
|
||||||
|
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
pop esi
|
mov ecx, edi
|
||||||
mov ecx, edi
|
call insert_chunk
|
||||||
pop edi
|
jmp .fail2
|
||||||
jmp insert_chunk
|
.unl_large:
|
||||||
.unl_large:
|
|
||||||
|
; unlink_large_chunk((tchunkptr)next);
|
||||||
; unlink_large_chunk((tchunkptr)next);
|
|
||||||
|
|
||||||
mov edx, ebx
|
mov edx, ebx
|
||||||
call unlink_large_chunk
|
call unlink_large_chunk
|
||||||
@ -361,16 +360,15 @@ free:
|
|||||||
|
|
||||||
mov [esi+edi], esi
|
mov [esi+edi], esi
|
||||||
|
|
||||||
; insert_chunk(p,psize);
|
; insert_chunk(p,psize);
|
||||||
|
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
pop esi
|
mov ecx, edi
|
||||||
mov ecx, edi
|
call insert_chunk
|
||||||
pop edi
|
jmp .fail2
|
||||||
jmp insert_chunk
|
.fix_next:
|
||||||
.fix_next:
|
|
||||||
|
; (p+psize)->prev_foot = psize;
|
||||||
; (p+psize)->prev_foot = psize;
|
|
||||||
; next->head &= ~PINUSE_BIT;
|
; next->head &= ~PINUSE_BIT;
|
||||||
; p->head = psize|PINUSE_BIT;
|
; p->head = psize|PINUSE_BIT;
|
||||||
|
|
||||||
@ -383,16 +381,15 @@ free:
|
|||||||
; (p+psize)->prev_foot = psize;
|
; (p+psize)->prev_foot = psize;
|
||||||
|
|
||||||
mov [esi+edi], esi
|
mov [esi+edi], esi
|
||||||
; insert_chunk(p,psize);
|
; insert_chunk(p,psize);
|
||||||
|
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
pop esi
|
mov ecx, edi
|
||||||
mov ecx, edi
|
call insert_chunk
|
||||||
pop edi
|
jmp .fail2
|
||||||
jmp insert_chunk
|
|
||||||
|
; param
|
||||||
; param
|
; ecx = chunk
|
||||||
; ecx = chunk
|
|
||||||
; eax = size
|
; eax = size
|
||||||
|
|
||||||
insert_chunk:
|
insert_chunk:
|
||||||
@ -415,21 +412,17 @@ insert_chunk:
|
|||||||
mov edx, [eax+8] ;F = B->fd
|
mov edx, [eax+8] ;F = B->fd
|
||||||
mov [eax+8], esi ;B->fd = P
|
mov [eax+8], esi ;B->fd = P
|
||||||
mov [edx+12], esi ;F->bk = P
|
mov [edx+12], esi ;F->bk = P
|
||||||
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
|
ret
|
||||||
call mutex_unlock
|
.large:
|
||||||
ret
|
mov ebx, eax
|
||||||
.large:
|
call insert_large_chunk
|
||||||
mov ebx, eax
|
pop esi
|
||||||
call insert_large_chunk
|
ret
|
||||||
pop esi
|
|
||||||
mov ecx, mst.mutex
|
|
||||||
call mutex_unlock
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
; param
|
; param
|
||||||
; esi= chunk
|
; esi= chunk
|
||||||
; ebx= size
|
; ebx= size
|
||||||
|
@ -439,78 +439,89 @@ proc init_LFB
|
|||||||
ret
|
ret
|
||||||
endp
|
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 edi, [new_size]
|
|
||||||
add edi, 4095
|
mov edx, [current_slot]
|
||||||
and edi, not 4095
|
cmp [edx+APPDATA.heap_base], 0
|
||||||
mov [new_size], edi
|
jne .exit
|
||||||
|
|
||||||
mov edx, [current_slot]
|
mov edi, [new_size]
|
||||||
cmp [edx+APPDATA.heap_base], 0
|
add edi, 4095
|
||||||
jne .exit
|
and edi, not 4095
|
||||||
|
mov [new_size], edi
|
||||||
mov esi, [edx+APPDATA.mem_size]
|
|
||||||
add esi, 4095
|
mov esi, [edx+APPDATA.mem_size]
|
||||||
and esi, not 4095
|
add esi, 4095
|
||||||
|
and esi, not 4095
|
||||||
cmp edi, esi
|
|
||||||
jae .expand
|
cmp edi, esi
|
||||||
|
ja .expand
|
||||||
shr edi, 12
|
je .exit
|
||||||
shr esi, 12
|
|
||||||
@@:
|
mov ebx, edi
|
||||||
mov eax, [app_page_tabs+edi*4]
|
shr edi, 12
|
||||||
test eax, 1
|
shr esi, 12
|
||||||
jz .next
|
|
||||||
mov dword [app_page_tabs+edi*4], 2
|
mov ecx, pg_data.mutex
|
||||||
mov ebx, edi
|
call mutex_lock
|
||||||
shl ebx, 12
|
@@:
|
||||||
push eax
|
mov eax, [app_page_tabs+edi*4]
|
||||||
invlpg [ebx]
|
test eax, 1
|
||||||
pop eax
|
jz .next
|
||||||
call free_page
|
|
||||||
|
mov dword [app_page_tabs+edi*4], 0
|
||||||
.next:
|
invlpg [ebx]
|
||||||
add edi, 1
|
call free_page
|
||||||
cmp edi, esi
|
|
||||||
jb @B
|
.next:
|
||||||
|
inc edi
|
||||||
.update_size:
|
add ebx, 0x1000
|
||||||
mov ebx, [new_size]
|
cmp edi, esi
|
||||||
call update_mem_size
|
jb @B
|
||||||
|
|
||||||
mov ecx, pg_data.mutex
|
mov ecx, pg_data.mutex
|
||||||
call mutex_unlock
|
call mutex_unlock
|
||||||
|
|
||||||
xor eax, eax
|
.update_size:
|
||||||
ret
|
mov edx, [current_slot]
|
||||||
.expand:
|
mov ebx, [new_size]
|
||||||
|
call update_mem_size
|
||||||
push esi
|
.exit:
|
||||||
push edi
|
pop edi
|
||||||
|
pop esi
|
||||||
add edi, 0x3FFFFF
|
pop ebx
|
||||||
and edi, not(0x3FFFFF)
|
xor eax, eax
|
||||||
add esi, 0x3FFFFF
|
ret
|
||||||
and esi, not(0x3FFFFF)
|
|
||||||
|
.expand:
|
||||||
cmp esi, edi
|
|
||||||
jae .grow
|
mov ecx, pg_data.mutex
|
||||||
|
call mutex_lock
|
||||||
xchg esi, edi
|
|
||||||
|
xchg esi, edi
|
||||||
@@:
|
|
||||||
call alloc_page
|
push esi ;new size
|
||||||
test eax, eax
|
push edi ;old size
|
||||||
jz .exit_pop
|
|
||||||
|
add edi, 0x3FFFFF
|
||||||
stdcall map_page_table, edi, eax
|
and edi, not(0x3FFFFF)
|
||||||
|
add esi, 0x3FFFFF
|
||||||
|
and esi, not(0x3FFFFF)
|
||||||
|
|
||||||
|
cmp edi, esi
|
||||||
|
jae .grow
|
||||||
|
@@:
|
||||||
|
call alloc_page
|
||||||
|
test eax, eax
|
||||||
|
jz .exit_fail
|
||||||
|
|
||||||
|
stdcall map_page_table, edi, eax
|
||||||
|
|
||||||
push edi
|
push edi
|
||||||
shr edi, 10
|
shr edi, 10
|
||||||
add edi, page_tabs
|
add edi, page_tabs
|
||||||
@ -521,57 +532,44 @@ proc new_mem_resize stdcall, new_size:dword
|
|||||||
pop edi
|
pop edi
|
||||||
|
|
||||||
add edi, 0x00400000
|
add edi, 0x00400000
|
||||||
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]
|
shr edi, 10
|
||||||
sub esi, 1
|
shr ecx, 10
|
||||||
shr edi, 12
|
sub ecx, edi
|
||||||
cmp esi, edi
|
shr ecx, 2 ;pages count
|
||||||
jle .out_of_memory
|
mov eax, 2
|
||||||
;//-
|
|
||||||
pop edi
|
add edi, app_page_tabs
|
||||||
pop esi
|
rep stosd
|
||||||
@@:
|
|
||||||
call alloc_page
|
mov ecx, pg_data.mutex
|
||||||
test eax, eax
|
call mutex_unlock
|
||||||
jz .exit
|
|
||||||
stdcall map_page, esi, eax, dword PG_UW
|
jmp .update_size
|
||||||
|
|
||||||
push edi
|
.exit_fail:
|
||||||
mov edi, esi
|
mov ecx, pg_data.mutex
|
||||||
xor eax, eax
|
call mutex_unlock
|
||||||
mov ecx, 1024
|
|
||||||
cld
|
add esp, 8
|
||||||
rep stosd
|
pop edi
|
||||||
pop edi
|
pop esi
|
||||||
|
pop ebx
|
||||||
add esi, 0x1000
|
xor eax, eax
|
||||||
cmp esi, edi
|
inc eax
|
||||||
jb @B
|
ret
|
||||||
|
endp
|
||||||
jmp .update_size
|
|
||||||
;//-
|
|
||||||
.exit_pop:
|
align 4
|
||||||
.out_of_memory:
|
update_mem_size:
|
||||||
;//-
|
; in: edx = slot base
|
||||||
pop edi
|
; ebx = new memory size
|
||||||
pop esi
|
|
||||||
.exit:
|
|
||||||
mov ecx, pg_data.mutex
|
|
||||||
call mutex_unlock
|
|
||||||
|
|
||||||
xor eax, eax
|
|
||||||
inc eax
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
update_mem_size:
|
|
||||||
; in: edx = slot base
|
|
||||||
; ebx = new memory size
|
|
||||||
; destroys eax,ecx,edx
|
; destroys eax,ecx,edx
|
||||||
|
|
||||||
mov [APPDATA.mem_size+edx], ebx
|
mov [APPDATA.mem_size+edx], ebx
|
||||||
@ -605,14 +603,18 @@ update_mem_size:
|
|||||||
;
|
;
|
||||||
; retval
|
; retval
|
||||||
; eax= phisical page address
|
; eax= phisical page address
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
get_pg_addr:
|
get_pg_addr:
|
||||||
shr eax, 12
|
sub eax, OS_BASE
|
||||||
mov eax, [page_tabs+eax*4]
|
cmp eax, 0x400000
|
||||||
and eax, 0xFFFFF000
|
jb @f
|
||||||
ret
|
shr eax, 12
|
||||||
|
mov eax, [page_tabs+(eax+(OS_BASE shr 12))*4]
|
||||||
|
@@:
|
||||||
|
and eax, 0xFFFFF000
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
; Now it is called from core/sys32::exc_c (see stack frame there)
|
; Now it is called from core/sys32::exc_c (see stack frame there)
|
||||||
@ -1250,13 +1252,13 @@ f68:
|
|||||||
mov [esp+32], eax
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
.21:
|
.21:
|
||||||
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
|
||||||
stdcall load_PE, ecx
|
stdcall load_PE, ecx
|
||||||
mov esi, eax
|
mov esi, eax
|
||||||
test eax, eax
|
test eax, eax
|
||||||
|
@ -297,12 +297,13 @@ __exports:
|
|||||||
free_page, 'FreePage', \ ; eax
|
free_page, 'FreePage', \ ; eax
|
||||||
kernel_alloc, 'KernelAlloc', \ ; stdcall
|
kernel_alloc, 'KernelAlloc', \ ; stdcall
|
||||||
kernel_free, 'KernelFree', \ ; stdcall
|
kernel_free, 'KernelFree', \ ; stdcall
|
||||||
malloc, 'Kmalloc', \
|
malloc, 'Kmalloc', \
|
||||||
free, 'Kfree', \
|
free, 'Kfree', \
|
||||||
map_io_mem, 'MapIoMem', \ ; stdcall
|
map_io_mem, 'MapIoMem', \ ; stdcall
|
||||||
get_pg_addr, 'GetPgAddr', \ ; eax
|
map_page, 'MapPage', \ ; stdcall
|
||||||
\
|
get_pg_addr, 'GetPgAddr', \ ; eax
|
||||||
mutex_init, 'MutexInit', \ ; gcc fastcall
|
\
|
||||||
|
mutex_init, 'MutexInit', \ ; gcc fastcall
|
||||||
mutex_lock, 'MutexLock', \ ; gcc fastcall
|
mutex_lock, 'MutexLock', \ ; gcc fastcall
|
||||||
mutex_unlock, 'MutexUnlock', \ ; gcc fastcall
|
mutex_unlock, 'MutexUnlock', \ ; gcc fastcall
|
||||||
\
|
\
|
||||||
|
@ -428,12 +428,23 @@ term9:
|
|||||||
mov [eax+8], ecx
|
mov [eax+8], ecx
|
||||||
mov [eax+12], ecx
|
mov [eax+12], ecx
|
||||||
.cont:
|
.cont:
|
||||||
add eax, 16
|
add eax, 16
|
||||||
cmp eax, hotkey_list+256*16
|
cmp eax, hotkey_list+256*16
|
||||||
jb .loop
|
jb .loop
|
||||||
; remove hotkeys in buffer
|
; get process PID
|
||||||
mov eax, hotkey_buffer
|
mov eax, esi
|
||||||
.loop2:
|
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
|
||||||
|
mov eax, hotkey_buffer
|
||||||
|
.loop2:
|
||||||
cmp [eax], esi
|
cmp [eax], esi
|
||||||
jnz .cont2
|
jnz .cont2
|
||||||
and dword [eax+4], 0
|
and dword [eax+4], 0
|
||||||
@ -680,27 +691,25 @@ term9:
|
|||||||
;mov esi,process_terminated
|
;mov esi,process_terminated
|
||||||
;call sys_msg_board_str
|
;call sys_msg_board_str
|
||||||
add esp, 4
|
add esp, 4
|
||||||
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
|
||||||
mov esi, boot_sched_1
|
; call boot_log
|
||||||
call boot_log
|
; call build_process_gdt_tss_pointer
|
||||||
; call build_process_gdt_tss_pointer
|
|
||||||
|
; mov esi,boot_sched_2
|
||||||
; mov esi,boot_sched_2
|
; call boot_log
|
||||||
; call boot_log
|
; ret
|
||||||
|
|
||||||
ret
|
|
||||||
|
@ -81,19 +81,21 @@ proc fs_execute
|
|||||||
hdr_mem dd ? ;0x10
|
hdr_mem dd ? ;0x10
|
||||||
hdr_i_end dd ? ;0x14
|
hdr_i_end dd ? ;0x14
|
||||||
endl
|
endl
|
||||||
|
|
||||||
pushad
|
pushad
|
||||||
|
|
||||||
pushad
|
cmp [SCR_MODE], word 0x13
|
||||||
stdcall set_cursor, [def_cursor_clock]
|
jbe @f
|
||||||
mov [handle], eax
|
pushad
|
||||||
mov [redrawmouse_unconditional], 1
|
stdcall set_cursor, [def_cursor_clock]
|
||||||
call __sys_draw_pointer
|
mov [handle], eax
|
||||||
popad
|
mov [redrawmouse_unconditional], 1
|
||||||
|
call __sys_draw_pointer
|
||||||
mov [flags], edx
|
popad
|
||||||
|
@@:
|
||||||
; [ebp] pointer to filename
|
mov [flags], edx
|
||||||
|
|
||||||
|
; [ebp] pointer to filename
|
||||||
|
|
||||||
lea edi, [filename]
|
lea edi, [filename]
|
||||||
lea ecx, [edi+1024]
|
lea ecx, [edi+1024]
|
||||||
@ -182,13 +184,13 @@ proc fs_execute
|
|||||||
|
|
||||||
lea esi, [eax+1]
|
lea esi, [eax+1]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
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
|
||||||
cmp al, '.'
|
cmp al, '.'
|
||||||
jz .copy_process_name_done
|
jz .copy_process_name_done
|
||||||
test al, al
|
test al, al
|
||||||
@ -258,17 +260,20 @@ end if
|
|||||||
stdcall kernel_free, [file_base]
|
stdcall kernel_free, [file_base]
|
||||||
.err_file:
|
.err_file:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [application_table_status], eax
|
mov [application_table_status], eax
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
.final:
|
.final:
|
||||||
pushad
|
cmp [SCR_MODE], word 0x13
|
||||||
stdcall set_cursor, [handle]
|
jbe @f
|
||||||
mov [redrawmouse_unconditional], 1
|
pushad
|
||||||
call __sys_draw_pointer
|
stdcall set_cursor, [handle]
|
||||||
popad
|
mov [redrawmouse_unconditional], 1
|
||||||
ret
|
call __sys_draw_pointer
|
||||||
endp
|
popad
|
||||||
|
@@:
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
test_app_header:
|
test_app_header:
|
||||||
virtual at eax
|
virtual at eax
|
||||||
|
@ -47,18 +47,18 @@ run_test1:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
run_test2:
|
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
|
||||||
mov eax, edi
|
mov eax, edi
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
test ebx, 64
|
test ebx, 64
|
||||||
@ -75,13 +75,17 @@ run_test3:
|
|||||||
and eax, 1023
|
and eax, 1023
|
||||||
jz .loop
|
jz .loop
|
||||||
push ebx
|
push ebx
|
||||||
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
|
||||||
call malloc_with_test
|
push edi
|
||||||
; mov ecx, [saved_state_num]
|
call malloc_with_test
|
||||||
; mov [saved_state+ecx*8+4], eax
|
pop ecx
|
||||||
; inc [saved_state_num]
|
cmp ecx, edi
|
||||||
|
jnz edi_destroyed
|
||||||
|
; mov ecx, [saved_state_num]
|
||||||
|
; mov [saved_state+ecx*8+4], eax
|
||||||
|
; inc [saved_state_num]
|
||||||
pop ecx
|
pop ecx
|
||||||
pop ebx
|
pop ebx
|
||||||
inc esi
|
inc esi
|
||||||
@ -110,13 +114,17 @@ run_test3:
|
|||||||
mov edi, eax
|
mov edi, eax
|
||||||
mov al, [edi]
|
mov al, [edi]
|
||||||
repz scasb
|
repz scasb
|
||||||
jnz memory_destroyed
|
jnz memory_destroyed
|
||||||
pop eax edi
|
pop eax edi
|
||||||
push ebx edx
|
push ebx edx
|
||||||
call free
|
push edi
|
||||||
pop edx ebx
|
call free
|
||||||
dec esi
|
pop ecx
|
||||||
pop eax ecx
|
cmp ecx, edi
|
||||||
|
jnz edi_destroyed
|
||||||
|
pop edx ebx
|
||||||
|
dec esi
|
||||||
|
pop eax ecx
|
||||||
push edi
|
push edi
|
||||||
lea edi, [esp+4]
|
lea edi, [esp+4]
|
||||||
@@:
|
@@:
|
||||||
@ -147,15 +155,21 @@ malloc_with_test:
|
|||||||
jz generic_malloc_fail
|
jz generic_malloc_fail
|
||||||
call check_mutex
|
call check_mutex
|
||||||
call check_range
|
call check_range
|
||||||
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
|
ret
|
||||||
|
mutex_lock:
|
||||||
kernel_alloc:
|
inc dword [ecx]
|
||||||
cmp dword [esp+4], bufsize
|
ret
|
||||||
|
mutex_unlock:
|
||||||
|
dec dword [ecx]
|
||||||
|
ret
|
||||||
|
|
||||||
|
kernel_alloc:
|
||||||
|
cmp dword [esp+4], bufsize
|
||||||
jnz error1
|
jnz error1
|
||||||
mov eax, buffer
|
mov eax, buffer
|
||||||
ret 4
|
ret 4
|
||||||
@ -171,13 +185,13 @@ error1:
|
|||||||
|
|
||||||
generic_malloc_fail:
|
generic_malloc_fail:
|
||||||
mov eax, 2
|
mov eax, 2
|
||||||
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
|
||||||
@@:
|
@@:
|
||||||
mov eax, 3
|
mov eax, 3
|
||||||
jmp error_with_code
|
jmp error_with_code
|
||||||
|
|
||||||
@ -192,12 +206,16 @@ check_range:
|
|||||||
jmp error_with_code
|
jmp error_with_code
|
||||||
|
|
||||||
memory_destroyed:
|
memory_destroyed:
|
||||||
mov eax, 5
|
mov eax, 5
|
||||||
jmp error_with_code
|
jmp error_with_code
|
||||||
|
|
||||||
error_with_code:
|
edi_destroyed:
|
||||||
mov edx, saved_state_num
|
mov eax, 6
|
||||||
; eax = error code
|
jmp error_with_code
|
||||||
|
|
||||||
|
error_with_code:
|
||||||
|
mov edx, saved_state_num
|
||||||
|
; eax = error code
|
||||||
; 1 signals error in testing code (wrong bufsize)
|
; 1 signals error in testing code (wrong bufsize)
|
||||||
; 2 = malloc() returned NULL
|
; 2 = malloc() returned NULL
|
||||||
; 3 = mutex not released
|
; 3 = mutex not released
|
||||||
@ -205,12 +223,13 @@ error_with_code:
|
|||||||
; 5 = memory destroyed by malloc() or free()
|
; 5 = memory destroyed by malloc() or free()
|
||||||
int3 ; simplest way to report error
|
int3 ; simplest way to report error
|
||||||
jmp $-1 ; just in case
|
jmp $-1 ; just in case
|
||||||
|
|
||||||
; Include main heap code
|
; Include main heap code
|
||||||
include '../proc32.inc'
|
include '../proc32.inc'
|
||||||
include '../const.inc'
|
include '../struct.inc'
|
||||||
include 'malloc.inc'
|
include '../const.inc'
|
||||||
|
include 'malloc.inc'
|
||||||
|
|
||||||
i_end:
|
i_end:
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
|
@ -46,17 +46,29 @@ keymap_alt:
|
|||||||
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if lang eq ru
|
if lang eq ru
|
||||||
boot_fonts db '˜à¨äâë § £à㦥ë',0
|
boot_initirq db 'ˆ¨æ¨ «¨§ æ¨ï IRQ',0
|
||||||
boot_memdetect db 'Š®«¨ç¥á⢮ ®¯¥à ⨢®© ¯ ¬ïâ¨',' ',' Œ¡',0
|
boot_picinit db 'ˆ¨æ¨ «¨§ æ¨ï PIC',0
|
||||||
boot_tss db '“áâ ®¢ª TSSs',0
|
boot_v86machine db 'ˆ¨æ¨ «¨§ æ¨ï á¨á⥬ë V86 ¬ è¨ë',0
|
||||||
boot_cpuid db '—⥨¥ CPUIDs',0
|
boot_inittimer db 'ˆ¨æ¨ «¨§ æ¨ï á¨á⥬®£® â ©¬¥à (IRQ0)',0
|
||||||
boot_devices db '<27>®¨áª ãáâனáâ¢',0
|
boot_initapic db '<27>®¯ë⪠¨¨æ¨ «¨§ 樨 APIC',0
|
||||||
boot_timer db '“áâ ®¢ª â ©¬¥à ',0
|
boot_enableirq db '‚ª«îç¨âì ¯à¥àë¢ ¨ï 2, 6, 13, 14, 15',0
|
||||||
boot_irqs db '<27>¥à¥®¯à¥¤¥«¥¨¥ IRQ',0
|
boot_enablint_ide db '<27> §à¥è¥¨¥ ¯à¥àë¢ ¨© ¢ ª®â஫«¥à¥ IDE',0
|
||||||
boot_setmouse db '“áâ ®¢ª ¬ëè¨',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_tss db '“áâ ®¢ª TSSs',0
|
||||||
|
boot_cpuid db '—⥨¥ CPUIDs',0
|
||||||
|
; boot_devices db '<27>®¨áª ãáâனáâ¢',0
|
||||||
|
boot_timer db '“áâ ®¢ª â ©¬¥à ',0
|
||||||
|
boot_irqs db '<27>¥à¥®¯à¥¤¥«¥¨¥ IRQ',0
|
||||||
|
boot_setmouse db '“áâ ®¢ª ¬ëè¨',0
|
||||||
boot_windefs db '“áâ ®¢ª áâ஥ª ®ª® ¯® 㬮«ç ¨î',0
|
boot_windefs db '“áâ ®¢ª áâ஥ª ®ª® ¯® 㬮«ç ¨î',0
|
||||||
boot_bgr db '“áâ ®¢ª ä® ',0
|
boot_bgr db '“áâ ®¢ª ä® ',0
|
||||||
boot_resirqports db '<27>¥§¥à¢¨à®¢ ¨¥ IRQ ¨ ¯®à⮢',0
|
boot_resirqports db '<27>¥§¥à¢¨à®¢ ¨¥ IRQ ¨ ¯®à⮢',0
|
||||||
@ -66,57 +78,69 @@ if lang eq ru
|
|||||||
boot_tsc db '—⥨¥ TSC',0
|
boot_tsc db '—⥨¥ TSC',0
|
||||||
boot_cpufreq db '— áâ®â ¯à®æ¥áá®à ',' ',' Œƒæ',0
|
boot_cpufreq db '— áâ®â ¯à®æ¥áá®à ',' ',' Œƒæ',0
|
||||||
boot_pal_ega db '“áâ ®¢ª EGA/CGA 320x200 ¯ «¨âàë',0
|
boot_pal_ega db '“áâ ®¢ª EGA/CGA 320x200 ¯ «¨âàë',0
|
||||||
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
|
||||||
if preboot_blogesc
|
|
||||||
boot_tasking db '‚ᥠ£®â®¢® ¤«ï § ¯ã᪠, ¦¬¨âॠESC ¤«ï áâ àâ ',0
|
boot_APIC_found db 'APIC ¢ª«îç¥', 0
|
||||||
end if
|
boot_APIC_nfound db 'APIC ¥ ©¤¥', 0
|
||||||
else
|
if preboot_blogesc
|
||||||
boot_fonts db 'Fonts loaded',0
|
boot_tasking db '‚ᥠ£®â®¢® ¤«ï § ¯ã᪠, ¦¬¨âॠESC ¤«ï áâ àâ ',0
|
||||||
boot_memdetect db 'Determining amount of memory',0
|
end if
|
||||||
boot_tss db 'Setting TSSs',0
|
else
|
||||||
boot_cpuid db 'Reading CPUIDs',0
|
boot_initirq db 'Initialize IRQ',0
|
||||||
boot_devices db 'Detecting devices',0
|
boot_picinit db 'Initialize PIC',0
|
||||||
boot_setmouse db 'Setting mouse',0
|
boot_v86machine db 'Initialize system V86 machine',0
|
||||||
boot_windefs db 'Setting window defaults',0
|
boot_inittimer db 'Initialize system timer (IRQ0)',0
|
||||||
boot_bgr db 'Calculating background',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_tss db 'Setting TSSs',0
|
||||||
|
boot_cpuid db 'Reading CPUIDs',0
|
||||||
|
; boot_devices db 'Detecting devices',0
|
||||||
|
boot_setmouse db 'Setting mouse',0
|
||||||
|
boot_windefs db 'Setting window defaults',0
|
||||||
|
boot_bgr db 'Calculating background',0
|
||||||
boot_resirqports db 'Reserving IRQs & ports',0
|
boot_resirqports db 'Reserving IRQs & ports',0
|
||||||
boot_setostask db 'Setting OS task',0
|
boot_setostask db 'Setting OS task',0
|
||||||
boot_allirqs db 'Unmasking IRQs',0
|
boot_allirqs db 'Unmasking IRQs',0
|
||||||
boot_tsc db 'Reading TSC',0
|
boot_tsc db 'Reading TSC',0
|
||||||
boot_cpufreq db 'CPU frequency is ',' ',' MHz',0
|
boot_cpufreq db 'CPU frequency is ',' ',' MHz',0
|
||||||
boot_pal_ega db 'Setting EGA/CGA 320x200 palette',0
|
boot_pal_ega db 'Setting EGA/CGA 320x200 palette',0
|
||||||
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
|
||||||
if preboot_blogesc
|
|
||||||
boot_tasking db 'All set - press ESC to start',0
|
boot_APIC_found db 'APIC enabled', 0
|
||||||
end if
|
boot_APIC_nfound db 'APIC not found', 0
|
||||||
end if
|
if preboot_blogesc
|
||||||
|
boot_tasking db 'All set - press ESC to start',0
|
||||||
boot_APIC_found db 'APIC enabled', 0
|
end if
|
||||||
boot_APIC_nfound db 'APIC not found', 0
|
end if
|
||||||
|
|
||||||
;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
|
||||||
|
|
||||||
msg_unresolved db 'unresolved ',0
|
msg_unresolved db 'unresolved ',0
|
||||||
msg_module db 'in module ',0
|
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
|
|
||||||
|
szHwMouse db 'ATI2D',0
|
||||||
;szSound db 'SOUND',0
|
szPS2MDriver db 'PS2MOUSE',0
|
||||||
;szInfinity db 'INFINITY',0
|
;szCOM_MDriver db 'COM_MOUSE',0
|
||||||
szHwMouse db 'ATI2D',0
|
|
||||||
szPS2MDriver db 'PS2MOUSE',0
|
|
||||||
;szCOM_MDriver db 'COM_MOUSE',0
|
|
||||||
szUSB db 'USB',0
|
szUSB db 'USB',0
|
||||||
szAtiHW db '/rd/1/drivers/ati2d.drv',0
|
szAtiHW db '/rd/1/drivers/ati2d.drv',0
|
||||||
|
|
||||||
@ -132,15 +156,12 @@ notifyapp db '@notify',0
|
|||||||
if lang eq ru
|
if lang eq ru
|
||||||
ud_user_message db 'Žè¨¡ª : ¥¯®¤¤¥à¦¨¢ ¥¬ ï ¨áâàãªæ¨ï ¯à®æ¥áá®à ',0
|
ud_user_message db 'Žè¨¡ª : ¥¯®¤¤¥à¦¨¢ ¥¬ ï ¨áâàãªæ¨ï ¯à®æ¥áá®à ',0
|
||||||
else
|
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
|
bootpath db '/KOLIBRI '
|
||||||
char2 db '/sys/FONTS/CHAR2.MT',0
|
bootpath2 db 0
|
||||||
|
vmode db '/sys/drivers/VMODE.MDR',0
|
||||||
bootpath db '/KOLIBRI '
|
|
||||||
bootpath2 db 0
|
|
||||||
vmode db '/sys/drivers/VMODE.MDR',0
|
|
||||||
;vrr_m db 'VRR_M',0
|
;vrr_m db 'VRR_M',0
|
||||||
kernel_file db 'KERNEL MNT'
|
kernel_file db 'KERNEL MNT'
|
||||||
|
|
||||||
|
@ -130,12 +130,16 @@ search_partitions_bd:
|
|||||||
end_search_partitions_bd:
|
end_search_partitions_bd:
|
||||||
pop ecx
|
pop ecx
|
||||||
inc [hdpos]
|
inc [hdpos]
|
||||||
loop start_search_partitions_bd
|
loop start_search_partitions_bd
|
||||||
jmp end_search_partitions
|
jmp end_search_partitions
|
||||||
|
|
||||||
partition_data_transfer:
|
problem_partition db 0 ; used for partitions search
|
||||||
mov edi, [transfer_adress]
|
|
||||||
mov esi, PARTITION_START ;start of file_system_data
|
include '../fs/part_set.inc'
|
||||||
|
|
||||||
|
partition_data_transfer:
|
||||||
|
mov edi, [transfer_adress]
|
||||||
|
mov esi, PARTITION_START ;start of file_system_data
|
||||||
mov ecx, (file_system_data_size+3)/4
|
mov ecx, (file_system_data_size+3)/4
|
||||||
rep movsd
|
rep movsd
|
||||||
ret
|
ret
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -631,37 +631,40 @@ found_file_analyze_flp:
|
|||||||
; \begin{diamond}
|
; \begin{diamond}
|
||||||
fat_find_lfn:
|
fat_find_lfn:
|
||||||
; in: esi->name
|
; in: esi->name
|
||||||
; [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:
|
||||||
lea eax, [esp+0Ch+20h+262*2+4]
|
mov ebp, [esp+8+262*2+4]
|
||||||
call dword [eax-8]
|
lea eax, [esp+0Ch+20h+262*2+4]
|
||||||
jnc .l1
|
call dword [eax-8]
|
||||||
add esp, 262*2+4
|
jnc .l1
|
||||||
.reterr:
|
add esp, 262*2+4
|
||||||
stc
|
.reterr:
|
||||||
popa
|
mov [esp+28], eax
|
||||||
ret
|
stc
|
||||||
.found:
|
popa
|
||||||
add esp, 262*2+4
|
ret
|
||||||
; if this is LFN entry, advance to true entry
|
.found:
|
||||||
cmp byte [edi+11], 0xF
|
add esp, 262*2+4
|
||||||
jnz @f
|
mov ebp, [esp+8]
|
||||||
|
; if this is LFN entry, advance to true entry
|
||||||
|
cmp byte [edi+11], 0xF
|
||||||
|
jnz @f
|
||||||
lea eax, [esp+0Ch+20h]
|
lea eax, [esp+0Ch+20h]
|
||||||
call dword [eax-8]
|
call dword [eax-8]
|
||||||
jc .reterr
|
jc .reterr
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -166,16 +166,12 @@ endg
|
|||||||
and dword [esp+36], 0; ok read
|
and dword [esp+36], 0; ok read
|
||||||
mov dword [esp+24], 32*2; size of root
|
mov dword [esp+24], 32*2; size of root
|
||||||
ret
|
ret
|
||||||
|
|
||||||
fs_info: ;start of code - Mihasik
|
fs_info: ;start of code - Mihasik
|
||||||
push eax
|
push eax
|
||||||
cmp [eax+21], byte 'h'
|
cmp [eax+21], byte 'r'
|
||||||
je fs_info_h
|
je fs_info_r
|
||||||
cmp [eax+21], byte 'H'
|
cmp [eax+21], byte 'R'
|
||||||
je fs_info_h
|
|
||||||
cmp [eax+21], byte 'r'
|
|
||||||
je fs_info_r
|
|
||||||
cmp [eax+21], byte 'R'
|
|
||||||
je fs_info_r
|
je fs_info_r
|
||||||
mov eax, 3 ;if unknown disk
|
mov eax, 3 ;if unknown disk
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
@ -186,15 +182,12 @@ endg
|
|||||||
call ramdisk_free_space;if ramdisk
|
call ramdisk_free_space;if ramdisk
|
||||||
mov ecx, edi ;free space in ecx
|
mov ecx, edi ;free space in ecx
|
||||||
shr ecx, 9 ;free clusters
|
shr ecx, 9 ;free clusters
|
||||||
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_info1:
|
||||||
fs_info_h: ;if harddisk
|
pop edi
|
||||||
call get_hd_info
|
mov [esp+36], eax
|
||||||
fs_info1:
|
|
||||||
pop edi
|
|
||||||
mov [esp+36], eax
|
|
||||||
mov [esp+24], ebx ; total clusters on disk
|
mov [esp+24], ebx ; total clusters on disk
|
||||||
mov [esp+32], ecx ; free clusters on disk
|
mov [esp+32], ecx ; free clusters on disk
|
||||||
mov [edi], edx ; cluster size in bytes
|
mov [edi], edx ; cluster size in bytes
|
||||||
@ -434,41 +427,15 @@ choice_necessity_partition_1:
|
|||||||
hd_err_return:
|
hd_err_return:
|
||||||
call free_hd_channel
|
call free_hd_channel
|
||||||
and [hd1_status], 0
|
and [hd1_status], 0
|
||||||
jmp file_system_return
|
jmp file_system_return
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
cmp dword [esp+20], 0; READ
|
call free_hd_channel
|
||||||
jne fs_noharddisk_read
|
and [hd1_status], 0
|
||||||
|
|
||||||
mov eax, [esp+0] ; /fname
|
fs_noharddisk:
|
||||||
lea edi, [eax+12]
|
; \begin{diamond}[18.03.2006]
|
||||||
mov byte [eax], 0 ; path to asciiz
|
mov eax, 5 ; file not found
|
||||||
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
|
|
||||||
and [hd1_status], 0
|
|
||||||
|
|
||||||
fs_noharddisk:
|
|
||||||
; \begin{diamond}[18.03.2006]
|
|
||||||
mov eax, 5 ; file not found
|
|
||||||
; à ìîæåò áûòü, âîçâðàùàòü äðóãîé êîä îøèáêè?
|
; à ìîæåò áûòü, âîçâðàùàòü äðóãîé êîä îøèáêè?
|
||||||
mov ebx, [esp+24+24]; do not change ebx in application
|
mov ebx, [esp+24+24]; do not change ebx in application
|
||||||
; \end{diamond}[18.03.2006]
|
; \end{diamond}[18.03.2006]
|
||||||
|
@ -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
|
||||||
|
@ -30,31 +30,15 @@ PARTITION_END dd 0
|
|||||||
fs_type db 0 ; 1=NTFS, 2=EXT2/3, 16=FAT16, 32=FAT32
|
fs_type db 0 ; 1=NTFS, 2=EXT2/3, 16=FAT16, 32=FAT32
|
||||||
align 4
|
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
|
fs_dependent_data_end:
|
||||||
ROOT_CLUSTER dd 2 ; first rootdir cluster
|
file_system_data_size = $ - PARTITION_START
|
||||||
FAT_START dd 0 ; start of fat table
|
if file_system_data_size > 96
|
||||||
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:
|
|
||||||
file_system_data_size = $ - PARTITION_START
|
|
||||||
if file_system_data_size > 96
|
|
||||||
ERROR:
|
ERROR:
|
||||||
sizeof(file system data) too big!
|
sizeof(file system data) too big!
|
||||||
end if
|
end if
|
||||||
@ -85,13 +69,12 @@ virtual at fs_dependent_data_start
|
|||||||
; EXT2 data
|
; EXT2 data
|
||||||
ext2_data:
|
ext2_data:
|
||||||
.log_block_size dd ?
|
.log_block_size dd ?
|
||||||
.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 ?
|
|
||||||
.count_pointer_in_block dd ? ; block_size / 4
|
.count_pointer_in_block dd ? ; block_size / 4
|
||||||
.count_pointer_in_block_square dd ? ; (block_size / 4)**2
|
.count_pointer_in_block_square dd ? ; (block_size / 4)**2
|
||||||
.ext2_save_block dd ? ; ¡«®ª £«®¡ «ìãî 1 ¯à®æ¥¤ãàã
|
.ext2_save_block dd ? ; ¡«®ª £«®¡ «ìãî 1 ¯à®æ¥¤ãàã
|
||||||
@ -424,111 +407,30 @@ boot_read_ok:
|
|||||||
|
|
||||||
mov eax, [PARTITION_START] ;ext2 test changes [buffer]
|
mov eax, [PARTITION_START] ;ext2 test changes [buffer]
|
||||||
call hd_read
|
call hd_read
|
||||||
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
|
||||||
test eax, eax
|
push ebp
|
||||||
jz problem_fat_dec_count
|
mov ebp, esp
|
||||||
mov [SECTORS_PER_CLUSTER], eax
|
mov esi, 'old' ; special value: there is no DISK structure
|
||||||
|
push 1 ; bootsector read successfully
|
||||||
movzx ecx, word [ebx+0xb]; bytes per sector
|
call fat_create_partition
|
||||||
cmp ecx, 0x200
|
add esp, 4*7
|
||||||
jnz problem_fat_dec_count
|
test eax, eax
|
||||||
mov [BYTES_PER_SECTOR], ecx
|
jz problem_fat_dec_count
|
||||||
|
mov [fs_dependent_data_start.partition], eax
|
||||||
movzx eax, word [ebx+0x11]; count of rootdir entries (=0 fat32)
|
mov al, [eax+FAT.fs_type]
|
||||||
mov edx, 32
|
mov [fs_type], al
|
||||||
mul edx
|
|
||||||
dec ecx
|
popad
|
||||||
add eax, ecx ; round up if not equal count
|
call free_hd_channel
|
||||||
inc ecx ; bytes per sector
|
mov [hd1_status], 0 ; free
|
||||||
div ecx
|
ret
|
||||||
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
|
|
||||||
|
|
||||||
mov [fatRESERVED], 0x0FFFFFF6
|
|
||||||
mov [fatBAD], 0x0FFFFFF7
|
|
||||||
mov [fatEND], 0x0FFFFFF8
|
|
||||||
mov [fatMASK], 0x0FFFFFFF
|
|
||||||
mov [fs_type], 32 ; Fat32
|
|
||||||
call free_hd_channel
|
|
||||||
mov [hd1_status], 0 ; free
|
|
||||||
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
|
|
||||||
|
|
||||||
|
BIN
kernel/branches/net/gui/char.mt
Normal file
BIN
kernel/branches/net/gui/char.mt
Normal file
Binary file not shown.
BIN
kernel/branches/net/gui/char2.mt
Normal file
BIN
kernel/branches/net/gui/char2.mt
Normal file
Binary file not shown.
@ -225,7 +225,15 @@ draw_text_to_user_area:
|
|||||||
add eax, 8
|
add eax, 8
|
||||||
and ecx, 0xffffff
|
and ecx, 0xffffff
|
||||||
or ecx, 0xff000000 ; not transparent
|
or ecx, 0xff000000 ; not transparent
|
||||||
mov [eax], ecx ; store pixel
|
mov [eax], ecx ; store pixel
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
align 4
|
||||||
|
FONT_I:
|
||||||
|
file 'char.mt'
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
align 4
|
||||||
|
FONT_II:
|
||||||
|
file 'char2.mt'
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
@ -255,14 +255,14 @@ mouse._.left_button_press_handler: ;///////////////////////////////////////////
|
|||||||
@@:
|
@@:
|
||||||
test dl, mouse.WINDOW_RESIZE_E_FLAG
|
test dl, mouse.WINDOW_RESIZE_E_FLAG
|
||||||
jz .call_window_handler
|
jz .call_window_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
|
||||||
|
|
||||||
.calculate_n_delta:
|
.calculate_n_delta:
|
||||||
mov eax, [mouse.state.pos.y]
|
mov eax, [mouse.state.pos.y]
|
||||||
|
@ -1023,12 +1023,61 @@ align 4
|
|||||||
mov byte[MOUSE_DOWN], 0
|
mov byte[MOUSE_DOWN], 0
|
||||||
inc eax
|
inc eax
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
align 4
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
minimize_window: ;/////////////////////////////////////////////////////////////
|
minimize_all_window:
|
||||||
;------------------------------------------------------------------------------
|
push ebx ecx edx esi edi
|
||||||
;> eax = window number on screen
|
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: ;/////////////////////////////////////////////////////////////
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;> eax = window number on screen
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;# corrupts [dl*]
|
;# corrupts [dl*]
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
@ -1044,27 +1093,43 @@ minimize_window: ;/////////////////////////////////////////////////////////////
|
|||||||
jnz .exit
|
jnz .exit
|
||||||
|
|
||||||
push eax ebx ecx edx esi
|
push eax ebx ecx edx esi
|
||||||
|
|
||||||
; 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
|
||||||
mov eax, [edi + WDATA.box.left]
|
; If the window width is 0, then the action is not needed.
|
||||||
mov [draw_limits.left], eax
|
cmp [edi + WDATA.box.width], dword 0
|
||||||
mov ecx, eax
|
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 [draw_limits.left], eax
|
||||||
|
mov ecx, eax
|
||||||
add ecx, [edi + WDATA.box.width]
|
add ecx, [edi + WDATA.box.width]
|
||||||
mov [draw_limits.right], ecx
|
mov [draw_limits.right], ecx
|
||||||
mov ebx, [edi + WDATA.box.top]
|
mov ebx, [edi + WDATA.box.top]
|
||||||
mov [draw_limits.top], ebx
|
mov [draw_limits.top], ebx
|
||||||
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
|
; DEBUGF 1, "K : minimize_window\n"
|
||||||
xor eax, eax
|
; DEBUGF 1, "K : dl_left %x\n",[draw_limits.left]
|
||||||
call redrawscreen
|
; DEBUGF 1, "K : dl_right %x\n",[draw_limits.right]
|
||||||
|
; DEBUGF 1, "K : dl_top %x\n",[draw_limits.top]
|
||||||
pop esi edx ecx ebx eax
|
; DEBUGF 1, "K : dl_bottom %x\n",[draw_limits.bottom]
|
||||||
;--------------------------------------
|
call calculatescreen
|
||||||
align 4
|
; xor esi, esi
|
||||||
|
; xor eax, eax
|
||||||
|
mov eax, edi
|
||||||
|
call redrawscreen
|
||||||
|
;--------------------------------------
|
||||||
|
align 4
|
||||||
|
@@:
|
||||||
|
pop esi edx ecx ebx eax
|
||||||
|
;--------------------------------------
|
||||||
|
align 4
|
||||||
.exit:
|
.exit:
|
||||||
popfd
|
popfd
|
||||||
pop edi
|
pop edi
|
||||||
@ -1263,35 +1328,35 @@ align 4
|
|||||||
call window._.set_window_box
|
call window._.set_window_box
|
||||||
add esp, sizeof.BOX
|
add esp, sizeof.BOX
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
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
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
sys_window_end_moving_handler: ;///////////////////////////////////////////////
|
sys_window_end_moving_handler: ;///////////////////////////////////////////////
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;? <description>
|
;? <description>
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;> eax = old (original) window box
|
;> eax = old (original) window box
|
||||||
;> 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
|
||||||
add edi, window_data
|
add edi, window_data
|
||||||
|
|
||||||
mov eax, ebx
|
mov eax, ebx
|
||||||
@ -2316,23 +2381,23 @@ align 4
|
|||||||
mov bx, word[edi + BOX.top]
|
mov bx, word[edi + BOX.top]
|
||||||
add bx, word[edi + BOX.height]
|
add bx, word[edi + BOX.height]
|
||||||
call draw_rectangle.forced
|
call draw_rectangle.forced
|
||||||
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
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
window._.get_rect: ;/////////////////////////////////////////////////////
|
window._.get_rect: ;/////////////////////////////////////////////////////
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;? <description> void __fastcall get_window_rect(struct RECT* rc);
|
;? <description> void __fastcall get_window_rect(struct RECT* rc);
|
||||||
|
@ -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:
|
||||||
|
@ -23,20 +23,20 @@ $Revision $
|
|||||||
|
|
||||||
uglobal
|
uglobal
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
mousecount dd 0x0
|
mousecount dd 0x0
|
||||||
mousedata dd 0x0
|
mousedata dd 0x0
|
||||||
Y_UNDER_subtraction_CUR_hot_y:
|
Y_UNDER_sub_CUR_hot_y_add_curh:
|
||||||
dd 0
|
dw 0
|
||||||
X_UNDER_subtraction_CUR_hot_x:
|
Y_UNDER_subtraction_CUR_hot_y:
|
||||||
dd 0
|
dw 0
|
||||||
Y_UNDER_sub_CUR_hot_y_add_curh:
|
X_UNDER_sub_CUR_hot_x_add_curh:
|
||||||
dd 0
|
dw 0
|
||||||
X_UNDER_sub_CUR_hot_x_add_curh:
|
X_UNDER_subtraction_CUR_hot_x:
|
||||||
dd 0
|
dw 0
|
||||||
endg
|
endg
|
||||||
|
|
||||||
iglobal
|
iglobal
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
mouse_delay dd 10
|
mouse_delay dd 10
|
||||||
@ -121,12 +121,24 @@ save_draw_mouse:
|
|||||||
shl edx, 8
|
shl edx, 8
|
||||||
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
|
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
|
||||||
|
|
||||||
cmp esi, [current_cursor]
|
cmp esi, [current_cursor]
|
||||||
je .draw
|
je .draw
|
||||||
|
|
||||||
push esi
|
mov eax, [TASK_COUNT]
|
||||||
call [_display.select_cursor]
|
movzx eax, word [WIN_POS+eax*2]
|
||||||
mov [current_cursor], esi
|
shl eax, 8
|
||||||
|
|
||||||
|
cmp eax, edx
|
||||||
|
je @F
|
||||||
|
|
||||||
|
mov esi, [def_cursor]
|
||||||
|
cmp esi, [current_cursor]
|
||||||
|
je .draw
|
||||||
|
|
||||||
|
@@:
|
||||||
|
push esi
|
||||||
|
call [_display.select_cursor]
|
||||||
|
mov [current_cursor], esi
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.draw:
|
.draw:
|
||||||
@ -444,21 +456,21 @@ redrawmouse:
|
|||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov esi, [current_cursor]
|
mov esi, [current_cursor]
|
||||||
|
|
||||||
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
|
||||||
@@:
|
@@:
|
||||||
popfd
|
popfd
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
|
@ -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] ;;
|
||||||
@ -4961,7 +5133,7 @@ align 4
|
|||||||
align 4
|
align 4
|
||||||
.no_put:
|
.no_put:
|
||||||
pop ecx eax
|
pop ecx eax
|
||||||
|
|
||||||
sub ebp, 4
|
sub ebp, 4
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz .start_x
|
jnz .start_x
|
||||||
@ -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
|
||||||
|
@ -144,14 +144,14 @@
|
|||||||
; FFFF byte do not change task for 1/100 sec.
|
; FFFF byte do not change task for 1/100 sec.
|
||||||
;
|
;
|
||||||
; 0x80010000 -> 6CBFF kernel, 32-bit run-time code (up to 371 Kb)
|
; 0x80010000 -> 6CBFF kernel, 32-bit run-time code (up to 371 Kb)
|
||||||
|
|
||||||
; 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)
|
||||||
; 0x80080000 -> 8FFFF additional app info, in 256 byte steps - 256 entries
|
; 0x80080000 -> 8FFFF additional app info, in 256 byte steps - 256 entries
|
||||||
;
|
;
|
||||||
; 00 11db name of app running
|
; 00 11db name of app running
|
||||||
|
@ -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,148 +28,87 @@ struct BLITTER
|
|||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
align 4
|
|
||||||
|
|
||||||
__L1OutCode:
|
align 4
|
||||||
push ebx
|
block_clip:
|
||||||
mov ebx, 8
|
;esi= clip RECT ptr
|
||||||
cmp edx, [eax]
|
;edi= RECT ptr
|
||||||
jl .L2
|
;return code:
|
||||||
xor ebx, ebx
|
;eax= 0 - draw, 1 - don't draw
|
||||||
cmp edx, [eax+8]
|
|
||||||
setg bl
|
push ebx
|
||||||
sal ebx, 2
|
|
||||||
.L2:
|
mov eax, [edi+RECT.left]
|
||||||
cmp ecx, [eax+4]
|
mov ebx, [edi+RECT.right]
|
||||||
jge .L3
|
mov ecx, [esi+RECT.left] ;clip.left
|
||||||
or ebx, 1
|
mov edx, [esi+RECT.right] ;clip.right
|
||||||
jmp .L4
|
|
||||||
|
cmp eax, edx ;left >= clip.right
|
||||||
.L3:
|
jge .fail
|
||||||
cmp ecx, [eax+12]
|
|
||||||
jle .L4
|
cmp ebx, ecx ;right < clip.left
|
||||||
or ebx, 2
|
jl .fail
|
||||||
.L4:
|
|
||||||
mov eax, ebx
|
cmp eax, ecx ;left >= clip.left
|
||||||
pop ebx
|
jae @F
|
||||||
ret
|
|
||||||
|
mov eax, ecx
|
||||||
align 4
|
@@:
|
||||||
block_clip:
|
mov [edi+RECT.left], eax
|
||||||
push ebp
|
|
||||||
push edi
|
cmp ebx, edx ;right <= clip.right
|
||||||
push esi
|
jle @f
|
||||||
push ebx
|
mov ebx, edx
|
||||||
sub esp, 4
|
@@:
|
||||||
|
mov [edi+RECT.right], ebx
|
||||||
mov ebx, eax
|
|
||||||
mov [esp], edx
|
mov eax, [edi+RECT.top]
|
||||||
mov ebp, ecx
|
mov ebx, [edi+RECT.bottom]
|
||||||
mov ecx, [ecx]
|
mov ecx, [esi+RECT.top] ;clip.top
|
||||||
mov edx, [edx]
|
mov edx, [esi+RECT.bottom] ;clip.bottom
|
||||||
call __L1OutCode
|
|
||||||
|
cmp eax, edx ;top >= clip.bottom
|
||||||
mov esi, eax
|
jge .fail
|
||||||
mov edx, [esp+28]
|
|
||||||
mov ecx, [edx]
|
cmp ebx, ecx ;bottom < clip.top
|
||||||
.L21:
|
jl .fail
|
||||||
mov eax, [esp+24]
|
|
||||||
mov edx, [eax]
|
cmp eax, ecx ;top >= clip.top
|
||||||
mov eax, ebx
|
jae @F
|
||||||
call __L1OutCode
|
|
||||||
|
mov eax, ecx
|
||||||
mov edi, eax
|
@@:
|
||||||
.L20:
|
mov [edi+RECT.top], eax
|
||||||
mov eax, edi
|
|
||||||
and eax, esi
|
cmp ebx, edx ;bottom <= clip.bottom
|
||||||
jne .L9
|
jle @f
|
||||||
cmp esi, edi
|
mov ebx, edx
|
||||||
je .L9
|
@@:
|
||||||
test esi, esi
|
mov [edi+RECT.bottom], ebx
|
||||||
jne .L10
|
pop ebx
|
||||||
test edi, 1
|
xor eax, eax
|
||||||
je .L11
|
ret
|
||||||
mov eax, [ebx+4]
|
.fail:
|
||||||
jmp .L25
|
pop ebx
|
||||||
.L11:
|
mov eax, 1
|
||||||
test edi, 2
|
ret
|
||||||
je .L13
|
|
||||||
mov eax, [ebx+12]
|
|
||||||
.L25:
|
align 4
|
||||||
mov edx, [esp+28]
|
blit_clip:
|
||||||
jmp .L22
|
|
||||||
.L13:
|
.sx0 equ 8
|
||||||
test edi, 4
|
.sy0 equ 12
|
||||||
je .L14
|
.sx1 equ 16
|
||||||
mov eax, [ebx+8]
|
.sy1 equ 20
|
||||||
jmp .L26
|
|
||||||
.L14:
|
.dx0 equ 24
|
||||||
and edi, 8
|
.dy0 equ 28
|
||||||
je .L12
|
.dx1 equ 32
|
||||||
mov eax, [ebx]
|
.dy1 equ 36
|
||||||
.L26:
|
|
||||||
mov edx, [esp+24]
|
|
||||||
.L22:
|
push edi
|
||||||
mov [edx], eax
|
|
||||||
.L12:
|
|
||||||
mov eax, [esp+28]
|
|
||||||
mov ecx, [eax]
|
|
||||||
jmp .L21
|
|
||||||
.L10:
|
|
||||||
test esi, 1
|
|
||||||
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 esi
|
|
||||||
pop edi
|
|
||||||
pop ebp
|
|
||||||
ret
|
|
||||||
|
|
||||||
align 4
|
|
||||||
blit_clip:
|
|
||||||
|
|
||||||
.sx0 equ 36
|
|
||||||
.sy0 equ 32
|
|
||||||
.sx1 equ 28
|
|
||||||
.sy1 equ 24
|
|
||||||
|
|
||||||
.dx0 equ 20
|
|
||||||
.dy0 equ 16
|
|
||||||
.dx1 equ 12
|
|
||||||
.dy1 equ 8
|
|
||||||
|
|
||||||
|
|
||||||
push edi
|
|
||||||
push esi
|
push esi
|
||||||
push ebx
|
push ebx
|
||||||
sub esp, 40
|
sub esp, 40
|
||||||
@ -177,71 +116,58 @@ blit_clip:
|
|||||||
mov ebx, ecx
|
mov ebx, ecx
|
||||||
mov edx, [ecx+BLITTER.src_x]
|
mov edx, [ecx+BLITTER.src_x]
|
||||||
mov [esp+.sx0], edx
|
mov [esp+.sx0], edx
|
||||||
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
|
add eax, [ecx+BLITTER.h]
|
||||||
mov [esp+.sx1], edx
|
mov [esp+.sx1], edx
|
||||||
add eax, [ecx+BLITTER.h]
|
mov [esp+.sy1], eax
|
||||||
dec eax
|
|
||||||
mov [esp+.sy1], eax
|
lea edi, [esp+.sx0]
|
||||||
|
lea esi, [ebx+BLITTER.sc]
|
||||||
lea ecx, [esp+.sy0]
|
|
||||||
lea edx, [esp+.sx0]
|
call block_clip
|
||||||
lea eax, [ebx+BLITTER.sc]
|
test eax, eax
|
||||||
lea esi, [esp+.sy1]
|
mov esi, 1
|
||||||
|
jnz .done
|
||||||
mov [esp+4], esi
|
|
||||||
lea esi, [esp+.sx1]
|
mov edi, [esp+.sx0]
|
||||||
mov [esp], esi
|
mov edx, [ebx+BLITTER.dst_x]
|
||||||
call block_clip
|
|
||||||
|
|
||||||
mov esi, 1
|
|
||||||
test eax, eax
|
|
||||||
jne .L28
|
|
||||||
|
|
||||||
mov edi, [esp+.sx0]
|
|
||||||
mov edx, [ebx+BLITTER.dst_x]
|
|
||||||
add edx, edi
|
add edx, edi
|
||||||
sub edx, [ebx+BLITTER.src_x]
|
sub edx, [ebx+BLITTER.src_x]
|
||||||
mov [esp+.dx0], edx
|
mov [esp+.dx0], edx
|
||||||
|
|
||||||
mov ecx, [esp+.sy0]
|
mov ecx, [esp+.sy0]
|
||||||
mov eax, [ebx+BLITTER.dst_y]
|
mov eax, [ebx+BLITTER.dst_y]
|
||||||
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
|
|
||||||
add edx, [esp+.sx1]
|
sub edx, edi
|
||||||
mov [esp+.dx1], edx
|
add edx, [esp+.sx1]
|
||||||
|
mov [esp+.dx1], edx
|
||||||
|
|
||||||
sub eax, ecx
|
sub eax, ecx
|
||||||
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]
|
call block_clip
|
||||||
mov [esp+4], eax
|
test eax, eax
|
||||||
lea eax, [esp+.dx1]
|
mov esi, 1
|
||||||
mov [esp], eax
|
jnz .done
|
||||||
mov eax, ebx
|
|
||||||
call block_clip
|
mov edx, [esp+.dx0]
|
||||||
test eax, eax
|
mov eax, [esp+.dx1]
|
||||||
jne .L28
|
sub eax, edx
|
||||||
|
mov [ebx+BLITTER.w], eax
|
||||||
mov edx, [esp+.dx0]
|
|
||||||
mov eax, [esp+.dx1]
|
mov eax, [esp+.dy0]
|
||||||
inc eax
|
mov ecx, [esp+.dy1]
|
||||||
sub eax, edx
|
sub ecx, eax
|
||||||
mov [ebx+BLITTER.w], eax
|
mov [ebx+BLITTER.h], ecx
|
||||||
|
|
||||||
mov eax, [esp+.dy0]
|
|
||||||
mov ecx, [esp+.dy1]
|
|
||||||
inc ecx
|
|
||||||
sub ecx, eax
|
|
||||||
mov [ebx+BLITTER.h], ecx
|
|
||||||
|
|
||||||
mov ecx, [ebx+BLITTER.src_x]
|
mov ecx, [ebx+BLITTER.src_x]
|
||||||
add ecx, edx
|
add ecx, edx
|
||||||
sub ecx, [ebx+BLITTER.dst_x]
|
sub ecx, [ebx+BLITTER.dst_x]
|
||||||
@ -251,13 +177,13 @@ blit_clip:
|
|||||||
add ecx, eax
|
add ecx, eax
|
||||||
sub ecx, [ebx+BLITTER.dst_y]
|
sub ecx, [ebx+BLITTER.dst_y]
|
||||||
mov [ebx+BLITTER.src_y], ecx
|
mov [ebx+BLITTER.src_y], ecx
|
||||||
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
|
||||||
pop esi
|
pop esi
|
||||||
pop edi
|
pop edi
|
||||||
|
|
||||||
@ -271,43 +197,42 @@ purge .dx0
|
|||||||
purge .dy0
|
purge .dy0
|
||||||
purge .dx1
|
purge .dx1
|
||||||
purge .dy1
|
purge .dy1
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
align 4
|
||||||
|
blit_32:
|
||||||
align 4
|
push ebp
|
||||||
|
push edi
|
||||||
blit_32:
|
|
||||||
push ebp
|
|
||||||
push edi
|
|
||||||
push esi
|
push esi
|
||||||
push ebx
|
push ebx
|
||||||
sub esp, 72
|
sub esp, 72
|
||||||
|
|
||||||
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
|
||||||
xor eax, eax
|
inc edx
|
||||||
|
|
||||||
mov [esp+BLITTER.dc.xmin], eax
|
xor eax, eax
|
||||||
mov [esp+BLITTER.dc.ymin], eax
|
|
||||||
mov [esp+BLITTER.dc.xmax], ebx
|
mov [esp+BLITTER.dc.left], eax
|
||||||
mov [esp+BLITTER.dc.ymax], edx
|
mov [esp+BLITTER.dc.top], eax
|
||||||
|
mov [esp+BLITTER.dc.right], ebx
|
||||||
mov [esp+BLITTER.sc.xmin], eax
|
mov [esp+BLITTER.dc.bottom], edx
|
||||||
mov [esp+BLITTER.sc.ymin], eax
|
|
||||||
mov eax, [ecx+24]
|
mov [esp+BLITTER.sc.left], eax
|
||||||
dec eax
|
mov [esp+BLITTER.sc.top], eax
|
||||||
mov [esp+BLITTER.sc.xmax], eax
|
mov eax, [ecx+24]
|
||||||
mov eax, [ecx+28]
|
|
||||||
dec eax
|
mov [esp+BLITTER.sc.right], eax
|
||||||
mov [esp+BLITTER.sc.ymax], eax
|
mov eax, [ecx+28]
|
||||||
|
|
||||||
mov eax, [ecx]
|
mov [esp+BLITTER.sc.bottom], eax
|
||||||
mov [esp+BLITTER.dst_x], eax
|
|
||||||
mov eax, [ecx+4]
|
mov eax, [ecx]
|
||||||
|
mov [esp+BLITTER.dst_x], eax
|
||||||
|
mov eax, [ecx+4]
|
||||||
mov [esp+BLITTER.dst_y], eax
|
mov [esp+BLITTER.dst_y], eax
|
||||||
|
|
||||||
mov eax, [ecx+16]
|
mov eax, [ecx+16]
|
||||||
@ -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
|
||||||
|
@ -444,22 +444,17 @@ align 4
|
|||||||
.fail2:
|
.fail2:
|
||||||
ret
|
ret
|
||||||
endp
|
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 ?
|
mov esi, [hcursor]
|
||||||
inp_size dd ?
|
|
||||||
output dd ?
|
cmp [esi+CURSOR.magic], 'CURS'
|
||||||
out_size dd ?
|
jne .fail
|
||||||
endl
|
|
||||||
|
|
||||||
mov esi, [hcursor]
|
|
||||||
cmp [esi+CURSOR.magic], 'CURS'
|
|
||||||
jne .fail
|
|
||||||
|
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [CURRENT_TASK]
|
||||||
shl ebx, 5
|
shl ebx, 5
|
||||||
mov ebx, [CURRENT_TASK+ebx+4]
|
mov ebx, [CURRENT_TASK+ebx+4]
|
||||||
@ -639,12 +634,14 @@ align 4
|
|||||||
mov [cur.bottom], edi
|
mov [cur.bottom], edi
|
||||||
|
|
||||||
sub ebx, [x]
|
sub ebx, [x]
|
||||||
sub edi, [y]
|
sub edi, [y]
|
||||||
inc ebx
|
inc ebx
|
||||||
inc edi
|
inc edi
|
||||||
|
sub ebx, [_dx]
|
||||||
mov [cur.w], ebx
|
sub edi, [_dy]
|
||||||
mov [cur.h], edi
|
|
||||||
|
mov [cur.w], ebx
|
||||||
|
mov [cur.h], edi
|
||||||
mov [h], edi
|
mov [h], edi
|
||||||
|
|
||||||
mov eax, edi
|
mov eax, edi
|
||||||
@ -755,12 +752,14 @@ align 4
|
|||||||
mov [cur.bottom], edi
|
mov [cur.bottom], edi
|
||||||
|
|
||||||
sub ebx, [x]
|
sub ebx, [x]
|
||||||
sub edi, [y]
|
sub edi, [y]
|
||||||
inc ebx
|
inc ebx
|
||||||
inc edi
|
inc edi
|
||||||
|
sub ebx, [_dx]
|
||||||
mov [cur.w], ebx
|
sub edi, [_dy]
|
||||||
mov [cur.h], edi
|
|
||||||
|
mov [cur.w], ebx
|
||||||
|
mov [cur.h], edi
|
||||||
mov [h], edi
|
mov [h], edi
|
||||||
|
|
||||||
mov eax, edi
|
mov eax, edi
|
||||||
@ -832,16 +831,16 @@ check_mouse_area_for_getpixel_new:
|
|||||||
|
|
||||||
cmp ax, [X_UNDER_sub_CUR_hot_x_add_curh]
|
cmp ax, [X_UNDER_sub_CUR_hot_x_add_curh]
|
||||||
jae .no_mouse_area
|
jae .no_mouse_area
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
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
|
||||||
; eax = offset x
|
; eax = offset x
|
||||||
imul ebx, [cur.w] ;y
|
imul ebx, [cur.w] ;y
|
||||||
add eax, ebx
|
add eax, ebx
|
||||||
@ -871,47 +870,55 @@ check_mouse_area_for_putpixel_new:
|
|||||||
; ecx = x shl 16 + y
|
; ecx = x shl 16 + y
|
||||||
; eax = color
|
; eax = color
|
||||||
; out:
|
; out:
|
||||||
; eax = new color
|
; eax = new color
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
; check for Y
|
; check for Y
|
||||||
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
|
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
||||||
jb .no_mouse_area
|
jae .no_mouse_area
|
||||||
|
|
||||||
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
||||||
jae .no_mouse_area
|
jb .no_mouse_area
|
||||||
|
|
||||||
rol ecx, 16
|
rol ecx, 16
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
; check for X
|
; check for X
|
||||||
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
||||||
jb .no_mouse_area
|
jae .no_mouse_area
|
||||||
|
|
||||||
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
||||||
jae .no_mouse_area
|
jb .no_mouse_area
|
||||||
;--------------------------------------
|
|
||||||
align 4
|
ror ecx, 16
|
||||||
.1:
|
;--------------------------------------
|
||||||
push eax
|
align 4
|
||||||
; offset X
|
.1:
|
||||||
mov ax, [X_UNDER_subtraction_CUR_hot_x]
|
push eax
|
||||||
sub cx, ax ; x1
|
;--------------------------------------
|
||||||
ror ecx, 16
|
; ecx = (offset x) shl 16 + (offset y)
|
||||||
; offset Y
|
push ebx
|
||||||
mov ax, [Y_UNDER_subtraction_CUR_hot_y]
|
mov ebx, ecx
|
||||||
sub cx, ax ; y1
|
shr ebx, 16 ; x
|
||||||
;--------------------------------------
|
and ecx, 0xffff ; y
|
||||||
; ecx = (offset x) shl 16 + (offset y)
|
|
||||||
push ebx
|
cmp ecx, [cur.h]
|
||||||
mov ebx, ecx
|
jae @f
|
||||||
shr ebx, 16 ; x
|
|
||||||
and ecx, 0xffff ; y
|
cmp ebx, [cur.w]
|
||||||
; ecx = offset y
|
jb .ok
|
||||||
; ebx = offset x
|
;--------------------------------------
|
||||||
mov eax, [esp + 4]
|
align 4
|
||||||
|
@@:
|
||||||
push ebx ecx
|
; DEBUGF 1, "K : SHIT HAPPENS: %x %x \n", ecx,ebx
|
||||||
imul ecx, [cur.w] ;y
|
pop ebx
|
||||||
add ecx, ebx
|
jmp .sh ; SORRY! SHIT HAPPENS!
|
||||||
|
;--------------------------------------
|
||||||
|
align 4
|
||||||
|
.ok:
|
||||||
|
; ecx = offset y
|
||||||
|
; ebx = offset x
|
||||||
|
push ebx ecx
|
||||||
|
imul ecx, [cur.w] ;y
|
||||||
|
add ecx, ebx
|
||||||
mov ebx, ecx
|
mov ebx, ecx
|
||||||
shl ecx, 2
|
shl ecx, 2
|
||||||
cmp [ScreenBPP], byte 24
|
cmp [ScreenBPP], byte 24
|
||||||
@ -941,16 +948,20 @@ align 4
|
|||||||
|
|
||||||
pop ebx
|
pop ebx
|
||||||
|
|
||||||
test eax, 0xFF000000
|
test eax, 0xFF000000
|
||||||
jz @f
|
jz @f
|
||||||
|
|
||||||
pop ecx
|
add esp, 4
|
||||||
ret
|
ret
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
@@:
|
.sh:
|
||||||
pop eax
|
mov ecx, -1
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
|
align 4
|
||||||
|
@@:
|
||||||
|
pop eax
|
||||||
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.no_mouse_area:
|
.no_mouse_area:
|
||||||
ret
|
ret
|
||||||
|
@ -403,35 +403,44 @@ align 4
|
|||||||
mov eax, [putimg.ebp+4]
|
mov eax, [putimg.ebp+4]
|
||||||
call eax
|
call eax
|
||||||
cmp [ebp], bl
|
cmp [ebp], bl
|
||||||
jne .skip
|
jne .skip
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
push ecx
|
push ecx
|
||||||
mov ecx, [putimg.real_sy_and_abs_cy + 4]
|
;--------------------------------------
|
||||||
sub ecx, edi
|
align 4
|
||||||
;--------------------------------------
|
.sh:
|
||||||
; check for Y
|
neg ecx
|
||||||
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
|
add ecx, [putimg.real_sx_and_abs_cx + 4]
|
||||||
jb .no_mouse_area
|
;--------------------------------------
|
||||||
|
; check for X
|
||||||
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
||||||
jae .no_mouse_area
|
jae .no_mouse_area
|
||||||
|
|
||||||
rol ecx, 16
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
||||||
add ecx, [putimg.real_sx_and_abs_cx + 4]
|
jb .no_mouse_area
|
||||||
sub ecx, [esp]
|
|
||||||
;--------------------------------------
|
shl ecx, 16
|
||||||
; check for X
|
|
||||||
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
|
add ecx, [putimg.real_sy_and_abs_cy + 4]
|
||||||
jb .no_mouse_area
|
sub ecx, edi
|
||||||
|
;--------------------------------------
|
||||||
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
; check for Y
|
||||||
jae .no_mouse_area
|
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
||||||
;--------------------------------------
|
jae .no_mouse_area
|
||||||
; check mouse area for putpixel
|
|
||||||
call check_mouse_area_for_putpixel_new.1
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
||||||
;--------------------------------------
|
jb .no_mouse_area
|
||||||
align 4
|
;--------------------------------------
|
||||||
.no_mouse_area:
|
; check mouse area for putpixel
|
||||||
|
call check_mouse_area_for_putpixel_new.1
|
||||||
|
cmp ecx, -1 ;SHIT HAPPENS?
|
||||||
|
jne .no_mouse_area
|
||||||
|
|
||||||
|
mov ecx, [esp]
|
||||||
|
jmp .sh
|
||||||
|
;--------------------------------------
|
||||||
|
align 4
|
||||||
|
.no_mouse_area:
|
||||||
pop ecx
|
pop ecx
|
||||||
; store to real LFB
|
; store to real LFB
|
||||||
mov [LFB_BASE+edx], ax
|
mov [LFB_BASE+edx], ax
|
||||||
@ -605,35 +614,44 @@ align 4
|
|||||||
mov eax, [putimg.ebp+4]
|
mov eax, [putimg.ebp+4]
|
||||||
call eax
|
call eax
|
||||||
cmp [ebp], bl
|
cmp [ebp], bl
|
||||||
jne .skip
|
jne .skip
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
push ecx
|
push ecx
|
||||||
mov ecx, [putimg.real_sy_and_abs_cy + 4]
|
;--------------------------------------
|
||||||
sub ecx, edi
|
align 4
|
||||||
;--------------------------------------
|
.sh:
|
||||||
; check for Y
|
neg ecx
|
||||||
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
|
add ecx, [putimg.real_sx_and_abs_cx + 4]
|
||||||
jb .no_mouse_area
|
;--------------------------------------
|
||||||
|
; check for X
|
||||||
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
||||||
jae .no_mouse_area
|
jae .no_mouse_area
|
||||||
|
|
||||||
rol ecx, 16
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
||||||
add ecx, [putimg.real_sx_and_abs_cx + 4]
|
jb .no_mouse_area
|
||||||
sub ecx, [esp]
|
|
||||||
;--------------------------------------
|
shl ecx, 16
|
||||||
; check for X
|
|
||||||
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
|
add ecx, [putimg.real_sy_and_abs_cy + 4]
|
||||||
jb .no_mouse_area
|
sub ecx, edi
|
||||||
|
;--------------------------------------
|
||||||
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
; check for Y
|
||||||
jae .no_mouse_area
|
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
||||||
;--------------------------------------
|
jae .no_mouse_area
|
||||||
; check mouse area for putpixel
|
|
||||||
call check_mouse_area_for_putpixel_new.1
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
||||||
;--------------------------------------
|
jb .no_mouse_area
|
||||||
align 4
|
;--------------------------------------
|
||||||
.no_mouse_area:
|
; check mouse area for putpixel
|
||||||
|
call check_mouse_area_for_putpixel_new.1
|
||||||
|
cmp ecx, -1 ;SHIT HAPPENS?
|
||||||
|
jne .no_mouse_area
|
||||||
|
|
||||||
|
mov ecx, [esp]
|
||||||
|
jmp .sh
|
||||||
|
;--------------------------------------
|
||||||
|
align 4
|
||||||
|
.no_mouse_area:
|
||||||
pop ecx
|
pop ecx
|
||||||
; store to real LFB
|
; store to real LFB
|
||||||
mov [LFB_BASE+edx], eax
|
mov [LFB_BASE+edx], eax
|
||||||
@ -764,27 +782,29 @@ Vesa20_putpixel24_new:
|
|||||||
jne @f
|
jne @f
|
||||||
; check mouse area for putpixel
|
; check mouse area for putpixel
|
||||||
test eax, 0x04000000
|
test eax, 0x04000000
|
||||||
jnz @f
|
jnz @f
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
; check for Y
|
; check for Y
|
||||||
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
|
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
||||||
jb @f
|
jae @f
|
||||||
|
|
||||||
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
||||||
jae @f
|
jb @f
|
||||||
|
|
||||||
rol ecx, 16
|
rol ecx, 16
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
; check for X
|
; check for X
|
||||||
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
||||||
jb @f
|
jae @f
|
||||||
|
|
||||||
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
||||||
jae @f
|
jb @f
|
||||||
|
|
||||||
call check_mouse_area_for_putpixel_new.1
|
ror ecx, 16
|
||||||
;--------------------------------------
|
|
||||||
align 4
|
call check_mouse_area_for_putpixel_new.1
|
||||||
|
;--------------------------------------
|
||||||
|
align 4
|
||||||
@@:
|
@@:
|
||||||
; store to real LFB
|
; store to real LFB
|
||||||
mov [LFB_BASE+ebx+edi], ax
|
mov [LFB_BASE+ebx+edi], ax
|
||||||
@ -838,27 +858,29 @@ Vesa20_putpixel32_new:
|
|||||||
jne @f
|
jne @f
|
||||||
; check mouse area for putpixel
|
; check mouse area for putpixel
|
||||||
test eax, 0x04000000
|
test eax, 0x04000000
|
||||||
jnz @f
|
jnz @f
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
; check for Y
|
; check for Y
|
||||||
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
|
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
||||||
jb @f
|
jae @f
|
||||||
|
|
||||||
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
||||||
jae @f
|
jb @f
|
||||||
|
|
||||||
rol ecx, 16
|
rol ecx, 16
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
; check for X
|
; check for X
|
||||||
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
||||||
jb @f
|
jae @f
|
||||||
|
|
||||||
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
||||||
jae @f
|
jb @f
|
||||||
|
|
||||||
call check_mouse_area_for_putpixel_new.1
|
ror ecx, 16
|
||||||
;--------------------------------------
|
|
||||||
align 4
|
call check_mouse_area_for_putpixel_new.1
|
||||||
|
;--------------------------------------
|
||||||
|
align 4
|
||||||
@@:
|
@@:
|
||||||
and eax, 0xffffff
|
and eax, 0xffffff
|
||||||
; store to real LFB
|
; store to real LFB
|
||||||
@ -1369,28 +1391,30 @@ align 4
|
|||||||
jne .skip
|
jne .skip
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
mov ecx, [drbar.real_sy_and_abs_cy]
|
mov ecx, [drbar.real_sy_and_abs_cy]
|
||||||
sub ecx, esi
|
sub ecx, esi
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
; check for Y
|
; check for Y
|
||||||
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
|
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
||||||
jb .no_mouse_area
|
jae .no_mouse_area
|
||||||
|
|
||||||
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
||||||
jae .no_mouse_area
|
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]
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
||||||
jb .no_mouse_area
|
jae .no_mouse_area
|
||||||
|
|
||||||
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
||||||
jae .no_mouse_area
|
jb .no_mouse_area
|
||||||
;--------------------------------------
|
|
||||||
; check mouse area for putpixel
|
ror ecx, 16
|
||||||
push eax
|
;--------------------------------------
|
||||||
|
; check mouse area for putpixel
|
||||||
|
push eax
|
||||||
call check_mouse_area_for_putpixel_new.1
|
call check_mouse_area_for_putpixel_new.1
|
||||||
mov [edx], ax
|
mov [edx], ax
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
@ -1554,28 +1578,30 @@ align 4
|
|||||||
jne .skip
|
jne .skip
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
mov ecx, [drbar.real_sy_and_abs_cy]
|
mov ecx, [drbar.real_sy_and_abs_cy]
|
||||||
sub ecx, esi
|
sub ecx, esi
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
; check for Y
|
; check for Y
|
||||||
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
|
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
||||||
jb .no_mouse_area
|
jae .no_mouse_area
|
||||||
|
|
||||||
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
||||||
jae .no_mouse_area
|
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]
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
||||||
jb .no_mouse_area
|
jae .no_mouse_area
|
||||||
|
|
||||||
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
||||||
jae .no_mouse_area
|
jb .no_mouse_area
|
||||||
;--------------------------------------
|
|
||||||
; check mouse area for putpixel
|
ror ecx, 16
|
||||||
push eax
|
;--------------------------------------
|
||||||
|
; check mouse area for putpixel
|
||||||
|
push eax
|
||||||
call check_mouse_area_for_putpixel_new.1
|
call check_mouse_area_for_putpixel_new.1
|
||||||
mov [edx], eax
|
mov [edx], eax
|
||||||
pop eax
|
pop eax
|
||||||
|
Loading…
Reference in New Issue
Block a user