/programs/other/outdated/mfar/trunk/build_en.bat |
---|
0,0 → 1,4 |
@echo lang fix en >lang.inc |
@fasm mfar.asm mfar |
@erase lang.inc |
@pause |
/programs/other/outdated/mfar/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@echo lang fix ru >lang.inc |
@fasm mfar.asm mfar |
@erase lang.inc |
@pause |
/programs/other/outdated/mfar/trunk/macros.inc |
---|
0,0 → 1,227 |
; new application structure |
macro meos_app_start |
{ |
use32 |
org 0x0 |
db 'MENUET01' |
dd 0x01 |
dd __start |
dd __end |
dd __memory |
dd __stack |
if used __params & ~defined __params |
dd __params |
else |
dd 0x0 |
end if |
dd 0x0 |
} |
MEOS_APP_START fix meos_app_start |
macro code |
{ |
__start: |
} |
CODE fix code |
macro data |
{ |
__data: |
} |
DATA fix data |
macro udata |
{ |
if used __params & ~defined __params |
__params: |
db 0 |
__end: |
rb 255 |
else |
__end: |
end if |
__udata: |
} |
UDATA fix udata |
macro meos_app_end |
{ |
align 32 |
rb 2048 |
__stack: |
__memory: |
} |
MEOS_APP_END fix meos_app_end |
; macro for defining multiline text data |
struc mstr [sstring] |
{ |
forward |
local ssize |
virtual at 0 |
db sstring |
ssize = $ |
end virtual |
dd ssize |
db sstring |
common |
dd -1 |
} |
; language for programs |
lang fix ru ; ru en fr ge fi |
; code profiling |
macro STARTTIMER |
{ |
push ecx |
push ebx |
rdtsc |
push edx |
push eax |
} |
macro STOPTIMER ;edx:eax = cpu cycles ellapsed |
{ |
rdtsc |
pop ebx |
pop ecx |
clc |
sbb eax,ebx |
sbb edx,ecx |
pop ebx |
pop ecx |
} |
; optimize the code for size |
macro add arg1,arg2 |
{ |
if arg1 in <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
if arg2 eqtype 0 |
if (arg2) = 1 |
inc arg1 |
else |
add arg1,arg2 |
end if |
else |
add arg1,arg2 |
end if |
else |
add arg1,arg2 |
end if |
} |
macro sub arg1,arg2 |
{ |
if arg2 eqtype 0 |
if (arg2) = 1 |
dec arg1 |
else |
sub arg1,arg2 |
end if |
else |
sub arg1,arg2 |
end if |
} |
macro mov arg1,arg2 |
{ |
if arg1 in <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
if arg2 eqtype 0 |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
xor arg1,arg1 |
inc arg1 |
else if (arg2) = -1 |
or arg1,-1 |
else if (arg2) > -128 & (arg2) < 128 |
push arg2 |
pop arg1 |
else |
mov arg1,arg2 |
end if |
else |
mov arg1,arg2 |
end if |
else |
mov arg1,arg2 |
end if |
} |
macro struct name |
{ |
virtual at 0 |
name name |
sizeof.#name = $ - name |
end virtual |
} |
; structures used in MeOS |
struc process_information |
{ |
.cpu_usage dd ? ; +0 |
.window_stack_position dw ? ; +4 |
.window_stack_value dw ? ; +6 |
.not_used1 dw ? ; +8 |
.process_name rb 12 ; +10 |
.memory_start dd ? ; +22 |
.used_memory dd ? ; +26 |
.PID dd ? ; +30 |
.x_start dd ? ; +34 |
.y_start dd ? ; +38 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
} |
struct process_information |
struc system_colors |
{ |
.frame dd ? |
.grab dd ? |
.grab_button dd ? |
.grab_button_text dd ? |
.grab_text dd ? |
.work dd ? |
.work_button dd ? |
.work_button_text dd ? |
.work_text dd ? |
.work_graph dd ? |
} |
struct system_colors |
; constants |
; events |
EV_IDLE = 0 |
EV_TIMER = 0 |
EV_REDRAW = 1 |
EV_KEY = 2 |
EV_BUTTON = 3 |
EV_EXIT = 4 |
EV_BACKGROUND = 5 |
EV_MOUSE = 6 |
EV_IPC = 7 |
EV_STACK = 8 |
; event mask bits for function 40 |
EVM_REDRAW = 1b |
EVM_KEY = 10b |
EVM_BUTTON = 100b |
EVM_EXIT = 1000b |
EVM_BACKGROUND = 10000b |
EVM_MOUSE = 100000b |
EVM_IPC = 1000000b |
EVM_STACK = 10000000b |
/programs/other/outdated/mfar/trunk/menuet.inc |
---|
0,0 → 1,181 |
;------------------------------------------------------------------------------ |
;///// SYSTEM FUNCTIONS /////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
MF_TERMINATE = -1 |
MF_DEFWINDOW = 0 |
WS_GRADIENT = $80000000 |
WS_NOSIZE = $00000000 |
WS_TRANSP = $01000000 |
WS_NORMAL = $02000000 |
WS_SKINNED = $03000000 |
MF_PUTPIXEL = 1 |
MF_GETKEY = 2 |
MF_GETTIME = 3 |
MF_DRAWTEXT = 4 |
DT_FIXED = $00000000 |
DT_VARIABLE = $10000000 |
MF_DELAY = 5 |
MF_RDREADFILE = 6 |
MF_PUTIMAGE = 7 |
MF_DEFBUTTON = 8 |
DB_ADD = $00000000 |
DB_DELETE = $80000000 |
BS_HIDDEN = $40000000 |
MF_PRINFO = 9 |
PI_SELF = $FFFFFFFF |
MF_WAITEVENT = 10 |
MF_CHKEVENT = 11 |
MF_WNDDRAW = 12 |
WD_BEGINDRAW = 1 |
WD_ENDDRAW = 2 |
MF_FILLRECT = 13 |
FR_GRADIENT = $80000000 |
MF_GETSCRDIM = 14 |
MF_SETBKGND = 15 |
BG_SETSIZE = 1 |
BG_PUTPIXEL = 2 |
BG_REDRAW = 3 |
BG_SETSTYLE = 4 |
BGS_TILE = 1 |
BGS_STRETCH = 2 |
BG_SETIMAGE = 5 |
MF_RAM2FLOP = 16 |
R2F_ALL = 1 |
MF_GETPRSDBTNID = 17 |
MF_SYSSERV = 18 |
SYS_QUIT = 1 |
SYS_KILLPR = 2 |
SYS_SETFOCUS = 3 |
SYS_GETIDLE = 4 |
SYS_SETSPEED = 5 |
SYS_RAM2HARD = 6 |
MF_STARTPRG = 19 |
MF_MIDI = 20 |
MIDI_RESET = 1 |
MIDI_OUTPUT = 2 |
MF_DEVSETUP = 21 |
DEV_MIDI = 1 |
DEV_KEYB = 2 |
DEV_CD = 3 |
DEV_SB16 = 4 |
DEV_LANG = 5 |
DEV_WSS = 6 |
DEV_HD = 7 |
DEV_HDPART = 8 |
DEV_DMA = 10 |
DEV_LOWHDACC = 11 |
DEV_PCIACC = 12 |
DEV_VIDEODRV = 13 |
MF_WAITEVWTO = 23 |
MF_CDAUDIO = 24 |
CDA_PLAY = 1 |
CDA_GETPLIST = 2 |
CDA_STOP = 3 |
MF_SB16M1 = 25 |
SB_SETMAINVOL = 1 |
SB_SETCDVOL = 2 |
MF_GETDEVPREF = 26 |
DEV_GETTICKS = 9 |
MF_SOUNDPROPS = 27 |
MF_SB16M2 = 28 |
MF_GETDATE = 29 |
MF_HDREADFILE = 30 |
MF_HDSTARTPRG = 31 |
MF_RDDELFILE = 32 |
MF_RDWRITEFILE = 33 |
MF_RDREADDIR = 34 |
MF_GETPIXEL = 35 |
MF_MOUSEINFO = 37 |
MI_SCREENCRD = 0 |
MI_CLIENTCRD = 1 |
MI_BUTTONS = 2 |
MB_NONE = 0 |
MB_LEFT = 1 |
MB_RIGHT = 2 |
MB_BOTH = 3 |
MF_DRAWLINE = 38 |
MF_GETBKGND = 39 |
GB_SIZE = 1 |
GB_PIXEL = 2 |
GB_STYLE = 4 |
MF_SETEVMASK = 40 |
MF_GETIRQOWNER = 41 |
MF_GETIRQDATA = 42 |
MF_PORTIO = 43 |
MF_SETIRQTABLE = 44 |
MF_MANAGEIRQS = 45 |
IRQ_RESERVE = 0 |
IRQ_RELEASE = 1 |
MF_MANAGEPORTS = 46 |
PORT_RESERVE = 0 |
PORT_RELEASE = 1 |
MF_DRAWNUMBER = 47 |
DN_NUMBER = $00000000 |
DN_POINTER = $00000001 |
DN_DEC = $00000000 |
DN_HEX = $00000100 |
DN_BIN = $00000200 |
MF_WINPROPS = 48 |
WP_REDRAW = 0 |
WPR_DESKTOP = 0 |
WP_SETBTNSTYLE = 1 |
BS_FLAT = 0 |
BS_3D = 1 |
WP_SETSYSCLRS = 2 |
WP_GETSYSCLRS = 3 |
WP_GETSKINH = 4 |
MF_WINFREEFORM = 50 |
FF_SETSHAPE = 0 |
FF_SETSCALE = 1 |
MF_THREAD = 51 |
TH_CREATE = 1 |
MF_STACK = 52 |
MF_SOCKET = 53 |
MF_SOUND = 55 |
SND_LOADBLOCK = 0 |
SND_PLAYBLOCK = 1 |
SND_SETFORMAT = 2 |
SF_SETLENGTH = 1 |
;MF_HDWRITEFILE = 56 |
;MF_HDDELFILE = 57 |
MF_FSACCESS = 70 |
FS_READ = 999999 |
FS_READ_FILE = 0 |
FS_READ_FOLDER = 1 |
FS_WRITE_FILE = 2 |
FS_APPEND = 3 |
FS_EXECUTE = 7 |
FS_DELETE = 8 |
FS_CREATE_FOL = 9 |
MF_SYSTRACE = 59 |
ST_GETEVENTS = 0 |
MF_IPC = 60 |
IPC_SETAREA = 1 |
IPC_SENDMSG = 2 |
MF_GRAPHPROPS = 61 |
GP_PERMIT = 1 |
GP_GETBPP = 2 |
GP_GETBPS = 3 |
MF_PCI = 62 |
MF_DEBUGBRD = 63 |
DBG_WRITE = 1 |
DBG_READ = 2 |
MF_MEMRESIZE = 64 |
MR_SETSIZE = 1 |
MF_UTF = 65 |
MF_KEYBMODE = 66 |
KM_SETMODE = 1 |
KM_GETMODE = 2 |
;------------------------------------------------------------------------------ |
;///// ERROR CODES //////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
ERR_SUCCESS = 0 |
ERR_FS_FIRST = 1 |
ERR_FS_LAST = 6 |
ERR_IRQ_NODATA = 1 |
ERR_IRQ_BADOWNER = 2 |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/outdated/mfar/trunk/mf-copy.inc |
---|
0,0 → 1,204 |
;------------------------------------------------------------------------------ |
;///// COPYING //////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
func copy_file |
pushad |
cmp [active_panel],0 |
jne ._00 |
push f_path0 |
push [f_plen0] |
mov eax,[d_lpos] |
shl eax,4 |
add eax,lstart |
push eax |
mov esi,f_path1 |
mov eax,[f_plen1] |
jmp @f |
._00: |
push f_path1 |
push [f_plen1] |
mov eax,[d_rpos] |
shl eax,4 |
add eax,rstart |
push eax |
mov esi,f_path0 |
mov eax,[f_plen0] |
@@: |
mov ebx,[esp] |
test byte[ebx+11],FA_FOLDER |
jz @f |
add esp,3*4 |
stc |
jmp .close |
@@: |
mov edi,fc_info.path |
call get_normal_path |
mov eax,[len] |
mov byte[edi+eax-1],'/' |
mov [fc_len2],eax |
pop esi |
call get_file_info |
mov eax,[f_size] |
mov [fc_size],eax |
pop eax |
pop esi |
mov edi,f_info.path |
call get_normal_path |
mov eax,[len] |
mov byte[edi+eax-1],'/' |
mov [fc_len1],eax |
jmp .redraw_copy |
.redraw: |
call draw_window_full |
.redraw_copy: |
call draw_window_copy_main |
.still: |
mcall MF_WAITEVENT |
jmpe al,.still,\ |
EV_REDRAW,.redraw,\ |
EV_KEY,.key,\ |
EV_BUTTON,.button |
.key: |
mcall MF_GETKEY |
jmpe ah,.still,\ |
VK_ESCAPE,._close,\ |
VK_RETURN,.copy |
.button: |
jmp .still |
.copy: |
mov ecx,[fc_size] |
shr ecx,9 |
inc ecx |
push ecx |
shl ecx,9 |
add ecx,MEM_USED |
mcall MF_MEMRESIZE,MR_SETSIZE |
or eax,eax |
jnz .close |
mov edi,file_info |
mov al,' ' |
mov ecx,13 |
repne scasb |
sub ecx,12 |
neg ecx |
push ecx |
mov esi,file_info |
mov edi,f_info.path |
add edi,[fc_len1] |
rep movsb |
mov byte[edi],0 |
pop ecx |
mov esi,file_info |
mov edi,fc_info.path |
add edi,[fc_len2] |
rep movsb |
mov byte[edi],0 |
xor eax,eax ; FS_READ |
mov [f_info],eax |
mov [f_info+4],eax |
pop eax |
mov [f_info+8],eax |
mov dword[f_info+12],MEM_USED |
mcall MF_FSACCESS,f_info |
mov eax,[fc_size] |
mov [fc_info+8],eax |
mcall MF_FSACCESS,fc_info |
mcall MF_MEMRESIZE,MR_SETSIZE,MEM_USED |
._close: |
clc |
.close: |
popad |
ret |
endf |
;------------------------------------------------------------------------------ |
func draw_window_copy_main |
mcall2 MF_FILLRECT,oX+tW*2,tW*76,oY+tH*7,tH*8,0x00C0C0C0 |
mmov esi,oX+tW*4+2,oX+tW*75+3 |
mmov edi,oY+tH*8+3,oY+tH*13+5 |
xor edx,edx |
call draw_frame |
mmov esi,oX+tW*4+4,oX+tW*75+1 |
mmov edi,oY+tH*8+5,oY+tH*13+3 |
call draw_frame |
mcall2 MF_DRAWLINE,oX+tW*4+4,oX+tW*75+1,oY+tH*11+3,oY+tH*11+3,0 |
mcall2 MF_FILLRECT,oX+tW*40-(sz_copy.size-2)*tW/2-tW,sz_copy.size*tW,\ |
oY+tH*8+3,3,0x00C0C0C0 |
mcall1 MF_DRAWTEXT,oX+tW*40-(sz_copy.size-2)*tW/2,oY+tH*8,\ |
0x00000000,sz_copy,sz_copy.size-2 |
mcall1 ,oX+tW*6,oY+tH*9,,,sz_copy.size |
mov edi,file_info |
mov al,' ' |
mov ecx,13 |
repne scasb |
madd ebx,(sz_copy.size)*tW,0 |
mov esi,ecx |
sub esi,12 |
neg esi |
mcall MF_DRAWTEXT,,,file_info |
imul esi,tW |
shl esi,16 |
add ebx,esi |
mcall ,,,sz_copyto,sz_copyto.size |
call draw_copy_input |
ret |
endf |
;------------------------------------------------------------------------------ |
func draw_copy_input |
mcall2 MF_FILLRECT,oX+tW*6,tW*68,oY+tH*10,tH,0x00008080 |
mov edx,fc_info.path |
mov esi,[fc_len2] |
cmp esi,68 |
jb @f |
sub esi,68 |
lea edx,[edx+esi+1] |
mov esi,67 |
@@: |
mcall1 MF_DRAWTEXT,oX+tW*6,oY+tH*10+1,0x00000000 |
ret |
endf |
;------------------------------------------------------------------------------ |
;fc_pst db 0 |
;fc_cur db 0 |
align 4 |
fc_size dd ? |
fc_len1 dd 0 |
fc_len2 dd 0 |
fc_info: |
dd 1 |
dd 0 |
dd ? |
dd MEM_USED |
dd MEM_FOR_OS |
.path: |
rb 200 |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/outdated/mfar/trunk/mf-sort.inc |
---|
0,0 → 1,140 |
;------------------------------------------------------------------------------ |
;///// SORTING //////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
r_sort db 1 |
l_sort db 1 |
align 4 |
compare_table: |
dd compare_by_name |
dd compare_by_extension |
; AL = panel |
func mfar_sort |
pusha |
cmp al,0 |
jne ._00 |
mov eax,[d_lcnt] |
mov edi,lstart |
movzx edx,[l_sort] |
jmp @f |
._00: |
mov eax,[d_rcnt] |
mov edi,rstart |
movzx edx,[r_sort] |
@@: |
mov edx,[edx*4+compare_table] |
cmp eax,2 |
jbe .exit |
dec eax |
shl eax,4 |
add eax,edi |
cmp word[edi],'..' |
jne @f |
add edi,16 |
@@: |
push edi |
mov esi,edi |
add edi,16 |
.next_file: |
call edx |
add edi,16 |
cmp edi,eax |
jbe .next_file |
mov ebx,12 |
@@: |
mov ecx,[ebx+eax] |
xchg [ebx+esi],ecx |
mov [ebx+eax],ecx |
sub ebx,4 |
jge @b |
mov esi,[esp] |
mov edi,esi |
add edi,16 |
sub eax,16 |
cmp eax,edi |
jge .next_file |
pop edi |
.exit: |
popad |
ret |
endf |
;------------------------------------------------------------------------------ |
; ESI = pointer to 1st file info |
; EDI = pointer to 2nd file info |
func compare_by_name |
mov ecx,11 |
push edi esi |
repe cmpsb |
pop esi edi |
pushfd |
test byte[esi+11],FA_FOLDER |
jnz ._00 |
test byte[edi+11],FA_FOLDER |
jz ._01 |
jmp ._03 |
._00: |
test byte[edi+11],FA_FOLDER |
jz ._02 |
._01: |
popfd |
jg ._04 |
mov esi,edi |
ret |
._02: |
popfd |
mov esi,edi |
ret |
._03: |
popfd |
._04: |
ret |
endf |
;------------------------------------------------------------------------------ |
; ESI = pointer to 1st file info |
; EDI = pointer to 2nd file info |
func compare_by_extension |
push edi esi |
mov ecx,3 |
add esi,8 |
add edi,8 |
repe cmpsb |
jne ._00 |
mov esi,[esp] |
mov edi,[esp+4] |
mov ecx,8 |
repe cmpsb |
._00: |
pop esi edi |
pushfd |
test byte[esi+11],FA_FOLDER |
jnz ._01 |
test byte[edi+11],FA_FOLDER |
jz ._02 |
jmp ._04 |
._01: |
test byte[edi+11],FA_FOLDER |
jz ._03 |
._02: |
popfd |
jg ._05 |
mov esi,edi |
ret |
._03: |
popfd |
mov esi,edi |
ret |
._04: |
popfd |
._05: |
ret |
endf |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/outdated/mfar/trunk/mfar.asm |
---|
0,0 → 1,1180 |
; MENUET FAR [MFAR] PRE-ALPHA-8.1 |
; 2003-2004 (C) Mike Semenyako aka mike.dld |
; Compile with FASM for Menuet |
use32 |
org 0 |
db 'MENUET01' ; 8 byte id |
dd $01 ; header version |
dd START ; start of code |
dd I_END ; size of image |
dd MEM_USED ; memory for app |
dd $007FF0 ; esp |
dd $00,$00 ; I_Param , I_Icon |
; |
; START:SIZE |
; |
; +00000000:00007FF0 - image |
; +00007FF0:00007FF0 - stack |
; +00008000:00000300 - path strings buffer |
; +00008300:0003FD00 - files data |
; +00048000:00000300 - temporary file read area |
; +00048300:00004000 - memory for OS (read/write buffer) |
; +0004C300:FFFB3CFF - dinamically allocated for copy, view, edit etc. |
; |
include 'macros.inc' |
include 'menuet.inc' |
include 'mfar.inc' |
START: |
mcall MF_RDREADFILE,fcfile,0,-1,fc ; read user colors |
mov esi,p_rd ; left panel = RD |
mov edi,f_path0 |
mov ecx,p_rd.size |
rep movsb |
mov esi,p_hd ; right panel = HD |
mov edi,f_path1 |
mov ecx,p_hd.size |
rep movsb |
redraw_all: |
call draw_window_full |
jmp still |
redraw_files: |
call draw_files |
still: |