/programs/filemngrs/rdfdel/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/filemngrs/rdfdel/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/filemngrs/rdfdel/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/rdfdel/trunk/rdfdel.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/hexhd/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/filemngrs/hexhd/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/filemngrs/hexhd/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/hexhd/trunk/hexhd.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/mfar/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/filemngrs/mfar/trunk/readme.txt |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/mfar/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/mfar/trunk/mfar.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/mfar/trunk/mf-sort.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/mfar/trunk/mf-copy.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/mfar/trunk/mfar.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/mfar/trunk/menuet.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/mfar/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/filemngrs/mfar/trunk/mf-lang.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/sysxtree/trunk/sysxtree.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/sysxtree/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/filemngrs/sysxtree/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/filemngrs/sysxtree/trunk/ascl.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/sysxtree/trunk/SYSTR12.GIF |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/filemngrs/sysxtree/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/sysxtree/trunk/ascgl.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/copy2/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/filemngrs/copy2/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/filemngrs/copy2/trunk/copy2.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/copy2/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/copyr/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/filemngrs/copyr/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/filemngrs/copyr/trunk/ascl.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/copyr/trunk/copyr.asm |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/filemngrs/copyr/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/develop/mhc/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/develop/mhc/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/develop/mhc/trunk/mhc.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/develop/mhc/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/develop/archer/trunk/sys.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/develop/archer/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/develop/archer/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/develop/archer/trunk/deflate.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/develop/archer/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/develop/archer/trunk/debug.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/develop/archer/trunk/arcmacro.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/develop/archer/trunk/data.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/develop/archer/trunk/archer.txt |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/develop/archer/trunk/@RCHER.ASM |
---|
File deleted |
/programs/develop/archer/trunk/parser.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/fs/copy2/trunk/copy2.asm |
---|
0,0 → 1,427 |
; project name: SYSTREE FILE COPIER |
; version: 1.1b |
; last update: 18/07/2004 |
; compiler: FASM 1.52 |
; written by: Ivan Poddubny |
; e-mail: ivan-yar@bk.ru |
; copying-policy: GPL |
; History: |
; 18/07/2004 strings using "lsz" macro + french language (not 100%!) |
; 04/06/2004 Bugfix for memory - thanks to Ville |
; ... |
use32 |
org 0x0 |
db 'MENUET01' ; 8 byte id |
dd 0x01 ; header version |
dd START ; start of code |
dd I_END ; size of image |
dd 0x20201 ; memory for app |
dd 0x10000 ; esp |
dd 0x0 , 0x0 ; I_Param , I_Icon |
include 'lang.inc' |
include 'macros.inc' ; very useful stuff for MeOS |
STRLEN = 48 ; maximal length of filename |
START: ; start of execution |
red: |
call draw_window ; at first, draw the window |
still: ; main cycle of application begins here |
mov eax,10 ; wait here for event |
int 0x40 |
dec eax ; redraw request ? |
jz red |
dec eax ; key in buffer ? |
jz key |
dec eax ; button in buffer ? |
jz button |
jmp still |
key: ; key event handler |
mov eax,2 ; just read it and ignore |
int 0x40 |
jmp still ; return to main loop |
button: ; button |
mov eax,17 ; get id |
int 0x40 |
cmp ah,1 ; button id=1 ? (close_btn) |
jz close |
cmp ah,2 ; copy ? |
je copy_file |
; read_string: |
cmp ah,5 ; user pressed dest button ? |
jz dstbtn |
cmp ah,4 ; user pressed src button ? |
jnz still |
srcbtn: |
mov [addr],dword source |
mov [ya],dword 36 |
jmp rk |
dstbtn: |
mov [addr],dword destination |
mov [ya],dword 36+16 |
rk: |
mov edi,[addr] ; load the address of the string |
mov al,0 ; the symbol we will search for |
mov ecx,STRLEN+1 ; length of the string (+1) |
cld ; search forward |
repne scasb ; do search now |
inc ecx ; we've found a zero or ecx became 0 |
mov eax,STRLEN+1 |
sub eax,ecx ; eax = address of <0> character |
mov [temp],eax ; position |
call print_text |
mov edi,[addr] ; address of string |
add edi,[temp] ; cursor position |
.waitev: |
mov eax,10 |
int 0x40 |
cmp eax,2 |
jnz still |
; mov eax,2 |
int 0x40 |
shr eax,8 |
cmp eax,8 |
jnz .nobs ; BACKSPACE |
cmp edi,[addr] |
jz .waitev |
dec edi |
mov [edi],byte 0 |
call print_text |
jmp .waitev |
.nobs: |
cmp eax,13 ; ENTER |
je still |
cmp eax,192 |
jne .noclear |
xor al,al |
mov edi,[addr] |
mov ecx,STRLEN |
rep stosb |
mov edi,[addr] |
call print_text |
jmp .waitev |
.noclear: |
mov [edi],al |
call print_text |
inc edi |
mov esi,[addr] |
add esi,STRLEN |
cmp esi,edi |
jnz .waitev |
jmp still |
close: |
or eax,-1 ; close program |
int 0x40 |
;==================================================== |
; copy_file |
; This piece of code copies src file to dst file, |
; then it pass the control to copy_error routine, |
; which returns to the main cycle of the app. |
; It's NOT a function! It's reached by direct jump |
; from the button handler. |
;==================================================== |
copy_file: |
; at first we must get the size of the source file |
mov [source_info.blocks],1 ; load only 512 bytes |
mov eax,58 |
mov ebx,source_info |
int 0x40 |
; now eax contains error code |
; and ebx contains file size in bytes |
test eax,eax ; check if eax is equal to zero (success) |
je .ok_getsize ; eax = 0 => continue |
cmp eax,6 |
jna @f |
mov eax,7 ; if error code is above 6, it will be 7 |
@@: |
cmp eax,5 ; file might be copied successfully altrough |
; the system reports an error 5 |
jne copy_error ; print error code now |
.ok_getsize: |
; allocate memory |
push ebx ; save file size |
mov ecx,ebx |
add ecx,0x20000 ; size of memory needed = 0x20000+filesize |
mov eax,64 ; func 64 |
mov ebx,1 ; resize application memory |
int 0x40 |
pop ebx ; restore filesize |
; check if alloc function failed |
test eax,eax ; non-zero value means error |
je .ok_memory |
mov eax,5 ; error 5 - out of memory |
jmp copy_error ; print error code now |
.ok_memory: |
; save number of blocks to source_info |
add ebx,511 |
shr ebx,9 ; round up to 512 boundary |
mov [source_info.blocks],ebx |
; read the source file |
mov eax,58 |
mov ebx,source_info |
int 0x40 |
; ebx = file size |
; save loaded file |
mov [dest_info.bytes2write],ebx ; file size in bytes |
mov eax,58 |
mov ebx,dest_info |
int 0x40 |
; check if 58 function failed |
test eax,eax |
je .ok_write |
add eax,7 ; error number += 7 |
cmp eax,6+7 |
jna copy_error |
mov eax,7+7 |
jmp copy_error |
.ok_write: |
; return to the initial amount of memory |
mov eax,64 |
mov ebx,1 |
mov ecx,0x20201 |
int 0x40 |
xor eax,eax ; eax = message number (0-OK) |
; print message now |
copy_error: |
mov edi,eax |
mov eax,4 |
mov ebx,20*65536+83 |
mov ecx,0x10ff0000 |
mov edx,[errors+edi*8] |
mov esi,[errors+edi*8+4] |
int 0x40 |
jmp still |
; print strings (source & destination) |
print_text: |
mov eax,13 |
mov ebx,107*65536+STRLEN*6 |
mov ecx,[ya] |
shl ecx,16 |
add ecx,9 |
mov edx,0xf2f2f2 |
int 0x40 |
mov eax,4 |
mov ebx,109*65536 |
add ebx,[ya] |
xor ecx,ecx |
mov edx,[addr] |
mov esi,STRLEN |
int 0x40 |
ret |
; ********************************************* |
; ******* WINDOW DEFINITIONS AND DRAW ******** |
; ********************************************* |
draw_window: |
mov eax, 12 ; function 12:tell os about windowdraw |
mov ebx, 1 ; 1, start of draw |
int 0x40 |
; DRAW WINDOW |
xor eax, eax ; function 0 : define and draw window |
mov ebx, 160*65536+415 ; [x start] *65536 + [x size] |
mov ecx, 160*65536+100 ; [y start] *65536 + [y size] |
mov edx, 0x03DDDDDD ; color of work area RRGGBB |
int 0x40 |
; WINDOW LABEL |
mov eax, 4 ; function 4 : write text to window |
mov ebx, 8*65536+8 ; [x start] *65536 + [y start] |
mov ecx, 0x10ffffff ; color of text RRGGBB |
mov edx, header ; pointer to text beginning |
mov esi, header.size ; text length |
int 0x40 |
mov eax, 8 ; COPY BUTTON |
mov ebx, 20*65536+375 |
mov ecx, 63*65536+16 |
mov edx, 2 |
mov esi, 0xCCCCCC |
int 0x40 |
mov ebx, 105*65536+290 |
mov ecx, 33*65536+12 |
mov edx, 4 |
mov esi, 0xEBEBEB |
int 0x40 |
mov ebx, 105*65536+290 |
mov ecx, 49*65536+12 |
mov edx, 5 |
mov esi, 0xEBEBEB |
int 0x40 |
mov esi, source |
mov edi, text+14 |
mov ecx, STRLEN |
rep movsb |
mov esi, destination |
mov edi, text+STRLEN+59-45+14 |
mov ecx, STRLEN |
rep movsb |
mov ebx, 25*65536+36 ; print filenames |
xor ecx, ecx |
mov edx, text |
mov esi, STRLEN+59-45 |
newline: |
mov eax, 4 |
int 0x40 |
add ebx, 16 |
add edx, STRLEN+59-45 |
cmp [edx], byte 'x' |
jnz newline |
mov eax, 12 ; function 12:tell os about windowdraw |
mov ebx, 2 ; 2, end of draw |
int 0x40 |
ret |
; DATA AREA |
align 4 |
source_info: ; SOURCE FILEINFO |
.mode dd 0 ; read file |
.start_block dd 0x0 ; block to read |
.blocks dd 0x700 ; num of blocks |
.address dd 0x20000 |
.workarea dd 0x10000 |
source db '/HD/1/KERNEL/KERNEL.MNT',0 |
times (STRLEN-23) db 0 |
dest_info: ; DESTINATION FILEINFO |
.mode dd 1 ; write |
.notused dd 0x0 ; not used |
.bytes2write dd 0 ; bytes to write |
.address dd 0x20000 |
.workarea dd 0x10000 |
destination db '/RD/1/KERNEL.MNT',0 |
times (STRLEN-16) db 0 |
align 4 |
addr dd 0x0 |
ya dd 0x0 |
temp dd 0 |
lsz text,\ |
ru, ' : | ®áá¨ï, à®á« ¢«ì ',\ |
ru, ' : | ®¤¤ã¡ë© ¢ , ivan-yar@bk.ru ',\ |
ru, ' ',\ |
ru, 'x',\ ; <- END MARKER, DONT DELETE |
\ |
en, 'SOURCE: | Russia, Yaroslavl ',\ |
en, 'DESTINATION: | Poddubny Ivan, ivan-yar@bk.ru ',\ |
en, ' COPY SOURCE -> DESTINATION ',\ |
en, 'x',\ ; <- END MARKER, DONT DELETE |
\ |
fr, 'SOURCE: | ',\ |
fr, 'DESTINATION: | ',\ |
fr, ' COPIER ',\ |
fr, 'x' |
lsz header,\ |
ru, ' ',\ |
en, 'SYSTREE FILE COPIER',\ |
fr, 'COPIER LE FICHIER' |
; This macro is used to define a string table in format <pointer;length> |
macro strtbl name,[string] |
{ |
common |
label name dword |
forward |
local str,size |
dd str,size |
forward |
str db string |
size = $ - str |
} |
if lang eq ru |
strtbl errors,\ |
"ä ©« ᪮¯¨à®¢ ãᯥè®",\ |
"(ç⥨¥) ¥ § ¤ ¡ § ¦¤",\ |
"(ç⥨¥) ä ©«®¢ ï á¨á⥬ ¥ ¯®¤¤¥à¦¨¢ ¥âáï",\ |
"(ç⥨¥) ¥¨§¢¥áâ ï ä ©«®¢ ï á¨á⥬ ",\ |
"(ç⥨¥) ¥ § ¤ à §¤¥« ¦¤",\ |
"¥¤®áâ â®ç® ¯ ¬ïâ¨",\ |
"(ç⥨¥) ª®¥æ ä ©« ",\ |
"(ç⥨¥) ¥¨§¢¥áâ ï ®è¨¡ª ",\ |
"(§ ¯¨áì) ¥ § ¤ à §¤¥« ¦¤",\ |
"(§ ¯¨áì) ä ©«®¢ ï á¨á⥬ ¥ ¯®¤¤¥à¦¨¢ ¥âáï",\ |
"(§ ¯¨áì) ¥¨§¢¥áâ ï ä ©«®¢ ï á¨á⥬ ",\ |
"(§ ¯¨áì) ¥ § ¤ à §¤¥« ¦¤",\ |
"?",\ |
"(§ ¯¨áì) ä ©« ¥ ©¤¥",\ |
"(§ ¯¨áì) ¥¨§¢¥áâ ï ®è¨¡ª " |
else |
strtbl errors,\ |
"Success!",\ |
"(read) no hd base or partition defined",\ |
"(read) unsupported file system",\ |
"(read) unknown file system",\ |
"(read) hd partition not defined",\ |
"out of memory",\ |
"(read) end of file",\ |
"(read) unknown error",\ |
"(write) no hd base or partition defined",\ |
"(write) unsupported file system",\ |
"(write) unknown file system",\ |
"(write) hd partition not defined",\ |
"?",\ |
"(write) end of file",\ |
"(write) unknown error" |
end if |
I_END: |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/copy2/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm copy2.asm copy2 |
@pause |
/programs/fs/copy2/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm copy2.asm copy2 |
@pause |
/programs/fs/copy2/trunk/macros.inc |
---|
0,0 → 1,266 |
; 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 |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b eq) |
mov reg,a |
end if |
} |
macro mcall a,b,c,d,e,f { ; mike.dld |
__mov eax,a |
__mov ebx,b |
__mov ecx,c |
__mov edx,d |
__mov esi,e |
__mov edi,f |
int 0x40 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
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 __regs) & (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 |
} |
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 |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/copyr/trunk/ascl.inc |
---|
0,0 → 1,835 |
lang equ ru ; ru en fr ge fi |
; |
; Assembler |
; SMALL |
; CODE |
; Libary |
; |
; Ver 0.14 By Pavlushin Evgeni (RUSSIA) |
; www.waptap@mail.ru |
;Please compile aplications on FASM ver1.54 or higer!!! |
;InfoList |
;0.01 scank,putpix,puttxt |
;0.02 label,random,colors |
;0.03 window,startwd,endwd,attributes |
;0.04 close,delay,scevent ~30.04.2004 |
;0.05 small random, ~04.05.2004 |
;0.06 wtevent ~09.05.2004 |
;0.07 timeevent ~23.05.2004 |
;0.08 txtput ~14.06.2004 |
;0.09 opendialog,savedialog ~20.06.2004 |
;0.10 wordstoreg by halyavin, add at ~30.08.2004 |
; random bug deleted eax is use. |
;0.11 loadfile from me +puttxt bug del ~07.09.2004 |
;0.12 open/save dialog ~13.09.2004 |
;0.13 dialogs bugs deleted |
;0.14 drawlbut ~03.10.2004 |
; LOADFILE |
; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area |
; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area |
macro loadfile file_name,file_load_area,file_temp_area |
{ |
local open,fileinfo,string |
jmp open |
fileinfo: |
dd 0 |
dd 0 |
dd 1 |
dd file_load_area |
dd file_temp_area |
string: |
db file_name,0 |
open: |
mov dword [fileinfo+8],1 ; how many blocks to read (1) |
mov eax,58 |
mov ebx,fileinfo |
int 0x40 |
mov eax,[file_load_area+2] |
shr eax,9 ; ¯®¤¥«¨¬ 512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢ |
inc eax |
mov dword [fileinfo+8],eax |
mov eax,58 |
mov ebx,fileinfo |
int 0x40 |
} |
macro wordstoreg reg,hiword,loword |
{ |
if hiword eqtype 0 & loword eqtype 0 |
mov reg,hiword*65536+loword |
else if hiword eqtype 12 & loword eqtype eax |
mov reg,hiword*65536 |
add reg,loword |
else if hiword eqtype 12 & loword eqtype [123] |
mov reg,hiword*65536 |
add reg,loword |
else |
mov reg,hiword |
shl reg,16 |
add reg,loword |
end if |
} |
; DRAW BUTTON with label |
macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor |
{ |
local asd,lab |
jmp asd |
lab db text ;arg label |
asd: |
wordstoreg ebx,x,xs |
wordstoreg ecx,y,ys |
mov edx,id |
mov esi,bcolor |
mov eax,8 |
int 0x40 |
mov eax,asd-lab ;calc size |
mov ebx,6 |
mul ebx |
mov esi,eax |
mov eax,xs |
sub eax,esi |
shr eax,1 |
add eax,x |
mov edx,ys |
sub edx,7 |
shr edx,1 |
add edx,y |
mov ebx,eax |
shl ebx,16 |
add ebx,edx |
mov ecx,tcolor ;arg4 color |
mov edx,lab |
mov esi,asd-lab ;calc size |
mov eax,4 |
int 0x40 |
} |
macro opendialog redproc,openoff,erroff,path |
{ |
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc |
local run_fileinfo, param |
local getmesloop, loox, mred, mkey, mbutton, mgetmes |
local dlg_is_work, ready, procinfo |
; |
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
; |
cld |
;; mov esi,path |
mov edi,path |
mov eax,0 |
mov ecx,200 |
rep stosb |
;mov [get_loops],0 |
mov [dlg_pid_get],0 |
; Get my PID in dec format 4 bytes |
mov eax,9 |
mov ebx,procinfo |
mov ecx,-1 |
int 0x40 |
; convert eax bin to param dec |
mov eax,dword [procinfo+30] ;offset of myPID |
mov edi,param+4-1 ;offset to 4 bytes |
mov ecx,4 |
mov ebx,10 |
cld |
new_d: |
xor edx,edx |
div ebx |
add dl,'0' |
mov [edi],dl |
dec edi |
loop new_d |
; wirite 1 byte space to param |
mov [param+4],byte 32 ;Space for next parametr |
; and 1 byte type of dialog to param |
mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) |
; |
; STEP2 prepare IPC area for get messages |
; |
; prepare IPC area |
mov [path],dword 0 |
mov [path+4],dword 8 |
; define IPC memory |
mov eax,60 |
mov ebx,1 ; define IPC |
mov ecx,path ; offset of area |
mov edx,150 ; size 150 bytes |
int 0x40 |
; change wanted events list 7-bit IPC event |
mov eax,40 |
mov ebx,01000111b |
int 0x40 |
; |
; STEP 3 run SYSTEM XTREE with parameters |
; |
mov eax,58 |
mov ebx,run_fileinfo |
int 0x40 |
call redproc |
mov [get_loops],0 |
getmesloop: |
mov eax,23 |
mov ebx,50 ;0.5 sec |
int 0x40 |
cmp eax,1 |
je mred |
cmp eax,2 |
je mkey |
cmp eax,3 |
je mbutton |
cmp eax,7 |
je mgetmes |
; Get number of procces |
mov ebx,procinfo |
mov ecx,-1 |
mov eax,9 |
int 0x40 |
mov ebp,eax |
loox: |
mov eax,9 |
mov ebx,procinfo |
mov ecx,ebp |
int 0x40 |
mov eax,[DLGPID] |
cmp [procinfo+30],eax ;IF Dialog find |
je dlg_is_work ;jmp to dlg_is_work |
dec ebp |
jnz loox |
jmp erroff |
dlg_is_work: |
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated |
je erroff ;TESTODP2 terminated too |
cmp [dlg_pid_get],dword 1 |
je getmesloop |
inc [get_loops] |
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
jae erroff |
jmp getmesloop |
mred: |
call redproc |
jmp getmesloop |
mkey: |
mov eax,2 |
int 0x40 ; read (eax=2) |
jmp getmesloop |
mbutton: |
mov eax,17 ; get id |
int 0x40 |
cmp ah,1 ; button id=1 ? |
jne getmesloop |
mov eax,-1 ; close this program |
int 0x40 |
mgetmes: |
; If dlg_pid_get then second message get jmp to still |
cmp [dlg_pid_get],dword 1 |
je ready |
; First message is number of PID SYSXTREE dialog |
; convert PID dec to PID bin |
movzx eax,byte [path+16] |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+1] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+2] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+3] |
add eax,ebx |
sub eax,48 |
mov [DLGPID],eax |
; Claear and prepare IPC area for next message |
mov [path],dword 0 |
mov [path+4],dword 8 |
mov [path+8],dword 0 |
mov [path+12],dword 0 |
mov [path+16],dword 0 |
; Set dlg_pid_get for get next message |
mov [dlg_pid_get],dword 1 |
call redproc ;show DLG_PID |
jmp getmesloop |
ready: |
; |
; The second message get |
; Second message is 100 bytes path to SAVE/OPEN file |
; shl path string on 16 bytes |
; |
cld |
mov esi,path+16 |
mov edi,path |
mov ecx,200 |
rep movsb |
mov [edi],byte 0 |
jmp openoff |
; DATA AREA |
get_loops dd 0 |
dlg_pid_get dd 0 |
DLGPID dd 0 |
param: |
dd 0 ; My dec PID |
dd 0,0 ; Type of dialog |
run_fileinfo: |
dd 16 |
dd 0 |
dd param |
dd 0 |
dd procinfo ; 0x10000 |
;run_filepath |
db '/RD/1/SYSXTREE',0 |
procinfo: |
times 256 db 0 |
} |
macro savedialog redproc,openoff,erroff,path |
{ |
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc |
local run_fileinfo, run_filepath, param |
local getmesloop, loox, mred, mkey, mbutton, mgetmes |
local dlg_is_work, ready, procinfo |
; |
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
; |
cld |
;; mov esi,path |
mov edi,path |
mov eax,0 |
mov ecx,200 |
rep stosb |
;mov [get_loops],0 |
mov [dlg_pid_get],0 |
; Get my PID in dec format 4 bytes |
mov eax,9 |
mov ebx,procinfo |
mov ecx,-1 |
int 0x40 |
; convert eax bin to param dec |
mov eax,dword [procinfo+30] ;offset of myPID |
mov edi,param+4-1 ;offset to 4 bytes |
mov ecx,4 |
mov ebx,10 |
cld |
new_d: |
xor edx,edx |
div ebx |
add dl,'0' |
mov [edi],dl |
dec edi |
loop new_d |
; wirite 1 byte space to param |
mov [param+4],byte 32 ;Space for next parametr |
; and 1 byte type of dialog to param |
mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog) |
; |
; STEP2 prepare IPC area for get messages |
; |
; prepare IPC area |
mov [path],dword 0 |
mov [path+4],dword 8 |
; define IPC memory |
mov eax,60 |
mov ebx,1 ; define IPC |
mov ecx,path ; offset of area |
mov edx,120 ; size 150 bytes |
int 0x40 |
; change wanted events list 7-bit IPC event |
mov eax,40 |
mov ebx,01000111b |
int 0x40 |
; |
; STEP 3 run SYSTEM XTREE with parameters |
; |
mov eax,58 |
mov ebx,run_fileinfo |
int 0x40 |
call redproc |
mov [get_loops],0 |
getmesloop: |
mov eax,23 |
mov ebx,50 ;0.5 sec |
int 0x40 |
cmp eax,1 |
je mred |
cmp eax,2 |
je mkey |
cmp eax,3 |
je mbutton |
cmp eax,7 |
je mgetmes |
; Get number of procces |
mov ebx,procinfo |
mov ecx,-1 |
mov eax,9 |
int 0x40 |
mov ebp,eax |
loox: |
mov eax,9 |
mov ebx,procinfo |
mov ecx,ebp |
int 0x40 |
mov eax,[DLGPID] |
cmp [procinfo+30],eax ;IF Dialog find |
je dlg_is_work ;jmp to dlg_is_work |
dec ebp |
jnz loox |
jmp erroff |
dlg_is_work: |
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated |
je erroff ;TESTODP2 terminated too |
cmp [dlg_pid_get],dword 1 |
je getmesloop |
inc [get_loops] |
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
jae erroff |
jmp getmesloop |
mred: |
call redproc |
jmp getmesloop |
mkey: |
int 0x40 ; read (eax=2) |
jmp getmesloop |
mbutton: |
mov eax,17 ; get id |
int 0x40 |
cmp ah,1 ; button id=1 ? |
jne getmesloop |
mov eax,-1 ; close this program |
int 0x40 |
mgetmes: |
; If dlg_pid_get then second message get jmp to still |
cmp [dlg_pid_get],dword 1 |
je ready |
; First message is number of PID SYSXTREE dialog |
; convert PID dec to PID bin |
movzx eax,byte [path+16] |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+1] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+2] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+3] |
add eax,ebx |
sub eax,48 |
mov [DLGPID],eax |
; Claear and prepare IPC area for next message |
mov [path],dword 0 |
mov [path+4],dword 8 |
mov [path+8],dword 0 |
mov [path+12],dword 0 |
mov [path+16],dword 0 |
; Set dlg_pid_get for get next message |
mov [dlg_pid_get],dword 1 |
call redproc ;show DLG_PID |
jmp getmesloop |
ready: |
; |
; The second message get |
; Second message is 100 bytes path to SAVE/OPEN file |
; shl path string on 16 bytes |
; |
cld |
mov esi,path+16 |
mov edi,path |
mov ecx,200 |
rep movsb |
mov [edi],byte 0 |
jmp openoff |
; DATA AREA |
get_loops dd 0 |
dlg_pid_get dd 0 |
DLGPID dd 0 |
param: |
rb 4 ; My dec PID |
rb 6 ; Type of dialog |
run_fileinfo: |
dd 16 |
dd 0 |
dd param |
dd 0 |
dd procinfo |
run_filepath: |
db '/RD/1/SYSXTREE',0 |
procinfo: |
times 256 db 0 |
} |
; RANDOM - generate random count (small) |
; (SYNTAX) RANDOM MaxCount,OutArgument |
; (SAMPLE) RANDOM 10000,eax |
; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations |
randomuse = 0 |
macro random arg1,arg2 |
{ |
local rxproc |
randomuse = randomuse + 1 |
jmp rxproc |
if defined randomuse & randomuse = 1 |
randomproc: |
jmp rnj |
rsx1 dw 0x4321 |
rsx2 dw 0x1234 |
rnj: |
; mov eax,arg1 |
push bx |
push cx |
push dx |
push si |
push di |
mov cx,ax |
mov ax,word ptr rsx1 |
mov bx,word ptr rsx2 |
mov si,ax |
mov di,bx |
mov dl,ah |
mov ah,al |
mov al,bh |
mov bh,bl |
xor bl,bl |
rcr dl,1 |
rcr ax,1 |
rcr bx,1 |
add bx,di |
adc ax,si |
add bx,0x62e9 |
adc ax,0x3619 |
mov word ptr rsx1,bx |
mov word ptr rsx2,ax |
xor dx,dx |
cmp ax,0 |
je nodiv |
cmp cx,0 |
je nodiv |
div cx |
nodiv: |
mov ax,dx |
pop di |
pop si |
pop dx |
pop cx |
pop bx |
and eax,0000ffffh |
; mov arg2,0 |
; mov arg2,eax |
ret |
end if |
rxproc: |
mov eax,arg1 |
call randomproc |
mov arg2,eax |
} |
macro scank |
{ |
mov eax,10 |
int 0x40 |
} |
macro putpix x,y,color |
{ |
mov ebx,x |
mov ecx,y |
mov edx,color |
mov eax,1 |
int 0x40 |
} |
macro puttxt x,y,offs,size,color |
{ |
; mov ebx,x |
; shl ebx,16 |
; add ebx,y |
wordstoreg ebx,x,y |
mov ecx,color |
mov edx,offs |
mov esi,size |
mov eax,4 |
int 0x40 |
} |
macro outcount data, x, y, color, numtype |
{ |
mov ecx,data |
mov ebx,numtype |
mov bl,0 |
; mov edx,x*65536+y |
wordstoreg edx,x,y |
mov esi,color |
mov eax,47 |
int 0x40 |
} |
; SCEVENT - Scan event |
macro scevent red,key,but |
{ |
mov eax,11 |
int 0x40 |
dec eax |
jz red |
dec eax |
jz key |
dec eax |
jz but |
} |
; WTEVENT - Wait event |
macro wtevent red,key,but |
{ |
mov eax,10 |
int 0x40 |
dec eax |
jz red |
dec eax |
jz key |
dec eax |
jz but |
} |
; TIMEEVENT - Wite for event with timeout |
macro timeevent xfps,noevent,red,key,but |
{ |
mov eax,23 |
mov ebx,xfps |
int 0x40 |
cmp eax,0 |
je noevent |
dec eax |
jz red |
dec eax |
jz key |
dec eax |
jz but |
} |
; CLOSE - Close program |
macro close |
{ |
mov eax,-1 |
int 0x40 |
} |
; DELAY - Create delay 1/100 sec |
; (SYNTAX) Delay time |
; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec |
macro delay arg1 |
{ |
mov eax,5 |
mov ebx,arg1 |
int 0x40 |
} |
; WINDOW - Draw window |
; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color |
; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned |
macro window arg1,arg2,arg3,arg4,arg5 |
{ |
; mov ebx,arg1*65536+arg3 |
; mov ecx,arg2*65536+arg4 |
wordstoreg ebx,arg1,arg3 |
wordstoreg ecx,arg2,arg4 |
mov edx,arg5 |
mov eax,0 |
int 0x40 |
} |
macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7 |
{ |
mov ebx,arg1*65536+arg3 |
mov ecx,arg2*65536+arg4 |
mov edx,arg5 |
mov esi,arg6 |
mov edi,arg7 |
mov eax,0 |
int 0x40 |
} |
; STARTWD - Start of window draw |
macro startwd |
{ |
mov eax,12 |
mov ebx,1 |
int 0x40 |
} |
; ENDWD - End window draw |
macro endwd |
{ |
mov eax,12 |
mov ebx,2 |
int 0x40 |
} |
; LABEL - Put text to frame |
; (SYNTAX) LABEL Xstart,Ystart,'Text',Color |
; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big |
macro label arg1,arg2,arg3,arg4 |
{ |
local asd,lab |
jmp asd |
lab db arg3 ;arg label |
asd: |
; mov ebx,arg1 ;arg1=y arg2=x |
; shl ebx,16 |
; add ebx,arg2 |
wordstoreg ebx,arg1,arg2 |
mov ecx,arg4 ;arg4 color |
mov edx,lab |
mov esi,asd-lab ;calc size |
mov eax,4 |
int 0x40 |
} |
;Key's |
key_Up equ 178 |
key_Down equ 177 |
key_Right equ 179 |
key_Left equ 176 |
key_Esc equ 27 |
key_Space equ 32 |
key_Enter equ 13 |
key_Bspace equ 8 |
key_F1 equ 50 |
key_F2 equ 51 |
key_F3 equ 52 |
key_F4 equ 53 |
key_F5 equ 54 |
key_F6 equ 55 |
key_F7 equ 56 |
key_F8 equ 57 |
key_F9 equ 48 |
key_F10 equ 49 |
key_F11 equ 68 |
key_F12 equ 255 |
key_Home equ 180 |
key_End equ 181 |
key_PgUp equ 184 |
key_PgDown equ 183 |
;Attributes |
;Window Attributes |
window_Skinned equ 0x03000000 |
window_Type2 equ 0x02000000 |
window_Type1 equ 0x00000000 |
window_Reserve equ 0x01000000 |
;Font Attributes |
font_Big equ 0x10000000 |
;Colors |
cl_White equ 0x00ffffff |
cl_Black equ 0x00000000 |
cl_Grey equ 0x00888888 |
cl_Red equ 0x00ff0000 |
cl_Lime equ 0x0000ff00 |
cl_Green equ 0x0000af00 |
cl_Blue equ 0x000000ff |
cl_Purple equ 0x008080ff |
cl_Violet equ 0x008040ff |
cl_Cyan equ 0x0040e0ff |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/copyr/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm copyr.asm copyr |
@pause |
/programs/fs/copyr/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm copyr.asm copyr |
@pause |
/programs/fs/copyr/trunk/copyr.asm |
---|
0,0 → 1,341 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; ; |
; FILE COPY - system module for copy ; |
; files.Prog for SYS X-TREE BROWSER v22 ; |
; ; |
; Create by Pavlushin Evgeni waptap@mail.ru ; |
; homepage www.deck4.narod.ru ; |
; ; |
; On base SYSTREE FILE COPIER 1.02 ; |
; Ivan Poddubny ivan-yar@bk.ru ; |
; ; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; ï ¯à®£ ¥é¥ áëà ï ¨ £«îç ï ® 㦥 ª®¥ ª ª à ¡®â ¥â |
use32 |
org 0x0 |
db 'MENUET01' ; 8 byte id |
dd 0x01 ; header version |
dd START ; start of code |
dd I_END ; size of image |
dd 0x20000 ; memory for app |
dd 0x10000 ; esp |
dd param_area , 0x0 ; I_Param , I_Icon |
include 'lang.inc' |
include 'macros.inc' ; very useful stuff for MeOS |
include 'ascl.inc' |
STRLEN = 48 ; maximal length of filename |
START: ; start of execution |
; à ¬¥âàë: |
; ®â 0 ¤® 100 ¯ãâì ª ¨áâ®ç¨ªã |
; ®â 100 ¤® 200 ¯ãâì ª ¯à¨¥¬¨ªã |
; |
;get param |
mov eax,15 |
cmp byte [param_area],0 |
je err_exit ;source not found |
mov eax,16 |
cmp byte [param_area+100],0 |
je err_exit ;dest not found |
mov ecx,199 |
cdf: |
mov al,[param_area+ecx] |
cmp al,byte 32 |
jne nor |
mov al,byte 0 |
nor: |
mov al,[param_area+ecx] |
dec ecx |
jns cdf |
mov ecx,STRLEN - 4 |
copysp: |
mov al,[param_area+ecx] |
mov [source+ecx],al |
dec ecx |
jns copysp |
mov [source+42],byte 0 |
mov ecx,STRLEN - 4 |
copydp: |
mov al,[param_area+ecx+100] |
mov [destination+ecx],al |
dec ecx |
jns copydp |
mov [destination+42],byte 0 |
call draw_window |
call copy_file |
dexit: |
wtevent red,key,button |
jmp dexit |
red: |
call draw_window |
jmp dexit |
key: |
button: |
exit: |
close |
err_exit: |
push eax |
call draw_window |
pop eax |
jmp copy_error |
; print message now |
copy_error: |
mov ebp,43 |
mul ebp |
mov ebp,eax |
mov eax,4 |
mov ebx,20*65536+70 |
mov ecx,0x10ff0000 |
mov edx,errors ;*8] |
add edx,ebp |
mov esi,43 ;[errors+edi*8+4] |
int 0x40 |
jmp dexit |
;closep: |
; or eax,-1 ; close program |
; int 0x40 |
;==================================================== |
; copy_file |
; This piece of code copies src file to dst file, |
; then it pass the control to copy_error routine, |
; which returns to the main cycle of the app. |
; It's NOT a function! It's reached by direct jump |
; from the button handler. |
;==================================================== |
copy_file: |
; at first we must get the size of the source file |
mov [source_info.blocks],1 ; load only 512 bytes |
mov eax,58 |
mov ebx,source_info |
int 0x40 |
; now eax contains error code |
; and ebx contains file size in bytes |
test eax,eax ; check if eax is equal to zero (success) |
je .ok_getsize ; eax = 0 => continue |
cmp eax,6 |
jna @f |
mov eax,7 ; if error code is above 6, it will be 7 |
@@: |
cmp eax,5 ; file might be copied successfully altrough |
; the system reports an error 5 |
jne copy_error ; print error code now |
.ok_getsize: |
; allocate memory |
push ebx ; save file size |
mov ecx,ebx |
add ecx,0x20000 ; size of memory needed = 0x20000+filesize |
mov eax,64 ; func 64 |
mov ebx,1 ; resize application memory |
int 0x40 |
pop ebx ; restore filesize |
; check if alloc function failed |
test eax,eax ; non-zero value means error |
je .ok_memory |
mov eax,5 ; error 5 - out of memory |
jmp copy_error ; print error code now |
.ok_memory: |
; save number of blocks to source_info |
shr ebx,9 ; divide by 512 |
inc ebx ; blocks++ |
mov [source_info.blocks],ebx |
; read the source file |
mov eax,58 |
mov ebx,source_info |
int 0x40 |
; ebx = file size |
; save loaded file |
mov [dest_info.bytes2write],ebx ; file size in bytes |
mov eax,58 |
mov ebx,dest_info |
int 0x40 |
; check if 58 function failed |
test eax,eax |
je .ok_write |
add eax,7 ; error number += 7 |
cmp eax,6+7 |
jna copy_error |
mov eax,7+7 |
jmp copy_error |
.ok_write: |
; return to the initial amount of memory |
mov eax,64 |
mov ebx,1 |
mov ecx,0x20000 |
int 0x40 |
xor eax,eax ; eax = message number (0-OK) |
; print strings (source & destination) |
print_text: |
mov eax,13 |
mov ebx,107*65536+STRLEN*6 |
mov ecx,[ya] |
shl ecx,16 |
add ecx,9 |
mov edx,0xf2f2f2 |
int 0x40 |
mov eax,4 |
mov ebx,109*65536 |
add ebx,[ya] |
xor ecx,ecx |
mov edx,[addr] |
mov esi,STRLEN |
int 0x40 |
ret |
; ********************************************* |
; ******* WINDOW DEFINITIONS AND DRAW ******** |
; ********************************************* |
draw_window: |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,1 ; 1, start of draw |
int 0x40 |
; DRAW WINDOW |
xor eax,eax ; function 0 : define and draw window |
mov ebx,160*65536+415 ; [x start] *65536 + [x size] |
mov ecx,160*65536+90 ; [y start] *65536 + [y size] |
mov edx,0x03DDDDDD ; color of work area RRGGBB |
int 0x40 |
; WINDOW LABEL |
mov eax,4 ; function 4 : write text to window |
mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
mov ecx,0x10ffffff ; color of text RRGGBB |
mov edx,labelt ; pointer to text beginning |
mov esi,labellen-labelt ; text length |
int 0x40 |
mov eax,8 |
mov ebx,105*65536+290 |
mov ecx,33*65536+12 |
mov edx,4 |
mov esi,0xEBEBEB |
int 0x40 |
mov ebx,105*65536+290 |
mov ecx,49*65536+12 |
mov edx,5 |
mov esi,0xEBEBEB |
int 0x40 |
mov esi,source |
mov edi,text+14 |
mov ecx,STRLEN |
rep movsb |
mov esi,destination |
mov edi,text+STRLEN+59-45+14 |
mov ecx,STRLEN |
rep movsb |
mov ebx,25*65536+36 ; print filenames |
xor ecx,ecx |
mov edx,text |
mov esi,STRLEN+59-45 |
newline: |
mov eax,4 |
int 0x40 |
add ebx,16 |
add edx,STRLEN+59-45 |
cmp [edx],byte 'x' |
jnz newline |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,2 ; 2, end of draw |
int 0x40 |
ret |
; DATA AREA |
align 4 |
param_area: |
times 256 db 0 |
source_info: ; SOURCE FILEINFO |
.mode dd 0 ; read file |
.start_block dd 0x0 ; block to read |
.blocks dd 0x700 ; num of blocks |
.address dd 0x20000 |
.workarea dd 0x10000 |
source: |
times (STRLEN) db 32 |
db 0 |
dest_info: ; DESTINATION FILEINFO |
.mode dd 1 ; write |
.notused dd 0x0 ; not used |
.bytes2write dd 0 ; bytes to write |
.address dd 0x20000 |
.workarea dd 0x10000 |
destination: |
times (STRLEN) db 32 |
db 0 |
align 4 |
addr dd 0x0 |
ya dd 0x0 |
temp dd 0 |
text: |
db ' : |®áá¨ï, ¥«ï⨮, ®áª¢ , 1 ãàá ' |
db ' : | ¢«îè¨ ¢£¥¨©, waptap@mail.ru ' |
db ' ' |
db 'x' ; <- END MARKER, DONT DELETE |
labelt: |
db ' ' |
labellen: |
errors: |
db "ä ©« ᪮¯¨à®¢ ãá¯¥è® " |
db "(ç⥨¥) ¥ § ¤ ¡ § ¦¤ " |
db "(ç⥨¥) ä ©«®¢ ï á¨á⥬ ¥ ¯®¤¤¥à¦¨¢ ¥âáï" |
db "(ç⥨¥) ¥¨§¢¥áâ ï ä ©«®¢ ï á¨á⥬ " |
db "(ç⥨¥) ¥ § ¤ à §¤¥« ¦¤ " |
db "¥¤®áâ â®ç® ¯ ¬ï⨠" |
db "(ç⥨¥) ª®¥æ ä ©« " |
db "(ç⥨¥) ¥¨§¢¥áâ ï ®è¨¡ª " |
db "(§ ¯¨áì) ¥ § ¤ à §¤¥« ¦¤ " |
db "(§ ¯¨áì) ä ©«®¢ ï á¨á⥬ ¥ ¯®¤¤¥à¦¨¢ ¥âáï" |
db "(§ ¯¨áì) ¥¨§¢¥áâ ï ä ©«®¢ ï á¨á⥬ " |
db "(§ ¯¨áì) ¥ § ¤ à §¤¥« ¦¤ " |
db "oh shit! " |
db "(§ ¯¨áì) ä ©« ¥ ©¤¥ " |
db "(§ ¯¨áì) ¥¨§¢¥áâ ï ®è¨¡ª " |
db "ãâì ª ¨áâ®ç¨ªã ¨ ¯à¨¥¬¨ªã ¥ 㪠§ ë!!! " |
db "ãâì ª ¯à¨¥¬¨ªã ¥ 㪠§ !!! " |
;0123456789012345678901234567890123456789012 |
I_END: |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/copyr/trunk/macros.inc |
---|
0,0 → 1,266 |
; 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 |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b eq) |
mov reg,a |
end if |
} |
macro mcall a,b,c,d,e,f { ; mike.dld |
__mov eax,a |
__mov ebx,b |
__mov ecx,c |
__mov edx,d |
__mov esi,e |
__mov edi,f |
int 0x40 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
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 __regs) & (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 |
} |
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 |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/hexhd/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm hexhd.asm hexhd |
@pause |
/programs/fs/hexhd/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm hexhd.asm hexhd |
@pause |
/programs/fs/hexhd/trunk/hexhd.asm |
---|
0,0 → 1,235 |
; |
; EXAMPLE APPLICATION |
; |
; Compile with FASM for Menuet |
; |
use32 |
org 0x0 |
db 'MENUET00' ; 8 byte id |
dd 38 ; required os |
dd START ; program start |
dd I_END ; program image size |
dd 0x5000 ; required amount of memory |
dd 0x5000 ; esp = 0x7FFF0 |
dd 0x00000000 ; reserved=no extended header |
include 'lang.inc' |
include 'macros.inc' |
START: ; start of execution |
call open_file |
call draw_window ; at first, draw the window |
still: |
mov eax,10 ; wait here for event |
int 0x40 |
cmp eax,1 ; redraw request ? |
je red |
cmp eax,2 ; key in buffer ? |
je key |
cmp eax,3 ; button in buffer ? |
je button |
jmp still |
red: ; redraw |
call draw_window |
jmp still |
key: ; key |
mov eax,2 ; just read it and ignore |
int 0x40 |
jmp still |
button: ; button |
mov eax,17 ; get id |
int 0x40 |
cmp ah,1 ; button id=1 ? |
jne noclose |
mov eax,-1 ; close this program |
int 0x40 |
noclose: |
cmp ah,2 |
jne noexam |
jmp still |
noexam: |
cmp ah,3 |
jne noback |
mov edi,block |
cmp dword [edi],0 |
je nonext |
dec dword [edi] |
call open_file |
call draw_window |
noback: |
cmp ah,4 |
jne nonext |
mov edi,block |
inc dword [edi] |
call open_file |
call draw_window |
nonext: |
jmp still |
; ********************************************* |
; ******* WINDOW DEFINITIONS AND DRAW ******** |
; ********************************************* |
draw_window: |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,1 ; 1, start of draw |
int 0x40 |
; DRAW WINDOW |
mov eax,0 ; function 0 : define and draw window |
mov ebx,0*65536+400 ; [x start] *65536 + [x size] |
mov ecx,0*65536+270+200 ; [y start] *65536 + [y size] |
mov edx,0x038899aa;1111cc ; color of work area RRGGBB,8->c |
int 0x40 |
mov eax,4 ; function 4 : write text to window |
mov ebx,144*65536+8 ; [x start] *65536 + [y start] |
mov ecx,0x00ffffff ; color of text RRGGBB |
mov edx,labelt ; pointer to text beginning |
mov esi,labellen-labelt ; text length |
int 0x40 |
mov eax,47 ;decimal |
mov ecx,[block] |
mov edx,64*65536+34 |
mov ebx,10 |
shl ebx,16 |
mov esi,0x00ffffff |
int 0x40 |
add edx,128*65536 ;hex |
mov bh,1 |
int 0x40 |
mov eax,8 |
mov ebx,280*65536+16*6 |
mov ecx,30*65536+14 |
mov edx,2 |
mov esi,0x3f49df;5599cc |
int 0x40 |
mov ebx,15*65536+32 |
add edx,1 |
mov eax,8 |
int 0x40 |
add ebx,127*65536 |
add edx,1 |
mov eax,8 |
int 0x40 |
mov eax,4 |
mov ebx,14*65536+33 |
mov ecx,0xffffff |
mov edx,buttons |
mov esi,blen-buttons |
int 0x40 |
mov ebx,280*65536+65 ; draw info text with function 4 |
mov ecx,0xffffff |
mov edx,text |
mov esi,16 |
mov edi,16*2 |
newline: |
pusha ; hext |
mov edi,16 |
mov ecx,edx |
mov edx,ebx |
sub edx,265*65536 |
newhex: |
mov eax,47 |
mov ebx,0x00020101 |
xor esi,0xffff00 |
int 0x40 |
add edx,16*65536 |
add ecx,1 |
dec edi |
jne newhex |
popa |
mov eax,4 ; text |
int 0x40 |
add ebx,12 |
add edx,16 |
dec edi |
jnz newline |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,2 ; 2, end of draw |
int 0x40 |
ret |
open_file: |
pusha |
mov eax,58 |
mov ebx,fileinfo |
int 0x40 |
popa |
ret |
; DATA AREA |
fileinfo: |
dd 8 |
block dd 0 |
dd 1 |
dd text |
dd os |
db '/HARDDISK/FIRST',0 |
labelt: |
db 'EDITOR HEXADECIMAL' |
labellen: |
buttons db ' << >> << OPTIONS >> ' |
blen: |
os: |
times 16384 db ? |
text: |
I_END: |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/hexhd/trunk/macros.inc |
---|
0,0 → 1,265 |
; 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 |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a { ; mike.dld |
if ~a eq |
mov reg,a |
end if |
} |
macro mcall a,b,c,d,e,f { ; mike.dld |
__mov eax,a |
__mov ebx,b |
__mov ecx,c |
__mov edx,d |
__mov esi,e |
__mov edi,f |
int 0x40 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
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 __regs) & (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 |
} |
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 |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/mfar/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm mfar.asm mfar |
@pause |
/programs/fs/mfar/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm mfar.asm mfar |
@pause |
/programs/fs/mfar/trunk/macros.inc |
---|
0,0 → 1,226 |
; 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 |
} |
; 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 |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/mfar/trunk/menuet.inc |
---|
0,0 → 1,180 |
;------------------------------------------------------------------------------ |
;///// 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 = 58 |
FS_READ = 0 |
FS_WRITE = 1 |
FS_DELETE = 2 |
FS_APPEND = 3 |
FS_LBAREAD = 8 |
FS_LBAWRITE = 9 |
FS_EXECUTE = 16 |
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/fs/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/fs/mfar/trunk/mf-lang.inc |
---|
0,0 → 1,39 |
;------------------------------------------------------------------------------ |
;///// LOCALIZED STRINGS ////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
lsz lname,\ |
ru,'•',\ |
en,'Name',\ |
fr,'Nom',\ |
ge,'Name' |
lsz sort_kind,\ |
ru,'¨à',\ |
en,'nx',\ |
fr,'ne',\ |
ge,'ne' |
lsz btmkeys,\ |
ru,'®¬®éì ®«ì§ à®á¬ ¥¤ ªâ ®¯¨à ',\ |
ru,'¥à¥ ¯ª ¤ «¥ ®ä ë室',\ |
en,'Help UserMn View Edit Copy ',\ |
en,'RenMov MkFold Delete ConfMn Quit',\ |
fr,'Aide UserMn Vue Editer Copier ',\ |
fr,'RenDep CrÎeRp Efface ConfMn Quitter',\ |
ge,'Hilfe Menà Anzeig Bearb. Kopie ',\ |
ge,'UmbBew MkDir LÂsche Funkt. Ende' |
lsz sz_cancel,\ |
ru,'⬥ ',\ |
en,'Cancel',\ |
fr,'Annuler',\ |
ge,'Beenden' |
;---------- COPY DIALOG ---------- |
lsz sz_copy,\ |
ru,'®¯¨à®¢ âì "',\ |
en,'Copy "',\ |
fr,'Copier "',\ |
ge,'Kopiere "' |
lsz sz_copyto,\ |
ru,'" ¢:',\ |
en,'" to:',\ |
fr,'" vers:',\ |
ge,'" nach:' |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/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/fs/mfar/trunk/mfar.asm |
---|
0,0 → 1,1181 |
; 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 'lang.inc' |
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: |
mcall MF_WAITEVWTO,100 ; waiting 1 sec |
jmpe al,,\ |
EV_REDRAW,redraw_all,\ |
EV_KEY,key,\ |
EV_BUTTON,button |
; after every 1 second [when no other events occur] updating files info |
; eg. requesting ACTIVE panel files data and drawing it |
;; timed redraw { |
mov dl,[active_panel] |
cmp dl,0 |
jne ._00 |
push [d_ltsz] |
jmp @f |
._00: |
push [d_rtsz] |
@@: |
call get_files_data |
pop eax |
cmp dl,0 |
jne ._01 |
cmp eax,[d_ltsz] |
jmp @f |
._01: |
cmp eax,[d_rtsz] |
@@: |
je still ; nothing happened, waiting again |
mov al,dl |
jmp redraw_files |
;; } |
; key pressed event |
key: |
mcall MF_GETKEY ; get key-code |
movzx ecx,[active_panel] |
jmpe ah,k_directional,\ |
VK_RETURN,k_return,\ ; execute something |
VK_TAB,k_tab,\ ; change active panel |
VK_F5,k_f5,\ ; copy |
VK_F10,mfar_exit,\ ; terminate |
VK_CTRLF3,k_ctrl_f3,\ ; sort by name |
VK_CTRLF4,k_ctrl_f4 ; sort by extension |
;------------------------------------------------------------------------------ |
k_return: |
call execute_current_file |
jmp still |
;------------------------------------------------------------------------------ |
k_tab: |
mov edi,[fc.background] |
call draw_sel ; hide current file selection |
xor [active_panel],1 ; changing active panel |
call draw_path ; drawing path of new panel |
mov dl,[active_panel] |
call get_files_data ; requesting panel files info |
mov edi,sel_color |
call draw_sel ; show current file |
mov al,[active_panel] |
call draw_file_info ; and its info (size,date) |
jmp still |
;------------------------------------------------------------------------------ |
k_f5: |
call copy_file |
jc still |
jmp redraw_all |
;------------------------------------------------------------------------------ |
k_ctrl_f3: |
jecxz ._00 |
cmp [r_sort],0 |
je still |
mov [r_sort],0 |
jmp @f |
._00: |
cmp [l_sort],0 |
je still |
mov [l_sort],0 |
@@: |
mov al,cl |
call mfar_sort |
jmp redraw_files |
;------------------------------------------------------------------------------ |
k_ctrl_f4: |
jecxz ._00 |
cmp [r_sort],1 |
je still |
mov [r_sort],1 |
jmp @f |
._00: |
cmp [l_sort],1 |
je still |
mov [l_sort],1 |
@@: |
mov al,al |
call mfar_sort |
jmp redraw_files |
;------------------------------------------------------------------------------ |
k_directional: |
cmp ah,VK_LEFT ; non-directional keys ? |
jb still ; ignore them |
cmp ah,VK_END |
ja still |
jecxz ._00 |
mov edx,[d_rpos] |
mov ebx,[d_rtop] |
mov esi,[d_rcnt] |
jmp @f |
._00: |
mov edx,[d_lpos] |
mov ebx,[d_ltop] |
mov esi,[d_lcnt] |
@@: |
xor ebp,ebp ; redraw whole panel [0-no, 1-yes] |
;------------------------------------------------------------------------------ |
jmpe ah,show_cur,\ |
VK_LEFT,k_left,\ |
VK_DOWN,k_down,\ |
VK_UP,k_up,\ |
VK_RIGHT,k_right,\ |
VK_HOME,k_home,\ |
VK_END,k_end |
k_left: |
cmp edx,0 |
je still |
sub edx,FPC |
jge @f |
xor edx,edx |
@@: |
mov eax,edx |
sub eax,ebx |
jge show_cur |
inc ebp |
sub ebx,FPC |
jge show_cur |
xor ebx,ebx |
jmp show_cur |
;------------------------------------------------------------------------------ |
k_down: |
lea eax,[esi-1] |
cmp edx,eax |
je still |
inc edx |
mov eax,edx |
sub eax,ebx |
cmp eax,FPC*3-1 |
jle show_cur |
inc ebp |
inc ebx |
jmp show_cur |
;------------------------------------------------------------------------------ |
k_up: |
cmp edx,0 |
je still |
dec edx |
mov eax,ebx |
cmp edx,eax |
jge show_cur |
inc ebp |
dec ebx |
jmp show_cur |
;------------------------------------------------------------------------------ |
k_right: |
lea eax,[esi-1] |
cmp edx,eax |
je still |
add edx,FPC |
cmp edx,eax |
jle @f |
mov edx,eax |
@@: |
mov eax,edx |
sub eax,ebx |
cmp eax,FPC*3-1 |
jle show_cur |
inc ebp |
add ebx,FPC |
jmp show_cur |
;------------------------------------------------------------------------------ |
k_home: |
cmp edx,0 |
je still |
inc ebp |
xor edx,edx |
xor ebx,ebx |
jmp show_cur |
;------------------------------------------------------------------------------ |
k_end: |
lea eax,[esi-1] |
cmp edx,eax |
je still |
mov edx,eax |
mov edi,eax |
sub edi,ebx |
cmp edi,FPC*3-1 |
jle show_cur |
inc ebp |
sub eax,FPC*3-1 |
mov ebx,eax |
;------------------------------------------------------------------------------ |
show_cur: |
mov edi,[fc.background] |
call draw_sel |
jecxz ._00 |
mov [d_rpos],edx |
mov [d_rtop],ebx |
jmp @f |
._00: |
mov [d_lpos],edx |
mov [d_ltop],ebx |
@@: |
cmp ebp,0 |
mov al,cl |
jne redraw_files |
mov edi,[fc.selection] |
call draw_sel |
call draw_file_info |
jmp still |
button: |
mcall MF_GETPRSDBTNID |
cmp ah,1 |
jne noclose |
mfar_exit: |
mcall MF_RDDELFILE,fcfile ; delete existing mfar.dat |
mcall MF_RDWRITEFILE,fcfile,fc,12*4,0 ; create new mfar.dat |
mcall MF_TERMINATE ; close program |
noclose: |
jmp still |
;------------------------------------------------------------------------------ |
;///// DRAW WINDOW //////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
func draw_window |
mcall MF_WINPROPS,WP_GETSYSCLRS,sc,sizeof.system_colors |
mcall MF_WNDDRAW,WD_BEGINDRAW |
mov edx,[fc.background] |
or edx,WS_SKINNED |
mcall2 MF_DEFWINDOW,90,oX+tW*80+4,45,oY+tH*25+4 |
mcall1 MF_DRAWTEXT,8,8,[sc.grab_text],caption,caption.size |
mmov esi,oX+2,oX+tW*39+2 |
mmov edi,oY+3,oY+tH*22+3 |
mov edx,[fc.default] |
call draw_frame |
mmov esi,oX+tW*40+2,oX+tW*79+2 |
call draw_frame |
mcall2 MF_DRAWLINE,oX+tW*13+2,oX+tW*13+2,oY+tH,oY+tH*20+3 |
madd ebx,tW*13,tW*13 |
mcall |
mcall2 ,oX+3,oX+tW*39+1,oY+tH*20+3,oY+tH*20+3 |
mcall2 ,oX+tW*53+2,oX+tW*53+2,oY+tH,oY+tH*20+3 |
madd ebx,tW*13,tW*13 |
mcall |
mcall2 ,oX+tW*40+3,oX+tW*79+1,oY+tH*20+3,oY+tH*20+3 |
mcall1 MF_DRAWTEXT,oX+tW*5,oY+tH,$00ffff00,lname,lname.size |
mcall1 ,oX+tW*18,oY+tH |
mcall1 ,oX+tW*31,oY+tH |
mcall1 ,oX+tW*45,oY+tH |
mcall1 ,oX+tW*58,oY+tH |
mcall1 ,oX+tW*71,oY+tH |
movzx edi,[l_sort] |
lea edx,[edi+sort_kind] |
mcall1 ,oX+tW,oY+tH,$00ffff00,,1 |
movzx edi,[r_sort] |
lea edx,[edi+sort_kind] |
mcall1 ,oX+tW*41,oY+tH |
call draw_path |
call draw_bottom_keys |
mcall MF_WNDDRAW,WD_ENDDRAW |
ret |
endf |
;------------------------------------------------------------------------------ |
;////////////////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
func draw_window_full |
call draw_window |
mov edx,1 |
call get_files_data |
mov al,1 |
call draw_files |
mov edx,0 |
call get_files_data |
mov al,0 |
call draw_files |
ret |
endf |
;------------------------------------------------------------------------------ |
;////////////////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
align 4 |
len dd ? |
func get_normal_path |
pusha |
mov ecx,5 |
rep movsb |
dec esi |
dec edi |
mov ecx,5 |
push eax |
@@: |
dec dword[esp] |
jz @f |
lodsb |
cmp al,0 |
je @b |
cmp al,' ' |
je @b |
stosb |
inc ecx |
jmp @b |
@@: |
pop eax |
mov byte[edi],'>' |
mov [len],ecx |
popa |
ret |
endf |
;------------------------------------------------------------------------------ |
;////////////////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
; EAX = length needed |
; ECX = current length |
; EDI = path string |
func get_path_ellipses |
cmp ecx,eax |
jbe @f |
pushad |
lea esi,[edi+ecx+3+6] ; ... + /??/?/ |
sub esi,eax |
add ecx,edi |
sub ecx,esi |
mov dword[edi+6],'... ' |
add edi,9 |
cld |
rep movsb |
mov [len],eax |
popad |
@@: |
ret |
endf |
;------------------------------------------------------------------------------ |
;////////////////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
func draw_path |
pushad |
cmp [active_panel],0 |
jne ._00 |
mov esi,f_path0 |
mov eax,[f_plen0] |
jmp @f |
._00: |
mov esi,f_path1 |
mov eax,[f_plen1] |
@@: |
mov edi,f_pathn |
call get_normal_path |
mov eax,39 |
mov ecx,[len] |
mov edi,f_pathn |
call get_path_ellipses |
mcall2 MF_FILLRECT,oX-1,tW*80+1,oY+tH*23-1,tH,[fc.pathbg] |
mcall1 MF_DRAWTEXT,oX,oY+tH*23,[fc.path],f_pathn,[len] |
popad |
ret |
endf |
;------------------------------------------------------------------------------ |
;////////////////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
; AL = panel |
func draw_files |
push eax |
mmov ecx,oY+tH*2-1,tH*FPC |
mov edx,[fc.background] |
cmp al,0 |
mov eax,MF_FILLRECT |
jne ._00 |
mcall1 ,oX+tW-2,tW*12+3 |
mcall1 ,oX+tW*14-2,tW*12+3 |
mcall1 ,oX+tW*27-2,tW*12+3 |
mmov ebx,oX+tW,oY+tH*2 |
mov edx,[d_ltop] |
shl edx,4 |
add edx,lstart |
mov edi,[d_lcnt] |
mov esi,edi |
sub edi,[d_ltop] |
jmp @f |
._00: |
mcall1 ,oX+tW*41-2,tW*12+3 |
mcall1 ,oX+tW*54-2,tW*12+3 |
mcall1 ,oX+tW*67-2,tW*12+3 |
mmov ebx,oX+tW*41,oY+tH*2 |
mov edx,[d_rtop] |
shl edx,4 |
add edx,rstart |
mov edi,[d_rcnt] |
mov esi,edi |
sub edi,[d_rtop] |
@@: |
cmp esi,0 |
je .exit_nok ; no files |
mov ecx,3 |
.next_col: |
push ecx |
mov ecx,FPC |
.next_row: |
dec edi |
jge @f |
pop eax |
jmp .exit_ok |
@@: |
push ecx |
call get_file_color |
mov esi,edx |
call get_file_name |
push edx |
mcall 4,,,f_name,12 ; draw file name |
pop edx ecx |
add ebx,tH |
add edx,16 |
dec ecx |
jnz .next_row |
pop ecx |
dec ecx |
jz .exit_ok |
madd ebx,tW*13,0 |
mov bx,oY+tH*2 |
jmp .next_col |
.exit_ok: |
mov edi,sel_color |
call draw_sel |
.exit_nok: |
pop eax |
call draw_file_info |
ret |
endf |
;------------------------------------------------------------------------------ |
;////////////////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
func draw_bottom_keys |
pushad |
mcall2 MF_FILLRECT,oX-1,tW*80+1,oY+tH*24-1,tH+1,[fc.pathbg] |
dec ecx |
mcall1 ,oX+tW-1,tW*6+1,,[fc.keysbg] |
mov esi,7 |
@@: |
madd ebx,tW*8,0 |
mcall |
dec esi |
jge @b |
mcall1 ,oX+tW*73-1,tW*7+1 |
mcall MF_DRAWNUMBER,$00010100,1,oX*65536+(oY+tH*24),[fc.path] |
sub edx,$00010000 |
@@: |
inc cl |
madd edx,tW*8,0 |
mcall |
cmp cl,10 |
jb @b |
mcall1 MF_DRAWTEXT,oX+tW,oY+tH*24,[fc.keys],btmkeys,btmkeys.size |
popad |
ret |
endf |
;------------------------------------------------------------------------------ |
;////////////////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
; ESI = X1*65536+X2 |
; EDI = Y1*65536+Y2 |
; EDX = color |
func draw_frame |
mov ecx,edi |
mov ebx,edi |
shr ebx,16 |
mov cx,bx |
mcall MF_DRAWLINE,esi |
mov ecx,edi |
shl ecx,16 |
mov cx,di |
mcall |
mov ebx,esi |
mov ecx,esi |
shr ecx,16 |
mov bx,cx |
mcall ,,edi |
mov ebx,esi |
shl ebx,16 |
mov bx,si |
mcall |
ret |
endf |
;------------------------------------------------------------------------------ |
;////////////////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
; EDX = pointer to file data |
func get_file_color |
push esi |
mov cl,[edx+11] |
test cl,(FA_HIDDEN or FA_SYSTEM) |
jz @f |
mov ecx,[fc.system] |
jmp .exit |
@@: |
test cl,FA_FOLDER |
jz @f |
mov ecx,[fc.folder] |
jmp .exit |
@@: |
mov ecx,[edx+7] |
and ecx,$ffffff00 |
or ecx,$00000020 |
mov esi,ext0-4 |
@@: |
lodsd |
or eax,eax |
jz @f |
cmp ecx,eax |
jne @b |
mov ecx,[fc.executable] |
jmp .exit |
@@: |
lodsd |
or eax,eax |
jz @f |
cmp ecx,eax |
jne @b |
mov ecx,[fc.bitmap] |
jmp .exit |
@@: |
lodsd |
or eax,eax |
je @f |
cmp ecx,eax |
jne @b |
mov ecx,[fc.source] |
jmp .exit |
@@: |
mov ecx,[fc.default] |
.exit: |
pop esi |
ret |
endf |
;------------------------------------------------------------------------------ |
;////////////////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
; EDI = color |
func draw_sel |
pushad |
cmp [active_panel],0 |
jne ._00 |
mov eax,[d_lpos] |
sub eax,[d_ltop] |
mov esi,[d_lcnt] |
jmp @f |
._00: |
mov eax,[d_rpos] |
sub eax,[d_rtop] |
mov esi,[d_rcnt] |
@@: |
cmp esi,0 |
je .exit |
mov cl,FPC |
div cl |
mov bp,ax |
and eax,$000000FF |
mov cl,tW*13 |
mul cl |
add ax,oX+tW-2 |
push eax |
shl eax,16 |
mov ax,tW*12+3 |
mov ebx,eax |
mov ax,bp |
shr eax,8 |
and eax,$000000FF |
mov cl,tH |
mul cl |
add ax,oY+tH*2-1 |
push eax |
shl eax,16 |
mov ax,tH |
mov ecx,eax |
mov edx,edi |
cmp [active_panel],0 |
je @f |
madd ebx,(40*6),0 |
@@: |
mcall MF_FILLRECT |
pop eax |
movzx ebx,ax |
inc bx |
pop eax |
add ax,2 |
shl eax,16 |
or ebx,eax |
cmp [active_panel],0 |
jne ._01 |
mov edx,[d_lpos] |
shl edx,4 |
add edx,lstart |
jmp @f |
._01: |
mov edx,[d_rpos] |
shl edx,4 |
add edx,rstart |
@@: |
mov esi,edx |
call get_file_name |
call get_file_color |
cmp ecx,edi |
jne @f |
xor ecx,ecx |
@@: |
cmp [active_panel],0 |
je @f |
madd ebx,tW*40,0 |
@@: |
mcall MF_DRAWTEXT,,,f_name,12 |
.exit: |
popad |
ret |
endf |
;------------------------------------------------------------------------------ |
;////////////////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
; AL = panel |
func draw_file_info |
push eax |
mmov ecx,oY+tH*21,tH |
mov edx,[fc.background] |
cmp al,0 |
mov eax,MF_FILLRECT |
jne ._00 |
mcall1 ,oX+tW,tW*38+1 |
mov esi,[d_lpos] |
shl esi,4 |
add esi,lstart |
mov edi,[d_lcnt] |
jmp @f |
._00: |
mcall1 ,oX+tW*41,tW*38+1 |
mov esi,[d_rpos] |
shl esi,4 |
add esi,rstart |
mov edi,[d_rcnt] |
@@: |
cmp edi,0 |
jne @f |
pop eax |
ret |
@@: |
call get_file_info |
mov dword[file_info+17],' ' |
mov word[file_info+15],' ' |
test byte[esi+11],FA_FOLDER |
jz @f |
mov dword[file_info+21],' DIR' |
jmp .no_size |
@@: |
mov dword[file_info+21],' ' |
mov eax,[f_size] |
mov esi,file_info+24 |
mov ebx,10 |
mov ecx,ebx |
@@: |
xor edx,edx |
div ebx |
add dl,'0' |
mov [esi],dl |
or eax,eax |
jz .no_size |
dec esi |
loop @b |
.no_size: |
pop eax |
mmov edx,oX+tW*35,oY+tH*21 |
mmov ebx,oX+tW,oY+tH*21 |
cmp al,0 |
je @f |
madd edx,tW*40,0 |
madd ebx,tW*40,0 |
@@: |
push edx |
mcall MF_DRAWTEXT,,[fc.default],file_info,34 |
pop edx |
mov esi,ecx |
mov cx,[f_year] |
mcall MF_DRAWNUMBER,$00040000 |
sub edx,$00240000 ; 6*6 = $24 |
movzx ecx,[f_day] |
mcall ,$00020000 |
add edx,$00120000 |
mov cl,[f_mnth] |
mcall |
ret |
endf |
;------------------------------------------------------------------------------ |
;////////////////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
func get_file_name |
pushad |
mov eax,[esi+0] |
mov [f_name+0],eax |
mov eax,[esi+4] |
mov [f_name+4],eax |
mov eax,[esi+8] |
shl eax,8 |
and eax,$FFFFFF00 |
or al,$00000020 |
mov [f_name+8],eax |
popad |
ret |
endf |
;------------------------------------------------------------------------------ |
;////////////////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
; ESI = pointer to file data |
func get_file_info |
pushad |
mov eax,[esi+12] |
mov dword[f_info],FS_READ |
mov [f_info+4],eax |
mov dword[f_info+12],read_area |
mcall MF_FSACCESS,f_info |
cmp eax,ERR_SUCCESS |
je @f |
cmp eax,ERR_FS_LAST |
ja @f |
popad |
stc |
ret |
@@: |
mov eax,read_area |
mov ecx,16 |
.next_file: |
mov edx,[esi+0] |
cmp [eax+0],edx |
jne @f |
mov edx,[esi+4] |
cmp [eax+4],edx |
jne @f |
mov edx,[esi+8] |
cmp [eax+8],edx |
jne @f |
mov esi,eax |
jmp .found |
@@: |
add eax,32 |
loop .next_file |
.found: |
push esi |
mov eax,' ' |
mov ecx,3 |
mov edi,file_info |
rep stosd |
mov edi,file_info |
mov ecx,2 |
rep movsd |
mov edi,file_info |
@@: |
cmp byte[edi],' ' |
jbe @f |
inc edi |
jmp @b |
@@: |
mov eax,[esi] |
shl eax,8 |
mov al,'.' |
cmp eax,'. ' |
je @f |
mov [edi],eax |
@@: |
pop esi |
mov eax,[esi+28] |
mov [f_size],eax |
mov eax,[esi+24] |
mov [f_day],al |
and [f_day],00011111b |
shr eax,5 |
mov [f_mnth],al |
and [f_mnth],00001111b |
shr eax,4 |
mov [f_year],ax |
and [f_year],01111111b |
add [f_year],1980 |
popad |
clc |
ret |
endf |
;------------------------------------------------------------------------------ |
;////////////////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
; DL = panel |
func get_files_data |
pushad |
mov [d_tcnt],0 |
mov [d_ttsz],0 |
cmp dl,0 |
jne ._00 |
mov esi,f_path0 |
mov ecx,[f_plen0] |
jmp @f |
._00: |
mov esi,f_path1 |
mov ecx,[f_plen1] |
@@: |
push edi |
mov edi,f_info.path |
mov byte[edi+ecx],0 |
rep movsb |
pop edi |
cmp dl,0 |
jne ._01 |
mov edi,lstart |
jmp @f |
._01: |
mov edi,rstart |
@@: |
push edx |
xor ebp,ebp |
mov dword[f_info],FS_READ ; read |
mov dword[f_info+8],1 ; 1 block |
mov dword[f_info+12],read_area ; to read_area |
.next_block: |
mov dword[f_info+4],ebp ; starting from block #ebp |
mcall MF_FSACCESS,f_info |
cmp eax,ERR_SUCCESS |
je @f |
cmp eax,ERR_FS_LAST |
ja @f |
jmp .exit |
@@: |
mov esi,read_area |
mov ecx,16 |
.next_file: |
cmp word[esi],0 ; end of entries |
je .exit |
cmp word[esi],'. ' ; self-pointer |
je .skip |
test byte[esi+11],FA_LABEL ; disk label |
jnz .skip |
cmp byte[esi+11],$0F ; fat32 |
je .skip |
cmp byte[esi],$E5 ; erased |
je .skip |
mov eax,[esi+28] ; add file size |
add [d_ttsz],eax ; to folder size |
push ecx |
mov ecx,3 |
rep movsd ; copy name, attriputes |
mov [edi],ebp ; and block number |
add edi,4 |
add esi,20 |
inc [d_tcnt] ; increase folder files counter |
; cmp [d_tcnt],max_cnt |
; je .exit |
pop ecx |
jmp @f |
.skip: |
add esi,32 |
@@: |
loop .next_file |
cmp [d_tcnt],max_cnt |
je .exit |
inc ebp |
jmp .next_block |
.exit: |
pop edx |
push [d_ttsz] |
mov eax,[d_tcnt] |
cmp dl,0 |
jne ._02 |
mov [d_lcnt],eax |
pop [d_ltsz] |
jmp @f |
._02: |
mov [d_rcnt],eax |
pop [d_rtsz] |
@@: |
popad |
mov al,dl |
call mfar_sort |
ret |
endf |
;------------------------------------------------------------------------------ |
;////////////////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
func execute_current_file |
pushad |
cmp [active_panel],0 |
jne ._00 |
mov esi,[d_lpos] |
shl esi,4 |
add esi,lstart |
mov edi,f_path0 |
mov ecx,f_plen0 |
jmp @f |
._00: |
mov esi,[d_rpos] |
shl esi,4 |
add esi,rstart |
mov edi,f_path1 |
mov ecx,f_plen1 |
@@: |
call get_file_info |
test byte[esi+11],FA_FOLDER |
jz .file |
cmp word[esi],'..' |
jne .enter_dir |
add edi,[ecx] |
dec edi |
@@: |
dec [f_plen1] |
cmp byte[edi],'/' |
je @f |
dec edi |
jmp @b |
@@: |
mov dword[edi],0 |
jmp @f |
.enter_dir: |
add edi,[ecx] |
push ecx edi |
mov byte[edi],'/' |
inc edi |
mov esi,file_info |
mov ecx,3 |
cld |
rep movsd |
mov dword[edi],0 |
pop esi ecx |
sub edi,esi |
add dword[ecx],edi |
mov [d_rpos],0 |
mov [d_rtop],0 |
@@: |
mov dl,[active_panel] |
call get_files_data |
call draw_path |
mov al,dl |
call draw_files |
jmp .exit |
.file: |
mov eax,[esi+8] |
shl eax,8 |
and eax,$FFFFFF00 |
or eax,$00000020 |
cmp eax,' ' |
jne .exit |
mov esi,edi |
mov eax,[ecx] |
mov edi,f_pathn |
call get_normal_path |
mov esi,f_pathn |
mov ecx,[len] |
dec ecx |
mov edi,f_info.path |
rep movsb |
mov byte[edi],'/' |
inc edi |
mov esi,file_info |
@@: |
movsb |
cmp byte[esi],0 |
je @f |
cmp byte[esi],' ' |
jne @b |
@@: |
mov byte[edi],0 |
mov dword[f_info],FS_EXECUTE |
mov dword[f_info+12],0 |
mcall MF_FSACCESS,f_info |
.exit: |
popad |
ret |
endf |
;------------------------------------------------------------------------------ |
;////////////////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
func delete_current_file |
pushad |
popad |
ret |
endf |
;------------------------------------------------------------------------------ |
;///// INCLUDES /////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
include 'mf-copy.inc' |
include 'mf-sort.inc' |
;------------------------------------------------------------------------------ |
;///// DATA /////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
align 4 |
f_size dd ? |
f_day db ? |
f_mnth db ? |
f_year dw ? |
d_lpos dd 0 |
d_ltop dd 0 |
d_lcnt dd 0 |
d_ltsz dd 0 |
d_rpos dd 0 |
d_rtop dd 0 |
d_rcnt dd 0 |
d_rtsz dd 0 |
d_tpos dd ? |
d_ttop dd ? |
d_tcnt dd ? |
d_ttsz dd ? |
f_info: |
dd 0 |
dd 0 |
dd ? |
dd read_area |
dd MEM_FOR_OS |
.path: |
rb 200 |
f_plen0 dd 5 |
f_plen1 dd 5 |
sz caption,'MFAR : PRE-ALPHA-8.1' |
sz fcfile,'MFAR DAT' |
sz p_hd,'/HD/1',0 |
sz p_rd,'/RD/1',0 |
ext0: |
db ' EXE COM BAT CMD' |
dd 0 |
ext1: |
db ' BMP GIF JPG PNG WMF' |
dd 0 |
ext2: |
db ' ASM INC' |
dd 0 |
;----- LANGUAGE-SPECIFIC STRINGS ----- |
include 'mf-lang.inc' |
;------------------------------------- |
f_name: rb 12 |
file_info: db ' . .' |
active_panel db 0 |
;--------------------------------- |
sel_color = $00008080 |
FPC = 18 |
MEM_FOR_OS = $48300 |
MEM_USED = $4C300 |
read_area = $48000 |
fdata_size = $40000-$300 |
max_cnt = fdata_size/32 |
lstart = $8000+$300 |
rstart = lstart+max_cnt*16 |
f_path0 = $8000 |
f_path1 = $8000+$100 |
f_pathn = $8000+$200 |
align 4 |
sc system_colors |
fc mfar_colors |
I_END: |
; 16 bytes per entry: |
; -> 8 bytes - name |
; -> 3 bytes - extension |
; -> 1 byte - attributes |
; -> 4 bytes - block number |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/mfar/trunk/mfar.inc |
---|
0,0 → 1,147 |
oX = 6 |
oY = 22+3 |
tW = 6 |
tH = 9 |
VK_TAB = 9 |
VK_RETURN = 13 |
VK_ESCAPE = 27 |
VK_F10 = 49 |
VK_F5 = 54 |
VK_LEFT = 176 |
VK_DOWN = 177 |
VK_UP = 178 |
VK_RIGHT = 179 |
VK_HOME = 180 |
VK_END = 181 |
VK_PGDOWN = 183 |
VK_PGUP = 184 |
VK_CTRLF3 = 212 |
VK_CTRLF4 = 213 |
FA_READONLY = 00000001b |
FA_HIDDEN = 00000010b |
FA_SYSTEM = 00000100b |
FA_LABEL = 00001000b |
FA_FOLDER = 00010000b |
FA_ARCHIVED = 00100000b |
struc mfar_colors { |
.background dd $00000080 |
.default dd $0000FFFF |
.system dd $00008080 |
.selection dd $00009090 |
.folder dd $00FFFFFF |
.executable dd $0000FF00 |
.bitmap dd $00FF00FF |
.source dd $00FF0000 |
.path dd $00C0C0C0 |
.pathbg dd $00000000 |
.keys dd $00000000 |
.keysbg dd $00008080 |
} |
struct mfar_colors |
macro __mov reg,a { |
if ~a eq |
mov reg,a |
end if |
} |
macro mcall a,b,c,d,e,f { |
__mov eax,a |
__mov ebx,b |
__mov ecx,c |
__mov edx,d |
__mov esi,e |
__mov edi,f |
int $40 |
} |
macro mcall1 a,b1,b2,c,d,e,f { |
__mov eax,a |
if (~b1 eq)|(~b2 eq) |
mov ebx,(b1)*65536+(b2) |
end if |
__mov ecx,c |
__mov edx,d |
__mov esi,e |
__mov edi,f |
int $40 |
} |
macro mcall2 a,b1,b2,c1,c2,d,e,f { |
__mov eax,a |
if (~b1 eq)|(~b2 eq) |
mov ebx,(b1)*65536+(b2) |
end if |
if (~c1 eq)|(~c2 eq) |
mov ecx,(c1)*65536+(c2) |
end if |
__mov edx,d |
__mov esi,e |
__mov edi,f |
int $40 |
} |
macro sz name,[data] { |
common |
if used name |
label name |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro mmov reg,a1,a2 { |
mov reg,(a1)*65536+a2 |
} |
macro madd reg,a1,a2 { |
add reg,(a1)*65536+a2 |
} |
macro msub reg,a1,a2 { |
sub reg,(a1)*65536+a2 |
} |
macro jmpe reg,def,[val,lab] { |
forward |
cmp reg,val |
je lab |
common |
if ~def eq |
jmp def |
end if |
} |
macro func name { |
if used name |
label name |
} |
macro endf { |
end if |
} |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/mfar/trunk/readme.txt |
---|
0,0 → 1,80 |
; MFAR pre-alpha 8.1 |
; 2003-2004 (C) Semenyako Mike a.k.a. mike.dld |
; e-mail: mike.dld@tut.by |
;------------------------------------------------------------------------------ |
;///// ENGLISH //////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
---[ ATTENTION ]--------------------------------------------------------------- |
This MFAR version is far from being RELEASE! |
So, use it carefully, paying special attention to the new features. |
---[ ABOUT ]------------------------------------------------------------------- |
MFAR was intended as SYSTREE-alternative & at the same time as file-manager |
with well-known & handy interface for MenuetOS. It'll be look like FAR |
(farmanager.com) which i really like BTW. |
---[ FEATURES ]---------------------------------------------------------------- |
- displaying RD (left) & HD (right) file structure |
- color highlighting for files (depending on their extensions) |
- sotring (by name or extension) |
- selected file info: date, size |
- MeOS apps execution |
---[ TODO ]-------------------------------------------------------------------- |
- copying (moving), deleting files |
- disk selection |
- other sort types |
- not only apps execution |
- ... |
---[ HOTKEYS ]----------------------------------------------------------------- |
Up, Down, Left, Right, Home, End - if you worked in any DOS-based file- |
manager (NC, VC, DN, ...), even a few minutes, you may know that this |
keys direct the caret (light pen) |
F5 - copy !FILE! from one panel to another (in development) |
F10 - exit program |
Ctrl+F3 - sort by name |
Ctrl+F4 - sort by extension |
;------------------------------------------------------------------------------ |
;///// //////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
---[ ¨¬ ¨¥ ]---------------------------------------------------------------- |
âã ¢¥àá¨î MFAR ¨ª ª ¥«ì§ï áç¨â âì ५¨§®¬! |
à®£à ¬¬ 室¨âáï ¢ à §à ¡®âª¥ ¨ ï ®ç¥ì ᮦ «¥î ® ⮬, çâ® ¥ ¢ ᨫ å |
¯®ª çâ® ¯à¥¤áâ ¢¨âì ¬ ¯®«®æ¥ë© ä ©«-¬¥¥¤¦¥à, å®âï ¡ë ¯à¨¡«¨§¨â¥«ì® |
áà ¢¨¬ë© ¯® äãªæ¨® «ìë¬ ¢®§¬®¦®áâï¬ á «®£¨ç묨 ¯à®¥ªâ ¬¨ ¯®¤ *nix |
¨ *dows. |
---[ ¯à®£à ¬¬¥ ]------------------------------------------------------------- |
MFAR ¡ë« § ¤ã¬ ª ª «ìâ¥à ⨢ SYSTREE ¨ ®¤®¢à¥¬¥® ª ª ä ©«-¬¥¥¤¦¥à |
á® § ª®¬ë¬ ¨ 㤮¡ë¬ ¨â¥à䥩ᮬ ¯®¤ MenuetOS. § §¢ ¨ï ¬®¦® ¤®£ ¤ âìáï, |
çâ® ¢¥è¨© ¢¨¤ ¯à®£à ¬¬ë ¡ã¤¥â ¥ ®á®¡® ®â«¨ç âìáï ®â FAR' (farmanager.com), |
®ç¥ì, ªáâ â¨, ¬®î «î¡¨¬®£® ¨ 㢠¦ ¥¬®£® ¯à®¥ªâ . |
---[ ⮠ᤥ« ® ]------------------------------------------------------------- |
- ®â®¡à ¦¥¨¥ ä ©«®¢®© áâàãªâãàë ®¡à § (á«¥¢ ) ¨ (á¯à ¢ ) |
- ¯®¤á¢¥âª ¨¬¥ ä ©«®¢ à §ë¬¨ 梥⠬¨ (¢ § ¢¨á¨¬®á⨠®â ä®à¬ â ) |
- á®àâ¨à®¢ª (¯® ¨¬¥¨ ¨«¨ à áè¨à¥¨î) |
- à §¬¥à ¨ ¤ â ᮧ¤ ¨ï (¨§¬¥¥¨ï) ¤«ï ¢ë¤¥«¥®£® ä ©« |
- § ¯ã᪠¨á¯®«ï¥¬ëå ä ©«®¢ |
---[ â® å®â¥«®áì ¡ë ᤥ« âì ]------------------------------------------------- |
- ª®¯¨à®¢ ¨¥ (¯¥à¥¬¥é¥¨¥), 㤠«¥¨¥ ä ©«®¢ |
- ¢ë¡®à ªâ¨¢®£® ¤¨áª ¤«ï ¯ ¥«¥© |
- ¤à㣨¥ ¢¨¤ë á®àâ¨à®¢®ª |
- § ¯ã᪠¥ ⮫쪮 ¨á¯®«ï¥¬ëå ä ©«®¢ |
- ... |
---[ ®ç¥â ¨ï ª« ¢¨è ]-------------------------------------------------------- |
Up, Down, Left, Right, Home, End - ªâ® å®âï ¡ë à § à ¡®â « ¢ ®¢áª®¬ |
ä ©«-¬¥¥¤¦¥à¥ (NC, VC, DN, ...) § ¥â, çâ® á ¯®¬®éìî íâ¨å ª« ¢¨è ¬®¦® |
ã¯à ¢«ïâì ¯®«®¦¥¨¥¬ ªãàá®à (ᢥ⮢®£® ¯¥à ) |
F5 - ª®¯¨à®¢ âì ä ©« ¨§ ®¤®© ¯ ¥«¨ ¢ ¤àã£ãî (¢ à §à ¡®âª¥) |
F10 - ¢ë室 ¨§ ¯à®£à ¬¬ë |
Ctrl+F3 - á®àâ¨à®¢ âì ¯® ¨¬¥¨ |
Ctrl+F4 - á®àâ¨à®¢ âì ¯® à áè¨à¥¨î |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/rdfdel/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm rdfdel.asm rdfdel |
@pause |
/programs/fs/rdfdel/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm rdfdel.asm rdfdel |
@pause |
/programs/fs/rdfdel/trunk/macros.inc |
---|
0,0 → 1,266 |
; 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 |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b eq) |
mov reg,a |
end if |
} |
macro mcall a,b,c,d,e,f { ; mike.dld |
__mov eax,a |
__mov ebx,b |
__mov ecx,c |
__mov edx,d |
__mov esi,e |
__mov edi,f |
int 0x40 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
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 __regs) & (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 |
} |
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 |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/rdfdel/trunk/rdfdel.asm |
---|
0,0 → 1,232 |
; |
; FILE COPIER |
; |
; Compile with FASM for Menuet |
; |
use32 |
org 0x0 |
db 'MENUET00' ; 8 byte id |
dd 38 ; required os |
dd START ; program start |
dd I_END ; program image size |
dd 0x1000 ; required amount of memory |
dd 0x1000 |
dd 0 ; reserved=no extended header |
include "lang.inc" |
include "macros.inc" |
START: ; start of execution |
call draw_window ; at first, draw the window |
still: |
mov eax,10 ; wait here for event |
int 0x40 |
cmp eax,1 ; redraw request ? |
jz red |
cmp eax,2 ; key in buffer ? |
jz key |
cmp eax,3 ; button in buffer ? |
jz button |
jmp still |
red: ; redraw |
call draw_window |
jmp still |
key: ; key |
mov eax,2 ; just read it and ignore |
int 0x40 |
jmp still |
button: ; button |
mov eax,17 ; get id |
int 0x40 |
cmp ah,1 ; button id=1 ? |
jnz noclose |
mov eax,0xffffffff ; close this program |
int 0x40 |
noclose: |
cmp ah,3 ; delete ? |
jnz nodelete |
mov eax,32 |
mov ebx,destination |
int 0x40 |
jmp still |
nodelete: |
cmp ah,4 |
jz f2 |
jmp nof12 |
f2: |
mov [addr],dword destination |
mov [ya],dword 35 |
jmp rk |
rk: |
mov edi,[addr] |
mov al,' ' |
mov ecx,11 |
rep stosb |
call print_text |
mov edi,[addr] |
f11: |
mov eax,10 |
int 0x40 |
cmp eax,2 |
jz fbu |
jmp still |
fbu: |
mov eax,2 |
int 0x40 |
shr eax,8 |
cmp eax,8 |
jnz nobs |
cmp edi,[addr] |
jz f11 |
sub edi,1 |
mov [edi],byte 0 |
call print_text |
jmp f11 |
nobs: |
cmp eax,dword 31 |
jbe f11 |
cmp eax,dword 95 |
jb keyok |
sub eax,32 |
keyok: |
mov [edi],al |
call print_text |
add edi,1 |
mov esi,[addr] |
add esi,11 |
cmp esi,edi |
jnz f11 |
jmp still |
print_text: |
mov eax,13 |
mov ebx,109*65536+11*6 |
mov ecx,[ya] |
shl ecx,16 |
mov cx,8 |
mov edx,0xffffff |
int 0x40 |
mov eax,4 |
mov ebx,109*65536 |
add ebx,[ya] |
mov ecx,0x000000 |
mov edx,[addr] |
mov esi,11 |
int 0x40 |
ret |
nof12: |
jmp still |
; ********************************************* |
; ******* WINDOW DEFINITIONS AND DRAW ******** |
; ********************************************* |
draw_window: |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,1 ; 1, start of draw |
int 0x40 |
; DRAW WINDOW |
mov eax,0 ; function 0 : define and draw window |
mov ebx,100*65536+230 ; [x start] *65536 + [x size] |
mov ecx,100*65536+105 ; [y start] *65536 + [y size] |
mov edx,0x03ffffff ; color of work area RRGGBB |
int 0x40 |
; WINDOW LABEL |
mov eax,4 ; function 4 : write text to window |
mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
mov ecx,0x10ffffff ; color of text RRGGBB |
mov edx,header ; pointer to text beginning |
mov esi,header.len ; text length |
int 0x40 |
mov esi,0xbbbbbb |
mov eax,8 ; DELETE BUTTON |
mov ebx,20*65536+190 |
mov ecx,63*65536+15 |
mov edx,3 |
int 0x40 |
mov eax,8 |
mov ebx,200*65536+10 |
mov ecx,33*65536+10 |
mov edx,4 |
int 0x40 |
mov esi,destination |
mov edi,text+14 |
mov ecx,11 |
cld |
rep movsb |
mov ebx,25*65536+35 ; draw info text with function 4 |
mov ecx,0x0 |
mov edx,text |
mov esi,40 |
newline: |
mov eax,4 |
int 0x40 |
add ebx,16*2 |
add edx,40 |
cmp [edx],byte 'x' |
jnz newline |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,2 ; 2, end of draw |
int 0x40 |
ret |
; DATA AREA |
destination db 'EXAMPLE.ASM' |
addr dd 0x0 |
ya dd 0x0 |
text: |
db 'FILENAME : yyyyyyyyyyy ' |
db ' DELETE FROM RAMDISK ' |
db 'x' ; <- END MARKER, DONT DELETE |
header: |
db 'RAMDISK FILE DELETE' |
.len = $ - header |
I_END: |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/sysxtree/trunk/SYSTR12.GIF |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/fs/sysxtree/trunk/ascgl.inc |
---|
0,0 → 1,1385 |
lang equ ru |
; |
; Assembler |
; SMALL |
; CODE |
; Graphics |
; Libary |
; |
; Ver 0.18 By Pavlushin Evgeni (RUSSIA) |
; www.waptap@mail.ru |
;InfoList |
;0.01 LoadImage |
;0.02 SetBmp |
;0.03 Bmptoimg, Setimg ~01.03.2004 |
;0.04 Bug deleted, copyimg ~03.05.2004 |
;0.05 fullimg, collimg ~05.05.2004 |
;0.06 getimg ~09.05.2004 |
;0.07 convbmp ~13.05.2004 |
;0.08 fps ~14.05.2004 |
;0.09 drawfbox ~03.06.2004 |
;0.10 all macros optimized by halyavin, add at ~07.06.2004 |
;0.11 many macros optimized by halyavin, add at ~30.08.2004 |
;0.12 bmptoimg ~07.09.2004 |
;0.13 imgtoimg ~08.09.2004 |
;0.14 imgtoimg modify not brake bmp pict! ~09.09.2004 |
;0.15 giftoimg, giftoani ~10.09.2004 |
;0.16 setframe, rgbtobgr, setbmp deleted ~20.09.2004 |
;0.17 modification giftoimg, giftoani, getframeoff ~01.10.2004 |
;0.18 aframetoimg,aimgtoimg,frametoimg ~03.10.2004 |
aframetoimg_use_count=0 |
macro aframetoimg img, x, y, canvas,acol |
{ |
local loo,loo2,acolor |
aframetoimg_use_count=aframetoimg_use_count+1 |
if aframetoimg_use_count = 1 |
jmp end_aframetoimg_proc |
acolor dd 0 |
aframetoimg_proc: |
;getout coord |
mov [acolor],ebp |
mov edx,ebx ;img ;xsize |
movzx eax,word [edx] |
add eax,esi ;y cor |
; mov eax,esi ;y cor |
mul dword [ecx] ;canvas xsize |
add eax,edi ;x cor |
mov ebp,ebx ;img ;xsize |
movzx edx,word [ebp] |
add eax,edx |
mov ebp,eax |
shl eax,1 |
add ebp,eax |
add ebp,ecx ;canvas+8;start |
add ebp,8 |
;get img size |
add ebx,4 |
mov eax,ebx ;img ;xsize |
movzx esi,word [eax] |
movzx edi,word [eax+2] |
add ebx,4 |
mov edx,ebx ;img+8 |
loo2: |
push esi |
loo: |
;test on alpha color |
mov eax,[edx] |
shl eax,8 |
shr eax,8 |
cmp eax,[acolor] |
jne yx |
add edx,3 |
add ebp,3 |
jmp nx |
yx: |
mov al,byte [edx] |
mov byte [ebp],al |
inc ebp |
inc edx |
mov al,byte [edx] |
mov byte [ebp],al |
inc ebp |
inc edx |
mov al,byte [edx] |
mov byte [ebp],al |
inc ebp |
inc edx |
nx: |
dec esi |
jnz loo |
pop esi |
sub ebp,3 |
mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) |
sub eax,esi |
add ebp,eax |
shl eax,1 |
add ebp,eax |
add ebp,3 |
dec edi |
jnz loo2 |
ret |
end_aframetoimg_proc: |
end if |
push img |
push canvas |
push x |
push y |
push acol |
pop ebp |
pop esi |
pop edi |
pop ecx |
pop ebx |
call aframetoimg_proc |
} |
frametoimg_use_count=0 |
macro frametoimg img, x, y, canvas |
{ |
local loo,loo2 |
frametoimg_use_count=frametoimg_use_count+1 |
if frametoimg_use_count = 1 |
jmp end_frametoimg_proc |
frametoimg_proc: |
;getout coord |
mov edx,ebx ;img ;xsize |
movzx eax,word [edx] |
add eax,esi ;y cor |
; mov eax,esi ;y cor |
mul dword [ecx] ;canvas xsize |
add eax,edi ;x cor |
mov ebp,ebx ;img ;xsize |
movzx edx,word [ebp] |
add eax,edx |
mov ebp,eax |
shl eax,1 |
add ebp,eax |
add ebp,ecx ;canvas+8;start |
add ebp,8 |
;get img size |
add ebx,4 |
mov eax,ebx ;img ;xsize |
movzx esi,word [eax] |
movzx edi,word [eax+2] |
add ebx,4 |
mov edx,ebx ;img+8 |
loo2: |
push esi |
loo: |
mov al,byte [edx] |
mov byte [ebp],al |
inc ebp |
inc edx |
mov al,byte [edx] |
mov byte [ebp],al |
inc ebp |
inc edx |
mov al,byte [edx] |
mov byte [ebp],al |
inc ebp |
inc edx |
dec esi |
jnz loo |
pop esi |
sub ebp,3 |
mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) |
sub eax,esi |
add ebp,eax |
shl eax,1 |
add ebp,eax |
add ebp,3 |
dec edi |
jnz loo2 |
ret |
end_frametoimg_proc: |
end if |
push img |
push canvas |
push x |
push y |
pop esi |
pop edi |
pop ecx |
pop ebx |
call frametoimg_proc |
} |
aimgtoimg_use_count=0 |
macro aimgtoimg img, x, y, canvas,acol |
{ |
local loo,loo2,acolor |
aimgtoimg_use_count=aimgtoimg_use_count+1 |
if aimgtoimg_use_count = 1 |
jmp end_aimgtoimg_proc |
acolor dd 0 |
aimgtoimg_proc: |
;getout coord |
mov [acolor],ebp |
mov eax,esi ;y cor |
mul dword [ecx] ;canvas xsize |
add eax,edi ;x cor |
mov ebp,eax |
shl eax,1 |
add ebp,eax |
add ebp,ecx ;canvas+8;start |
add ebp,8 |
;get img size |
mov eax,ebx ;img ;xsize |
mov esi,[eax] |
add ebx,4 |
mov eax,ebx ; img+4 ;ysize |
mov edi,[eax] |
add ebx,4 |
mov edx,ebx ;img+8 |
loo2: |
push esi |
loo: |
;test on alpha color |
mov eax,[edx] |
shl eax,8 |
shr eax,8 |
cmp eax,[acolor] |
jne yx |
add edx,3 |
add ebp,3 |
jmp nx |
yx: |
mov al,byte [edx] |
mov byte [ebp],al |
inc ebp |
inc edx |
mov al,byte [edx] |
mov byte [ebp],al |
inc ebp |
inc edx |
mov al,byte [edx] |
mov byte [ebp],al |
inc ebp |
inc edx |
nx: |
dec esi |
jnz loo |
pop esi |
sub ebp,3 |
mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) |
sub eax,esi |
add ebp,eax |
shl eax,1 |
add ebp,eax |
add ebp,3 |
dec edi |
jnz loo2 |
ret |
end_aimgtoimg_proc: |
end if |
push img |
push canvas |
push x |
push y |
push acol |
pop ebp |
pop esi |
pop edi |
pop ecx |
pop ebx |
call aimgtoimg_proc |
} |
imgtoimg_use_count=0 |
macro imgtoimg img, x, y, canvas |
{ |
local loo,loo2 |
imgtoimg_use_count=imgtoimg_use_count+1 |
if imgtoimg_use_count = 1 |
jmp end_imgtoimg_proc |
imgtoimg_proc: |
;getout coord |
mov eax,esi ;y cor |
mul dword [ecx] ;canvas xsize |
add eax,edi ;x cor |
mov ebp,eax |
shl eax,1 |
add ebp,eax |
add ebp,ecx ;canvas+8;start |
add ebp,8 |
;get img size |
mov eax,ebx ;img ;xsize |
mov esi,[eax] |
add ebx,4 |
mov eax,ebx ; img+4 ;ysize |
mov edi,[eax] |
add ebx,4 |
mov edx,ebx ;img+8 |
loo2: |
push esi |
loo: |
mov al,byte [edx] |
mov byte [ebp],al |
inc ebp |
inc edx |
mov al,byte [edx] |
mov byte [ebp],al |
inc ebp |
inc edx |
mov al,byte [edx] |
mov byte [ebp],al |
inc ebp |
inc edx |
dec esi |
jnz loo |
pop esi |
sub ebp,3 |
mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) |
sub eax,esi |
add ebp,eax |
shl eax,1 |
add ebp,eax |
add ebp,3 |
dec edi |
jnz loo2 |
ret |
end_imgtoimg_proc: |
end if |
push img |
push canvas |
push x |
push y |
pop esi |
pop edi |
pop ecx |
pop ebx |
call imgtoimg_proc |
} |
;DrawBox |
macro drawfbox x,y,xs,ys,color |
{ |
wordstoreg ebx,x,xs ;x*65536+xs |
wordstoreg ecx,y,ys ;y*65536+ys |
mov edx,color |
mov eax,13 |
int 0x40 |
} |
; FPS - Set Frame Per Second Display |
fps_show_frequency=40 |
macro fps x,y,color,delcolor |
{ |
local spdat,savetime,new_time,fps,fps_cntr,out_fps,new_time,ttt |
local no_out_fps |
jmp spdat |
savetime dd 0 |
fps_cntr dd 0 |
fps dd 0 |
ttt dd 0 |
spdat: |
get_time: |
mov eax,3 |
int 0x40 |
cmp eax,[savetime] |
jne new_time |
inc [fps_cntr] |
cmp dword [ttt],0 |
je out_fps |
dec dword [ttt] |
jmp no_out_fps |
new_time: |
mov [savetime],eax |
mov ebx,[fps_cntr] |
mov [fps],ebx |
mov [fps_cntr],0 |
out_fps: |
if ~(delcolor eq ) |
mov ebx,x*65536+30 |
mov ecx,y*65536+7 |
mov edx,delcolor |
mov eax,13 |
int 0x40 |
end if |
mov dword [ttt],fps_show_frequency |
mov eax,47 |
mov ebx,5*65536 |
; mov bl,0 |
mov edx,x*65536+y |
mov esi,color |
mov ecx,[fps] |
int 0x40 |
no_out_fps: |
} |
; COLLIMG - Collusion image's |
_1dbounce_count=0; |
macro collimg img1_off,x1,y1,img2_off,x2,y2,otv |
{ |
local bounce,exit,anot,bc,nbc |
mov esi,[img1_off] ;xs1 |
mov edi,[img2_off] ;ys2 |
mov eax,x1 ; |
mov ebx,x2 ; |
call _1dbounce |
mov edx,ecx |
mov esi,[img1_off+4] ;ys1 |
mov edi,[img2_off+4] ;ys2 |
mov eax,y1 ; |
mov ebx,y2 ; |
call _1dbounce |
add edx,ecx |
cmp edx,2 |
je bounce |
mov otv,0 |
jmp exit |
_1dbounce_count=_1dbounce_count+1 |
if _1dbounce_count = 1 |
_1dbounce: |
cmp ebx,eax |
jb anot |
add eax,esi |
cmp eax,ebx |
jbe nbc |
bc: |
mov ecx,1 |
ret |
anot: |
add ebx,edi |
cmp ebx,eax |
ja bc |
nbc: |
xor ecx,ecx |
ret |
end if |
bounce: |
mov otv,1 |
exit: |
} |
macro rgbtobgr image |
{ |
local loo |
mov eax,[image] |
mul dword [image+4] |
mov ecx,eax |
mov esi,image+8 |
; add esi,8 |
loo: |
mov al,[esi] |
mov bl,[esi+2] |
mov [esi],bl |
mov [esi+2],al |
add esi,3 |
dec ecx |
jnz loo |
} |
macro setimg x , y ,arg3 |
{ |
mov eax,7 |
mov ebx,arg3 |
add ebx,8 |
mov cx,[arg3] |
shl ecx,16 |
add cx,[arg3+4] |
; wordstoreg ecx,[arg3],[arg3+4] |
wordstoreg edx, x , y ;arg1*65536+arg2 |
int 0x40 |
} |
macro setframe x , y ,arg3 |
{ |
mov eax,7 |
mov ebx,arg3 |
add ebx,8 |
wordstoreg edx, x , y ;arg1*65536+arg2 |
add edx,dword [arg3] |
mov ecx,dword [arg3+4] |
int 0x40 |
} |
macro getimg imgsrc,x,y,xs,ys,imgdest |
{ |
local cyc |
if xs eqtype 0 |
mov dword [imgdest],xs |
else |
mov eax,xs |
mov dword [imgdest],eax |
end if |
if ys eqtype 0 |
mov dword [imgdest+4],ys |
else |
mov eax,ys |
mov dword [imgdest+4],eax |
end if |
mov eax,dword [imgsrc] ;getx size |
; lea ecx,[eax+2*eax] |
mov ecx,eax |
shl ecx,1 |
add ecx,eax |
mov ebx,y |
mul ebx |
add eax,x |
mov edx,ecx |
lea eax,[eax+2*eax] ;eax=offset on imsrc |
; mov ebp,eax |
; shl eax,1 |
; add eax,ebp |
mov ecx,xs |
mov ebx,ys |
mov edi,8+imgdest |
lea esi,[eax+8+imgsrc] |
; mov esi,eax |
; add esi,8 |
; add esi,imgsrc |
cld |
cyc: |
movsw |
movsb |
dec ecx |
jne cyc |
add esi,edx |
mov ecx,xs |
sub esi,ecx |
sub esi,ecx |
sub esi,ecx |
dec ebx |
jne cyc |
} |
macro copyimg img2_off,img1_off |
{ |
mov eax,dword [img1_off] |
mov ebx,dword [img1_off+4] |
mul ebx |
lea ecx,[eax+2*eax] |
lea esi,[img1_off+8] |
lea edi,[img2_off+8] |
cld |
rep movsb |
} |
macro fullimg img_off,xs,ys,color |
{ |
local cop |
mov eax,xs |
mov ebx,ys |
mov dword [img_off],eax |
mov dword [img_off+4],ebx |
mul ebx |
lea ebp,[eax+2*eax] |
mov esi,color |
if color eqtype 0 |
mov ecx,color/65536 |
else |
mov ecx,esi |
shr ecx,16 |
end if |
xor edi,edi |
cop: |
mov word [img_off+8+edi],si |
add edi,2 |
mov byte [img_off+8+edi],cl |
inc edi |
cmp edi,ebp |
jne cop |
} |
; number of frame in ecx |
; callculatin offset of raw data |
macro getframeoff num_of_frame,offset_of_animation,offset_of_frame |
{ |
local loo,setpic |
mov ebp,num_of_frame ;ecx |
mov esi,offset_of_animation;Image |
loo: |
cmp ebp,0 |
je setpic |
movzx eax,word [esi+4] |
movzx ebx,word [esi+6] |
mul ebx ;dword [esi+4] |
mov ebx,3 |
mul ebx |
add eax,8 |
add esi,eax |
dec ebp |
jmp loo |
setpic: |
mov dword offset_of_frame,esi |
} |
; BMPTOIMG -Convert BMP format TO IMG format |
; (SYNTAX) BMPTOIMG BMP_source_offset,IMG_dest_ofset |
; (SAMPLE) View BMPLS.ASM sample. |
; ( NOTE ) This is macros is not brake bmp structure! Tested in 32,8,4 bits |
bmptoimg_data_area_count=0 |
macro bmptoimg bmp_load_area,img_dest_area |
{ |
local fileinfo,string,end_bmp,nodix |
local converttable,noaddelem,nextbit,convert1bpp,convert4bpp,convert2 |
local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize |
;local qwe,bmpfn |
; convert: |
movzx eax,word [bmp_load_area+28] |
mul dword [bmp_load_area+18] |
add eax,31 |
shr eax,5 |
mov dword [bmptoimg_data_area_dwps],eax ;dwps-doublewords per string |
shl eax,2 |
mov dword [bmptoimg_data_area_bps],eax ;bps-bytes per string |
cmp dword [bmp_load_area+34],0 |
jne yespicsize ;if picture size is defined |
mul dword [bmp_load_area+22] |
mov dword [bmp_load_area+34],eax |
yespicsize: |
mov ebp,img_dest_area+8 |
mov eax,bmp_load_area |
mov ebx,eax |
add ebx, [bmp_load_area+2];file size |
inc ebx |
mov dword [bmptoimg_soi],ebx ;soi-start of image area for drawing |
add eax, [bmp_load_area+10] |
mov dword [bmptoimg_data_area_sop],eax ;sop-start of picture in file |
add eax, [bmp_load_area+34] |
mov dword [bmptoimg_data_area_eop],eax ;eop-end of picture in file |
mov eax, [bmp_load_area+18] |
lea eax,[eax+2*eax] ;3x pixels in eax |
mov edi,dword [bmptoimg_soi] ;initializing |
mov esi,dword [bmptoimg_data_area_eop] |
sub esi,dword [bmptoimg_data_area_bps] |
nextstring: |
push edi |
push ebp |
cmp word [bmp_load_area+28],24 |
jne convertno32 |
mov edi,ebp |
mov ecx,[bmptoimg_data_area_dwps] |
cld |
rep movsd |
convert1: |
pop ebp |
pop edi |
sub esi,dword [bmptoimg_data_area_bps] |
sub esi,dword [bmptoimg_data_area_bps] |
cmp esi,dword [bmptoimg_data_area_sop] |
jb end_bmp |
add edi,eax |
add ebp,eax |
jmp nextstring |
convertno32: |
mov ebx,bmp_load_area |
add ebx, [bmp_load_area+14] |
add ebx,14 ;start of color table |
push esi |
add esi,dword [bmptoimg_data_area_bps] |
mov dword [bmptoimg_data_area_eos],esi |
pop esi |
nextelem: |
push eax |
movzx eax,byte [esi] |
cmp word [bmp_load_area+28],4 |
je convert4bpp |
cmp word [bmp_load_area+28],1 |
je convert1bpp |
call converttable |
convert2: |
pop eax |
inc esi |
cmp esi,dword [bmptoimg_data_area_eos] |
jae convert1 |
add edi,3 |
add ebp,3 |
jmp nextelem |
convert4bpp: |
shl ax,4 |
shr al,4 |
push ax |
movzx eax,ah |
call converttable |
add edi,3 |
add ebp,3 |
pop ax |
movzx eax,al |
call converttable |
jmp convert2 |
convert1bpp: |
mov ecx,eax |
mov edx,7 |
nextbit: |
xor eax,eax |
bt ecx,edx |
jnc noaddelem |
inc eax |
noaddelem: |
push edx |
call converttable |
pop edx |
dec edx |
js convert2 |
add edi,3 |
add ebp,3 |
jmp nextbit |
converttable: |
shl eax,2 |
add eax,ebx |
mov edx, dword [eax] |
; mov dword [edi],edx |
mov [ebp],edx |
ret |
bmptoimg_data_area_count=bmptoimg_data_area_count+1 |
if bmptoimg_data_area_count = 1 |
; DATA AREA |
bmptoimg_soi dd 0 |
bmptoimg_data_area_bps dd 0 |
bmptoimg_data_area_dwps dd 0 |
bmptoimg_data_area_sop dd 0 |
bmptoimg_data_area_eop dd 0 |
bmptoimg_data_area_eos dd 0 |
end if |
end_bmp: |
mov eax,dword [bmp_load_area+18] |
mov ebx,dword [bmp_load_area+22] |
mov dword [img_dest_area],eax |
mov dword [img_dest_area+4],ebx |
} |
; For convert RGB to BGR |
COLOR_ORDER equ MENUETOS |
macro giftoani gifsrc,imgsrc,num_of_frames |
{ |
local hasharea, ReadGIF, nextblock,_null |
local globalColor, img_count, cur_info, img_start |
local codesize, compsize, bit_count, CC, EOI, Palette |
local block_ofs, table_ptr, gifmacend |
local no_gc, block_skip, no_comm, noextblock, uselocal |
local setPal, filltable, reinit, cycle, zadd, noinc |
local notintable, er, zend, nxt, continue, ex, Gif_skipmap |
local Gif_get_sym, shift, nextbl, noblock, loop1, exx |
local Gif_output, next, loop2 |
_null equ 0x1000 ; 0x1000 |
; jmp sss |
; if defined gif_hash_offset |
; else |
; hasharea: |
; times 4096 dd 0 ;4096 |
; end if |
;sss: |
mov esi,gifsrc ;ª § ⥫ì ä ¨« ¢ ¯ ¬ï⨠|
mov edi,imgsrc ;ª § ⥫ì ᯨ᮪ ª à⨮ª |
if defined gif_hash_offset |
mov eax,gif_hash_offset ; ¡®ç ï ®¡« áâì ¬¨¨¬ã¬ 4096*4 ¡ ©â |
else |
mov eax,hasharea ; ¡®ç ï ®¡« áâì ¬¨¨¬ã¬ 4096*4 ¡ ©â |
end if |
call ReadGIF |
push ecx |
pop dword num_of_frames |
jmp gifmacend |
if defined gif_hash_offset |
else |
hasharea: |
times 4096 dd 0 ;4096 |
end if |
ReadGIF: |
push esi edi |
mov [table_ptr],eax |
mov [cur_info],edi |
xor eax,eax |
mov [globalColor],eax |
mov [img_count],eax |
inc eax |
cmp dword[esi],'GIF8' |
jne er ; signature |
mov ecx,[esi+0xa] |
inc eax |
add esi,0xd |
mov edi,esi |
bt ecx,7 |
jnc nextblock |
mov [globalColor],esi |
call Gif_skipmap |
nextblock: |
cmp byte[edi],0x21 |
jne noextblock |
inc edi |
cmp byte[edi],0xf9 ; Graphic Control Ext |
jne no_gc |
add edi,7 |
jmp nextblock |
no_gc: |
cmp byte[edi],0xfe ; Comment Ext |
jne no_comm |
inc edi |
block_skip: |
movzx eax,byte[edi] |
lea edi,[edi+eax+1] |
cmp byte[edi],0 |
jnz block_skip |
inc edi |
jmp nextblock |
no_comm: |
cmp byte[edi],0xff ; Application Ext |
jne nextblock |
add edi,13 |
jmp block_skip |
noextblock: |
cmp byte[edi],0x2c ; image beginning |
jne er |
inc [img_count] |
inc edi |
mov esi,[cur_info] |
xchg esi,edi |
movsd |
movsd |
push edi |
movzx ecx,word[esi] |
inc esi |
bt ecx,7 |
jc uselocal |
push [globalColor] |
mov edi,esi |
jmp setPal |
uselocal: |
call Gif_skipmap |
push esi |
setPal: |
movzx ecx,byte[edi] |
inc ecx |
mov [codesize],ecx |
dec ecx |
pop [Palette] |
lea esi,[edi+1] |
mov edi,[table_ptr] |
xor eax,eax |
cld |
lodsb ; eax - block_count |
add eax,esi |
mov [block_ofs],eax |
mov [bit_count],8 |
mov eax,1 |
shl eax,cl |
mov [CC],eax |
inc eax |
mov [EOI],eax |
lea ecx,[eax-1] |
mov eax, _null shl 16 |
filltable: |
stosd |
inc eax |
loop filltable |
pop edi |
mov [img_start],edi |
reinit: |
mov edx,[EOI] |
inc edx |
push [codesize] |
pop [compsize] |
call Gif_get_sym |
cmp eax,[CC] |
je reinit |
call Gif_output |
cycle: |
movzx ebx,ax |
call Gif_get_sym |
cmp eax,edx |
jae notintable |
cmp eax,[CC] |
je reinit |
cmp eax,[EOI] |
je zend |
call Gif_output |
zadd: |
push eax |
mov eax,[table_ptr] |
mov [eax+edx*4],ebx |
pop eax |
cmp edx,0xFFF |
jae cycle |
inc edx |
bsr ebx,edx |
cmp ebx,[compsize] |
jne noinc |
inc [compsize] |
noinc: |
jmp cycle |
notintable: |
push eax |
mov eax,ebx |
call Gif_output |
push ebx |
movzx eax,bx |
call Gif_output |
pop ebx eax |
jmp zadd |
er: |
pop edi |
jmp ex |
zend: |
; mov eax,[.cur_info] ; skip offset to next frame |
; mov [eax],edi |
mov [cur_info],edi |
add esi,2 |
xchg esi,edi |
nxt: |
cmp byte[edi],0 |
jnz continue |
inc edi |
jmp nxt |
continue: |
cmp byte[edi],0x3b ;read next frame |
jne nextblock |
xor eax,eax |
stosd |
mov ecx,[img_count] |
ex: |
pop edi esi |
ret |
Gif_skipmap: |
; in: ecx - image descriptor, esi - pointer to colormap |
; out: edi - pointer to area after colormap |
and ecx,111b |
inc ecx ; color map size |
mov ebx,1 |
shl ebx,cl |
lea ebx,[ebx*2+ebx] |
lea edi,[esi+ebx] |
ret |
Gif_get_sym: |
mov ecx,[compsize] |
push ecx |
xor eax,eax |
shift: |
ror byte[esi],1 |
rcr eax,1 |
dec [bit_count] |
jnz loop1 |
inc esi |
cmp esi,[block_ofs] |
jb noblock |
push eax |
xor eax,eax |
lodsb |
test eax,eax |
jnz nextbl |
mov eax,[EOI] |
sub esi,2 |
add esp,8 |
jmp exx |
nextbl: |
add eax,esi |
mov [block_ofs],eax |
pop eax |
noblock: |
mov [bit_count],8 |
loop1: |
loop shift |
pop ecx |
rol eax,cl |
exx: |
xor ecx,ecx |
ret |
Gif_output: |
push esi eax edx |
mov edx,[table_ptr] |
next: |
push word[edx+eax*4] |
mov ax,word[edx+eax*4+2] |
inc ecx |
cmp ax,_null |
jnz next |
shl ebx,16 |
mov bx,[esp] |
loop2: |
pop ax |
lea esi,[eax+eax*2] |
add esi,[Palette] |
if COLOR_ORDER eq MENUETOS |
mov esi,[esi] |
bswap esi |
shr esi,8 |
mov [edi],esi |
add edi,3 |
else |
movsw |
movsb |
end if |
loop loop2 |
pop edx eax esi |
ret |
globalColor dd 1 |
img_count dd 1 |
cur_info dd 1 ; image table pointer |
img_start dd 1 |
codesize dd 1 |
compsize dd 1 |
bit_count dd 1 |
CC dd 1 |
EOI dd 1 |
Palette dd 1 |
block_ofs dd 1 |
table_ptr dd 1 |
gifmacend: |
} |
macro giftoimg gifsrc,imgsrc |
{ |
local hasharea, ReadGIF, nextblock,_null |
local globalColor, img_count, cur_info, img_start |
local codesize, compsize, bit_count, CC, EOI, Palette |
local block_ofs, table_ptr, gifmacend |
local no_gc, block_skip, no_comm, noextblock, uselocal |
local setPal, filltable, reinit, cycle, zadd, noinc |
local notintable, er, zend, nxt, continue, ex, Gif_skipmap |
local Gif_get_sym, shift, nextbl, noblock, loop1, exx |
local Gif_output, next, loop2 |
_null fix 0x1000 ; 0x1000 |
mov esi,gifsrc ;ª § ⥫ì ä ¨« ¢ ¯ ¬ï⨠|
mov edi,imgsrc ;ª § ⥫ì ᯨ᮪ ª à⨮ª |
if defined gif_hash_offset |
mov eax,gif_hash_offset ; ¡®ç ï ®¡« áâì ¬¨¨¬ã¬ 4096*4 ¡ ©â |
else |
mov eax,hasharea ; ¡®ç ï ®¡« áâì ¬¨¨¬ã¬ 4096*4 ¡ ©â |
end if |
call ReadGIF |
jmp gifmacend |
if defined gif_hash_offset |
else |
hasharea: |
times 4096 dd 0 ;4096 |
end if |
ReadGIF: |
push esi edi |
mov [table_ptr],eax |
mov [cur_info],edi |
xor eax,eax |
mov [globalColor],eax |
mov [img_count],eax |
inc eax |
cmp dword[esi],'GIF8' |
jne er ; signature |
mov ecx,[esi+0xa] |
inc eax |
add esi,0xd |
mov edi,esi |
bt ecx,7 |
jnc nextblock |
mov [globalColor],esi |
call Gif_skipmap |
nextblock: |
cmp byte[edi],0x21 |
jne noextblock |
inc edi |
cmp byte[edi],0xf9 ; Graphic Control Ext |
jne no_gc |
add edi,7 |
jmp nextblock |
no_gc: |
cmp byte[edi],0xfe ; Comment Ext |
jne no_comm |
inc edi |
block_skip: |
movzx eax,byte[edi] |
lea edi,[edi+eax+1] |
cmp byte[edi],0 |
jnz block_skip |
inc edi |
jmp nextblock |
no_comm: |
cmp byte[edi],0xff ; Application Ext |
jne nextblock |
add edi,13 |
jmp block_skip |
noextblock: |
cmp byte[edi],0x2c ; image beginning |
jne er |
inc [img_count] |
inc edi |
mov esi,[cur_info] |
xchg esi,edi |
; movsd |
; movsd |
mov bp,word[esi+4] |
movzx ebx,bp |
mov [edi],ebx |
mov bp,word[esi+6] |
movzx ebx,bp |
mov [edi+4],ebx |
add edi,8 |
add esi,8 |
push edi |
movzx ecx,word[esi] |
inc esi |
bt ecx,7 |
jc uselocal |
push [globalColor] |
mov edi,esi |
jmp setPal |
uselocal: |
call Gif_skipmap |
push esi |
setPal: |
movzx ecx,byte[edi] |
inc ecx |
mov [codesize],ecx |
dec ecx |
pop [Palette] |
lea esi,[edi+1] |
mov edi,[table_ptr] |
xor eax,eax |
cld |
lodsb ; eax - block_count |
add eax,esi |
mov [block_ofs],eax |
mov [bit_count],8 |
mov eax,1 |
shl eax,cl |
mov [CC],eax |
inc eax |
mov [EOI],eax |
lea ecx,[eax-1] |
mov eax, _null shl 16 |
filltable: |
stosd |
inc eax |
loop filltable |
pop edi |
mov [img_start],edi |
reinit: |
mov edx,[EOI] |
inc edx |
push [codesize] |
pop [compsize] |
call Gif_get_sym |
cmp eax,[CC] |
je reinit |
call Gif_output |
cycle: |
movzx ebx,ax |
call Gif_get_sym |
cmp eax,edx |
jae notintable |
cmp eax,[CC] |
je reinit |
cmp eax,[EOI] |
je zend |
call Gif_output |
zadd: |
push eax |
mov eax,[table_ptr] |
mov [eax+edx*4],ebx |
pop eax |
cmp edx,0xFFF |
jae cycle |
inc edx |
bsr ebx,edx |
cmp ebx,[compsize] |
jne noinc |
inc [compsize] |
noinc: |
jmp cycle |
notintable: |
push eax |
mov eax,ebx |
call Gif_output |
push ebx |
movzx eax,bx |
call Gif_output |
pop ebx eax |
jmp zadd |
er: |
pop edi |
jmp ex |
zend: |
; mov eax,[.cur_info] ; skip offset to next frame |
; mov [eax],edi |
mov [cur_info],edi |
add esi,2 |
xchg esi,edi |
nxt: |
cmp byte[edi],0 |
jnz continue |
inc edi |
jmp nxt |
continue: |
; cmp byte[edi],0x3b ;read next frame |
; jne nextblock |
xor eax,eax |
stosd |
mov ecx,[img_count] |
ex: |
pop edi esi |
ret |
Gif_skipmap: |
; in: ecx - image descriptor, esi - pointer to colormap |
; out: edi - pointer to area after colormap |
and ecx,111b |
inc ecx ; color map size |
mov ebx,1 |
shl ebx,cl |
lea ebx,[ebx*2+ebx] |
lea edi,[esi+ebx] |
ret |
Gif_get_sym: |
mov ecx,[compsize] |
push ecx |
xor eax,eax |
shift: |
ror byte[esi],1 |
rcr eax,1 |
dec [bit_count] |
jnz loop1 |
inc esi |
cmp esi,[block_ofs] |
jb noblock |
push eax |
xor eax,eax |
lodsb |
test eax,eax |
jnz nextbl |
mov eax,[EOI] |
sub esi,2 |
add esp,8 |
jmp exx |
nextbl: |
add eax,esi |
mov [block_ofs],eax |
pop eax |
noblock: |
mov [bit_count],8 |
loop1: |
loop shift |
pop ecx |
rol eax,cl |
exx: |
xor ecx,ecx |
ret |
Gif_output: |
push esi eax edx |
mov edx,[table_ptr] |
next: |
push word[edx+eax*4] |
mov ax,word[edx+eax*4+2] |
inc ecx |
cmp ax,_null |
jnz next |
shl ebx,16 |
mov bx,[esp] |
loop2: |
pop ax |
lea esi,[eax+eax*2] |
add esi,[Palette] |
if COLOR_ORDER eq MENUETOS |
mov esi,[esi] |
bswap esi |
shr esi,8 |
mov [edi],esi |
add edi,3 |
else |
movsw |
movsb |
end if |
loop loop2 |
pop edx eax esi |
ret |
globalColor dd 1 |
img_count dd 1 |
cur_info dd 1 ; image table pointer |
img_start dd 1 |
codesize dd 1 |
compsize dd 1 |
bit_count dd 1 |
CC dd 1 |
EOI dd 1 |
Palette dd 1 |
block_ofs dd 1 |
table_ptr dd 1 |
gifmacend: |
} |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/sysxtree/trunk/ascl.inc |
---|
0,0 → 1,838 |
lang equ ru ; ru en fr ge fi |
; |
; Assembler |
; SMALL |
; CODE |
; Libary |
; |
; Ver 0.14 By Pavlushin Evgeni (RUSSIA) |
; www.waptap@mail.ru |
;Please compile aplications on FASM ver1.54 or higer!!! |
;InfoList |
;0.01 scank,putpix,puttxt |
;0.02 label,random,colors |
;0.03 window,startwd,endwd,attributes |
;0.04 close,delay,scevent ~30.04.2004 |
;0.05 small random, ~04.05.2004 |
;0.06 wtevent ~09.05.2004 |
;0.07 timeevent ~23.05.2004 |
;0.08 txtput ~14.06.2004 |
;0.09 opendialog,savedialog ~20.06.2004 |
;0.10 wordstoreg by halyavin, add at ~30.08.2004 |
; random bug deleted eax is use. |
;0.11 loadfile from me +puttxt bug del ~07.09.2004 |
;0.12 open/save dialog ~13.09.2004 |
;0.13 dialogs bugs deleted |
;0.14 drawlbut ~03.10.2004 |
; LOADFILE |
; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area |
; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area |
macro loadfile file_name,file_load_area,file_temp_area |
{ |
local open,fileinfo,string |
jmp open |
fileinfo: |
dd 0 |
dd 0 |
dd 1 |
dd file_load_area |
dd file_temp_area |
string: |
db file_name,0 |
open: |
mov dword [fileinfo+8],1 ; how many blocks to read (1) |
mov eax,58 |
mov ebx,fileinfo |
int 0x40 |
mov eax,[file_load_area+2] |
shr eax,9 ; ¯®¤¥«¨¬ 512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢ |
inc eax |
mov dword [fileinfo+8],eax |
mov eax,58 |
mov ebx,fileinfo |
int 0x40 |
} |
macro wordstoreg reg,hiword,loword |
{ |
if hiword eqtype 0 & loword eqtype 0 |
mov reg,(hiword)*65536+(loword) |
else if hiword eqtype 12 & loword eqtype eax |
mov reg,(hiword)*65536 |
add reg,loword |
else if hiword eqtype 0 & loword eqtype [123] |
mov reg,(hiword)*65536 |
add reg,loword |
else if (hiword eq ) & (loword eq ) |
else |
mov reg,hiword |
shl reg,16 |
add reg,loword |
end if |
} |
; DRAW BUTTON with label |
macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor |
{ |
local asd,lab |
jmp asd |
lab db text ;arg label |
asd: |
wordstoreg ebx,x,xs |
wordstoreg ecx,y,ys |
mov edx,id |
mov esi,bcolor |
mov eax,8 |
int 0x40 |
mov eax,asd-lab ;calc size |
mov ebx,6 |
mul ebx |
mov esi,eax |
mov eax,xs |
sub eax,esi |
shr eax,1 |
add eax,x |
mov edx,ys |
sub edx,7 |
shr edx,1 |
add edx,y |
mov ebx,eax |
shl ebx,16 |
add ebx,edx |
mov ecx,tcolor ;arg4 color |
mov edx,lab |
mov esi,asd-lab ;calc size |
mov eax,4 |
int 0x40 |
} |
macro opendialog redproc,openoff,erroff,path |
{ |
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc |
local run_fileinfo, param |
local getmesloop, loox, mred, mkey, mbutton, mgetmes |
local dlg_is_work, ready, procinfo |
; |
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
; |
cld |
;; mov esi,path |
mov edi,path |
mov eax,0 |
mov ecx,200 |
rep stosb |
;mov [get_loops],0 |
mov [dlg_pid_get],0 |
; Get my PID in dec format 4 bytes |
mov eax,9 |
mov ebx,procinfo |
mov ecx,-1 |
int 0x40 |
; convert eax bin to param dec |
mov eax,dword [procinfo+30] ;offset of myPID |
mov edi,param+4-1 ;offset to 4 bytes |
mov ecx,4 |
mov ebx,10 |
cld |
new_d: |
xor edx,edx |
div ebx |
add dl,'0' |
mov [edi],dl |
dec edi |
loop new_d |
; wirite 1 byte space to param |
mov [param+4],byte 32 ;Space for next parametr |
; and 1 byte type of dialog to param |
mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) |
; |
; STEP2 prepare IPC area for get messages |
; |
; prepare IPC area |
mov [path],dword 0 |
mov [path+4],dword 8 |
; define IPC memory |
mov eax,60 |
mov ebx,1 ; define IPC |
mov ecx,path ; offset of area |
mov edx,150 ; size 150 bytes |
int 0x40 |
; change wanted events list 7-bit IPC event |
mov eax,40 |
mov ebx,01000111b |
int 0x40 |
; |
; STEP 3 run SYSTEM XTREE with parameters |
; |
mov eax,58 |
mov ebx,run_fileinfo |
int 0x40 |
call redproc |
mov [get_loops],0 |
getmesloop: |
mov eax,23 |
mov ebx,50 ;0.5 sec |
int 0x40 |
cmp eax,1 |
je mred |
cmp eax,2 |
je mkey |
cmp eax,3 |
je mbutton |
cmp eax,7 |
je mgetmes |
; Get number of procces |
mov ebx,procinfo |
mov ecx,-1 |
mov eax,9 |
int 0x40 |
mov ebp,eax |
loox: |
mov eax,9 |
mov ebx,procinfo |
mov ecx,ebp |
int 0x40 |
mov eax,[DLGPID] |
cmp [procinfo+30],eax ;IF Dialog find |
je dlg_is_work ;jmp to dlg_is_work |
dec ebp |
jnz loox |
jmp erroff |
dlg_is_work: |
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated |
je erroff ;TESTODP2 terminated too |
cmp [dlg_pid_get],dword 1 |
je getmesloop |
inc [get_loops] |
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
jae erroff |
jmp getmesloop |
mred: |
call redproc |
jmp getmesloop |
mkey: |
mov eax,2 |
int 0x40 ; read (eax=2) |
jmp getmesloop |
mbutton: |
mov eax,17 ; get id |
int 0x40 |
cmp ah,1 ; button id=1 ? |
jne getmesloop |
mov eax,-1 ; close this program |
int 0x40 |
mgetmes: |
; If dlg_pid_get then second message get jmp to still |
cmp [dlg_pid_get],dword 1 |
je ready |
; First message is number of PID SYSXTREE dialog |
; convert PID dec to PID bin |
movzx eax,byte [path+16] |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+1] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+2] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+3] |
add eax,ebx |
sub eax,48 |
mov [DLGPID],eax |
; Claear and prepare IPC area for next message |
mov [path],dword 0 |
mov [path+4],dword 8 |
mov [path+8],dword 0 |
mov [path+12],dword 0 |
mov [path+16],dword 0 |
; Set dlg_pid_get for get next message |
mov [dlg_pid_get],dword 1 |
call redproc ;show DLG_PID |
jmp getmesloop |
ready: |
; |
; The second message get |
; Second message is 100 bytes path to SAVE/OPEN file |
; shl path string on 16 bytes |
; |
cld |
mov esi,path+16 |
mov edi,path |
mov ecx,200 |
rep movsb |
mov [edi],byte 0 |
jmp openoff |
; DATA AREA |
get_loops dd 0 |
dlg_pid_get dd 0 |
DLGPID dd 0 |
param: |
dd 0 ; My dec PID |
dd 0,0 ; Type of dialog |
run_fileinfo: |
dd 16 |
dd 0 |
dd param |
dd 0 |
dd procinfo ; 0x10000 |
;run_filepath |
db '/RD/1/SYSXTREE',0 |
procinfo: |
times 256 db 0 |
} |
macro savedialog redproc,openoff,erroff,path |
{ |
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc |
local run_fileinfo, run_filepath, param |
local getmesloop, loox, mred, mkey, mbutton, mgetmes |
local dlg_is_work, ready, procinfo |
; |
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
; |
cld |
;; mov esi,path |
mov edi,path |
mov eax,0 |
mov ecx,200 |
rep stosb |
;mov [get_loops],0 |
mov [dlg_pid_get],0 |
; Get my PID in dec format 4 bytes |
mov eax,9 |
mov ebx,procinfo |
mov ecx,-1 |
int 0x40 |
; convert eax bin to param dec |
mov eax,dword [procinfo+30] ;offset of myPID |
mov edi,param+4-1 ;offset to 4 bytes |
mov ecx,4 |
mov ebx,10 |
cld |
new_d: |
xor edx,edx |
div ebx |
add dl,'0' |
mov [edi],dl |
dec edi |
loop new_d |
; wirite 1 byte space to param |
mov [param+4],byte 32 ;Space for next parametr |
; and 1 byte type of dialog to param |
mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog) |
; |
; STEP2 prepare IPC area for get messages |
; |
; prepare IPC area |
mov [path],dword 0 |
mov [path+4],dword 8 |
; define IPC memory |
mov eax,60 |
mov ebx,1 ; define IPC |
mov ecx,path ; offset of area |
mov edx,120 ; size 150 bytes |
int 0x40 |
; change wanted events list 7-bit IPC event |
mov eax,40 |
mov ebx,01000111b |
int 0x40 |
; |
; STEP 3 run SYSTEM XTREE with parameters |
; |
mov eax,58 |
mov ebx,run_fileinfo |
int 0x40 |
call redproc |
mov [get_loops],0 |
getmesloop: |
mov eax,23 |
mov ebx,50 ;0.5 sec |
int 0x40 |
cmp eax,1 |
je mred |
cmp eax,2 |
je mkey |
cmp eax,3 |
je mbutton |
cmp eax,7 |
je mgetmes |
; Get number of procces |
mov ebx,procinfo |
mov ecx,-1 |
mov eax,9 |
int 0x40 |
mov ebp,eax |
loox: |
mov eax,9 |
mov ebx,procinfo |
mov ecx,ebp |
int 0x40 |
mov eax,[DLGPID] |
cmp [procinfo+30],eax ;IF Dialog find |
je dlg_is_work ;jmp to dlg_is_work |
dec ebp |
jnz loox |
jmp erroff |
dlg_is_work: |
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated |
je erroff ;TESTODP2 terminated too |
cmp [dlg_pid_get],dword 1 |
je getmesloop |
inc [get_loops] |
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
jae erroff |
jmp getmesloop |
mred: |
call redproc |
jmp getmesloop |
mkey: |
int 0x40 ; read (eax=2) |
jmp getmesloop |
mbutton: |
mov eax,17 ; get id |
int 0x40 |
cmp ah,1 ; button id=1 ? |
jne getmesloop |
mov eax,-1 ; close this program |
int 0x40 |
mgetmes: |
; If dlg_pid_get then second message get jmp to still |
cmp [dlg_pid_get],dword 1 |
je ready |
; First message is number of PID SYSXTREE dialog |
; convert PID dec to PID bin |
movzx eax,byte [path+16] |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+1] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+2] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+3] |
add eax,ebx |
sub eax,48 |
mov [DLGPID],eax |
; Claear and prepare IPC area for next message |
mov [path],dword 0 |
mov [path+4],dword 8 |
mov [path+8],dword 0 |
mov [path+12],dword 0 |
mov [path+16],dword 0 |
; Set dlg_pid_get for get next message |
mov [dlg_pid_get],dword 1 |
call redproc ;show DLG_PID |
jmp getmesloop |
ready: |
; |
; The second message get |
; Second message is 100 bytes path to SAVE/OPEN file |
; shl path string on 16 bytes |
; |
cld |
mov esi,path+16 |
mov edi,path |
mov ecx,200 |
rep movsb |
mov [edi],byte 0 |
jmp openoff |
; DATA AREA |
get_loops dd 0 |
dlg_pid_get dd 0 |
DLGPID dd 0 |
param: |
rb 4 ; My dec PID |
rb 6 ; Type of dialog |
run_fileinfo: |
dd 16 |
dd 0 |
dd param |
dd 0 |
dd procinfo |
run_filepath: |
db '/RD/1/SYSXTREE',0 |
procinfo: |
times 256 db 0 |
} |
; RANDOM - generate random count (small) |
; (SYNTAX) RANDOM MaxCount,OutArgument |
; (SAMPLE) RANDOM 10000,eax |
; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations |
randomuse = 0 |
macro random arg1,arg2 |
{ |
local rxproc |
randomuse = randomuse + 1 |
jmp rxproc |
if defined randomuse & randomuse = 1 |
randomproc: |
jmp rnj |
rsx1 dw 0x4321 |
rsx2 dw 0x1234 |
rnj: |
; mov eax,arg1 |
push bx |
push cx |
push dx |
push si |
push di |
mov cx,ax |
mov ax,word ptr rsx1 |
mov bx,word ptr rsx2 |
mov si,ax |
mov di,bx |
mov dl,ah |
mov ah,al |
mov al,bh |
mov bh,bl |
xor bl,bl |
rcr dl,1 |
rcr ax,1 |
rcr bx,1 |
add bx,di |
adc ax,si |
add bx,0x62e9 |
adc ax,0x3619 |
mov word ptr rsx1,bx |
mov word ptr rsx2,ax |
xor dx,dx |
cmp ax,0 |
je nodiv |
cmp cx,0 |
je nodiv |
div cx |
nodiv: |
mov ax,dx |
pop di |
pop si |
pop dx |
pop cx |
pop bx |
and eax,0000ffffh |
; mov arg2,0 |
; mov arg2,eax |
ret |
end if |
rxproc: |
mov eax,arg1 |
call randomproc |
mov arg2,eax |
} |
macro scank |
{ |
mov eax,10 |
int 0x40 |
} |
macro putpix x,y,color |
{ |
mov ebx,x |
mov ecx,y |
mov edx,color |
mov eax,1 |
int 0x40 |
} |
macro puttxt x,y,offs,size,color |
{ |
; mov ebx,x |
; shl ebx,16 |
; add ebx,y |
wordstoreg ebx,x,y |
mov ecx,color |
mov edx,offs |
mov esi,size |
mov eax,4 |
int 0x40 |
} |
macro outcount data, x, y, color, numtype |
{ |
mov ecx,data |
mov ebx,numtype |
mov bl,0 |
; mov edx,x*65536+y |
wordstoreg edx,x,y |
mov esi,color |
mov eax,47 |
int 0x40 |
} |
; SCEVENT - Scan event |
macro scevent red,key,but |
{ |
mov eax,11 |
int 0x40 |
dec eax |
jz red |
dec eax |
jz key |
dec eax |
jz but |
} |
; WTEVENT - Wait event |
macro wtevent red,key,but |
{ |
mov eax,10 |
int 0x40 |
dec eax |
jz red |
dec eax |
jz key |
dec eax |
jz but |
} |
; TIMEEVENT - Wite for event with timeout |
macro timeevent xfps,noevent,red,key,but |
{ |
mov eax,23 |
mov ebx,xfps |
int 0x40 |
cmp eax,0 |
je noevent |
dec eax |
jz red |
dec eax |
jz key |
dec eax |
jz but |
} |
; CLOSE - Close program |
macro close |
{ |
mov eax,-1 |
int 0x40 |
} |
; DELAY - Create delay 1/100 sec |
; (SYNTAX) Delay time |
; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec |
macro delay arg1 |
{ |
mov eax,5 |
mov ebx,arg1 |
int 0x40 |
} |
; WINDOW - Draw window |
; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color |
; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned |
macro window arg1,arg2,arg3,arg4,arg5 |
{ |
; mov ebx,arg1*65536+arg3 |
; mov ecx,arg2*65536+arg4 |
wordstoreg ebx,arg1,arg3 |
wordstoreg ecx,arg2,arg4 |
mov edx,arg5 |
mov eax,0 |
int 0x40 |
} |
macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7 |
{ |
mov ebx,arg1*65536+arg3 |
mov ecx,arg2*65536+arg4 |
mov edx,arg5 |
mov esi,arg6 |
mov edi,arg7 |
mov eax,0 |
int 0x40 |
} |
; STARTWD - Start of window draw |
macro startwd |
{ |
mov eax,12 |
mov ebx,1 |
int 0x40 |
} |
; ENDWD - End window draw |
macro endwd |
{ |
mov eax,12 |
mov ebx,2 |
int 0x40 |
} |
; LABEL - Put text to frame |
; (SYNTAX) LABEL Xstart,Ystart,'Text',Color |
; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big |
macro label arg1,arg2,arg3,arg4 |
{ |
local asd,lab |
jmp asd |
lab db arg3 ;arg label |
asd: |
; mov ebx,arg1 ;arg1=y arg2=x |
; shl ebx,16 |
; add ebx,arg2 |
wordstoreg ebx,arg1,arg2 |
if ~(arg4 eq ) |
mov ecx,arg4 ;arg4 color |
end if |
mov edx,lab |
mov esi,asd-lab ;calc size |
mov eax,4 |
int 0x40 |
} |
;Key's |
key_Up equ 178 |
key_Down equ 177 |
key_Right equ 179 |
key_Left equ 176 |
key_Esc equ 27 |
key_Space equ 32 |
key_Enter equ 13 |
key_Bspace equ 8 |
key_F1 equ 50 |
key_F2 equ 51 |
key_F3 equ 52 |
key_F4 equ 53 |
key_F5 equ 54 |
key_F6 equ 55 |
key_F7 equ 56 |
key_F8 equ 57 |
key_F9 equ 48 |
key_F10 equ 49 |
key_F11 equ 68 |
key_F12 equ 255 |
key_Home equ 180 |
key_End equ 181 |
key_PgUp equ 184 |
key_PgDown equ 183 |
;Attributes |
;Window Attributes |
window_Skinned equ 0x03000000 |
window_Type2 equ 0x02000000 |
window_Type1 equ 0x00000000 |
window_Reserve equ 0x01000000 |
;Font Attributes |
font_Big equ 0x10000000 |
;Colors |
cl_White equ 0x00ffffff |
cl_Black equ 0x00000000 |
cl_Grey equ 0x00888888 |
cl_Red equ 0x00ff0000 |
cl_Lime equ 0x0000ff00 |
cl_Green equ 0x0000af00 |
cl_Blue equ 0x000000ff |
cl_Purple equ 0x008080ff |
cl_Violet equ 0x008040ff |
cl_Cyan equ 0x0040e0ff |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/sysxtree/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm sysxtree.asm sysxtree |
@pause |
/programs/fs/sysxtree/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm sysxtree.asm sysxtree |
@pause |
/programs/fs/sysxtree/trunk/macros.inc |
---|
0,0 → 1,266 |
; 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 |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a { ; mike.dld |
if ~a eq |
mov reg,a |
end if |
} |
macro mcall a,b,c,d,e,f { ; mike.dld |
__mov eax,a |
__mov ebx,b |
__mov ecx,c |
__mov edx,d |
__mov esi,e |
__mov edi,f |
int 0x40 |
} |
; language for programs |
lang fix ru ; ru en fr ge fi |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
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 __regs) & (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 |
} |
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 |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/fs/sysxtree/trunk/sysxtree.asm |
---|
0,0 → 1,2758 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; ; |
; SYSTEM X-TREE BROWSER ; |
; ; |
; Author: Pavlushin Evgeni waptap@mail.ru ; |
; site: www.deck4.narod.ru ; |
; ; |
; Compile with FASM for MenuetOS ; |
; ; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;Bug report +bug deleted -bug not deleted |
;show/fade del notwork+ |
;64Ver Run file from HD bug deleted. |
;65Ver The bad scroll realization |
;66Ver The good scroll realization, url line anti-flick |
;67Ver Url line monolith procedure |
;68Ver Mini icon on left of file name |
;69Ver Getimg proc size minus 900 bytes |
;70Ver Del data area ramsize minus 140000 bytes |
;72Ver Quick sort, ramsize minus 200000 bytes |
;73Ver Url flick and out bugs delete |
;74Ver scroll bug deleted |
;75Ver hd partition fast change button. Add bmp,txt,exec,asm and inc icons. |
; sort type in headmenu bug del |
;78Ver directory extension bug fix by Asko Vuori |
;79Ver Asko Vuori volume label add and "put in command line" bug fix |
;80Ver prompt edit fatal bug deleted, antiflick when move list up/down |
;81Ver Save Dialog bug deleted |
;600000 bytes memory! |
;****************************************************************************** |
use32 |
org 0x0 |
db 'MENUET01' ; 8 byte id |
dd 0x01 ; header version |
dd START ; program start |
dd I_END ; program image size |
dd RAM_END ; memory |
dd RAM_END ; stack |
dd param_area ,0x0 ; param,icon |
; dd 0,0 |
;****************************************************************************** |
include 'lang.inc' |
include 'macros.inc' |
include 'ascl.inc' |
include 'ascgl.inc' |
gif_hash_offset = gif_hash |
START: ; start of execution |
; //// Willow |
mov eax,58 |
mov ebx,MRUfile |
int 0x40 |
; //// Willow |
mov eax,40 |
mov ebx,0100111b |
int 0x40 |
cmp byte [param_area],0 ;test parameters line |
jne no_brow ;it's dialog |
mov [browser],dword 1 ;it's browser |
no_brow: |
cmp [browser],dword 1 |
je no_dlg |
mov al,byte [param_area+5] |
mov [dlg_type],al |
mov eax,9 |
mov ebx,procinfo |
mov ecx,-1 |
int 0x40 |
mov eax,dword [procinfo+30] |
mov edi,MYPID+4-1 |
mov ecx,4 |
mov ebx,10 |
cld |
new_d: |
xor edx,edx |
div ebx |
add dl,'0' |
mov [edi],dl |
dec edi |
loop new_d |
movzx eax,byte [param_area] |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [param_area+1] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [param_area+2] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [param_area+3] |
add eax,ebx |
sub eax,48 |
mov ecx,eax ;pid to ecx |
mov eax,60 |
mov ebx,2 |
mov edx,MYPID |
mov esi,4 |
int 0x40 |
no_dlg: |
giftoimg but_file,tempimg |
;************************ |
; Get images |
;************************ |
mov eax,0 ;x |
mov ebx,0 ;y |
mov esi,286 ;xs |
mov edi,16 ;ys |
mov ecx,tempimg ;src |
mov edx,butimg ;dest |
call getimgproc |
mov eax,288 |
mov esi,60 |
mov edx,logoimg ;dest |
call getimgproc |
mov eax,0 ;x |
mov ebx,16 ;y |
mov esi,51 ;xs |
mov edi,esi ;ys |
mov edx,logoinfimg ;dest |
call getimgproc |
mov eax,51 ;x |
mov esi,8 ;xs |
mov edi,9 ;ys |
mov edx,upsb ;dest |
call getimgproc |
mov eax,51+8 ;x |
mov edx,dnsb ;dest |
call getimgproc |
mov eax,51+16 ;x |
mov ebx,16 ;y |
mov esi,12 ;xs |
mov edi,9 ;ys |
mov ecx,tempimg ;src |
mov edx,hdico ;dest |
mov ebp,9 |
loogetimg: |
call getimgproc |
add edx,9*12*3+8 |
add eax,12 |
dec ebp |
jnz loogetimg |
jmp endgip |
getimgproc: |
pushad |
mov dword [edx],esi ;xs |
mov dword [edx+4],edi ;ys |
mov ebp,eax |
mov eax,dword [ecx] ;getx size |
push edx |
push ecx |
lea ecx,[eax+2*eax] |
mul ebx |
add eax,ebp ;x |
mov edx,ecx |
lea eax,[eax+2*eax] ;eax=offset on imsrc |
mov ecx,esi ;xs |
mov ebx,edi ;ys |
mov ebp,esi |
pop edi |
lea esi,[eax+8+edi] |
pop edi |
add edi,8 |
cld |
cyc: |
movsw |
movsb |
dec ecx |
jne cyc |
add esi,edx |
mov ecx,ebp ;xs |
sub esi,ecx |
sub esi,ecx |
sub esi,ecx |
dec ebx |
jne cyc |
popad |
ret |
endgip: |
call read_directory |
; call convertation |
red: |
call draw_window ; at first, draw the window |
still: |
mov eax,9 |
mov ebx,procinfo |
mov ecx,-1 |
int 0x40 |
wtevent red,key,button |
scrolltest: |
mov eax,37 |
mov ebx,2 |
int 0x40 |
cmp eax,1 |
jne still |
scrl: |
mov eax,37 |
mov ebx,1 |
int 0x40 |
mov ebx,eax |
shr eax,16 ;x |
and ebx,0xffff ;y |
mov ebp,eax |
sub ebp,[listx] ;[procinfo.x_size] |
sub ebp,[listxsize] |
add ebp,[scrollsize] |
cmp ebp,dword [scrollsize] ;8 |
ja menu_test ; still |
mov ebp,ebx |
sub ebp,[listy] ;76 ;up scroll |
sub ebp,[scrollbutsize] |
cmp ebp,0 |
jl menu_test |
mov [mousey],ebp |
push eax ebx edx |
mov edx,0 |
mov eax,[listysize] |
sub eax,2 |
mov ebx,dword 10 |
div ebx |
mov [filelistsize],eax |
mov ebx,eax |
cmp ebx,[listsize] ;filelistsize in ebx |
ja notusescrl |
mov edx,0 |
mov eax,[listysize] |
sub eax,[scrollbutsize] |
sub eax,[scrollbutsize] |
shl eax,16+6 |
div dword [listsize] |
mul ebx |
shr eax,16+6 |
mov ebp,eax ; in ebp ysize of scroll |
mov edx,0 |
mov eax,[listsize] |
mov ebx,[listysize] |
sub ebx,[scrollbutsize] |
sub ebx,[scrollbutsize] |
shl eax,16 |
div ebx ;dword [listsize] |
mul [mousey] |
shr eax,16 |
mov ebx,[listsize] |
sub ebx,[filelistsize] |
cmp eax,ebx |
jnae no_cor |
mov eax,[listsize] ;correction for full dirs (1000 files) |
sub eax,[filelistsize] |
no_cor: |
mov [filecursor],eax |
jmp usescrl |
notusescrl: |
mov [filecursor],0 ;ebp |
usescrl: |
pop edx ebx eax |
mov esi,[listy];[procinfo.y_size] |
add esi,[listysize] |
sub esi,[scrollbutsize] |
cmp ebx,esi |
jna oks ;menu_test ;still |
sub esi,ebp |
inc esi ;correction |
cmp ebx,esi |
ja menu_test ;still |
oks: |
mov [flick],1 |
jmp anti_flick ;red |
menu_test: |
cmp [pmenu_draw],1 ;if menu is show, update all |
jne still |
mov [pmenu_draw],0 |
jmp red ;update all window |
;this function not use in dialog when poup menu's is not used |
;in dialog's |
;=================== |
; Test keyboard |
;=================== |
key: ; key |
mov eax,2 |
int 0x40 |
cmp dword [focus],0 |
jne con_edit |
cmp ah,key_Up |
jne no_upk |
mov ebx,1 |
jmp up |
no_upk: |
cmp ah,key_Down |
jne no_downk |
mov ebx,1 |
jmp down |
no_downk: |
cmp ah,key_PgUp |
jne no_pgup |
mov ebx,10 |
jmp up |
no_pgup: |
cmp ah,key_PgDown |
jne no_pgdown |
mov ebx,10 |
jmp down |
no_pgdown: |
cmp ah,key_Enter |
jne no_k_ent |
jmp kfad |
no_k_ent: |
cmp ah,key_Bspace |
je back |
cmp ah,key_F2 |
je viewset |
cmp ah,key_F3 |
je textopen |
cmp ah,key_F5 |
je copy_to_clip |
cmp ah,key_F6 |
je paste_from_clip |
cmp ah,key_F11 |
je edit_prompt |
cmp ah,key_F12 |
je update |
jmp still |
; test input string |
con_edit: |
cmp ah,key_Enter |
jne no_con_ent |
not [focus] |
jmp savetest |
jmp update |
no_con_ent: |
cmp ah,key_Left |
jne no_con_left |
dec [cursor] |
mov [flick],2 |
jmp anti_flick ;red |
no_con_left: |
cmp ah,key_Right |
jne no_con_right |
inc [cursor] |
mov [flick],2 |
jmp anti_flick ;red |
no_con_right: |
cmp ah,key_Bspace |
jne no_con_bspace |
mov ecx,[cursor] |
cmp ecx,0 |
je still |
dec ecx |
mov ebp,[cursor] |
lobsp: |
mov bl,byte [path+ebp] |
mov byte [path+ebp-1],bl |
inc ebp |
cmp ebp,100 |
jne lobsp |
dec [cursor] |
mov [flick],2 |
jmp anti_flick ;red |
no_con_bspace: |
mov ecx,[cursor] |
dec ecx |
mov ebp,100 ;[cursor] |
losx: |
mov bl,byte [path+ebp] |
mov byte [path+ebp+1],bl |
dec ebp |
cmp ebp,ecx ;100 |
jne losx |
mov ebp, [cursor] |
cmp ebp,100 |
ja still |
mov byte [path+ebp],ah |
inc dword [cursor] |
mov [flick],2 |
jmp anti_flick |
;---------------------------- |
;Test on mouse button |
;----------------------------- |
button: ; button |
mov eax,17 |
int 0x40 |
cmp ah,2 ;Edit prompt line? |
je edit_prompt |
cmp ah,4 |
jne no_filelist |
mousetest: |
mov eax,37 |
mov ebx,1 |
int 0x40 |
mov ebx,eax |
shr eax,16 ;x |
and ebx,0xffff ;y |
sub ebx,[listy] ;80 |
mov [mousey],ebx |
mov ecx,[listx] |
cmp eax,ecx |
jl still |
add ecx,[listxsize] |
cmp eax,ecx |
jg still |
filexadd: |
; Enter in directory |
file_add: |
mov edx,0 ;for div correct work div |
mov eax,dword [mousey] |
mov ebx,10 |
div ebx |
add eax,[filecursor] |
jmp no_kfad |
kfad: |
mov eax,[filecursor] |
no_kfad: |
mov ebx,62 |
mul ebx |
mov ebp,eax |
mov edi,paramtest ;clear param string |
mov ecx,256 |
mov al,0 |
rep stosb |
mov esi,0 |
lll2: |
mov al,byte [path+esi] |
cmp al,byte 0 ;' '; '/' |
je fis2 |
cmp al,byte ' '; '/' |
je fis2 |
inc esi |
cmp esi,100 |
jna lll2 |
jmp fis2 |
fis2: |
mov edi,ebp |
cmp [convinfo+edi+26],dword 'FOL ' |
jne openf |
mov [path+esi],byte '/' |
inc esi |
mov ebp,8 |
los: ;directory extension bug fix |
mov al,[convinfo+edi] |
cmp al,' ' |
jz skip_name_space |
mov [path+esi],al |
inc esi |
skip_name_space: |
inc edi |
dec ebp |
jnz los |
cmp byte [convinfo+edi],'.' |
jnz dir_name_end |
cmp byte [convinfo+edi+1],' ' |
jz dir_name_end |
mov ebp,4 |
dir_ext_char: |
mov al,[convinfo+edi] |
cmp al,' ' |
jz dir_name_end |
mov [path+esi],al |
inc esi |
inc edi |
dec ebp |
jnz dir_ext_char |
dir_name_end: |
mov [filecursor],0 |
;los: |
; mov al,[convinfo+edi] |
; mov [path+esi],al |
; inc esi |
; inc edi |
; dec ebp |
; jnz los |
; mov [filecursor],0 |
; cmp byte [dlg_type],'S' |
; je savetest |
;no_save: |
call read_directory |
;; call convertation |
call draw_window |
; jmp still |
;Savetest |
savetest: |
cmp byte [dlg_type],'S' |
je savetest_yes |
jmp still |
savetest_yes: |
mov ecx,100 |
savetestloop: |
cmp [path+ecx],byte 0 |
je next_byte |
cmp [path+ecx],byte 32 |
je next_byte |
cmp [path+ecx],byte '.' |
je openf ;it's file |
; cmp [path+ecx],byte '/' |
; je no_save ;it's dir |
next_byte: |
dec ecx |
jnz savetestloop |
jmp still |
;Open/Run file |
openf: |
mov ecx,100 |
lopt: |
mov al,[path+ecx] |
mov [paramtest+ecx],al |
dec ecx |
jns lopt |
; mov ebp,100 |
;loow: |
; cmp [paramtest+ebp],byte '.' |
; je file_set |
; dec ebp |
; jnz loow ;is file set not file add |
cmp dword [focus],0 ;if prompt line with focus no add file name from frame |
jne file_set |
mov [paramtest+esi],byte '/' |
inc esi |
mov ebp,8+4 |
mov edx,edi |
losf: |
mov al,[convinfo+edi] |
mov [paramtest+esi],al |
inc esi |
inc edi |
dec ebp |
jnz losf |
file_set: |
cmp [browser],0 |
jne is_brow |
movzx eax,byte [param_area] |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [param_area+1] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [param_area+2] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [param_area+3] |
add eax,ebx |
sub eax,48 |
mov ecx,eax ;pid to ecx |
mov eax,60 |
mov ebx,2 |
mov edx,paramtest |
mov esi,100 |
int 0x40 |
jmp exit |
is_brow: |
; cmp [convinfo+edi+26],dword 'Fvol' |
; je edit |
mov eax,dword [convinfo+edx+8] |
cmp eax,'. ' |
jne noexecute |
mov ebx,0 |
jmp execute |
noexecute: |
cmp eax,'.JPG' |
jne nojv |
jpg_jpe: |
mov ebx,jpgview |
jmp run |
nojv: |
cmp eax,'.JPE' |
je jpg_jpe |
cmp eax,'.GIF' |
jne nojv1 |
mov ebx,gifview |
jmp run |
nojv1: |
cmp eax,'.WAV' |
jne nojv12 |
mov ebx,ac97wav |
jmp run |
nojv12: |
cmp eax,'.BMP' |
jne nobv |
mov ebx,bmpview |
jmp run |
nobv: |
; //// Willow |
cmp eax,'.PNG' |
jne nopngv |
mov ebx,pngview |
jmp run |
nopngv: |
; //// Willow |
cmp eax,'.ASM' |
je edit |
cmp eax,'.TXT' |
je edit |
cmp eax,'.INC' |
je edit |
cmp eax,'.DAT' |
je edit |
jmp still |
edit: |
mov ebx,editor |
jmp run |
execute: |
mov ecx,0 ;200 |
loexe: |
mov al,[paramtest+ecx] |
; cmp al,0 |
; je setzr |
; cmp al,' ' |
; je setzr |
; je badl |
cmp al,'.' |
je setzr |
; je badl |
; jmp okl |
;badl: |
; mov al,0 |
okl: |
mov [open_path+ecx],al |
inc ecx |
cmp ecx,200 |
jnae loexe |
setzr: |
; add ecx,3 |
; mov al,0 |
mov [open_path+ecx],byte 0 ;al |
mov eax,58 |
mov ebx,fileinfo_start |
int 0x40 |
jmp still |
run: |
mov ecx,paramtest |
mov eax,19 |
int 0x40 |
jmp still |
no_filelist: |
cmp ah,5 ;OPEN/SAVE button |
je kfad |
cmp ah,6 ;Scroll up |
jne no_scrlup |
mov ebx,1 |
jmp up |
no_scrlup: |
cmp ah,7 ;Scroll down |
jne no_scrldown |
mov ebx,1 |
jmp down |
no_scrldown: |
cmp ah,8 |
jne no_update |
update: |
call read_directory |
; call convertation |
; mov [filecursor],0 |
call draw_window |
no_update: |
cmp ah,9 |
jne no_textopen |
textopen: |
mov esi,0 |
xlll2: |
mov al,byte [path+esi] |
cmp al,byte '/' |
jne xfis2 |
inc esi |
cmp esi,12*20 |
jnae xlll2 |
jmp still |
xfis2: |
mov al,byte [path+esi] |
cmp al,byte ' ' |
je xaa2 |
inc esi |
cmp esi,12*20 |
jnae xfis2 |
jmp still |
xaa2: |
mov eax,[filecursor] |
mov ebx,62 |
mul ebx |
mov edi,eax |
cmp [convinfo+edi+26],dword 'FOL ' |
je still |
mov ecx,12*20 |
xlopt: |
mov al,[path+ecx] |
mov [paramtest+ecx],al |
dec ecx |
jns xlopt |
mov [paramtest+esi],byte '/' |
inc esi |
mov ebp,8+4 |
mov edx,edi |
xlosf: |
mov al,[convinfo+edi] |
mov [paramtest+esi],al |
inc esi |
inc edi |
dec ebp |
jnz xlosf |
mov [paramtest+esi],byte 0 |
mov ebx,editor |
mov ecx,paramtest |
mov eax,19 |
int 0x40 |
jmp red ;still |
no_textopen: |
cmp ah,11 |
jne no_view |
viewset: |
; not dword [delflag] |
inc dword [viewmode] |
cmp dword [viewmode],8 |
jnae not_cm |
mov [viewmode],0 |
not_cm: |
call read_directory |
; call convertation |
mov [filecursor],0 |
call draw_window |
jmp still |
no_view: |
cmp ah,12 ;move back |
jne no_back |
back: |
mov esi,12*20 |
lll: |
mov al,byte [path+esi] |
cmp al,byte ' ' |
jne findsl |
dec esi |
jnz lll |
jmp still |
findsl: |
dec esi |
fis: |
mov al,byte [path+esi] |
cmp al,byte '/' |
je aa |
mov [path+esi],byte 0 ;' ' |
dec esi |
jnz fis |
aa: |
mov [path+esi],byte 0 ;' ' |
mov [filecursor],0 |
call read_directory |
; call convertation |
call draw_window |
jmp still |
no_back: |
cmp ah,13 ;string up? |
jne no_up |
mov ebx,1 ;step |
up: |
mov [downstop],0 |
sub [filecursor],ebx |
cmp [filecursor],0 |
jnl cr_ok |
mov [filecursor],0 |
cr_ok: |
jmp draw_wd |
no_up: |
cmp ah,14 ;string down? |
jne no_dn |
mov ebx,1 ;step |
down: |
cmp [downstop],1 |
je no_dn |
add [filecursor],ebx |
jmp draw_wd |
no_dn: |
cmp ah,15 |
jne no_copyclip ;copy to clipboard |
copy_to_clip: |
mov ebx,param_area ;clipfilp |
mov eax,32 |
int 0x40 |
mov esi,0 |
wlll2: |
mov al,byte [path+esi] |
cmp al,byte '/' |
jne wfis2 |
inc esi |
cmp esi,12*20 |
jnae wlll2 |
jmp still |
wfis2: |
mov al,byte [path+esi] |
cmp al,byte ' ' |
je waa2 |
inc esi |
cmp esi,12*20 |
jnae wfis2 |
jmp still |
waa2: |
mov eax,[filecursor] |
mov ebx,62 |
mul ebx |
mov edi,eax |
cmp [convinfo+edi+26],dword 'FOL ' |
je still |
mov ecx,12*20 |
wlopt: |
mov al,[path+ecx] |
mov [paramtest+ecx],al |
dec ecx |
jns wlopt |
mov [paramtest+esi],byte '/' |
inc esi |
mov ebp,8+4 |
mov edx,edi |
wlosf: |
mov al,[convinfo+edi] |
mov [paramtest+esi],al |
inc esi |
inc edi |
dec ebp |
jnz wlosf |
mov [paramtest+esi],byte 0 |
mov ebx,param_area ;clipfile |
mov ecx,paramtest |
mov edx,100 |
mov esi,0 |
mov eax,33 |
int 0x40 |
jmp still |
no_copyclip: |
cmp ah,16 |
jne no_clippaste |
paste_from_clip: |
mov ebx,param_area ;clipfile |
mov ecx,0 |
mov edx,-1 |
mov esi,sourcepath |
mov eax,6 |
int 0x40 |
mov ecx,99 |
cdestp: |
mov al,[path+ecx] |
mov [destpath+ecx],al |
dec ecx |
jns cdestp |
mov esi,0 |
zlll2: |
mov al,byte [destpath+esi] |
cmp al,byte '/' |
jne zfis2 |
inc esi |
cmp esi,100 |
jnae zlll2 |
jmp still |
zfis2: |
mov al,byte [destpath+esi] |
cmp al,byte ' ' |
je zaa2 |
inc esi |
cmp esi,100 |
jnae zfis2 |
jmp still |
zaa2: |
mov byte [destpath+esi],'/' |
inc esi |
mov edi,0 |
qlll2: |
mov al,byte [sourcepath+edi] |
cmp al,byte '.' |
je qfis2 |
inc edi |
cmp edi,100 |
jnae qlll2 |
jmp still |
qfis2: |
sub edi,8 ;.-8=start of file name |
mov ecx,11 ;11 sybols |
cfname: |
mov al,[sourcepath+edi] |
cmp al,byte ' ' |
je dar |
mov [destpath+esi],al |
inc esi |
dar: |
inc edi |
dec ecx |
jns cfname |
; mov [destpath+esi],byte 0 |
mov ecx,199 |
cdestjp: |
mov al,[sourcepath+ecx] |
cmp al,byte 0 |
jne nor |
mov al,byte 32 |
nor: |
mov [sourcepath+ecx],al |
dec ecx |
jns cdestjp |
cmp [browser],dword 1 |
jne no_outpath |
mov eax,4 ; function 4 : write text to window |
mov ebx,10*65536+67 ; [x start] *65536 + [y start] |
mov ecx,0x00000000 ;[sc.grab_text] ; color of text RRGGBB |
mov edx,sourcepath ; pointer to text beginning |
mov esi,100 ;12*20 ; text length |
int 0x40 |
mov ebx,250*65536+67 ; [x start] *65536 + [y start] |
mov ecx,0x00000000 ;[sc.grab_text] ; color of text RRGGBB |
mov edx,destpath ; pointer to text beginning |
mov esi,100 ;12*20 ; text length |
int 0x40 |
no_outpath: |
mov ebx,copyrfile |
mov ecx,sourcepath |
mov eax,19 |
int 0x40 |
delay 50 ;wait recoed file |
jmp update ;still |
no_clippaste: |
cmp ah,19 ;Delete from floppy |
delete_file: |
jne no_delt |
cmp dword [path],'/RD/' |
jne no_delt |
cmp byte [path+4],'1' |
jne no_delt |
mov eax,[filecursor] |
mov ebx,62 |
mul ebx |
mov edi,eax |
add edi,convinfo |
mov ebp,edi |
mov eax,dword [edi] |
mov dword [paramtest],eax |
mov eax,dword [edi+4] |
mov dword [paramtest+4],eax |
mov eax,dword [edi+4+4+1] |
mov dword [paramtest+4+4],eax |
mov ebx,paramtest |
mov eax,32 |
int 0x40 |
jmp update |
no_delt: |
cmp ah,20 ;I - Help |
je help_scr |
cmp ah,22 |
jne no_headfile |
mov [drawhf],1 |
call draw_window |
mov [drawhf],0 |
mov [pmenu_draw],1 |
jmp still |
no_headfile: |
cmp ah,23 |
jne no_headview |
mov [drawhv],1 |
call draw_window |
mov [drawhv],0 |
mov [pmenu_draw],1 |
jmp still |
no_headview: |
cmp ah,24 |
jne no_headinfo |
mov [drawhi],1 |
call draw_window |
mov [drawhi],0 |
mov [pmenu_draw],1 |
jmp still |
no_headinfo: |
;FILE MENU |
cmp ah,30 |
je kfad |
cmp ah,31 |
je copy_to_clip ;Copy |
cmp ah,32 |
je paste_from_clip ;Paste |
cmp ah,33 |
je delete_file ;Delte |
cmp ah,34 |
je textopen ;Edit in Tinypad |
cmp ah,37 |
je exit |
;VIEW MENU |
cmp ah,40 ;Sort by name show del |
jne no_sn |
; mov dword [viewmode],0 |
and dword [viewmode],100b |
jmp update |
no_sn: |
cmp ah,41 ;Sort by extension show del |
jne no_se |
and dword [viewmode],1101b |
or dword [viewmode],0001b |
jmp update |
no_se: |
cmp ah,42 ;Sort by size show del |
jne no_ss |
and dword [viewmode],1110b |
or dword [viewmode],0010b |
jmp update |
no_ss: |
cmp ah,43 ;Sort by date show del |
jne no_sd |
or dword [viewmode],0011b |
jmp update |
no_sd: |
cmp ah,44 ;Show del files |
jne no_ds |
or dword [viewmode],0100b |
jmp update |
no_ds: |
cmp ah,45 ;Fade del files |
jne no_df |
and dword [viewmode],11111011b |
jmp update |
no_df: |
;HELP MENU |
cmp ah,50 ;Help? |
je help_scr |
cmp ah,51 ;Info? |
je info_scr |
cmp ah,83 |
ja no_hd_part |
cmp ah,80 |
jb no_hd_part |
mov ecx,0 |
sub ah,80 |
inc ah |
mov cl,ah |
mov eax,21 |
mov ebx,8 ;7 |
int 0x40 |
no_hd_part: |
cmp ah,1 ; test on exit button |
je exit |
jmp still |
exit: |
; //// Willow |
mov eax,58 |
mov ebx,MRUfile |
mov dword[ebx+8],255 |
inc dword[ebx] |
int 0x40 |
; //// Willow |
mov eax,-1 |
int 0x40 |
draw_wd: |
; call draw_window |
; jmp still |
mov [flick],1 |
jmp anti_flick |
edit_prompt: |
not [focus] |
jmp red |
help_scr: |
mov esi,14 |
mov ebp,help_text |
jmp screen |
info_scr: |
mov esi,6 |
mov ebp,info_text |
jmp screen |
screen: |
cmp [browser],dword 1 ;it's browser? |
jne dialogscr |
mov eax,[procinfo.y_size] |
sub eax,90 |
drawfbox 40,76,300,eax,0x00000000 |
mov eax,[procinfo.y_size] |
sub eax,92 |
drawfbox 41,77,298,eax,0x00ffffff |
mov edi,esi ;14 |
mov ebx,(41+26)*65536+(77+20) |
mov ecx,cl_Black |
mov edx,ebp ;help_text |
jmp outlab |
dialogscr: |
mov eax,[procinfo.y_size] |
sub eax,84 |
drawfbox 16,54,270,eax,0x00000000 |
mov eax,[procinfo.y_size] |
sub eax,86 |
drawfbox 17,55,268,eax,0x00ffffff |
mov edi,esi ;14 |
mov ebx,(17+10)*65536+(55+1) |
mov ecx,cl_Black |
mov edx,ebp ;help_text |
outlab: ;out labels |
mov eax,4 |
mov esi,40 |
helploo: |
int 0x40 |
add ebx,11 |
add edx,40 |
dec edi |
jnz helploo |
setimg 48,84,logoinfimg |
jmp still |
;HELP TEXT |
help_text: |
;0123456789012345678901234567890123456789 |
db ' ~~~~~ SYSTEM X-TREE ~~~~~ ' |
db ' HELP ' |
db ' ' |
db ' ' |
db 'F2 - CHANGE SORTMODE (name,ext,size,dat)' |
db 'F3 - VIEW file in tinypad ' |
db 'F5 - COPY FILE to clipboard ' |
db 'F6 - PASTE FILE from clipboard ' |
db 'F11- EDIT PROMPT string ' |
db 'F12- UPDATE directory sources ' |
db ' ' |
db 'Enter - input to directory ' |
db 'Backspace - back to previos directory ' |
db 'PageDn/PageUp, Up/Down - move cursor ' |
info_text: |
db ' ~~~~~ SYSTEM X-TREE ~~~~~ ' |
db ' INFO 81 Ver ' |
db ' ' |
db ' Create by Pavlushin Evgeni ' |
db ' with ASCL libary special for Menuet OS ' |
db ' www.deck4.narod.ru waptap@mail.ru ' |
; ********************************************* |
; ******* WINDOW DEFINITIONS AND DRAW ******** |
; ******** FILE BROWSER / DIALOG ********* |
;draw_browser_window: |
draw_window: |
; mov eax,9 |
; mov ebx,procinfo |
; mov ecx,-1 |
; int 0x40 |
; mov eax,[procinfo.x_size] |
; cmp eax,66 |
; jg temp12345 |
; ret |
; temp12345: |
mov eax,48 |
mov ebx,3 |
mov ecx,sc |
mov edx,sizeof.system_colors |
int 0x40 |
mov eax,[sc.work_button] |
mov [b_color],eax |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,1 ; 1, start of draw |
int 0x40 |
;Window |
xor eax,eax ; function 0 : define and draw window |
cmp [browser],dword 1 ;it's browser |
jne nob1 |
mov ebx,140*65536+400 ; [x start] *65536 + [x size] |
mov ecx,160*65536+280 ; [y start] *65536 + [y size] |
jmp isb1 |
nob1: |
mov ebx,140*65536+320 ; [x start] *65536 + [x size] |
mov ecx,260*65536+240 ; [y start] *65536 + [y size] |
isb1: |
; mov edx,[sc.work] ; color of work area RRGGBB |
or edx,0x03ffffff;000000 |
int 0x40 |
;Get proc info |
mov eax,9 |
mov ebx,procinfo |
mov ecx,-1 |
int 0x40 |
mov eax,[procinfo.x_size] |
cmp eax,66 |
jg temp12345 |
ret |
temp12345: |
cmp [browser],dword 1 ;it's browser |
jne nob9 |
mov [listx],120 |
mov eax,[procinfo.x_size] |
sub eax,[listx] |
sub eax,7 |
mov [listxsize],eax |
mov [listy],73 |
mov eax,[procinfo.y_size] |
sub eax,[listy] |
sub eax,7 |
mov [listysize],eax |
jmp isb9 |
nob9: |
mov [listx],10 |
mov eax,[procinfo.x_size] |
sub eax,[listx] |
sub eax,7 |
mov [listxsize],eax |
mov [listy],54 |
mov eax,[procinfo.y_size] |
sub eax,[listy] |
sub eax,34 |
mov [listysize],eax |
isb9: |
;Draw only browser components |
cmp [browser],dword 1 ;it's browser |
jne nob2 |
mov eax,[sc.grab_text] ; color of text RRGGBB |
or eax,0x10000000 |
label 8,8,'SYSTEM X-TREE FILE BROWSER',eax |
;Draw buttons headers |
mov eax,8 |
mov ebx,8*65536+(6*8-1) ;start pos x |
mov ecx,23*65536+10 ;start pos y |
mov edx,22;+1000000000000000000000000000000b ;spoke butt |
mov edi,3 ;draw 13 button's |
mov esi,0x00339933 |
int 0x40 |
dec edi |
nexthbut: |
add ebx,(6*8)*65536 |
inc edx |
int 0x40 |
dec edi |
jnz nexthbut |
;DRAW PARTITION BUTTONS |
mov eax,8 |
mov ebx,340*65536+5 ;start pos x |
mov ecx,24*65536+8 ;start pos y |
mov edx,80;+1000000000000000000000000000000b ;spoke butt |
mov edi,4 ;draw 13 button's |
mov esi,0x00339933 |
int 0x40 |
dec edi |
nextpbut: |
add ebx,6*65536 |
inc edx |
int 0x40 |
dec edi |
jnz nextpbut |
;DRAW PARTITON TEXT |
label 341,25,'1234',cl_White;Black |
;File STRING |
label 8,25,' FILE VIEW INFO ', ;cl_White ;Black |
;BlackLine |
mov eax,[procinfo.x_size] |
sub eax,10 |
drawfbox 5,35, eax, 1, cl_Black |
;BlackLine2 |
mov eax,[procinfo.x_size] |
sub eax,10 |
drawfbox 5,68, eax, 1, cl_Black |
;BlackLine2 vertical |
; mov eax,[procinfo.y_size] |
; sub eax,69+4 |
; drawfbox 115, 69, 1, eax, cl_Black |
;Set logo img |
setimg 34,88,logoinfimg |
label 20,165,'SYSTEM X-TREE',cl_Black |
add ebx,10 |
label ,,'FOR MENUETOS', |
add ebx,9*65536+20 |
label ,,'welcome to',cl_Green |
add ebx,-15*65536+10 |
label ,,'www.menuetos.org',cl_Green |
; label ,,'Create by',cl_Green |
; add ebx,10 |
; label ,,' Pavlushin', |
; add ebx,10 |
; label ,,' Evgeni', |
;Draw head->file buttons |
cmp [drawhf],1 |
jne no_drawhf |
mov ebx,8*65536+6*12 ;start pos x |
mov ecx,35*65536+10 ;start pos y |
mov edx,30 ;spoke butt |
mov edi,8 ;draw 4 button's |
mov esi,cl_Grey |
call menubutton |
no_drawhf: |
;Draw head->view buttons |
cmp [drawhv],1 |
jne no_drawhv |
mov ebx,(8+6*8)*65536+6*12 ;start pos x |
mov ecx,35*65536+10 ;start pos y |
mov edx,40 ;spoke butt |
mov edi,6 ;draw 4 button's |
mov esi,cl_Grey |
call menubutton |
no_drawhv: |
;Draw head->info buttons |
cmp [drawhi],1 |
jne no_drawhi |
mov ebx,(8+12*8)*65536+6*12 ;start pos x |
mov ecx,35*65536+10 ;start pos y |
mov edx,50 ;spoke butt |
mov edi,2 ;draw 2 button's |
mov esi,cl_Grey |
call menubutton |
no_drawhi: |
nob2: |
;Draw buttons instruments |
mov eax,8 |
cmp [browser],dword 1 ;it's browser |
jne nob3 |
mov ebx,10*65536+16+5 ;start pos x |
mov ecx,37*65536+15 ;start pos y |
jmp isb3 |
nob3: |
mov ebx,16*65536+16+5 ;start pos x |
mov ecx,29*65536+15 ;start pos y |
isb3: |
mov edx,8;+1000000000000000000000000000000b ;spoke butt |
mov edi,13 ;draw 13 button's |
mov esi,cl_Grey |
int 0x40 |
dec edi |
nextbut: |
add ebx,(16+6)*65536 |
inc edx |
int 0x40 |
dec edi |
jnz nextbut |
cmp [browser],dword 1 ;it's browser |
jne nob4 |
;But img browser |
setimg 10,37,butimg |
;left logo |
add eax,[procinfo.x_size] |
sub eax,80 |
mov [temp],eax |
setimg [temp],37,logoimg |
jmp isb4 |
nob4: |
;But img dialog |
setimg 16,29,butimg |
isb4: |
cmp [browser],dword 1 ;it's browser |
jne nob5 |
mov [urlx],48 |
mov [urly],55 |
mov eax,[procinfo.x_size] |
sub eax,48+10 |
mov [urlxsize],eax |
mov [urlysize],12 |
label 20,57,"URL:",cl_Black |
;Out view mode info |
mov eax,[viewmode] |
mov ebx,16 |
mul ebx |
mov edx,eax |
mov eax,4 |
mov ebx,180*65536+25 |
mov ecx,cl_Black |
add edx,modetext |
mov esi,16 |
int 0x40 |
;List size |
outcount [listsize],294,25,cl_Black,4*65536 |
jmp isb5 |
head_dlg: db 'OPEN FILE' |
db 'SAVE FILE' |
but_dlg: db 'OPEN' |
db 'SAVE' |
nob5: |
mov [urlx],10 |
mov eax,[procinfo.y_size] |
sub eax,24 |
mov [urly],eax |
mov eax,[procinfo.x_size] |
sub eax,80 |
mov [urlxsize],eax |
mov [urlysize],12 |
cmp byte [dlg_type],'O' ;if byte O - is Open dialog |
jne no_openh |
mov edx,head_dlg ;draw in head OPEN FILE |
jmp out_laby |
no_openh: |
cmp byte [dlg_type],'S' ;if byte S - is Save dialog |
jne no_saveh |
mov edx,head_dlg+9 ;draw in head SAVE FILE |
out_laby: |
mov ebx,8*65536+8 |
mov ecx,[sc.grab_text] ; color of text RRGGBB |
or ecx,0x10000000 |
mov esi,9 |
mov eax,4 |
int 0x40 |
no_saveh: |
;Draw OPEN\SAVE button |
mov ebx,0*65536+50 |
mov ecx,0*65536+12 |
mov eax,[procinfo.x_size] |
sub eax,63 |
shl eax,16 |
add ebx,eax |
mov eax,[procinfo.y_size] |
sub eax,25 |
shl eax,16 |
add ecx,eax |
mov eax,8 |
mov edx,5 ;button ID |
mov esi,0x006699aa ;gradient!!! |
int 0x40 |
; label OPEN or SAVE |
mov ebx,[procinfo.x_size] |
sub ebx,48 |
mov eax,[procinfo.y_size] |
sub eax,22 |
shl ebx,16 |
add ebx,eax |
cmp byte [dlg_type],'O' ;if byte O - is Open dialog |
jne no_openb |
mov edx,but_dlg ;draw in head OPEN FILE |
jmp out_labx |
no_openb: |
cmp byte [dlg_type],'S' ;if byte S - is Save dialog |
jne no_saveb |
mov edx,but_dlg+4 ;draw in head SAVE FILE |
out_labx: |
mov ecx,cl_White |
mov esi,4 |
mov eax,4 |
int 0x40 |
no_saveb: |
isb5: |
anti_flick: |
cmp [flick],2 |
je draw_url |
cmp [flick],0 |
jne no_flick_url |
;*************************** |
; DRAW URL LINE |
;*************************** |
draw_url: |
;Draw URL focus button |
mov ebx,[urlx] |
shl ebx,16 |
add ebx,[urlxsize] |
mov ecx,[urly] |
shl ecx,16 |
add ecx,[urlysize] |
dec ebx |
dec ecx |
mov eax,8 |
mov edx,2 ;button ID |
mov esi,0x00aaaaaa ;gradient!!! |
int 0x40 |
;Draw URL String |
mov eax,13 |
mov edx,cl_Black |
int 0x40 |
add ebx,1*65536-2+1 |
add ecx,1*65536-2+1 |
mov edx,cl_White |
int 0x40 |
;Draw URL Cursor |
mov eax,6 |
mul [cursor] |
mov ebx,[urlx] |
add ebx,eax |
shl ebx,16 |
add ebx,2*65536+1 |
mov ecx,[urly] |
shl ecx,16 |
add ecx,[urlysize] |
add ecx,2*65536-4 |
mov eax,13 |
mov edx,cl_Black |
int 0x40 |
; OUT TEXT |
mov eax,[urlxsize] ;calculating text leight |
sub eax,8 |
mov ebx,6 |
div ebx |
mov esi,eax |
mov ebx,[urlx] |
shl ebx,16 |
add ebx,[urly] |
add ebx,3*65536+2 |
mov eax,4 ; function 4 : write text to window |
mov ecx,0x00000000 ;[sc.grab_text] ; color of text RRGGBB |
mov edx,path ; pointer to text beginning |
int 0x40 |
cmp [flick],2 |
jne no_flick_url |
mov [flick],0 |
jmp still |
no_flick_url: |
;*************************** |
; DRAW FILE LIST |
;*************************** |
;Draw Scroll Line |
mov eax,13 |
mov ebx,[listx] |
add ebx,[listxsize] |
sub ebx,[scrollsize] |
shl ebx,16 |
add ebx,dword [scrollsize] |
mov ecx,[listy] |
add ecx,[scrollbutsize] |
shl ecx,16 |
add ecx,[listysize] |
sub ecx,[scrollbutsize] |
sub ecx,[scrollbutsize] |
mov edx,[scrollcolor] ;0x00006600 |
int 0x40 |
;Draw Scroll Box |
mov edx,0 |
mov eax,[listysize] |
sub eax,2 |
mov ebx,dword 10 |
div ebx |
mov edx,0 |
mov ebx,eax |
cmp ebx,[listsize] ;filelistsize in ebx |
ja notusescroll |
;usescroll |
mov eax,[listysize] |
sub eax,[scrollbutsize] |
sub eax,[scrollbutsize] |
shl eax,16 |
div dword [listsize] |
mul ebx |
shr eax,16 |
mov esi,[mousey] |
shl esi,16 |
add esi,eax |
mov eax,13 |
mov ebx,[listx] |
add ebx,[listxsize] |
sub ebx,[scrollsize] |
shl ebx,16 |
add ebx,dword [scrollsize] |
mov ecx,[listy] |
add ecx,[scrollbutsize] |
shl ecx,16 |
add ecx,esi |
mov edx,[scrollboxcol] |
int 0x40 |
notusescroll: |
;Draw list button for get file name |
mov ebx,[listx] |
shl ebx,16 |
add ebx,[listxsize] |
sub ebx,15 ;right free zone |
sub ebx,[scrollsize] |
mov ecx,[listy] |
shl ecx,16 |
add ecx,[listysize] |
mov eax,8 |
mov edx,4+1000000000000000000000000000000b ;spoke butt |
int 0x40 |
add ebx,15 |
mov eax,13 |
mov edx,[listcolor] ;ffffff |
int 0x40 |
;Draw up/down buttons |
mov ebx,[listx] |
add ebx,[listxsize] |
sub ebx,[scrollsize] |
shl ebx,16 |
add ebx,[scrollsize] |
mov ecx,[listy] |
shl ecx,16 |
add ecx,[scrollbutsize] |
dec ecx ;correction |
mov eax,8 |
mov edx,6+1000000000000000000000000000000b ;spoke butt |
int 0x40 |
inc ecx |
mov eax,13 |
mov edx,[scrollbutcol] ;ffffff |
int 0x40 |
; Draw image on up button |
pushad |
shr ebx,16 |
mov edx,ebx |
shl edx,16 |
shr ecx,16 |
add edx,ecx |
mov ecx,8*65536+9 |
mov ebx,upsb+8 |
mov eax,7 |
int 0x40 |
popad |
dec ecx ;correction |
mov edx,7+1000000000000000000000000000000b ;spoke butt |
mov eax,[listysize] |
sub eax,[scrollbutsize] |
shl eax,16 |
add ecx,eax |
mov eax,8 |
int 0x40 |
inc ecx |
mov eax,13 |
mov edx,[scrollbutcol] ;ffffff |
int 0x40 |
; Draw image on down button |
pushad |
shr ebx,16 |
mov edx,ebx |
shl edx,16 |
shr ecx,16 |
add edx,ecx |
mov ecx,8*65536+9 |
mov ebx,dnsb+8 |
mov eax,7 |
int 0x40 |
popad |
; Draw text in file list |
mov eax,[listxsize] |
sub eax,40*6 ;leight of string |
shr eax,1 |
add eax,[listx] |
shl eax,16 |
add eax,[listy] |
add eax,2 |
mov [filelistxy],eax ;dword 19*65536+58 |
mov edx,0 |
mov eax,[listysize] |
sub eax,2 |
mov ebx,dword 10 |
div ebx |
mov [filelistsize],eax ;dword 40 |
; OUT FILE DATA |
mov eax,[filecursor] ;calc cursor position |
mov ebx,62 |
mul ebx |
;OUT TEXT |
mov ebp,4096 ; 16 ;out strings process |
sub ebp,[filecursor] |
mov edx,convinfo ;fileinfo+11 |
add edx,eax |
mov ebx,dword [filelistxy] |
loo: |
mov ecx,0x00888888 ;for another file's color white |
cmp [edx+26],dword 'FOL ' ;folder yellow |
jne nb |
mov ecx,0x00006666 |
jmp cset1 |
nb: |
mov eax,[edx+8] |
;Color set |
cmp eax,dword '.TXT' ;text's blue |
je itx |
cmp eax,dword '.INC' |
je itx |
cmp eax,dword '.ASM' |
je itx |
jmp nt |
itx: |
mov ecx,0x00446666 |
jmp cset |
nt: |
cmp eax,dword '.BMP' ;picture's pure |
je ipic |
cmp eax,dword '.JPG' |
je ipic |
cmp eax,dword '.JPE' |
je ipic |
cmp eax,dword '.GIF' |
je ipic |
; //// Willow |
cmp eax,dword '.PNG' |
je ipic |
; //// Willow |
cmp eax,dword '.WAV' |
je ipic |
jmp np |
ipic: |
mov ecx,0x00226688 |
jmp cset |
np: |
cmp eax,dword '. ' ;execute's green |
jne nexec |
mov ecx,0x00008866 |
jmp cset |
nexec: |
cset: |
cset1: |
mov esi,40 ;symbols out 62 ;32 |
mov eax,4 |
pushad |
int 0x40 |
; popad |
; pushad |
cmp [edx+26],dword 'Fvol' ;volume label |
jne no_volico |
push hdico+8 |
jmp out_ico |
no_volico: |
cmp [edx+26],dword 'FOL ' |
jne no_folico |
cmp [edx+9],dword 'HARD' |
jne no_hdico |
push hdico+8 |
jmp out_ico |
no_hdico: |
cmp [edx+9],dword 'RAMD' |
jne no_rdico |
push rdico+8 |
jmp out_ico |
no_rdico: |
push folico+8 |
jmp out_ico |
no_folico: |
cmp [edx+8],dword '.BMP' |
je is_imgico |
cmp [edx+8],dword '.JPG' |
je is_imgico |
cmp [edx+8],dword '.JPE' |
je is_imgico |
cmp [edx+8],dword '.GIF' |
je is_imgico |
; //// Willow |
cmp [edx+8],dword '.PNG' |
je is_imgico |
; //// Willow |
cmp [edx+8],dword '.WAV' |
je is_imgico |
jmp no_imgico |
is_imgico: |
push imgico+8 |
jmp out_ico |
no_imgico: |
cmp [edx+8],dword '.ASM' |
je is_asmincico |
cmp [edx+8],dword '.INC' |
je is_asmincico |
jmp no_asmincico |
is_asmincico: |
push asmincico+8 |
jmp out_ico |
no_asmincico: |
cmp [edx+8],dword '.TXT' |
jne no_txtico |
push txtico+8 |
jmp out_ico |
no_txtico: |
cmp [edx+8],dword '. ' |
jne no_execico |
push execico+8 |
jmp out_ico |
no_execico: |
cmp [edx+26],dword 'DAT ' |
jne no_datico |
push datico+8 |
jmp out_ico |
no_datico: |
cmp [edx+26],dword 'DEL ' |
jne no_out_ico |
push delico+8 |
jmp out_ico |
out_ico: |
mov edx,ebx |
sub edx,14*65536+1 |
mov ecx,12*65536+9 |
; mov ebx,upsb+8 |
pop ebx |
mov eax,7 |
int 0x40 |
no_out_ico: |
popad |
add ebx,10 |
noout: |
add edx,62 |
dec [filelistsize] |
cmp [filelistsize],dword 0 |
je extloo |
dec ebp |
jnz loo |
dext: |
mov [downstop],1 |
extloo: |
cmp [browser],dword 1 ;it's browser |
jne nob8 |
;Draw text for head->file buttons |
cmp [drawhf],1 |
jne no_drawhftext |
drawfbox 8,35,(6*12)+1,11*8,0x00000000 |
drawfbox 9,36,(6*12)-1,(11*8)-2,0x00ffffff |
mov edi,8 |
mov ebx,9*65536+37 |
mov ecx,cl_Black |
mov edx,file_text_label |
call drawmenu |
jmp no_drawhftext |
file_text_label: |
db ' Open ' |
db ' Copy ' |
db ' Paste ' |
db ' Delete ' |
db ' Tinypad ' |
db ' Edit ' |
db ' ' |
db ' Exit ' |
no_drawhftext: |
;Draw text for head->view buttons |
cmp [drawhv],1 |
jne no_drawhvtext |
drawfbox (8+6*8),35,(6*12)+1,(11*6),0x00000000 |
drawfbox (9+6*8),36,(6*12)-1,(11*6)-2,0x00ffffff |
mov edi,6 ;4 |
mov ebx,(9+6*8)*65536+37 |
mov ecx,cl_Black |
mov edx,view_text_label |
call drawmenu |
jmp no_drawhvtext |
view_text_label: |
db ' Name sort ' |
db ' Ext. sort ' |
db ' Size sort ' |
db ' Date sort ' |
db ' Show DEL ' |
db ' Fade DEL ' |
no_drawhvtext: |
;Draw text for head->info buttons |
cmp [drawhi],1 |
jne no_drawhitext |
drawfbox (8+12*8),35,(6*12)+1,(11*2),0x00000000 |
drawfbox (9+12*8),36,(6*12)-1,(11*2)-2,0x00ffffff |
mov edi,2 |
mov eax,4 |
mov ebx,(9+12*8)*65536+37 |
mov ecx,cl_Black |
mov edx,info_text_label |
call drawmenu |
jmp no_drawhitext |
info_text_label: |
db ' Help ' |
db ' About ' |
no_drawhitext: |
nob8: |
cmp [flick],1 |
jne no_flick |
mov [flick],0 |
jmp still |
no_flick: |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,2 ; 2, end of draw |
int 0x40 |
ret |
;FILE LIST PARAMETRS |
listx dd 15 |
listy dd 72 |
listxsize dd 350 |
listysize dd 41 |
filelistxy dd 0 |
filelistsize dd 0 |
scrollsize dd 8 |
listcolor dd 0xffffff ;0xeeeeee |
scrollcolor dd 0x778877 |
scrollboxcol dd 0x335533 |
scrollbutcol dd 0x224422 |
scrollbutsize dd 9 |
usescroll dd 1 |
;URL LINE PARAMETRS |
urlx dd 10 |
urly dd 20 |
urlxsize dd 350 |
urlysize dd 12 |
drawmenu: |
mov eax,4 |
mov esi,12 |
menuloo: |
int 0x40 |
add ebx,11 |
add edx,12 |
dec edi |
jnz menuloo |
ret |
menubutton: |
mov eax,8 |
nextmenubut: |
int 0x40 |
add ecx,11*65536 |
inc edx |
dec edi |
jnz nextmenubut |
ret |
;***************************** |
; READ FILE STRUCTURE PROC |
;***************************** |
read_directory: |
; STEP 0 SEt TYPE OF SORT |
mov eax,[viewmode] |
;with no show del files |
and eax,0FFFFFFFBh |
cmp eax,0 |
jnz no_sort_by_name |
mov [start],0 |
mov [x0],12 |
mov [x1],99 |
mov [x2],99 |
mov [x3],99 |
jmp sortset |
no_sort_by_name: |
dec eax |
jnz no_sort_by_ext |
mov [start],9 |
mov [x0],9 |
mov [x1],99 |
mov [x2],99 |
mov [x3],12 |
jmp sortset |
no_sort_by_ext: |
dec eax |
jnz no_sort_by_size |
mov [start],30 |
mov [x0],12 |
mov [x1],99 |
mov [x2],99 |
mov [x3],38 |
jmp sortset |
no_sort_by_size: |
dec eax |
mov [start],21 |
mov [x0],12 |
mov [x1],17 |
mov [x2],20 |
mov [x3],26 |
jmp sortset ;sort by date |
;SORT VARILE |
start dd 0 |
x0 dd 0 |
x1 dd 0 |
x2 dd 0 |
x3 dd 0 |
sortset: |
;STEP 1 CLEAR CONVINFO |
mov edi,convinfo |
mov al,255 |
mov ecx,4096*62 ;512 |
cld |
rep stosb |
;STEP 2 TEST ON HD OR PARTITION |
cmp [path],byte '/' |
je nstep |
mov ecx,61+62 |
loxhd: |
mov al,[hdimg+ecx] |
mov [convinfo+ecx],al |
dec ecx |
jns loxhd |
mov [listsize],0 |
ret |
nstep: |
cmp [path+3],byte '/' |
je nstep2 |
mov ecx,61+62 |
loxpt: |
mov al,[ptimg+ecx] |
mov [convinfo+ecx],al |
dec ecx |
jns loxpt |
mov [listsize],0 |
ret |
nstep2: |
;STEP 3 CLEAR OUTINFO |
mov edi,outinfo ;0x14000 ;0x20000 |
xor eax,eax |
mov ecx,4096*32 ;512 |
cld |
rep stosb |
;STEP 4 READ DATA FROM HD |
mov dword [farea],outinfo |
mov dword [readblock],0 |
loorhd: |
mov eax,[readblock] |
mov [fileinfoblock+4],eax |
mov eax,58 |
mov ebx,fileinfoblock |
int 0x40 |
cmp eax,0 |
jne hd_err |
add dword [farea],512 |
inc dword [readblock] |
cmp dword [readblock],4096/16 |
jna loorhd |
hd_err: |
mov ebx,dword [readblock] |
shl ebx,4 |
mov dword [blocksread],ebx ; for quick resorting |
cmp eax,5 |
je end_of_dir |
; It's erorr's test is poor code |
cmp eax,1 |
jne no_inv_part |
label 10,10,'Invalid partition or hd base',cl_Red+font_Big |
jmp end_of_dir |
no_inv_part: |
cmp eax,3 |
jne no_unk_fs |
label 10,10,'Unknow file system',cl_Red+font_Big |
jmp end_of_dir |
no_unk_fs: |
end_of_dir: |
mov [dirlen],ebx |
; command succesful |
mov esi,outinfo ;data_area+1024 |
; mov edi,fileinfo+11 |
mov edx,0 ;4096 ;16 |
newlineb: |
mov edi,fileinfo+11 |
pushad ; clear |
mov al,32 |
mov ecx,58 |
sub edi,11 |
cld |
rep stosb |
popad |
mov cl,[esi] ; end of entries ? |
cmp cl,6 |
jnz noib0 |
mov [edi+26],dword 'EOE ' |
add esi,32 |
; add edi,62 |
jmp inf |
noib0: |
mov cl,[esi+0] |
cmp cl,0xe5 |
je yesdelfil |
mov cl,[esi+11] ; long fat32 name ? |
cmp cl,0xf |
jnz noib1 |
mov [edi+26],dword 'F32 ' |
add esi,32 |
; add edi,62 |
jmp inf |
noib1: |
mov eax,'DAT ' ; data or .. ? |
mov cl,[esi+0] ; deleted file |
cmp cl,0xe5 |
je yesdelfil |
cmp cl,0x0 |
je yesdelfil |
jmp nodelfil |
yesdelfil: |
mov eax,'DEL ' |
jmp ffile |
nodelfil: |
mov cl,[esi+11] ; folder |
and cl,0x10 |
jz ffile |
mov eax,'FOL ' |
mov [edi+26],eax |
jmp nosize |
ffile: |
; Asko patch for v79 |
mov cl,[esi+11] ; fold |
and cl,0xf |
cmp cl,0xf ; skip long filename |
jz novol |
test cl,0x8 ; is it fold label? |
jz novol ; no |
mov eax,'Fvol' |
mov [edi+26],eax |
jmp nosize |
novol: |
mov [edi+26],eax |
pusha ; size |
mov eax,[esi+28] |
mov esi,edi |
add esi,37 |
mov ebx,10 |
mov ecx,8 |
newnum: |
xor edx,edx |
div ebx |
add dl,48 |
mov [esi],dl |
test eax,eax |
jz zernum |
dec esi |
loop newnum |
zernum: |
popa |
nosize: |
pusha ; date |
mov [edi+17],dword '. .' |
movzx eax,word [esi+24] |
shr eax,9 ; year |
add eax,1980 |
mov ecx,4 |
newdel1: |
dec ecx |
xor edx,edx |
mov ebx,10 |
div ebx |
add edx,48 |
mov [edi+ecx+21],dl |
test ecx,ecx |
jnz newdel1 |
movzx eax,word [esi+24] |
shr eax,5 ; month |
and eax,0x0f |
mov ecx,2 |
newdel2: |
dec ecx |
xor edx,edx |
mov ebx,10 |
div ebx |
add edx,48 |
mov [edi+ecx+18],dl |
test ecx,ecx |
jnz newdel2 |
movzx eax,word [esi+24] |
and eax,0x1f ; day |
mov ecx,2 |
newdel3: |
dec ecx |
xor edx,edx |
mov ebx,10 |
div ebx |
add edx,48 |
mov [edi+ecx+15],dl |
test ecx,ecx |
jnz newdel3 |
popa |
pusha ; number |
mov eax,edx |
sub eax,4096 |
neg eax |
xor edx,edx |
mov ebx,10 |
div ebx |
add dl,48 |
mov [edi+43],dl ;0001 |
xor edx,edx |
div ebx |
add dl,48 |
mov [edi+42],dl ;0010 |
xor edx,edx |
div ebx |
add al,48 |
add dl,48 |
mov [edi+41],dl ;0100 |
mov [edi+40],byte 0 ;1000 |
popa |
mov ecx,8 ; first 8 |
cld |
rep movsb |
mov [edi],byte '.' |
inc edi |
mov ecx,3 ; last 3 |
cld |
rep movsb |
add esi,(32-11) |
; add edi,(60-12+2) |
inf: |
pushad |
;STEP 5 Test on WRITE OR NOTWRITE |
mov edx,fileinfo+11 |
looo: |
; Delete del, eoe, f32 and another head-names |
cmp [viewmode],3 ;0-3 no outdel |
ja del_out |
cmp [edx+26],dword 'DEL ' |
je nextfl |
del_out: |
cmp [edx+26],dword 'DEL ' |
jne no_del |
cmp [edx],dword 0 ;431 ;435 ;484 +10% speed |
je nextfl |
no_del: |
cmp [edx+26],dword 'EOE ' |
je nextfl |
cmp [edx+26],dword 'F32 ' ;F32 not useles |
je nextfl |
cmp [edx],dword '. ' |
je nextfl |
cmp [edx],dword '.. ' |
je nextfl |
cmp [edx],dword 'FIRS' |
je nextfl |
; ---------_______-------_______ --------_________----------- |
; SORT by name and del deletet files or f32 headers from list |
; _________-------_______ --------_______---------___________ |
; STEP 6 UNIVERSAL SORT ALGORYTHM |
xxx: |
mov esi,0 ;[tekfilename] ;0 |
mov ebx,[start] ; 0 |
; At first Fold after Dat and Del |
ftestname: |
cmp byte [fileinfo+11+26],'F' |
je F |
cmp byte [fileinfo+11+26],'D' |
je D |
jmp add_element |
D: cmp byte [convinfo+esi+26],'D' |
je add_element |
cmp byte [convinfo+esi+26],'F' |
je skipfile |
jmp add_element |
F: cmp byte [convinfo+esi+26],'D' |
je writenow |
; cmp byte [convinfo+esi+26],'F' |
; je add_element |
; jmp add_element |
add_element: |
mov al,[fileinfo+ebx+11] |
cmp al,[convinfo+esi+ebx] |
je equal |
jb writenow |
skipfile: |
add esi,62 |
mov ebx,[start] ;0 |
jmp ftestname |
equal: |
inc ebx |
cmp ebx,[x0] |
je writefile |
cmp ebx,[x1] |
je x1p |
cmp ebx,[x2] |
je x2p |
cmp ebx,[x3] |
jae x3p |
jmp add_element |
x1p: |
mov ebx,18 |
jmp add_element |
x2p: |
mov ebx,15 |
jmp add_element |
x3p: |
mov ebx,0 |
jmp add_element |
writenow: |
mov ecx,4096*62 |
sub ecx,esi |
ldloop: |
mov al,[convinfo+ecx+esi] |
mov [convinfo+ecx+esi+62],al |
dec ecx |
jns ldloop |
writefile: |
mov ecx,61 |
wfloop: |
mov al,[fileinfo+ecx+11] |
mov [convinfo+ecx+esi],al |
dec ecx |
jns wfloop |
nextfile: |
nextfl: |
; popad |
; pushad |
mov eax,edx |
shl eax,26 |
cmp eax,0 |
jne no_outcnt |
push edx |
drawfbox 294,25,(4*6),10,cl_White |
pop ebp |
outcount ebp,294,25,cl_Black,4*65536 |
no_outcnt: |
popad |
inc edx |
cmp edx,4096 |
jnae newlineb |
;STEP 8 GET SIZE OF RESORTING LIST |
mov ecx,0 |
mov edi,0 |
mov eax,[blocksread] |
mov ebx,62 |
mul ebx |
mov edx,eax |
loogs: |
mov eax,dword [convinfo+edi+26] |
cmp eax,dword 0xffffffff |
je endgs |
add edi,62 |
inc ecx |
cmp edi,edx ;4096*62 |
jnae loogs |
endgs: |
mov [listsize],ecx |
ret |
;****************************************************************************** |
; DATA AREA |
pmenu_draw dd 0 ;if poup menu is draw,update all window |
flick dd 0 ;anti flick on ? |
drawhf dd 0 ;draw file menu? |
drawhv dd 0 ;draw view menu? |
drawhi dd 0 ;draw info menu? |
browser dd 0 ;0-dialog, 1-browser |
cursor dd 0 ;cursor in prompt line |
focus dd 0 ;prompt edit or window? |
viewmode dd 0 ;folder sort & not del |
downstop dd 0 |
filecursor dd 0 |
mousex dd 0 |
mousey dd 0 |
blocksread dd 0 |
listsize dd 0 ;num of files in directory |
temp dd 0 |
readblock dd 1 |
dlg_type db 0 ;S-save O-open |
;01234567890123456789012345678901234567890123456789012345678912 |
hdimg db 'HD HARDDISK FOL ' |
db 'RD RAMDISK FOL ' |
ptimg db '1 FIRST PARTITION FOL ' |
db '2 SECOND PARTITION FOL ' |
modetext: |
;0123456789012345 |
db 'SORT BY NAME 0' |
db 'SORT BY EXT. 1' |
db 'SORT BY SIZE 2' ;type sort |
db 'SORT BY DATE 3' |
db 'DEL SORT NAME 4' |
db 'DEL SORT EXT. 5' |
db 'DEL SORT SIZE 6' ;type sort |
db 'DEL SORT DATE 7' |
dirlen dd 0x1 |
b_color dd 0x6677cc |
; //// Willow |
MRUfile: |
dd 0x0 |
dd 0x0 |
dd 0x1 |
dd path |
dd tempzone |
db '/RD/1/MRU.LST',0 |
; //// Willow |
;Name of programs |
editor db 'TINYPAD ' |
bmpview db 'MV ' |
jpgview db 'JPEGVIEW ' |
gifview db 'GIFVIEW ' |
ac97wav db 'AC97WAV ' |
copyrfile db 'COPYR ' |
; //// Willow |
pngview db '@RCHER ' |
; //// Willow |
fileinfo_start: |
dd 16 |
dd 0 |
dd 0 ;tempzone+1000; |
dd 0 |
dd tempzone ;0x10000 |
open_path: |
times 256 db 0 ;run app path |
fileinfoblock: |
dd 0x0 ; read |
dd 0x0 ; first block |
dd 0x1 ; number of blocks to read |
farea: |
dd outinfo ; ret offset |
dd tempzone ; work size of sytemram |
path: |
times 256 db 0 ;path |
;rb 256 |
but_file: |
file 'systr12.GIF' |
butimg: |
rb 400*16*3+8 ;buttons (left pice of picture) |
logoimg: |
rb 70*16*3+8 ;logo (right pice of picture) |
logoinfimg: |
rb 60*60*3+8 ;logoinfo (right pice of picture) |
upsb: |
rb 8*9*3+8 ;up scroll button |
dnsb: |
rb 8*9*3+8 ;down scroll button |
;ICONS RESERVE AREA |
hdico: |
rb 12*9*3+8 |
rdico: |
rb 12*9*3+8 |
folico: |
rb 12*9*3+8 |
datico: |
rb 12*9*3+8 |
delico: |
rb 12*9*3+8 |
imgico: |
rb 12*9*3+8 |
txtico: |
rb 12*9*3+8 |
asmincico: |
rb 12*9*3+8 |
execico: |
rb 12*9*3+8 |
tempimg: ;reserve ram for images |
rb 400*100*3+8 ;for picture |
rb 8000 |
gif_hash: |
rd 4096 |
tempzone: ;temp zone for 58 function |
rb 4000 |
sourcepath rb 100 |
destpath rb 100 |
MYPID: |
rd 8 |
I_END: |
param_area: |
rb 256 |
paramtest: |
rb 256 |
filedir: |
rb 256 |
procinfo process_information |
sc system_colors |
fileinfo: |
rb 200 ;4096*62+1024 |
outinfo: |
rb 4096*34+1024 |
convinfo: |
rb 4096*62+1024 |
RAM_END: |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/archer/trunk/@RCHER.ASM |
---|
0,0 → 1,424 |
; @RCHER - DEflate unpacker v1.0 |
; |
; Written in pure assembler by Ivushkin Andrey aka Willow |
; |
; Created: May 6, 2005 |
; |
; Last changed: July 14, 2005 |
; |
; Compile with FASM |
SYS equ meos |
PARAM_PTR equ png_image |
DUMPFILE equ '/hd/1/out.txt' |
SHOW_RBLOCK equ 0;1 |
SHOW_PNG_SEC equ 0;1 |
SHOW_METH equ 0;1 |
FILE_NUM equ 0 |
MEMORY equ 0x800000 |
BITS equ 16 |
BUFSIZE equ 32 |
BUFPTR equ area |
PASSW_LEN equ 32 |
NO_STOPS equ 1 |
SHOW_CHARS equ 0 |
BSIZE equ 512 |
INBUF equ BUFSIZE*BSIZE*2 |
OUTBUF equ 4*1024*1024 |
IGNORE_DIRS equ 0 |
MOVE_SLINE_LEV equ 8 |
DECRYPT_MODE equ 100b |
PNG_MODE equ 10b |
TAR_MODE equ 1000b |
STAY_MODE equ 10000b |
IPC_MODE equ 100000b |
RAW_MODE equ 1000000b |
THREAD_YES equ 10000000b |
if SYS eq win |
format PE console |
entry start |
;match =win,SYS |
;{ |
; include 'D:\Ivushkin\projects\fasmw\INCLUDE\win32a.inc' |
;} |
else |
use32 |
org 0x0 |
db 'MENUET01' |
dd 0x01 |
dd start |
dd I_END |
dd MEMORY |
dd MEMORY-2048 |
if PARAM_PTR eq param |
dd 0 |
else |
dd PARAM_PTR |
end if |
dd 0x0 |
include "lang.inc" |
if PARAM_PTR eq param |
param db 'RQ' |
db '000037' |
db '/hd/1/zip/png.zip',0 |
end if |
;match =meos,SYS |
;{ |
include "macros.inc" |
; purge mov |
include "debug.inc" |
;} |
end if |
language equ en |
if SYS eq win |
section '.text' code readable executable writeable |
end if |
include "arcmacro.inc" |
include "parser.inc" |
include "deflate.inc" |
include "sys.inc" |
FileNum dd FILE_NUM |
;FNAME equ '/hd/1/zip/pngsuite/s01n3p01.png' |
start: |
if SYS eq win |
invoke GetStdHandle, STD_OUTPUT_HANDLE |
mov [cons],eax |
invoke GetStdHandle, STD_INPUT_HANDLE |
mov [cons_in],eax |
Msg 0 |
Msg 1 |
else |
Msg 0 |
Msg 1 |
mcall 40,10000101b |
; jmp again |
CmdLine |
red: |
call draw_window |
mcall 12,2 |
still: |
mcall 10 |
cmp eax,1 |
je red |
cmp eax,2 |
jne .nokey |
mcall 2 |
cmp ah,9 |
jz quit |
jmp still |
.nokey: |
cmp eax,3 |
jne still |
mcall 17 |
cmp ah,1 |
jne still |
mcall 23,30 |
cmp eax,3 |
jne .noquit |
call KillViewer |
mcall -1 |
.noquit: |
mcall 17 |
QueryFile |
and [FileNum],0 |
test eax,eax |
jnz still |
end if |
again: |
Newline |
xor eax,eax |
; and [Flags],STAY_MODE |
and [CRC32],eax |
and [IDATsize],eax |
mov [Adler32],1 |
call OpenFile |
test ebx,ebx |
jnz .sizeok2 |
.sizebad2: |
Msg 14 |
jmp quit |
.sizeok2: |
mov [filesize],ebx |
test [Flags],RAW_MODE |
jz .norawm |
mov eax,[arc_base] |
xor ebx,ebx |
call FileSeek |
jmp .sizeok |
.norawm: |
call SfxParse |
call ZipParse |
cmp edx,52 |
je .notzip |
mov ecx,[FileNum] |
call ZipFindN |
cmp edx,4 |
je quit |
test [Flags],DECRYPT_MODE |
jz .nopass |
call ZipDecrypt |
push esi |
mov ecx,31 |
._: |
mov al,[esi] |
push eax |
call decrypt_byte |
xor al,byte[esp] |
add esp,4 |
call UKeys |
mov [esi],al |
inc esi |
loop ._ |
pop esi |
ud2 |
.nopass: |
cmp [unp_size],0 |
jne .sizeok |
.sizebadq: |
Msg 13 |
jmp quit |
.notzip: |
call GzipParse |
test edx,edx |
jne .notgzip |
jmp .sizeok |
.notgzip: |
call PngParse |
test edx,edx |
jz .sizeok1 |
cmp edx,21 |
je .sizebad |
test [Flags],RAW_MODE |
jne .sizeok |
Msg 40 |
jmp exit |
.sizebad: |
Msg 17 |
jmp exit |
.sizeok1: |
if ~ SYS eq win |
call KillViewer |
end if |
Msg 39 |
mov edi,[outp] |
call Deflate.blkbegin |
jmp .defl_end |
.sizeok: |
call Deflate ; <=========== |
.defl_end: |
test [bits],7 |
jnz .esi_ok |
dec esi |
.esi_ok: |
push dword[esi] ; <- Adler !!! |
mov esi,output |
sub edi,esi |
mov ecx,edi |
mov [outfile.size],ecx |
test [Flags],RAW_MODE |
jnz .skipAdler |
test [Flags],PNG_MODE |
jnz .skipCRC |
push esi ecx |
call UCRC |
Msg 11 |
mov eax,[CRC32] |
mov edx,36 |
cmp eax,[CRC_check] |
je .crcok |
dec edx |
.crcok: |
Msg edx |
if SYS eq win |
else |
dph eax |
end if |
pop ecx esi |
jmp .skipAdler |
.skipCRC: |
call UAdler |
Msg 10 |
mov eax,[Adler32] |
bswap eax ; <- calculated Adler !!! |
mov edx,36 |
cmp eax,[esp] |
je .adlok |
dec edx |
.adlok: |
Msg edx |
if SYS eq win |
else |
dph eax |
end if |
.skipAdler: |
pop eax |
Newline |
.nomoreIDAT: |
mov ebx,output |
if SYS eq win |
Msg 37 |
invoke CloseHandle, [hnd] |
invoke CreateFile,dumpfile,GENERIC_WRITE, FILE_SHARE_WRITE, NULL, \ |
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,NULL |
mov [hnd],eax |
invoke WriteFile, eax,ebx,[outfile.size],cparam1,NULL |
invoke CloseHandle, [hnd] |
else |
test [Flags],PNG_MODE |
jnz .nosave |
test [Flags],TAR_MODE |
jnz .nomsg |
Msg 37 |
.nomsg: |
mov [outfile.out],ebx |
mcall 58,outfile |
test [Flags],TAR_MODE |
jnz .nosave |
call StartPad |
.nosave: |
end if |
test [Flags],PNG_MODE |
jz NoPng |
xor eax,eax |
mov edi,filters |
mov ecx,6 |
rep stosd |
mov edi,png_image |
mov esi,output |
;// |
mov [outp],edi |
;// |
call PngFilter |
call FiltStats |
mov [outfile.size],edi |
mov ebx,[outp];png_image |
if SYS eq win |
exit: |
Msg 12 |
invoke CreateFile,outfile,GENERIC_WRITE, FILE_SHARE_WRITE, NULL, \ |
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,NULL |
mov [hnd],eax |
invoke WriteFile, eax,ebx,[outfile.size],cparam1,NULL |
invoke CloseHandle, [hnd] |
call RunViewer |
and [arc_base],0 |
and [Flags],STAY_MODE |
quit: |
QueryFile |
test eax,eax |
jnz again |
invoke ExitProcess,0 |
else |
exit: |
mov [outfile.out],ebx |
test [Flags],TAR_MODE |
jz .notar |
Msg 37 |
mcall 58,outfile |
call StartPad |
.notar: |
Msg 12 |
call RunViewer |
and [arc_base],0 |
and [Flags],STAY_MODE |
quit: |
test [Flags],STAY_MODE |
jnz red |
mcall -1 |
end if |
NoPng: |
test [Flags],TAR_MODE |
if SYS eq win |
jz quit |
else |
jz still |
end if |
mov ecx,dumpf_len |
mov esi,dumpfile |
mov edi,filename |
rep movsb |
call OpenFile |
test ebx,ebx |
jz again.sizebadq |
call TarParse |
mov ecx,[FileNum] |
call TarFindN |
cmp [outfile.size],0 |
jz again.sizebadq |
mov ebx,esi |
jmp exit |
if ~ SYS eq win |
draw_window: |
mcall 12,1 |
mov ebx,15 |
mov ecx,ebx |
mov edx,0x0e26830 |
mov edi,edx |
mcall 0,,,,0x1f2a870 |
mcall 8,,,1+1 shl 30 |
mcall 4,<6,5>,0x10d0d0d0,msgs+5,1 |
mcall ,<5,5>,0x10202020 |
ret |
end if |
include 'data.inc' |
if SYS eq win |
section '.idata' import data readable writeable |
library kernel,'KERNEL32.DLL',\ |
comdlg,'COMDLG32.DLL',\ |
user,'USER32.DLL' |
import kernel,\ |
CreateFile,'CreateFileA',\ |
GetFileSize,'GetFileSize',\ |
ReadFile,'ReadFile',\ |
WriteFile,'WriteFile',\ |
SetFilePointer,'SetFilePointer',\ |
CloseHandle,'CloseHandle',\ |
GetStdHandle,'GetStdHandle',\ |
WriteConsole,'WriteConsoleA',\ |
ReadConsole,'ReadConsoleA',\ |
CreateProcess,'CreateProcessA',\ |
WritePrivateProfileString,'WritePrivateProfileStringA',\ |
ExitProcess,'ExitProcess' |
import comdlg,\ |
GetOpenFileName,'GetOpenFileNameA' |
import user,\ |
wsprintf,'wsprintfA',\ |
SendMessage,'SendMessageA',\ |
FindWindowEx,'FindWindowExA',\ |
WaitForInputIdle,'WaitForInputIdle' |
section '.reloc' fixups data readable discardable |
end if |
if ~ SYS in <meos,win> |
error "Please specify SYS: meos OR win" |
end if |
/programs/other/archer/trunk/archer.txt |
---|
0,0 → 1,176 |
@RCHER FOR MENUET v1.0 July 14, 2005 |
Written in pure assembler by Ivushkin Andrey aka Willow |
Deflate unpacker |
Vivat assembler et MENUETOS! |
I tender thanks to everyone who spends his time in feasible effortsfor that |
little OS evolution. Now in my own rating the Mario79's distro named Kolibri4 |
takes 1th place. It is always pleasant to use modern software. Go on! |
@RCHER is intended to view & unpack data compressed by Deflate method |
(including both static and dynamic Huffman). This method (although it isn't the |
best already) is used by such file formats as ZIP (modern versions: PKZIP for |
MS-DOS can create archives using other, less effective compression methods, |
which @RCHER doesn't support), GZIP, JAR, OpenOffice files, SFX ZIP executables |
and some others. I couldn't prevent myself to include support of PNG images |
(they use the similar compression) and TAR and TAR+GZIP archives. |
When the program is started, a little button carrying a @ symbol appears in the |
left top corner of screen. Clicking this button opens a SYSXTREE dialog to |
select a file being unpacked. Doubleclick closes the application. @RCHER |
outputs its information messages to Debug Board. If an archive contains more |
than one file, the 1st is by default unpacked into /HD/1/OUT.TXT (you may |
change the DUMPFILE constant in @RCHER.ASM) and is opened through TINYPAD |
or - if it's a PNG image - in the built-in viewer. |
These are unpacking flags that may exist in a commandline before an archive |
filename: |
s - do not close the program after unpacking; |
n - decompress the K-th archive file, where K is the following dword in |
commandline; |
N - decompress the K-th archive file, where K is ASCII number from the |
following 6 bytes of commandline; |
R - "raw" Deflate data, without descriptors and headers; |
q - begin file parsing from offset of K, where K is following dword in |
commandline; |
Q - begin file parsing from offset of K, where K is ASCII number from the |
following 6 bytes of commandline. |
Commandline example: |
cmd_string: |
db 'sN000037q' |
dd 1465 |
db '/hd/1/png.zip',0 |
It means to open the 34th (counting from 0) file of archive /hd/1/png.zip |
and do not terminate. Archive will be parsed starting at offset 1465. |
To-Do list: |
1. Support for interlaced PNG, alpha-channels, gamma-correction, background, |
Significant bits and a lot of cool parts of that format. |
2. Output of archive content through IPC or into a built-in window like SYSTREE |
(as we are going to decide with the respected colleagues). |
3. Searching of archive files by name and wildcards! |
4. Unpacking into a file specified. |
5. Means on saving memory space (now @RCHER gorges 8 Mb!): moving RAM areas, |
blocked file output. To do the last thing it is necessary to test carefully |
the reliability of harddisk I/O, directory creation and file deletion. These |
kernel capabilities aren't still documented. |
6. Archive contents integration into SYSXTREE & MFAR filemanagers. We have to |
unify the calling format (like a structure in the sysfunc 58). |
7. Add comments to source. |
8. Correct bugs to be found |
Special thanks to: |
Explanation of algorythm of Deflate format decoder with decoding samples |
(evm.narod.ru) |
RFC 1951 DEFLATE Compressed Data Format Specification version 1.3 |
ZIP File Format Specification version 4.5 by PKWARE Inc. |
"An Explanation of the Deflate Algorithm" by Antaeus Feldspar |
RFC 1952 GZIP file format specification version 4.3 |
TAR Format. Information from File Format List 2.0 by Max Maischein. |
RFC 1950 ZLIB Compressed Data Format Specification version 3.3 |
PNG (Portable Network Graphics) Specification version 1.0 |
Michael Dipperstein's Huffman Code Page |
I expect your remarks and suggestions on the @RCHER's topic, "Coding" section |
at meos.sysbin.com forum. |
See you later! |
**************************************** |
**************************************** |
@RCHER MENUET v1.0 14 ¨î«ï 2005 £. |
¯¨á ç¨á⮬ áᥬ¡«¥à¥ ¢ãèª¨ë¬ ¤à¥¥¬ (Willow) |
Deflate à ᯠª®¢é¨ª |
Vivat assembler et MenuetOS! |
ëà ¦ î ¨áªà¥îî ¡« £®¤ à®áâì ¢á¥¬ ⥬, ªâ® ¥ ¦ «¥ï ᢮¥£® ¢à¥¬¥¨, |
¤¥« ¥â ¯®á¨«ìë© ¢ª« ¤ ¢ à §¢¨â¨¥ í⮩ ¬ «¥ìª®© . ¥©ç á ¢ ¬®¥¬ ᮡá⢥®¬ |
३⨣¥ 1-¥ ¬¥áâ® § ¨¬ ¥â ¤¨áâਡã⨢ Mario79 Kolibri4. ᥣ¤ ¯à¨ïâ® |
¯®«ì§®¢ âìáï ᮢ६¥ë¬ . ª ¤¥à¦ âì! |
@RCHER ¯à¥¤ § ç¥ ¤«ï ¯à®á¬®âà ¨ à ᯠª®¢ª¨ ¤ ëå, ᦠâëå á ¯®¬®éìî ¬¥â®¤ |
Deflate (¢ª«îç ï áâ â¨ç¥áª¨© ¨ ¤¨ ¬¨ç¥áª¨© ää¬ ). ë¬ ¬¥â®¤®¬ (å®âï ® |
㦥 ¥ ¯à¥â¥¤ã¥â §¢ ¨¥ ¨«ãç襣®) ¯®«ì§ãîâáï ä®à¬ âë ä ©«®¢ ZIP |
(ᮢ६¥ë¥ ¢¥àᨨ: PKZIP ¤«ï MS-DOS ¬®¦¥â ᮧ¤ ¢ âì à娢ë á ¤à㣨¬¨, ¬¥¥¥ |
íä䥪⨢묨 ¬¥â®¤ ¬¨ ᦠâ¨ï, ª®â®àë¥ @RCHER ¥ ¯®¤¤¥à¦¨¢ ¥â), GZIP, JAR, |
ä ©«ë OpenOffice, SFX-ZIP ¯à¨«®¦¥¨ï ¨ àï¤ ¤à㣨å. ¥ ¬®£ 㤥ঠâìáï ¨ ¥ |
ᤥ« âì ¯®¤¤¥à¦ªã ¨§®¡à ¦¥¨© ¢ ä®à¬ ⥠PNG (¨á¯®«ì§ãîé¨å தáâ¢¥ë© ¬¥â®¤ |
ᦠâ¨ï) ¨ à娢®¢ TAR ¨ TAR+GZIP. |
ਠ§ ¯ã᪥ ¯à®£à ¬¬ë ¢ «¥¢®¬ ¢¥à奬 㣫ã íªà ¯®ï¢«ï¥âáï ¬ «¥ìª ï ª®¯ª |
á® § 窮¬ @. ਠ¦ ⨨ ¥¥ ®âªàë¢ ¥âáï ®ª® ¢ë¡®à ä ©« (SYSXTREE) ¤«ï |
à ᯠª®¢ª¨. ¢®©®© 饫箪 § ªàë¢ ¥â ¯à¨«®¦¥¨¥. ä®à¬ æ¨®ë¥ á®®¡é¥¨ï |
@RCHER ¢ë¢®¤¨â ¤®áªã ®â« ¤ª¨. ᫨ à娢 ᮤ¥à¦¨â ¥áª®«ìª® ä ©«®¢, ¯® |
㬮«ç ¨î ¯¥à¢ë© ¨§ ¨å à ᯠª®¢ë¢ ¥âáï /HD/1/OUT.TXT (¯®¬¥ï©â¥ ¯à¨ |
¥®¡å®¤¨¬®á⨠ª®áâ âã DUMPFILE ¢ @RCHER.ASM) ¨ ®âªàë¢ ¥âáï ç¥à¥§ TINYPAD |
¨«¨ - ¢ á«ãç ¥ ª à⨪¨ PNG - ¢ ®ª¥ ¢áâ஥®£® ¯à®á¬®âà騪 . |
ª®¬ ¤®© áâப¥ ¯¥à¥¤ ¨¬¥¥¬ à娢 ¬®£ãâ ¢ ¯à®¨§¢®«ì®¬ ¯®à浪¥ 㪠§ë¢ âìáï |
ä« £¨ à ᯠª®¢ª¨: |
s - ¥ § ªàë¢ âì ¯à®£à ¬¬ã ¯®á«¥ à ᯠª®¢ª¨; |
n - à ᯠª®¢ âì K-© ä ©« à娢 , £¤¥ K - á«¥¤ãî騩 dword ¢ ª®¬ ¤®© áâப¥; |
N - à ᯠª®¢ âì K-© ä ©« à娢 , £¤¥ K - ASCII ç¨á«® ¨§ á«¥¤ãîé¨å 6 ¡ ©â |
ª®¬ ¤®© áâப¨; |
R - "áëàë¥" Deflate-¤ ë¥, ¡¥§ ®¯¨á ⥫¥© ¨ § £®«®¢ª®¢; |
q - ¯à®á¬®âà ä ©« ç âì ᮠᬥ饨ï K, £¤¥ K - á«¥¤ãî騩 dword ¢ ª®¬ ¤®© |
áâப¥; |
Q - ¯à®á¬®âà ä ©« ç âì ᮠᬥ饨ï K, £¤¥ K - ASCII ç¨á«® ¨§ á«¥¤ãîé¨å 6 |
¡ ©â ª®¬ ¤®© áâப¨. |
ਬ¥à ª®¬ ¤®© áâப¨: |
cmd_string: |
db 'sN000037q' |
dd 1465 |
db '/hd/1/png.zip',0 |
â® ®§ ç ¥â, çâ® á«¥¤ã¥â ®âªàëâì 34-© (áç¨â ï ®â 0) ä ©« à娢 /hd/1/png.zip |
¨ ¥ § ¢¥àè âì à ¡®âã. à®á¬®âà à娢 ç¥âáï ᮠᬥ饨ï 1465. |
â® ¥é¥ 㦮 ᤥ« âì: |
1. ®¤¤¥à¦ª ç¥à¥ááâà®çëå (interlaced) PNG, â ª¦¥ «ìä -ª «®¢, £ ¬¬ë, |
ä® , Significant bits ¨ ªãç¨ ¤àã£¨å ¯à¨¬®ç¥ª í⮣® ä®à¬ â . |
2. 뢮¤ ᮤ¥à¦¨¬®£® à娢®¢ ç¥à¥§ IPC ¨«¨ ¢® ¢áâ஥®¬ ®ª¥ ¯®¤®¡¨¥ SYSTREE |
(íâ® ª ª à¥è¨¬ á 㢠¦ ¥¬ë¬¨ ª®««¥£ ¬¨). |
3. ®¨áª ä ©«®¢ ¢ à娢¥ ¯® ¨¬¥¨ ¨ ¤ ¦¥ ¬ ᪥! |
4. ᯠª®¢ª ¢ 㪠§ ë© ä ©«. |
5. ¥à®¯à¨ïâ¨ï ¯® íª®®¬¨¨ ¯ ¬ï⨠(ᥩç á @RCHER ¦à¥â 8 ¡!): ¯¥à¥¬¥é¥¨¥ |
ãç á⪮¢ ¯ ¬ïâ¨, ¡«®çë© ¢ë¢®¤ ¢ ä ©«. «ï ¯®á«¥¤¥£® ¥®¡å®¤¨¬® âé â¥«ì® |
¯à®â¥áâ¨à®¢ âì ¤¥¦®áâì ¢®®¤ -¢ë¢®¤ , ᮧ¤ ¨ï ª â «®£®¢ ¨ 㤠«¥¨ï |
ä ©«®¢. ®ª í⨠¢®§¬®¦®á⨠ï¤à ¥ ¤®ªã¬¥â¨à®¢ ë. |
6. ⥣à æ¨ï à娢ëå ª â «®£®¢ ¢ ä ©«®¢ë¥ ¬¥¥¤¦¥àë SYSXTREE, MFAR. |
®âॡã¥âáï ã¨ä¨æ¨à®¢ âì ä®à¬ ⠢맮¢ ( ¯®¤®¡¨¥ áâàãªâãàë ¢ 58 äãªæ¨¨). |
7. ⪮¬¬¥â¨à®¢ âì ª®¤. |
8. á¯à ¢¨âì ¡ £¨, ª®â®àë¥, ¥á®¬¥®, ©¤ãâáï ;-) |
á®¡ë¥ ¡« £®¤ à®áâ¨: |
¯¨á ¨¥ «£®à¨â¬ ¤¥ª®¤¥à ä®à¬ â Deflate ¯à¨¬¥à å ¤¥ª®¤¨à®¢ ¨ï |
(evm.narod.ru) |
RFC 1951 DEFLATE Compressed Data Format Specification version 1.3 |
ZIP File Format Specification version 4.5 by PKWARE Inc. |
"An Explanation of the Deflate Algorithm" by Antaeus Feldspar |
RFC 1952 GZIP file format specification version 4.3 |
TAR Format. Information from File Format List 2.0 by Max Maischein. |
RFC 1950 ZLIB Compressed Data Format Specification version 3.3 |
PNG (Portable Network Graphics) Specification version 1.0 |
Michael Dipperstein's Huffman Code Page |
¤ã ¢ è¨å § ¬¥ç ¨© ¨ ¯à¥¤«®¦¥¨© ®¤®¨¬¥®© ¢¥âª¥ à §¤¥« "®¤¨£" ä®à㬠|
meos.sysbin.com |
® ®¢ëå ¢áâà¥ç! |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/archer/trunk/arcmacro.inc |
---|
0,0 → 1,440 |
; @RCHER macros and messages |
; Written in pure assembler by Ivushkin Andrey aka Willow |
macro stop |
{ |
if SYS eq win & NO_STOPS eq 0 |
int3 |
end if |
} |
macro wait |
{ |
if ~ SYS eq win |
local .nodrw,.ex |
pusha |
mcall 10 |
cmp eax,1 |
jne .nodrw |
call draw_window |
.nodrw: |
mcall 17 |
.ex: |
popa |
end if |
} |
macro rbits dest,cnt |
{ |
if ~ cnt eq |
mov ecx,cnt |
end if |
if dest eq 0 |
xor eax,eax |
else |
mov eax,dest |
end if |
call read_bits |
} |
macro rep_err cond_ok, result, msg |
{ |
local .m |
j#cond_ok .m |
if ~ msg eq |
Msg msg |
end if |
mov edx,result |
jmp .err |
.m: |
} |
macro memcpy_esi dest, count,_add |
{ |
push esi |
if ~ _add eq |
add esi,_add |
end if |
mov edi,dest |
mov ecx,count |
rep movsb |
pop esi |
} |
DebugPrint: |
; in: edx-asciiz string ptr |
pusha |
if SYS eq win |
mov ecx,255 |
xor eax,eax |
mov edi,edx |
repne scasb |
sub edi,edx |
dec edi |
invoke WriteConsole,[cons],edx,edi,cparam1,NULL |
else |
call debug_outstr |
end if |
popa |
ret |
macro DebugPrintDec |
{ |
if SYS eq win |
call int2str |
mov edx,os_work |
call DebugPrint |
else |
call debug_outdec |
end if |
} |
macro Newline |
{ |
if SYS eq win |
pusha |
invoke WriteConsole,[cons],cr_lf,2,cparam1,NULL |
popa |
else |
newline |
end if |
} |
Msgcall: |
; edx - msg number |
pusha |
movzx edx,word[strs+edx*2] |
add edx,msgs |
call DebugPrint |
popa |
ret |
macro Msg num |
{ |
if ~ num eq edx |
mov edx,num |
end if |
call Msgcall |
} |
MSG_COUNT=0 |
macro str_table [str] |
{ |
forward |
local label |
dw label-msgs |
common |
msgs: |
forward |
label db str,0 |
MSG_COUNT=MSG_COUNT+1 |
} |
strs: |
if language eq ru |
str_table \ |
<'*** @RCHER - Deflate Unpacker ***',13,10>,\ ;0 |
<'*** Copyright Wiland Inc., 2005 ***',13,10>,\ ;1 |
' ©«®¢ ¢ à娢¥: ',\ ;2 |
<'End of Directory ¤®á⨣ãâ',13,10>,\ ;3 |
'¥â ä ©« á â ª¨¬ ®¬¥à®¬',\ ;4 |
<'FindByNumber ',13,10>,\ ;5 |
<'¥¢¥àë© ID ¡«®ª ää¬ ',13,10>,\ ;6 |
<'訡ª ¢ ª®¤ å ää¬ !',13,10>,\ ;7 |
<13,10,' áç¥â â ¡«¨æë CRC32',13,10>,\ ;8 |
'.',\ ;9 |
'Adler32',\ ;10 |
'CRC32',\ ;11 |
<' ¢¥à襮.',13,10>,\ ;12 |
<' ©« ¨¬¥¥â ã«¥¢ãî ¤«¨ã, à ᯠª®¢ª ®â¬¥¥ .',13,10>,\ ;13 |
<'âà ï ¤«¨ ä ©« -¨áâ®ç¨ª . 訡ª ¢ ¨¬¥¨? ⬥ .',13,10>,\ ;14 |
<'¥ GZIP à娢',13,10>,\ ;15 |
<'«¨èª®¬ ¡®«ì让 à §¬¥à ¢ë室®£® ä ©« ',13,10>,\ ;16 |
<"訡ª ¯à¨ à ᯠª®¢ª¥.",13,10>,\ ; 17 |
<'¥ à¨á㮪 PNG',13,10>,\ ; 18 |
<13,10,'*¤'>,\ ;19 |
<13,10,'*á'>,\ ;20 |
'¥®¦¨¤ ë© ª®¥æ ¡«®ª®¢ IDAT',\ ;21 |
'¥ä¨«ìâà æ¨ï:',\ ;22 |
'¨«ìâàë: None ',\ ;23 |
' Sub ',\ ;24 |
' Up ',\ ;25 |
' Avg ',\ ;26 |
' Paeth ',\ ;27 |
' 訡®ª: ',\ ;28 |
<'¥à¥ááâà®çë© PNG',13,10>,\ ;29 |
<'«®ª ¡¥§ ᦠâ¨ï',13,10>,\ ;30 |
<'¨¯ 梥⠥ ¯®¤¤¥à¦¨¢ ¥âáï',13,10>,\ ;31 |
<'¢¥¤¨â¥ ¯ à®«ì ¤«ï § è¨ä஢ ®£® ä ©« :',13,10>,\ ;32 |
<'®¨áª ä ©« ...',13,10>,\ ;33 |
'¥ ¬®¤ã«ì SFX',\ ;34 |
' ¥¢¥à ! ',\ ;35 |
' OK: ',\ ;36 |
<' ¯¨áì OUT.TXT',13,10>,\ ;37 |
' ',\ ;38 |
<'®¤£®â®¢ª ¨§®¡à ¦¥¨ï...',13,10>,\ ;39 |
<'ª ¦¨â¥ "R" ¤«ï ®¡à ¡®âª¨ áëàëå ¤ ëå. ⬥ .',13,10>,\ ;40 |
' ',\ ; |
' ',\ ; |
' ',\ ; |
' ',\ ; |
' ',\ ; |
' ',\ ; |
' ',\ ; |
' ',\ ; |
' ',\ ; |
' <- ¥¨§¢¥áâë© ¬¥â®¤ ᦠâ¨ï',\ ;50 |
' <- § è¨ä஢ ',\ ;51 |
<'¥ ZIP à娢',13,10> ; 52 |
else |
str_table \ |
<'*** @RCHER - Deflate Unpacker ***',13,10>,\ ;0 |
<'*** Copyright Wiland Inc., 2005 ***',13,10>,\ ;1 |
'Files in archive: ',\ ;2 |
<'End of Directory reached',13,10>,\ ;3 |
'No file has this number',\ ;4 |
<'FindByNumber succeded',13,10>,\ ;5 |
<'Invalid Huffman block ID',13,10>,\ ;6 |
<'Error while getting Huffman codes!',13,10>,\ ;7 |
<13,10,'Rebuilding CRC32 table',13,10>,\ ;8 |
'.',\ ;9 |
'Adler32',\ ;10 |
'CRC32',\ ;11 |
<'Job finished.',13,10>,\ ;12 |
<'File of zero length, unpacking aborted.',13,10>,\ ;13 |
<'Source file has strange length, may be missing? Abort.',13,10>,\ ;14 |
<'Not a GZIP archive',13,10>,\ ;15 |
<'Destination file is too large for now',13,10>,\ ;16 |
<"Can't unpack content.",13,10>,\ ; 17 |
<'Not a PNG image',13,10>,\ ; 18 |
<13,10,'*d'>,\ ;19 |
<13,10,'*s'>,\ ;20 |
'Unexpected end of IDAT chunks',\ ;21 |
'Unfiltering:',\ ;22 |
'Filters: None ',\ ;23 |
' Sub ',\ ;24 |
' Up ',\ ;25 |
' Avg ',\ ;26 |
' Paeth ',\ ;27 |
' Invalid ',\ ;28 |
<'Interlaced PNG',13,10>,\ ;29 |
<'Stored block',13,10>,\ ;30 |
<'Color type not supported',13,10>,\ ;31 |
<'Enter password for encrypted file:',13,10>,\ ;32 |
<'Searching for file...',13,10>,\ ;33 |
'Not a SFX module',\ ;34 |
' error! ',\ ;35 |
' OK: ',\ ;36 |
<'Creating OUT.TXT',13,10>,\ ;37 |
' ',\ ;38 |
<'Preparing bitmap...',13,10>,\ ;39 |
<'Specify "R" to force raw data. Abort.',13,10>,\ ;40 |
' ',\ ; |
' ',\ ; |
' ',\ ; |
' ',\ ; |
' ',\ ; |
' ',\ ; |
' ',\ ; |
' ',\ ; |
' ',\ ; |
' <- unknown compression method',\ ;50 |
' <- encrypted',\ ;51 |
<'Not a ZIP archive',13,10> ; 52 |
end if |
macro opendialog redproc,openoff,erroff,path |
{ |
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc |
local run_fileinfo, param |
local getmesloop, loox, mred, mkey, mbutton, mgetmes |
local dlg_is_work, ready |
; |
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
; |
cld |
;; mov esi,path |
mov edi,path |
xor eax,eax |
mov ecx,200 |
rep stosb |
;mov [get_loops],0 |
mov [dlg_pid_get],0 |
; Get my PID in dec format 4 bytes |
mcall 9,os_work,-1 |
; convert eax bin to param dec |
mov eax,dword [os_work+30] ;offset of myPID |
mov edi,param+4-1 ;offset to 4 bytes |
mov ecx,4 |
mov ebx,10 |
cld |
new_d: |
xor edx,edx |
div ebx |
add dl,'0' |
mov [edi],dl |
dec edi |
loop new_d |
; write 1 byte space to param |
mov [param+4],byte 32 ;Space for next parametr |
; and 1 byte type of dialog to param |
mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) |
; |
; STEP2 prepare IPC area for get messages |
; |
; prepare IPC area |
mov [path],dword 0 |
mov [path+4],dword 8 |
; define IPC memory |
mov eax,60 |
mov ebx,1 ; define IPC |
mov ecx,path ; offset of area |
mov edx,150 ; size 150 bytes |
int 0x40 |
mcall 40,1000111b |
; |
; STEP 3 run SYSTEM XTREE with parameters |
; |
mcall 58,run_fileinfo |
call redproc |
mov [get_loops],0 |
getmesloop: |
mov eax,23 |
mov ebx,50 ;0.5 sec |
int 0x40 |
cmp eax,1 |
je mred |
cmp eax,2 |
je mkey |
cmp eax,3 |
je mbutton |
cmp eax,7 |
je mgetmes |
; Get number of procces |
mcall 9,os_work,-1 |
mov ebp,eax |
loox: |
mcall 9,os_work,ebp |
mov eax,[DLGPID] |
cmp dword[os_work+30],eax ;IF Dialog find |
je dlg_is_work ;jmp to dlg_is_work |
dec ebp |
jnz loox |
jmp erroff |
dlg_is_work: |
cmp word[os_work+50],word 9 ;If slot state 9 - dialog is terminated |
je erroff ;TESTODP2 terminated too |
cmp [dlg_pid_get],dword 1 |
je getmesloop |
inc [get_loops] |
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
jae erroff |
jmp getmesloop |
mred: |
call redproc |
jmp getmesloop |
mkey: |
mcall 2 ; read (eax=2) |
jmp getmesloop |
mbutton: |
mov eax,17 ; get id |
int 0x40 |
cmp ah,1 ; button id=1 ? |
jne getmesloop |
mov eax,-1 ; close this program |
int 0x40 |
mgetmes: |
; If dlg_pid_get then second message get jmp to still |
cmp [dlg_pid_get],dword 1 |
je ready |
; First message is number of PID SYSXTREE dialog |
; convert PID dec to PID bin |
movzx eax,byte [path+16] |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+1] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+2] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+3] |
add eax,ebx |
sub eax,48 |
mov [DLGPID],eax |
; Claear and prepare IPC area for next message |
mov [path],dword 0 |
mov [path+4],dword 8 |
mov [path+8],dword 0 |
mov [path+12],dword 0 |
mov [path+16],dword 0 |
; Set dlg_pid_get for get next message |
mov [dlg_pid_get],dword 1 |
call redproc ;show DLG_PID |
jmp getmesloop |
ready: |
; |
; The second message get |
; Second message is 100 bytes path to SAVE/OPEN file |
; shl path string on 16 bytes |
; |
cld |
mov esi,path+16 |
mov edi,path |
mov ecx,200 |
rep movsb |
mov [edi],byte 0 |
jmp openoff |
; DATA AREA |
get_loops dd 0 |
dlg_pid_get dd 0 |
DLGPID dd 0 |
param: |
dd 0 ; My dec PID |
dd 0,0 ; Type of dialog |
run_fileinfo: |
dd 16 |
dd 0 |
dd param |
dd 0 |
dd os_work ; 0x10000 |
;run_filepath |
db '/RD/1/SYSXTREE',0 |
} |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/archer/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm @rcher.asm @rcher |
@pause |
/programs/other/archer/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm @rcher.asm @rcher |
@pause |
/programs/other/archer/trunk/data.inc |
---|
0,0 → 1,158 |
; @RCHER data area |
; Written in pure assembler by Ivushkin Andrey aka Willow |
if SYS eq win |
dumpfile: |
db 'D:\Ivushkin\projects\zip\output.dmp',0 |
dumpf_len=$-dumpfile |
end if |
outfile: |
if SYS eq win |
db 'D:\Ivushkin\projects\zip\output.raw',0 |
end if |
dd 1 |
dd 0 |
.size dd 0 |
.out dd output |
dd os_work |
if ~SYS eq win |
dumpfile: |
db DUMPFILE,0 |
dumpf_len=$-dumpfile |
end if |
Finfo: |
dd 0 |
.block dd 0 |
.count dd BUFSIZE*2 |
.ptr dd BUFPTR |
dd os_work |
filename: |
if SYS eq win |
db 'png\absolut0.png',0 |
;db 'fasm-1.54.tgz',0 |
;include 'testsu~1.inc' |
; db 'pngsuite\pngsuite.tar.gz',0 ; OK |
; db 'pngsuite\basn4a08.png',0 ; OK |
; db 'goldhill.png',0 ; beeping |
; db 'arl_logo.png',0 ; wrong out |
; db 'tech.png',0 ; wrong out |
; db 'png\lena0000.png',0 |
; db 'arcs\' |
; db 'NTOSKRNL.gz' |
; db 'msg_enc.zip' |
;db 'msgplain.zip' |
; db 'c_866.gz' |
; db 'zalman_2.png' ;OK |
; db 'arcs\headerbar.png',0 ;OK |
; db 'fonts1.png' ;OK |
; db 'fonts.png' ; |
; db 'skin.png' ;OK |
; db 'JavaPowered8.png'; OK |
; db 'opr008S8.png' |
; db 'goldhill.png' |
; db 'k3b.png',0 |
; db 'image0051.png' |
; db 'window-elements.png',0 |
; db 'WWW.zip',0 |
; db 'png.zip',0 |
; db 'zlib09.zip',0 |
else |
if ~ FNAME eq |
db FNAME |
end if |
; db '/hd/1/zip/png.zip',0 |
; db '/hd/1/zip/files/opossum.png' |
; db '/rd/1/www.zip',0 |
; db '/hd/1/zip/test2.zip',0 |
end if |
db 0 |
rb 256-($-filename) |
I_END: |
if SYS eq win |
cr_lf db 0xa,0xd |
hnd dd ? |
cons dd ? |
cons_in dd ? |
cparam1 dd ? |
cparam2 dd ? |
end if |
DKeys rd 3 |
Dheader rb 12 |
Dpassword rb PASSW_LEN |
png_bpp dd ? |
sline_len dd ? |
IDATcount dd ? |
IDATsize dd ? |
PNG_info: |
.Width dd ? |
.Height dd ? |
.Bit_depth db ? |
.Color_type db ? |
.Compression_method db ? |
.Filter_method db ? |
.Interlace_method db ? |
.Palette rb 3*256 |
gpbf dw ? |
file_count dd ? |
filters rd 6 |
arc_base dd ? |
outp dd ? |
unp_size dd ? |
CRC_check dd ? |
CRC32 dd ? |
CRC32table rd 256 |
Adler32 dd ? |
child dd ? |
clientPID dd ? |
filesize dd ? |
bits db ? |
cur_byte dd ? |
lastblk db ? |
Flags dd ? |
tblCount dw ? |
tblLen dw ? |
hclen db ? |
max_len dw ? |
bl_count rb BITS |
next_code rw BITS |
tmp_clit: |
rw 20 |
calph: |
rw 20 |
sorted_clit rw 20 |
seql_c db ? |
seql rb BITS |
seqd_c db ? |
seqd rb BITS |
hlit dw ? |
Literal rw 286 |
Lit_c rw 286 |
hdist db ? |
Distance rw 32 |
Dist_c rw 32 |
area: |
rb INBUF |
os_work rb 4*1024 |
output: |
rb OUTBUF |
png_image: |
if SYS eq win |
rb OUTBUF |
end if |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/archer/trunk/debug.inc |
---|
0,0 → 1,131 |
macro debug_print str |
{ |
local ..string, ..label |
jmp ..label |
..string db str,0 |
..label: |
pushf |
pushad |
mov edx,..string |
call debug_outstr |
popad |
popf |
} |
dps fix debug_print |
macro debug_print_dec arg |
{ |
pushf |
pushad |
if ~arg eq eax |
mov eax,arg |
end if |
call debug_outdec |
popad |
popf |
} |
dpd fix debug_print_dec |
;--------------------------------- |
debug_outdec: ;(eax - num, edi-str) |
push 10 ;2 |
pop ecx ;1 |
push -'0' ;2 |
.l0: |
xor edx,edx ;2 |
div ecx ;2 |
push edx ;1 |
test eax,eax ;2 |
jnz .l0 ;2 |
.l1: |
pop eax ;1 |
add al,'0' ;2 |
call debug_outchar ; stosb |
jnz .l1 ;2 |
ret ;1 |
;--------------------------------- |
debug_outchar: ; al - char |
pushf |
pushad |
mov cl,al |
mov eax,63 |
mov ebx,1 |
int 0x40 |
popad |
popf |
ret |
debug_outstr: |
mov eax,63 |
mov ebx,1 |
@@: |
mov cl,[edx] |
test cl,cl |
jz @f |
int 40h |
inc edx |
jmp @b |
@@: |
ret |
macro newline |
{ |
dps <13,10> |
} |
macro print message |
{ |
dps message |
newline |
} |
macro pregs |
{ |
dps "EAX: " |
dpd eax |
dps " EBX: " |
dpd ebx |
newline |
dps "ECX: " |
dpd ecx |
dps " EDX: " |
dpd edx |
newline |
} |
macro debug_print_hex arg |
{ |
pushf |
pushad |
if ~arg eq eax |
mov eax, arg |
end if |
call debug_outhex |
popad |
popf |
} |
dph fix debug_print_hex |
debug_outhex: |
; eax - number |
mov edx, 8 |
.new_char: |
rol eax, 4 |
movzx ecx, al |
and cl, 0x0f |
mov cl, [__hexdigits + ecx] |
pushad |
mcall 63, 1 |
popad |
dec edx |
jnz .new_char |
ret |
__hexdigits: |
db '0123456789ABCDEF' |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/archer/trunk/deflate.inc |
---|
0,0 → 1,615 |
; @RCHER main algorythm |
; Written in pure assembler by Ivushkin Andrey aka Willow |
macro get_a _type,_size,c1,c2,c3,c4,c5 |
{ |
get_#_type: |
local .no,.no0,.ex |
push edx |
and [Flags],not 1 |
if _type eq Len |
cmp eax,c4 |
jne .no |
mov eax,c5 |
jmp .ex |
.no: |
end if |
sub eax,c1 |
ja .no0 |
add eax,c2 |
jmp .ex |
.no0: |
add eax,c3 |
push eax |
mov ecx,eax |
shr ecx,_size |
xor eax,eax |
call read_bits |
pop edx |
and edx,1 shl _size-1 |
shl edx,cl |
movzx ecx,[tblH#_type+ecx*2] |
add edx,ecx |
add eax,edx |
.ex: |
or [Flags],1 |
pop edx |
ret |
} |
; ************************* |
Deflate: |
mov edi,[outp] |
.init: |
mov [bits],8 |
lodsb |
call setcurb |
.blkbegin: |
and [lastblk],0 |
and [Flags],not 1 |
rbits 0,1 |
test eax,eax |
je .nolast |
mov [lastblk],1 |
.nolast: |
rbits 0,2 |
cmp eax,10b |
je .DynHuff |
cmp eax,01b |
je .static |
test eax,eax |
jnz .errorID |
Msg 30 |
movzx ecx,[bits] |
call read_bits |
movzx ecx,word[esi-1] |
add esi,3 |
rep movsb |
jmp .check_last |
.errorID: |
Msg 6 |
ret |
; Static Huffman |
.static: |
if SHOW_METH eq 1 |
Msg 20 |
end if |
mov edi,[outp] |
or [Flags],1 |
.next: |
rbits 0,7 |
; stop |
cmp eax,0x17 |
ja .no7 |
add eax,256 |
cmp eax,256 |
jne .noend |
.check_last: |
mov [outp],edi |
cmp [lastblk],1 |
je .ex |
jmp .blkbegin |
.noend: |
call get_Len |
mov ebx,eax |
rbits 0,5 |
call get_Dist |
neg eax |
push esi |
lea esi,[edi+eax] |
mov ecx,ebx |
rep movsb |
pop esi |
jmp .next |
.no7: |
rbits eax,1 |
cmp eax,0xc8 |
jb .no9 |
rbits eax,1 |
sub eax,0xd0 |
jmp .no81 |
.no9: |
cmp eax,0xc0 |
jb .no81 |
add eax,0x58 |
jmp .noend |
.no81: |
sub eax,0x30 |
stosb |
jmp .next |
.ex: |
ret |
; ************* dynamic Huffman ************ |
.DynHuff: |
; dps '##' |
if SHOW_METH eq 1 |
Msg 19 |
end if |
pusha |
xor eax,eax |
mov ecx,(area-bl_count) / 4 |
mov edi,bl_count |
rep stosd |
popa |
; max_len=0 |
and [max_len],0 |
rbits 0,5 |
; hlit-257 |
add eax,257 |
mov [hlit],ax |
rbits 0,5 |
; hdist-1 |
inc eax |
mov [hdist],al |
rbits 0,4 |
; hclen-4 |
add eax,4 |
mov [hclen],al |
mov ecx,eax |
push edi |
mov edi,tmp_clit |
; read code lengths for code lengths |
.alphloop: |
push ecx |
rbits 0,3 |
stosb |
pop ecx |
loop .alphloop |
; sort code lengths for code lengths |
push esi |
movzx ecx,[hclen] |
xor eax,eax |
mov edi,tmp_clit |
mov esi,tblSort |
.sortloop: |
lodsb |
movzx bx,byte[edi] |
mov [sorted_clit+eax*2],bx |
inc edi |
loop .sortloop |
pop esi edi |
.generate: |
mov ecx,19 |
mov ebx,calph |
mov edx,seql |
mov eax,sorted_clit |
call Huffc |
and [tblCount],0 |
or [Flags],1 |
mov edi,Lit_c |
mov ebp,sorted_clit |
.again: |
cmp edi,output+OUTBUF |
jb ._ok |
Msg 16 |
jmp .ex |
._ok: |
mov edx,seql |
mov ebx,calph |
call get_code |
call ExpLen |
cmp [hlit],ax |
ja .again |
if SHOW_CHARS eq 1 |
mov edi,Lit_c |
call Show_codes |
end if |
mov edi,Dist_c |
and [tblCount],0 |
.again2: |
mov ebx,calph |
call get_code |
call ExpLen |
cmp [hdist],al |
ja .again2 |
movzx ecx,[hlit] |
mov ebx,Literal |
mov edx,seql |
mov eax,Lit_c |
call Huffc |
movzx ecx,[hdist] |
mov ebx,Distance |
mov edx,seqd |
mov eax,Dist_c |
call Huffc |
push [hlit] |
pop [tblLen] |
mov ebp,Lit_c |
mov edx,seql |
mov ebx,Literal |
mov edi,[outp] |
and [tblCount],0 |
.again3: ; <------------ |
call get_code |
cmp eax,256 |
je .check_last |
ja .dist |
stosb |
jmp .again3 |
.dist: |
call get_Len |
push eax ebx edx ebp |
mov ecx,32 |
mov ebp,Dist_c |
mov edx,seqd |
mov ebx,Distance |
mov [tblLen],32 |
call get_code |
call get_Dist |
push [hlit] |
pop [tblLen] |
neg eax |
pop ebp edx ebx ecx |
push esi |
lea esi,[edi+eax] |
rep movsb |
pop esi |
jmp .again3 |
; ****************************************** |
Huffc: |
; EBX - dest array, ECX - length, EDX - br_seq dest, EAX - source array |
push esi edi eax ecx |
mov edi,bl_count |
xor eax,eax |
mov ecx,BITS |
rep stosw |
pop ecx |
mov esi,[esp] |
mov [tblLen],cx |
mov [max_len],ax |
; Count the number of codes for each code length |
.cnt_loop: |
lodsw |
cmp [max_len],ax |
jae .skip |
mov [max_len],ax |
.skip: |
inc byte[bl_count+eax] |
loop .cnt_loop |
movzx ecx,[max_len] |
xor eax,eax |
and [bl_count],al |
xor esi,esi ; edx - bits |
mov edi,next_code+2 |
push ebx |
; Find the numerical value of the smallest code for each code length |
.nc_loop: |
movzx bx,byte[bl_count+esi] |
add ax,bx |
shl ax,1 |
stosw |
inc esi |
loop .nc_loop |
pop ebx |
; clear table |
movzx ecx,[tblLen] |
xor eax,eax |
dec eax |
mov edi,ebx |
rep stosw |
inc eax |
movzx ecx,[tblLen] |
mov esi,[esp] |
mov edi,ebx |
; Assign numerical values to all codes |
.loop3: |
lodsw |
test eax,eax |
jz .lp |
push [next_code+eax*2] |
pop word[edi] |
inc [next_code+eax*2] |
.lp: |
add edi,2 |
loop .loop3 |
; Clear all codes |
xor eax,eax |
mov edi,edx |
movzx ecx,[max_len] |
mov [edi-1],al |
; Prepare read bit sequences |
.rebiloop: |
inc eax |
cmp [bl_count+eax],0 |
jz .sk |
stosb |
inc byte[edx-1] |
.sk: |
loop .rebiloop |
movzx ecx,byte[edx-1] |
dec ecx |
jecxz .noreb2 |
.reb2loop: |
mov al,[edx+ecx-1] |
sub [edx+ecx],al |
loop .reb2loop |
.noreb2: |
pop eax edi esi |
ret |
; ****************************************** |
; get Codes of variable sizes |
get_code: |
; EDX - br_seq, EBX - source table, EBP - codelength table |
push edx edi |
xor eax,eax |
movzx ecx,byte[edx-1] |
mov [codel],ax |
.rb3: |
push ecx |
movzx ecx,byte[edx] |
add [codel],cx |
call read_bits |
movzx ecx,[tblLen] |
inc ecx |
mov edi,ebx |
.scas: |
repne scasw |
jecxz .notfound |
push edi ecx |
sub edi,ebx |
sub edi,2 |
mov cx,[codel] |
cmp cx,[ds:ebp+edi] |
jne .notfound2 |
mov eax,edi |
shr eax,1 |
add esp,12 |
.pp: |
pop edi edx |
ret |
.notfound2: |
pop ecx |
pop edi |
jmp .scas |
.notfound: |
pop ecx |
inc edx |
loop .rb3 |
Msg 7 |
jmp .pp |
codel dw ? |
; ****************************************** |
ExpLen: |
cmp eax,16 |
jae .noliteral |
inc [tblCount] |
stosw |
jmp .nomatch |
.noliteral: |
and [Flags],not 1 |
mov ebx,3 |
cmp eax,17 |
jae .code1718 |
mov ecx,2 |
xor eax,eax |
call read_bits |
lea ecx,[eax+ebx] |
mov ax,[edi-2] |
.cc: |
add [tblCount],cx |
rep stosw |
or [Flags],1 |
jmp .nomatch |
.code1718: |
jne .code18 |
mov ecx,3 |
.cc2: |
xor eax,eax |
call read_bits |
lea ecx,[eax+ebx] |
xor eax,eax |
jmp .cc |
.code18: |
mov ebx,11 |
mov ecx,7 |
jmp .cc2 |
.nomatch: |
mov ax,[tblCount] |
ret |
get_a Len,2,256+8,10,3,285,258 |
get_a Dist,1,3,4,1 |
; ****************************************** |
read_bits: ; eax-dest; ecx-count |
push edx ecx |
.shift: |
if RBLOCK eq 4 |
ror [cur_byte],1 |
else |
ror byte[cur_byte],1 |
end if |
pushf |
test [Flags],1 |
je .noh1 |
popf |
rcl eax,1 |
jmp .dec |
.noh1: |
popf |
rcr eax,1 |
.dec: |
dec [bits] |
jnz .loop1 |
.push: |
push eax |
mov eax,[esi] |
call setcurb |
pop eax |
if RBLOCK eq 1 |
inc esi |
inc [IDATcount] |
else |
inc esi |
inc [IDATcount] |
end if |
cmp esi,area+INBUF-BSIZE |
jbe .ok |
pusha |
if SHOW_RBLOCK eq 1 |
Msg 9 |
end if |
mov eax,0 |
mov ebx,1 |
call FileSeek |
mov [esp+4],esi |
popa |
.ok: |
test [Flags],PNG_MODE |
jz .idatok |
mov edx,[IDATcount] |
cmp edx,[IDATsize] |
jbe .idatok |
pusha |
lodsd |
call PngParse.nxt_sec |
mov [IDATcount],1 |
mov [esp+4],esi |
mov [esp+20],edx |
popa |
cmp edx,21 |
jne .idatok |
mov eax,256 |
pop ecx |
jmp .exx |
.idatok: |
mov [bits],8 |
.loop1: |
loop .shift2 |
jmp .popc |
.shift2: |
jmp .shift |
.popc: |
pop ecx |
test [Flags],1 |
jne .exx |
.noh2: |
rol eax,cl |
.exx: |
pop edx |
ret |
if SHOW_CHARS eq 1 |
Show_codes: |
pusha |
movzx ecx,[tblLen] |
mov ecx,256 |
xor eax,eax |
.lp2: |
mov [braces+1],al |
push eax ecx |
invoke StrFormat,eax,strbuf,20 |
invoke WriteConsole,[cons],strbuf,16,param1,NULL |
invoke WriteConsole,[cons],braces,6,param1,NULL |
mov eax,[esp+4] |
movzx eax,word[edi+eax*2] |
test eax,eax |
jz .skip |
invoke WriteConsole,[cons],exist,6,param1,NULL |
.skip: |
invoke WriteConsole,[cons],braces+6,2,param1,NULL |
pop ecx eax |
inc eax |
loop .lp |
jmp .ex |
.lp: |
jmp .lp2 |
.ex: |
popa |
ret |
cons dd ? |
param1 dd ? |
braces db '( ) = ',0xa, 0xd |
strbuf rb 20 |
exist db 'exists' |
end if |
makeCRC: |
pusha |
Msg 8 |
mov edi,CRC32table |
add edi,255*4 |
std |
mov ecx,255 |
mov ebx,0xedb88320 |
.m1: |
mov eax,ecx |
push ecx |
mov ecx,8 |
.m2: |
shr eax,1 |
jnc .m3 |
xor eax,ebx |
.m3: |
loop .m2 |
pop ecx |
stosd |
loop .m1 |
popa |
cld |
ret |
UCRC: |
; in: esi - data to calculate CRC |
; ecx - its length |
; [CRC32] - previous CRC32 |
; out: [CRC32]- partial CRC32 (no pre- & post-conditioning!) |
pusha |
cmp dword[CRC32table+4],0x77073096 |
je .tbl_rdy |
call makeCRC |
.tbl_rdy: |
mov eax,[CRC32] |
not eax |
.m1: |
movzx ebx,al |
shr eax,8 |
xor bl,[esi] |
xor eax,[CRC32table+ebx*4] |
inc esi |
loop .m1 |
not eax |
mov [CRC32],eax |
popa |
ret |
UAdler: |
; in: esi - data to calculate CRC |
; ecx - its length |
; [Adler32] - previous Adler32 |
; out: [Adler32]- partial Adler32 |
pusha |
mov ebp,65521 |
movzx ebx,word[Adler32] ; s1-ebx |
movzx edi,word[Adler32+2] ; s2-edi |
.m1: |
movzx eax,byte[esi] |
add eax,ebx |
xor edx,edx |
div ebp |
mov ebx,edx |
lea eax,[edi+ebx] |
xor edx,edx |
div ebp |
mov edi,edx |
inc esi |
loop .m1 |
shl edi,16 |
add edi,ebx |
mov [Adler32],edi |
popa |
ret |
tblSort db 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 |
tblHLen dw 7,11,19,35,67,131 |
tblHDist dw 3,5,9,17,33,65,129,257,513,1025,2049,4097,8193,16385 |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/archer/trunk/macros.inc |
---|
0,0 → 1,266 |
; 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 |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b eq) |
mov reg,a |
end if |
} |
macro mcall a,b,c,d,e,f { ; mike.dld |
__mov eax,a |
__mov ebx,b |
__mov ecx,c |
__mov edx,d |
__mov esi,e |
__mov edi,f |
int 0x40 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
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 __regs) & (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 |
} |
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 |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/archer/trunk/parser.inc |
---|
0,0 → 1,896 |
; @RCHER parser and filter routines |
; Written in pure assembler by Ivushkin Andrey aka Willow |
fhs_local equ 0x04034b50 |
fhs_central equ 0x02014b50 |
fhs_end equ 0x06054b50 |
fhs_enc equ 0x08074b50 |
SkipASCIIZ: |
xor eax,eax |
mov ecx,255 |
mov edi,esi |
repne scasb |
mov esi,edi |
ret |
PrintFilename: |
pusha |
mov esi,edx |
mov edi,os_work |
mov edx,edi |
rep movsb |
mov dword[edi],0x00a0d |
call DebugPrint |
; mcall 10 |
; mcall 2 |
popa |
ret |
; Parse routines: |
; out: edx= 0 if all ok, 1 - central dir, 2-EOD |
; 50 - encrypted |
; 51 - not deflated |
; 52 - invalid format |
; 53 - dir skipped |
; 1 - encrypted |
; **************************************************** |
ZipParse: |
call ResetFile |
.nxt: |
call ZipCrawl |
cmp edx,3 |
je .ex |
cmp edx,1 |
je .skipinc |
if IGNORE_DIRS eq 1 |
cmp edx,53 |
jne .skipinc |
end if |
inc [file_count] |
.skipinc: |
cmp edx,52 |
je .er1 |
cmp edx,50 |
jne .seek |
.er1: |
Msg edx |
ret |
.seek: |
add eax,ecx |
mov ebx,1 |
call FileSeek |
jmp .nxt |
.ex: |
Msg 2 |
mov eax,[file_count] |
if ~ SYS eq win |
dpd eax |
else |
pusha |
call int2str |
mov edx,os_work |
call DebugPrint |
popa |
end if |
Newline |
ret |
ZipFindN: |
; ecx - file # |
Msg 33 |
cmp ecx,[file_count] |
jae .err |
push ecx |
call ResetFile |
.nxt: |
call ZipCrawl |
cmp edx,51 |
je .ok2 |
.noenc: |
test edx,edx |
jnz .err |
.ok2: |
add eax,ecx |
cmp dword[esp],0 |
jz .ok |
dec dword[esp] |
mov ebx,1 |
call FileSeek |
jmp .nxt |
.err: |
mov edx,4 |
jmp .ex |
.ok: |
pop ecx |
sub eax,[esi+18] |
add esi,eax |
mov edx,5 |
.ex: |
push edx |
Msg edx |
pop edx |
ret |
ZipCrawl: |
mov edx,52 |
cmp dword[esi],fhs_central |
jne .noc |
mov eax,46 |
movzx ecx,word[esi+28] |
add eax,ecx |
movzx ecx,word[esi+30] |
add eax,ecx |
movzx ecx,word[esi+32] |
mov edx,1 |
ret |
.noc: |
cmp dword[esi],fhs_end |
jne .noe |
.edx3: |
Msg 3 |
mov edx,3 |
ret |
.noe: |
cmp dword[esi],fhs_local |
je .loc |
cmp dword[esi],fhs_enc |
jne .err |
mov eax,16 |
xor ecx,ecx |
mov edx,1 |
ret |
.loc: |
push word[esi+6] |
pop [gpbf] |
push dword[esi+14] |
pop [CRC_check] |
push dword[esi+22] |
pop [unp_size] |
movzx ecx,word[esi+26] |
mov eax,30 |
lea edx,[esi+eax] |
add eax,ecx |
if IGNORE_DIRS eq 1 |
cmp byte[edx+ecx-1],'/' |
je .skipdp |
end if |
call PrintFilename |
.skipdp: |
movzx ecx,word[esi+28] |
add eax,[esi+18] |
test [gpbf],1 |
jz .no_enc |
or [Flags],DECRYPT_MODE ; encrypted |
mov edx,51 |
jmp .err |
.no_enc: |
test word[esi+8],7 |
rep_err z,50 |
.ok: |
xor edx,edx |
.err: |
ret |
; *********************************************** |
GzipParse: |
ID1ID2 equ 0x8b1f |
FTEXT equ 1b |
FHCRC equ 10b |
FEXTRA equ 100b |
FNAME equ 1000b |
FCOMMENT equ 10000b |
mov eax,7 |
mov ebx,2 |
call FileSeek |
push dword[esi] |
pop [CRC_check] |
push dword[esi+4] |
pop [unp_size] |
call ResetFile |
xor edx,edx |
cmp word[esi],ID1ID2 |
rep_err e, 52, 15 |
cmp byte[esi+2],8 |
rep_err e, 52, 50 |
mov bl,[esi+3] ; bl - FLG |
add esi,10 ; esi->extra |
test bl,FEXTRA |
jz .noextr |
movzx eax,word[esi] |
lea esi,[esi+eax+2] ; esi->FNAME |
.noextr: |
test bl,FNAME |
jz .nofname |
mov edx,esi |
call DebugPrint |
call SkipASCIIZ |
cmp dword[esi-5],'.tar' |
jne .nofname |
or [Flags],TAR_MODE |
.nofname: ; esi->FCOMMENT |
test bl,FCOMMENT |
jz .nocomm |
call SkipASCIIZ |
.nocomm: ; esi->HCRC |
test bl,FHCRC |
jz .noCRC16 |
add esi,2 |
.noCRC16: |
cmp [unp_size],OUTBUF |
jb .sizeok2 |
Msg 16 |
mov edx,15 |
ret |
.sizeok2: |
xor edx,edx |
.err: |
ret |
PngParse: |
ID1 equ 0x474e5089 |
ID2 equ 0x0a1a0a0d |
FDICT equ 100000b |
InitIDAT equ 2 |
mov [IDATcount],InitIDAT |
call ResetFile |
cmp dword[esi],ID1 |
rep_err e, 52, 18 |
cmp dword[esi+4],ID2 |
rep_err e, 52, 18 |
add esi,8 |
cmp dword[esi+4],'IHDR' |
rep_err e,52, 18 |
or [Flags],PNG_MODE |
memcpy_esi PNG_info,13,8 |
mov eax,[PNG_info.Width] |
bswap eax |
mov [PNG_info.Width],eax |
mov eax,[PNG_info.Height] |
bswap eax |
mov [PNG_info.Height],eax |
add esi,25 |
cmp byte[esi-5],0 |
rep_err e,52,29 |
.nxt_sec: |
lodsd |
bswap eax ; eax - section size |
push eax |
lodsd |
mov edi,Png_ch |
mov ecx,(E_ch-Png_ch) / 4 |
repne scasd |
pop eax |
mov ebx,[esi-4] |
mov edx,os_work |
mov [edx],ebx |
mov dword[edx+4],0x0a0d |
.dp: |
sub edi,Png_ch |
shr edi,2 ; edi- chunk # |
if SHOW_PNG_SEC eq 1 |
call DebugPrint |
end if |
cmp edi,1 |
jne .noend |
mov edx,21 |
jmp .err |
.noend: |
cmp edi,2 |
jne .noplte |
memcpy_esi PNG_info.Palette,eax |
jmp .noidat |
.noplte: |
cmp edi,3 |
jne .noidat |
mov [IDATsize],eax |
cmp [IDATcount],InitIDAT |
jne .ex |
mov [bits],8 |
if RBLOCK eq 4 |
lodsd |
else |
lodsb |
end if |
call setcurb |
rbits 0,16 |
test ah,FDICT |
jz .ex |
rbits 0,32 |
add [IDATcount],4 |
jmp .ex |
.noidat: |
add eax,4 |
mov ebx,1 |
call FileSeek |
jmp .nxt_sec |
.ex: |
xor edx,edx |
.err: |
ret |
Png_ch: |
dd 'IEND','PLTE','IDAT','????' |
E_ch: |
ZipDecrypt: |
push edi |
mov ecx,3 |
mov edi,Dheader |
rep movsd |
pop edi |
call QueryPwd |
jecxz .ex |
push esi |
mov [DKeys], 305419896 |
mov [DKeys+4],591751049 |
mov [DKeys+8],878082192 |
xor eax,eax |
mov esi,Dpassword |
.enc_init: |
lodsb |
call UKeys |
loop .enc_init |
mov ecx,12 |
mov esi,Dheader |
.dec_header: |
call decrypt_byte |
xor al,[esi] |
call UKeys |
mov [esi],al |
inc esi |
loop .dec_header |
mov eax,[CRC_check] |
pop esi |
.ex: |
ret |
QueryPwd: |
; out: ecx - passwd len |
if SYS eq win |
Msg 32 |
invoke ReadConsole,[cons_in],Dpassword,PASSW_LEN,cparam1,NULL |
test eax,eax |
jnz .inp_ok |
xor ecx,ecx |
jmp .ex |
.inp_ok: |
mov ecx,[cparam1] |
cmp ecx,PASSW_LEN |
je .ex |
sub ecx,2 |
else |
end if |
.ex: |
ret |
UKeys: |
; in: al - char |
pusha |
mov edi,134775813 |
mov ebx,DKeys |
mov esi,os_work |
mov byte[esi],al |
mov ecx,1 |
push dword[ebx] |
pop [CRC32] |
call UCRC |
push [CRC32] |
pop dword[ebx] |
mov eax,[ebx] |
and eax,0xff |
add eax,[ebx+4] |
mul edi |
inc eax |
mov [ebx+4],eax |
shr eax,24 |
mov byte[esi],al |
push dword[ebx+8] |
pop [CRC32] |
call UCRC |
push [CRC32] |
pop dword[ebx+8] |
popa |
ret |
decrypt_byte: |
; out: al |
push ebx edx |
movzx ebx,word[DKeys+8] |
or ebx,2 |
mov eax,ebx |
xor eax,1 |
mul ebx |
shr eax,8 |
pop edx ebx |
ret |
setcurb: |
; in: eax |
test [Flags],DECRYPT_MODE |
jz .noenc |
push eax |
call decrypt_byte |
xor al,byte[esp] |
add esp,4 |
call UKeys |
.noenc: |
mov [cur_byte],eax |
ret |
TarParse: |
call ResetFile |
.nxt: |
call TarCrawl |
; wait |
cmp edx,3 |
je ZipParse.ex |
if IGNORE_DIRS eq 1 |
cmp edx,53 |
jne .skipinc |
end if |
inc [file_count] |
.skipinc: |
add eax,ecx |
mov ebx,1 |
call FileSeek |
jmp .nxt |
TarFindN: |
; in: ecx - file number |
; ecx - file # |
Msg 33 |
cmp ecx,[file_count] |
jae .err |
push ecx |
call ResetFile |
.nxt: |
call TarCrawl |
if IGNORE_DIRS eq 1 |
cmp edx,53 |
je .seek |
end if |
test edx,edx |
jnz .err |
cmp dword[esp],0 |
jz .ok |
dec dword[esp] |
.seek: |
add eax,ecx |
mov ebx,1 |
call FileSeek |
jmp .nxt |
.err: |
mov edx,4 |
jmp .ex |
.ok: |
pop ecx |
add esi,eax |
mov edx,5 |
.ex: |
Msg edx |
ret |
TarCrawl: |
cmp byte[esi],0 |
jz ZipCrawl.edx3 |
push esi |
mov ecx,11 |
add esi,0x7c |
call Octal_str |
mov esi,[esp] |
mov [outfile.size],eax |
call SkipASCIIZ |
if IGNORE_DIRS eq 1 |
cmp byte[esi-2],'/' |
je .skipdp |
end if |
mov edx,[esp] |
lea ecx,[esi-1] |
sub ecx,edx |
call PrintFilename |
.skipdp: |
mov ecx,[outfile.size] |
jecxz .zerolen |
shr ecx,9 |
inc ecx |
shl ecx,9 |
.zerolen: |
mov eax,512 |
pop esi |
jmp ZipCrawl.ok |
Octal_str: |
; in: esi - ASCIIZ octal string |
; ecx - its length |
; out: eax - value |
push esi ebx ecx |
xor ebx,ebx |
xor eax,eax |
.jec: |
jecxz .zero |
cmp byte[esi+ecx-1],' ' |
jne .lp |
dec ecx |
jmp .jec |
.lp: |
lodsb |
shl ebx,3 |
cmp eax,' ' |
je .space |
lea ebx,[ebx+eax-'0'] |
.space: |
loop .lp |
mov eax,ebx |
.zero: |
pop ecx ebx esi |
ret |
TRAILING_BUF equ 2048 |
SfxParse: |
call ResetFile |
cmp word[esi],'MZ' |
rep_err e, 34 |
mov eax,TRAILING_BUF |
mov ecx,eax |
mov ebx,2 |
call FileSeek |
mov edi,esi |
mov al,'P' |
.lp: |
repne scasb |
cmp dword[edi-1],fhs_end |
je .end_found |
jecxz .err |
jmp .lp |
.end_found: |
dec edi |
mov esi,edi |
mov eax,[edi+12] |
neg eax |
mov ebx,1 |
call FileSeek |
push dword[esi+42] |
pop [arc_base] |
.err: |
ret |
; Created: May 31, 2005 |
FiltCall: |
dd PngFilter.nofilt,Filt_sub,Filt_up,Filt_av,Filt_paeth,PngFilter.nofilt |
PngFilter: |
; esi - filtered uncompressed image data |
; edi - destination |
mov cl,[PNG_info.Color_type] |
mov eax,1 |
cmp cl,3 |
je .palette |
test cl,2 |
jz .notriple |
add eax,2 |
.notriple: |
test cl,4 |
jz .calc_bpp |
inc eax |
.calc_bpp: |
mul [PNG_info.Bit_depth] |
.palette: |
mov ecx,eax ; in bits |
shr eax,3 ; in bytes |
test eax,eax |
jnz .noz |
inc eax |
.noz: |
mov [png_bpp],eax |
mov eax,[PNG_info.Width] |
mov ebp,eax |
imul ecx |
shr eax,3 |
test eax,eax |
jnz .noz2 |
inc eax |
.noz2: |
mov [sline_len],eax ; scanline length |
push edi |
and [Flags],not 1 |
mov ecx,[PNG_info.Height] |
.scanline: |
; Msg 9,1 |
push ecx |
lodsb |
movzx eax,al |
cmp eax,5 |
jb .f_ok |
mov eax,5 |
.f_ok: |
inc dword[filters+eax*4] |
jmp dword[FiltCall+eax*4] |
.nofilt: |
mov dl,[PNG_info.Color_type] |
cmp dl,3 |
jne .nopalette |
lodsb |
mov [cur_byte],eax |
mov [bits],8 |
mov ecx,ebp |
.pixel: |
push ecx |
movzx ecx,[PNG_info.Bit_depth] |
call rb_png |
push esi |
lea esi,[eax+eax*2] |
add esi,PNG_info.Palette |
call PngStore |
pop esi |
pop ecx |
loop .pixel |
cmp [bits],8 |
jne .lp |
dec esi |
.lp: |
pop ecx |
loop .sl |
jmp .sl2 |
.sl: |
;// |
MV equ 1 |
; mov eax,ecx |
; and eax,1 shl MOVE_SLINE_LEV-1 |
; jnz .scanline |
;stop |
if MV eq 0 |
push ecx |
mov ecx,edi |
sub ecx,esi |
sub [outp],esi |
mov edi,output |
add [outp],edi |
rep movsb |
mov esi,output |
pop ecx |
pop eax |
push [outp] |
end if |
;;// |
jmp .scanline |
.sl2: |
;// |
; call MoveScanline |
sub edi,[outp] |
;// |
; sub edi,[esp] |
pop eax |
ret |
.nopalette: |
test dl,2 |
jz .notriple1 |
.__: |
mov ecx,[PNG_info.Width] |
.RGBcp: |
call PngStore |
add esi,[png_bpp] |
loop .RGBcp |
jmp .lp |
.notriple1: |
test dl,dl |
jz .gray |
cmp dl,4 |
jne .__ |
; Msg 31 |
; ud2 |
.gray: |
; stop |
push ecx |
mov ecx,[PNG_info.Width] |
mov [bits],8 |
lodsb |
mov [cur_byte],eax |
.gray2: |
push ecx |
movzx ecx,[PNG_info.Bit_depth] |
push ecx |
call rb_png |
pop ecx |
cmp ecx,8 |
jbe .lo |
add esi,2 |
shr eax,8 |
jmp .stsb |
.lo: |
neg ecx |
add ecx,8 |
shl eax,cl |
.stsb: |
mov ecx,3 |
rep stosb |
pop ecx |
loop .gray2 |
dec esi |
pop ecx |
jmp .lp |
Filt_sub: |
; dps '-' |
mov ecx,[sline_len] |
sub ecx,[png_bpp] |
push esi edi |
mov edi,esi |
add edi,[png_bpp] |
.scan: ; esi - previous, edi - current |
lodsb |
add [edi],al |
inc edi |
loop .scan |
pop edi esi |
; dps '-' |
jmp PngFilter.nofilt |
Filt_up: |
cmp ecx,[PNG_info.Height] |
je PngFilter.nofilt |
push esi edi |
mov ecx,[sline_len] |
mov edi,esi |
sub esi,ecx |
dec esi |
jmp Filt_sub.scan |
Filt_av: |
pusha |
mov ecx,[sline_len] |
mov ebp,[PNG_info.Height] |
mov edx,[png_bpp] ; edx-raw |
neg edx |
mov ebx,ecx |
sub ebx,[png_bpp] |
mov edi,esi |
sub esi,ecx |
dec esi ; esi-prior |
.lpavg: |
xor eax,eax |
cmp [esp+24h],ebp |
je .1stl |
movzx eax,byte[esi] |
.1stl: |
cmp ecx,ebx |
ja .leftbad |
push ecx |
movzx ecx,byte[edi+edx] |
add eax,ecx |
pop ecx |
.leftbad: |
shr eax,1 |
add [edi],al |
inc esi |
inc edi |
loop .lpavg |
popa |
jmp PngFilter.nofilt |
Filt_paeth: |
pusha |
mov ecx,[sline_len] |
mov edx,[png_bpp] |
neg edx |
lea ebp,[ecx+edx] ; left edge |
mov edi,esi |
sub esi,ecx |
dec esi |
.lpaeth: |
push ecx |
movzx eax,byte[edi+edx] |
movzx ebx,byte[esi] |
movzx ecx,byte[esi+edx] |
push eax |
mov eax,[esp+28h] |
cmp eax,[PNG_info.Height] ; 1st line |
jne .no1stlineok |
xor ebx,ebx |
xor ecx,ecx |
.no1stlineok: |
pop eax |
cmp [esp],ebp ; ecx |
jbe .leftok ; x-bpp>=0 |
xor eax,eax |
xor ecx,ecx |
.leftok: |
pusha ; eax-28, ebx-16, ecx-24 |
lea edx,[eax+ebx] |
sub edx,ecx ; p=edx |
sub eax,edx ; pa := abs(p - a) |
jge .eaxp |
neg eax |
.eaxp: |
sub ebx,edx ; pb := abs(p - b) |
jge .ebxp |
neg ebx |
.ebxp: |
sub ecx,edx ; pc := abs(p - c) |
jge .ecxp |
neg ecx |
.ecxp: |
cmp eax,ebx |
ja .noa |
cmp eax,ecx |
jbe .ex ; pa-min |
.noa: |
cmp ebx,ecx |
ja .nob |
mov eax,[esp+16] |
jmp .ex2 |
.nob: |
mov eax,[esp+24] |
.ex2: |
mov [esp+28],eax |
.ex: |
popa |
add [edi],al |
inc esi |
inc edi |
pop ecx |
loop .lpaeth |
popa |
jmp PngFilter.nofilt |
rb_png: ; eax-dest; ecx-count |
push ecx |
xor eax,eax |
.shift: |
rol byte[cur_byte],1 |
rcl eax,1 |
.dec: |
dec [bits] |
jnz .loop1 |
.push: |
push dword[esi] |
pop [cur_byte] |
mov [bits],8 |
inc esi |
.loop1: |
loop .shift |
pop ecx |
ret |
PngStore: |
push esi |
cmp [PNG_info.Bit_depth],8 |
jbe .lo |
add esi,3 |
.lo: |
if ~ SYS eq win |
mov esi,[esi] |
bswap esi |
shr esi,8 |
mov [edi],esi |
add edi,3 |
else |
movsw |
movsb |
end if |
pop esi |
ret |
FiltStats: |
pusha |
xor ebx,ebx |
mov edx,23 |
mov ecx,6 |
.lp: |
push ecx edx |
Msg edx |
mov eax,[filters+ebx*4] |
DebugPrintDec |
pop edx ecx |
inc edx |
inc ebx |
loop .lp |
Newline |
popa |
ret |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/archer/trunk/sys.inc |
---|
0,0 → 1,326 |
; @RCHER system-dependent and other stuff |
; Written in pure assembler by Ivushkin Andrey aka Willow |
OpenFile: |
mov [outp],output |
mov esi,area |
and [Finfo.block],0 |
if SYS eq win |
invoke CreateFile, filename, GENERIC_READ, FILE_SHARE_READ, NULL, \ |
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL |
inc eax |
test eax,eax |
jz .ex |
dec eax |
mov [hnd],eax |
invoke GetFileSize,eax,NULL |
.ex: |
mov ebx,eax |
mov [filesize],eax |
else |
mcall 58,Finfo |
mov [filesize],ebx |
end if |
ret |
ResetFile: |
and [file_count],0 |
mov eax,[arc_base] |
xor ebx,ebx |
mov esi,area |
call FileSeek |
ret |
FileSeek: |
; eax - offset |
; esi - current pointer (in memory!) |
; ebx - translation method: 0 - beginning, 1 - current, 2 - end |
push eax ecx edx |
mov edx,[Finfo.block] |
imul edx,BSIZE |
sub esi,BUFPTR |
add esi,edx |
cmp ebx,1 |
je .cur |
jb .begin |
mov esi,[filesize] |
not eax |
.cur: |
add eax,esi |
.begin: |
mov ecx,BSIZE |
xor edx,edx |
div ecx |
lea esi,[BUFPTR+edx] |
mov [Finfo.block],eax |
if SYS eq win |
mul ecx |
invoke SetFilePointer,[hnd],eax,NULL,FILE_BEGIN |
invoke ReadFile,[hnd],area,INBUF, os_work, NULL |
; add [byte_count],area |
else |
; pregs |
; wait |
mov [Finfo.count],BUFSIZE*2 |
mcall 58,Finfo |
; mov [byte_count],area+INBUF |
end if |
pop edx ecx eax |
ret |
macro QueryFile |
{ |
local ex |
if SYS eq win |
invoke GetOpenFileName,ofstruc |
else |
opendialog draw_window,QFok,QFcanc,filename |
QFok: |
xor eax,eax |
jmp ex |
ret |
QFcanc: |
mov eax,1 |
end if |
ex: |
} |
RunViewer: |
test [Flags],PNG_MODE |
jz .ex |
if SYS eq win |
mov eax,[PNG_info.Width] |
call int2str |
invoke WritePrivateProfileString,ini_sec,ini_rwidth,os_work,ini_file |
mov eax,[PNG_info.Height] |
call int2str |
invoke WritePrivateProfileString,ini_sec,ini_rheight,os_work,ini_file |
invoke CreateProcess,NULL,iview_cmd,NULL,NULL,TRUE,\ |
NORMAL_PRIORITY_CLASS,NULL,NULL,suinfo,pinfo |
invoke WaitForInputIdle,dword[pinfo],0xFFFFFFFF |
invoke FindWindowEx, NULL,NULL,NULL,rawwnd_txt |
invoke FindWindowEx, eax,NULL,NULL,ok_txt |
invoke SendMessage,eax,BM_CLICK,NULL,NULL |
else |
test [Flags],THREAD_YES |
jnz .ex |
mcall 51,1,thread,MEMORY |
mov [child],eax |
end if |
.ex: |
ret |
if SYS eq win |
int2str: |
; in: eax - number |
; out: formatted string -> os_work |
invoke wsprintf,os_work,fmt_str,eax |
add esp,12 |
ret |
rawwnd_txt db 'Set RAW open parameters',0 |
ok_txt db 'OK',0 |
ini_sec db 'RAW',0 |
ini_rwidth db 'RWidth',0 |
ini_rheight db 'RHeight',0 |
ini_file db "C:\Program Files\IrfanView\i_view32.ini",0 |
fmt_str db "%d",0 |
iview_cmd db '"C:\Program Files\IrfanView\i_view32.exe"' |
db ' "D:\Ivushkin\projects\zip\output.raw"',0 |
filt_str: |
db 'Pictures (*.png)',0,'*.png',0 |
db 'Archives (*.zip;*.*gz)',0,'*.zip;*.*gz',0 |
db 'All files (*.*)',0,'*.*',0,0 |
suinfo STARTUPINFO |
pinfo PROCESS_INFORMATION |
cpstruc: |
ofstruc: |
dd ofstruc_end-ofstruc |
dd NULL |
dd NULL |
dd filt_str |
dd NULL |
dd NULL |
dd 0 |
dd filename |
dd 256 |
dd NULL |
dd 0 |
dd NULL |
dd NULL |
dd NULL |
dw NULL |
dw NULL |
dd NULL |
dd NULL |
dd NULL |
dd NULL |
dd NULL |
dd NULL |
dd NULL |
ofstruc_end: |
else |
mov ebx,-1 |
mov ecx,ebx |
mov edx,[PNG_info.Width] |
add edx,10 |
mov esi,[PNG_info.Width] |
add esi,30 |
mcall 67 |
mcall 7,outfile,[outfile.size],10 shl 16+15 |
.ex: |
ret |
MIN_WIDTH equ 300 |
thread: |
.red: |
mcall 12,1 |
mov ebx,[PNG_info.Width] |
cmp ebx,MIN_WIDTH |
jae .more |
mov ebx,MIN_WIDTH |
.more: |
add ebx,20 |
mov ecx,[PNG_info.Height] |
add ecx,30 |
mcall 0,,,0x3808080 |
mcall 4,<5,7>,0x10f0f0f0,filename,255 |
mov ecx,[PNG_info.Width] |
shl ecx,16 |
add ecx,[PNG_info.Height] |
mcall 7,png_image,,10 shl 16+25 |
mcall 12,2 |
.still: |
mcall 10 |
cmp eax,1 |
je .red |
cmp eax,2 |
jne .nokey |
mcall 2 |
cmp ah,27 ; Esc - close |
je .close |
jmp .still |
.nokey: |
cmp eax,3 |
jne .still |
.close: |
and [child],0 |
mcall -1 |
KillViewer: |
pusha |
mov edi,[child] |
test edi,edi |
jz .noth |
mcall 9,os_work,-1 |
mov ecx,eax |
.fchild: |
push ecx |
mcall 9,os_work |
cmp edi,[ebx+30] |
jne .lp |
mov ecx,[esp] |
mcall 18,2 |
pop ecx |
jmp .noth |
.lp: |
pop ecx |
loop .fchild |
.noth: |
popa |
ret |
macro CmdLine |
{ |
mov esi,PARAM_PTR |
.parse: |
lodsb |
test al,al |
jnz .noend |
or [Flags],STAY_MODE |
jmp red |
.noend: |
cmp al,' ' |
je .stay |
cmp al,'/' |
jne .yespar |
mov ecx,255 |
dec esi |
mov edi,filename |
xor al,al |
rep stosb |
mov ecx,255 |
mov edi,filename |
rep movsb |
jmp again |
.yespar: |
cmp al,'N' |
jne .nonum |
call get_6ASCII_num |
.fnum: |
mov [FileNum],eax |
jmp .parse |
.nonum: |
cmp al,'n' |
jne .nonum2 |
lodsd |
jmp .fnum |
.nonum2: |
cmp al,'s' |
jne .nostay |
.stay: |
or [Flags],STAY_MODE |
jmp .parse |
.nostay: |
cmp al,'i' |
jne .noclPID |
lodsd |
mov [clientPID],eax |
or [Flags],IPC_MODE |
jmp .parse |
.noclPID: |
cmp al,'R' |
jne .noraw |
or [Flags],RAW_MODE |
jmp .parse |
.noraw: |
cmp al,'q' |
jne .noofs |
lodsd |
.fofs: |
mov [arc_base],eax |
jmp .parse |
.noofs: |
cmp al,'Q' |
jne .noofs2 |
call get_6ASCII_num |
jmp .fofs |
.noofs2: |
jmp .parse |
get_6ASCII_num: |
; in: esi - str ptr, out: eax - num |
xor edx,edx |
mov ebx,10 |
mov ecx,6 |
.lp: |
xor eax,eax |
lodsb |
sub al,'0' |
imul edx,ebx |
add edx,eax |
loop .lp |
mov eax,edx |
ret |
} |
StartPad: |
mcall 19,editorcmd,dumpfile |
ret |
editorcmd db 'TINYPAD ' |
end if |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/mhc/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm mhc.asm mhc |
@pause |
/programs/other/mhc/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm mhc.asm mhc |
@pause |
/programs/other/mhc/trunk/macros.inc |
---|
0,0 → 1,267 |
; 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 |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b eq) |
mov reg,a |
end if |
} |
macro mcall a,b,c,d,e,f { ; mike.dld |
__mov eax,a |
__mov ebx,b |
__mov ecx,c |
__mov edx,d |
__mov esi,e |
__mov edi,f |
int 0x40 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
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 __regs) & (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 |
} |
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 |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/mhc/trunk/mhc.asm |
---|
0,0 → 1,977 |
; |
; MHC archiver for MenuetOS - very fast compression tool |
; |
; version 0.09 |
; |
; Written by Nikita Lesnikov (nlo_one@mail.ru, Republic of Belarus, Sluck) |
; |
;============================================================================== |
; |
; Brief file format description: |
; |
; +-----------+------------------------+ |
; File structure: | Method ID | Compressed data | |
; +-----------+------------------------+ |
; |
; Methods list: |
; |
; 0. LZP (order-2 specified specially for *.ASM,*.RAW and MeOS executables) |
; |
; New methods can be easily added without loss of compatibility |
; with older versions |
; |
;============================================================================== |
; SYSTEM HEADER |
use32 |
org 0x0 |
db "MENUET01" |
dd 0x01 |
dd ENTRANCE |
dd MHC_END |
dd 0x300000 ; 3 megs of memory needed |
dd 0x2FF000 |
dd 0x0 |
dd 0x0 |
include 'lang.inc' |
include 'macros.inc' |
; CODE AREA |
ENTRANCE: |
; ======== user interface ========= |
call draw_window ; draw the window |
still: |
mov eax,10 ; wait for event |
int 0x40 |
cmp eax,1 ; redraw? |
jnz no_redraw |
call draw_window |
no_redraw: |
cmp eax,2 ; key pressed? |
jz key |
cmp eax,3 ; button pressed? |
jz button |
jmp still |
; Key handler |
key: |
mov eax,2 ; read it |
int 0x40 |
shr eax,8 |
cmp byte [editstate],0 |
jz still |
cmp al,8 ; backspace |
jnz no_bksp |
cmp byte [editpos],0 |
jz no_del_last |
dec byte [editpos] |
xor ebx,ebx |
mov bl,byte [editpos] |
add ebx,cmfile |
cmp byte [editstate],2 |
jnz no_add_base_1 |
add ebx,12 |
no_add_base_1: |
mov byte [ebx],32 |
no_del_last: |
call draw_info |
jmp still |
no_bksp: |
cmp al,13 ; enter |
jnz no_enter |
mov byte [editstate],0 |
call draw_info |
jmp still |
no_enter: |
cmp eax,dword 31 |
jbe no_lit |
cmp eax,dword 95 |
jb capital |
sub eax,32 |
capital: |
xor ebx,ebx |
mov bl,byte [editpos] |
add ebx,cmfile |
cmp byte [editstate],2 |
jnz no_add_base_2 |
add ebx,12 |
no_add_base_2: |
mov byte [ebx],al |
inc byte [editpos] |
cmp byte [editpos],12 |
jnz no_null_state |
mov byte [editstate],0 |
no_null_state: |
call draw_info |
no_lit: |
jmp still |
; Button handler |
button: |
mov eax,17 |
int 0x40 |
cmp ah,1 |
jnz no_quit |
mov eax,-1 |
int 0x40 |
no_quit: |
cmp ah,4 |
jnz nofirst |
cld |
mov byte [editstate],1 |
mov edi,cmfile |
mov eax,0x20202020 |
mov ecx,3 |
rep stosd |
mov byte [editpos],0 |
mov byte [msgid],0 |
call draw_info |
nofirst: |
cmp ah,5 |
jnz nosecond |
cld |
mov byte [editstate],2 |
mov edi,iofile |
mov eax,0x20202020 |
mov ecx,3 |
rep stosd |
mov byte [editpos],0 |
mov byte [msgid],0 |
call draw_info |
nosecond: |
cmp ah,2 |
jnz no_compress |
call compress |
no_compress: |
cmp ah,3 |
jnz no_decompress |
call decompress |
no_decompress: |
cmp ah,6 |
jnz no_delete_io |
pusha |
mov eax,32 |
mov ebx,iofile |
int 0x40 |
popa |
no_delete_io: |
cmp ah,7 |
jnz no_delete_archive |
pusha |
mov eax,32 |
mov ebx,cmfile |
int 0x40 |
popa |
no_delete_archive: |
jmp still |
; WINDOW DRAW |
draw_window: |
mov eax,12 ; Start redrawing |
mov ebx,1 |
int 0x40 |
xor eax,eax ; Define window |
mov ebx,100*65536+240 |
mov ecx,100*65536+130 |
mov edx,0x02AAAAAA |
mov esi,0x80777777 |
mov edi,0x00777777 |
int 0x40 |
mov eax,4 ; Draw all needed texts |
mov ebx,8*65536+8 |
mov ecx,0x00FFFFFF |
mov edx,title |
mov esi,arclab-title |
int 0x40 |
xor ecx,ecx |
mov edx,arclab |
mov esi,unplab-arclab |
add ebx,10*65536+28 |
int 0x40 |
mov edx,unplab |
mov esi,fin_text-unplab |
add ebx,18 |
int 0x40 |
pusha |
mov eax,8 ; Buttons |
mov ebx,222*65536+10 |
mov ecx,6*65536+10 |
mov edx,1 |
mov esi,0x555555 |
int 0x40 |
mov ebx,15*65536+100 |
mov ecx,70*65536+13 |
inc edx |
int 0x40 |
inc edx |
add ebx,110*65536 |
int 0x40 |
inc edx |
mov ebx,214*65536+11 |
mov ecx,33*65536+11 |
int 0x40 |
inc edx |
add ecx,18*65536 |
int 0x40 |
inc edx |
mov ebx,15*65536+100 |
mov ecx,86*65536+13 |
int 0x40 |
inc edx |
add ebx,110*65536 |
int 0x40 |
popa |
mov ecx,0x00FFFFFF |
mov edx,keylab |
mov esi,dellab-keylab |
add ebx,19 |
int 0x40 |
mov edx,dellab |
mov esi,title-dellab |
add ebx,16 |
int 0x40 |
call draw_info |
mov eax,12 ; Finish redrawing |
mov ebx,2 |
int 0x40 |
ret |
draw_info: ; Draw filenames and compressor state |
activecolor equ 0x00112299 |
pusha ; Save registers |
mov eax,13 ; Clean draw area |
mov ebx,127*65536+85 |
mov ecx,33*65536+33 |
mov edx,0x00AAAAAA |
int 0x40 |
mov eax,4 ; Draw filenames |
mov ebx,134*65536+36 |
mov edx,cmfile |
xor ecx,ecx |
mov esi,12 |
cmp byte [editstate],1 |
jnz no_active_1 |
mov ecx,activecolor |
no_active_1: |
int 0x40 |
xor ecx,ecx |
cmp byte [editstate],2 |
jnz no_active_2 |
mov ecx,activecolor |
no_active_2: |
add ebx,18 |
add edx,12 |
int 0x40 |
mov eax,13 ; Clean info area |
mov ebx,14*65536+210 |
mov ecx,107*65536+14 |
mov edx,0x00AAAAAA |
int 0x40 |
cmp byte [msgid],0 ; Draw info string |
jz notype |
mov ebx,16*65536+110 |
xor ecx,ecx |
mov esi,16 |
mov al, byte [msgid] |
dec al |
shl al,4 |
xor ah,ah |
xor edx,edx |
mov dx,ax |
add edx,msgtable |
mov eax,4 |
int 0x40 |
notype: |
popa ; Restore registers |
ret |
; interface data |
keylab db " COMPRESS DECOMPRESS" |
dellab db " DELETE I/O DELETE *.MHC" |
title db "MHC 0.09" |
arclab db "COMPRESSED FILE:" |
unplab db "INPUT/OUTPUT FILE:" |
fin_text: |
cmfile db "FILENAME.MHC" |
iofile db "FILENAME.XYZ" |
editstate db 0 |
editpos db 0 |
msgid db 0 |
msgtable: |
db "COMPRESSING... " |
db "DECOMPRESSING..." |
db "I/O NOT FOUND! " |
db "*.MHC NOT FOUND!" |
db "INVALID METHOD! " |
; ======== compression/decompression engine ======== |
; Adresses declaration |
hashtable equ MHC_END |
ifile equ hashtable+65536*4 |
ofile equ ifile+1000000 |
compress: ; File compression |
call fill_filebufs |
mov eax,6 |
mov ebx,iofile |
xor ecx,ecx |
mov edx,ecx |
not edx |
mov esi,ifile |
int 0x40 |
cmp eax,0xFFFFFFFF |
jnz compress_filefound ; i/o file not found |
mov byte [msgid],3 |
call draw_info |
ret |
compress_filefound: |
mov byte [msgid],1 |
call draw_info |
jmp lzp_compress ; compress with order-2 LZP |
compress_dumpdata: |
push edx |
mov eax,32 |
mov ebx,cmfile |
int 0x40 |
mov eax,33 |
pop edx |
mov ebx,cmfile |
mov ecx,ofile |
xor esi,esi |
int 0x40 |
mov byte [msgid],0 |
call draw_info |
ret |
decompress: ; File decompression |
call fill_filebufs |
mov eax,6 |
mov ebx,cmfile |
xor ecx,ecx |
mov edx,ecx |
not edx |
mov esi,ofile |
int 0x40 |
cmp eax,0xFFFFFFFF |
jnz decompress_filefound ; *.mhc file not found |
mov byte [msgid],4 |
call draw_info |
ret |
decompress_filefound: |
cmp byte [ofile],0 ; Invalid method! |
jz right_method |
mov byte [msgid],5 |
call draw_info |
ret |
right_method: |
mov byte [msgid],2 |
call draw_info |
jmp lzp_decompress |
decompress_dumpdata: |
push edx |
mov eax,32 |
mov ebx,iofile |
int 0x40 |
mov eax,33 |
pop edx |
mov ebx,iofile |
mov ecx,ifile |
xor esi,esi |
int 0x40 |
mov byte [msgid],0 |
call draw_info |
ret |
fill_filebufs: ; Fill filebufs with garbage to simplify matching |
pusha |
cld |
mov eax,0xF7D9A03F ; <- "magic number" :) just garbage... |
mov ecx,2000000/4 |
mov edi,ifile |
rep stosd |
popa |
ret |
; ==== algorithms section ==== |
; Method 0: LZP compression algorithm |
lzp_compress: ; EDX - how much bytes to dump |
cld ; clear direction flag |
mov esi,ifile ; init pointers |
mov edi,ofile |
push eax ; write header: ID0+4bfilesize => total 5 bytes |
xor eax,eax |
stosb |
pop eax |
stosd |
pusha ; fill hash table |
mov eax,ifile |
mov edi,hashtable |
mov ecx,65536 |
rep stosd |
popa |
add eax,esi ; calculate endpointer |
mov dword [endpointer],eax |
movsw ; copy three bytes |
movsb |
mov dword [controlp],edi |
inc edi |
mov byte [controld],0 |
mov byte [controlb],0 |
c_loop: |
cmp dword [endpointer],esi ; check end of file |
ja c_loop_ok |
jmp finish_c_loop |
c_loop_ok: |
call chash |
call compare |
jz two_match_c |
lodsb |
mov byte [literal],al |
call chash |
call compare |
jz lit_match_c |
mov al,0 |
call putbit |
mov al,byte [literal] |
stosb |
movsb |
jmp end_c_loop |
lit_match_c: |
mov al,1 |
call putbit |
mov al,0 |
call putbit |
mov al,byte [literal] |
stosb |
jmp encode_match |
two_match_c: |
mov al,1 |
call putbit |
call putbit |
encode_match: |
call incpos |
call compare |
jz one_c |
mov al,0 |
call putbit |
jmp end_c_loop |
one_c: |
call incpos |
mov al,1 |
call putbit |
call compare |
jnz ec1 |
call incpos |
call compare |
jnz ec2 |
call incpos |
call compare |
jnz ec3 |
call incpos |
mov al,1 |
call putbit |
call putbit |
call compare |
jnz ec4 |
call incpos |
call compare |
jnz ec5 |
call incpos |
call compare |
jnz ec6 |
call incpos |
call compare |
jnz ec7 |
call incpos |
call compare |
jnz ec8 |
call incpos |
call compare |
jnz ec9 |
call incpos |
call compare |
jnz ec10 |
call incpos |
mov al,1 |
call putbit |
call putbit |
call putbit |
xor ecx,ecx |
match_loop_c: |
cmp esi,dword [endpointer] |
jae out_match_loop_c |
call compare |
jnz out_match_loop_c |
inc ecx |
call incpos |
jmp match_loop_c |
out_match_loop_c: |
mov al,0xFF |
out_lg: |
cmp ecx,255 |
jb out_lg_out |
stosb |
sub ecx,255 |
jmp out_lg |
out_lg_out: |
mov al,cl |
stosb |
jmp end_c_loop |
ec10: |
mov al,1 |
call putbit |
call putbit |
mov al,0 |
call putbit |
jmp end_c_loop |
ec9: |
mov al,1 |
call putbit |
mov al,0 |
call putbit |
mov al,1 |
call putbit |
jmp end_c_loop |
ec8: |
mov al,1 |
call putbit |
mov al,0 |
call putbit |
call putbit |
jmp end_c_loop |
ec7: |
mov al,0 |
call putbit |
mov al,1 |
call putbit |
call putbit |
jmp end_c_loop |
ec6: |
mov al,0 |
call putbit |
mov al,1 |
call putbit |
mov al,0 |
call putbit |
jmp end_c_loop |
ec5: |
mov al,0 |
call putbit |
call putbit |
mov al,1 |
call putbit |
jmp end_c_loop |
ec4: |
mov al,0 |
call putbit |
call putbit |
call putbit |
jmp end_c_loop |
ec3: |
mov al,1 |
call putbit |
mov al,0 |
call putbit |
jmp end_c_loop |
ec2: |
mov al,0 |
call putbit |
mov al,1 |
call putbit |
jmp end_c_loop |
ec1: |
mov al,0 |
call putbit |
call putbit |
end_c_loop: |
jmp c_loop |
finish_c_loop: |
mov eax,dword [controlp] ; store last tagbyte |
mov bl,byte [controld] |
mov [eax], byte bl |
sub edi,ofile ; calculate dump size |
mov edx,edi |
jmp compress_dumpdata |
; LZP decompression algorithm |
lzp_decompress: ; EDX - how much bytes to dump |
cld |
mov edi,ifile |
mov esi,ofile+1 |
pusha ; fill hash table |
mov eax,ifile |
mov edi,hashtable |
mov ecx,65536 |
rep stosd |
popa |
lodsd |
mov ebx,edi |
add ebx,eax |
mov dword [endpointer],ebx |
movsw |
movsb |
lodsb |
mov byte [controld],al |
mov byte [controlb],0 |
d_loop: |
cmp dword [endpointer],edi |
ja d_loop_ok |
jmp finish_d_loop |
d_loop_ok: |
call getbit |
cmp al,0 |
jnz match_d |
call dhash |
movsb |
call dhash |
movsb |
jmp end_d_loop |
match_d: |
call getbit |
cmp al,0 |
jnz no_literal_before_match |
call dhash |
movsb |
no_literal_before_match: |
call dhash |
mov ecx,1 |
call copymatch |
call getbit |
cmp al,0 |
jz end_d_loop |
mov ecx,1 |
call copymatch |
call getbit |
cmp al,0 |
jz dc2 |
mov ecx,2 |
call copymatch |
call getbit |
cmp al,0 |
jz end_d_loop |
mov ecx,1 |
call copymatch |
call getbit |
cmp al,0 |
jz dc4 |
mov ecx,4 |
call copymatch |
call getbit |
cmp al,0 |
jz dc5 |
call getbit |
cmp al,0 |
jz dc6 |
mov ecx,3 |
call copymatch |
do: |
lodsb |
xor ecx,ecx |
mov cl,al |
call copymatch |
cmp al,0xFF |
jnz end_do |
jmp do |
end_do: |
jmp end_d_loop |
dc6: |
mov ecx,2 |
call copymatch |
jmp end_d_loop |
dc5: |
call getbit |
cmp al,0 |
jz ndc5 |
mov ecx,1 |
call copymatch |
ndc5: |
jmp end_d_loop |
dc4: |
call getbit |
cmp al,0 |
jz ndc4 |
call getbit |
mov ecx,3 |
cmp al,1 |
jz ndcc4 |
dec ecx |
ndcc4: |
call copymatch |
jmp end_d_loop |
ndc4: |
call getbit |
cmp al,0 |
jz ndccc4 |
mov ecx,1 |
call copymatch |
ndccc4: |
jmp end_d_loop |
dc2: |
call getbit |
cmp al,0 |
jz ndc2 |
mov ecx,1 |
call copymatch |
ndc2: |
end_d_loop: |
jmp d_loop |
finish_d_loop: |
mov edx, dword [ofile+1] |
jmp decompress_dumpdata |
; LZP subroutines |
putbit: ; bit -> byte tag, AL holds bit for output |
pusha |
mov cl,byte [controlb] |
shl al,cl |
mov bl,byte [controld] |
or bl,al |
mov byte [controld],bl |
inc cl |
cmp cl,8 |
jnz just_increment |
mov byte [controlb],0 |
mov byte [controld],0 |
push edi |
mov edi, dword [controlp] |
mov al,bl |
stosb |
pop edi |
mov dword [controlp],edi |
popa |
inc edi |
ret |
just_increment: |
mov byte [controlb],cl |
popa |
ret |
getbit: ; tag byte -> bit, AL holds input |
push ecx |
mov al,byte [controld] |
mov cl,byte [controlb] |
shr al,cl |
and al,1 |
inc cl |
cmp cl,8 |
jnz just_increment_d |
mov byte [controlb],0 |
push eax |
lodsb |
mov byte [controld],al |
pop eax |
pop ecx |
ret |
just_increment_d: |
mov byte [controlb],cl |
pop ecx |
ret |
chash: ; calculate hash -> mp -> fill position |
pusha |
xor eax,eax |
mov al, byte [esi-1] |
mov ah, byte [esi-2] |
shl eax,2 |
add eax,hashtable |
mov edx,dword [eax] |
mov dword [mp],edx |
mov dword [eax],esi |
popa |
ret |
dhash: ; calculate hash -> mp -> fill position |
pusha |
xor eax,eax |
mov al, byte [edi-1] |
mov ah, byte [edi-2] |
shl eax,2 |
add eax,hashtable |
mov edx,dword [eax] |
mov dword [mp],edx |
mov dword [eax],edi |
popa |
ret |
copymatch: ; ECX bytes from [mp] to [rp] |
push esi |
mov esi,dword [mp] |
rep movsb |
mov dword [mp],esi |
pop esi |
ret |
compare: ; compare [mp] with [cpos] |
push edi |
push esi |
mov edi,dword [mp] |
cmpsb |
pop esi |
pop edi |
ret |
incpos: |
inc dword [mp] |
inc esi |
ret |
; LZP algorithm data |
endpointer dd 0 |
controlp dd 0 |
controlb db 0 |
controld db 0 |
mp dd 0 |
literal db 0 |
MHC_END: ; the end... - Nikita Lesnikov (nlo_one) |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/tinypad2/trunk/ReadMe.txt |
---|
0,0 → 1,203 |
-= [v 3.78b] =- |
¥àá¨ï ¡ë« ᤥ« áà §ã ¯®á«¥ ⮣® ª ª ï ¢ë«®¦¨« ¯à¥¤., ® ï ¥ñ ¥ ¢ëª« ¤ë¢ «, |
â ª ª ª ¤¥ï«áï ¥éñ ¤®à ¡®â âì. |
®¢®¥: |
- ¯®¨áª á¯àïâ ¢ ¬¥î, £®àïç ï ª« ¢¨è ctrl+F7, ¯®¨áª ¤ «¥¥ - ctrl+F8 |
- ¡®«¥¥ ¤«¨ ï áâப ®âªàëâ¨ï ä ©«®¢, ¥ ¦¥« â¥«ì® ®âªàë¢ âì ¯ã⨠|
>71 ᨬ¢®« , â ª ª ª ¬®£ãâ ¢®§¨ªãâì ®è¨¡ª¨ ¯à¨ à ¡®â¥ á ®ª®¬ "¡ëáâண® á/§" |
íâ® ¯à®áâ® ¤®¯®«¥¨¥ ª ¯à¥¤ë¤ã饬㠢ë¯ãáªã. ¤ «ìè¥ ¡ã¤¥â ¨á¯à ¢«¥®: |
- £«îª á ¥ ªâ¨¢ë¬¨ ®ª ¬¨. |
-= [v 3.78a] =- |
த¥ à ¡®â ¥â.. :) |
®¢®¥: |
- ªà®«« ¢§ïâ á "Scroll.inc", ¢â®à ª®â®à®£® Jason Delozier. |
¯à¨æ¨¯ ¤¢¨¦¥¨ï ¯® ¤®ªã¬¥âã ¯®«®áâìî ¨§¬¥ñ (¯® áà ¢¥¨î |
á ¯à®è«®© ¢¥àᨥ©). |
- ãàá®à ¤¢¨£ ¥âáï ª«¨ª®¬ ¬ë誨. |
- ®¡ ¢«¥ äãªæ¨ï Goto Line #. |
(enter-goto; esc - cancel) |
¤®áâ â®ç® ¯®«¥§ ï äãªæ¨ï, ª®£¤ ä á¬( ¤®áª¥ ®â« ¤ª¨) ¯¨è¥â çâ® ®è¨¡ª |
¢ â ª®©-â® áâப¥... |
- á¯à ¢«¥ ¡ £ á § ¤ ¨¥¬ ¨¬¥¨ ®¢®£® ä ©« |
- á¯à ¢«¥ ¡ £ á® áâப®© ¯®¨áª (¯à¨ "¯®¨áª¥" ¯®á«¥¤¥© áâப¨) |
- á¯à ¢«¥ ¡ £ ¯®á«¥ ¢ë§®¢ ¤¨ «®£®¢ ®âªàëâ¨ï/á®åà ¥¨ï. |
⥯¥àì áªà®«« ¯®á«¥ ¨å ¯à®¤®«¦ ¥â à ¡®â âì ;) |
- ¥«ª¨¥ ¨á¯à ¢«¥¨ï ¢ à ¡®â¥ ¬¥î. |
®ï¢¨«áï: |
£«îª, ª ª ¢ LC - ¯à¨ ¦ ⨨ ¢ ®¡« á⨠®ª , ¤ ¦¥ ¥á«¨ ®ª® ¥ ªâ¨¢®, |
ªãàᮢ ¨ áªà®«« ¡ à ¢áñ à ¢® ॠ£¨àãîâ ¬ëèªã. |
¡®â î ¤: |
-ᯨ᪮¬ ¯®á«¥¤¨å ä ©«®¢ |
-§ £à㧪®© "color table'a" |
â ª ¦¥, ¤® ¯®á¬®âà¥âì ¨á室¨ª¨ HeEd'a, â®ç¥¥ äãªæ¨¨ ¯¥à¥ª®¤¨à®¢ª¨. |
------------------------------------------------- |
-= [v 3.77a] =- |
éñ ®¤ «ìä . |
íâ®â à §: |
- ¤®¡ ¢«¥ ¯®«®á ¯à®ªã⪨ |
- ¨á¯à ¢«¥® ®ª® ¢®¯à®á "á®åà ¨âì ¤®ªã¬¥â", â ª ª ª ï § ¬¥â¨« |
çâ® ®® ¦à «® ¬®£® ¯à®æ¥áá®à®£® ¢à¥¬¥¨. |
- ®¡®¢«¥¨¥ íªà ¯®á«¥ ¤¨ «®£®¢ á®åà ¥¨ï ¨ ®âªàëâ¨ï |
§ ¬¥âªã: áªà®«« ¯®«®áâìî ᤥ« ¬®© ¨ ¯®í⮬ã, ¢®§¬®¦®, ¥áâì £«îª¨. |
â ª ª ª ï ¥ èñ« ¡®«¥¥ å®à®è¥© ä®à¬ã«ë, áªà®«« ¢á¥£¤ ¥¬®£® ¥ ¤®¥§¦ ¥â ¤® |
¢¥àå , § â® ¨ª®£¤ ¥ ¯¥à¥á¥ª ¥â ¨¦îî ª®¯ªã (¢à®¤¥ ¡ë) |
ª®¯ª¨ áªà®«« "¢¢¥àå" ¨ "¢¨§" íª¢¨¢ «¥âë pg.up ¨ pg.down |
§¬¥à áªà®«« ¦¥á⪮ § ªà¥¯«ñ, â ª ª ª ᪮஠¡ã¤¥â § ¯¥à饮 |
¨§¬¥ïâì à §¬¥ë ®ª . |
¥ ¯®«ãç¨âáï: |
¡à âì ®£à ¨ç¥¨¥ ¢ 80 ᨬ¢®«®¢ ¨ ¯à¨á®¡ ç¨âì ¯®¤¤¥à¦ªã BGI èà¨ä⮢. |
஡«¥¬ ¢ ᫨誮¬ ¨§¢à éñ®¬ «£®à¨â¬¥ ¢ë¢®¤ ᨬ¢®«®¢ (¯® ªà ©¥© |
¬¥à¥ ¬¥ â ª ¯®ª § «®áì), ¯à®é¥ ¡ã¤¥â ¯¥à¥¤¥« âì ¢áñ ¯® ®¢®©, |
¢§ï¢ ¥ª®â®àë¥ äãªæ¨¨ ®âáî¤ . |
á«¥¤ãî饩 ¢¥àᨨ ¯« ¨àã¥âáï: |
- äãªæ¨ï "goto string #" |
- ¨§¬¥¥¨¥ 梥â ⥪áâ (¨ ᯥæ. ᨬ¢®«®¢) ¨ à ¡®ç¥© ®¡« áâ¨. |
- á®åà ¥¨¥ ¥¡®«ì讣® ᯨ᪠"¯®á«¥¤¨å । ªâ¨à㥬ëå ä ©«®¢" |
¯®áâ à îáì, ® ¢áñ ¦¥ ¨ç¥£® ¥ ®¡¥é î.... |
-= [v 3.76 ] =- |
®¢â®àë© à¥¬¥©ª â ©¨¯ ¤ :) « ¢¨ âãà à㫨â. |
â® ®¢®£®? |
- "ª® ¡ëáâண® á®åà ¥¨ï ¨ § £à㧪¨" ¤«ï ¯à®¯¨áë¢ ¨ï ¯ã⨠|
ª ä ©«ã "¢àãçãî". í⮬ ¦¥ ®ª¥ £®àï稥 ª« ¢¨è¨ - |
ctrl+s - á®åà ¨âì, ctrl+o - ®âªàëâì, esc - ®â¬¥ |
- ®àï稥 ª« ¢¨è¨ ¤«ï ª®¬¯¨«ï樨(CTRL+F9), |
ª®¬¯¨«ï樨 ¨ § ¯ã᪠(CTRL+F10), ¨ ¤®áª¨ ®â« ¤ª¨(F12) |
- £« ¢®¥ ®ª® ®áâ ñâáï ªâ¨¢ë¬ ¯®á«¥ § ¯ã᪠¤®áª¨ ®â« ¤ª¨ |
¨ ®ª ¡ëáâண® á®åà ¥¨ï (⮫쪮 £®àï稬¨ ª« ¢¨è ¬¨) |
- á¯à ¢«¥ £«îª ¢ë«¥â ¨ï ¯à¨ ¯®¯ë⪥ ¯®¨áª ¢ ¯ãá⮬ |
¤®ªã¬¥â¥ |
- ®¡« £®à®¦¥ ¯¨áª ¨§ ᯨª¥à , ⥯¥àì ¯®å®¦ ¯¨áª ®«¨¡à¨ 3 |
- ®¯ª¨ ¢ë஢¥ë ¤«ï ¨á¯®«ì§®¢ ¨ï ᪨ |
- ¯® ¥¯®ïâë¬ ¬¥ ¯à¨ç¨ ¬ ä ©«ë á®åà ñë¥ ¢ ¨¦¥¬ ॣ¨áâॠ|
¡á®«îâ® ¥ ¯à¨¨¬ «¨áì sysxtree ¨ 㦮 ¡ë«® ¨å ®âªàë¢ âì |
¢àãçãî ¯à®¯¨áë¢ ï ¯ãâì. ¨á¯à ¢«¥® ®¡ëçë¬ ¯¥à¥¢®¤®¬ ¢ ¢¥à娩 |
ॣ¨áâà. |
- ®ª á®®¡é¥¨ï ¯à¨ ¯¥à¥¯®«¥®¬ ¤¨áª¥ (â ¦¥ ¯à®æ¥¤ãà , çâ® ¨ ¤«ï erroff ã |
savedialog) |
- ¨á¯à ¢«¥ ¬®© ¡ £ - ¯à¨ ¥¢®§¬®¦®á⨠á®åà ¥¨ï ⥯¥àì ®áâ ñâáï áâ àë© ¯ãâì |
ª ä ©«ã (¨ ¨¬ï). |
- ¨á¯à ¢«¥® ¥éñ ¯ à®çª ¬¥«ª¨å ¥¤®çñ⮢ (¬®¨å?!). |
â® ¥ ᤥ« ®? |
áñ ¥éñ ¥â ¯®¤¤¥à¦ª¨ èà¨ä⮢ BGI ¨ |
¨§¬¥¥¨ï 梥â ä® /⥪áâ . ®âï ï ᮬ¥¢ îáì, çâ® BGI èà¨äâë ¯àאַ "¥®¡å®¤¨¬ |
ë" |
¢ á¬-¡«®ª®â¥. |
®ª ¥éñ ¥ ®¡à ¡ âë¢ ¥âáï ®è¨¡ª "fat12 § ¯®«¥" - ¢à®¤¥ ¡ë ¤ ¦¥ äãªæ¨¨ ¢ ï¤ |
ॠ¥â... |
®çã ¯¥à¥©â¨ ᪠-ª®¤ë, â® ¢ ᪨ ¯®¢â®àïîâáï ª®¤ë. |
-------------------------------------------- |
¨ ¥éñ: ® ®è¨¡ª å ¨ ªà¨â¨ª¥ - ¬¥ (¥ "¬¥ï") ¬ë«® ¨«¨ ä®àã¬. |
-------------------------------------------- |
áâ®à¨ï... |
-= [ v 3.75b ] =- |
.... |
¥¬¥©ª :) Tinypad'a : |
ã«¡ à ⥯¥àì á¯àïâ ¢ ¬¥î. «ï á®åà ¥¨ï ¨ ®âªàëâ¨ï ¨á¯®«ì§ãîâáï |
¤¨ «®£¨ ¨§ ASCL ¢«îè¨ ¢£¥¨ï. á¯à ¢«¥ "¦ã⪨©" ¡ £ - ª®£¤ |
á®åà ï¥èì ¤®ªã¬¥â ¯®¤ ¤à㣨¬ ¨¬¥¥¬, ¢ áâப¥ § £®«®¢ª ®áâ ¢ «®áì |
áâ ஥ §¢ ¨¥. |
®¡ ¢«¥ë ¤¨ «®£®¢ë¥ ®ª ¯à¨ ®è¨¡ª å ¨ ¢ë室¥. ®¡ ¢«¥ ª®¯ª |
"®¢ë©", ¯à¨ ¦ ⨨ ª®â®àãî § ¤ ñâáï ¢®¯à®á ® á®åà ¥¨¨ ä ©« , § ⥬ |
ᮧ¤ ñâáï ¤®ªã¬¥â á ®¢ë¬ ¨¬¥¥¬. ªá¨¬ «ì® 99 ®¢ëå ¤®ªã¬¥â®¢. ®¯ª |
"®¢®¥ ®ª®" ®âªàë¢ ¥â ®¢®¥ ®ª® ©¨¯ ¤ (§ ¯ã᪠¥â ®¢ë© ¯à®æ¥áá). |
£àãá⮬... |
¡® ¢á¥å ®è¨¡ª å ¬¥ ¬ë«®, ¯®¯à®¡ãî ¨á¯à ¢¨âì. |
¨ «®£ "á®åà ¨âì ª ª" á®åà ï¥â ⮫쪮 £®â®¢ë¥ ä ©«ë (â® ¥áâì ¯®¢¥àå ¨å, |
¥«ì§ï ᮧ¤ âì ®¢ë©). |
ਠ¯®¯ë⪥ ¯®¨áª áâப¨ ¢ ¯ãá⮬ ¤®ªã¬¥â¥ ¯à®£ ¢ë«¥â ¥â :( |
ਠ¢ë室¥, ª®£¤ ¢ë« §¨â ®ª®èª® á ¢®¯à®á®¬ "á®åà ¨âì ä ©«?" - ¤ - á®åà ï¥â |
¤®ªã¬¥â ¨ § ªàë¢ ¥â ®ª®, ¥â - ¥ á®åà ï¥â ¨ ¢ë室¨â, ¥«çñª ¯® à ¡®ç¥© ®¡« |
á⨠|
â ©¨¯ ¤ íª¢¨¢ «¥â¥ ª®¯ª¥ ®â¬¥ , ª®â®à®© ¥âã ;), ¯à ¢¤ ¥á«¨ ®ª® á®®¡é¥¨ |
ï |
¯¥à¥¬¥áâ¨âì, £« ¢®¥ ®ª® ¥ ®¡®¢«ï¥âáï. â® ¢ë§¢ ® "ᯥæ¨ä¨ç¥áª¨¬" ª®¤®¬, â |
ª |
ª ª ¡®«¥¥ ¯à®á⮣® à¥è¥¨ï ï ¥ èñ«. |
ᯠᨡª å... |
ᥬ ᯠᨡ ! ¢«îè¨ã § ASCL, «ï¢¨ã, Willow ¨ ¢á¥¬ á 襣® ä®à㬠¯®¬®éì. |
¡ã¤ã饬... |
¥á«¨ ¯®«ãç¨âáï, ¬®¦® ¡ã¤¥â ॠ«¨§®¢ âì ¯®¤¤¥à¦ªã BGI èà¨ä⮢... ¥éñ ¥ ᬮâ५ |
¨å ª®¤ -- áâà è®! |
â®, ¡«%? |
DoomEd Archangel |
archangel@mail.kz / meos-wall.narod.ru |
-= [ v 3.75a ------> v 3.6 ] =- |
;****************************************************************************** |
; project name: TINYPAD |
; compiler: flat assmebler 1.52 alpha 3 |
; version: 3.75a |
; last update: 24/03/2004 |
; maintained by: Ivan Poddubny |
; e-mail: ivan-yar@bk.ru |
;****************************************************************************** |
; HISTORY: |
; 3.75a |
; fixed converting char to upper case in read_string |
; 3.75 |
; rewrote save_file from scratch; bugfix in loadfile; |
; 3.74 |
; optimisation |
; 3.73 |
; completly new load_file function |
; 3.72 |
; speed++ |
; 3.71 |
; error beep |
; 3.6,3.7: |
; many bugs fixed |
; simple toolbar |
; compile, run applications from TINYPAD, all fasm output is in debug board |
; TAB button |
; auto-indent |
; Ctrl+L - insert comment string |
;****************************************************************************** |
; Memory 0x300000: |
; stack 0x00eff0 - áâíª |
; stack for help 0x00fff0 - |
; stack for help 0x00fff0 |
/programs/other/tinypad2/trunk/archive.txt |
---|
0,0 → 1,8 |
«ï ç¨ îé¨å à ¡®â âì á MeOS - ®¯¨á ¨¥ ä ©«®¢ ¢ í⮬ à娢¥: |
tinypad - ᪮¬¯¨«¨à®¢ ë© ¨á¯®«ï¥¬ë© ä ©« MeOS |
tinypad.asm - ¨áå®¤ë© ª®¤ |
ascl.inc - assembler small code library ®â ¢«îè¨ ¢£¥¨ï |
(äãªæ¨ï label § ¬¥¥ putlabel) |
dialogs1.inc - ¤¨ «®£®¢ë¥ ®ª , messagebox'ë ¨ ¥ ®ç¥ì å®à®è¥¥ ¬¥î. |
macros.inc - ⮦¥ § ¬¥ç ⥫ìë© ¡®à ¬ ªà®á®¢. |
/programs/other/tinypad2/trunk/ascl.inc |
---|
0,0 → 1,933 |
lang equ ru ; ru en fr ge fi |
; |
; Assembler |
; SMALL |
; CODE |
; Libary |
; |
; Ver 0.14 By Pavlushin Evgeni (RUSSIA) |
; www.waptap@mail.ru |
;Please compile aplications on FASM ver1.54 or higer!!! |
;InfoList |
;0.01 scank,putpix,puttxt |
;0.02 label,random,colors |
;0.03 window,startwd,endwd,attributes |
;0.04 close,delay,scevent ~30.04.2004 |
;0.05 small random, ~04.05.2004 |
;0.06 wtevent ~09.05.2004 |
;0.07 timeevent ~23.05.2004 |
;0.08 txtput ~14.06.2004 |
;0.09 opendialog,savedialog ~20.06.2004 |
;0.10 wordstoreg by halyavin, add at ~30.08.2004 |
; random bug deleted eax is use. |
;0.11 loadfile from me +puttxt bug del ~07.09.2004 |
;0.12 open/save dialog ~13.09.2004 |
;0.13 dialogs bugs deleted |
;0.14 drawlbut ~03.10.2004 |
;0.15 extendet label! |
; LOADFILE |
; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area |
; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area |
macro loadfile file_name,file_load_area,file_temp_area |
{ |
local open,fileinfo,string |
jmp open |
fileinfo: |
dd 0 |
dd 0 |
dd 1 |
dd file_load_area |
dd file_temp_area |
string: |
db file_name,0 |
open: |
mov dword [fileinfo+8],1 ; how many blocks to read (1) |
mov eax,58 |
mov ebx,fileinfo |
int 0x40 |
mov eax,[file_load_area+2] |
shr eax,9 ; ¯®¤¥«¨¬ 512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢ |
inc eax |
mov dword [fileinfo+8],eax |
mov eax,58 |
mov ebx,fileinfo |
int 0x40 |
} |
;*********************************************************** |
macro savefile file_name,file_save_area,file_temp_area,fsize |
{ |
local save,fileinfo,string ;,counter00 |
jmp save |
;counter00 dd 0 |
fileinfo: |
dd 1 |
dd 0 |
dd fsize ;counter00 |
dd file_save_area |
dd file_temp_area |
string: |
db file_name,0 |
save: |
;xor edi,edi |
; sub edi,file_save_area ; calculate dump size |
; mov edx,edi |
;mov [counter00],edi |
; mov dword [fileinfo+8],1 ; how many blocks to write (1) |
; mov eax,58 |
; mov ebx,fileinfo |
; int 0x40 |
; mov eax,[file_load_area+2] |
; shr eax,9 ; ¯®¤¥«¨¬ 512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢ |
; inc eax |
; mov dword [fileinfo+8],eax |
mov eax,58 |
mov ebx,fileinfo |
int 0x40 |
} |
;*********************************************************** |
;macro wordstoreg reg,hiword,loword |
;{ |
;if hiword eqtype 0 & loword eqtype 0 |
; mov reg,dword hiword*65536+loword |
;else if hiword eqtype 12 & loword eqtype eax |
; mov reg,dword hiword*65536 |
; add reg,dword loword |
;else if hiword eqtype 12 & loword eqtype [123] |
; mov reg,dword hiword*65536 |
; add reg,dword loword |
;else |
; mov reg,dword hiword |
; shl reg,16 |
; add reg,dword loword |
;end if |
;} |
macro dword2reg reg,doubleword |
{ |
if doubleword eq |
; not changes |
else |
mov reg,dword doubleword |
end if |
} |
macro words2reg reg,hiword,lowword |
{ |
if hiword eq |
if lowword eq |
; not changes |
else |
if lowword eqtype 12 |
and reg,dword 0xffff0000 |
add reg,dword lowword |
else |
and reg,dword 0xffff0000 |
add reg,dword lowword |
end if |
end if |
else |
if lowword eq |
if hiword eqtype 12 |
and reg,dword 0x0000ffff |
add reg,dword hiword*65536 |
else |
shl reg,16 |
add reg,dword hiword |
ror reg,16 |
end if |
else |
if lowword eqtype 12 & hiword eqtype 12 |
if lowword eq 0 & hiword eq 0 |
xor reg,reg |
else |
mov reg,dword hiword*65536+lowword |
end if |
else |
mov reg,dword hiword |
shl reg,16 |
add reg,dword lowword |
end if |
end if |
end if |
} |
; DRAW BUTTON with label |
macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor |
{ |
local asd,lab |
jmp asd |
lab db text ;arg label |
asd: |
words2reg ebx,x,xs |
words2reg ecx,y,ys |
mov edx,id |
mov esi,bcolor |
mov eax,8 |
int 0x40 |
mov eax,asd-lab ;calc size |
mov ebx,6 |
mul ebx |
mov esi,eax |
mov eax,xs |
sub eax,esi |
shr eax,1 |
add eax,x |
mov edx,ys |
sub edx,7 |
shr edx,1 |
add edx,y |
mov ebx,eax |
shl ebx,16 |
add ebx,edx |
mov ecx,tcolor ;arg4 color |
mov edx,lab |
mov esi,asd-lab ;calc size |
mov eax,4 |
int 0x40 |
} |
macro opendialog redproc,openoff,erroff,path |
{ |
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc |
local run_fileinfo, param |
local getmesloop, loox, mred, mkey, mbutton, mgetmes |
local dlg_is_work, ready, procinfo |
; |
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
; |
cld |
;; mov esi,path |
mov edi,path |
mov eax,0 |
mov ecx,200 |
rep stosb |
;mov [get_loops],0 |
mov [dlg_pid_get],0 |
; Get my PID in dec format 4 bytes |
mov eax,9 |
mov ebx,procinfo |
mov ecx,-1 |
int 0x40 |
; convert eax bin to param dec |
mov eax,dword [procinfo+30] ;offset of myPID |
mov edi,param+4-1 ;offset to 4 bytes |
mov ecx,4 |
mov ebx,10 |
cld |
new_d: |
xor edx,edx |
div ebx |
add dl,'0' |
mov [edi],dl |
dec edi |
loop new_d |
; wirite 1 byte space to param |
mov [param+4],byte 32 ;Space for next parametr |
; and 1 byte type of dialog to param |
mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) |
; |
; STEP2 prepare IPC area for get messages |
; |
; prepare IPC area |
mov [path],dword 0 |
mov [path+4],dword 8 |
; define IPC memory |
mov eax,60 |
mov ebx,1 ; define IPC |
mov ecx,path ; offset of area |
mov edx,150 ; size 150 bytes |
int 0x40 |
; change wanted events list 7-bit IPC event |
mov eax,40 |
mov ebx,01000111b |
int 0x40 |
; |
; STEP 3 run SYSTEM XTREE with parameters |
; |
mov eax,58 |
mov ebx,run_fileinfo |
int 0x40 |
call redproc |
mov [get_loops],0 |
getmesloop: |
mov eax,23 |
mov ebx,50 ;0.5 sec |
int 0x40 |
cmp eax,1 |
je mred |
cmp eax,2 |
je mkey |
cmp eax,3 |
je mbutton |
cmp eax,7 |
je mgetmes |
; Get number of procces |
mov ebx,procinfo |
mov ecx,-1 |
mov eax,9 |
int 0x40 |
mov ebp,eax |
loox: |
mov eax,9 |
mov ebx,procinfo |
mov ecx,ebp |
int 0x40 |
mov eax,[DLGPID] |
cmp [procinfo+30],eax ;IF Dialog find |
je dlg_is_work ;jmp to dlg_is_work |
dec ebp |
jnz loox |
jmp erroff |
dlg_is_work: |
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated |
je erroff ;TESTODP2 terminated too |
cmp [dlg_pid_get],dword 1 |
je getmesloop |
inc [get_loops] |
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
jae erroff |
jmp getmesloop |
mred: |
call redproc |
jmp getmesloop |
mkey: |
mov eax,2 |
int 0x40 ; read (eax=2) |
jmp getmesloop |
mbutton: |
mov eax,17 ; get id |
int 0x40 |
cmp ah,1 ; button id=1 ? |
jne getmesloop |
mov eax,-1 ; close this program |
int 0x40 |
mgetmes: |
; If dlg_pid_get then second message get jmp to still |
cmp [dlg_pid_get],dword 1 |
je ready |
; First message is number of PID SYSXTREE dialog |
; convert PID dec to PID bin |
movzx eax,byte [path+16] |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+1] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+2] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+3] |
add eax,ebx |
sub eax,48 |
mov [DLGPID],eax |
; Claear and prepare IPC area for next message |
mov [path],dword 0 |
mov [path+4],dword 8 |
mov [path+8],dword 0 |
mov [path+12],dword 0 |
mov [path+16],dword 0 |
; Set dlg_pid_get for get next message |
mov [dlg_pid_get],dword 1 |
call redproc ;show DLG_PID |
jmp getmesloop |
ready: |
; |
; The second message get |
; Second message is 100 bytes path to SAVE/OPEN file |
; shl path string on 16 bytes |
; |
cld |
mov esi,path+16 |
mov edi,path |
mov ecx,200 |
rep movsb |
mov [edi],byte 0 |
jmp openoff |
; DATA AREA |
get_loops dd 0 |
dlg_pid_get dd 0 |
DLGPID dd 0 |
param: |
dd 0 ; My dec PID |
dd 0,0 ; Type of dialog |
run_fileinfo: |
dd 16 |
dd 0 |
dd param |
dd 0 |
dd procinfo ; 0x10000 |
;run_filepath |
db '/RD/1/SYSXTREE',0 |
procinfo: |
times 1024 db 0 |
} |
macro savedialog redproc,openoff,erroff,path |
{ |
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc |
local run_fileinfo, run_filepath, param |
local getmesloop, loox, mred, mkey, mbutton, mgetmes |
local dlg_is_work, ready, procinfo |
; |
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
; |
cld |
;; mov esi,path |
mov edi,path |
mov eax,0 |
mov ecx,200 |
rep stosb |
;mov [get_loops],0 |
mov [dlg_pid_get],0 |
; Get my PID in dec format 4 bytes |
mov eax,9 |
mov ebx,procinfo |
mov ecx,-1 |
int 0x40 |
; convert eax bin to param dec |
mov eax,dword [procinfo+30] ;offset of myPID |
mov edi,param+4-1 ;offset to 4 bytes |
mov ecx,4 |
mov ebx,10 |
cld |
new_d: |
xor edx,edx |
div ebx |
add dl,'0' |
mov [edi],dl |
dec edi |
loop new_d |
; wirite 1 byte space to param |
mov [param+4],byte 32 ;Space for next parametr |
; and 1 byte type of dialog to param |
mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog) |
; |
; STEP2 prepare IPC area for get messages |
; |
; prepare IPC area |
mov [path],dword 0 |
mov [path+4],dword 8 |
; define IPC memory |
mov eax,60 |
mov ebx,1 ; define IPC |
mov ecx,path ; offset of area |
mov edx,150 ; size 150 bytes |
int 0x40 |
; change wanted events list 7-bit IPC event |
mov eax,40 |
mov ebx,01000111b |
int 0x40 |
; |
; STEP 3 run SYSTEM XTREE with parameters |
; |
mov eax,58 |
mov ebx,run_fileinfo |
int 0x40 |
call redproc |
mov [get_loops],0 |
getmesloop: |
mov eax,23 |
mov ebx,50 ;0.5 sec |
int 0x40 |
cmp eax,1 |
je mred |
cmp eax,2 |
je mkey |
cmp eax,3 |
je mbutton |
cmp eax,7 |
je mgetmes |
; Get number of procces |
mov ebx,procinfo |
mov ecx,-1 |
mov eax,9 |
int 0x40 |
mov ebp,eax |
loox: |
mov eax,9 |
mov ebx,procinfo |
mov ecx,ebp |
int 0x40 |
mov eax,[DLGPID] |
cmp [procinfo+30],eax ;IF Dialog find |
je dlg_is_work ;jmp to dlg_is_work |
dec ebp |
jnz loox |
jmp erroff |
dlg_is_work: |
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated |
je erroff ;TESTODP2 terminated too |
cmp [dlg_pid_get],dword 1 |
je getmesloop |
inc [get_loops] |
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
jae erroff |
jmp getmesloop |
mred: |
call redproc |
jmp getmesloop |
mkey: |
mov eax,2 |
int 0x40 ; read (eax=2) |
jmp getmesloop |
mbutton: |
mov eax,17 ; get id |
int 0x40 |
cmp ah,1 ; button id=1 ? |
jne getmesloop |
mov eax,-1 ; close this program |
int 0x40 |
mgetmes: |
; If dlg_pid_get then second message get jmp to still |
cmp [dlg_pid_get],dword 1 |
je ready |
; First message is number of PID SYSXTREE dialog |
; convert PID dec to PID bin |
movzx eax,byte [path+16] |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+1] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+2] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+3] |
add eax,ebx |
sub eax,48 |
mov [DLGPID],eax |
; Claear and prepare IPC area for next message |
mov [path],dword 0 |
mov [path+4],dword 8 |
mov [path+8],dword 0 |
mov [path+12],dword 0 |
mov [path+16],dword 0 |
; Set dlg_pid_get for get next message |
mov [dlg_pid_get],dword 1 |
call redproc ;show DLG_PID |
jmp getmesloop |
ready: |
; |
; The second message get |
; Second message is 100 bytes path to SAVE/OPEN file |
; shl path string on 16 bytes |
; |
cld |
mov esi,path+16 |
mov edi,path |
mov ecx,200 |
rep movsb |
mov [edi],byte 0 |
jmp openoff |
; DATA AREA |
get_loops dd 0 |
dlg_pid_get dd 0 |
DLGPID dd 0 |
param: |
dd 0 ; My dec PID |
dd 0,0 ; Type of dialog |
run_fileinfo: |
dd 16 |
dd 0 |
dd param |
dd 0 |
dd procinfo |
;run_filepath: |
db '/RD/1/SYSXTREE',0 |
procinfo: |
times 1024 db 0 |
} |
; RANDOM - generate random count (small) |
; (SYNTAX) RANDOM MaxCount,OutArgument |
; (SAMPLE) RANDOM 10000,eax |
; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations |
randomuse = 0 |
macro random arg1,arg2 |
{ |
local rxproc |
randomuse = randomuse + 1 |
jmp rxproc |
if defined randomuse & randomuse = 1 |
randomproc: |
jmp rnj |
rsx1 dw 0x4321 |
rsx2 dw 0x1234 |
rnj: |
; mov eax,arg1 |
push bx |
push cx |
push dx |
push si |
push di |
mov cx,ax |
mov ax,word ptr rsx1 |
mov bx,word ptr rsx2 |
mov si,ax |
mov di,bx |
mov dl,ah |
mov ah,al |
mov al,bh |
mov bh,bl |
xor bl,bl |
rcr dl,1 |
rcr ax,1 |
rcr bx,1 |
add bx,di |
adc ax,si |
add bx,0x62e9 |
adc ax,0x3619 |
mov word ptr rsx1,bx |
mov word ptr rsx2,ax |
xor dx,dx |
cmp ax,0 |
je nodiv |
cmp cx,0 |
je nodiv |
div cx |
nodiv: |
mov ax,dx |
pop di |
pop si |
pop dx |
pop cx |
pop bx |
and eax,0000ffffh |
; mov arg2,0 |
; mov arg2,eax |
ret |
end if |
rxproc: |
mov eax,arg1 |
call randomproc |
mov arg2,eax |
} |
macro scank |
{ |
mov eax,10 |
int 0x40 |
} |
macro putpix x,y,color |
{ |
mov ebx,x |
mov ecx,y |
mov edx,color |
mov eax,1 |
int 0x40 |
} |
macro puttxt x,y,offs,size,color |
{ |
; mov ebx,x |
; shl ebx,16 |
; add ebx,y |
words2reg ebx,x,y |
dword2reg ecx,color |
dword2reg edx,offs |
dword2reg esi,size |
; mov ecx,color |
; mov edx,offs |
; mov esi,size |
mov eax,4 |
int 0x40 |
} |
macro outcount data, x, y, color, numtype |
{ |
mov ecx,data |
mov ebx,numtype |
mov bl,0 |
; mov edx,x*65536+y |
words2reg edx,x,y |
mov esi,color |
mov eax,47 |
int 0x40 |
} |
; SCEVENT - Scan event |
macro scevent red,key,but |
{ |
mov eax,11 |
int 0x40 |
dec eax |
jz red |
dec eax |
jz key |
dec eax |
jz but |
} |
; WTEVENT - Wait event |
macro wtevent red,key,but |
{ |
mov eax,10 |
int 0x40 |
dec eax |
jz red |
dec eax |
jz key |
dec eax |
jz but |
} |
; TIMEEVENT - Wite for event with timeout |
macro timeevent xfps,noevent,red,key,but |
{ |
mov eax,23 |
mov ebx,xfps |
int 0x40 |
cmp eax,0 |
je noevent |
dec eax |
jz red |
dec eax |
jz key |
dec eax |
jz but |
} |
; CLOSE - Close program |
macro close |
{ |
mov eax,-1 |
int 0x40 |
} |
; DELAY - Create delay 1/100 sec |
; (SYNTAX) Delay time |
; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec |
macro delay arg1 |
{ |
mov eax,5 |
mov ebx,arg1 |
int 0x40 |
} |
; WINDOW - Draw window |
; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color |
; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned |
macro window arg1,arg2,arg3,arg4,arg5 |
{ |
; mov ebx,arg1*65536+arg3 |
; mov ecx,arg2*65536+arg4 |
words2reg ebx,arg1,arg3 |
words2reg ecx,arg2,arg4 |
mov edx,arg5 |
mov eax,0 |
int 0x40 |
} |
macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7 |
{ |
; mov ebx,arg1*65536+arg3 |
; mov ecx,arg2*65536+arg4 |
words2reg ebx,arg1,arg3 |
words2reg ecx,arg2,arg4 |
mov edx,arg5 |
mov esi,arg6 |
mov edi,arg7 |
mov eax,0 |
int 0x40 |
} |
; STARTWD - Start of window draw |
macro startwd |
{ |
mov eax,12 |
mov ebx,1 |
int 0x40 |
} |
; ENDWD - End window draw |
macro endwd |
{ |
mov eax,12 |
mov ebx,2 |
int 0x40 |
} |
; LABEL - Put text to frame |
; (SYNTAX) LABEL Xstart,Ystart,'Text',Color |
; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big |
macro putlabel arg1,arg2,arg3,arg4 |
{ |
local asd,lab |
jmp asd |
lab db arg3 ;arg label |
asd: |
; mov ebx,arg1 ;arg1=y arg2=x |
; shl ebx,16 |
; add ebx,arg2 |
words2reg ebx,arg1,arg2 |
dword2reg ecx,arg4 |
mov edx,lab |
mov esi,asd-lab ;calc size |
mov eax,4 |
int 0x40 |
} |
;Key's |
key_Up equ 178 |
key_Down equ 177 |
key_Right equ 179 |
key_Left equ 176 |
key_Esc equ 27 |
key_Space equ 32 |
key_Enter equ 13 |
key_Bspace equ 8 |
key_F1 equ 50 |
key_F2 equ 51 |
key_F3 equ 52 |
key_F4 equ 53 |
key_F5 equ 54 |
key_F6 equ 55 |
key_F7 equ 56 |
key_F8 equ 57 |
key_F9 equ 48 |
key_F10 equ 49 |
key_F11 equ 68 |
key_F12 equ 255 |
key_Home equ 180 |
key_End equ 181 |
key_PgUp equ 184 |
key_PgDown equ 183 |
;Attributes |
;Window Attributes |
window_Skinned equ 0x03000000 |
window_Type2 equ 0x02000000 |
window_Type1 equ 0x00000000 |
window_Reserve equ 0x01000000 |
;Font Attributes |
font_Big equ 0x10000000 |
;Colors |
cl_White equ 0x00ffffff |
cl_Black equ 0x00000000 |
cl_Grey equ 0x00888888 |
cl_Red equ 0x00ff0000 |
cl_Lime equ 0x0000ff00 |
cl_Green equ 0x0000af00 |
cl_Blue equ 0x000000ff |
cl_Purple equ 0x008080ff |
cl_Violet equ 0x008040ff |
cl_Cyan equ 0x0040e0ff |
/programs/other/tinypad2/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm tinypad2.asm tinypad2 |
@pause |
/programs/other/tinypad2/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm tinypad2.asm tinypad2 |
@pause |
/programs/other/tinypad2/trunk/dialogs1.inc |
---|
0,0 → 1,597 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; ; |
; DIALOGS1.INC ; |
; ; |
; COMPILE WITH FASM for MENUET ; |
; ; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
menus dd 3 ; number of menus |
m_x dd 0x5 ; x start |
m_y dd 20 ; y start |
m_xs dd 290 ; x size |
m_ys dd 14 ; y size |
g_stack dd 0xf000 ; thread stack - required |
menu:; AB C D E F G |
db '*D FILE +Save File +Load File +- +Quit ' |
db '*B EDIT +Copy +Paste ' |
db '*B HELP +Setup +About.. ' |
db '@' ; end mark |
; A : Data type '*' -> New menu , '+' -> menu selection |
; B : Number of selections in menu (A+) |
; C : Menu header text |
; D-G : Menu selection text |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; |
; DATA BELOW IS FOR DIALOGS1.INC INTERNALS |
menu_action dd '----' |
window_on db 0 |
g_n dd -1 |
g_x dd 0x0 |
g_t dd 0x0 |
g_1 dd 0x0 |
g_l dd 0x0 |
closet db 0 |
table: times 1024 db 0 |
last_mouse dd 0x0 |
mo_x dd 0x0 |
mo_y dd 0x0 |
check_mouse: |
pusha |
cmp [window_on],1 |
je no_open |
mov eax,37 |
mov ebx,2 |
int 0x40 |
cmp [window_on],0 |
jne openw2 |
cmp eax,0 |
je no_open |
openw2: |
waitformouse: |
mov eax,23 |
mov ebx,2 |
int 0x40 |
cmp eax,0 |
jne no_open |
mov eax,37 |
mov ebx,2 |
int 0x40 |
cmp eax,0 |
jne waitformouse |
mov eax,37 |
mov ebx,1 |
int 0x40 |
mov esi,eax |
shr eax,16 |
xor edx,edx |
mov ebx,50 |
div ebx |
mov edx,eax |
cmp edx,[g_n] |
je no_open |
cmp edx,[menus] |
jge no_open |
mov eax,esi |
and eax,0xffff |
mov ebx,[m_y] |
cmp eax,ebx |
jbe no_open |
add ebx,[m_ys] |
cmp eax,ebx |
jge no_open |
cmp [window_on],0 |
je noww |
mov [closet],1 |
mov ecx,100 |
waitm: |
mov eax,5 |
mov ebx,1 |
int 0x40 |
dec ecx |
jz no_open |
cmp [window_on],0 |
jne waitm |
noww: |
mov eax,edx |
jmp cll |
no_open: |
mov [last_mouse],esi |
popa |
ret |
cll: |
mov [window_on],2 |
mov [g_n],eax |
mov [g_x],96 |
mov [g_t],0 |
mov [g_1],1 |
mov eax,9 |
mov ebx,table |
mov ecx,-1 |
int 0x40 |
mov eax,[table+34] |
mov [mo_x],eax |
mov eax,[table+38] |
mov [mo_y],eax |
mov eax,51 |
mov ebx,1 |
mov ecx,alert_entry |
mov edx,[g_stack] |
int 0x40 |
mov [esp+28],dword 0 ; clear button entry |
mov [menu_action],'MD ' |
check_gr: |
popa |
ret |
draw_menu: |
mov eax,9 |
mov ebx,table |
mov ecx,-1 |
int 0x40 |
cmp [table+46],dword 30 |
jb drmr |
mov eax,13 ; white background |
mov ebx,[m_x] |
shl ebx,16 |
add ebx,[m_xs] |
inc ebx |
mov ecx,[m_y] |
shl ecx,16 |
add ecx,[m_ys] |
mov edx,0xf0f8ff |
int 0x40 |
mov eax,38 ; egde lines |
mov ebx,[m_x] |
shl ebx,16 |
add ebx,[m_x] |
add ebx,[m_xs] |
mov ecx,[m_y] |
shl ecx,16 |
add ecx,[m_y] |
mov edx,0x000000 |
int 0x40 |
mov eax,38 |
mov ecx,[m_y] |
add ecx,[m_ys] |
shl ecx,16 |
add ecx,[m_y] |
add ecx,[m_ys] |
int 0x40 |
mov esi,menu-1 |
mov edi,[m_x] |
mov ebp,1 |
new_menu: |
inc esi |
cmp [esi],byte '*' |
jne drmnl1 |
push esi |
mov eax,4 |
mov ebx,edi |
shl ebx,16 |
add ebx,[m_y] |
add ebx,0x00050004 |
mov ecx,0x000000 |
mov edx,esi |
add edx,3 |
mov esi,12 |
int 0x40 ; draw text |
pop esi |
add esi,2 |
add edi,50 |
inc ebp |
drmnl1: |
cmp [esi],byte '@' |
jne new_menu |
drmr: |
ret |
alert_box: |
; eax : x size - min 200 |
; ebx : pointer to ASCIIZ - max 128 character text |
; ecx : button 1 id ( OK or YES ) |
; edx : button 2 id or zero ( NO ) |
cmp [window_on],0 |
jne alert_box_return |
mov [window_on],1 |
cmp eax,100 |
jg size_ok |
mov eax,100 |
size_ok: |
mov [g_x],eax |
mov [g_t],ebx |
mov [g_1],ecx |
mov ecx,0 |
new_search: |
cmp [ebx],byte 0 |
je found_len |
inc ebx |
inc ecx |
cmp ecx,128 |
jbe new_search |
found_len: |
mov [g_l],ecx |
mov eax,51 |
mov ebx,1 |
mov ecx,alert_entry |
mov edx,[g_stack] |
int 0x40 |
mov [menu_action],'MA ' |
alert_box_return: |
ret |
alert_entry: |
call alert_draw_window |
alert_still: |
mov eax,23 ; wait here for event |
mov ebx,1 |
int 0x40 |
cmp eax,1 ; redraw request ? |
je alert_red |
cmp eax,2 ; key in buffer ? |
je alert_key |
cmp eax,3 ; button in buffer ? |
je alert_button |
cmp [closet],0 |
jne ccc |
mov eax,9 |
mov ebx,table |
mov ecx,-1 |
int 0x40 |
cmp ax,[table+4] |
je no_close |
ccc: |
mov [closet],0 |
mov [g_n],-1 |
mov [menu_action],'----' |
mov [window_on],0 |
mov eax,-1 |
int 0x40 |
no_close: |
jmp alert_still |
alert_red: ; redraw |
call alert_draw_window |
jmp alert_still |
alert_key: ; key |
mov eax,2 ; just read it and ignore |
int 0x40 |
jmp alert_still |
alert_button: ; button |
mov eax,17 ; get id |
int 0x40 |
shr eax,8 |
cmp eax,3 |
jg no_action1 |
dec eax |
shl eax,2 |
mov eax,dword [eax+rtext] |
mov [menu_action],eax |
jmp action_done |
no_action1: |
sub eax,16 |
add eax,65 |
shl eax,8 |
mov ebx,[g_n] |
add ebx,65 |
add eax,ebx |
mov [menu_action],eax |
action_done: |
mov [closet],0 |
mov [g_n],-1 |
mov [window_on],0 |
mov eax,-1 ; close this program |
int 0x40 |
rtext db 'NO YES OK ' |
jmp alert_still |
; ********************************************* |
; ******* WINDOW DEFINITIONS AND DRAW ******** |
; ********************************************* |
alert_draw_window: |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,1 ; 1, start of draw |
int 0x40 |
cmp [window_on],2 |
jne no_win_type_2 |
mov edx,menu-1 |
mov ecx,[g_n] |
add ecx,1 |
find_menu: |
inc edx |
cmp [edx],byte '*' |
je menu_loop |
jmp find_menu |
menu_loop: |
loop find_menu |
movzx ebp,byte [edx+1] |
sub ebp,64 |
push edx |
; DRAW WINDOW |
mov eax,0 ; function 0 : define and draw window |
mov ebx,[g_n] |
imul ebx,50 |
add ebx,[mo_x] |
add ebx,[m_x] |
shl ebx,16 |
add ebx,[g_x] |
mov ecx,[mo_y] |
add ecx,[m_y] |
add ecx,[m_ys] |
shl ecx,16 |
mov edx,14 |
imul edx,ebp |
add edx,7 |
add ecx,edx |
mov edx,0x00ffffff ; color of work area RRGGBB,8->color gl |
mov esi,0x00ffffff ; color of grab bar RRGGBB,8->color gl |
mov edi,0x000000cc ; color of frames RRGGBB |
int 0x40 |
pop edx |
mov ebx,5*65536+7 ; draw info text with function 4 |
mov ecx,0x10000000 |
mov esi,12 |
mov ebp,16 |
no_d_found: |
inc edx |
cmp [edx],byte '*' |
je d_drawed |
cmp [edx],byte '@' |
je d_drawed |
cmp [edx],byte '+' |
jne no_d_found |
inc edx |
pusha ; draw button |
mov eax,8 |
mov ecx,ebx |
mov ebx,[g_x] |
add ebx,0x0000fffe |
shl ecx,16 |
add ecx,0xfffc0000+14 |
mov edx,0x40000000 |
add edx,ebp |
mov esi,0 |
int 0x40 |
popa |
mov eax,4 ; draw text |
int 0x40 |
inc ebp |
add ebx,14 |
jmp no_d_found |
d_drawed: |
no_win_type_2: |
cmp [window_on],1 |
jne no_win_1 |
mov eax,14 ; to middle of screen |
int 0x40 |
mov ecx,eax |
and ecx,0xffff |
shr ecx,1 |
shr eax,1 |
mov ebx,[g_x] |
shr ebx,1 |
shl ebx,16 |
sub eax,ebx |
mov ebx,eax |
mov eax,0 ; function 0 : define and draw window |
mov bx,word [g_x] |
sub ecx,80 |
shl ecx,16 |
mov cx,110 ; [y start] *65536 + [y size] |
mov edx,0x02ffffff ; color of work area RRGGBB,8->color gl |
mov esi,0x80d05050 ; color of grab bar RRGGBB,8->color gl |
mov edi,0x00d05050 ; color of frames RRGGBB |
int 0x40 |
mov eax,4 ; label |
mov ebx,8*65536+8 |
mov ecx,0x10ddeeff |
mov edx,alert_labelt1 |
mov esi,alert_label1len-alert_labelt1 |
int 0x40 |
mov eax,4 |
mov ebx,10*65536+43 |
mov ecx,0x10000000 |
mov edx,[g_t] |
mov esi,[g_l] |
int 0x40 |
cmp [g_1],1 |
jne gadgets_no_1 |
mov eax,8 |
mov ebx,[g_x] |
sub ebx,100 |
shr ebx,1 |
shl ebx,16 |
add ebx,30*65536+40 |
mov ecx,75*65536+16 |
mov edx,3 |
mov esi,0x446688 |
int 0x40 |
mov eax,4 |
mov ebx,[g_x] |
sub ebx,100 |
shr ebx,1 |
shl ebx,16 |
add ebx,31*65536+80 |
mov ecx,0x10ffffff |
mov edx,alert_t2 |
mov esi,alert_t2len-alert_t2 |
int 0x40 |
gadgets_no_1: |
cmp [g_1],2 |
jne gadgets_no_2 |
mov eax,8 |
mov ebx,[g_x] |
sub ebx,100 |
shr ebx,1 |
shl ebx,16 |
add ebx,0*65536+40 |
mov ecx,75*65536+16 |
mov edx,1 |
mov esi,0x446688 |
int 0x40 |
mov eax,8 |
mov ebx,[g_x] |
sub ebx,100 |
shr ebx,1 |
shl ebx,16 |
add ebx,57*65536+40 |
mov ecx,75*65536+16 |
mov edx,2 |
mov esi,0x446688 |
int 0x40 |
mov eax,4 |
mov ebx,[g_x] |
sub ebx,100 |
shr ebx,1 |
shl ebx,16 |
add ebx,1*65536+80 |
mov ecx,0x10ffffff |
mov edx,alert_t1 |
mov esi,alert_t1len-alert_t1 |
int 0x40 |
gadgets_no_2: |
no_win_1: |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,2 ; 2, end of draw |
int 0x40 |
ret |
; DATA AREA |
alert_t1: |
db ' No Yes' |
alert_t1len: |
alert_t2: |
db ' OK' |
alert_t2len: |
alert_labelt1: |
db 'ALERT' |
alert_label1len: |
/programs/other/tinypad2/trunk/macros.inc |
---|
0,0 → 1,266 |
; 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 |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a { ; mike.dld |
if ~a eq |
mov reg,a |
end if |
} |
macro mcall a,b,c,d,e,f { ; mike.dld |
__mov eax,a |
__mov ebx,b |
__mov ecx,c |
__mov edx,d |
__mov esi,e |
__mov edi,f |
int 0x40 |
} |
; language for programs |
lang fix ru ; ru en fr ge fi |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
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 __regs) & (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 |
} |
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/tinypad2/trunk/scroll.inc |
---|
0,0 → 1,440 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ; |
;; Scroll.inc ; |
;; ; |
;; Vertical Scroll Bar Example for MenuetOS ; |
;; ; |
;; Version 0.2 27 February 2005 ; |
;; ; |
;; ; |
;; GNU GENERAL PUBLIC LICENSE ; |
;; Version 2, June 1991 ; |
;; ; |
;; Copyright 2005 Jason Delozier, ; |
;; cordata51@hotmail.com ; |
;; ; |
;; See file COPYING for details ; |
;; ; |
;; Updates: ; |
;; - FPU not longer used for calculations -Feb 27, 2005 ; |
;; ; |
;; ; |
;; TODO: ; |
;; - Create Message Handler and only allow runtime arguments ; |
;; to be processed through the message handler ; |
;; - Remove all local varibles and only allow working varible to ; |
;; reside in scroll bar structure. ; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;***************************************************************************** |
;* |
;* VScroll Structure Equates |
;* |
;***************************************************************************** |
VScroll_width equ 0 |
VScroll_x equ 2 |
VScroll_height equ 4 |
VScroll_y equ 6 |
VScroll_min equ 8 |
VScroll_max equ 12 |
VScroll_current equ 16 |
VScroll_s_change equ 20 |
VScroll_b_change equ 24 |
;Example VScroll Structure |
;VScroll_1: |
; dw 16 ;width +0 |
; dw 100 ;x +2 |
; dw 200 ;height +4 |
; dw 40 ;y +6 |
; dd 0 ;min +8 |
; dd 1000;max +12 |
; dd 1 ;current +16 |
; dd 1 ;small change +20 |
; dd 10 ;big change +24 |
VScroll_Min_Height dw 16 ;scroll box |
Vscroll_Fixed_Height dw 16 ;height of scroll buttons (up and down) |
;************************************** |
;* |
;* Mouse Over VScroll |
;* |
;************************************** |
vsm1 dd 0 |
vstoff dd 0 |
VScroll_mouse_over: |
cmp [mouseb], 1 |
je VScroll_Mouse_Has_Mouse |
cmp [mouseb], 0 |
jne VScroll_mouse_over_done2 |
mov [vsm1], 0 |
jmp VScroll_mouse_over_done2 |
VScroll_Mouse_Has_Mouse: |
push ecx |
mov ecx, [vsm1] |
shl ecx,2 |
call dword [VScroll_Mouse_Jumptable+ecx] |
VScroll_mouse_over_done: |
pop ecx |
VScroll_mouse_over_done2: |
ret |
VScroll_Mouse_Jumptable: |
dd VScroll_Mouse_Find |
dd VScroll_Mouse_On_Up |
dd VScroll_Mouse_On_Down |
dd VScroll_Mouse_Above_Thumb |
dd VScroll_Mouse_Below_Thumb |
dd VScroll_Mouse_On_Thumb |
VScroll_Mouse_Find: |
inc ecx |
call dword [VScroll_Mouse_Jumptable+ecx*4] |
cmp [vsm1], 0 |
jne VScroll_mouse_over_done2 |
cmp ecx, 5 |
je VScroll_mouse_over_done2 |
jmp VScroll_Mouse_Find |
;************************************** |
;Is Mouse at Up button |
VScroll_Mouse_On_Up: |
push eax |
movzx eax, word [ebp+VScroll_y] |
add ax, word [Vscroll_Fixed_Height] |
cmp [mousey], ax |
pop eax |
ja VScroll_Mouse_On_Up2 |
mov [vsm1], 1 |
call VScroll_Small_Up |
VScroll_Mouse_On_Up2: |
ret |
;************************************** |
;Is Mouse at Down button |
VScroll_Mouse_On_Down: |
push eax |
movzx eax,word [ebp+VScroll_y] |
add ax, word [ebp+VScroll_height] |
sub ax, word [Vscroll_Fixed_Height] |
cmp [mousey], ax |
pop eax |
jb VScroll_Mouse_On_Down2 |
mov [vsm1], 2 |
call VScroll_Small_Down |
VScroll_Mouse_On_Down2: |
ret |
;************************************** |
;Is Mouse above Scroll Thumb |
VScroll_Mouse_Above_Thumb: |
push eax |
push ecx |
push edx |
call Vscroll_SBox_Area |
add cx, word [ebp+VScroll_y] |
add cx, word [Vscroll_Fixed_Height] ;plus height of scroll button |
cmp cx, [mousey] |
pop edx |
pop ecx |
pop eax |
jb VScroll_Mouse_Above_Thumb2 |
mov [vsm1], 3 |
call VScroll_Big_Up |
VScroll_Mouse_Above_Thumb2: |
ret |
;************************************** |
;Is Mouse below scroll thumb |
VScroll_Mouse_Below_Thumb: |
push eax |
push ecx |
push edx |
call Vscroll_SBox_Area |
add cx, word [ebp+VScroll_y] |
add cx, word [Vscroll_Fixed_Height] ;plus height of scroll button |
add cx, ax |
cmp cx, [mousey] |
pop edx |
pop ecx |
pop eax |
ja VScroll_Mouse_Below_Thumb2 |
mov [vsm1], 4 |
call VScroll_Big_Down |
VScroll_Mouse_Below_Thumb2: |
ret |
;************************************** |
;Mouse is on Scroll Thumb |
VScroll_Mouse_On_Thumb: |
pusha |
cmp [vsm1], 5 ;first time moving since we clicked? |
je VScroll_Mouse_On_Thumb1 ;if not jump.. we already have offset |
mov [vsm1], 5 ;determine offset between mouse pointer and top of thumb |
call Vscroll_SBox_Area ;get top of thumb coordinate |
add cx, word [ebp+VScroll_y] ;make screen coordinate |
add cx, word [Vscroll_Fixed_Height] ;plus height of scroll button and top |
movzx esi,word [mousey] ;get mouse position |
sub esi, ecx ;make offset between top of thumb |
mov [vstoff], esi ;and mouse pointer then save it |
VScroll_Mouse_On_Thumb1: ; |
movzx esi, [mousey] ;get mouse y value |
sub si, word [ebp+VScroll_y] ;get y starting value of scroll bar |
sub si, [Vscroll_Fixed_Height] |
sub esi, [vstoff] ; |
call Vscroll_SBox_Area ; |
VScroll_Mouse_On_Thumb2: ; |
cmp [ebp+VScroll_current], edx ;only redraw if change occured |
je VScroll_Mouse_On_Thumb3 ; |
mov [ebp+VScroll_current], edx ;new current value |
call drawvscrolla ;redraw scroll background and thumb |
VScroll_Mouse_On_Thumb3: ; |
popa ; |
ret |
;************************************** |
;***************************************************************************** |
;* |
;* Vscroll_SBox_Area |
;* |
;* Purpose: To determine the area of the Scroll Bar Thumb and the current |
;* value of scroll based on top pixel of thumb. |
;* |
;* Inputs: |
;* EBP - Structure of scroll bar |
;* ESI - Top of Thumb - optional |
;* |
;* Outputs: |
;* EAX - Thumb Height |
;* ECX - Top of thumb |
;* EDX - Current Value based on top pixel of thumb. Valid when ESI |
;* is given as input. |
;* |
;* This procedure is divided up into 5 specific functions. |
;* 1. ((Vmax-VMin)/Small Change)= Total Changes |
;* 2. Height - (2* Fixed Button Height) = Total Pixels |
;* 3. Total Pixels - Total Changes = Thumb Height (must be >= 16) |
;* Minimum Height of 16 is varible [VScroll_Min_Height] |
;* 4. (((Tot Pixels - Thumb Height)* Current)/Max-min)=Top Pixel of Thumb |
;* 5. ((Mouse Top * (max-Min))/(Total Pix - Thumb Height)) = Current |
;* Step 5 is only valid if ESI is supplied as an input. |
;* |
;* |
;***************************************************************************** |
Vscroll_SBox_Area: |
push ebx |
push esi |
push edi |
;Step 1. Determine Total Changes |
mov eax, dword [ebp+VScroll_max] ;get max scroll |
sub eax, dword [ebp+VScroll_min] ;sub minmum scroll for total scro |
xor edx,edx |
push eax |
div dword [ebp+VScroll_s_change] ; |
;eax = total changes ((max-min)/Small Change) |
;Step 2. Determine Total Pixels |
movzx ecx, word [ebp+VScroll_height] ;height of entire scroll bar |
mov bx, word [Vscroll_Fixed_Height] ;minus height of both scroll button |
shl bx, 1 |
sub cx, bx |
push ecx |
;ecx = total pixels (Total Height - (2*Fixed Button Height) |
;Step 3. Determine Thumb Height |
cmp ecx, eax |
jbe vs1 |
sub ecx, eax |
cmp cx, word [VScroll_Min_Height] |
jb vs1 |
jmp vs2 |
vs1: |
movzx ecx, word [VScroll_Min_Height] |
vs2: |
;ecx = Thumb Height (Total Pixels - Total Changes) >=16 |
;Step 4. Determine Top Pixel of Thumb |
pop edi ;Total Pixels |
sub edi, ecx ; |
;edi = Total Pixels - thumb Height |
mov eax, edi ; |
mul dword [ebp+VScroll_current] ;get current scroll value |
pop ebx ;max scroll |
push ecx ; |
div ebx ; |
mov ecx, eax ; |
;ecx = top pixel of thumb |
;Step 5. Determine Current Value based on Mouse Position |
cmp si,0 |
jge vss4 |
mov eax, dword [ebp+VScroll_min] |
jmp vsdone1 |
vss4: |
cmp esi, edi |
jbe vss3 |
mov eax, dword [ebp+VScroll_max] |
jmp vsdone1 |
vss3: |
mov eax,ebx ;max scroll |
mul esi ;Top Pixel of mouse |
div edi ;Total Pixels - Thumb Height |
;eax = Current Value |
vsdone1: |
mov edx, eax ;Current Value |
pop eax ;Thumb Height |
pop edi |
pop esi |
pop ebx |
ret |
;***************************************************************************** |
;* |
;***************************************************************************** |
;ebp is structure |
drawvscroll: |
pusha |
;up button |
mov eax, 13 ;button system function |
mov edx,0x00777777 ;0x6677cc ;color |
mov ebx, [ebp+VScroll_width] ;x-start/width |
mov cx, word [ebp+VScroll_y] ;get bottom of scroll bar |
shl ecx, 16 |
mov cx, [Vscroll_Fixed_Height] ;fixed height |
int 0x40 |
;down button |
mov ebx, [ebp+VScroll_width] ;x-start/width |
mov cx, word [ebp+VScroll_y] ;get bottom of scroll bar |
add cx, word [ebp+VScroll_height] ; |
sub cx, [Vscroll_Fixed_Height] ;y-start is 12 pixel from bottom |
shl ecx, 16 ; |
mov cx, [Vscroll_Fixed_Height] ;fixed height |
int 0x40 |
;------- 'ASCL.INC' needs to be included to use this -- |
putlabel 493,46,'',cl_Black |
putlabel 493,372,'',cl_Black |
;------------------------------------------------------ |
popa |
drawvscrolla: |
pusha |
mov eax, 13 ;Draw Scroll Box Background |
mov edx, 0x00999999;0 ;color |
push edx |
movzx edx, word [Vscroll_Fixed_Height] |
mov ebx, [ebp+VScroll_width] ;x-start/width |
movzx ecx,word [ebp+VScroll_y] ;y-start |
add ecx, edx ;add fixed height button |
shl ecx, 16 ;do height next |
mov cx,word [ebp+VScroll_height] ;y-start |
sub cx, dx ;subtract fixed height of up button |
sub cx, dx ;subtract fixed height of down button |
pop edx |
int 0x40 ;tell system to draw it |
;determine height of scroll box (thumb) |
call Vscroll_SBox_Area |
add cx, [ebp+VScroll_y] |
add cx, 16 |
shl ecx, 16 |
mov cx, ax |
mov eax, 13 ;draw scroll box |
mov ebx, [ebp+VScroll_width] ;x-start/width |
mov edx, 0x00bbbbbb ;0x999999 |
int 0x40 |
;call Draw_Scroll_info |
popa |
ret |
;***************************************************************************** |
;***************************************************************************** |
;* VScroll_Big_Up |
;* VScroll_Small_Up |
;***************************************************************************** |
;need to update for signed values |
VScroll_Big_Up: |
push eax |
push ebx |
mov eax, dword [ebp+VScroll_b_change] |
jmp VScroll_Up |
VScroll_Small_Up: |
push eax |
push ebx |
mov eax, dword [ebp+VScroll_s_change] |
VScroll_Up: |
mov ebx, dword [ebp+VScroll_min] ;get minimum value |
cmp [ebp+VScroll_current], ebx ;are we at minimum already? |
je VScroll_Up_exit ;if so leave |
sub [ebp+VScroll_current], eax ; |
jnc VScroll_Up_done |
mov [ebp+VScroll_current], ebx |
VScroll_Up_done: |
cmp [ebp+VScroll_current], ebx ;if current is greater then max |
jae VScroll_Up_done2 |
mov [ebp+VScroll_current], ebx |
VScroll_Up_done2: |
;redraw |
call drawvscroll ;temp? |
VScroll_Up_exit: |
pop ebx |
pop eax |
ret |
;***************************************************************************** |
;***************************************************************************** |
;* VScroll_Big_Down |
;* VScroll_Small_Down |
;***************************************************************************** |
;need to update for signed values |
VScroll_Big_Down: |
push eax |
push ebx |
mov eax, dword [ebp+VScroll_b_change];get big change value |
jmp VScroll_Down |
VScroll_Small_Down: |
push eax |
push ebx |
mov eax, dword [ebp+VScroll_s_change];get small change value |
VScroll_Down: |
mov ebx, dword [ebp+VScroll_max] ;get maximum scroll value |
cmp [ebp+VScroll_current], ebx ;are we at max already? |
je VScroll_Down_exit ;if so leave |
add [ebp+VScroll_current], eax ;add change to current |
jno VScroll_Down_done ;dont go beyond bounds of register |
mov [ebp+VScroll_current], ebx ;if we did then we at max |
VScroll_Down_done: ; |
cmp [ebp+VScroll_current], ebx ;if current is greater then max |
jbe VScroll_Down_done2 ; |
mov [ebp+VScroll_current], ebx ;then we at max |
VScroll_Down_done2: ; |
;redraw |
call drawvscroll ;temp? |
VScroll_Down_exit: |
pop ebx |
pop eax |
ret |
;***************************************************************************** |
/programs/other/tinypad2/trunk/tinypad2.asm |
---|
0,0 → 1,4001 |
; SYSTEM HAEDER: |
use32 |
org 0x0 |
db 'MENUET01' ; identifier |
dd 0x01 ; version |
dd START ; pointer to start |
dd TINYPAD_END ; size of file |
dd 0x300f00 ;0x500000; 0x3fff00;0x300000 ; size of memory |
dd 0xeff0 ;0x4fffff ;0x3ff000;0xeff0 ; esp |
dd I_PARAM ; parameters |
dd 0 ; reserved |
include 'lang.inc' |
include 'ascl.inc' |
include 'macros.inc' ; useful stuff |
include 'dialogs1.inc' |
include 'scroll.inc' |
;include 'debug.inc' |
purge mov ; SPEED |
;****************************************************************************** |
; INITIALIZING |
START: |
;debug_print_hex TINYPAD_END |
call mask_events |
cmp [I_PARAM],byte 0 |
jz noparams |
; parameters are at I_PARAM |
mov esi,I_PARAM |
mov edi,filename |
mov ecx,50 |
cld |
rep movsb |
mov edi,filename |
mov ecx,50 |
xor eax,eax |
repne scasb |
sub edi,filename |
dec edi |
mov [filename_len],edi |
jmp do_load_file |
noparams: |
jmp newfile |
;****************************************************************************** |
; MAIN LOOP |
still: |
call writepos ; write current position & number of strings |
call mouse_info |
mov eax,10 ; wait here until event |
int 0x40 |
cmp eax,1 |
je red |
cmp eax,2 |
je key |
cmp eax,3 |
je button |
cmp eax,6 |
je mouse |
jmp still |
;****************************************************************************** |
; ********************************* |
; * MOUSE * |
; ********************************* |
mouse: |
mov eax,37 ;mouse click |
mov ebx,2 |
int 0x40 |
cmp eax,0 |
je .leave_now |
;if exit window is on |
cmp [exit_wnd_on],1 |
jne @f |
mov [exit_wnd_on],0 |
jmp red |
;else |
@@: |
cmp eax,1 ;mouse 1 |
jne .leave_now |
mov eax,37 ;mouse position |
mov ebx,1 |
int 0x40 |
mov word[mouse_y],ax |
shr eax,16 |
mov word[mouse_x],ax |
cmp [mouse_x],7 |
jb .leave_now ;.leave_now ;if < |
cmp [mouse_x],485;487 |
ja .leave_now ;.leave_now ;if > |
cmp [mouse_y],45 |
jb .leave_now ;.leave_now ;if < |
cmp [mouse_y],342 ;345 |
ja .leave_now ;.leave_now ;if > |
call main_cursor_move |
.leave_now: |
jmp still |
; ********************************* |
; * BUTTON HANDLER * |
; ********************************* |
button: |
mov eax,17 |
int 0x40 |
;;;;;;;;;;;;;;;exit dialog box check;;;;;;;;;;;;; |
cmp ah,49 |
je save_and_exit |
cmp ah,48 |
je exit_now |
cmp ah,47 |
mov [exit_wnd_on],0 |
je red |
cmp ah,46 |
jne @f |
call save_file |
jmp newfile |
@@: |
cmp ah,45 |
je newfile |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;MENU CHECK;;;;;;;;;;;;;;;;;;;;;;; |
cmp ah,15 |
jne no_d_w |
call draw_window_for_dialogs |
jmp still |
no_d_w: |
cmp ah,97 |
je draw_win_menu_file |
cmp ah,98 |
je draw_win_menu_code |
cmp ah,96 |
je draw_win_menu_text |
cmp ah,95 |
je goto_string |
cmp ah,92 |
je search_window |
cmp ah,94 |
je red |
cmp ah,99 |
je help_wnd |
cmp ah,100 |
je new_pad_wnd |
cmp ah,101 |
je doyouwannasave |
cmp ah,102 |
jne nosavenow |
for_key_save: |
savedialog draw_window_for_dialogs,copy_fpath_s,saveerror,mypath |
nosavenow: |
cmp ah,103 |
jne noopennow |
for_key_open: |
opendialog draw_window_for_dialogs,copy_fpath,openerror,mypath |
noopennow: |
cmp ah,104 |
je exit |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
shr eax,8 |
cmp al,50 |
jne no_search |
; SEARCH { |
search: |
cmp [lines],1 ;something like bug fix |
je red ;still |
xor esi,esi |
mov edi,[post] |
add edi,80 |
imul ecx,[lines],80 |
sub ecx,edi ; ecx (loop counter) = lines*80-(post+80) |
news: |
push edi |
news2: |
; 1) LOAD BYTES |
mov al,[esi+search_string] |
mov bl,[edi+0x80000] |
; 2) COMPARE BYTES |
cmp al,bl |
je yes_char |
; 3) LETTER? |
cmp al,'A' |
jb notequal |
cmp al,'z' |
ja notequal |
; 4) A->a OR a->A |
cmp al,'a' |
jb @f |
add al,-32 |
jmp compare_bytes |
@@: |
cmp al,'Z' |
ja notequal |
add al,32 |
compare_bytes: |
cmp al,bl |
jne notequal |
yes_char: |
inc edi |
inc esi |
cmp esi,[search_len] |
jge sfound |
jmp news2 |
notequal: |
pop edi |
xor esi,esi |
inc edi |
loop news |
call string_not_found |
jmp still |
sfound: |
mov eax,edi |
cdq ; edx = 0; |
mov ebx,80 |
div ebx |
;;;;; imul eax,80 |
; lea eax,[eax+eax*4] ; eax *= 5; |
; shl eax,4 ; eax *= 16; |
; mov [post],eax |
mov [posy],0 |
;--------------- |
; mov ebx,80 |
; div ebx |
call goto_pos |
call draw_vertical_scroll |
jmp still |
; SEARCH } |
no_search: |
; TOOLBAR { |
cmp eax,10000 |
jb no_toolbar |
add eax,-10000 |
jne @f |
lbl_compile_file: |
mov [run_outfile],0 |
call start_fasm |
jmp still |
@@: |
dec eax |
jnz @f |
lbl_run_outfile: |
mov [run_outfile],1 |
call start_fasm |
jmp still |
@@: |
dec eax |
jnz @f |
call open_debug_board |
jmp still |
@@: |
dec eax |
jnz still |
call open_sysfuncs_txt |
jmp still |
; TOOLBAR } |
no_toolbar: |
cmp al,4 |
jne noid4 |
; LOAD_FILE { |
do_load_file: |
mov [modified],0 |
call empty_work_space |
cmp [filename],'/' |
jne @f |
call loadhdfile |
jmp .restorecursor |
@@: |
call loadfile1 |
.restorecursor: |
mov edi,0x78000 |
mov ecx,80*80/4 |
mov eax,0x01010101 |
cld |
rep stosd |
xor eax,eax |
mov [post],eax |
mov [posx],eax |
mov [posy],eax |
; enable color syntax for ASM and INC files: |
mov [asm_mode], 0 |
mov eax, [filename_len] |
add eax, filename |
cmp word [eax-3],'AS' |
jne @f |
cmp byte [eax-1],'M' |
jne @f |
mov [asm_mode], 1 |
jmp .nocol |
@@: |
cmp word [eax-3],'IN' |
jne @f |
cmp byte [eax-1],'C' |
jne @f |
mov [asm_mode], 1 |
@@: |
.nocol: |
; if the header is the same as the previous, |
; just redraw the text area |
; else redraw the window |
;------pos00=filename_len |
mov eax,[filename_len] |
mov [pos00],eax |
;------------------------- |
mov ecx, [filename_len] |
add ecx, 10 ; strlen(" - TINYPAD"); |
cmp ecx, [headlen] |
jne @f |
add ecx, -10 |
mov esi, filename ; strcmp(filename,header); |
mov edi, header |
rep cmpsb |
jne @f |
call drawfile |
call draw_window_for_dialogs ;redraw, because it's needed |
cmp [to_return],0 |
je still |
ret |
;jmp still |
@@: |
call set_title |
cmp [to_return],0 |
je still |
ret |
; jmp still |
; LOAD_FILE } |
noid4: |
cmp al, 2 |
jz yessave |
dec al ; close if butid == 0 |
jnz nosave |
; EXIT: |
exit: |
cmp [modified],0 |
je exit_now |
mov eax,55 ; beep |
mov ebx,eax |
mov esi,save_beep1 |
int 0x40 |
delay 4 |
mov eax,55 ; beep |
mov ebx,eax |
mov esi,save_beep2 |
int 0x40 |
;---------"EXIT" dialog box |
mov eax,13 |
mov ebx,150*65536+200 |
mov ecx,100*65536+70 |
mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512 |
int 0x40 |
mov eax,38 |
mov ebx,150*65536+350 |
mov ecx,100*65536+100 |
mov edx,cl_White |
int 0x40 |
mov eax,38 |
mov ebx,150*65536+350 |
mov ecx,170*65536+170 |
mov edx,cl_White |
int 0x40 |
mov eax,38 |
mov ebx,150*65536+150 |
mov ecx,100*65536+170 |
mov edx,cl_White |
int 0x40 |
mov eax,38 |
mov ebx,350*65536+350 |
mov ecx,100*65536+170 |
mov edx,cl_White |
int 0x40 |
putlabel 190,120,'®åà ¨âì ¤®ªã¬¥â?',cl_White |
drawlbut 170,140,30,15,' ',49,[sc.work_button],cl_White |
drawlbut 230,140,30,15,'¥â',48,[sc.work_button],cl_White |
drawlbut 290,140,45,15,'⬥ ',47,[sc.work_button],cl_White |
mov [exit_wnd_on],1 |
;---------------- |
jmp still |
exit_now: |
mov [MainWndClosed], 1 |
or eax, -1 |
int 0x40 |
save_and_exit: |
call save_file |
jmp exit_now |
; mov [MainWndClosed], 1 |
; or eax, -1 |
; int 0x40 |
; SAVE_FILE { |
yessave: |
call clear_screen |
call drawwindow |
call save_file |
; call clear_screen |
; call drawwindow |
mov [modified],0 |
jmp still |
; SAVE_FILE } |
nosave: |
inc al |
call read_string |
jmp still |
;********************************** |
;* REDRAW HANDLER * |
;********************************** |
red: |
; ¯¥à¥à¨á®¢ª ®ª |
call clear_screen |
call drawwindow |
jmp still |
;********************************** |
;* KEY HANDLER * |
;********************************** |
key: |
mov eax, 2 ; GET KEY |
int 0x40 |
cmp [exit_wnd_on],1 ;exit window is ON? |
jne no_exit_wnd ; no - goto other checks |
; cmp eax,13 ;enter - save n exit |
; je save_and_exit |
; cmp eax,173 ;ctrl+enter - exit |
; je exit_now |
mov [exit_wnd_on],0 ;other keys - cancel |
; call draw_window_for_dialogs |
jmp red ;redraw and still |
no_exit_wnd: |
shr eax, 8 |
; HELP_TEXT { |
cmp al, 210 ; Ctrl + F1 |
jne no_help_text |
help_wnd: |
call clear_screen |
call drawwindow |
mov eax, 51 |
mov ebx, 1 |
mov ecx, help_thread_start |
mov edx, 0xfff0 |
int 0x40 |
jmp still |
help_thread_start: |
call draw_help_wnd |
still_hw: |
cmp [MainWndClosed], 1 |
je exit_hw |
mov eax, 10 |
int 0x40 |
cmp eax, 1 |
je red_hw |
cmp eax, 2 |
je key_hw |
cmp eax, 3 |
je button_hw |
jmp still_hw |
red_hw: |
call draw_help_wnd |
jmp still_hw |
key_hw: |
; mov eax, 2 |
int 0x40 |
cmp ah, 27 |
jne still_hw |
button_hw: |
mov eax, 17 |
int 0x40 |
exit_hw: |
or eax, -1 |
int 0x40 |
; draw help window |
draw_help_wnd: |
mov eax, 12 |
mov ebx, 1 |
int 0x40 |
xor eax, eax |
mov ebx, 200 shl 16 + 320 |
mov ecx, 200 shl 16 + 260 |
mov edx, 0x03e0e0e0 ; work |
mov esi, [sc.grab] |
or esi, 0x80000000 ; grab |
mov edi, [sc.frame] ; frame |
int 0x40 |
mov eax, 4 |
mov ebx, 8 shl 16 + 8 |
mov ecx, 0xffffff |
mov edx, help_wnd_header |
mov esi, hlphead_len |
int 0x40 |
mov eax, 4 |
mov ebx, 8 shl 16 + 34 |
xor ecx, ecx |
mov esi, 51 |
mov edx, help_text |
.new_help_line: |
int 0x40 |
add ebx, 10 |
add edx, esi |
cmp [edx], byte 'x' |
jne .new_help_line |
mov eax, 12 |
mov ebx, 2 |
int 0x40 |
ret |
; HELP_TEXT } |
no_help_text: |
; LOAD_FILE { |
cmp al, 211 ; Ctrl + F2 |
je for_key_open ;do_load_file |
; LOAD_FILE } |
; SEARCH { |
cmp al, 212 ; Ctrl + F3 |
je search |
; SEARCH } |
; SAVE_FILE { |
cmp al, 213 ; Ctrl + F4 |
je yessave |
; SAVE_FILE } |
; ENTER_FILENAME { |
cmp al, 214 ; Ctrl + F5 |
jne @f |
jmp for_key_save |
@@: |
; ENTER_FILENAME } |
; ENTER_SEARCH { |
cmp al, 215 ; Ctrl + F6 |
jne @f |
; mov al, 51 |
; call read_string |
; jmp still |
jmp search_window |
@@: |
; ENTER_SEARCH } |
; CHANGE_LAYOUT { |
cmp al, 217 ; Ctrl + F8 |
jne @f |
call layout |
jmp still |
@@: |
; CHANGE_LAYOUT } |
; COMPILE_FILE { |
cmp al, 208 |
je lbl_compile_file |
; COMPILE_FILE } |
; RUN_OUTFILE { |
cmp al, 209 |
je lbl_run_outfile |
; RUN_OUTFILE } |
;run debug board { ----- |
cmp al,255 |
jne @f |
call open_debug_board |
call activate_me |
jmp still |
;} |
@@: |
;open sysfuncR { ----- |
; cmp al,228 |
; jne @f |
; call open_sysfuncs_txt |
; jmp still |
; @@: |
;fast_save_and_open { |
cmp al,216 |
jne @f |
call make_fast_so |
jmp still |
;} |
@@: |
; 3 times english -> àãá᪨© |
; 2 times àãá᪨© -> english |
; COPY START { |
cmp al, 19 |
jne no_copy_start |
mov eax, [post] |
imul ebx, [posy], 80 |
add eax, ebx |
mov [copy_start], eax |
jmp still |
; COPY START } |
no_copy_start: |
; COPY END { |
cmp al, 5 |
jne no_copy_end |
cmp [copy_start], 0 |
je still |
mov ecx, [post] |
imul ebx, [posy], 80 |
add ecx, ebx |
add ecx, 80 |
cmp ecx, [copy_count] |
jb still |
sub ecx, [copy_start] |
mov [copy_count], ecx |
mov esi, [copy_start] |
add esi, 0x80000 |
mov edi, 0x2f0000 |
cld |
rep movsb |
jmp still |
; COPY END } |
no_copy_end: |
; PASTE { |
cmp al, 16 |
jne no_copy_paste |
cmp [copy_count], 0 |
je still |
mov eax,[copy_count] |
cdq |
mov ebx, 80 |
div ebx |
add [lines], eax |
mov ecx, 0x2e0000 |
mov eax, [post] |
imul ebx, [posy], 80 |
add eax, ebx |
add eax, 0x80000 |
sub ecx, eax |
mov esi, 0x2e0000 |
sub esi, [copy_count] |
mov edi, 0x2e0000 |
std |
rep movsb |
mov esi, 0x2f0000 |
mov edi, [post] |
imul eax, [posy], 80 |
add edi, eax |
add edi, 0x80000 |
mov ecx, [copy_count] |
cld |
rep movsb |
call clear_screen |
call drawfile |
call draw_vertical_scroll |
mov [modified],1 |
jmp still |
; PASTE } |
no_copy_paste: |
; INSERT_SEPARATOR { |
cmp al,0xc ; Ctrl+L |
jne no_insert_separator |
imul eax,[posy],80 |
add eax,[post] |
add eax,0x80000 |
mov ebx,eax |
imul eax,[lines],80 |
add eax,0x80000 ; ⥯¥àì 㪠§ë¢ ¥â ª®¥æ ä ©« |
mov ecx,eax ; size |
sub ecx,ebx |
inc ecx |
mov esi,eax ; from |
mov edi,eax |
add edi,80 ; to |
std |
rep movsb |
mov ecx,80/4 |
mov esi,comment_string |
mov edi,ebx |
cld |
rep movsd |
inc [lines] |
call clear_screen |
call drawfile |
;call calc_scroll_size_and_pos |
call draw_vertical_scroll |
mov [modified],1 |
jmp still |
; INSERT_SEPARATOR } |
no_insert_separator: |
; DEL_LINE { |
cmp al,4 |
jne no_delete_line |
mov eax,[post] |
cdq |
mov ebx,80 |
div ebx |
add eax,[posy] |
inc eax |
cmp eax,[lines] |
jge still |
dec dword [lines] |
imul edi,[posy],80 |
add edi,[post] |
add edi,0x80000 |
mov esi,edi |
add esi,80 |
mov ecx,0x2e0000 |
sub ecx,esi |
shr ecx,4 |
cld |
rep movsd |
call clear_screen |
call drawfile |
;call calc_scroll_size_and_pos |
call draw_vertical_scroll |
mov [modified],1 |
jmp still |
; DEL_LINE } |
no_delete_line: |
; ENTER { |
cmp al,13 |
jnz noenter |
; lines down |
mov eax,[posy] |
inc eax |
; imul eax,80 |
lea eax,[eax+eax*4] ; eax *= 5 |
shl eax,4 ; eax *= 16 |
add eax,0x80000 |
add eax,[post] |
mov ebx,eax |
; ebx = ([posy]+1)*80 + 0x80000 + [post] |
; ebx -> first byte of next string |
imul eax,[lines],80 |
add eax,0x80000 |
mov ecx,eax |
; ecx = [lines]*80 + 0x80000 |
; ecx -> end of the document |
cmp ebx,ecx |
jz .bug_fixed |
@@: |
dec ecx |
mov dl,[ecx] |
mov [ecx+80],dl |
cmp ecx,ebx |
jnz @b |
.bug_fixed: |
; save for later |
imul eax,[posy],80 |
add eax,0x80000 |
add eax,[post] |
mov ebx,eax |
add eax,[posx] |
; eax = 0x80000 + [post] + [posy]*80 + [posx] |
push eax |
dec ebx |
xor ecx,ecx |
@@: |
cmp ecx,80 |
je @f |
inc ecx |
inc ebx |
cmp byte [ebx],' ' |
je @b |
@@: |
dec ecx |
cmp ecx,80-1 |
jne @f |
; mov [posx],0 |
jmp .lbl |
@@: |
cmp [posx],ecx |
jbe @f |
mov [posx],ecx |
jmp .lbl |
@@: |
mov [posx],0 |
.lbl: |
inc [posy] |
;clear line |
imul eax,[posy],80 |
add eax,0x80000 |
add eax,[post] |
mov edi,eax |
mov eax,' ' |
mov ecx,80/4 |
cld |
rep stosd |
; end of line to next line beginning |
imul eax,[posy],80 |
add eax,0x80000 |
add eax,[post] |
; add eax,[posx] |
mov ebx,eax |
; ebx -> beginning of this line |
pop esi |
mov edi,eax |
@@: |
mov al,[esi] |
mov [ebx],al |
mov [esi],byte ' ' |
inc esi |
inc ebx |
cmp esi,edi |
jb @b |
inc [lines] |
mov ecx,[posy] |
cmp ecx,[slines] |
jne @f |
dec [posy] |
add [post],80 |
@@: |
call clear_screen |
call drawfile |
;call calc_scroll_size_and_pos |
call draw_vertical_scroll |
mov [modified],1 |
jmp still |
; ENTER } |
noenter: |
; UP { |
cmp al,130+48 |
jnz noup |
mov ecx,[posy] |
test ecx,ecx |
jnz .up1 |
mov ecx,[post] |
test ecx,ecx |
jz still |
add ecx,-80 |
mov [post],ecx |
call clear_screen |
jmp .finish |
.up1: |
dec ecx |
mov [posy],ecx |
.finish: |
call drawfile |
call draw_vertical_scroll |
;call calc_scroll_size_and_pos |
jmp still |
; UP } |
noup: |
; DOWN { |
cmp al,129+48 |
jnz nodown |
mov ecx,[posy] |
mov eax,[slines] |
dec eax |
cmp ecx,eax |
jb .do1 ; goto do1 if [posy] < [slines]-1 |
mov eax,[lines] |
sub eax,[slines] |
dec eax |
jb still ; goto still if [lines] < [slines]-1 |
; imul eax,80 |
lea eax,[eax+eax*4] |
shl eax,4 |
cmp [post],eax |
jg still ; goto still if [post] > ([lines]-[slines]-1)*80 |
add [post],80 |
call clear_screen |
call drawfile |
call draw_vertical_scroll |
;call calc_scroll_size_and_pos |
jmp still |
.do1: |
pusha |
mov eax,[post] |
cdq |
mov ebx,80 |
div ebx |
add eax,[posy] |
inc eax |
cmp eax,[lines] |
jb .do10 |
popa |
jmp still |
.do10: |
popa |
inc ecx |
mov [posy],ecx |
call drawfile |
call draw_vertical_scroll |
;call calc_scroll_size_and_pos |
jmp still |
; DOWN } |
nodown: |
; LEFT { |
cmp al,128+48 |
jnz noleft |
cmp [posx],0 |
je still |
dec [posx] |
call drawfile |
jmp still |
; LEFT } |
noleft: |
; RIGHT { |
cmp al,131+48 |
jnz noright |
cmp [posx],79 |
je still |
inc [posx] |
call drawfile |
jmp still |
; RIGHT } |
noright: |
; PAGE_UP { |
page_up: |
cmp al,136+48 |
jnz nopu |
scrl_up: |
mov eax,[slines] |
dec eax |
; imul eax,80 |
lea eax,[eax+eax*4] |
shl eax,4 |
mov ecx,[post] |
cmp eax,ecx |
jbe pu1 |
mov ecx,eax |
pu1: |
sub ecx,eax |
mov [post],ecx |
call clear_screen |
call drawfile |
call draw_vertical_scroll |
;call calc_scroll_size_and_pos |
jmp still |
; PAGE_UP } |
nopu: |
; PAGE_DOWN { |
page_down: |
cmp al,135+48 |
jnz nopd |
scrl_down: |
mov eax,[lines] |
cmp eax,[slines] |
jb still |
mov eax,[post] ; eax = offset |
cdq |
mov ebx,80 |
div ebx ; eax /= 80 |
mov ecx,[lines] ; ecx = lines in the file |
cmp eax,ecx ; if eax < ecx goto pfok |
jnb still |
mov eax,[slines] ; eax = lines on the screen |
dec eax ; eax-- |
; imul eax,80 ; eax *= 80 |
lea eax,[eax+eax*4] |
shl eax,4 |
add [post],eax ; offset += eax |
mov eax,[lines] ; eax = lines in the file |
sub eax,[slines] ; eax -= lines on the screen |
; imul eax,80 ; eax *= 80 |
lea eax,[eax+eax*4] |
shl eax,4 |
cmp [post],eax |
jb @f |
mov [post],eax |
@@: |
call clear_screen |
call drawfile |
call draw_vertical_scroll |
;call calc_scroll_size_and_pos |
jmp still |
; PAGE_DOWN } |
nopd: |
; HOME { |
cmp al,132+48 |
jnz nohome |
push 0 |
pop [posx] |
call drawfile |
jmp still |
; HOME } |
nohome: |
; END { |
end_key: |
cmp al,133+48 |
jnz noend |
imul eax,[posy],80 |
add eax,0x80000 |
add eax,[post] |
mov esi,eax |
add eax,80+1 |
@@: dec eax |
cmp eax,esi |
je @f |
cmp byte [eax-1],' ' |
jbe @b |
@@: |
sub eax,esi |
cmp eax,80-1 |
jbe @f |
dec eax |
@@: |
mov [posx],eax |
call drawfile |
jmp still |
; END } |
noend: |
; GO_START { |
cmp al,251 ; Ctrl + [ |
jnz no_go_to_start |
push 0 |
pop [post] ; offset = 0 |
call clear_screen |
call drawfile ; draw file |
call draw_vertical_scroll |
;call calc_scroll_size_and_pos |
jmp still ; go to still |
; GO_START } |
no_go_to_start: |
; GO_END { |
cmp al,253 ; Ctrl + ] |
jnz no_go_to_end |
cmp [lines],30 ;to fix ctrl+] bug |
jb @f |
mov eax,[lines] ; eax = lines in the file |
sub eax,[slines] ; eax -= lines on the screen |
; imul eax,80 ; eax *= 80 (length of line) |
lea eax,[eax+eax*4] |
shl eax,4 |
mov [post],eax ; offset in the file |
call clear_screen |
call drawfile ; draw file |
call draw_vertical_scroll |
@@: |
jmp still ; go to still |
; GO_END } |
no_go_to_end: |
; DELETE { |
cmp al,134+48 |
jne nodel |
imul eax,[posy],80 |
add eax,0x80000 |
add eax,[post] |
add eax,[posx] |
mov ecx,eax |
imul eax,[posy],80 |
add eax,0x80000+79 |
add eax,[post] |
mov ebx,eax |
push ebx |
dec ecx |
dec ebx |
push ecx ebx |
push ebx |
imul eax,[posy],80 |
add eax,0x80000 |
add eax,[post] |
mov ecx,eax |
xor eax,eax |
cdq |
pop ebx |
dec ecx |
@@: |
inc ecx |
mov dh,[ecx] |
cmp dh,33 |
jb .nok |
xor eax,eax |
inc eax |
.nok: |
cmp ecx,ebx |
jb @b |
pop ebx ecx |
@@: |
inc ecx |
mov dl,[ecx+1] |
mov [ecx],dl |
cmp ecx,ebx |
jb @b |
pop ebx |
mov [ebx],byte 32 |
test eax,eax |
jz dellinesup |
call clear_screen |
call drawfile |
mov [modified],1 |
jmp still |
dellinesup: |
; lines -1 |
pusha |
mov eax,[post] |
cdq |
mov ebx,80 |
div ebx |
add eax,[posy] |
inc eax |
cmp eax,[lines] |
jb @f |
popa |
mov [modified],1 |
jmp still |
@@: |
popa |
dec [lines] |
; lines up |
mov [posx],dword 0 |
imul eax,[posy],80 |
add eax,0x80000-1 |
add eax,[post] |
mov ebx,eax |
push ebx |
imul eax,[lines],80 |
add eax,0x80000-1 |
add eax,[post] |
mov ecx,eax |
pop ebx |
@@: |
mov dl,[ebx+80] |
mov [ebx],dl |
inc ebx |
cmp ecx,ebx |
jnz @b |
call clear_screen |
call drawfile |
mov [modified],1 |
jmp still |
; DELETE } |
nodel: |
; INSERT { |
cmp al,137+48 |
jnz noins |
imul eax,[posy],80 |
add eax,0x80000 |
add eax,[post] |
add eax,[posx] |
mov ecx,eax |
; ecx = [posy]*80+0x80000+[post]+[posx] |
imul eax,[posy],80 |
add eax,0x80000+79 |
add eax,[post] |
mov ebx,eax |
; ebx = [posy]*80+0x80000+79+[post] |
.movstr: |
dec ebx |
mov dl,[ebx] |
mov [ebx+1],dl |
cmp ecx,ebx |
jb .movstr |
mov [ecx],byte ' ' |
call invalidate_string |
call drawfile |
mov [modified],1 |
jmp still |
; INSERT } |
noins: |
; BACKSPACE { |
cmp al,8 |
jnz nobs |
mov ecx,[posx] |
test ecx,ecx |
jz still |
dec ecx |
mov [posx],ecx |
imul eax,[posy],80 |
add eax,0x80000 |
add eax,[post] |
add eax,[posx] |
mov ebx,eax |
push ebx |
imul eax,[posy],80 |
add eax,0x80000+79 |
add eax,[post] |
mov ebx,eax |
pop ecx |
push ebx |
dec ecx |
.movleft: |
inc ecx |
mov dl,[ecx+1] |
mov [ecx],dl |
cmp ecx,ebx |
jb .movleft |
pop ebx |
mov [ebx],byte ' ' |
call invalidate_string |
call drawfile |
mov [modified],1 |
jmp still |
; BACKSPACE } |
nobs: |
; TAB { |
cmp eax,9 ; Tab |
jne notab |
mov eax,[posx] |
cmp eax,80-1 |
jae still |
add eax,5 ; 9 5 3 |
and eax,11111100b ; ...1000b, ...100b, ...10b |
dec eax |
mov [posx], eax |
call drawfile |
mov [modified],1 |
jmp still |
; TAB } |
notab: |
; ADD_KEY { |
push eax ; add key |
imul eax,[posy],80 |
add eax,0x80000 |
add eax,[post] |
add eax,[posx] |
mov ecx,eax |
push ecx |
imul eax,[posy],80 |
add eax,0x80000+79 |
add eax,[post] |
mov ebx,eax |
.movright: |
dec ebx |
mov al,[ebx] |
mov [ebx+1],al |
cmp ecx,ebx |
jbe .movright |
pop ebx |
pop eax |
mov [ebx],al |
mov edx,78 |
mov ecx,[posx] |
cmp edx,ecx |
jb noxp |
inc ecx |
mov [posx],ecx |
noxp: |
call invalidate_string |
call drawfile |
mov [modified],1 |
; call draw_vertical_scroll |
jmp still |
; ADD_KEY } |
;****************************************************************************** |
start_fasm: |
cmp [asm_mode],1 |
je @f |
ret |
@@: |
mov esi,filename |
mov edi,fasm_parameters |
cmp byte [esi],'/' |
je .yes_systree |
mov ecx,[filename_len] |
rep movsb |
mov al,',' |
stosb |
mov ecx,[filename_len] |
add ecx,-4 |
mov esi,filename |
rep movsb |
mov al,',' |
stosb |
mov [edi],dword '/RD/' |
add edi,4 |
mov [edi],word '1/' |
inc edi |
inc edi |
mov al,0 |
stosb |
jmp .run |
.yes_systree: |
add esi,[filename_len] |
dec esi |
xor ecx,ecx |
mov al,'/' |
@@: |
cmp [esi],al |
je @f |
dec esi |
inc ecx |
jmp @b |
@@: |
inc esi |
push esi |
push esi |
push ecx |
rep movsb |
mov al,',' |
stosb |
pop ecx |
pop esi |
add ecx,-4 |
rep movsb |
mov al,',' |
stosb |
pop ecx |
sub ecx,filename |
mov esi,filename |
rep movsb |
mov al,0 |
stosb |
.run: |
cmp [run_outfile],1 |
jne @f |
dec edi |
mov eax,',run' |
stosd |
mov al,0 |
stosb |
@@: |
mov eax,19 |
mov ebx,fasm_filename |
mov ecx,fasm_parameters |
int 0x40 |
ret |
open_debug_board: |
mov eax,19 |
mov ebx,debug_filename |
xor ecx,ecx |
int 0x40 |
ret |
open_sysfuncs_txt: |
mov eax,19 |
mov ebx,tinypad_filename |
mov ecx,sysfuncs_filename |
int 0x40 |
ret |
empty_work_space: |
; ®ç¨áâ¨âì ¢á¥ |
mov eax,' ' |
mov edi,0x80000 |
mov ecx,(0x300000-0x90000)/4 |
cld |
rep stosd |
mov edi,0x10000 |
mov ecx,0x60000/4 |
rep stosd |
ret |
clear_screen: |
; ®ç¨áâ¨âì íªà |
mov ecx,80*40 |
mov edi,0x78000 |
xor eax,eax |
@@: |
mov [edi],eax |
add edi,4 |
dec ecx |
jnz @b |
ret |
invalidate_string: |
imul eax,[posy],80 |
add eax,0x78000 |
mov edi,eax |
mov al,1 |
mov ecx,80/4 |
rep stosd |
ret |
layout: |
; ᬥ¨âì à ᪫ ¤ªã ª« ¢¨ âãàë |
mov eax,19 |
mov ebx,setup |
mov ecx,param_setup |
int 0x40 |
mov eax,5 |
mov ebx,eax |
int 0x40 |
call activate_me |
ret |
activate_me: |
; 1) get info about me |
mov eax,9 |
mov ebx,procinfo |
mov ecx,-1 |
int 0x40 |
; eax = number of processes |
; save process counter |
inc eax |
inc eax |
mov [proccount],eax |
mov eax,[procinfo.PID] |
mov [PID],eax |
; 2) get my process number |
mov eax,9 |
mov ebx,procinfo |
mov ecx,[proccount] |
@@: |
dec ecx |
jz @f ; counter=0 => not found? => return |
mov eax,9 |
int 0x40 |
mov edx,[procinfo.PID] |
cmp edx,[PID] |
jne @b |
;found: ecx = process_number |
mov eax,18 |
mov ebx,3 |
int 0x40 |
mov eax,5 |
mov ebx,eax |
int 0x40 |
@@: |
ret |
; ******************************************************************* |
; ************************** DRAW WINDOW ************************** |
; ******************************************************************* |
align 4 |
drawwindow: |
mov eax,12 ; WINDOW DRAW START |
mov ebx,1 |
int 0x40 |
mov [menu_is_on],0 |
mov eax,48 ; get system colors |
mov ebx,3 |
mov ecx,sc |
mov edx,sizeof.system_colors |
int 0x40 |
mov [sc.work],0xe0e0e0 |
xor eax,eax ; DEFINE WINDOW |
mov ebx,100*65536+506 ; 496 |
mov ecx,75*65536+400 ;385;400 ; sum < 480 for 640x480 |
mov edx,[sc.work] |
add edx,0x03000000 |
mov esi,[sc.grab] |
or esi,0x80000000 |
mov edi,[sc.frame] |
int 0x40 |
; header string |
mov eax,4 |
mov ebx,10*65536+8 |
mov ecx,[sc.grab_text] |
mov edx,header |
mov esi,[headlen] |
int 0x40 |
mov eax,9 ; get info about me |
mov ebx,procinfo |
or ecx,-1 |
int 0x40 |
mov eax,[procinfo.y_size] |
mov [do_not_draw],1 ; do_not_draw = true |
cmp eax,100 |
jb .no_draw ; do not draw text & buttons if height < 100 |
mov [do_not_draw],0 ; do_not_draw = false |
add eax,-(46+47) ; 46 = y offs |
cdq |
mov ebx,10 |
div ebx |
mov [slines],eax |
cmp eax,[posy] |
jnb @f |
dec eax |
mov [posy],eax |
@@: |
mov eax,[procinfo.y_size] ; calculate buttons position |
add eax,-47 |
mov [dstart],eax |
; mov eax,8 ; STRING BUTTON |
; mov ebx,5*65536+57 |
; mov ecx,[dstart] |
; add ecx,29 |
; shl ecx,16 |
; add ecx,13 |
; mov edx,51 ;;;;;-----string button ID=51 |
; mov esi,[sc.work_button] |
; int 0x40 |
; SEARCH BUTTON |
; mov ebx,(505-129)*65536+125 |
; mov edx,50 |
; mov esi,[sc.work_button] |
; int 0x40 |
; mov eax,4 ; SEARCH TEXT |
; mov ebx,[dstart] |
; add ebx,7*65536+32 |
; mov ecx,[sc.work_button_text] |
; mov edx,searcht |
; mov esi,searchtl-searcht |
; int 0x40 |
mov eax,13 ; BAR STRIPE |
mov ebx,5*65536+497 |
mov ecx,[dstart] |
shl ecx,16 |
add ecx,30 ;15 |
mov edx,0x00aaaaaa |
int 0x40 |
; mov eax,4 ; FIRST TEXT LINE (POSITION...) |
; mov ebx,12*65536 |
; add ebx,[dstart] |
; add ebx,38 ;18 |
; mov ecx,[sc.work_button_text] |
; mov edx,htext2 |
; mov esi,htextlen2-htext2 |
; int 0x40 |
call drawfile |
; mov eax,[dstart] |
; add eax,31 |
; mov [ya],eax |
; mov [addr],search_string |
; call print_text |
.no_draw: |
call draw_win_menu |
call draw_vertical_scroll |
mov eax,12 ; WINDOW DRAW END |
mov ebx,2 |
int 0x40 |
ret |
; ********************************** |
; *********** DRAWFILE *********** |
; ********************************** |
drawfile: |
;--------------- |
cmp [menu_is_on],1 |
jne .ff |
call drawwindow |
.ff: |
;--------------- |
mov [next_not_quote],1 |
mov [next_not_quote2],1 |
mov eax,[post] ; print from position |
pusha |
mov edi,[post] |
mov [posl],edi |
mov ebx,8*65536+46 ; letters (46 = y offs) |
xor ecx,ecx |
mov edx,0x80000 |
add edx,eax |
mov edi,edx |
imul esi,[slines],80 |
add edi,esi |
nd: |
pusha |
mov edx,ebx |
mov edi,ebx |
add edi,(6*65536)*80 |
wi1: |
; draw ? |
pusha |
push ecx |
imul eax,[posx],6 |
add eax,8 |
shl eax,16 |
mov ecx,eax |
; ecx = ([posx]*6+8)<<16 |
imul eax,[posy],10 |
add eax,46 ; y offs |
add eax,ecx |
; eax = [posy]*10+46+ecx |
pop ecx |
cmp edx,eax |
jnz drwa |
mov eax,0x7ffff |
call check_pos |
jmp drlet |
drwa: |
popa |
pusha |
imul eax,[posxm],6 |
add eax,8 |
shl eax,16 |
mov ecx,eax |
imul eax,[posym],10 |
add eax,46 ; y offs |
add eax,ecx |
cmp edx,eax |
jnz drwa2 |
mov eax,0x7ffff |
call check_pos |
jmp drlet |
drwa2: |
popa |
pusha |
mov eax,0x78000 ; screen |
add eax,[posl] ; screen+abs |
sub eax,[post] ; eax = screen+abs-base = y*80+x + screen |
mov edx,0x80000 ; file |
add edx,[posl] ; edx = absolute |
mov bl,[edx] ; in the file |
call check_pos |
mov cl,[eax] ; on the screen |
cmp bl,cl |
jnz drlet |
popa |
jmp nodraw |
; draw letter |
drlet: |
mov [eax],bl ; mov byte to the screen |
mov [tmpabc],bl |
popa ; restore regs |
;!!!!!!!!!!!! |
cmp [tmpabc],' ' |
je @f |
call draw_letter |
jmp nodraw |
@@: |
call clear_char |
nodraw: |
inc [posl] |
add edx,6*65536 |
cmp edx,edi |
jz wi3 |
jmp wi1 |
wi3: |
popa |
add ebx,10 |
add edx,80 |
cmp edi,edx |
jbe nde |
jmp nd |
nde: |
mov eax,[posx] |
mov ebx,[posy] |
mov [posxm],eax |
mov [posym],ebx |
popa |
ret |
stText = 0 |
stInstr = 1 |
stReg = 2 |
stNum = 3 |
stQuote = 4 |
stComment = 5 |
stSymbol = 6 |
align 4 |
clear_char: |
pusha |
mov ebx,[sc.work] |
push ecx |
imul eax,[posx],6 |
add eax,8 |
shl eax,16 |
mov ecx,eax |
imul eax,[posy],10 |
add eax,46 ; 26 |
add eax,ecx |
pop ecx |
cmp edx,eax |
jnz @f |
mov ebx,0xffffff ; light blue 0x00ffff |
@@: |
; draw bar |
push ebx |
mov eax,13 |
mov ebx,edx |
mov bx,6 |
mov ecx,edx |
shl ecx,16 |
add ecx,10 |
pop edx |
int 0x40 |
popa |
ret |
align 4 |
; CHECK_POSITION { |
check_pos: |
cmp [asm_mode],1 |
je @f |
mov [d_status],stText |
ret |
@@: |
pushad |
; COMMENT TERMINATOR |
cmp [d_status],stComment |
jnz @f |
mov eax,[posl] |
sub eax,[post] |
cdq |
mov ebx,80 |
div ebx |
test edx,edx |
jnz end_check_pos |
mov [d_status],stText |
@@: |
; QUOTE TERMINATOR B |
cmp [next_not_quote],1 |
jne @f |
mov [d_status],stText |
@@: |
mov eax,[posl] |
add eax,0x80000 |
mov edx,eax |
mov al,[eax] |
; QUOTE TERMINATOR A |
cmp [d_status],stQuote |
jnz @f |
cmp al,[quote] |
jne end_check_pos |
mov [next_not_quote],1 |
jmp end_check_pos |
@@: |
mov [next_not_quote],0 |
; START QUOTE 1 |
cmp al,"'" |
jne @f |
mov [d_status],stQuote |
mov [quote],al |
jmp end_check_pos |
@@: |
; START QUOTE 2 |
cmp al,'"' |
jne @f |
mov [d_status],stQuote |
mov [quote],al |
jmp end_check_pos |
@@: |
; START COMMENT |
cmp al,';' |
jne @f |
mov [d_status],stComment |
jmp end_check_pos |
@@: |
; NUMBER TERMINATOR |
cmp [d_status],stNum |
jne nonumt |
mov ecx,23 |
@@: |
dec ecx |
jz nonumt |
cmp al,[symbols+ecx] |
jne @b |
nonumt1: |
mov [d_status],stText |
nonumt: |
; START NUMBER |
cmp [d_status],stNum |
je end_check_pos |
cmp al,'0' |
jb nonum |
cmp al,'9' |
ja nonum |
mov bl,[edx-1] |
mov ecx,23 |
@@: |
dec ecx |
jz nonum |
cmp bl,[symbols+ecx] |
jne @b |
@@: |
mov [d_status],stNum |
jmp end_check_pos |
nonum: |
; SYMBOL |
mov esi,symbols |
mov ecx,21 |
@@: |
cmp byte [esi],al |
je @f |
dec ecx |
jz nosymbol |
inc esi |
jmp @b |
@@: |
mov [d_status],stSymbol |
jmp end_check_pos |
nosymbol: |
mov [d_status],stText |
end_check_pos: |
popad |
ret |
; CHECK_POSITION } |
;;;;;;;;;;;;;;;;; |
;; DRAW LETTER ;; |
;;;;;;;;;;;;;;;;; |
draw_letter: |
call clear_char |
pusha |
mov ebx,edx ; x & y |
mov eax,[d_status] |
mov ecx,[eax*4+color_tbl] |
mov eax,4 |
xor esi,esi |
inc esi |
mov edx,0x80000 |
mov edi,[posl] |
add edx,edi |
int 0x40 |
popa |
ret |
; ******************************************** |
; **************** SAVEFILE **************** |
; ******************************************** |
save_file: |
mov esi,0x80000 |
mov edi,0x10000 |
or ecx,-1 |
.new_string: |
inc ecx |
call save_string |
cmp ecx,[lines] |
jb .new_string |
sub edi,0x10004 ; why??? |
mov [filelen],edi |
cmp byte [filename],'/' |
je .systree_save |
mov eax,33 |
mov ebx,filename |
mov ecx,0x10000 |
mov edx,[filelen] |
xor esi,esi |
int 0x40 |
test eax,eax |
je .finish |
; call file_not_found |
call disk_is_full |
;============================== |
jmp .finish |
.systree_save: |
mov eax,[filelen] |
mov [fileinfo_write+8],eax |
mov esi,filename |
mov edi,pathfile_write |
mov ecx,50 |
cld |
rep movsb |
mov eax,58 |
mov ebx,fileinfo_write |
int 0x40 |
cmp eax,0 |
je .finish |
call disk_is_full |
.finish: |
call draw_window_for_dialogs |
mov [modified],0 |
ret |
save_string: |
push ecx |
push esi |
mov eax,esi |
mov ebx,eax |
add ebx,79 |
.countlen: |
cmp ebx,eax |
jb .endcount |
cmp byte [ebx],' ' |
jne .endcount |
dec ebx |
jmp .countlen |
.endcount: |
inc ebx |
sub ebx,eax |
mov ecx,ebx |
jecxz .endcopy |
.copystr: |
mov al,[esi] |
mov [edi],al |
inc esi |
inc edi |
dec ecx |
jnz .copystr |
.endcopy: |
mov eax,0x0a0d |
stosw |
pop esi |
add esi,80 |
pop ecx |
ret |
; ******************************************** |
; **************** LOADFILE **************** |
; ******************************************** |
loadhdfile: |
mov esi,filename |
mov edi,pathfile_read |
mov ecx,250 ;50 |
cld |
rep movsb |
mov eax,58 |
mov ebx,fileinfo_read |
int 0x40 |
xchg eax,ebx |
inc eax |
test ebx,ebx ;errorcode=0 - ok |
je file_found |
cmp ebx,6 ;errorcode=5 - ok |
je file_found |
call file_not_found |
ret |
loadfile1: |
mov eax,6 ; 6 = open file |
mov ebx,filename |
xor ecx,ecx |
mov edx,16800 |
mov esi,0x10000 |
int 0x40 |
inc eax ; eax = -1 -> file not found |
jnz file_found ;strannaya proverka (Ed) |
call file_not_found |
ret |
file_found: |
dec eax |
; eax = file size |
jz .finish |
mov [filesize],eax |
mov edi,0x80000 ; clear all |
@@: |
mov [edi],byte ' ' |
inc edi |
cmp edi,0x2effff |
jnz @b |
mov [lines],0 |
mov edi,0x10000 |
mov ebx,0x80000 |
; edi = from |
; ebx = to |
; eax = filesize |
.new_char: |
mov cl,[edi] ; get_char(); |
cmp cl,13 ; if (char==13) |
je .new_str1 ; goto .new_str1; |
cmp cl,10 ; if (char==10) |
je .new_str2 ; goto .new_str2; |
mov [ebx],cl ; store_char(); |
inc ebx ; dest++; |
.back: |
inc edi ; src++; |
dec eax ; counter--; |
jnz .new_char ; if (counter!=0) goto .new_char; |
.finish: |
inc [lines] ; [lines]++; |
ret |
.new_str1: |
pusha |
mov eax,ebx ; eax = destination |
add eax,-0x80000 ; eax = offset |
cdq |
mov ecx,80 |
div ecx ; offset /= 80; |
test edx,edx ; if not the first char in the string |
jne @f ; go forward |
test eax,eax ; if first line |
je @f ; go forward |
cmp [edi-1],byte 10; if previous char != 10 continue without line feed |
jne .contin |
@@: |
inc eax ; offset++; |
imul eax,80 ; offset *= 80; |
add eax,0x80000 |
mov [esp+4*4],eax ; to ebx |
.contin: |
popa |
inc edi ; do not look on the next char (10) |
dec eax ; counter--; |
inc [lines] ; [lines]++; |
jmp .back |
.new_str2: |
pusha |
mov eax,ebx |
add eax,-0x80000 |
cdq |
mov ecx,80 |
div ecx |
inc eax |
imul eax,80 |
add eax,0x80000 |
mov [esp+4*4],eax ; to ebx |
popa |
inc [lines] |
jmp .back |
file_not_found: |
mov eax,55 ; beep |
mov ebx,eax |
mov esi,error_beep |
int 0x40 |
mov [lines],1 ; open empty document |
mov [to_return2],1 |
call openerror |
ret |
disk_is_full: |
mov eax,55 ; beep |
mov ebx,eax |
mov esi,error_beep |
int 0x40 |
mov [to_return2],1 |
call saveerror |
mov [error2_found],1 |
ret |
; ***************************** |
; ****** WRITE POSITION ****** |
; ***************************** |
writepos: |
cmp [do_not_draw],1 ; return if drawing is not permitted |
jne @f |
ret |
@@: |
pusha |
mov eax,[posx] |
inc eax |
cdq |
mov ebx,10 |
div ebx |
add al,'0' |
add dl,'0' |
mov [htext2+ 9],al |
mov [htext2+10],dl |
mov eax,[post] |
cdq |
mov ebx,80 |
div ebx |
mov [real_posy],eax ;=====!!!!!!!!! |
add eax,[posy] |
inc eax |
mov ebx,10 |
cdq |
div ebx |
add dl,'0' |
mov [htext2+16],dl ; 00001 |
cdq |
div ebx |
add dl,'0' |
mov [htext2+15],dl ; 00010 |
cdq |
div ebx |
add dl,'0' |
mov [htext2+14],dl ; 00100 |
cdq |
div ebx |
add dl,'0' |
add al,'0' |
mov [htext2+13],dl ; 01000 |
mov [htext2+12],al ; 10000 |
mov eax,[lines] ; number of lines |
cdq |
mov ebx,10 |
div ebx |
add dl,'0' |
mov [htext2+31],dl ; 0001 |
cdq |
div ebx |
add dl,'0' |
mov [htext2+30],dl ; 0010 |
cdq |
div ebx |
add dl,'0' |
mov [htext2+29],dl ; 0100 |
cdq |
div ebx |
add dl,'0' |
add al,'0' |
mov [htext2+28],dl |
mov [htext2+27],al ; 10000 |
; ! |
; mov [htext2+42], word 'RU' |
; mov eax,13 ; draw bar |
; mov ebx,5*65536+38*6 |
; mov ecx,[dstart] |
; shl ecx,16 |
; add ecx,15 |
; mov edx,[sc.work_graph] |
; int 0x40 |
mov eax,13 ; BAR STRIPE |
mov ebx,5*65536+497 |
mov ecx,[dstart] |
add ecx,29;30 ;15 |
shl ecx,16 |
add ecx,14 |
mov edx,[sc.work_graph] |
int 0x40 |
mov eax,4 ; write position |
mov ebx,12*65536 |
mov bx,word [dstart] |
add ebx,33 ;18 |
mov ecx,[sc.work_button_text] |
mov edx,htext2 |
mov esi,38 |
int 0x40 |
cmp [modified],1 |
jne no_mod |
putlabel 270,386,' ',[sc.work_button_text] |
no_mod: |
popa |
ret |
;----------------------------- |
; search window |
;----------------------------- |
search_window: |
mov eax,13 |
mov ebx,55*65536+380 |
mov ecx,100*65536+60 |
mov edx,[sc.work_graph] |
int 0x40 |
mov eax,38 |
mov ebx,55*65536+435 |
mov ecx,100*65536+100 |
mov edx,cl_White |
int 0x40 |
mov eax,38 |
mov ebx,55*65536+55 |
mov ecx,100*65536+160 |
mov edx,cl_White |
int 0x40 |
mov eax,38 |
mov ebx,435*65536+435 |
mov ecx,100*65536+160 |
mov edx,cl_White |
int 0x40 |
mov eax,38 |
mov ebx,55*65536+435 |
mov ecx,160*65536+160 |
mov edx,cl_White |
int 0x40 |
drawlbut 375,110,50,15,'®¨áª',50,[sc.work_button],[sc.work_button_text] |
drawlbut 375,130,50,15,'⬥ ',94,[sc.work_button],[sc.work_button_text] |
call read_string |
; add eax,31 |
; mov [ya],eax |
; mov [addr],search_string |
; call print_text |
jmp search |
string_not_found: |
mov eax,13 |
mov ebx,150*65536+200 |
mov ecx,100*65536+70 |
mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512 |
int 0x40 |
mov eax,38 |
mov ebx,150*65536+350 |
mov ecx,100*65536+100 |
mov edx,cl_White |
int 0x40 |
mov eax,38 |
mov ebx,150*65536+350 |
mov ecx,170*65536+170 |
mov edx,cl_White |
int 0x40 |
mov eax,38 |
mov ebx,150*65536+150 |
mov ecx,100*65536+170 |
mov edx,cl_White |
int 0x40 |
mov eax,38 |
mov ebx,350*65536+350 |
mov ecx,100*65536+170 |
mov edx,cl_White |
int 0x40 |
putlabel 195,120,'âப ¥ ©¤¥ !',cl_White |
drawlbut 235,140,30,15,'ª',94,[sc.work_button],cl_White |
ret |
read_string: |
push eax |
;---------------- |
mov eax,40 |
mov ebx,00000000000000000000000000000111b |
int 0x40 |
;---------------- |
pop eax |
; cmp al,51 |
; jz .f2 |
; ret |
.f2: |
mov [addr],dword search_string |
mov eax,[dstart] |
add eax,17+14 |
mov [ya],eax |
mov [case_sens],1 |
.rk: |
mov edi,[addr] |
mov eax,[addr] |
mov eax,[eax-4] |
mov [temp],eax |
add edi,eax |
call print_text |
.waitev: |
mov eax, 10 |
int 0x40 |
cmp eax, 2 |
jne .read_done |
int 0x40 |
shr eax, 8 |
cmp al, 13 ; enter |
je .read_done |
cmp al,27 |
jne ._f |
jmp red |
._f: |
cmp al, 192 ; Ctrl + space |
jne .noclear |
xor eax, eax |
mov [temp], eax |
mov edi, [addr] |
mov [edi-4], eax |
mov ecx, 49 |
cld |
rep stosb |
mov edi, [addr] |
call print_text |
jmp .waitev |
.noclear: |
cmp al, 8 ; backspace |
jnz .nobsl |
cmp [temp], 0 |
jz .waitev |
dec [temp] |
mov edi, [addr] |
add edi, [temp] |
mov [edi], byte 0 |
mov eax,[addr] |
dec dword [eax-4] |
call print_text |
jmp .waitev |
.nobsl: |
cmp [temp],50 |
jae .read_done |
; CONVERT CHAR TO UPPER CASE: |
cmp al, ' ' ; below "space" - ignore |
jb .waitev |
cmp [case_sens], 1 ; case sensitive? |
je .keyok |
cmp al, 'a' |
jb .keyok |
cmp al, 'z' |
ja .keyok |
sub al, 32 |
.keyok: |
mov edi,[addr] |
add edi,[temp] |
mov [edi],al |
inc [temp] |
mov eax,[addr] |
inc dword [eax-4] |
call print_text |
cmp [temp],50 |
jbe .waitev |
.read_done: |
mov ecx,50 |
sub ecx,[temp] |
mov edi,[addr] |
add edi,[temp] |
xor eax,eax |
cld |
rep stosb |
mov [temp],987 |
call print_text |
call mask_events |
ret |
print_text: |
pusha |
mov eax,13 |
mov ebx,64*65536+50*6+2 |
; mov ecx,[ya] |
; shl ecx,16 |
; add ecx,12 |
mov ecx,110*65536+12 |
mov edx,[sc.work] |
int 0x40 |
mov edx,[addr] |
mov esi,[edx-4] |
mov eax,4 |
mov ebx,65*65536+112 ;2 |
; add ebx,[ya] |
mov ecx,[color_tbl+0] |
int 0x40 |
cmp [temp],50 |
ja @f |
; draw cursor |
; { |
; mov eax,[ya] |
mov eax,18*65536+102 ;65 |
mov ebx,eax |
shl eax,16 |
add eax,ebx |
add eax,10 |
mov ecx,eax |
mov eax,[temp] |
; imul eax,6 |
lea eax,[eax+eax*2] |
shl eax,1 |
add eax,65 |
mov ebx,eax |
shl eax,16 |
add ebx,eax |
mov eax,38 |
mov edx,[color_tbl+0] |
int 0x40 |
; } |
@@: |
popa |
ret |
; mov eax,8 ; STRING BUTTON |
; mov ebx,5*65536+57 |
; mov ecx,[dstart] |
; add ecx,29 |
; shl ecx,16 |
; add ecx,13 |
; mov edx,51 ;;;;;-----string button ID=51 |
; mov esi,[sc.work_button] |
; int 0x40 |
; SEARCH BUTTON |
; mov ebx,(505-129)*65536+125 |
; mov edx,50 |
; mov esi,[sc.work_button] |
; int 0x40 |
; mov eax,4 ; SEARCH TEXT |
; mov ebx,[dstart] |
; add ebx,7*65536+32 |
; mov ecx,[sc.work_button_text] |
; mov edx,searcht |
; mov esi,searchtl-searcht |
; int 0x40 |
; **************************** |
; ******* READ STRING ******** |
; **************************** |
goto_string: |
mov [num_goto_string],0 |
call read_str_num |
mov eax,[num_goto_string] |
cmp eax,[lines] |
ja .leave |
;--------------- |
mov [posy],0 |
call goto_pos |
.leave: |
call draw_window_for_dialogs |
call mask_events |
jmp still |
read_str_num: |
push eax |
;---------------- |
mov eax,40 |
mov ebx,00000000000000000000000000000111b |
int 0x40 |
;---------------- |
pop eax |
mov eax,13 |
mov ebx,100*65536+100 |
mov ecx,70*65536+60 |
mov edx,[sc.work_button] |
int 0x40 |
mov eax,38 |
mov ebx,100*65536+200 |
mov ecx,70*65536+70 |
mov edx,cl_White |
int 0x40 |
mov eax,38 |
mov ebx,100*65536+200 |
mov ecx,130*65536+130 |
mov edx,cl_White |
int 0x40 |
mov eax,38 |
mov ebx,100*65536+100 |
mov ecx,70*65536+130 |
mov edx,cl_White |
int 0x40 |
mov eax,38 |
mov ebx,200*65536+200 |
mov ecx,70*65536+130 |
mov edx,cl_White |
int 0x40 |
putlabel 105,75,'GoTo Line #',cl_White |
mov eax,13 |
mov ebx,110*65536+40 |
mov ecx,90*65536+12;[ya] |
mov edx,[sc.work] |
int 0x40 |
outcount [num_goto_string],112,92,cl_Black,6*65536 |
drawlbut 110,105,40,15,'GoTo',93,cl_Grey,cl_Black |
drawlbut 153,105,40,15,'Cancel',94,cl_Grey,cl_Black |
.waitev: |
mov eax, 10 |
int 0x40 |
; cmp eax,6 |
; je .mouse |
cmp eax,3 |
je .but |
cmp eax, 2 |
; jne .read_done |
jne .waitev |
int 0x40 |
shr eax, 8 |
cmp al, 13 ; enter |
je .read_done |
cmp al,27 |
je goto_string.leave |
cmp al, 8 ; backspace |
jnz .nobsl |
xor edx,edx |
mov eax,[num_goto_string] |
mov ebx,dword 10 |
div ebx |
mov [num_goto_string],eax |
call print_text2 |
jmp .waitev |
;.mouse: |
;mov eax,37 |
;mov ebx,2 |
;int 0x40 |
;cmp eax,2 |
;je goto_string.leave |
;jmp .waitev |
.but: |
mov eax,17 |
int 0x40 |
cmp ah,94 |
je goto_string.leave |
cmp ah,93 |
je .read_done |
jmp .waitev |
.nobsl: |
xor ecx,ecx |
xor edx,edx |
sub al,48 |
mov cl,al |
mov eax,[num_goto_string] |
cmp eax,99999 |
ja .read_done |
mov ebx,10 |
mul ebx |
add eax,ecx |
mov [num_goto_string],eax |
call print_text2 |
jmp .waitev |
.read_done: |
mov eax,[num_goto_string] |
dec eax |
mov [num_goto_string],eax |
call print_text2 |
ret |
print_text2: |
pusha |
mov eax,13 |
mov ebx,110*65536+40 |
mov ecx,90*65536+12;[ya] |
mov edx,[sc.work] |
int 0x40 |
outcount [num_goto_string],112,92,cl_Black,6*65536 |
popa |
ret |
;****************************************************************************** |
calc_scroll_size_and_pos: |
;cmp [menu_is_on],0 |
;je ._ff |
;call drawwindow |
;mov [menu_is_on],0 |
;._ff: |
cmp [lines],30 |
jbe .lines_less_30 |
xor edx,edx |
mov eax,[post] |
mov ebx,80 |
div ebx |
add eax,[posy] |
;add eax,[slines] |
;checking for bug |
mov ebx,[lines] |
sub ebx,30 |
cmp eax,ebx |
ja .f |
mov [VScroll_1+16],eax |
jmp .ff |
.f: |
mov [VScroll_1+16],ebx |
.ff: |
;--------------------- |
mov eax,[lines] |
sub eax,30 ;---max=lines-30 |
mov [VScroll_1+12],eax |
jmp .leave |
.lines_less_30: |
mov [VScroll_1+16],dword 0 |
mov [VScroll_1+12],dword 1 |
.leave: |
ret |
;============Draw vertical scroll bar========= |
draw_vertical_scroll: |
call calc_scroll_size_and_pos |
;======================== |
xor ecx,ecx ;start at top of controls list |
Draw_Controls_Loop: ;Redraw Controls Loop |
mov ebp, [App_Controls+ecx] ;get controls data location |
or ebp,ebp ;is this the last control? |
jz Draw_Controls_Done ; |
call dword [App_Controls+ecx+4] ;call controls draw function |
add ecx, 12 ;get next control |
jmp Draw_Controls_Loop ;loop till done |
Draw_Controls_Done: ;all done |
;======================== |
mov eax,38 |
mov ebx,488*65536+488 |
mov ecx,43*65536+388 |
mov edx,0x00000000 |
int 0x40 |
ret |
mouse_info: |
;call |
mov eax, 37 ;get mouse cordinates |
mov ebx, 1 ; |
int 0x40 ; |
mov ecx, eax ; |
push ecx ; |
mov eax, 37 ;get mouse buttons |
mov ebx, 2 ; |
int 0x40 ; |
;------------------ |
; if menu is on - then we need to redraw window before continue |
cmp eax,1 |
jne ._f1 |
pusha |
cmp [menu_is_on],0 |
je ._ff |
call drawwindow |
mov [menu_is_on],0 |
._ff: |
popa |
._f1: |
;------------------ |
cmp [mouseb], eax ;compare old mouse states to new states |
jne redraw_mouse_info ; |
cmp [mousey], cx ; |
jne redraw_mouse_info ; |
shr ecx, 16 ; |
cmp [mousex], cx ; |
jne redraw_mouse_info ; |
pop ecx ; |
ret ;return if no change in states |
redraw_mouse_info: |
pop ecx |
mov [mouseb], eax ;save new mouse states |
mov dword [mousey], ecx |
xor ecx, ecx |
Check_Mouse_Over_Controls_Loop: |
mov ebp, [App_Controls+ecx] |
or ebp, ebp |
jz Check_Mouse_Over_Controls_Loop_done |
movzx eax,word [ebp+2] |
cmp ax, [mousex] |
ja mouse_not_on_control |
movzx eax,word [ebp+6] |
cmp ax, [mousey] |
ja mouse_not_on_control |
movzx eax,word [ebp] |
add ax, [ebp+2] |
cmp ax, [mousex] |
jb mouse_not_on_control |
movzx eax,word [ebp+4] |
add ax, [ebp+6] |
cmp ax, [mousey] |
jb mouse_not_on_control |
call dword [App_Controls+ecx+8] |
;------------------------------ |
cmp [mouseb],1 |
jne mouse_not_on_control |
mov eax,[VScroll_1+16] |
call goto_pos |
;------------------------------ |
mouse_not_on_control: |
add ecx, 12 |
jmp Check_Mouse_Over_Controls_Loop |
Check_Mouse_Over_Controls_Loop_done: |
ret |
;****************************************************************************** |
goto_pos: |
;pusha |
mov ecx,eax ;save new position number in ecx for future |
cmp [lines],30 ;check for 'cursor' bug |
jbe .lines_less_30 |
;--------------- |
mov edx,[lines] ;if new pos is > than (lines-30) |
sub edx,30 |
cmp eax,edx |
ja .f1 |
jmp .ff |
.f1: |
mov eax,edx ;than newpos is = (lines-30) |
sub ecx,edx ;and posY=newpos-(lines-30) |
mov [posy],ecx |
.ff: |
;----------------------- |
;in eax must be string number |
mov ecx,80 |
mul ecx |
; add eax,[slines] |
; sub |
;------------------------ |
mov [post],eax |
.lines_less_30: |
call clear_screen |
call drawfile |
;popa |
ret |
;****************************************************************************** |
mask_events: |
mov eax,40 |
mov ebx,00100111b |
int 0x40 |
ret |
;****************************************************************************** |
main_cursor_move: |
;call drawwindow |
sub [mouse_x],7 |
sub [mouse_y],45 |
xor edx,edx |
mov eax,[mouse_x] |
mov ebx,6 |
div ebx ;eax=result |
mov [posx],eax |
xor edx,edx |
mov eax,dword [mouse_y] |
mov ebx,dword 10 |
div ebx ;eax=result=new posY |
;error checking ------ |
cmp [lines],dword 1 ;for "1st line" bug |
je ._do_nothing |
mov ebx,[lines] |
sub ebx,dword 1 |
cmp eax,ebx ;[lines] |
ja ._do_nothing |
;---------------------- |
mov [posy],eax |
._do_nothing: |
call clear_screen |
call drawfile |
call draw_vertical_scroll |
ret |
;****************************************************************************** |
make_fast_so: |
;=========================== |
; 1) get info about me |
mov eax,9 |
mov ebx,procinfo |
mov ecx,-1 |
int 0x40 |
; eax = number of processes |
; save process counter |
inc eax |
inc eax |
mov [proccount],eax |
mov eax,[procinfo.PID] |
mov [PID],eax |
;========================== |
mov eax,51 |
mov ebx,1 |
mov ecx,fast_so_thread_start |
mov edx,so_stack |
int 0x40 |
ret |
;****************************************************************************** |
;fast save & fast open |
draw_fastso_window: |
startwd |
colorwindow 120,100,454,70,window_Type1+0x00cccccc,0x00cccccc,cl_Black |
call draw_string00 |
drawlbut 10,40,30,20,'Save',17,cl_Grey,cl_Black |
drawlbut 50,40,30,20,'Open',18,cl_Grey,cl_Black |
drawlbut 90,40,37,20,'Close',19,cl_Grey,cl_Black |
endwd |
ret |
draw_string00: |
mov ebx,10*65536+433 |
mov ecx,10*65536+20 |
mov edx,0x00ffffff |
mov eax,13 |
int 0x40 |
push eax |
mov eax,6*65536 |
mul dword [pos00] |
add eax,10*65536+6 |
mov ebx,eax |
pop eax |
mov edx,0x6a73d0 |
int 0x40 |
mov eax,4 |
mov ebx,12*65536+17 |
mov ecx,cl_Black ;0x00000000 |
mov edx,mypath ;filename ;path |
mov esi,71 ;200 |
int 0x40 |
ret |
fast_so_thread_start: |
;copy filename to mypath |
cld |
mov esi,filename |
mov edi,mypath |
mov ecx,71 ;200 |
rep movsb |
mov edi,mypath |
mov ecx,71 ;200 |
xor eax,eax |
repne scasb |
;end copy |
call draw_fastso_window |
fastso_still: |
wtevent fred,fkey,fbut |
jmp fastso_still |
fred: |
call draw_fastso_window |
jmp fastso_still |
;====KEY |
fkey: |
mov eax,2 |
int 0x40 |
cmp ah,179 |
jne noright00 |
mov eax,[pos00] |
cmp eax,70 ;41 |
ja fastso_still |
inc eax |
mov [pos00],eax |
call draw_string00 |
jmp fastso_still |
noright00: |
cmp ah,176 |
jne noleft00 |
mov eax,[pos00] |
test eax,eax |
je fastso_still |
dec eax |
mov [pos00],eax |
call draw_string00 |
jmp fastso_still |
noleft00: |
cmp ah,182 |
jne nodelete00 |
call shiftback00 |
call draw_string00 |
jmp fastso_still |
nodelete00: |
cmp ah,8 |
jne noback00 |
mov eax,[pos00] |
test eax,eax |
je fastso_still |
dec eax |
mov [pos00],eax |
call shiftback00 |
call draw_string00 |
jmp fastso_still |
noback00: |
enter00: |
cmp ah,19 ;ctrl+s |
je fast_save |
cmp ah,15 ;ctrl+o |
je fast_open |
cmp ah,27 ;esli escape |
jne noesc00 |
jmp closethis ;to zakrivaem okno i nifiga ne delayem |
noesc00: |
cmp dword [pos00],71 ;200 ;42 |
jae fastso_still ;if pos>71 then jump to still |
;============letters================== |
;~~~~~~~TEST CODE~~~~~~~~~ |
; upper case |
shr eax,8 |
cmp eax,dword 31 |
jbe no_lit |
cmp eax,dword 95 |
jb capital |
sub eax,32 |
capital: |
;~~~~~~~~~~~~~~~~~~~~~~~~~ |
mov edi,mypath ;filename ;mypath ;**************PATHNAME |
add edi,71 ;200 ;count of letters |
mov esi,edi |
dec esi |
mov ecx,71 ;200 ;again??? |
sub ecx,[pos00] |
std |
rep movsb |
;shr eax,8 |
mov esi,mypath ;filename ;*************PATH AGAIN |
add esi,[pos00] |
mov byte [esi],al |
inc dword [pos00] |
call draw_string00 |
no_lit: |
jmp fastso_still |
;=============================== |
shiftback00: |
mov edi,mypath ;filename ;******PATH |
add edi,[pos00] |
mov esi,edi |
inc esi |
mov ecx,71 ;200 ; count??? |
sub ecx,[pos00] |
cld |
rep movsb |
ret |
;****************************************************************************** |
;====button |
fbut: |
mov eax,17 |
int 0x40 |
cmp ah,17 |
je fast_save |
cmp ah,18 |
je fast_open |
cmp ah,19 |
je closethis |
jmp fastso_still |
;****************************************************************************** |
;****************************************************************************** |
fast_open: |
call path_copy |
call set_title |
mov [to_return],1 |
call do_load_file |
jmp closethis |
fast_save: |
call path_copy |
call save_file |
call set_title |
;call copy_fpath_s |
closethis: |
mov [to_return],0 |
cmp [error_found],1 |
je @f |
call activate_main |
@@: |
mov [error_found],0 |
close |
activate_main: |
mov eax,9 |
mov ebx,procinfo |
mov ecx,[proccount] |
@@: |
dec ecx |
jz @f ; counter=0 => not found? => return |
mov eax,9 |
int 0x40 |
mov edx,[procinfo.PID] |
cmp edx,[PID] |
jne @b |
;found: ecx = process_number |
mov eax,18 |
mov ebx,3 |
int 0x40 |
mov eax,5 |
mov ebx,eax |
int 0x40 |
@@: |
ret |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
doyouwannasave: |
;****************************************************************************** |
cmp [modified],0 |
je newfile |
mov eax,55 ; beep |
mov ebx,eax |
mov esi,save_beep1 |
int 0x40 |
delay 4 |
mov eax,55 ; beep |
mov ebx,eax |
mov esi,save_beep2 |
int 0x40 |
mov eax,13 |
mov ebx,150*65536+200 |
mov ecx,100*65536+70 |
mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512 |
int 0x40 |
mov eax,38 |
mov ebx,150*65536+350 |
mov ecx,100*65536+100 |
mov edx,cl_White |
int 0x40 |
mov eax,38 |
mov ebx,150*65536+350 |
mov ecx,170*65536+170 |
mov edx,cl_White |
int 0x40 |
mov eax,38 |
mov ebx,150*65536+150 |
mov ecx,100*65536+170 |
mov edx,cl_White |
int 0x40 |
mov eax,38 |
mov ebx,350*65536+350 |
mov ecx,100*65536+170 |
mov edx,cl_White |
int 0x40 |
putlabel 190,120,'®åà ¨âì ¤®ªã¬¥â?',cl_White |
drawlbut 170,140,30,15,' ',46,[sc.work_button],cl_White |
drawlbut 230,140,30,15,'¥â',45,[sc.work_button],cl_White |
drawlbut 290,140,45,15,'⬥ ',47,[sc.work_button],cl_White |
mov [exit_wnd_on],1 |
jmp still |
;------------- |
newfile: |
;if filename is not NEWDOC## than change it to it! |
mov eax,dword [orig_filename] |
cmp dword [filename],eax ;[orig_filename] |
je @f |
cld |
mov esi,orig_filename |
mov edi,filename |
mov ecx,71 ;50 |
rep movsb |
mov edi,filename |
mov ecx,71 ;50 |
xor eax,eax |
repne scasb |
sub edi,filename |
dec edi |
mov [filename_len],edi |
@@: |
call change_fname |
call set_title |
call draw_window_for_dialogs |
call empty_work_space |
mov [lines],1 |
jmp do_load_file.restorecursor |
change_fname: |
cmp [filename+7],'9' |
jne addfname |
cmp [filename+6],'9' |
je error_creating_new_file |
mov [filename+7],'0' |
add [filename+6],0x1 |
jmp leavenow |
addfname: |
add [filename+7],0x1 |
leavenow: |
ret |
set_title: |
cmp [error2_found],1 |
je no_set_title |
mov esi, filename |
mov edi, header |
mov ecx, [filename_len] |
mov eax, ecx |
add eax, 10 |
mov [headlen], eax |
cld |
rep movsb |
mov [edi], dword ' - ' |
add edi, 3 |
mov esi, htext |
mov ecx, htext.size |
rep movsb |
call drawwindow |
no_set_title: |
mov [error2_found],0 |
ret |
draw_window_for_dialogs: |
call clear_screen |
call drawwindow |
ret |
copy_fpath: |
call mask_events |
call path_copy |
call set_title |
call draw_window_for_dialogs |
jmp do_load_file |
copy_fpath_s: |
call mask_events |
call path_copy |
call save_file |
call set_title |
call draw_window_for_dialogs |
jmp still |
path_copy: |
cld |
mov esi,mypath |
mov edi,filename |
mov ecx,250 ;71 ;50 |
rep movsb |
mov edi,filename |
mov ecx,250 ;71 ;50 |
xor eax,eax |
repne scasb |
sub edi,filename |
dec edi |
mov [filename_len],edi |
ret |
openerror: |
mov eax,360 |
mov ebx,openerrtext |
mov ecx,1 |
call alert_box |
cmp [to_return2],1 |
jne jmp_to_still |
mov [to_return2],0 |
mov [error_found],1 |
call mask_events |
ret |
saveerror: |
mov eax,390 |
mov ebx,saveerrtext |
mov ecx,1 |
call alert_box |
cmp [to_return2],0 |
je jmp_to_still |
mov [to_return2],0 |
mov [error_found],1 |
call mask_events |
ret |
;jmp still |
jmp_to_still: |
call mask_events |
jmp still |
error_creating_new_file: |
mov eax,200 |
mov ebx,newfileerror |
mov ecx,1 |
call alert_box |
jmp still |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;MENU;;;;;;;;;;;;;;;;;;;;;; |
draw_win_menu: |
;mov eax,8 |
;mov ebx,145*65536+276 |
;mov ecx,22*65536+15 |
;mov edx,00100000000000000000000000001111b |
;mov esi,0x00aaaaaa |
;int 0x40 |
mov eax,13 |
mov ebx,5*65536+497 |
mov ecx,22*65536+17 |
mov edx,[sc.work_graph] ;0x00999999 |
int 0x40 |
mov ecx,39*65536+5 |
mov edx,0x00aaaaaa |
int 0x40 |
drawlbut 5,22,70,15,' ©«',97,[sc.work_button],[sc.work_button_text] |
drawlbut 75,22,70,15,'®¤',98,[sc.work_button],[sc.work_button_text] |
drawlbut 145,22,70,15,'¥ªáâ',96,[sc.work_button],[sc.work_button_text] |
drawlbut 431,22,70,15,'¯à ¢ª ',99,[sc.work_button],[sc.work_button_text] |
ret |
draw_win_menu_file: |
call clear_screen |
call drawwindow |
;mov eax,13 |
;mov ebx,5*65536+71 |
;mov ecx,35*65536+90 |
;mov edx,[sc.grab_button];0x00999999 |
;int 0x40 |
;mov eax,38 |
;mov ebx,5*65536+35 |
;mov ecx,40*65536+47 |
;mov edx,0x00ff0000 |
;int 0x40 |
mov [menu_is_on],1 |
drawlbut 5,38,70,15,'®¢®¥ ®ª®',100,[sc.grab_button],[sc.grab_button_text] |
drawlbut 5,53,70,15,'®¢ë©',101,[sc.grab_button],[sc.grab_button_text] |
drawlbut 5,68,70,15,'®åà ¨âì',2,[sc.grab_button],[sc.grab_button_text] |
drawlbut 5,83,70,15,'®åà. ª ª',102,[sc.grab_button],[sc.grab_button_text] |
drawlbut 5,98,70,15,'âªàëâì',103,[sc.grab_button],[sc.grab_button_text] |
drawlbut 5,113,70,15,'ë室',104,[sc.grab_button],[sc.grab_button_text] |
jmp still |
draw_win_menu_code: |
call clear_screen |
call drawwindow |
drawlbut 75,38,70,15,'®¬¯¨«.',10000,[sc.grab_button],[sc.grab_button_text] |
drawlbut 75,53,70,15,' ¯ãáâ¨âì',10001,[sc.grab_button],[sc.grab_button_text] |
drawlbut 75,68,70,15,'®áª ®â«.',10002,[sc.grab_button],[sc.grab_button_text] |
drawlbut 75,83,70,15,'SysFunc',10003,[sc.grab_button],[sc.grab_button_text] |
mov [menu_is_on],1 |
jmp still |
draw_win_menu_text: |
call clear_screen |
call drawwindow |
drawlbut 145,38,70,15,'GoTo Line#',95,[sc.grab_button],[sc.grab_button_text] |
drawlbut 145,53,70,15,' ©â¨',92,[sc.grab_button],[sc.grab_button_text] |
drawlbut 145,68,70,15,' ©â¨ ¤ «¥¥',50,[sc.grab_button],[sc.grab_button_text] |
mov [menu_is_on],1 |
jmp still |
new_pad_wnd: |
mov eax,19 |
mov ebx,tinypad_filename |
mov ecx,0 |
int 0x40 |
jmp still |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
openerrtext db '訡ª ®âªàëâ¨ï ä ©« ¨«¨ ®âªàë⨥ ®â¬¥¥®!',0 |
saveerrtext db '訡ª á®åà ¥¨ï ä ©« ¨«¨ á®åà ¥¨¥ ®â¬¥¥®!',0 |
newfileerror db '¥¢®§¬®¦® á®å¤ âì ®¢ë© ä ©«',0 |
; ******************** |
; ****** DATA ****** |
; ******************** |
sz fasm_filename, 'FASM ' |
sz debug_filename, 'BOARD ' |
sz tinypad_filename, 'TINYPAD ' |
lsz sysfuncs_filename,\ |
ru, <'SYSFUNCR.TXT',0>,\ |
en, <'SYSFUNCS.TXT',0> |
sz setup, 'SETUP ' ; we need to run SETUP to change keyboard layout |
param_setup db 'LANG',0 ; parameter for SETUP |
addr dd filename ; address of input string |
filename_len dd 12 |
filename db 'NEWDOC00.TXT' |
times 256 db 0;51-12 db 0 |
;times db 0 ; ï ¥ § î ¯®ç¥¬ã ¨«« ¥ ¯®áâ ¢¨« íâã áâà®çªã |
orig_filename db 'NEWDOC00.TXT' |
rb 256 |
search_len dd 5 |
search_string db 'still' |
times 51-5 db 0 |
case_sens db 0 ; for search function |
align 4 |
comment_string: |
db ';***************************************' |
db '*************************************** ' |
; INTERFACE DATA: |
sz htext, 'TINYPAD' |
;sz toolbar_btn_text, 'COMPILE RUN BOARD SYSFUNC' |
searcht: |
if lang eq ru |
db ' > ' |
db ' ' |
else |
db ' STRING > ' |
db ' SEARCH ' |
end if |
searchtl: |
htext2: |
if lang eq ru |
db ' 00:00000 00000 ' |
else |
db 'POSITION 00:00000 LENGTH 00000 LINES ' |
end if |
htextlen2: |
help_text: |
if lang eq ru |
db ' : ' |
db ' ' |
db ' CTRL+F1 : â® ®ª® ' |
db ' CTRL+S : ¥à¢ ï áâப ¤«ï ª®¯¨à®¢ ¨ï ' |
db ' CTRL+E : ®á«¥¤ïï áâப ¤«ï ª®¯¨à®¢ ¨ï ' |
db ' CTRL+P : áâ ¢¨âì ¢ë¡à ®¥ ⥪ãéãî ¯®§¨æ¨î ' |
db ' CTRL+D : ¤ «¨âì áâபã ' |
db ' CTRL+L : áâ ¢¨âì áâபã-à §¤¥«¨â¥«ì ' |
db ' CTRL+[ : ¥à¥©â¨ ¢ ç «® ä ©« ' |
db ' CTRL+] : ¥à¥©â¨ ¢ ª®¥æ ä ©« ' |
db ' CTRL+F2 : £à㧨âì ä ©« ' |
db ' CTRL+F3 : ®¨áª ' |
db ' CTRL+F4 : ®åà ¨âì ä ©« ' |
db ' CTRL+F5 : ®åà ¨âì ä ©« ª ª... ' |
db ' CTRL+F6 : ¢¥á⨠áâப㠤«ï ¯®¨áª ' |
db ' CTRL+F7 : "ª® ¡ëáâண® á®åà ¥¨ï ¨ § £à㧪¨" ' |
db ' CTRL+F8 : ¬¥¨âì à ᪫ ¤ªã ª« ¢¨ âãàë ' |
db ' CTRL+F9 : ®¬¯¨«¨à®¢ âì ä ©« ' |
db ' CTRL+F10 : ®¬¯¨«¨à®¢ âì ¨ § ¯ãáâ¨âì ' |
db ' F12 : ¯ãáâ¨âì ¤®áªã ®â« ¤ª¨ ' |
db 'x' |
else |
db ' COMMANDS: ' |
db ' ' |
db ' CTRL+F1 : SHOW THIS WINDOW ' |
db ' CTRL+S : SELECT FIRST STRING TO COPY ' |
db ' CTRL+E : SELECT LAST STRING TO COPY ' |
db ' CTRL+P : PASTE SELECTED TO CURRENT POSITION ' |
db ' CTRL+D : DELETE CURRENT LINE ' |
db ' CTRL+L : INSERT SEPARATOR LINE ' |
db ' CTRL+[ : GO TO THE BEGINNING OF FILE ' |
db ' CTRL+] : GO TO THE END OF FILE ' |
db ' CTRL+F2 : LOAD FILE ' |
db ' CTRL+F3 : SEARCH ' |
db ' CTRL+F4 : SAVE FILE ' |
db ' CTRL+F5 : SAVE FILE AS... ' |
db ' CTRL+F6 : ENTER SEARCH STRING ' |
db ' CTRL+F7 : DRAW "FAST SAVE AND OPEN" WINDOW ' |
db ' CTRL+F8 : CHANGE KEYBOARD LAYOUT ' |
db ' CTRL+F9 : COMPILE FILE ' |
db ' CTRL+F10 : RUN OUTFILE ' |
db ' F12 : OPEN DEBUG BOARD ' |
db 'x' |
end if |
help_wnd_header: |
if lang eq ru |
db '',0 |
else |
db 'TINYPAD HELP',0 |
end if |
hlphead_len = $ - help_wnd_header |
save_yes_no: |
if lang eq ru |
db '®åà ¨âì ä ©« ¯¥à¥¤ ¢ë室®¬?',0 |
else |
db 'Save file before exit?',0 |
end if |
VScroll_1: |
dw 13 ;width +0 |
dw 489 ;x +2 |
dw 341 ;326 ;height +4 |
dw 43 ;y +6 |
dd 0 ;min +8 |
dd 100 ;scrl_max ;lines ;max +12 |
dd 0 ;cur_pos ;current +16 |
dd 1 ;small change +20 |
dd 10 ;big change +24 |
App_Controls: |
dd VScroll_1 , drawvscroll, VScroll_mouse_over ; |
dd 0,0,0 ;last control do not delete |
; END OF INTERFACE DATA |
symbols db '%#&*\:/<>|{}()[]=+-,. ' |
error_beep: |
db 0xA0,0x30,0 |
save_beep1: |
db 0x84,0x43,0 |
save_beep2: |
db 0x84,0x48,0 |
align 4 |
fileinfo_read: |
dd 0 |
dd 0 |
dd 300000/512 |
dd 0x10000 |
dd 0x70000 |
pathfile_read: |
times 250 db 0 ;51 db 0 |
align 4 |
fileinfo_write: |
dd 1 |
dd 0 |
dd 0 |
dd 0x10000 |
dd 0x70000 |
pathfile_write: |
times 250 db 0 ; 51 db 0 |
align 4 |
temp dd 0xabc ; used in read_string |
d_status dd 0 |
color_tbl: |
dd 0x00000000 ; text |
dd 0x00000000 ; instruction |
dd 0x00000000 ; register |
dd 0x00009000 ; number |
dd 0x00a00000 ; quote |
dd 0x00909090 ; comment |
dd 0x003030f0 ; symbol |
next_not_quote2 db 0 ; " |
next_not_quote db 0 ; ' |
quote db 0 |
asm_mode db 0 ; ASM highlight? |
tmpabc db 0 |
I_PARAM db 0 ; parameters are HERE - ¯ à ¬¥âàë ¡ã¤ãâ ç¨ âìáï ! |
TINYPAD_END: ; end of file |
; Uninitialised data |
; ¥¨¨æ¨ «¨§¨à®¢ ë¥ ¤ ë¥ |
align 4 |
posx dd ? ; x íªà ¥ (on the screen) |
posy dd ? ; y íªà ¥ |
post dd ? ; ᬥ饨¥ ®â ç « - offset |
posl dd ? |
lines dd ? ; ª®«¨ç¥á⢮ áâப ¢ ¤®ªã¬¥â¥ |
posxm dd ? |
posym dd ? |
dstart dd ? ; ᬥ饨¥ ¯® ®á¨ y ¤«ï ®âà¨á®¢ª¨ ª®¯®ª ¨ ¤à. |
filelen dd ? ; ¤«¨ ä ©« |
PID dd ? ; ¨¤¥â¨ä¨ª â®à ¯à®æ¥áá |
proccount dd ? ; ª®«¨ç¥á⢮ ¯à®æ¥áᮢ |
filesize dd ? ; à §¬¥à ä ©« |
ya dd ? ; ¤«ï read_string |
slines dd ? ; number of strings on the screen - ª®«¨ç¥á⢮ áâப íªà ¥ |
run_outfile dd ? ; for FASM |
copy_start dd ? ; Ctrl+S |
copy_count dd ? ; Ctrl+E |
headlen dd ? ; header length |
do_not_draw dd ? ; to draw or not to draw - this is a serious question ;) |
MainWndClosed dd ? |
sc system_colors |
to_return db 0 |
to_return2 db 0 |
error_found db 0 |
error2_found db 0 |
header: ; window header - § £®«®¢®ª ®ª |
rb 256 |
; ¨ä®à¬ æ¨ï ® ¯à®æ¥áᥠ§ ¯¨áë¢ ¥âáï ¢ íâã áâàãªâãàã |
procinfo process_information |
virtual at procinfo |
fasm_parameters rb 256 |
end virtual |
pos00 dd 0 |
newdoc db ? |
mypath: |
times 258 db 0 |
real_posy dd 0 |
vscroll_size dd 0 |
vscroll_pos dd 0 |
cur_pos dd 0 |
scrl_max dd 100 |
mouse_x dd 0 |
mouse_y dd 0 |
mousey dw 0 |
mousex dw 0 |
mouseb dd 0 |
num_goto_string dd 0 |
menu_is_on db 0 |
exit_wnd_on db 0 |
modified db 0 |
;fast save n open stack |
rb 1024 |
so_stack: |
;growing down |
; the end! |