Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 282 → Rev 283

/kernel/trunk/core/syscall.inc
133,7 → 133,7
dd sys_pci ; 62-PCI functions
dd sys_msg_board ; 63-System message board
dd sys_resize_app_memory ; 64-Resize application memory usage
dd undefined_syscall ; 65-UTF
dd syscall_putimage_palette; 65-PutImagePalette
dd sys_process_def ; 66-Process definitions - keyboard
dd sys_window_move ; 67-Window move or resize
dd new_services ; 68-Some internal services
/kernel/trunk/docs/apm/README.TXT
File deleted
/kernel/trunk/docs/apm/apm.txt
File deleted
/kernel/trunk/docs/apm.txt
0,0 → 1,518
--------p-155300-----------------------------
INT 15 - Advanced Power Management v1.0+ - INSTALLATION CHECK
AX = 5300h
BX = device ID of system BIOS (0000h)
Return: CF clear if successful
AH = major version (BCD)
AL = minor version (BCD)
BX = 504Dh ("PM")
CX = flags (see #00472)
CF set on error
AH = error code (06h,09h,86h) (see #00473)
BUG: early versions of the Award Modular BIOS with built-in APM support
reportedly do not set BX on return
 
Bitfields for APM flags:
Bit(s) Description (Table 00472)
0 16-bit protected mode interface supported
1 32-bit protected mode interface supported
2 CPU idle call reduces processor speed
3 BIOS power management disabled
4 BIOS power management disengaged (APM v1.1)
5-7 reserved
 
(Table 00473)
Values for APM error code:
01h power management functionality disabled
02h interface connection already in effect
03h interface not connected
04h real-mode interface not connected
05h 16-bit protected-mode interface already connected
06h 16-bit protected-mode interface not supported
07h 32-bit protected-mode interface already connected
08h 32-bit protected-mode interface not supported
09h unrecognized device ID
0Ah invalid parameter value in CX
0Bh (APM v1.1) interface not engaged
0Ch (APM v1.2) function not supported
0Dh (APM v1.2) Resume Timer disabled
0Eh-1Fh reserved for other interface and general errors
20h-3Fh reserved for CPU errors
40h-5Fh reserved for device errors
60h can't enter requested state
61h-7Fh reserved for other system errors
80h no power management events pending
81h-85h reserved for other power management event errors
86h APM not present
87h-9Fh reserved for other power management event errors
A0h-FEh reserved
FFh undefined
--------p-155301-----------------------------
INT 15 - Advanced Power Management v1.0+ - CONNECT REAL-MODE INTERFACE
AX = 5301h
BX = device ID of system BIOS (0000h)
Return: CF clear if successful
CF set on error
AH = error code (02h,05h,07h,09h) (see #00473)
Note: on connection, an APM v1.1 or v1.2 BIOS switches to APM v1.0
compatibility mode until it is informed that the user supports a
newer version of APM (see AX=530Eh)
SeeAlso: AX=5302h,AX=5303h,AX=5304h
--------p-155302-----------------------------
INT 15 R - Advanced Power Management v1.0+ - CONNECT 16-BIT PROTMODE INTERFACE
AX = 5302h
BX = device ID of system BIOS (0000h)
Return: CF clear if successful
AX = real-mode segment base address of protected-mode 16-bit code
segment
BX = offset of entry point
CX = real-mode segment base address of protected-mode 16-bit data
segment
---APM v1.1---
SI = APM BIOS code segment length
DI = APM BIOS data segment length
CF set on error
AH = error code (02h,05h,06h,07h,09h) (see #00473)
Notes: the caller must initialize two consecutive descriptors with the
returned segment base addresses; these descriptors must be valid
whenever the protected-mode interface is called, and will have
their limits arbitrarily set to 64K.
the protected mode interface is invoked by making a far call with the
same register values as for INT 15; it must be invoked while CPL=0,
the code segment descriptor must have a DPL of 0, the stack must be
in a 16-bit segment and have enough room for BIOS use and possible
interrupts, and the current I/O permission bit map must allow access
to the I/O ports used for power management.
functions 00h-03h are not available from protected mode
on connection, an APM v1.1 or v1.2 BIOS switches to APM v1.0
compatibility mode until it is informed that the user supports a
newer version of APM (see AX=530Eh)
SeeAlso: AX=5301h,AX=5303h,AX=5304h
--------p-155303-----------------------------
INT 15 - Advanced Power Management v1.0+ - CONNECT 32-BIT PROTMODE INTERFACE
AX = 5303h
BX = device ID of system BIOS (0000h)
Return: CF clear if successful
AX = real-mode segment base address of protected-mode 32-bit code
segment
EBX = offset of entry point
CX = real-mode segment base address of protected-mode 16-bit code
segment
DX = real-mode segment base address of protected-mode 16-bit data
segment
---APM v1.1---
SI = APM BIOS code segment length
DI = APM BIOS data segment length
CF set on error
AH = error code (02h,05h,07h,08h,09h) (see #00473)
Notes: the caller must initialize three consecutive descriptors with the
returned segment base addresses for 32-bit code, 16-bit code, and
16-bit data, respectively; these descriptors must be valid whenever
the protected-mode interface is called, and will have their limits
arbitrarily set to 64K.
the protected mode interface is invoked by making a far call to the
32-bit code segment with the same register values as for INT 15; it
must be invoked while CPL=0, the code segment descriptor must have a
DPL of 0, the stack must be in a 32-bit segment and have enough room
for BIOS use and possible interrupts, and the current I/O permission
bit map must allow access to the I/O ports used for power management.
functions 00h-03h are not available from protected mode
on connection, an APM v1.1 or v1.2 BIOS switches to APM v1.0
compatibility mode until it is informed that the user supports a
newer version of APM (see AX=530Eh)
SeeAlso: AX=5301h,AX=5302h,AX=5304h
--------p-155304-----------------------------
INT 15 - Advanced Power Management v1.0+ - DISCONNECT INTERFACE
AX = 5304h
BX = device ID of system BIOS (0000h)
Return: CF clear if successful
CF set on error
AH = error code (03h,09h) (see #00473)
SeeAlso: AX=5301h,AX=5302h,AX=5303h
--------p-155305-----------------------------
INT 15 - Advanced Power Management v1.0+ - CPU IDLE
AX = 5305h
Return: CF clear if successful (after system leaves idle state)
CF set on error
AH = error code (03h,0Bh) (see #00473)
Notes: call when the system is idle and should be suspended until the next
system event or interrupt
should not be called from within a hardware interrupt handler to avoid
reentrance problems
if an interrupt causes the system to resume normal processing, the
interrupt may or may not have been handled when the BIOS returns
from this call; thus, the caller should allow interrupts on return
interrupt handlers may not retain control if the BIOS allows
interrupts while in idle mode even if they are able to determine
that they were called from idle mode
the caller should issue this call continuously in a loop until it needs
to perform some processing of its own
SeeAlso: AX=1000h,AX=5306h,INT 2F/AX=1680h
--------p-155306-----------------------------
INT 15 - Advanced Power Management v1.0+ - CPU BUSY
AX = 5306h
Return: CF clear if successful
CF set on error
AH = error code (03h,0Bh) (see #00473)
Notes: called to ensure that the system runs at full speed even on systems
where the BIOS is unable to recognize increased activity (especially
if interrupts are hooked by other programs and not chained to the
BIOS)
this call may be made even when the system is already running at full
speed, but it will create unnecessary overhead
should not be called from within a hardware interrupt handler to avoid
reentrance problems
SeeAlso: AX=5305h
--------p-155307-----------------------------
INT 15 - Advanced Power Management v1.0+ - SET POWER STATE
AX = 5307h
BX = device ID (see #00474)
CX = system state ID (see #00475)
Return: CF clear if successful
CF set on error
AH = error code (01h,03h,09h,0Ah,0Bh,60h) (see #00473)
Note: should not be called from within a hardware interrupt handler to avoid
reentrance problems
SeeAlso: AX=530Ch
 
(Table 00474)
Values for APM device IDs:
0000h system BIOS
0001h all devices for which the system BIOS manages power
01xxh display (01FFh for all attached display devices)
02xxh secondary storage (02FFh for all attached secondary storage devices)
03xxh parallel ports (03FFh for all attached parallel ports)
04xxh serial ports (04FFh for all attached serial ports)
---APM v1.1+ ---
05xxh network adapters (05FFh for all attached network adapters)
06xxh PCMCIA sockets (06FFh for all)
0700h-7FFFh reserved
80xxh system battery devices (APM v1.2)
8100h-DFFFh reserved
Exxxh OEM-defined power device IDs
F000h-FFFFh reserved
 
(Table 00475)
Values for system state ID:
0000h ready (not supported for device ID 0001h)
0001h stand-by
0002h suspend
0003h off (not supported for device ID 0001h in APM v1.0)
---APM v1.1---
0004h last request processing notification (only for device ID 0001h)
0005h last request rejected (only for device ID 0001h)
0006h-001Fh reserved system states
0020h-003Fh OEM-defined system states
0040h-007Fh OEM-defined device states
0080h-FFFFh reserved device states
--------p-155307CX0001-----------------------
INT 15 - Advanced Power Management v1.0+ - SYSTEM STAND-BY
AX = 5307h
CX = 0001h
BX = 0001h (device ID for all power-managed devices)
Return: CF clear
Notes: puts the entire system into stand-by mode; normally called in response
to a System Stand-by Request notification after any necessary
processing, but may also be invoked at the caller's discretion
should not be called from within a hardware interrupt handler to avoid
reentrance problems
the stand-by state is typically exited on an interrupt
SeeAlso: AX=4280h,AX=5307h/CX=0002h"SUSPEND",AX=5307h/CX=0003h,AX=530Bh
--------p-155307CX0002-----------------------
INT 15 - Advanced Power Management v1.0+ - SUSPEND SYSTEM
AX = 5307h
CX = 0002h
BX = 0001h (device ID for all power-managed devices)
Return: after system is resumed
CF clear
Notes: puts the entire system into a low-power suspended state; normally
called in response to a Suspend System Request notification after
any necessary processing, but may also be invoked at the caller's
discretion
should not be called from within a hardware interrupt handler to avoid
reentrance problems
the caller may need to update its date and time values because the
system could have been suspended for a long period of time
SeeAlso: AX=5307h/CX=0001h"STAND-BY",AX=530Bh
--------p-155307CX0003-----------------------
INT 15 - Advanced Power Management v1.2 - TURN OFF SYSTEM
AX = 5307h
CX = 0003h
BX = 0001h (device ID for all power-managed devices)
Return: after system is resumed
CF clear
Notes: if supported by the system's power supply, turns off the system power
SeeAlso: AX=5307h/CX=0001h"STAND-BY",AX=530Bh
--------p-155308-----------------------------
INT 15 - Advanced Power Management v1.0+ - ENABLE/DISABLE POWER MANAGEMENT
AX = 5308h
BX = device ID for all devices power-managed by APM
0001h (APM v1.1+)
FFFFh (APM v1.0)
CX = new state
0000h disabled
0001h enabled
Return: CF clear if successful
CF set on error
AH = error code (01h,03h,09h,0Ah,0Bh) (see #00473)
Notes: when power management is disabled, the system BIOS will not
automatically power down devices, enter stand-by or suspended mode,
or perform any power-saving actions in response to AX=5305h calls
should not be called from within a hardware interrupt handler to avoid
reentrance problems
the APM BIOS should never be both disabled and disengaged at the same
time
SeeAlso: AX=5309h,AX=530Dh,AX=530Fh
--------p-155309-----------------------------
INT 15 - Advanced Power Management v1.0+ - RESTORE POWER-ON DEFAULTS
AX = 5309h
BX = device ID for all devices power-managed by APM
0001h (APM v1.1)
FFFFh (APM v1.0)
Return: CF clear if successful
CF set on error
AH = error code (03h,09h,0Bh) (see #00473)
Note: should not be called from within a hardware interrupt handler to avoid
reentrance problems
SeeAlso: AX=5308h
--------p-15530A-----------------------------
INT 15 - Advanced Power Management v1.0+ - GET POWER STATUS
AX = 530Ah
BX = device ID
0001h all devices power-managed by APM
80xxh specific battery unit number XXh (01h-FFh) (APM v1.2)
Return: CF clear if successful
BH = AC line status
00h off-line
01h on-line
02h on backup power (APM v1.1)
FFh unknown
other reserved
BL = battery status (see #00476)
CH = battery flag (APM v1.1+) (see #00477)
CL = remaining battery life, percentage
00h-64h (0-100) percentage of full charge
FFh unknown
DX = remaining battery life, time (APM v1.1) (see #00478)
---if specific battery unit specified---
SI = number of battery units currently installed
CF set on error
AH = error code (09h,0Ah) (see #00473)
Notes: should not be called from within a hardware interrupt handler to avoid
reentrance problems
supported in real mode (INT 15) and both 16-bit and 32-bit protected
mode
 
(Table 00476)
Values for APM v1.0+ battery status:
00h high
01h low
02h critical
03h charging
FFh unknown
other reserved
SeeAlso: #00477,#00478
 
Bitfields for APM v1.1+ battery flag:
Bit(s) Description (Table 00477)
0 high
1 low
2 critical
3 charging
4 selected battery not present (APM v1.2)
5-6 reserved (0)
7 no system battery
Note: all bits set (FFh) if unknown
SeeAlso: #00476,#00478
 
Bitfields for APM v1.1+ remaining battery life:
Bit(s) Description (Table 00478)
15 time units: 0=seconds, 1=minutes
14-0 battery life in minutes or seconds
Note: all bits set (FFFFh) if unknown
SeeAlso: #00476,#00477
--------p-15530B-----------------------------
INT 15 - Advanced Power Management v1.0+ - GET POWER MANAGEMENT EVENT
AX = 530Bh
Return: CF clear if successful
BX = event code (see #00479)
CX = event information (APM v1.2) if BX=0003h or BX=0004h
bit 0: PCMCIA socket was powered down in suspend state
CF set on error
AH = error code (03h,0Bh,80h) (see #00473)
Notes: although power management events are often asynchronous, notification
will not be made until polled via this call to permit software to
only receive event notification when it is prepared to process
power management events; since these events are not very time-
critical, it should be sufficient to poll once or twice per second
the critical resume notification is made after the system resumes
from an emergency suspension; normally, the system BIOS only notifies
its partner that it wishes to suspend and relies on the partner to
actually request the suspension, but no notification is made on an
emergency suspension
should not be called from within a hardware interrupt handler to avoid
reentrance problems
SeeAlso: AX=5307h,AX=5307h/CX=0001h"STAND-BY",AX=5307h/CX=0002h"SUSPEND"
 
(Table 00479)
Values for APM event code:
0001h system stand-by request
0002h system suspend request
0003h normal resume system notification
0004h critical resume system notification
0005h battery low notification
---APM v1.1---
0006h power status change notification
0007h update time notification
0008h critical system suspend notification
0009h user system standby request notification
000Ah user system suspend request notification
000Bh system standby resume notification
---APM v1.2---
000Ch capabilities change notification (see AX=5310h)
------
000Dh-00FFh reserved system events
01xxh reserved device events
02xxh OEM-defined APM events
0300h-FFFFh reserved
--------p-15530C-----------------------------
INT 15 - Advanced Power Management v1.1+ - GET POWER STATE
AX = 530Ch
BX = device ID (see #00474)
Return: CF clear if successful
CX = system state ID (see #00475)
CF set on error
AH = error code (01h,09h) (see #00473)
SeeAlso: AX=5307h
--------p-15530D-----------------------------
INT 15 - Advanced Power Management v1.1+ - EN/DISABLE DEVICE POWER MANAGEMENT
AX = 530Dh
BX = device ID (see #00474)
CX = function
0000h disable power management
0001h enable power management
Return: CF clear if successful
CF set on error
AH = error code (01h,03h,09h,0Ah,0Bh) (see #00473)
Desc: specify whether automatic power management should be active for a
given device
SeeAlso: AX=5308h,AX=530Fh
--------p-15530E-----------------------------
INT 15 - Advanced Power Management v1.1+ - DRIVER VERSION
AX = 530Eh
BX = device ID of system BIOS (0000h)
CH = APM driver major version (BCD)
CL = APM driver minor version (BCD) (02h for APM v1.2)
Return: CF clear if successful
AH = APM connection major version (BCD)
AL = APM connection minor version (BCD)
CF set on error
AH = error code (03h,09h,0Bh) (see #00473)
SeeAlso: AX=5300h,AX=5303h
--------p-15530F-----------------------------
INT 15 - Advanced Power Management v1.1+ - ENGAGE/DISENGAGE POWER MANAGEMENT
AX = 530Fh
BX = device ID (see #00474)
CX = function
0000h disengage power management
0001h engage power management
Return: CF clear if successful
CF set on error
AH = error code (01h,09h) (see #00473)
Notes: unlike AX=5308h, this call does not affect the functioning of the APM
BIOS
when cooperative power management is disengaged, the APM BIOS performs
automatic power management of the system or device
SeeAlso: AX=5308h,AX=530Dh
--------p-155310-----------------------------
INT 15 - Advanced Power Management v1.2 - GET CAPABILITIES
AX = 5310h
BX = device ID (see #00474)
0000h (APM BIOS)
other reserved
Return: CF clear if successful
BL = number of battery units supported (00h if no system batteries)
CX = capabilities flags (see #00480)
CF set on error
AH = error code (01h,09h,86h) (see #00473)
Notes: this function is supported via the INT 15, 16-bit protected mode, and
32-bit protected mode interfaces; it does not require that a
connection be established prior to use
this function will return the capabilities currently in effect, not
any new settings which have been made but do not take effect until
a system restart
SeeAlso: AX=5300h,AX=530Fh,AX=5311h,AX=5312h,AX=5313h
 
Bitfields for APM v1.2 capabilities flags:
Bit(s) Description (Table 00480)
15-8 reserved
7 PCMCIA Ring Indicator will wake up system from suspend mode
6 PCMCIA Ring Indicator will wake up system from standby mode
5 Resume on Ring Indicator will wake up system from suspend mode
4 Resume on Ring Indicator will wake up system from standby mode
3 resume timer will wake up system from suspend mode
2 resume timer will wake up system from standby mode
1 can enter global suspend state
0 can enter global standby state
--------p-155311-----------------------------
INT 15 - Advanced Power Management v1.2 - GET/SET/DISABLE RESUME TIMER
AX = 5311h
BX = device ID (see #00474)
0000h (APM BIOS)
other reserved
CL = function
00h disable Resume Timer
01h get Resume Timer
02h set Resume Timer
CH = resume time, seconds (BCD)
DL = resume time, minutes (BCD)
DH = resume time, hours (BCD)
SI = resume date (BCD), high byte = month, low byte = day
DI = resume date, year (BCD)
Return: CF clear if successful
---if getting timer---
CH = resume time, seconds (BCD)
DL = resume time, minutes (BCD)
DH = resume time, hours (BCD)
SI = resume date (BCD), high byte = month, low byte = day
DI = resume date, year (BCD)
CF set on error
AH = error code (03h,09h,0Ah,0Bh,0Ch,0Dh,86h) (see #00473)
Notes: this function is supported via the INT 15, 16-bit protected mode, and
32-bit protected mode interfaces
SeeAlso: AX=5300h,AX=5310h,AX=5312h,AX=5313h
--------p-155312-----------------------------
INT 15 - Advanced Power Management v1.2 - ENABLE/DISABLE RESUME ON RING
AX = 5312h
BX = device ID (see #00474)
0000h (APM BIOS)
other reserved
CL = function
00h disable Resume on Ring Indicator
01h enable Resume on Ring Indicator
02h get Resume on Ring Indicator status
Return: CF clear if successful
CX = resume status (0000h disabled, 0001h enabled)
CF set on error
AH = error code (03h,09h,0Ah,0Bh,0Ch,86h) (see #00473)
Notes: this function is supported via the INT 15, 16-bit protected mode, and
32-bit protected mode interfaces
SeeAlso: AX=5300h,AX=5310h,AX=5311h,AX=5313h
--------p-155313-----------------------------
INT 15 - Advanced Power Management v1.2 - ENABLE/DISABLE TIMER-BASED REQUESTS
AX = 5313h
BX = device ID (see #00474)
0000h (APM BIOS)
other reserved
CL = function
00h disable timer-based requests
01h enable timer-based requests
02h get timer-based requests status
Return: CF clear if successful
CX = timer-based requests status (0000h disabled, 0001h enabled)
CF set on error
AH = error code (03h,09h,0Ah,0Bh,86h) (see #00473)
Notes: this function is supported via the INT 15, 16-bit protected mode, and
32-bit protected mode interfaces
some BIOSes set AH on return even when successful
SeeAlso: AX=5300h,AX=5310h,AX=5311h,AX=5312h
/kernel/trunk/docs/sysfuncr.txt
3462,6 → 3462,26
«®ª «ì­ãî ªãç㠢맮¢®¬ 68.11.
 
======================================================================
========= ”ã­ªæ¨ï 65 - ¢ë¢¥á⨠¨§®¡à ¦¥­¨¥ á ¯ «¨âன ¢ ®ª­®. ========
======================================================================
 à ¬¥âàë:
* eax = 65 - ­®¬¥à ä㭪樨
* ebx = 㪠§ â¥«ì ­  ¨§®¡à ¦¥­¨¥
* ecx = [à §¬¥à ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ y]
* edx = [ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [ª®®à¤¨­ â  ¯® ®á¨ y]
* esi = ç¨á«® ¡¨â ­  ¯¨ªá¥«ì, ¤®«¦­® ¡ëâì 8 ¢ ⥪ã饩 ॠ«¨§ æ¨¨
* edi = 㪠§ â¥«ì ­  ¯ «¨âàã (256 梥⮢ 0x00RRGGBB)
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï
‡ ¬¥ç ­¨ï:
* Š®®à¤¨­ âë ¨§®¡à ¦¥­¨ï - íâ® ª®®à¤¨­ âë ¢¥àå­¥£® «¥¢®£® 㣫 
¨§®¡à ¦¥­¨ï ®â­®á¨â¥«ì­® ®ª­ .
*  §¬¥à ¨§®¡à ¦¥­¨ï ¢ ¡ ©â å ¥áâì xsize*ysize.
* Š ¦¤ë© ¡ ©â ¨§®¡à ¦¥­¨ï à áᬠâਢ ¥âáï ª ª ¨­¤¥ªá ¢ ¯ «¨âà¥.
* …᫨ ¨§®¡à ¦¥­¨¥ ¨á¯®«ì§ã¥â ­¥ ¢á¥ 256 梥⮢,   ¬¥­ìè¥,
à §¬¥à ¯ «¨âàë ¬®¦¥â ¡ëâì ¬¥­ìè¥ 256.
 
======================================================================
================= ”ã­ªæ¨ï 66 - à ¡®â  á ª« ¢¨ âãன. =================
======================================================================
¥¦¨¬ ¢¢®¤  ¢«¨ï¥â ­  १ã«ìâ âë ç⥭¨ï ª« ¢¨è ä㭪樥© 2.
/kernel/trunk/docs/sysfuncs.txt
3429,6 → 3429,26
with function 68.11.
 
======================================================================
======== Function 65 - draw image with palette in the window. ========
======================================================================
Parameters:
* eax = 65 - function number
* ebx = pointer to the image
* ecx = [size on axis x]*65536 + [size on axis y]
* edx = [coordinate on axis x]*65536 + [coordinate on axis y]
* esi = number of bits per pixel, must be 8
* edi = pointer to palette (256 colors 0x00RRGGBB)
Returned value:
* function does not return value
Remarks:
* Coordinates of the image are coordinates of the upper left corner
of the image relative to the window.
* Size of the image in bytes is xsize*ysize.
* Each byte of image is index in the palette.
* If the image uses less than 256 colors, palette size may be
less than 256 too.
 
======================================================================
================== Function 66 - work with keyboard. =================
======================================================================
The input mode influences results of reading keys by function 2.
/kernel/trunk/drivers/proc32.inc
71,7 → 71,7
if parmbytes | localbytes
leave
end if
if flag and 10000b
if (flag and 10000b) | (parmbytes=0)
retn
else
retn parmbytes
/kernel/trunk/kernel.asm
1365,7 → 1365,9
mov word [midisp],bx
ret
 
iglobal
midi_base dw 0
endg
 
nsyse1:
 
1501,7 → 1503,9
nosethd:
ret
 
iglobal
hd_base db 0
endg
 
nsyse7:
 
1667,12 → 1671,13
mov [esp+36],dword 1
ret
 
 
iglobal
align 4
mousefn dd msscreen, mswin, msbutton, msset
dd app_load_cursor
dd app_set_cursor
dd app_delete_cursor
endg
 
readmousepos:
 
3972,6 → 3977,11
add dx,word[edi+0x80000+APPDATA.wnd_clientbox.left]
rol edx,16
.forced:
push esi ebp
mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp
sys_putimage_bpp:
; call [disable_mouse] ; this will be done in xxx_putimage
; mov eax, vga_putimage
cmp [0xfe0c], word 0x12
jz @f ;.doit
3986,8 → 3996,51
inc [mouse_pause]
call eax
dec [mouse_pause]
pop ebp esi
jmp [draw_pointer]
 
syscall_putimage_palette:
lea edi, [esi+std_application_base_address]
mov esi, edx
mov edx, ecx
mov ecx, ebx
lea ebx, [eax+std_application_base_address]
sys_putimage_palette:
; ebx = pointer to image
; ecx = [xsize]*65536 + [ysize]
; edx = [xstart]*65536 + [ystart]
; esi = number of bits per pixel, must be 8
; edi = pointer to palette
mov eax, [0x3000]
shl eax, 8
add dx, word [eax+0x80000+APPDATA.wnd_clientbox.top]
rol edx, 16
add dx, word [eax+0x80000+APPDATA.wnd_clientbox.left]
rol edx, 16
.forced:
push esi ebp
mov ebp, putimage_get8bpp
mov esi, putimage_init8bpp
jmp sys_putimage_bpp
 
putimage_init24bpp:
lea eax, [eax*3]
putimage_init8bpp:
ret
 
putimage_get24bpp:
mov eax, [esi]
add esi, 3
ret 4
putimage_get8bpp:
movzx eax, byte [esi]
push edx
mov edx, [esp+8]
mov eax, [edx+eax*4]
pop edx
inc esi
ret 4
 
; eax x beginning
; ebx y beginning
; ecx x end
4003,6 → 4056,7
add edx,[esi+0x80000+APPDATA.wnd_clientbox.top]
.forced:
inc [mouse_pause]
; call [disable_mouse]
cmp [0xfe0c],word 0x12
je dbv20
sdbv20:
/kernel/trunk/video/vesa12.inc
709,6 → 709,12
 
 
vesa12_putimage:
; ebx = pointer to image
; ecx = size [x|y]
; edx = coordinates [x|y]
; ebp = pointer to 'get' function
; esi = pointer to 'init' function
; edi = parameter for 'get' function
 
; mov ebx,image
; mov ecx,320*65536+240
730,8 → 736,7
add ebx,[ecx-twdw+WDATA.box.top]
push eax
mov eax,ebx ; y
mov ebx,[0xfe08]
mul ebx
mul dword [0xfe08]
pop ecx
add eax,ecx ; x
add eax,ecx
747,29 → 752,18
 
; x size
 
movzx eax,word [esp+6]
mov ecx,eax
add ecx,eax
add ecx,eax
cmp [0xfbf1],byte 24 ; 24 or 32 bpp ? - x size
jz pi24312
add ecx,eax
movzx ecx,word [esp+6]
 
pi24312:
 
mov esi,[esp+8]
movzx ebx,word [esp+4]
 
; check limits while draw ?
 
push eax
push ecx
mov eax,[0x3010]
mov ecx,[eax+draw_data-0x3000+RECT.left]
cmp ecx,0
cmp dword [eax+draw_data-0x3000+RECT.left], 0
jnz dbcblimitlset212
mov ecx,[eax+draw_data-0x3000+RECT.top]
cmp ecx,0
cmp dword [eax+draw_data-0x3000+RECT.top], 0
jnz dbcblimitlset212
mov ecx,[eax+draw_data-0x3000+RECT.right]
cmp ecx,[0xfe00]
778,84 → 772,67
cmp ecx,[0xfe04]
jnz dbcblimitlset212
pop ecx
pop eax
push dword 0
push 0
jmp dbcblimitlno212
 
dbcblimitlset212:
 
pop ecx
pop eax
push dword 1
push 1
 
dbcblimitlno212:
 
cmp [0xfbf1],byte 24 ; 24 or 32 bpp ?
jz pi24bit12
jmp pi32bit12
jnz pi32bit12
 
pi24bit12:
 
cld
push eax
push ebx
push edx
xor edx,edx
mov eax,ecx
mov ebx,3
div ebx
mov ecx,eax
pop edx
pop ebx
pop eax
 
newpi12:
 
push edi
push esi
push ecx
push ebx
 
xor edx,edx
mov eax,edi
sub eax,[0xfe80]
mov edx,edi
sub edx,[0xfe80]
mov ebx,3
div ebx
add eax,WinMapAddress
add edx,WinMapAddress
mov ebx,[0x3000]
mov bh,[esp+4*4]
mov bh,[esp+4*3]
 
np2412:
 
cmp bl,[eax]
cmp bl,[edx]
jnz imp24no12
mov edx,[esi]
cmp bh,0
jz imp24yes12
; mov eax,[esi]
push dword [esp+4*3+20]
call ebp
; cmp bh,0
; jz imp24yes12
; call dbcplimit
; jnz imp24no12
 
imp24yes12:
 
push edi
push eax
push edi
mov eax,edi
sub eax,[0xfe80]
shr eax,16
call set_bank
pop eax
and edi,0xffff
add edi,0xa0000
mov [edi],edx
shr edx,2
mov [edi+2],dl
sti
mov [edi],ax
shr eax,16
mov [edi+2],al
pop edi
pop eax
 
imp24no12:
 
inc eax
add esi,3
inc edx
; add esi,3
add edi,3
dec ecx
jnz np2412
864,73 → 841,63
 
pop ebx
pop ecx
pop esi
pop edi
 
add edi,[0xfe08]
xor eax,eax
mov ax,[esp+4+2+4]
lea eax,[eax+eax*2]
add esi,eax
dec ebx
jz nonewpi12
jmp newpi12
jnz newpi12
 
nonewpi12:
 
add esp,7*4
mov eax,0
pop eax edx ecx ebx eax edi esi
xor eax, eax
ret
 
 
pi32bit12:
 
cld
shr ecx,2
 
newpi3212:
 
push edi
push esi
push ecx
push ebx
 
mov eax,edi
sub eax,[0xfe80]
shr eax,2
add eax,WinMapAddress
mov edx,edi
sub edx,[0xfe80]
shr edx,2
add edx,WinMapAddress
mov ebx,[0x3000]
mov bh,[esp+4*4]
mov bh,[esp+4*3]
 
np3212:
 
cmp bl,[eax]
cmp bl,[edx]
jnz imp32no12
mov edx,[esi]
cmp bh,0
jz imp32yes12
; mov eax,[esi]
push dword [esp+4*3+20]
call ebp
; cmp bh,0
; jz imp32yes12
; call dbcplimit
; jnz imp32no12
 
imp32yes12:
 
push edi
push eax
push edi
mov eax,edi
sub eax,[0xfe80]
shr eax,16
call set_bank
pop eax
and edi,0xffff
add edi,0xa0000
mov [edi],edx
sti
mov [edi+0xa0000],eax
pop edi
pop eax
 
imp32no12:
 
inc eax
add esi,3
inc edx
; add esi,3
add edi,4
dec ecx
jnz np3212
939,21 → 906,16
 
pop ebx
pop ecx
pop esi
pop edi
 
add edi,[0xfe08]
movzx eax,word [esp+4+2+4]
lea eax,[eax+eax*2]
add esi,eax
dec ebx
jz nonewpi3212
jmp newpi3212
jnz newpi3212
 
nonewpi3212:
 
add esp,7*4
mov eax,0
pop eax edx ecx ebx eax edi esi
xor eax, eax
ret
 
 
/kernel/trunk/video/vesa20.inc
76,16 → 76,21
.abs_cx dd ?
.abs_cy dd ?
.line_increment dd ?
.source_bpp dd ?
.winmap_newline dd ?
.screen_newline dd ?
.stack_data = 4*13
.stack_data = 4*12
.edi dd ?
.esi dd ?
.ebp dd ?
end virtual
 
align 4
align 16
; ebx = pointer
; ecx = size [x|y]
; edx = coordinates [x|y]
; ebp = pointer to 'get' function
; esi = pointer to 'init' function
; edi = parameter for 'get' function
vesa20_putimage:
pushad
call [disable_mouse]
92,13 → 97,6
 
sub esp, putimg.stack_data
 
mov [putimg.source_bpp], 3
; test ebx, 0x80000000
; jz @f
; inc [putimg.source_bpp]
; @@:
; and ebx, 0x7FFFFFFF
 
; save pointer to image
mov [putimg.pti], ebx
 
164,7 → 162,8
mov eax, [putimg.image_sx]
sub eax, [putimg.real_sx]
;; imul eax, [putimg.source_bpp]
lea eax, [eax + eax * 2]
; lea eax, [eax + eax * 2]
call esi
mov [putimg.line_increment], eax
 
; winmap new line increment
183,7 → 182,7
mov [putimg.screen_newline], eax
 
; pointer to image
mov ecx, [putimg.pti]
mov esi, [putimg.pti]
 
; pointer to screen
mov edx, [putimg.abs_cy]
213,29 → 212,32
mov edi, [putimg.real_sy]
align 4
.new_line:
mov esi, [putimg.real_sx]
mov ecx, [putimg.real_sx]
 
; push ebp edx
align 4
.new_x:
 
push [putimg.edi]
mov eax, [putimg.ebp+4]
call eax
cmp [ebp], bl
jne .skip
mov eax, [ecx] ; ecx = RRBBGGRR
; mov eax, [esi] ; eax = RRBBGGRR
mov [edx], ax
shr eax, 16
mov [edx+2], al
.skip:
 
add ecx, 3 ;[putimg.source_bpp]
; add esi, 3 ;[putimg.source_bpp]
add edx, 3
inc ebp
 
dec esi
dec ecx
jnz .new_x
; pop edx ebp
 
add ecx, [putimg.line_increment]
add esi, [putimg.line_increment]
add edx, [putimg.screen_newline] ;[BytesPerScanLine]
add ebp, [putimg.winmap_newline] ;[ScreenWidth]
;inc ebp
251,27 → 253,30
mov edi, [putimg.real_sy]
align 4
.new_line:
mov esi, [putimg.real_sx]
mov ecx, [putimg.real_sx]
 
; push ebp edx
align 4
.new_x:
 
push [putimg.edi]
mov eax, [putimg.ebp+4]
call eax
cmp [ebp], bl
jne .skip
mov eax, [ecx] ; ecx = RRBBGGRR
; mov eax, [esi] ; ecx = RRBBGGRR
mov [edx], eax
.skip:
 
add ecx, [putimg.source_bpp]
; add esi, [putimg.source_bpp]
add edx, 4
inc ebp
 
dec esi
dec ecx
jnz .new_x
; pop edx ebp
 
add ecx, [putimg.line_increment]
add esi, [putimg.line_increment]
add edx, [putimg.screen_newline] ;[BytesPerScanLine]
add ebp, [putimg.winmap_newline] ;[ScreenWidth]
;inc ebp
/programs/fs/kfar/trunk/dialogs.inc
215,7 → 215,7
mov eax, esi
pop esi
sub eax, esi
inc eax ; eax = äëèíà çàãîëîâêà + 2
inc eax ; eax = ¤«¨­  § £®«®¢ª  + 2
mov ecx, [ebx+dlgtemplate.width]
cmp eax, ecx
jbe .fullhea
236,9 → 236,9
mov ah, [ebx+dlgtemplate.header_color]
mov al, ' '
stosw
.2:
dec ecx
.2:
jecxz .3
jz .3
lodsb
test al, al
jz .4
404,6 → 404,8
call draw_keybar
mov eax, ebp
call mf_free
or [cursor_x], -1
or [cursor_y], -1
call draw_image
popad
ret 8
955,11 → 957,18
dlgitemtemplate:
; «¥¬¥­âë:
; 1 = áâ â¨ç¥áª¨© ⥪áâ
; 2 = ª­®¯ª 
; 3 = ¯®«¥ । ªâ¨à®¢ ­¨ï
.type dd ?
.x1 dd ?
.y1 dd ?
.x2 dd ?
.y2 dd ?
; „ ­­ë¥:
; ¤«ï ⥪áâ : const char* data - ASCIIZ-áâப 
; ¤«ï ª­®¯ª¨: const char* data - § £®«®¢®ª
; ¤«ï । ªâ®à : struct {unsigned maxlength; unsigned pos; unsigned start;
; char data[maxlength+1];}* data;
.data dd ?
.flags dd ?
; ”« £¨:
967,6 → 976,9
; 1 = ¢ëà ¢­¨¢ ­¨¥ ¯® 業âàã
; 2 = ¢ëà ¢­¨¢ ­¨¥ ¢¯à ¢®
; 4 = í«¥¬¥­â ¨¬¥¥â 䮪ãá ¢¢®¤ 
; 8 = í«¥¬¥­â ¬®¦¥â ¨¬¥âì 䮪ãá ¢¢®¤ 
; 10h: ¤«ï ª­®¯ª¨ = ª­®¯ª  ¯® 㬮«ç ­¨î (Enter ­  ­¥-ª­®¯ª¥)
; ¤«ï ¯®«ï ¢¢®¤  = ¤ ­­ë¥ ¡ë«¨ ¬®¤¨ä¨æ¨à®¢ ­ë
.size = $
end virtual
; struct DLGDATA
1017,12 → 1029,16
jz .tab
cmp al, 0x48
jz .up
cmp al, 0x50
jz .down
jecxz @f
cmp [ebx+dlgitemtemplate.type], 3
jz .key_edit
@@:
cmp al, 0x4B
jz .left
cmp al, 0x4D
jz .right
cmp al, 0x50
jz .down
.ret0:
xor eax, eax
ret 16
1030,8 → 1046,22
or eax, -1
ret 16
.enter:
cmp [ebx+dlgitemtemplate.type], 2
jnz @f
.enter_found:
mov eax, ebx
ret 16
@@:
mov ebx, [esp+4]
add ebx, dlgtemplate.size+12
.enter_find:
cmp [ebx+dlgitemtemplate.type], 2
jnz @f
test [ebx+dlgitemtemplate.flags], 0x10
jnz .enter_found
@@:
add ebx, dlgitemtemplate.size
jmp .enter_find
.tab:
test [ctrlstate], 3
jnz .shift_tab
1043,19 → 1073,20
jz .find_first_btn
@@:
add ebx, dlgitemtemplate.size
cmp [ebx+dlgitemtemplate.type], 2
jz .btn_found
test [ebx+dlgitemtemplate.flags], 8
jnz .btn_found
loop @b
.find_first_btn:
mov ebx, [esp+4]
add ebx, dlgtemplate.size+12
@@:
cmp [ebx+dlgitemtemplate.type], 2
jz .btn_found
test [ebx+dlgitemtemplate.flags], 8
jnz .btn_found
add ebx, dlgitemtemplate.size
jmp @b
.btn_found:
or byte [ebx+dlgitemtemplate.flags], 4
.ret_draw:
mov ebx, [esp+4]
call .dodraw
call draw_image
1072,9 → 1103,9
jz .find_last_btn
@@:
sub ebx, dlgitemtemplate.size
cmp [ebx+dlgitemtemplate.type], 2
loopnz @b
jz .btn_found
test [ebx+dlgitemtemplate.flags], 8
loopz @b
jnz .btn_found
.find_last_btn:
mov ebx, [eax+dlgtemplate.size+8]
imul ebx, dlgitemtemplate.size
1081,11 → 1112,126
lea ebx, [ebx+eax+dlgtemplate.size+12]
@@:
sub ebx, dlgitemtemplate.size
cmp [ebx+dlgitemtemplate.type], 2
test [ebx+dlgitemtemplate.flags], 8
jz @b
jmp .btn_found
.key_edit:
; ®¡à ¡®âª  ª« ¢¨è ¢ ¯®«¥ ¢¢®¤ 
test al, 0x80
jnz .ret0
or [ebx+dlgitemtemplate.flags], 0x10
mov edx, [ebx+dlgitemtemplate.data]
cmp al, 0x4B
jz .editor_left
cmp al, 0x4D
jz .editor_right
cmp al, 0x47
jz .editor_home
cmp al, 0x4F
jz .editor_end
cmp al, 0x0E
jz .editor_backspace
cmp al, 0x53
jz .editor_del
test [ctrlstate], 0x3C
jnz .ret_draw
; query keyboard layout
pushad
push 26
pop eax
push 2
pop ebx
xor ecx, ecx
cmp [ctrlstate], 1
sbb ecx, -2
mov edx, layout
int 0x40
popad
; translate scancode to ASCII
movzx eax, al
movzx eax, byte [layout+eax]
push eax
; insert entered symbol
xor eax, eax
lea edi, [edx+12]
or ecx, -1
repnz scasb
not ecx
pop eax
cmp ecx, [edx]
ja .ret_test ; buffer capacity exceeded
lea edi, [edx+ecx+12-1]
mov esi, [edx+4]
lea esi, [edx+esi+12]
@@:
mov cl, [edi]
mov [edi+1], cl
dec edi
cmp edi, esi
jae @b
mov [esi], al
inc dword [edx+4]
@@: jmp .ret_test
.editor_left:
mov ecx, [edx+4]
jecxz @f
dec dword [edx+4]
@@: jmp .ret_test
.editor_right:
mov ecx, [edx+4]
cmp byte [edx+ecx+12], 0
jz @b
inc dword [edx+4]
jmp @b
.editor_home:
and dword [edx+4], 0
jmp @b
.editor_end:
lea edi, [edx+12]
xor eax, eax
or ecx, -1
repnz scasb
not ecx
dec ecx
mov [edx+4], ecx
.ret_test:
mov eax, [edx+4]
cmp [edx+8], eax
jl .ret_test.l1
mov [edx+8], eax
jmp .ret_test.l2
.ret_test.l1:
add eax, [ebx+dlgitemtemplate.x1]
sub eax, [ebx+dlgitemtemplate.x2]
cmp [edx+8], eax
jge .ret_test.l2
mov [edx+8], eax
.ret_test.l2:
jmp .ret_draw
.editor_backspace:
mov ecx, [edx+4]
jecxz .ret_test
dec dword [edx+4]
lea esi, [edx+ecx+12]
lea edi, [esi-1]
.copy_and_ret_test:
@@:
lodsb
stosb
test al, al
jnz @b
jmp .btn_found
jmp .ret_test
.editor_del:
mov ecx, [edx+4]
lea edi, [ecx+edx+12]
lea esi, [edi+1]
cmp byte [edi], 0
jz .ret_test
jmp .copy_and_ret_test
 
.dodraw:
or [cursor_x], -1
or [cursor_y], -1
add ebx, dlgtemplate.size+8
mov ecx, [ebx]
add ebx, 4
1096,7 → 1242,12
dec eax
jz .draw_text
dec eax
jz .draw_button
dec eax
jnz .draw_loop_continue
call draw_editbox
jmp .draw_loop_continue
.draw_button:
call draw_button
jmp .draw_loop_continue
.draw_text:
1114,6 → 1265,7
draw_text:
; ®¯à¥¤¥«ï¥¬ ¤«¨­ã áâப¨
mov esi, [ebx+dlgitemtemplate.data]
draw_text_esi:
test esi, esi
jz .ret
or ecx, -1
1163,6 → 1315,11
pop ecx
cmp ecx, edx
jbe .text_copy
cmp [ebx+dlgitemtemplate.type], 3
jnz @f
mov ecx, edx
jmp .text_copy
@@:
cmp edx, 3
jb .ret
mov al, '.'
1203,3 → 1360,27
mov ah, [dialog_selected_btn_color]
@@:
jmp draw_text
 
draw_editbox:
mov edx, [ebx+dlgitemtemplate.data]
test [ebx+dlgitemtemplate.flags], 4
jz @f
mov eax, [ebx+dlgitemtemplate.x1]
add eax, [edx+4]
sub eax, [edx+8]
mov ecx, [esp+16]
add eax, [ecx+dlgtemplate.x]
mov [cursor_x], eax
mov eax, [ebx+dlgitemtemplate.y1]
add eax, [ecx+dlgtemplate.y]
mov [cursor_y], eax
@@:
mov ah, [dialog_edit_color]
test [ebx+dlgitemtemplate.flags], 10h
jnz @f
mov ah, [dialog_unmodified_edit_color]
@@:
mov esi, [ebx+dlgitemtemplate.data]
add esi, [edx+8]
add esi, 12
jmp draw_text_esi
/programs/fs/kfar/trunk/kfar.asm
18,6 → 18,7
start:
mov eax, mem
call mf_init
call init_console
call draw_window
push 66
pop eax
25,7 → 26,6
pop ebx
mov ecx, ebx
int 40h ; set keyboard mode to scancodes
call init_console
mov esi, def_left_dir
mov edi, panel1_dir
@@:
41,11 → 41,20
stosb
test al, al
jnz @b
mov eax, 304
mov eax, 200
mov [panel1_nfa], eax
mov [panel2_nfa], eax
mov [panel1_files], buf1
mov [panel2_files], buf2
mov eax, 200*4 + 32 + 200*304
push eax
call mf_alloc
mov [panel1_files], eax
pop eax
call mf_alloc
mov [panel2_files], eax
test eax, eax
jz exit
cmp [panel1_files], eax
jz exit
mov [panel1_sortmode], 0 ; sort by name
mov [panel2_sortmode], 0
mov [num_screens], 1
76,6 → 85,17
or eax, -1
int 40h
redraw:
; query kbd state from OS
mov al, 66
push 3
pop ebx
int 0x40
and eax, 0x3F
cmp al, [ctrlstate]
mov [ctrlstate], al
jz @f
call draw_keybar
@@:
mov al, 9
mov ebx, procinfo
or ecx, -1
101,7 → 121,7
@@:
xor ecx, ecx
mov eax, [ebx+42]
sub eax, 5*2
sub eax, 5*2-1
jae @f
xor eax, eax
@@:
124,10 → 144,9
or cl, ch
test edx, edx
setnz ch
or cl, ch
mov eax, [ebx+46]
sub eax, [skinh]
sub eax, 5
sub eax, 5-1
jns @f
xor eax, eax
@@:
146,16 → 165,16
@@:
cmp eax, [cur_height]
mov [cur_height], eax
setnz ch
jnz .resize
test cl, cl
jnz .resize
test edx, edx
setnz cl
or cl, ch
test edx, edx
setnz ch
test cx, cx
jz @f
mov eax, [MemForImage]
call mf_free
and [MemForImage], 0
call init_console
test byte [ebx+70], 1
jnz @f
.resize:
push 67
pop eax
or ebx, -1
162,13 → 181,15
or ecx, -1
mov edx, [cur_width]
imul edx, font_width
add edx, 5*2
add edx, 5*2-1
mov esi, [cur_height]
imul esi, font_height
add esi, [skinh]
add esi, 5
add esi, 5-1
int 40h
call draw_window
.resize_draw:
call init_console
; call draw_window
call draw_keybar
mov ebp, [active_screen_data]
mov eax, [active_screen_vtable]
177,6 → 198,56
@@:
call draw_window
jmp event
alt_f9:
cmp [saved_width], -1
jz @f
mov eax, [saved_width]
mov [cur_width], eax
or [saved_width], -1
mov eax, [saved_height]
mov [cur_height], eax
or [saved_height], -1
jmp redraw.resize
@@:
push 48
pop eax
push 5
pop ebx
int 0x40
push eax
sub eax, [esp+2]
inc eax
movzx eax, ax
sub eax, 10
xor edx, edx
mov ecx, font_width
div ecx
xchg [cur_width], eax
mov [saved_width], eax
mov eax, ebx
shr ebx, 16
sub eax, ebx
sub eax, 5-1
sub eax, [skinh]
xor edx, edx
mov ecx, font_height
div ecx
xchg [cur_height], eax
mov [saved_height], eax
mov ecx, ebx
pop ebx
shr ebx, 16
mov edx, [cur_width]
imul edx, font_width
add edx, 5*2-1
mov esi, [cur_height]
imul esi, font_height
add esi, [skinh]
add esi, 4
push 67
pop eax
int 0x40
jmp redraw.resize_draw
key:
mov al, 2
int 40h
581,36 → 652,13
call get_curfile_folder_entry
test byte [ecx], 10h
jnz .enter_folder
; find extension
lea esi, [ecx+40]
push esi
@@:
lodsb
test al, al
jnz @b
@@:
dec esi
cmp byte [esi], '.'
jz .found_ext
cmp esi, [esp]
ja @b
jmp .run_app
.found_ext:
inc esi
mov edi, associations
@@:
push esi edi
mov edi, [edi]
call strcmpi
pop edi esi
jz .run_association
add edi, 8
cmp edi, associations_end
jb @b
jmp .run_app
call find_extension
jc .run_app
jnz .run_app
.run_association:
mov eax, [edi+4]
.run_association2:
mov [execparams], execdata
mov eax, [edi+4]
mov [execptr], eax
jmp .dorun
.run_app:
617,7 → 665,6
mov [execptr], execdata
and [execparams], 0
.dorun:
pop esi
lea esi, [ebp + panel1_dir - panel1_data]
mov edi, execdata
; TODO: add overflow check
636,10 → 683,52
stosb
test al, al
jnz @b
; for fasm call - special handling, because
; 1) fasm command line convention is different : fasm infile,outfile[,path] rather than tinypad infile
; 2) fasm will probably create new file in directory, so we want to reload panel data
xor edx, edx
cmp [execparams], edx
jz .nofasm
cmp [execptr], fasm
jnz .nofasm
; TODO: add buffer/cmdline overflow check
mov esi, execdata
@@:
lodsb
stosb
test al, al
jnz @b
mov byte [esi-1], ','
inc edx
; output file: no extension if input file has extension, '.bin' otherwise
push edi
@@:
dec edi
cmp byte [edi], '.'
jz .ptfound
cmp byte [edi], '/'
jnz @b
pop edi
mov dword [edi-1], '.bin'
mov byte [edi+3], 0
jmp .nofasm
.ptfound:
mov byte [edi], 0
pop edi
.nofasm:
push 70
pop eax
mov ebx, execinfo
int 40h
test edx, edx
jz @f
push 5
pop eax
push 20
pop ebx
int 0x40
jmp .ctrl_r
@@:
ret
.enter_folder:
lea esi, [ecx+40]
880,6 → 969,270
jnz @b
call read_folder
jmp .done_redraw
.shift_f5:
call get_curfile_folder_entry
lea esi, [ecx+40]
mov edi, CopyDestEditBuf
mov eax, CopyDestEditBuf.length
stosd
scasd
xor eax, eax
stosd
mov edx, edi
@@:
lodsb
test al, al
jz .f5_common
stosb
jmp @b
.f5:
mov edi, CopyDestEditBuf
mov eax, CopyDestEditBuf.length
stosd
scasd
xor eax, eax
stosd
mov edx, edi
mov esi, ebp
xor esi, panel1_data xor panel2_data
add esi, panel1_dir - panel1_data
@@:
lodsb
test al, al
jz @f
stosb
jmp @b
@@:
mov al, '/'
stosb
.f5_common:
mov byte [edi], 0
sub edi, edx
mov [edx-8], edi
mov edi, CopySourceTextBuf
mov esi, aCopy1
@@:
lodsb
test al, al
jz @f
stosb
jmp @b
@@:
call get_curfile_folder_entry
lea esi, [ecx+40]
lea eax, [esi+1]
@@:
inc esi
cmp byte [esi-1], 0
jnz @b
sub esi, eax
xchg eax, esi
dec esi
mov edx, [cur_width]
sub edx, 50
sub eax, edx
jbe @f
add esi, eax
mov al, '.'
stosb
stosb
stosb
@@:
lodsb
test al, al
jz @f
stosb
jmp @b
@@:
mov esi, aCopy2
@@:
lodsb
stosb
test al, al
jnz @b
mov ebx, copy_dlgdata
mov eax, [cur_width]
sub eax, 12
mov [ebx + dlgtemplate.width], eax
dec eax
dec eax
mov [ebx - copy_dlgdata + copy_dlgdata.width2], eax
mov [ebx - copy_dlgdata + copy_dlgdata.width3], eax
shr eax, 1
dec eax
dec eax
mov [ebx - copy_dlgdata + copy_dlgdata.copy_x2], eax
sub eax, aCopyLength-1
mov [ebx - copy_dlgdata + copy_dlgdata.copy_x1], eax
add eax, aCopyLength+3
mov [ebx - copy_dlgdata + copy_dlgdata.cnl_x1], eax
add eax, aCancelBLength - 1
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
and byte [ebx - copy_dlgdata + copy_dlgdata.flags1], not 4
and byte [ebx - copy_dlgdata + copy_dlgdata.flags2], not 4
push ebx
call DialogBox
cmp eax, copy_dlgdata.copy_btn
jnz .ret2
; Š®¯¨à㥬
mov esi, CopyDestEditBuf+12
mov edi, esi
xor eax, eax
or ecx, -1
repnz scasb
dec edi
dec edi
cmp edi, esi
jb .ret2
cmp byte [edi], '/'
jnz @f
;  «¨ç¨¥/®âáãâá⢨¥ § ª ­ç¨¢ î饣® á«íè  ¢ ¦­® ⮫쪮 ¤«ï ª®¯¨à®¢ ­¨ï ¯ ¯®ª
cmp edi, esi
jz @f
mov byte [edi], 0
dec edi
@@:
; …᫨ ¯ãâì ­¥ ­ ç¨­ ¥âáï á® á«íè , áç¨â ¥¬ ¥£® ®â­®á¨â¥«ì­® ⥪ã饩 ¯ ¯ª¨
cmp byte [esi], '/'
jz .copy_absolute_path
push esi
push edi
lea edi, [ebp + panel1_dir - panel1_data]
or ecx, -1
xor eax, eax
repnz scasb
not ecx
pop edi
lea edx, [edi+2]
sub edx, esi
lea edi, [edi+ecx+1]
xchg ecx, edx
std
lea esi, [esi+ecx-1]
rep movsb
cld
pop edi
lea esi, [ebp + panel1_dir - panel1_data]
push edi
mov ecx, edx
rep movsb
mov byte [edi-1], '/'
pop esi
.copy_absolute_path:
; ®«ãç ¥¬  âਡãâë ­ §­ ç¥­¨ï
mov cl, 0x10
xor eax, eax
mov edi, esi
.countslashloop:
cmp byte [edi], '/'
jnz @f
inc eax
@@:
inc edi
cmp byte [edi], 0
jnz .countslashloop
cmp eax, 2
jbe @f
mov ebx, attrinfo
mov [attrinfo.attr], 0
mov [ebx + attrinfo.name - attrinfo], esi
push 70
pop eax
int 0x40
mov cl, byte [attrinfo.attr]
@@:
test cl, 0x10
jz .copyfile
;  ¬ ¯®¤áã­ã«¨ ª â «®£ ­ §­ ç¥­¨ï, ¤®¯¨á뢠¥¬ ¨¬ï ä ©« 
mov al, '/'
stosb
push esi
call get_curfile_folder_entry
lea esi, [ecx+40]
@@:
lodsb
stosb
test al, al
jnz @b
pop esi
.copyfile:
; ˆ¬ï ¨á室­®£® ä ©« 
push esi
lea esi, [ebp+panel1_dir-panel1_data]
mov edi, saved_file_name
push edi
@@:
lodsb
test al, al
jz @f
stosb
jmp @b
@@:
mov al, '/'
stosb
call get_curfile_folder_entry
lea esi, [ecx+40]
@@:
lodsb
stosb
test al, al
jnz @b
pop esi
pop edi
; ¥«ì§ï ᪮¯¨à®¢ âì ä ©« ¯®¢¥àå á ¬®£® ᥡï!
push esi edi
call strcmpi
pop edi esi
jz .ret2
; ‘®¡á⢥­­®, ª®¯¨à㥬
; esi->source name, edi->destination name
mov [writeinfo.code], 2
mov [writeinfo.name], edi
and dword [writeinfo.first], 0
and dword [writeinfo.first+4], 0
mov [writeinfo.data], copy_buffer
mov ebx, readinfo
and dword [ebx+readinfo.first-readinfo], 0
and dword [ebx+readinfo.first+4-readinfo], 0
mov [ebx+readinfo.size-readinfo], copy_buffer_size
mov [ebx+readinfo.data-readinfo], copy_buffer
mov [ebx+readinfo.name-readinfo], esi
.copyloop:
mov ebx, readinfo
push 70
pop eax
int 0x40
cmp ebx, -1
jz .copydone
test ebx, ebx
jz .copydone
add dword [readinfo.first], ebx
adc dword [readinfo.first+4], 0
mov [writeinfo.size], ebx
mov ebx, writeinfo
push 70
pop eax
int 0x40
mov ecx, [writeinfo.size]
add dword [writeinfo.first], ecx
adc dword [writeinfo.first+4], 0
mov [writeinfo.code], 3
cmp ecx, copy_buffer_size
jz .copyloop
.copydone:
push ebp
call .ctrl_r
pop ebp
xor ebp, panel1_data xor panel2_data
jmp .ctrl_r
 
.f3:
call view_file
.ret2:
980,7 → 1333,7
mov eax, [ebp + panel1_index - panel1_data]
push eax
call get_curfile_name
mov esi, eax
mov esi, ecx
mov edi, saved_file_name
@@:
lodsb
1034,6 → 1387,108
mov [ebp + panel1_start - panel1_data], eax
@@:
jmp .done_redraw
.menu:
; display context menu
; ignore folders
call get_curfile_folder_entry
test byte [ecx], 10h
jz @f
.menuret:
ret
@@:
call find_extension
jc .menuret
jnz .menuret
; known extension
mov ebx, [edi+8]
test ebx, ebx
jz .menuret
mov ecx, esi
@@:
inc ecx
cmp byte [ecx-1], 0
jnz @b
sub ecx, esi ; ecx = ¤«¨­  ¨¬¥­¨ ä ©« +1 = ¤«¨­  § £®«®¢ª +1
cmp ecx, 15
jb @f
mov cl, 15
@@:
xor edx, edx
.menucreateloop:
mov eax, [ebx]
test eax, eax
jz .menucreated
@@:
inc eax
cmp byte [eax-1], 0
jnz @b
sub eax, [ebx]
cmp eax, ecx
ja @f
mov eax, ecx
@@:
add eax, 12
call mf_alloc
test eax, eax
jz .menucreated
add eax, 4
test edx, edx
jz @f
mov [edx], eax
@@:
mov [eax+4], edx
mov edx, eax
push esi
mov esi, [ebx+4]
mov [eax-4], esi
mov esi, [ebx]
lea edi, [eax+8]
@@:
lodsb
stosb
test al, al
jnz @b
sub esi, [ebx]
sub esi, ecx
jae .menunoadd
neg esi
@@:
mov byte [edi-1], ' '
stosb
dec esi
jnz @b
.menunoadd:
pop esi
add ebx, 8
jmp .menucreateloop
.menucreated:
test edx, edx
jz .menuret
and dword [edx], 0
@@:
cmp dword [edx+4], 0
jz @f
mov edx, [edx+4]
jmp @b
@@:
push 1
push esi
push edx
call menu
cmp eax, -1
jz .menuret
push dword [eax-4]
@@:
test edx, edx
jz @f
lea eax, [edx-4]
mov edx, [edx]
call mf_free
jmp @b
@@:
pop eax
call get_curfile_folder_entry
jmp .run_association2
 
panels_OnRedraw:
call draw_cmdbar
1044,14 → 1499,23
ret
 
init_console:
mov eax, [console_data_ptr]
call mf_free
mov eax, [cur_width]
mul [cur_height]
mov ecx, eax
add eax, eax
add eax, eax
call mf_alloc
test eax, eax
jz exit
mov [console_data_ptr], eax
mov edi, eax
mov ax, 0720h
mov ecx, [cur_width]
imul ecx, [cur_height]
mov edi, console_data
rep stosw
and [panel1_left], 0
and [panel1_top], 0
and [panel2_top], 0
mov [panel1_left], ecx
mov [panel1_top], ecx
mov [panel2_top], ecx
mov eax, [cur_width]
inc eax
shr eax, 1
1192,10 → 1656,10
mov [skinh], eax
mov ebx, [cur_width]
imul ebx, font_width
add ebx, 100*65536 + 5*2
add ebx, 100*65536 + 5*2-1
mov ecx, [cur_height]
imul ecx, font_height
lea ecx, [eax+ecx+5+100*65536]
lea ecx, [eax+ecx+5-1+100*65536]
xor eax, eax
mov edx, 0x13000000
mov edi, header
1219,10 → 1683,18
; push 4
; pop eax
; int 40h
xor ecx, ecx
call draw_image
push 12
pop eax
; xor ecx, ecx
; call draw_image
and [min_x], 0
and [min_y], 0
mov eax, [cur_width]
dec eax
mov [max_x], eax
mov eax, [cur_height]
dec eax
mov [max_y], eax
call draw_image.force
mov al, 12
push 2
pop ebx
int 40h
1248,34 → 1720,129
ret
 
draw_image:
cmp [MemForImage], 0
jnz .allocated
; determine draw rectangle
and [max_x], 0
or [min_x], -1
or [min_y], -1
mov esi, [console_data_ptr]
xor eax, eax
xor edx, edx
mov ecx, [cur_width]
imul ecx, [cur_height]
.m1:
mov bx, [esi]
cmp bx, [esi+ecx*2]
jz .m2
cmp eax, [min_x]
ja @f
mov [min_x], eax
@@:
cmp eax, [max_x]
jb @f
mov [max_x], eax
@@:
cmp edx, [min_y]
jae @f
mov [min_y], edx
@@:
mov [max_y], edx
.m2:
add esi, 2
inc eax
cmp eax, [cur_width]
jb .m1
xor eax, eax
inc edx
cmp edx, [cur_height]
jb .m1
mov eax, [cursor_x]
cmp eax, -1
jz .m3
cmp eax, [min_x]
ja @f
mov [min_x], eax
@@:
cmp eax, [max_x]
jb @f
mov [max_x], eax
@@:
mov edx, [cursor_y]
cmp edx, [min_y]
ja @f
mov [min_y], edx
@@:
cmp edx, [max_y]
jb @f
mov [max_y], edx
@@:
.m3:
xchg eax, [old_cursor_x]
xchg edx, [old_cursor_y]
cmp eax, -1
jz .m4
cmp eax, [min_x]
ja @f
mov [min_x], eax
@@:
cmp eax, [max_x]
jb @f
mov [max_x], eax
@@:
cmp edx, [min_y]
ja @f
mov [min_y], edx
@@:
cmp edx, [max_y]
jb @f
mov [max_y], edx
@@:
.m4:
cmp [min_y], -1
jz .nodraw
.force:
; allocate memory for image
mov eax, [cur_width]
imul eax, [cur_height]
imul eax, font_width*font_height*3
call mf_alloc
mov ecx, [max_x]
sub ecx, [min_x]
inc ecx
mov [used_width], ecx
mov edx, [max_y]
sub edx, [min_y]
inc edx
mov [used_height], edx
imul ecx, edx
imul ecx, font_width*font_height
add ecx, [heapend]
push 64
pop eax
push 1
pop ebx
int 0x40
test eax, eax
jz draw_image.nomem
mov [MemForImage], eax
.allocated:
mov edi, [MemForImage]
mov esi, console_data
mov ecx, [cur_height]
jnz draw_image.nomem
mov edi, [heapend]
mov esi, [console_data_ptr]
mov eax, [min_y]
imul eax, [cur_width]
add eax, [min_x]
lea esi, [esi+eax*2]
mov ecx, [used_height]
.lh:
push ecx esi
mov ecx, [used_width]
.lw:
push ecx
mov ecx, [cur_width]
.lw:
push ecx edi
xor eax, eax
mov al, [esi+1]
and al, 0xF
mov ebx, [console_colors + eax*4] ; 梥â ⥪áâ 
mov al, [esi+1]
shr al, 4
mov ebp, [console_colors + eax*4] ; 梥â ä®­ 
lodsb
inc esi
mov ebx, [esi]
mov eax, [cur_width]
imul eax, [cur_height]
mov [eax*2+esi], bx
movzx eax, bl
push edi
movzx ebx, bh
mov ebp, ebx
shr ebp, 4
and ebx, 0xF
sub ebx, ebp
add esi, 2
if font_width > 8
lea edx, [eax+eax+font]
else
1283,23 → 1850,22
end if
mov ecx, font_height
.sh:
push ecx edi
push ecx edx edi
xor ecx, ecx
mov edx, [edx]
.sw:
mov eax, ebx
bt [edx], ecx
jc @f
mov eax, ebp
@@:
stosw
shr eax, 16
stosb
inc ecx
shr edx, 1
sbb eax, eax
and eax, ebx
add eax, ebp
mov [edi], al
add ecx, 1
add edi, 1
cmp ecx, font_width
jb .sw
pop edi ecx
mov eax, [cur_width]
imul eax, font_width*3
pop edi edx ecx
mov eax, [used_width]
imul eax, font_width
add edi, eax
if font_width > 8
add edx, 256*2
1307,24 → 1873,76
add edx, 256
end if
loop .sh
pop edi ecx
add edi, font_width*3
loop .lw
mov eax, [cur_width]
imul eax, (font_height-1)*font_width*3
pop edi
.skip_symbol:
pop ecx
add edi, font_width
dec ecx
jnz .lw
mov eax, [used_width]
imul eax, (font_height-1)*font_width
add edi, eax
pop esi ecx
add esi, [cur_width]
add esi, [cur_width]
dec ecx
jnz .lh
; cursor
mov eax, [cursor_y]
inc eax
jz .nocursor
sub eax, [min_y]
mul [used_width]
imul eax, font_height*font_width
mov edx, [cursor_x]
sub edx, [min_x]
inc edx
imul edx, font_width
add eax, edx
add eax, [heapend]
mov edx, [used_width]
imul edx, font_width
neg edx
mov ecx, (font_height*15+50)/100
.cursor_loop:
push ecx
mov ecx, font_width
add eax, edx
push eax
@@:
; add byte [eax-1], 0x10
xor byte [eax-1], 7
sub eax, 1
loop @b
pop eax
pop ecx
loop .lh
push 7
loop .cursor_loop
.nocursor:
mov ecx, [used_width]
imul ecx, font_width*65536
mov cx, word [used_height]
imul cx, font_height
mov edx, [min_x]
imul edx, font_width
add edx, 5
shl edx, 16
mov dx, word [min_y]
imul dx, font_height
add edx, [skinh]
push 65
pop eax
mov ebx, [MemForImage]
mov ecx, [cur_width]
imul ecx, font_width*10000h
mov cx, word [cur_height]
imul cx, font_height
mov edx, [skinh]
add edx, 5*10000h
int 40h
mov ebx, [heapend]
push 8
pop esi
mov edi, console_colors
int 0x40
push 64
pop eax
push 1
pop ebx
mov ecx, [heapend]
int 0x40
.nodraw:
ret
 
get_console_ptr:
1333,7 → 1951,8
push edx
imul edx, [cur_width]
add edx, eax
lea edi, [console_data + edx*2]
mov edi, [console_data_ptr]
lea edi, [edi + edx*2]
pop edx
ret
 
1431,7 → 2050,7
dec edi
@@:
push edi
mov eax, [cur_width]
xor eax, eax
mov edx, [cur_height]
call get_console_ptr
mov ecx, edi
1755,6 → 2374,7
jae .size_tera
; ¢ £¨£ ¡ ©â å
mov al, 'G'
shl edx, 2
jmp .size_letter
.size_tera:
; ¢ â¥à ¡ ©â å
1884,47 → 2504,14
mov ecx, [ebp + panel1_nfa - panel1_data]
lea esi, [esi + ecx*4 + 32 + 40]
add esi, [ebp + panel1_files - panel1_data]
; ¯®¤á¢¥âª 
; call insert_last_dot
xor ecx, ecx
.highlight_test_loop:
mov ebx, [highlight_groups+ecx*4]
mov al, [ebx + highlight.IncludeAttributes]
mov ah, [esi - 40]
and ah, al
cmp ah, al
jnz .highlight_test_failed
push edi
lea edi, [ebx + highlight.Mask]
call match_mask
pop edi
jc .highlight_test_failed
mov ah, [ebx + highlight.NormalColor]
mov ah, [esi - 40 + 5]
cmp ebp, [active_panel]
jnz @f
mov ecx, [column_index]
cmp ecx, [ebp + panel1_index - panel1_data]
jnz @f
mov ah, [ebx + highlight.CursorColor]
mov ah, [esi - 40 + 6]
@@:
test ah, ah
jz .nohighlight
jmp .doname
.highlight_test_failed:
inc ecx
cmp ecx, [highlight_num_groups]
jb .highlight_test_loop
.nohighlight:
mov ah, [panel_normal_color]
cmp ebp, [active_panel]
jnz @f
mov ecx, [column_index]
cmp ecx, [ebp + panel1_index - panel1_data]
jnz @f
mov ah, [panel_cursor_color]
@@:
.doname:
; call delete_last_dot
mov ecx, [column_width]
push edi
@@:
2056,12 → 2643,7
jz .readdone
push eax
mov eax, [ebp + panel1_files - panel1_data]
cmp eax, buf1
jz @f
cmp eax, buf2
jz @f
call mf_free
@@:
pop eax
mov eax, [eax+8]
add eax, 0xF
2088,7 → 2670,8
lea esi, [edi + eax*4 + 32]
xor eax, eax
mov ecx, [esi-32+4]
jecxz .loopdone
test ecx, ecx
jz .loopdone
; ˆ£­®à¨à㥬 ᯥ樠«ì­ë¥ ¢å®¤ë, ᮮ⢥âáâ¢ãî騥 ¯ ¯ª¥ '.' ¨ ¬¥âª¥ ⮬ 
.ptrinit:
cmp word [esi+eax+40], '.'
2096,9 → 2679,61
test byte [esi+eax], 8
jnz .loopcont
stosd
; ¯®¤á¢¥âª 
; call insert_last_dot
pushad
lea ebp, [esi+eax]
lea esi, [ebp+40]
mov edi, lower_file_name
mov edx, edi
@@:
lodsb
call tolower
stosb
test al, al
jnz @b
mov esi, edx
lea edx, [edi-1]
xor ecx, ecx
.highlight_test_loop:
mov ebx, [highlight_groups+ecx*4]
mov al, [ebx + highlight.IncludeAttributes]
mov ah, [ebp]
and ah, al
cmp ah, al
jnz .highlight_test_failed
lea edi, [ebx + highlight.Mask]
call match_mask_rev_lowercase
jc .highlight_test_failed
mov ah, [ebx + highlight.NormalColor]
test ah, ah
jnz @f
mov ah, [panel_normal_color]
@@:
mov [ebp+5], ah
mov ah, [ebx + highlight.CursorColor]
test ah, ah
jnz @f
mov ah, [panel_cursor_color]
@@:
mov [ebp+6], ah
jmp .doname
.highlight_test_failed:
inc ecx
cmp ecx, [highlight_num_groups]
jb .highlight_test_loop
.nohighlight:
mov ah, [panel_normal_color]
mov [ebp+5], ah
mov ah, [panel_cursor_color]
mov [ebp+6], ah
.doname:
; call delete_last_dot
popad
.loopcont:
add eax, 304
loop .ptrinit
dec ecx
jnz .ptrinit
.loopdone:
sub edi, [ebp + panel1_files - panel1_data]
shr edi, 2
2730,6 → 3365,7
stc
ret
 
if 0
match_mask:
; in: esi->name, edi->mask
; out: CF clear <=> match
2847,6 → 3483,36
inc esi
jmp .list
.asterisk:
cmp byte [esi], 0
jz .done_succ
cmp byte [esi], '?'
jnz @f
mov al, 0
scasb
jz .done_fail
inc esi
jmp .asterisk
@@:
cmp byte [esi], '['
jz .asterisk_common
; the mask is ...*<normal-symbol>...
.asterisk_normal:
mov al, [esi]
@@:
cmp byte [edi], 0
jz .done_fail
call match_symbol
jz @f
inc edi
jmp @b
@@:
inc edi
inc esi
call match_single_mask
jnc .done_succ
dec esi
jmp .asterisk_normal
.asterisk_common:
push edi
@@:
call match_single_mask
2860,6 → 3526,188
pop edi
jmp .done_succ
 
match_mask_rev:
; in: esi->name, edx->end of name, edi->mask
; out: CF clear <=> match
pusha
xchg esi, edx
xchg esi, edi
.main_cycle:
mov ecx, esi
@@:
lodsb
test al, al
jz @f
cmp al, ','
jz @f
cmp al, '|'
jnz @b
@@:
dec esi
mov [esi], byte 0
call match_single_mask_rev2
mov [esi], al
inc esi
jnc .found
cmp al, ','
jz .main_cycle
.done_fail:
stc
popa
ret
.found:
test al, al
jz .done_succ
cmp al, '|'
jz .test_exclude
lodsb
jmp .found
.done_succ:
clc
popa
ret
.test_exclude:
mov ecx, esi
@@:
lodsb
test al, al
jz @f
cmp al, ','
jnz @b
@@:
dec esi
mov byte [esi], 0
call match_single_mask_rev2
mov [esi], al
inc esi
jnc .done_fail
test al, al
jz .done_succ
jmp .test_exclude
 
match_single_mask_rev2:
pusha
jmp match_single_mask_rev.mask_symbol
match_single_mask_rev:
; in: esi->mask, edi->end of name, edx->start of name
; out: CF clear <=> match
pusha
mov ecx, esi
@@:
lodsb
test al, al
jnz @b
dec esi
; esi->end of mask, ecx->start of mask
.mask_symbol:
dec esi
cmp esi, ecx
jb .mask_done
mov al, [esi]
cmp al, '*'
jz .asterisk
cmp al, '?'
jz .quest
cmp al, ']'
jz .list
dec edi
cmp edi, edx
jb .done_fail
call match_symbol
jz .mask_symbol
.done_fail:
stc
popa
ret
.mask_done:
cmp edi, edx
jnz .done_fail
.done_succ:
clc
popa
ret
.quest:
dec edi
cmp edi, edx
jb .done_fail
jmp .mask_symbol
.list:
dec edi
cmp edi, edx
jb .done_fail
.list_check:
dec esi
cmp esi, ecx
jbe .done_fail
mov al, [esi]
cmp al, '['
jz .done_fail
cmp byte [esi-1], '-'
jz .range
call match_symbol
jnz .list_check
.listok:
@@:
dec esi
cmp esi, ecx
jb .done_fail
cmp byte [esi], '['
jnz @b
jmp .mask_symbol
.range:
call match_symbol
jb @f
mov al, [esi-2]
call match_symbol
jbe .listok
@@:
dec esi
dec esi
jmp .list_check
.asterisk:
cmp esi, ecx
jz .done_succ
cmp byte [esi-1], '?'
jnz @f
cmp edi, edx
jz .done_fail
dec esi
jmp .asterisk
@@:
cmp byte [esi-1], ']'
jz .asterisk_common
; the mask is ...<normal-symbol>*...
.asterisk_normal:
mov al, [esi-1]
@@:
cmp edi, edx
jz .done_fail
call match_symbol
jz @f
dec edi
jmp @b
@@:
dec edi
dec esi
call match_single_mask_rev2
jnc .done_succ
inc esi
jmp .asterisk_normal
.asterisk_common:
push edi
@@:
call match_single_mask_rev2
jnc @f
dec edi
cmp edi, edx
jae @b
pop edi
jmp .done_fail
@@:
pop edi
jmp .done_succ
end if
 
tolower:
cmp al, 'A'
jb @f
2880,11 → 3728,214
pop eax
ret
 
match_mask_rev_lowercase:
; in: esi->name, edx->end of name, edi->mask
; out: CF clear <=> match
pusha
xchg esi, edx
xchg esi, edi
.main_cycle:
mov ecx, esi
@@:
lodsb
test al, al
jz @f
cmp al, ','
jz @f
cmp al, '|'
jnz @b
@@:
dec esi
mov [esi], byte 0
call match_single_mask_rev_lowercase
mov [esi], al
inc esi
jnc .found
cmp al, ','
jz .main_cycle
.done_fail:
stc
popa
ret
.found:
test al, al
jz .done_succ
cmp al, '|'
jz .test_exclude
lodsb
jmp .found
.done_succ:
clc
popa
ret
.test_exclude:
mov ecx, esi
@@:
lodsb
test al, al
jz @f
cmp al, ','
jnz @b
@@:
dec esi
mov byte [esi], 0
call match_single_mask_rev_lowercase
mov [esi], al
inc esi
jnc .done_fail
test al, al
jz .done_succ
jmp .test_exclude
 
header db 'Kolibri Far 0.14'
;.length = $ - header
db 0
match_single_mask_rev_lowercase:
; in: esi->end of mask, ecx->start of mask, edi->end of name, edx->start of name
; out: CF clear <=> match
push esi edi eax
.mask_symbol:
dec esi
cmp esi, ecx
jb .mask_done
mov al, [esi]
cmp al, '*'
jz .asterisk
cmp al, '?'
jz .quest
cmp al, ']'
jz .list
dec edi
cmp edi, edx
jb .done_fail
cmp al, [edi]
jz .mask_symbol
.done_fail:
stc
pop eax edi esi
ret
.mask_done:
cmp edi, edx
jnz .done_fail
.done_succ:
clc
pop eax edi esi
ret
.quest:
dec edi
cmp edi, edx
jb .done_fail
jmp .mask_symbol
.list:
dec edi
cmp edi, edx
jb .done_fail
.list_check:
dec esi
cmp esi, ecx
jbe .done_fail
mov al, [esi]
cmp al, '['
jz .done_fail
cmp byte [esi-1], '-'
jz .range
cmp al, [edi]
jnz .list_check
.listok:
@@:
dec esi
cmp esi, ecx
jb .done_fail
cmp byte [esi], '['
jnz @b
jmp .mask_symbol
.range:
cmp al, [edi]
jb @f
mov al, [esi-2]
cmp al, [edi]
jbe .listok
@@:
dec esi
dec esi
jmp .list_check
.asterisk:
cmp esi, ecx
jz .done_succ
cmp byte [esi-1], '?'
jnz @f
cmp edi, edx
jz .done_fail
dec esi
jmp .asterisk
@@:
cmp byte [esi-1], ']'
jz .asterisk_common
; the mask is ...<normal-symbol>*...
.asterisk_normal:
mov al, [esi-1]
@@:
cmp edi, edx
jz .done_fail
cmp al, [edi]
jz @f
dec edi
jmp @b
@@:
dec edi
dec esi
call match_single_mask_rev_lowercase
jnc .done_succ
inc esi
jmp .asterisk_normal
.asterisk_common:
push edi
@@:
call match_single_mask_rev_lowercase
jnc @f
dec edi
cmp edi, edx
jae @b
pop edi
jmp .done_fail
@@:
pop edi
jmp .done_succ
 
find_extension:
lea esi, [ecx+40]
push esi
@@:
lodsb
test al, al
jnz @b
@@:
dec esi
cmp byte [esi], '.'
jz .found_ext
cmp esi, [esp]
ja @b
; empty extension
pop esi
stc
ret
.found_ext:
inc esi
mov edi, associations
@@:
push esi edi
mov edi, [edi]
call strcmpi
pop edi esi
jz @f
add edi, 12
cmp edi, associations_end
jb @b
; unknown extension
inc edi
@@:
pop esi
ret
 
header db 'Kolibri Far 0.19',0
 
nomem_draw db 'No memory for redraw.',0
.size = $ - nomem_draw
 
3257,9 → 4308,17
align 4
cur_width dd 80
cur_height dd 25
saved_width dd -1
saved_height dd -1
max_width = 256
max_height = 256
console_data_ptr dd 0
 
cursor_x dd -1
cursor_y dd -1
old_cursor_x dd -1
old_cursor_y dd -1
 
active_panel dd panel1_data
 
console_colors dd 0x000000, 0x000080, 0x008000, 0x008080
3375,10 → 4434,18
dd panels_OnKey.enter
dw 0x3D, 0
dd panels_OnKey.f3
dw 0x3F, 0
dd panels_OnKey.f5
dw 0x3F, 1
dd panels_OnKey.shift_f5
dw 0x42, 0
dd panels_OnKey.f8
dw 0x43, 0x100
dd alt_f9
dw 0x44, 0
dd exit
dw 0x5D, 0
dd panels_OnKey.menu
repeat 9-3+1
dw 0x3D+%-1, 0x10
dd panels_OnKey.ctrl_f39
3434,6 → 4501,8
dd viewer_OnKey.end
dw 0x58, 0
dd F12
dw 0x43, 0x100
dd alt_f9
db 0
 
dirinfo:
3453,6 → 4522,14
db 0
.name dd 0
 
writeinfo:
.code dd 2
.first dq 0
.size dd 0
.data dd 0
db 0
.name dd 0
 
attrinfo:
dd 5
dd 0
3493,6 → 4570,8
dialog_header_color db 70h
dialog_normal_btn_color db 70h
dialog_selected_btn_color db 30h
dialog_edit_color db 30h
dialog_unmodified_edit_color db 38h
; Œ¥­î
menu_normal_color db 3Fh
menu_selected_color db 0Fh
3535,6 → 4614,7
.Mask: ; ASCIIZ-string
end virtual
 
; all highlight masks must be in lowercase!
highlight_group0:
db 13h
db 38h
3590,20 → 4670,20
db '*',0
 
associations:
dd aAsm, tinypad
dd aInc, tinypad
dd aTxt, tinypad
dd aJpg, jpegview
dd aJpeg, jpegview
dd aGif, gifview
dd aWav, ac97
dd aMp3, ac97
dd aMid, midamp
dd aBmp, mv
dd aPng, archer
dd aRtf, rtfread
dd a3ds, view3ds
dd aLif, life2
dd aAsm, tinypad, AsmMenu
dd aInc, tinypad, 0
dd aTxt, tinypad, 0
dd aJpg, jpegview, 0
dd aJpeg, jpegview, 0
dd aGif, gifview, GifMenu
dd aWav, ac97, 0
dd aMp3, ac97, 0
dd aMid, midamp, 0
dd aBmp, mv, BmpMenu
dd aPng, archer, 0
dd aRtf, rtfread, 0
dd a3ds, view3ds, 0
dd aLif, life2, 0
associations_end:
 
aAsm db 'asm',0
3640,6 → 4720,32
aLif db 'lif',0
life2 db '/rd/1/demos/life2',0
 
AsmMenu:
dd aEdit, tinypad
dd aCompile, fasm
dd 0
BmpMenu:
dd aView, mv
dd aEdit, animage
dd 0
GifMenu:
dd aView, gifview
dd aEdit, animage
dd 0
 
if lang eq en
aView db '&View',0
aCompile db '&Compile',0
aEdit db '&Edit',0
else
aView db '&à®á¬®âà',0
aCompile db '&Š®¬¯¨«¨à®¢ âì',0
aEdit db '&¥¤ ªâ®à',0
end if
 
fasm db '/rd/1/develop/fasm',0
animage db '/rd/1/animage',0
 
bConfirmDelete db 1
 
; ‡¤¥áì § ª ­ç¨¢ îâáï ª®­ä¨£ãà æ¨®­­ë¥ ¤ ­­ë¥
3646,7 → 4752,6
 
bWasE0 db 0
ctrlstate db 0
MemForImage dd 0
 
align 4
f8_confirm_dlgdata:
3697,6 → 4802,56
dd aCancel
.flags2 dd 0
 
; ¤¨ «®£ ª®¯¨à®¢ ­¨ï
copy_dlgdata:
dd 0
.x dd -1
.y dd -1
.width dd ?
.height dd 4
dd 4
dd 2
dd aCopyCaption
.main_color db ?
.border_color db ?
.header_color db ?
db 0
dd 0
dd 0
dd 4
; áâப  'Š®¯¨à®¢ âì "%s" ¢:'
dd 1
dd 1,0
.width2 dd ?
dd 0
dd CopySourceTextBuf
dd 0
; ¯®«¥ । ªâ¨à®¢ ­¨ï á ¨¬¥­¥¬ ä ©« /¯ ¯ª¨ ­ §­ ç¥­¨ï
dd 3
dd 1,1
.width3 dd ?
dd 1
dd CopyDestEditBuf
.flags0 dd 0
; ª­®¯ª  "ª®¯¨à®¢ âì"
.copy_btn:
dd 2
.copy_x1 dd ?
dd 3
.copy_x2 dd ?
dd 3
dd aCopy
.flags1 dd 18h
; ª­®¯ª  "®â¬¥­¨âì"
dd 2
.cnl_x1 dd ?
dd 3
.cnl_x2 dd ?
dd 3
dd aCancelB
.flags2 dd 8
 
 
if lang eq ru
aDeleteCaption db '“¤ «¥­¨¥',0
aConfirmDeleteText db '‚ë å®â¨â¥ 㤠«¨âì ',0
3707,6 → 4862,13
aDeleteLength = $ - aDelete - 1
aCancel db ' Žâ¬¥­¨âì ',0
aCancelLength = $ - aCancel - 1
aCancelB db '[ Žâ¬¥­¨âì ]',0
aCancelBLength = $ - aCancelB - 1
aCopyCaption db 'Š®¯¨à®¢ ­¨¥',0
aCopy db '[ Š®¯¨à®¢ âì ]',0
aCopyLength = $ - aCopy - 1
aCopy1 db 'Š®¯¨à®¢ âì "',0
aCopy2 db '" ¢:',0
else
aDeleteCaption db 'Delete',0
aConfirmDeleteText db 'Do you wish to delete ',0
3717,6 → 4879,13
aDeleteLength = $ - aDelete - 1
aCancel db ' Cancel ',0
aCancelLength = $ - aCancel - 1
aCancelB db '[ Cancel ]',0
aCancelBLength = $ - aCancelB - 1
aCopyCaption db 'Copy',0
aCopy db '[ Copy ]',0
aCopyLength = $ - aCopy - 1
aCopy1 db 'Copy "',0
aCopy2 db '" to:',0
end if
 
execinfo:
3770,7 → 4939,7
panel2_files dd ?
panel2_dir rb 1024
 
console_data rb max_width*max_height*2
;console_data rb max_width*max_height*2
 
cur_header rb max_width
tmp dd ?
3778,6 → 4947,13
skinh dd ?
std_colors rd 10
 
min_y dd ?
max_y dd ?
min_x dd ?
max_x dd ?
used_width dd ?
used_height dd ?
 
column_left dd ?
column_top dd ?
column_width dd ?
3789,6 → 4965,7
 
saved_file_name:
procinfo rb 1024
lower_file_name = procinfo + 512
 
driveinfo rb 32+304
tmpname rb 32
3799,13 → 4976,19
active_screen_data dd ?
 
aConfirmDeleteTextBuf rb aConfirmDeleteTextMax + 1
CopySourceTextBuf rb 512
CopyDestEditBuf rb 12+512+1
.length = $ - CopyDestEditBuf - 9
 
align 4
layout rb 128
 
copy_buffer_size = 32768
copy_buffer rb copy_buffer_size
 
; stack
align 4
rb 512
stacktop:
; buffers for directory - may be resized dynamically
buf1 rb 4*304 + 32 + 304*304
buf2 rb 4*304 + 32 + 304*304
 
mem: