* Modified sysfunction 65 (see documentation), use new KFAR

* Deleted useless sysfunction 59 (syscalls trace)
* Load vmode.mdr via new file subsystem
* KFar 0.2

git-svn-id: svn://kolibrios.org@314 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Evgeny Grechnikov (Diamond) 2007-02-02 15:09:14 +00:00
parent e7d381a4b4
commit 822a9715c4
12 changed files with 658 additions and 273 deletions

View File

@ -138,8 +138,6 @@ TASK_BASE equ OS_BASE+0x0003010
TASK_DATA equ OS_BASE+0x0003020 TASK_DATA equ OS_BASE+0x0003020
TASK_EVENT equ OS_BASE+0x0003020 TASK_EVENT equ OS_BASE+0x0003020
save_syscall_data equ OS_BASE+0x0005000
;mouseunder equ OS_BASE+0x0006900 ;mouseunder equ OS_BASE+0x0006900
FLOPPY_BUFF equ OS_BASE+0x0008000 FLOPPY_BUFF equ OS_BASE+0x0008000
ACTIVE_PROC_STACK equ OS_BASE+0x000A400 ACTIVE_PROC_STACK equ OS_BASE+0x000A400

View File

@ -14,16 +14,13 @@ i40:
mov ds,ax mov ds,ax
mov es,ax mov es,ax
; for syscall trace function
call save_registers
; load all registers in crossed order ; load all registers in crossed order
mov edi,[esp+28] ; eax mov eax, ebx
mov eax,[esp+16] ; ebx mov ebx, ecx
mov ebx,[esp+24] ; ecx mov ecx, edx
mov ecx,[esp+20] ; edx mov edx, esi
mov edx,[esp+4] ; esi mov esi, edi
mov esi,[esp+0] ; edi mov edi, [esp+28]
; enable interupts - a task switch or an IRQ _CAN_ interrupt i40 handler ; enable interupts - a task switch or an IRQ _CAN_ interrupt i40 handler
sti sti
@ -31,34 +28,12 @@ i40:
and edi,0xff and edi,0xff
call dword [servetable+edi*4] call dword [servetable+edi*4]
pop eax pop eax
cli ; cli
popad popad
pop es ds pop es ds
iretd iretd
align 4
save_registers:
mov esi, [0x3010]
mov eax, [esi+TASKDATA.pid] ; load PID
lea esi, [esp+4]
inc [save_syscall_count]
mov edi,[save_syscall_count]
and edi,0xF
shl edi,6
add edi,save_syscall_data+32
mov [edi-32],eax
mov ecx,32 / 4
cld
rep movsd
ret
uglobal
save_syscall_count dd 0x0
endg
;label save_syscall_data dword at 0x5000
iglobal iglobal
;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -127,7 +102,7 @@ iglobal
dd undefined_syscall ; 56-reserved dd undefined_syscall ; 56-reserved
dd undefined_syscall ; 57-reserved dd undefined_syscall ; 57-reserved
dd file_system ; 58-Common file system interface dd file_system ; 58-Common file system interface
dd sys_trace ; 59-System call trace dd undefined_syscall ; 59-reserved
dd sys_IPC ; 60-Inter Process Communication dd sys_IPC ; 60-Inter Process Communication
dd sys_gs ; 61-Direct graphics access dd sys_gs ; 61-Direct graphics access
dd sys_pci ; 62-PCI functions dd sys_pci ; 62-PCI functions

View File

@ -1,4 +1,4 @@
ˆ…Œ<EFBFBD>… ”“<E2809D>Šˆˆ Ž<><EFBFBD>ˆŽ<CB86><C5BD>Ž‰ ‘ˆ‘’…Œ› Kolibri 0.6.3.0 ˆ…Œ<EFBFBD>… ”“<E2809D>Šˆˆ Ž<><EFBFBD>ˆŽ<CB86><C5BD>Ž‰ ‘ˆ‘’…Œ› Kolibri 0.6.4.0
<EFBFBD>®¬¥à ä㭪樨 ¯®¬¥é ¥âáï ¢ ॣ¨áâà eax. <EFBFBD>®¬¥à ä㭪樨 ¯®¬¥é ¥âáï ¢ ॣ¨áâà eax.
‚맮¢ á¨á⥬­®© ä㭪樨 ®áãé¥á⢫ï¥âáï ª®¬ ­¤®© "int 0x40". ‚맮¢ á¨á⥬­®© ä㭪樨 ®áãé¥á⢫ï¥âáï ª®¬ ­¤®© "int 0x40".
@ -851,8 +851,8 @@
db a,b,c,d ¤«ï ¢¥àᨨ a.b.c.d db a,b,c,d ¤«ï ¢¥àᨨ a.b.c.d
db UID_xxx: ®¤­® ¨§ UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2 db UID_xxx: ®¤­® ¨§ UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
db 'name',0 - ASCIIZ-áâப  á ¨¬¥­¥¬ db 'name',0 - ASCIIZ-áâப  á ¨¬¥­¥¬
„«ï ï¤à  Kolibri 0.6.3.0: „«ï ï¤à  Kolibri 0.6.4.0:
db 0,6,3,0 db 0,6,4,0
db 2 db 2
db 'Kolibri',0 db 'Kolibri',0
@ -2716,6 +2716,21 @@ dword-
* eax = 1 - ¯®àâ ᢮¡®¤¥­ * eax = 1 - ¯®àâ ᢮¡®¤¥­
* ebx à §àãè ¥âáï * ebx à §àãè ¥âáï
======================================================================
==== ”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 10 - ¯®«ãç¨âì áâ âãá ª ¡¥«ï Ethernet. ====
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 53 - ­®¬¥à ä㭪樨
* ebx = 10 - ­®¬¥à ¯®¤ä㭪樨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* al = -1 - ¤à ©¢¥à á¥â¥¢®© ª àâë ­¥ § £à㦥­ ¨«¨
­¥ ¯®¤¤¥à¦¨¢ ¥â íâã äã­ªæ¨î
* al = 0 - ª ¡¥«ì ­¥ ¯®¤ª«îçñ­
* al = 1 - ª ¡¥«ì ¯®¤ª«îçñ­
‡ ¬¥ç ­¨ï:
* ’¥ªãé ï ॠ«¨§ æ¨ï ï¤à  ¯®¤¤¥à¦¨¢ ¥â íâã äã­ªæ¨î
⮫쪮 ¤«ï á¥â¥¢ëå ª àâ RTL8139.
====================================================================== ======================================================================
”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 255 - ®â« ¤®ç­ ï ¨­ä®à¬ æ¨ï á¥â¥¢®£® ¤à ©¢¥à . ”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 255 - ®â« ¤®ç­ ï ¨­ä®à¬ æ¨ï á¥â¥¢®£® ¤à ©¢¥à .
====================================================================== ======================================================================
@ -3128,55 +3143,6 @@ dword-
¯®¤á¨áâ¥¬ë ¬®¦­® ®¯à¥¤¥«¨âì à §¬¥à ª« áâ¥à  (â ¬ ®­ åà ­¨âáï ¯®¤á¨áâ¥¬ë ¬®¦­® ®¯à¥¤¥«¨âì à §¬¥à ª« áâ¥à  (â ¬ ®­ åà ­¨âáï
¢ ᥪâ®à å) ¨ ®¡é¥¥ ç¨á«® ª« áâ¥à®¢ ¤«ï ¦ñáâª¨å ¤¨áª®¢. ¢ ᥪâ®à å) ¨ ®¡é¥¥ ç¨á«® ª« áâ¥à®¢ ¤«ï ¦ñáâª¨å ¤¨áª®¢.
======================================================================
=== ”ã­ªæ¨ï 59 - ¯®«ãç¨âì ¨­ä®à¬ æ¨î ® ¯®á«¥¤­¨å á¨á⥬­ëå ¢ë§®¢ å. ==
======================================================================
<EFBFBD>®«ã砥⠤ ­­ë¥ ® ¢á¥å á¨á⥬­ëå ¢ë§®¢ å ¢á¥å ¯à®æ¥áᮢ.
<EFBFBD> à ¬¥âàë:
* eax = 59 - ­®¬¥à ä㭪樨
* ebx = 0 - ¥¤¨­á⢥­­ ï ¯®¤äã­ªæ¨ï
* ecx = 㪠§ â¥«ì ­  ¡ãä¥à
* edx = à §¬¥à ¡ãä¥à 
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = ®¡é¥¥ ç¨á«® á¨á⥬­ëå ¢ë§®¢®¢,
ᤥ« ­­ëå á ¬®¬¥­â  § £à㧪¨ á¨á⥬ë (¯® ¬®¤ã«î 2^32)
* ebx = 0
”®à¬ â ¨­ä®à¬ æ¨¨ ®¡ ®¤­®¬ ¢ë§®¢¥: (à §¬¥à = 0x40 = 64 ¡ ©â )
* +0: dword: PID ¯à®æ¥áá /¯®â®ª 
* +4: 7*dword: ¬ãá®à
* +32 = +0x20: dword: §­ ç¥­¨¥ edi ¯à¨ ¢ë§®¢¥
* +36 = +0x24: dword: esi
* +40 = +0x28: dword: ebp
* +44 = +0x2C: dword: 㪠§ â¥«ì áâíª  ®¡à ¡®â稪  ï¤à 
* +48 = +0x30: dword: ebx
* +52 = +0x34: dword: edx
* +56 = +0x38: dword: ecx
* +60 = +0x3C: dword: eax (=­®¬¥à á¨á⥬­®© ä㭪樨)
‡ ¬¥ç ­¨ï:
* ”ã­ªæ¨ï ¨á¯®«ì§ã¥âáï ⮫쪮 ¢ ¯à¨«®¦¥­¨¨ systrace.
„®¢®«ì­® âà㤭® ¯à¥¤áâ ¢¨âì á¨âã æ¨î, ¢ ª®â®à®© íâ® ¯à¨«®¦¥­¨¥
¨«¨ íâ  äã­ªæ¨ï ¤¥©á⢨⥫쭮 ¯®«¥§­ë,   ¢®â ¢á¥ á¨á⥬­ë¥ ¢ë§®¢ë
¤«ï ¯®¤¤¥à¦ª¨ í⮩ ä㭪樨 ­¥áª®«ìª® § ¬¥¤«ïîâáï
(å®âï ¨ ­¥­ ¬­®£®)...
* á¢ï§¨ á í⨬ ¥áâì ¯à¥¤«®¦¥­¨¥ ¯®¤¤¥à¦ªã í⮩ ä㭪樨
¨§ ï¤à  ã¡à âì ᮢᥬ, ¢¬¥áâ¥ á ¯à¨«®¦¥­¨¥¬ systrace.
* ˆ­ä®à¬ æ¨ï ® á¨á⥬­ëå ¢ë§®¢ å á®åà ­ï¥âáï ¢
á¨á⥬­®¬ ª®«ì楢®¬ ¡ãä¥à¥ ­  0x10 ¢å®¤®¢.
<20>â  äã­ªæ¨ï ¯à®áâ® ª®¯¨àã¥â 㪠§ ­­ë© ®¡êñ¬ ¤ ­­ëå
¨§ 㯮¬ï­ã⮣® ¡ãä¥à  ¯® 㪠§ ­­®¬ã  ¤à¥áã.
* Š ª®© ¨§ ¢å®¤®¢ ¢ ¡ãä¥à¥ ᮮ⢥âáâ¢ã¥â ¯®á«¥¤­¥¬ã ¢ë§®¢ã,
¬®¦­® ®¯à¥¤¥«¨âì ¯® §­ ç¥­¨î eax,   ¨¬¥­­®,
¢å®¤ (eax and 0xF) (¯® ᬥ饭¨î (eax and 0xF)*0x40).
* ⥪ã饩 ॠ«¨§ æ¨¨ ¢®§¬®¦­ë ।ª® ¢áâà¥ç î騥áï
¯à®¡«¥¬ë à áᨭåà®­¨§ æ¨¨, ª®£¤  ® ­¥ª®â®àëå ¢ë§®¢ å
¨­ä®à¬ æ¨ï ãáâ à¥¢ ¥â.
* <20>®¤ á¨á⥬­ë© ¡ãä¥à ¢ë¤¥«¥­  áâà ­¨æ , 4Š¡.
<20> §¬¥à ¢å®¤  = 64 ¡ ©â .
<20>®ç¥¬ã ¨á¯®«ì§ã¥âáï ⮫쪮 16 ¢å®¤®¢ - ­¥¯®­ïâ­®.
* ‡­ ç¥­¨¥ esp ¢ ¬®¬¥­â á¨á⥬­®£® ¢ë§®¢ 
í⮩ ä㭪樥© 㧭 âì ­¥«ì§ï.
* <20>஢¥àª¨ ª®à४⭮á⨠edx ¢ ⥪ã饩 ॠ«¨§ æ¨¨ ­¥ ¤¥« ¥âáï.
====================================================================== ======================================================================
=========== ”ã­ªæ¨ï 60 - Inter Process Communication (IPC). ========== =========== ”ã­ªæ¨ï 60 - Inter Process Communication (IPC). ==========
====================================================================== ======================================================================
@ -3469,8 +3435,11 @@ IPC
* ebx = 㪠§ â¥«ì ­  ¨§®¡à ¦¥­¨¥ * ebx = 㪠§ â¥«ì ­  ¨§®¡à ¦¥­¨¥
* ecx = [à §¬¥à ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ y] * ecx = [à §¬¥à ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ y]
* edx = [ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [ª®®à¤¨­ â  ¯® ®á¨ y] * edx = [ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [ª®®à¤¨­ â  ¯® ®á¨ y]
* esi = ç¨á«® ¡¨â ­  ¯¨ªá¥«ì, ¤®«¦­® ¡ëâì 8 ¢ ⥪ã饩 ॠ«¨§ æ¨¨ * esi = ç¨á«® ¡¨â ­  ¯¨ªá¥«ì, ¤®«¦­® ¡ëâì 8, 24 ¨«¨ 32
* edi = 㪠§ â¥«ì ­  ¯ «¨âàã (256 梥⮢ 0x00RRGGBB) * edi = 㪠§ â¥«ì ­  ¯ «¨âàã (256 梥⮢ 0x00RRGGBB);
¨£­®à¨àã¥âáï ¯à¨ esi = 24 ¨ 32
* ebp = ᬥ饭¨¥ ¤ ­­ëå ª ¦¤®© á«¥¤ãî饩 áâப¨ ¨§®¡à ¦¥­¨ï
®â­®á¨â¥«ì­® ¯à¥¤ë¤ã饩
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï * äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï
‡ ¬¥ç ­¨ï: ‡ ¬¥ç ­¨ï:
@ -3480,6 +3449,8 @@ IPC
* Š ¦¤ë© ¡ ©â ¨§®¡à ¦¥­¨ï à áᬠâਢ ¥âáï ª ª ¨­¤¥ªá ¢ ¯ «¨âà¥. * Š ¦¤ë© ¡ ©â ¨§®¡à ¦¥­¨ï à áᬠâਢ ¥âáï ª ª ¨­¤¥ªá ¢ ¯ «¨âà¥.
* …᫨ ¨§®¡à ¦¥­¨¥ ¨á¯®«ì§ã¥â ­¥ ¢á¥ 256 梥⮢,   ¬¥­ìè¥, * …᫨ ¨§®¡à ¦¥­¨¥ ¨á¯®«ì§ã¥â ­¥ ¢á¥ 256 梥⮢,   ¬¥­ìè¥,
à §¬¥à ¯ «¨âàë ¬®¦¥â ¡ëâì ¬¥­ìè¥ 256. à §¬¥à ¯ «¨âàë ¬®¦¥â ¡ëâì ¬¥­ìè¥ 256.
* ‚맮¢ ä㭪樨 7 íª¢¨¢ «¥­â¥­ ¢ë§®¢ã í⮩ ä㭪樨 á ¯ à ¬¥âà ¬¨
esi=24, ebp=0.
====================================================================== ======================================================================
================= ”ã­ªæ¨ï 66 - à ¡®â  á ª« ¢¨ âãன. ================= ================= ”ã­ªæ¨ï 66 - à ¡®â  á ª« ¢¨ âãன. =================

View File

@ -1,4 +1,4 @@
SYSTEM FUNCTIONS of OS Kolibri 0.6.3.0 SYSTEM FUNCTIONS of OS Kolibri 0.6.4.0
Number of the function is located in the register eax. Number of the function is located in the register eax.
The call of the system function is executed by "int 0x40" command. The call of the system function is executed by "int 0x40" command.
@ -850,8 +850,8 @@ Structure of the buffer:
db a,b,c,d for version a.b.c.d db a,b,c,d for version a.b.c.d
db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2 db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
db 'name',0 - ASCIIZ-string with the name db 'name',0 - ASCIIZ-string with the name
For Kolibri 0.6.3.0 kernel: For Kolibri 0.6.4.0 kernel:
db 0,6,3,0 db 0,6,4,0
db 2 db 2
db 'Kolibri',0 db 'Kolibri',0
@ -2692,6 +2692,21 @@ Returned value:
* eax = 1 - port is free * eax = 1 - port is free
* ebx destroyed * ebx destroyed
======================================================================
===== Function 53, subfunction 10 - query Ethernet cable status. =====
======================================================================
Parameters:
* eax = 53 - function number
* ebx = 10 - subfunction number
Returned value:
* al = -1 - a network driver is not loaded or
does not support this function
* al = 0 - Ethernet cable is unplugged
* al = 1 - Ethernet cable is plugged
Remarks:
* The current kernel implementation supports this function
only for RTL8139 network cards.
====================================================================== ======================================================================
= Function 53, subfunction 255 - debug information of network driver. = Function 53, subfunction 255 - debug information of network driver.
====================================================================== ======================================================================
@ -3100,55 +3115,6 @@ Remarks:
it is stored in sectors) and total number of clusters it is stored in sectors) and total number of clusters
for hard disks. for hard disks.
======================================================================
=============== Function 59 - trace last system calls. ===============
======================================================================
Gets data on all system calls of all processes.
Parameters:
* eax = 59 - function number
* ebx = 0 - unique subfunction
* ecx = pointer to the buffer
* edx = size of the buffer
Returned value:
* eax = total number of system calls made from system boot
(modulo 2^32)
* ebx = 0
Format of information on one call: (size = 0x40 = 64 bytes)
* +0: dword: PID of process/thread
* +4: 7*dword: garbage
* +32 = +0x20: dword: value of edi at the call
* +36 = +0x24: dword: esi
* +40 = +0x28: dword: ebp
* +44 = +0x2C: dword: stack pointer of the kernel handler
* +48 = +0x30: dword: ebx
* +52 = +0x34: dword: edx
* +56 = +0x38: dword: ecx
* +60 = +0x3C: dword: eax (=number of system function)
Remarks:
* The function is used only in the application 'systrace'.
It is rather difficult to imagine a situation, in which
this application or this function are really useful;
and all system calls for support of this function are a little
decelerated (though not strongly)...
* So there is a proposition to delete from the kernel
support of this function, together with application 'systrace'.
* The information on system calls saves in the system
ring buffer with 0x10 entries.
This function simply copies the given size of data
from this buffer to the given address.
* One can determine, which entry in the buffer corresponds to
last system call, by value of eax, namely, it is the entry
(eax and 0xF) (at offset (eax and 0xF)*0x40).
* In the current implementation there can be the seldom
meeting problems of unsynchronization, when the information
on some calls becomes outdated.
* Under the system buffer one page, 4Kb, is allocated.
Size of an entry = 64 bytes. Why only 16 entries are used,
is not clearly.
* The value of esp at the moment of system call cannot
be determined by this function.
* The current implementation does not check edx for correctness.
====================================================================== ======================================================================
========== Function 60 - Inter Process Communication (IPC). ========== ========== Function 60 - Inter Process Communication (IPC). ==========
====================================================================== ======================================================================
@ -3436,8 +3402,10 @@ Parameters:
* ebx = pointer to the image * ebx = pointer to the image
* ecx = [size on axis x]*65536 + [size on axis y] * ecx = [size on axis x]*65536 + [size on axis y]
* edx = [coordinate on axis x]*65536 + [coordinate on axis y] * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
* esi = number of bits per pixel, must be 8 * esi = number of bits per pixel, must be 8, 24 or 32
* edi = pointer to palette (256 colors 0x00RRGGBB) * edi = pointer to palette (256 colors 0x00RRGGBB);
ignored when esi = 24 and 32
* ebp = offset of next row data relative to previous row data
Returned value: Returned value:
* function does not return value * function does not return value
Remarks: Remarks:
@ -3447,6 +3415,8 @@ Remarks:
* Each byte of image is index in the palette. * Each byte of image is index in the palette.
* If the image uses less than 256 colors, palette size may be * If the image uses less than 256 colors, palette size may be
less than 256 too. less than 256 too.
* The call to function 7 is equivalent to call to this function
with esi=24, ebp=0.
====================================================================== ======================================================================
================== Function 66 - work with keyboard. ================= ================== Function 66 - work with keyboard. =================

View File

@ -231,7 +231,7 @@ iglobal
char2 db 'FONTS/CHAR2.MT',0 char2 db 'FONTS/CHAR2.MT',0
bootpath db '/KOLIBRI ' bootpath db '/KOLIBRI '
bootpath2 db 0 bootpath2 db 0
vmode db 'VMODE MDR' vmode db 'VMODE.MDR',0
vrr_m db '/rd/1/VRR_M',0 vrr_m db '/rd/1/VRR_M',0
endg endg
@ -3977,7 +3977,7 @@ sys_putimage:
add dx,word[edi+0x80000+APPDATA.wnd_clientbox.left] add dx,word[edi+0x80000+APPDATA.wnd_clientbox.left]
rol edx,16 rol edx,16
.forced: .forced:
push esi ebp push ebp esi 0
mov ebp, putimage_get24bpp mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp mov esi, putimage_init24bpp
sys_putimage_bpp: sys_putimage_bpp:
@ -3996,7 +3996,7 @@ sys_putimage_bpp:
inc [mouse_pause] inc [mouse_pause]
call eax call eax
dec [mouse_pause] dec [mouse_pause]
pop ebp esi pop ebp esi ebp
jmp [draw_pointer] jmp [draw_pointer]
syscall_putimage_palette: syscall_putimage_palette:
@ -4009,8 +4009,9 @@ sys_putimage_palette:
; ebx = pointer to image ; ebx = pointer to image
; ecx = [xsize]*65536 + [ysize] ; ecx = [xsize]*65536 + [ysize]
; edx = [xstart]*65536 + [ystart] ; edx = [xstart]*65536 + [ystart]
; esi = number of bits per pixel, must be 8 ; esi = number of bits per pixel, must be 8, 24 or 32
; edi = pointer to palette ; edi = pointer to palette
; ebp = row delta
mov eax, [0x3000] mov eax, [0x3000]
shl eax, 8 shl eax, 8
add dx, word [eax+0x80000+APPDATA.wnd_clientbox.top] add dx, word [eax+0x80000+APPDATA.wnd_clientbox.top]
@ -4018,10 +4019,27 @@ sys_putimage_palette:
add dx, word [eax+0x80000+APPDATA.wnd_clientbox.left] add dx, word [eax+0x80000+APPDATA.wnd_clientbox.left]
rol edx, 16 rol edx, 16
.forced: .forced:
push esi ebp push ebp esi ebp
cmp esi, 8
jnz @f
mov ebp, putimage_get8bpp mov ebp, putimage_get8bpp
mov esi, putimage_init8bpp mov esi, putimage_init8bpp
jmp sys_putimage_bpp jmp sys_putimage_bpp
@@:
cmp esi, 24
jnz @f
mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp
jmp sys_putimage_bpp
@@:
cmp esi, 32
jnz @f
mov ebp, putimage_get32bpp
mov esi, putimage_init32bpp
jmp sys_putimage_bpp
@@:
pop ebp esi
ret
putimage_init24bpp: putimage_init24bpp:
lea eax, [eax*3] lea eax, [eax*3]
@ -4041,6 +4059,13 @@ putimage_get8bpp:
inc esi inc esi
ret 4 ret 4
putimage_init32bpp:
shl eax, 2
ret
putimage_get32bpp:
lodsd
ret 4
; eax x beginning ; eax x beginning
; ebx y beginning ; ebx y beginning
; ecx x end ; ecx x end
@ -4417,28 +4442,6 @@ sys_msg_board:
sys_trace:
test eax, eax ; get event data
jnz no_get_sys_events
mov esi,save_syscall_data ; data
mov edi,[0x3010]
mov edi,[edi+TASKDATA.mem_start]
add edi,ebx
cld
rep movsb
mov [esp+24],dword 0
mov eax,[save_syscall_count] ; count
mov [esp+36],eax
ret
no_get_sys_events:
ret
sys_process_def: sys_process_def:
mov edi, [0x3000] mov edi, [0x3000]

View File

@ -54,8 +54,7 @@
; 3c dword cpu usage in cpu timer tics ; 3c dword cpu usage in cpu timer tics
; ;
; ;
; 5000 -> 5FFF save_syscall_data - syscall trace ; 5000 -> 68FF free
; 6000 -> 68FF free
; 6900 -> 6EFF saved picture under mouse pointer ; 6900 -> 6EFF saved picture under mouse pointer
; ;
; 6F00 -> 6FFF free ; 6F00 -> 6FFF free

View File

@ -844,6 +844,7 @@ vesa12_putimage:
pop edi pop edi
add edi,[0xfe08] add edi,[0xfe08]
add esi,[esp+32]
dec ebx dec ebx
jnz newpi12 jnz newpi12

View File

@ -82,6 +82,13 @@ virtual at esp
.edi dd ? .edi dd ?
.esi dd ? .esi dd ?
.ebp dd ? .ebp dd ?
.esp dd ?
.ebx dd ?
.edx dd ?
.ecx dd ?
.eax dd ?
.ret_addr dd ?
.arg_0 dd ?
end virtual end virtual
align 16 align 16
@ -164,6 +171,7 @@ vesa20_putimage:
;; imul eax, [putimg.source_bpp] ;; imul eax, [putimg.source_bpp]
; lea eax, [eax + eax * 2] ; lea eax, [eax + eax * 2]
call esi call esi
add eax, [putimg.arg_0]
mov [putimg.line_increment], eax mov [putimg.line_increment], eax
; winmap new line increment ; winmap new line increment

View File

@ -10,18 +10,14 @@
; ;
;vmode db 'VMODE MDR' ; MDR - Menuet Driver
; must be located after fonts filenames in kernel.asm
; LOAD VIDEOMODE DRIVER ; LOAD VIDEOMODE DRIVER
; If vmode.mdr file not found ; If vmode.mdr file not found
or eax,-1 ; Driver ID = -1 (not present in system) or eax,-1 ; Driver ID = -1 (not present in system)
mov [0x760000],eax ; mov [0x760000],eax ;
mov [0x760100],byte 0xC3 ; Instruction RETN - driver loop mov [0x760100],byte 0xC3 ; Instruction RETN - driver loop
mov eax,vmode ; File name of driver mov esi, vmode
mov esi,12 xor ebx, ebx
mov ebx,0 mov ecx, 0x8000 ; size of memory area for driver
mov ecx,26000 mov edx, 0x760000 ; Memory position of driver
mov edx,0x760000 ; Memory position of driver call fs_RamdiskRead
call fileread

View File

@ -3,6 +3,11 @@
virtual at 0 virtual at 0
dlgtemplate: dlgtemplate:
; ”« Ł¨:
; ˇ¨â 0: ¨áŻ®«ě§®˘ âě áâ ­¤ ŕâ­ëĄ ć˘Ąâ  ¤¨ «®Ł 
; ˇ¨â 1: ¨áŻ®«ě§®˘ âě áâ ­¤ ŕâ­ëĄ ć˘Ąâ  ŻŕĄ¤ăŻŕĄ¦¤Ą­¨ď/®č¨ˇŞ¨
; (Ąá«¨ «îˇ®© ¨§ íâ¨ĺ ˇ¨â®˘ ăáâ ­®˘«Ą­, Ż®«ď main_color,border_color,header_color
; ¨Ł­®ŕ¨ŕăîâáď)
.flags dd ? .flags dd ?
.x dd ? .x dd ?
.y dd ? .y dd ?
@ -58,7 +63,28 @@ GenericBox:
or eax, -1 or eax, -1
ret 8 ret 8
.sizeok: .sizeok:
; set color if required
test byte [ebx+dlgtemplate.flags], 1
jz @f
mov edi, dialog_colors
jmp .setcolor
@@:
test byte [ebx+dlgtemplate.flags], 2
jz @f
mov edi, warning_colors
.setcolor:
mov al, [dialog_main_color-dialog_colors+edi]
mov [ebx+dlgtemplate.main_color], al
mov al, [dialog_border_color-dialog_colors+edi]
mov [ebx+dlgtemplate.border_color], al
mov al, [dialog_header_color-dialog_colors+edi]
mov [ebx+dlgtemplate.header_color], al
@@:
; allocate memory for data under dialog ; allocate memory for data under dialog
; for 'No memory' dialog use static data area
mov ebp, nomem_dlgsavearea
cmp ebx, nomem_dlgdata
jz .allocated
mov eax, [ebx+dlgtemplate.width] mov eax, [ebx+dlgtemplate.width]
add eax, [ebx+dlgtemplate.border_size_x] add eax, [ebx+dlgtemplate.border_size_x]
add eax, [ebx+dlgtemplate.border_size_x] add eax, [ebx+dlgtemplate.border_size_x]
@ -73,12 +99,12 @@ GenericBox:
call mf_alloc call mf_alloc
test eax, eax test eax, eax
jnz @f jnz @f
; TODO: add error message
popad popad
or eax, -1 or eax, -1
ret 8 ret 8
@@: @@:
mov ebp, eax mov ebp, eax
.allocated:
; save data ; save data
mov eax, [ebx+dlgtemplate.y] mov eax, [ebx+dlgtemplate.y]
add eax, [ebx+dlgtemplate.height] add eax, [ebx+dlgtemplate.height]
@ -402,8 +428,11 @@ GenericBox:
push eax push eax
call restore_console_data call restore_console_data
call draw_keybar call draw_keybar
cmp ebx, nomem_dlgdata
jz @f
mov eax, ebp mov eax, ebp
call mf_free call mf_free
@@:
or [cursor_x], -1 or [cursor_x], -1
or [cursor_y], -1 or [cursor_y], -1
call draw_image call draw_image
@ -526,7 +555,7 @@ menu_centered_in:
; +44: dd begin_variant ; +44: dd begin_variant
; +48: dd end_variant ; +48: dd end_variant
; +52: dd cur_variant_idx ; +52: dd cur_variant_idx
call mf_alloc call xmalloc
test eax, eax test eax, eax
jnz @f jnz @f
.ret_bad: .ret_bad:
@ -995,9 +1024,10 @@ DialogBox:
push ManagerDlgProc push ManagerDlgProc
push dword [esp+8] push dword [esp+8]
call GenericBox call GenericBox
ret 8 ret 4
ManagerDlgProc: ManagerDlgProc:
mov ebp, ebx
mov eax, [esp+8] mov eax, [esp+8]
dec eax dec eax
jz .draw jz .draw
@ -1052,8 +1082,7 @@ ManagerDlgProc:
mov eax, ebx mov eax, ebx
ret 16 ret 16
@@: @@:
mov ebx, [esp+4] lea ebx, [ebp+dlgtemplate.size+12]
add ebx, dlgtemplate.size+12
.enter_find: .enter_find:
cmp [ebx+dlgitemtemplate.type], 2 cmp [ebx+dlgitemtemplate.type], 2
jnz @f jnz @f
@ -1077,8 +1106,7 @@ ManagerDlgProc:
jnz .btn_found jnz .btn_found
loop @b loop @b
.find_first_btn: .find_first_btn:
mov ebx, [esp+4] lea ebx, [ebp+dlgtemplate.size+12]
add ebx, dlgtemplate.size+12
@@: @@:
test [ebx+dlgitemtemplate.flags], 8 test [ebx+dlgitemtemplate.flags], 8
jnz .btn_found jnz .btn_found
@ -1087,7 +1115,7 @@ ManagerDlgProc:
.btn_found: .btn_found:
or byte [ebx+dlgitemtemplate.flags], 4 or byte [ebx+dlgitemtemplate.flags], 4
.ret_draw: .ret_draw:
mov ebx, [esp+4] mov ebx, ebp
call .dodraw call .dodraw
call draw_image call draw_image
xor eax, eax xor eax, eax
@ -1097,8 +1125,7 @@ ManagerDlgProc:
.up: .up:
jecxz .ret0 jecxz .ret0
and byte [ebx+dlgitemtemplate.flags], not 4 and byte [ebx+dlgitemtemplate.flags], not 4
mov eax, [esp+4] sub ecx, [ebp+dlgtemplate.size+8]
sub ecx, [eax+dlgtemplate.size+8]
neg ecx neg ecx
jz .find_last_btn jz .find_last_btn
@@: @@:
@ -1107,9 +1134,9 @@ ManagerDlgProc:
loopz @b loopz @b
jnz .btn_found jnz .btn_found
.find_last_btn: .find_last_btn:
mov ebx, [eax+dlgtemplate.size+8] mov ebx, [ebp+dlgtemplate.size+8]
imul ebx, dlgitemtemplate.size imul ebx, dlgitemtemplate.size
lea ebx, [ebx+eax+dlgtemplate.size+12] lea ebx, [ebx+ebp+dlgtemplate.size+12]
@@: @@:
sub ebx, dlgitemtemplate.size sub ebx, dlgitemtemplate.size
test [ebx+dlgitemtemplate.flags], 8 test [ebx+dlgitemtemplate.flags], 8
@ -1262,6 +1289,9 @@ ManagerDlgProc:
draw_static_text: draw_static_text:
; ŕ¨á㼏 áâ â¨çĽáިŠ ⼪áâ ; ŕ¨á㼏 áâ â¨çĽáިŠ ⼪áâ
mov ah, [dialog_main_color] mov ah, [dialog_main_color]
test byte [ebp+dlgtemplate.flags], 2
jz draw_text
mov ah, [warning_main_color]
draw_text: draw_text:
; ŽŻŕĽ¤ĽŤďĽŹ ¤Ť¨­ă áâப¨ ; ŽŻŕĽ¤ĽŤďĽŹ ¤Ť¨­ă áâப¨
mov esi, [ebx+dlgitemtemplate.data] mov esi, [ebx+dlgitemtemplate.data]
@ -1299,13 +1329,12 @@ draw_text_esi:
xor eax, eax xor eax, eax
.text_draw: .text_draw:
push ecx push ecx
mov ecx, [esp+24]
push eax push eax
mov eax, [ebx+dlgitemtemplate.x1] mov eax, [ebx+dlgitemtemplate.x1]
add eax, [ecx+dlgtemplate.x] add eax, [ebp+dlgtemplate.x]
push edx push edx
mov edx, [ebx+dlgitemtemplate.y1] mov edx, [ebx+dlgitemtemplate.y1]
add edx, [ecx+dlgtemplate.y] add edx, [ebp+dlgtemplate.y]
call get_console_ptr call get_console_ptr
pop edx pop edx
pop ecx pop ecx
@ -1337,9 +1366,8 @@ draw_text_esi:
stosw stosw
loop @b loop @b
.ret: .ret:
mov ecx, [esp+20] mov eax, [ebp+dlgtemplate.x]
mov eax, [ecx+dlgtemplate.x] mov edx, [ebp+dlgtemplate.y]
mov edx, [ecx+dlgtemplate.y]
add eax, [ebx+dlgitemtemplate.x2] add eax, [ebx+dlgitemtemplate.x2]
inc eax inc eax
add edx, [ebx+dlgitemtemplate.y1] add edx, [ebx+dlgitemtemplate.y1]
@ -1354,10 +1382,15 @@ draw_text_esi:
ret ret
draw_button: draw_button:
mov ah, [dialog_normal_btn_color] mov ecx, dialog_colors
test byte [ebp+dlgtemplate.flags], 2
jz @f
mov ecx, warning_colors
@@:
mov ah, [dialog_normal_btn_color-dialog_colors+ecx]
test [ebx+dlgitemtemplate.flags], 4 test [ebx+dlgitemtemplate.flags], 4
jz @f jz @f
mov ah, [dialog_selected_btn_color] mov ah, [dialog_selected_btn_color-dialog_colors+ecx]
@@: @@:
jmp draw_text jmp draw_text
@ -1368,19 +1401,198 @@ draw_editbox:
mov eax, [ebx+dlgitemtemplate.x1] mov eax, [ebx+dlgitemtemplate.x1]
add eax, [edx+4] add eax, [edx+4]
sub eax, [edx+8] sub eax, [edx+8]
mov ecx, [esp+16] add eax, [ebp+dlgtemplate.x]
add eax, [ecx+dlgtemplate.x]
mov [cursor_x], eax mov [cursor_x], eax
mov eax, [ebx+dlgitemtemplate.y1] mov eax, [ebx+dlgitemtemplate.y1]
add eax, [ecx+dlgtemplate.y] add eax, [ebp+dlgtemplate.y]
mov [cursor_y], eax mov [cursor_y], eax
@@: @@:
mov ah, [dialog_edit_color] mov ecx, dialog_colors
test byte [ebp+dlgtemplate.flags], 2
jz @f
mov ecx, warning_colors
@@:
mov ah, [dialog_edit_color-dialog_colors+ecx]
test [ebx+dlgitemtemplate.flags], 10h test [ebx+dlgitemtemplate.flags], 10h
jnz @f jnz @f
mov ah, [dialog_unmodified_edit_color] mov ah, [dialog_unmodified_edit_color-dialog_colors+ecx]
@@: @@:
mov esi, [ebx+dlgitemtemplate.data] mov esi, [ebx+dlgitemtemplate.data]
add esi, [edx+8] add esi, [edx+8]
add esi, 12 add esi, 12
jmp draw_text_esi jmp draw_text_esi
; void __stdcall SayNoMem(void);
SayNoMem:
or dword [nomem_dlgdata+4], -1
or dword [nomem_dlgdata+8], -1
push nomem_dlgdata
call DialogBox
ret
; int __stdcall SayErr(const char* title, int x, int y,
; int num_strings, const char* strings[],
; int num_buttons, const char* buttons[]);
; may be x=-1 and/or y=-1
; [esp+4] = title
; [esp+8] = x
; [esp+12] = y
; [esp+16] = num_strings
; [esp+20] = strings
; [esp+24] = num_buttons
; [esp+28] = buttons
SayErr:
mov eax, [esp+16]
add eax, [esp+24]
imul eax, dlgitemtemplate.size
add eax, dlgtemplate.size+12
call xmalloc
test eax, eax
jnz @f
or eax, -1
ret 28
@@:
pushad
mov ebx, eax
mov edi, eax
mov eax, 2
stosd ; dlgtemplate.flags
mov eax, [esp+32+8]
stosd ; dlgtemplate.x
mov eax, [esp+32+12]
stosd ; dlgtemplate.y
; calculate width
mov ecx, [esp+32+16]
mov esi, [esp+32+20]
xor edx, edx
.calcwidth:
lodsd
@@:
inc eax
cmp byte [eax-1], 0
jnz @b
sub eax, [esi-4]
inc eax
cmp edx, eax
ja @f
mov edx, eax
@@:
loop .calcwidth
mov ecx, [esp+32+24]
mov esi, [esp+32+28]
xor ebp, ebp
.calcwidth2:
lodsd
@@:
inc eax
cmp byte [eax-1], 0
jnz @b
sub eax, [esi-4]
inc eax
add ebp, eax
loop .calcwidth2
inc ebp
inc ebp
cmp edx, ebp
ja @f
mov edx, ebp
@@:
mov eax, [cur_width]
sub eax, 8
cmp edx, eax
jb @f
mov edx, eax
@@:
mov eax, edx
stosd ; dlgtemplate.width
mov eax, [esp+32+16]
inc eax
stosd ; dlgtemplate.height
mov eax, 3
stosd ; dlgtemplate.border_size_x
mov al, 2
stosd ; dlgtemplate.border_size_y
mov eax, [esp+32+4]
stosd ; dlgtemplate.title
xor eax, eax
stosd ; (ignored)
stosd ; DlgProc
stosd ; userdata
mov eax, [esp+32+16]
add eax, [esp+32+24]
stosd ; num_items
; fill strings
xor ecx, ecx
mov esi, [esp+32+20]
@@:
mov eax, 1
stosd ; dlgitemtemplate.type
dec eax
stosd ; dlgitemtemplate.x1
mov eax, ecx
stosd ; dlgitemtemplate.y1
lea eax, [edx-1]
stosd ; dlgitemtemplate.x2
mov eax, ecx
stosd ; dlgitemtemplate.y2
movsd ; dlgitemtemplate.data
mov eax, 1
stosd ; dlgitemtemplate.flags
inc ecx
cmp ecx, [esp+32+16]
jb @b
; fill buttons
mov ecx, [esp+32+24]
mov esi, [esp+32+28]
sub edx, ebp
jc .big
shr edx, 1
inc edx
jmp .fillbtns
.big:
xor edx, edx
.fillbtns:
mov eax, 2
stosd ; dlgitemtemplate.type
mov eax, edx
stosd ; dlgitemtemplate.x1
mov eax, [ebx+dlgtemplate.height]
dec eax
stosd ; dlgitemtemplate.y1
push eax
lodsd
sub eax, edx
@@:
inc edx
cmp byte [eax+edx-1], 0
jnz @b
mov eax, edx
inc edx
stosd ; dlgitemtemplate.x2
pop eax
stosd ; dlgitemtemplate.y2
mov eax, [esi-4]
stosd ; dlgitemtemplate.data
mov eax, 9
cmp ecx, [esp+32+24]
jnz @f
or al, 4
@@:
stosd ; dlgitemtemplate.flags
loop .fillbtns
push ebx
call DialogBox
cmp eax, -1
jz @f
sub eax, ebx
sub eax, dlgtemplate.size+12
xor edx, edx
mov ecx, dlgitemtemplate.size
div ecx
sub eax, [esp+32+16]
@@:
mov [esp+28], eax
mov eax, ebx
call mf_free
popad
ret 28

View File

@ -14,6 +14,7 @@ include 'kglobals.inc'
include 'memalloc.inc' include 'memalloc.inc'
include 'dialogs.inc' include 'dialogs.inc'
include 'viewer.inc' include 'viewer.inc'
include 'tools.inc'
start: start:
mov eax, mem mov eax, mem
@ -61,14 +62,18 @@ start:
mov eax, 8 mov eax, 8
call mf_alloc call mf_alloc
mov [screens], eax mov [screens], eax
test eax, eax
jz exit
mov ecx, panels_vtable mov ecx, panels_vtable
mov [eax], ecx mov [eax], ecx
mov [active_screen_vtable], ecx mov [active_screen_vtable], ecx
call draw_keybar call draw_keybar
call draw_cmdbar call draw_cmdbar
mov [prev_dir], 0
mov ebp, panel1_data mov ebp, panel1_data
call read_folder call read_folder
call draw_panel call draw_panel
mov [bSilentFolderMode], 1
mov ebp, panel2_data mov ebp, panel2_data
call read_folder call read_folder
call draw_panel call draw_panel
@ -112,7 +117,7 @@ redraw:
int 0x40 int 0x40
xor eax, eax xor eax, eax
; ebx, ecx, edi are ignored by function 0 after first redraw ; ebx, ecx, edi are ignored by function 0 after first redraw
mov edx, 0x13000000 mov edx, 0x53000000
int 0x40 int 0x40
mov al, 12 mov al, 12
inc ebx inc ebx
@ -121,6 +126,7 @@ redraw:
@@: @@:
xor ecx, ecx xor ecx, ecx
mov eax, [ebx+42] mov eax, [ebx+42]
mov [wnd_width], eax
sub eax, 5*2-1 sub eax, 5*2-1
jae @f jae @f
xor eax, eax xor eax, eax
@ -143,8 +149,10 @@ redraw:
setnz cl setnz cl
or cl, ch or cl, ch
test edx, edx test edx, edx
mov [fill_width], edx
setnz ch setnz ch
mov eax, [ebx+46] mov eax, [ebx+46]
mov [wnd_height], eax
sub eax, [skinh] sub eax, [skinh]
sub eax, 5-1 sub eax, 5-1
jns @f jns @f
@ -163,6 +171,7 @@ redraw:
mov eax, 255 mov eax, 255
mov cl, 1 mov cl, 1
@@: @@:
mov [fill_height], edx
cmp eax, [cur_height] cmp eax, [cur_height]
mov [cur_height], eax mov [cur_height], eax
jnz .resize jnz .resize
@ -405,9 +414,8 @@ ctrlkey_test4:
setz al setz al
ret ret
; TODO: add "no memory" error handling
new_screen: new_screen:
call mf_alloc call xmalloc
test eax, eax test eax, eax
jnz @f jnz @f
ret ret
@ -417,7 +425,7 @@ new_screen:
inc ebx inc ebx
shl ebx, 3 shl ebx, 3
mov eax, [screens] mov eax, [screens]
call mf_realloc call xrealloc
test eax, eax test eax, eax
jnz @f jnz @f
mov eax, ebp mov eax, ebp
@ -461,7 +469,7 @@ delete_active_screen:
mov ebx, [num_screens] mov ebx, [num_screens]
shl ebx, 3 shl ebx, 3
mov eax, [screens] mov eax, [screens]
call mf_realloc call mf_realloc ; must succeed, because we decrease size
pop eax pop eax
call mf_free call mf_free
and [active_screen], 0 and [active_screen], 0
@ -484,7 +492,7 @@ F12:
add eax, 8 add eax, 8
mov esi, eax mov esi, eax
mul [num_screens] mul [num_screens]
call mf_alloc call xmalloc
test eax, eax test eax, eax
jnz @f jnz @f
ret ret
@ -737,11 +745,16 @@ panels_OnKey:
cmp byte [esi+2], 0 cmp byte [esi+2], 0
jz .dotdot jz .dotdot
@@: @@:
lea edi, [ebp + panel1_dir - panel1_data] push esi
mov al, 0 lea esi, [ebp + panel1_dir - panel1_data]
or ecx, -1 mov edi, prev_dir
repnz scasb @@:
dec edi lodsb
stosb
test al, al
jnz @b
lea edi, [esi-1]
pop esi
mov al, '/' mov al, '/'
cmp [edi-1], al cmp [edi-1], al
jz @f jz @f
@ -879,7 +892,7 @@ panels_OnKey:
test eax, eax test eax, eax
jnz .drive_loop_i_done jnz .drive_loop_i_done
mov eax, 32+8 mov eax, 32+8
call mf_alloc call xmalloc
test eax, eax test eax, eax
jz .drive_loop_i_done jz .drive_loop_i_done
jecxz @f jecxz @f
@ -951,6 +964,12 @@ panels_OnKey:
jz .ret2 jz .ret2
lea esi, [eax+8] lea esi, [eax+8]
lea edi, [ebp + panel1_dir - panel1_data] lea edi, [ebp + panel1_dir - panel1_data]
push ecx esi edi
mov esi, edi
mov edi, prev_dir
mov ecx, 1024/4
rep movsd
pop edi esi ecx
@@: @@:
lodsb lodsb
stosb stosb
@ -1068,12 +1087,6 @@ panels_OnKey:
mov [ebx - copy_dlgdata + copy_dlgdata.cnl_x1], eax mov [ebx - copy_dlgdata + copy_dlgdata.cnl_x1], eax
add eax, aCancelBLength - 1 add eax, aCancelBLength - 1
mov [ebx - copy_dlgdata + copy_dlgdata.cnl_x2], eax mov [ebx - copy_dlgdata + copy_dlgdata.cnl_x2], eax
mov al, [dialog_border_color]
mov [ebx + dlgtemplate.border_color], al
mov al, [dialog_header_color]
mov [ebx + dlgtemplate.header_color], al
mov al, [dialog_main_color]
mov [ebx + dlgtemplate.main_color], al
mov byte [ebx - copy_dlgdata + copy_dlgdata.flags0], 0xC mov byte [ebx - copy_dlgdata + copy_dlgdata.flags0], 0xC
and byte [ebx - copy_dlgdata + copy_dlgdata.flags1], not 4 and byte [ebx - copy_dlgdata + copy_dlgdata.flags1], not 4
and byte [ebx - copy_dlgdata + copy_dlgdata.flags2], not 4 and byte [ebx - copy_dlgdata + copy_dlgdata.flags2], not 4
@ -1292,12 +1305,6 @@ panels_OnKey:
mov [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.cnl_x1], eax mov [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.cnl_x1], eax
add eax, aCancelLength - 1 add eax, aCancelLength - 1
mov [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.cnl_x2], eax mov [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.cnl_x2], eax
mov al, [dialog_border_color]
mov [ebx + dlgtemplate.border_color], al
mov al, [dialog_header_color]
mov [ebx + dlgtemplate.header_color], al
mov al, [dialog_main_color]
mov [ebx + dlgtemplate.main_color], al
or byte [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.flags1], 4 or byte [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.flags1], 4
and byte [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.flags2], not 4 and byte [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.flags2], not 4
push ebx push ebx
@ -1428,7 +1435,7 @@ panels_OnKey:
mov eax, ecx mov eax, ecx
@@: @@:
add eax, 12 add eax, 12
call mf_alloc call xmalloc
test eax, eax test eax, eax
jz .menucreated jz .menucreated
add eax, 4 add eax, 4
@ -1661,28 +1668,38 @@ draw_window:
imul ecx, font_height imul ecx, font_height
lea ecx, [eax+ecx+5-1+100*65536] lea ecx, [eax+ecx+5-1+100*65536]
xor eax, eax xor eax, eax
mov edx, 0x13000000 mov edx, 0x53000000
mov edi, header mov edi, header
int 40h int 40h
mov al, 48 mov al, 13
push 3 xor edx, edx
pop ebx cmp [fill_width], 0
mov ecx, std_colors jz @f
push 40 mov ebx, [wnd_width]
pop edx sub ebx, [fill_width]
int 40h sub ebx, 5-1
; mov bl, 7 shl ebx, 16
; int 40h mov bx, word [fill_width]
; xor ax, ax mov ecx, [skinh-2]
; shr ebx, 16 mov cx, word [wnd_height]
; or ebx, eax sub cx, word [skinh]
; mov ecx, [std_colors+16] sub cx, 5-1
; mov edx, header int 0x40
; push header.length @@:
; pop esi cmp [fill_height], 0
; push 4 jz @f
; pop eax mov al, 13
; int 40h xor edx, edx
mov ebx, 50000h
mov bx, word [wnd_width]
sub ebx, 9
mov ecx, [wnd_height]
sub ecx, [fill_height]
sub ecx, 5-1
shl ecx, 16
mov cx, word [fill_height]
int 0x40
@@:
; xor ecx, ecx ; xor ecx, ecx
; call draw_image ; call draw_image
and [min_x], 0 and [min_x], 0
@ -1935,6 +1952,7 @@ end if
push 8 push 8
pop esi pop esi
mov edi, console_colors mov edi, console_colors
xor ebp, ebp
int 0x40 int 0x40
push 64 push 64
pop eax pop eax
@ -2611,6 +2629,7 @@ read_folder:
mov [dirinfo.dirdata], eax mov [dirinfo.dirdata], eax
lea eax, [ebp + panel1_dir - panel1_data] lea eax, [ebp + panel1_dir - panel1_data]
mov [dirinfo.name], eax mov [dirinfo.name], eax
.retry:
push 70 push 70
pop eax pop eax
mov ebx, dirinfo mov ebx, dirinfo
@ -2619,23 +2638,77 @@ read_folder:
jz .ok jz .ok
cmp eax, 6 cmp eax, 6
jz .ok jz .ok
; TODO: add error handling ; Failed to read folder, notify user
mov [ebp + panel1_numfiles - panel1_data], 2 cmp [bSilentFolderMode], 0
mov eax, [ebp + panel1_nfa - panel1_data] jnz .dont_notify
shl eax, 2 push aContinue
add eax, [ebp + panel1_files - panel1_data] push aRetry
add eax, 32+40 mov edx, esp
mov word [eax], '..' call get_error_msg
mov byte [eax+2], 0 push [dirinfo.name]
add eax, 304 push aCannotReadFolder
mov dword [eax], 'Read' push eax
mov dword [eax+4], ' err' mov eax, esp
mov dword [eax+8], 'or' push edx
mov eax, [ebp + panel1_files - panel1_data] push 2
mov dword [eax], 0 push eax
mov dword [eax+4], 304 push 3
push -1
push -1
push aError
call SayErr
add esp, 5*4
test eax, eax
jz .retry
.dont_notify:
mov esi, prev_dir
cmp byte [esi], 0
jz @f
lea edi, [ebp + panel1_dir - panel1_data]
mov ecx, 1024/4
rep movsd
mov byte [prev_dir], 0
ret
@@:
mov [bSilentFolderMode], 1 ; enter silent mode
mov esi, [dirinfo.name]
xor edx, edx
.up1:
lodsb
test al, al
jz .up1done
cmp al, '/'
jnz .up1
inc edx
lea edi, [esi-1]
jmp .up1
.up1done:
cmp edx, 2
jbe .noup
stosb
jmp read_folder
.noup:
mov esi, [dirinfo.name]
mov edi, esi
lodsd
or eax, 0x00202000
cmp eax, '/rd/'
jnz @f
lodsw
cmp ax, '1'
jz .nosetrd
@@:
mov eax, '/rd/'
stosd
mov ax, '1'
stosw
jmp read_folder
.nosetrd:
; „ ¦¥ à ¬¤¨áª ­¥ ¯à®ç¨â «áï. ‡­ ç¨â, ­¥ áã¤ì¡ ...
and dword [ebp + panel1_numfiles - panel1_data], 0
and dword [ebp + panel1_index - panel1_data], 0 and dword [ebp + panel1_index - panel1_data], 0
and dword [ebp + panel1_start - panel1_data], 0 and dword [ebp + panel1_start - panel1_data], 0
mov [bSilentFolderMode], 0 ; leave silent mode
ret ret
.ok: .ok:
mov eax, [dirinfo.dirdata] mov eax, [dirinfo.dirdata]
@ -2651,11 +2724,10 @@ read_folder:
push eax push eax
imul eax, 4+304 imul eax, 4+304
add eax, 32 add eax, 32
call mf_alloc call xmalloc
test eax, eax test eax, eax
jnz .succ1 jnz .succ1
pop eax pop eax
; TODO: add error handling
jmp .readdone jmp .readdone
.succ1: .succ1:
mov [ebp + panel1_files - panel1_data], eax mov [ebp + panel1_files - panel1_data], eax
@ -2746,6 +2818,7 @@ sort_files:
mov edx, [ebp + panel1_files - panel1_data] mov edx, [ebp + panel1_files - panel1_data]
mov ecx, [ebp + panel1_numfiles - panel1_data] mov ecx, [ebp + panel1_numfiles - panel1_data]
call sort call sort
mov [bSilentFolderMode], 0 ; leave silent mode
ret ret
compare_name: compare_name:
@ -3934,7 +4007,7 @@ find_extension:
pop esi pop esi
ret ret
header db 'Kolibri Far 0.19',0 header db 'Kolibri Far 0.2',0
nomem_draw db 'No memory for redraw.',0 nomem_draw db 'No memory for redraw.',0
.size = $ - nomem_draw .size = $ - nomem_draw
@ -3942,6 +4015,8 @@ nomem_draw db 'No memory for redraw.',0
def_left_dir db '/rd/1',0 def_left_dir db '/rd/1',0
def_right_dir db '/hd0/1',0 def_right_dir db '/hd0/1',0
bSilentFolderMode db 1
if lang eq ru if lang eq ru
aFolder db '<27> ¯ª ' aFolder db '<27> ¯ª '
.size = $-aFolder .size = $-aFolder
@ -4310,6 +4385,8 @@ cur_width dd 80
cur_height dd 25 cur_height dd 25
saved_width dd -1 saved_width dd -1
saved_height dd -1 saved_height dd -1
fill_width dd 0
fill_height dd 0
max_width = 256 max_width = 256
max_height = 256 max_height = 256
console_data_ptr dd 0 console_data_ptr dd 0
@ -4368,6 +4445,25 @@ viewer_vtable:
dd keybar_viewer dd keybar_viewer
dd viewer_getname dd viewer_getname
; additions to this table require changes in tools.inc::get_error_msg
errors1:
dd error0msg
dd error1msg
dd error2msg
dd error3msg
dd error4msg
dd error5msg
dd error6msg
dd error7msg
dd error8msg
dd error9msg
dd error10msg
dd error11msg
errors2:
dd error30msg
dd error31msg
dd error32msg
encodings: encodings:
.cp866 = 0 .cp866 = 0
.cp1251 = 1 .cp1251 = 1
@ -4565,13 +4661,24 @@ panel_active_header_color db 30h
column_header_color db 1Eh column_header_color db 1Eh
panel_nscreens_color db 0Bh panel_nscreens_color db 0Bh
; „¨ «®£¨ ; „¨ «®£¨
dialog_colors:
dialog_main_color db 70h dialog_main_color db 70h
dialog_border_color db 70h dialog_border_color db 70h
dialog_header_color db 70h dialog_header_color db 70h
dialog_normal_btn_color db 70h
dialog_selected_btn_color db 30h
dialog_edit_color db 30h dialog_edit_color db 30h
dialog_unmodified_edit_color db 38h dialog_unmodified_edit_color db 38h
dialog_normal_btn_color db 70h
dialog_selected_btn_color db 30h
; <20>।ã¯à¥¦¤¥­¨ï ¨ ®è¨¡ª¨
warning_colors:
; !!! ¤®«¦­ë ¡ëâì ⥠¦¥ ¯®«ï ¨ ¢ ⮬ ¦¥ ¯®à浪¥, çâ® ¨ ¤«ï ®¡ëç­ëå ¤¨ «®£®¢ !!!
warning_main_color db 4Fh
warning_border_color db 4Fh
warning_header_color db 4Fh
warning_edit_color db 30h
warning_unmodified_edit_color db 38h
warning_normal_btn_color db 4Fh
warning_selected_btn_color db 70h
; Œ¥­î ; Œ¥­î
menu_normal_color db 3Fh menu_normal_color db 3Fh
menu_selected_color db 0Fh menu_selected_color db 0Fh
@ -4754,8 +4861,33 @@ bWasE0 db 0
ctrlstate db 0 ctrlstate db 0
align 4 align 4
f8_confirm_dlgdata: ; ‘®®¡é¥­¨¥ ® ®¡«®¬¥ ¯à¨ ¢ë¤¥«¥­¨¨ ¯ ¬ïâ¨
nomem_dlgdata:
dd 2
dd -1
dd -1
dd 12
dd 2
dd 1
dd 1
dd aError
rb 4
dd 0 dd 0
dd 0
dd 2
; áâப  "No memory"
dd 1
dd 1,0,10,0
dd aNoMemory
dd 1
; ª­®¯ª  "Ok"
dd 2
dd 4,1,7,1
dd aOk
dd 0xD
f8_confirm_dlgdata:
dd 1
.x dd -1 .x dd -1
.y dd -1 .y dd -1
.width dd ? .width dd ?
@ -4804,7 +4936,7 @@ f8_confirm_dlgdata:
; ¤¨ «®£ ª®¯¨à®¢ ­¨ï ; ¤¨ «®£ ª®¯¨à®¢ ­¨ï
copy_dlgdata: copy_dlgdata:
dd 0 dd 1
.x dd -1 .x dd -1
.y dd -1 .y dd -1
.width dd ? .width dd ?
@ -4869,6 +5001,26 @@ aCopy db '[
aCopyLength = $ - aCopy - 1 aCopyLength = $ - aCopy - 1
aCopy1 db 'Š®¯¨à®¢ âì "',0 aCopy1 db 'Š®¯¨à®¢ âì "',0
aCopy2 db '" ¢:',0 aCopy2 db '" ¢:',0
aError db 'Žè¨¡ª ',0
aContinue db '<27>த®«¦¨âì',0
aRetry db '<27>®¢â®à¨âì',0
error0msg db '‘âà ­­®... <20>¥â ®è¨¡ª¨',0
error1msg db '‘âà ­­®... <20>¥ ®¯à¥¤¥«¥­  ¡ §  ¨/¨«¨ à §¤¥« ¦ñá⪮£® ¤¨áª ',0
error2msg db '”ã­ªæ¨ï ­¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤ ­­®© ä ©«®¢®© á¨á⥬ë',0
error3msg db '<27>¥¨§¢¥áâ­ ï ä ©«®¢ ï á¨á⥬ ',0
error4msg db '‘âà ­­®... Žè¨¡ª  4',0
error5msg db '” ©« ­¥ ­ ©¤¥­',0
error6msg db '” ©« § ª®­ç¨«áï',0
error7msg db '‘âà ­­®... “ª § â¥«ì ¢­¥ ¯ ¬ï⨠¯à¨«®¦¥­¨ï',0
error8msg db '„¨áª § ¯®«­¥­',0
error9msg db '” ©«®¢ ï áâàãªâãà  à §àã襭 ',0
error10msg db '„®áâ㯠§ ¯à¥éñ­',0
error11msg db 'Žè¨¡ª  ãáâனá⢠',0
error30msg db '<27>¥¤®áâ â®ç­® ¯ ¬ïâ¨',0
error31msg db '” ©« ­¥ ï¥âáï ¨á¯®«­ï¥¬ë¬',0
error32msg db '‘«¨èª®¬ ¬­®£® ¯à®æ¥áᮢ',0
aUnknownError db '<27>¥¨§¢¥áâ­ë© ª®¤ ®è¨¡ª¨: ',0
aCannotReadFolder db '<27>¥ ¬®£ã ¯à®ç¨â âì ¯ ¯ªã',0
else else
aDeleteCaption db 'Delete',0 aDeleteCaption db 'Delete',0
aConfirmDeleteText db 'Do you wish to delete ',0 aConfirmDeleteText db 'Do you wish to delete ',0
@ -4886,7 +5038,29 @@ aCopy db '[ Copy ]',0
aCopyLength = $ - aCopy - 1 aCopyLength = $ - aCopy - 1
aCopy1 db 'Copy "',0 aCopy1 db 'Copy "',0
aCopy2 db '" to:',0 aCopy2 db '" to:',0
aError db 'Error',0
aContinue db 'Continue',0
aRetry db 'Retry',0
error0msg db 'Strange... No error',0
error1msg db 'Strange... Hard disk base and/or partition not defined',0
error2msg db 'The file system does not support this function',0
error3msg db 'Unknown file system',0
error4msg db 'Strange... Error 4',0
error5msg db 'File not found',0
error6msg db 'End of file',0
error7msg db 'Strange... Pointer lies outside of application memory',0
error8msg db 'Disk is full',0
error9msg db 'File structure is destroyed',0
error10msg db 'Access denied',0
error11msg db 'Device error',0
error30msg db 'Not enough memory',0
error31msg db 'File is not executable',0
error32msg db 'Too many processes',0
aUnknownError db 'Unknown error code: ',0
aCannotReadFolder db 'Cannot read folder',0
end if end if
aOk db 'OK',0
aNoMemory db 'No memory!',0
execinfo: execinfo:
dd 7 dd 7
@ -4941,6 +5115,8 @@ panel2_dir rb 1024
;console_data rb max_width*max_height*2 ;console_data rb max_width*max_height*2
nomem_dlgsavearea rb (12+4)*(3+3)*2
cur_header rb max_width cur_header rb max_width
tmp dd ? tmp dd ?
@ -4954,6 +5130,9 @@ max_x dd ?
used_width dd ? used_width dd ?
used_height dd ? used_height dd ?
wnd_width dd ?
wnd_height dd ?
column_left dd ? column_left dd ?
column_top dd ? column_top dd ?
column_width dd ? column_width dd ?
@ -4967,6 +5146,10 @@ saved_file_name:
procinfo rb 1024 procinfo rb 1024
lower_file_name = procinfo + 512 lower_file_name = procinfo + 512
error_msg rb 128
prev_dir rb 1024
driveinfo rb 32+304 driveinfo rb 32+304
tmpname rb 32 tmpname rb 32

View File

@ -0,0 +1,69 @@
xmalloc:
; in: eax=size
; out: eax=pointer or NULL
call mf_alloc
.common:
test eax, eax
jnz @f
call SayNoMem
xor eax, eax
@@:
ret
xrealloc:
; in: eax=pointer, ebx=new size
; out: eax=pointer or NULL
call mf_realloc
jmp xmalloc.common
get_error_msg:
; in: eax=error code
; out: eax=pointer to message (in static buffer)
push esi edi
mov edi, error_msg
cmp eax, 11
ja .no1
mov esi, [errors1+eax*4]
jmp .copy
.no1:
cmp eax, 30
jb .no2
cmp eax, 32
ja .no2
mov esi, [errors2+(eax-30)*4]
.copy:
lodsb
stosb
test al, al
jnz .copy
.ret:
mov eax, error_msg
pop edi esi
ret
.no2:
mov esi, aUnknownError
push eax
@@:
lodsb
stosb
test al, al
jnz @b
pop eax
push edx ecx
test eax, eax
jns @f
mov byte [edi], '-'
inc edi
neg eax
@@:
xor edx, edx
mov ecx, 10
div ecx
add edx, '0'
mov byte [edi], dl
inc edi
test eax, eax
jnz @b
pop ecx edx
stosb
jmp .ret