other/outdated
git-svn-id: svn://kolibrios.org@3122 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
c2c84028ec
commit
7dfe6ad257
@ -1,176 +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 £.
|
||||
<20> ¯¨á ç¨á⮬ áᥬ¡«¥à¥ ˆ¢ãèª¨ë¬ €¤à¥¥¬ (Willow)
|
||||
|
||||
Deflate à ᯠª®¢é¨ª
|
||||
|
||||
Vivat assembler et MenuetOS!
|
||||
‚ëà ¦ î ¨áªà¥îî ¡« £®¤ à®áâì ¢á¥¬ ⥬, ªâ® ¥ ¦ «¥ï ᢮¥£® ¢à¥¬¥¨,
|
||||
¤¥« ¥â ¯®á¨«ìë© ¢ª« ¤ ¢ à §¢¨â¨¥ í⮩ ¬ «¥ìª®© Ž‘. ‘¥©ç á ¢ ¬®¥¬ ᮡá⢥®¬
|
||||
३⨣¥ 1-¥ ¬¥áâ® § ¨¬ ¥â ¤¨áâਡã⨢ Mario79 Kolibri4. ‚ᥣ¤ ¯à¨ïâ®
|
||||
¯®«ì§®¢ âìáï ᮢ६¥ë¬ <20>Ž. ’ ª ¤¥à¦ âì!
|
||||
|
||||
@RCHER ¯à¥¤ § ç¥ ¤«ï ¯à®á¬®âà ¨ à ᯠª®¢ª¨ ¤ ëå, ᦠâëå á ¯®¬®éìî ¬¥â®¤
|
||||
Deflate (¢ª«îç ï áâ â¨ç¥áª¨© ¨ ¤¨ ¬¨ç¥áª¨© • ää¬ ). „ ë¬ ¬¥â®¤®¬ (å®âï ®
|
||||
㦥 ¥ ¯à¥â¥¤ã¥â §¢ ¨¥ ¨«ãç襣®) ¯®«ì§ãîâáï ä®à¬ âë ä ©«®¢ ZIP
|
||||
(ᮢ६¥ë¥ ¢¥àᨨ: PKZIP ¤«ï MS-DOS ¬®¦¥â ᮧ¤ ¢ âì à娢ë á ¤à㣨¬¨, ¬¥¥¥
|
||||
íä䥪⨢묨 ¬¥â®¤ ¬¨ ᦠâ¨ï, ª®â®àë¥ @RCHER ¥ ¯®¤¤¥à¦¨¢ ¥â), GZIP, JAR,
|
||||
ä ©«ë OpenOffice, SFX-ZIP ¯à¨«®¦¥¨ï ¨ àï¤ ¤à㣨å. Ÿ ¥ ¬®£ 㤥ঠâìáï ¨ ¥
|
||||
ᤥ« âì ¯®¤¤¥à¦ªã ¨§®¡à ¦¥¨© ¢ ä®à¬ ⥠PNG (¨á¯®«ì§ãîé¨å தáâ¢¥ë© ¬¥â®¤
|
||||
ᦠâ¨ï) ¨ à娢®¢ TAR ¨ TAR+GZIP.
|
||||
|
||||
<EFBFBD>ਠ§ ¯ã᪥ ¯à®£à ¬¬ë ¢ «¥¢®¬ ¢¥à奬 㣫ã íªà ¯®ï¢«ï¥âáï ¬ «¥ìª ï ª®¯ª
|
||||
á® § 窮¬ @. <20>ਠ¦ ⨨ ¥¥ ®âªàë¢ ¥âáï ®ª® ¢ë¡®à ä ©« (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
|
||||
¡ ©â ª®¬ ¤®© áâப¨.
|
||||
|
||||
<EFBFBD>ਬ¥à ª®¬ ¤®© áâப¨:
|
||||
|
||||
cmd_string:
|
||||
db 'sN000037q'
|
||||
dd 1465
|
||||
db '/hd/1/png.zip',0
|
||||
|
||||
<EFBFBD>â® ®§ ç ¥â, çâ® á«¥¤ã¥â ®âªàëâì 34-© (áç¨â ï ®â 0) ä ©« à娢 /hd/1/png.zip
|
||||
¨ ¥ § ¢¥àè âì à ¡®âã. <20>à®á¬®âà à娢 ç¥âáï ᮠᬥ饨ï 1465.
|
||||
|
||||
|
||||
—â® ¥é¥ 㦮 ᤥ« âì:
|
||||
|
||||
1. <20>®¤¤¥à¦ª ç¥à¥ááâà®çëå (interlaced) PNG, â ª¦¥ «ìä -ª «®¢, £ ¬¬ë,
|
||||
ä® , Significant bits ¨ ªãç¨ ¤àã£¨å ¯à¨¬®ç¥ª í⮣® ä®à¬ â .
|
||||
2. ‚뢮¤ ᮤ¥à¦¨¬®£® à娢®¢ ç¥à¥§ IPC ¨«¨ ¢® ¢áâ஥®¬ ®ª¥ ¯®¤®¡¨¥ SYSTREE
|
||||
(íâ® ª ª à¥è¨¬ á 㢠¦ ¥¬ë¬¨ ª®««¥£ ¬¨).
|
||||
3. <20>®¨áª ä ©«®¢ ¢ à娢¥ ¯® ¨¬¥¨ ¨ ¤ ¦¥ ¬ ᪥!
|
||||
4. <20> ᯠª®¢ª ¢ 㪠§ ë© ä ©«.
|
||||
5. Œ¥à®¯à¨ïâ¨ï ¯® íª®®¬¨¨ ¯ ¬ï⨠(ᥩç á @RCHER ¦à¥â 8 Œ¡!): ¯¥à¥¬¥é¥¨¥
|
||||
ãç á⪮¢ ¯ ¬ïâ¨, ¡«®çë© ¢ë¢®¤ ¢ ä ©«. „«ï ¯®á«¥¤¥£® ¥®¡å®¤¨¬® âé ⥫ì®
|
||||
¯à®â¥áâ¨à®¢ âì ¤¥¦®áâì ¢®®¤ -¢ë¢®¤ †„, ᮧ¤ ¨ï ª â «®£®¢ ¨ 㤠«¥¨ï
|
||||
ä ©«®¢. <20>®ª í⨠¢®§¬®¦®á⨠ï¤à ¥ ¤®ªã¬¥â¨à®¢ ë.
|
||||
6. ˆâ¥£à æ¨ï à娢ëå ª â «®£®¢ ¢ ä ©«®¢ë¥ ¬¥¥¤¦¥àë SYSXTREE, MFAR.
|
||||
<20>®âॡã¥âáï ã¨ä¨æ¨à®¢ âì ä®à¬ ⠢맮¢ ( ¯®¤®¡¨¥ áâàãªâãàë ¢ 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
|
||||
|
||||
„® ®¢ëå ¢áâà¥ç!
|
||||
@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 £.
|
||||
<20> ¯¨á ç¨á⮬ áᥬ¡«¥à¥ ˆ¢ãèª¨ë¬ €¤à¥¥¬ (Willow)
|
||||
|
||||
Deflate à ᯠª®¢é¨ª
|
||||
|
||||
Vivat assembler et MenuetOS!
|
||||
‚ëà ¦ î ¨áªà¥îî ¡« £®¤ à®áâì ¢á¥¬ ⥬, ªâ® ¥ ¦ «¥ï ᢮¥£® ¢à¥¬¥¨,
|
||||
¤¥« ¥â ¯®á¨«ìë© ¢ª« ¤ ¢ à §¢¨â¨¥ í⮩ ¬ «¥ìª®© Ž‘. ‘¥©ç á ¢ ¬®¥¬ ᮡá⢥®¬
|
||||
३⨣¥ 1-¥ ¬¥áâ® § ¨¬ ¥â ¤¨áâਡã⨢ Mario79 Kolibri4. ‚ᥣ¤ ¯à¨ïâ®
|
||||
¯®«ì§®¢ âìáï ᮢ६¥ë¬ <20>Ž. ’ ª ¤¥à¦ âì!
|
||||
|
||||
@RCHER ¯à¥¤ § ç¥ ¤«ï ¯à®á¬®âà ¨ à ᯠª®¢ª¨ ¤ ëå, ᦠâëå á ¯®¬®éìî ¬¥â®¤
|
||||
Deflate (¢ª«îç ï áâ â¨ç¥áª¨© ¨ ¤¨ ¬¨ç¥áª¨© • ää¬ ). „ ë¬ ¬¥â®¤®¬ (å®âï ®
|
||||
㦥 ¥ ¯à¥â¥¤ã¥â §¢ ¨¥ ¨«ãç襣®) ¯®«ì§ãîâáï ä®à¬ âë ä ©«®¢ ZIP
|
||||
(ᮢ६¥ë¥ ¢¥àᨨ: PKZIP ¤«ï MS-DOS ¬®¦¥â ᮧ¤ ¢ âì à娢ë á ¤à㣨¬¨, ¬¥¥¥
|
||||
íä䥪⨢묨 ¬¥â®¤ ¬¨ ᦠâ¨ï, ª®â®àë¥ @RCHER ¥ ¯®¤¤¥à¦¨¢ ¥â), GZIP, JAR,
|
||||
ä ©«ë OpenOffice, SFX-ZIP ¯à¨«®¦¥¨ï ¨ àï¤ ¤à㣨å. Ÿ ¥ ¬®£ 㤥ঠâìáï ¨ ¥
|
||||
ᤥ« âì ¯®¤¤¥à¦ªã ¨§®¡à ¦¥¨© ¢ ä®à¬ ⥠PNG (¨á¯®«ì§ãîé¨å தáâ¢¥ë© ¬¥â®¤
|
||||
ᦠâ¨ï) ¨ à娢®¢ TAR ¨ TAR+GZIP.
|
||||
|
||||
<EFBFBD>ਠ§ ¯ã᪥ ¯à®£à ¬¬ë ¢ «¥¢®¬ ¢¥à奬 㣫ã íªà ¯®ï¢«ï¥âáï ¬ «¥ìª ï ª®¯ª
|
||||
á® § 窮¬ @. <20>ਠ¦ ⨨ ¥¥ ®âªàë¢ ¥âáï ®ª® ¢ë¡®à ä ©« (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
|
||||
¡ ©â ª®¬ ¤®© áâப¨.
|
||||
|
||||
<EFBFBD>ਬ¥à ª®¬ ¤®© áâப¨:
|
||||
|
||||
cmd_string:
|
||||
db 'sN000037q'
|
||||
dd 1465
|
||||
db '/hd/1/png.zip',0
|
||||
|
||||
<EFBFBD>â® ®§ ç ¥â, çâ® á«¥¤ã¥â ®âªàëâì 34-© (áç¨â ï ®â 0) ä ©« à娢 /hd/1/png.zip
|
||||
¨ ¥ § ¢¥àè âì à ¡®âã. <20>à®á¬®âà à娢 ç¥âáï ᮠᬥ饨ï 1465.
|
||||
|
||||
|
||||
—â® ¥é¥ 㦮 ᤥ« âì:
|
||||
|
||||
1. <20>®¤¤¥à¦ª ç¥à¥ááâà®çëå (interlaced) PNG, â ª¦¥ «ìä -ª «®¢, £ ¬¬ë,
|
||||
ä® , Significant bits ¨ ªãç¨ ¤àã£¨å ¯à¨¬®ç¥ª í⮣® ä®à¬ â .
|
||||
2. ‚뢮¤ ᮤ¥à¦¨¬®£® à娢®¢ ç¥à¥§ IPC ¨«¨ ¢® ¢áâ஥®¬ ®ª¥ ¯®¤®¡¨¥ SYSTREE
|
||||
(íâ® ª ª à¥è¨¬ á 㢠¦ ¥¬ë¬¨ ª®««¥£ ¬¨).
|
||||
3. <20>®¨áª ä ©«®¢ ¢ à娢¥ ¯® ¨¬¥¨ ¨ ¤ ¦¥ ¬ ᪥!
|
||||
4. <20> ᯠª®¢ª ¢ 㪠§ ë© ä ©«.
|
||||
5. Œ¥à®¯à¨ïâ¨ï ¯® íª®®¬¨¨ ¯ ¬ï⨠(ᥩç á @RCHER ¦à¥â 8 Œ¡!): ¯¥à¥¬¥é¥¨¥
|
||||
ãç á⪮¢ ¯ ¬ïâ¨, ¡«®çë© ¢ë¢®¤ ¢ ä ©«. „«ï ¯®á«¥¤¥£® ¥®¡å®¤¨¬® âé ⥫ì®
|
||||
¯à®â¥áâ¨à®¢ âì ¤¥¦®áâì ¢®®¤ -¢ë¢®¤ †„, ᮧ¤ ¨ï ª â «®£®¢ ¨ 㤠«¥¨ï
|
||||
ä ©«®¢. <20>®ª í⨠¢®§¬®¦®á⨠ï¤à ¥ ¤®ªã¬¥â¨à®¢ ë.
|
||||
6. ˆâ¥£à æ¨ï à娢ëå ª â «®£®¢ ¢ ä ©«®¢ë¥ ¬¥¥¤¦¥àë SYSXTREE, MFAR.
|
||||
<20>®âॡã¥âáï ã¨ä¨æ¨à®¢ âì ä®à¬ ⠢맮¢ ( ¯®¤®¡¨¥ áâàãªâãàë ¢ 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
|
||||
|
||||
„® ®¢ëå ¢áâà¥ç!
|
@ -1,439 +1,439 @@
|
||||
; @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
|
||||
'<27>¥â ä ©« á â ª¨¬ ®¬¥à®¬',\ ;4
|
||||
<'FindByNumber ŽŠ',13,10>,\ ;5
|
||||
<'<27>¥¢¥àë© ID ¡«®ª • ää¬ ',13,10>,\ ;6
|
||||
<'Žè¨¡ª ¢ ª®¤ å • ää¬ !',13,10>,\ ;7
|
||||
<13,10,'<27> áç¥â â ¡«¨æë CRC32',13,10>,\ ;8
|
||||
'.',\ ;9
|
||||
'Adler32',\ ;10
|
||||
'CRC32',\ ;11
|
||||
<'‡ ¢¥à襮.',13,10>,\ ;12
|
||||
<'” ©« ¨¬¥¥â ã«¥¢ãî ¤«¨ã, à ᯠª®¢ª ®â¬¥¥ .',13,10>,\ ;13
|
||||
<'‘âà ï ¤«¨ ä ©« -¨áâ®ç¨ª . Žè¨¡ª ¢ ¨¬¥¨? Žâ¬¥ .',13,10>,\ ;14
|
||||
<'<27>¥ GZIP à娢',13,10>,\ ;15
|
||||
<'‘«¨èª®¬ ¡®«ì让 à §¬¥à ¢ë室®£® ä ©« ',13,10>,\ ;16
|
||||
<"Žè¨¡ª ¯à¨ à ᯠª®¢ª¥.",13,10>,\ ; 17
|
||||
<'<27>¥ à¨á㮪 PNG',13,10>,\ ; 18
|
||||
<13,10,'*¤'>,\ ;19
|
||||
<13,10,'*á'>,\ ;20
|
||||
'<27>¥®¦¨¤ ë© ª®¥æ ¡«®ª®¢ IDAT',\ ;21
|
||||
'„¥ä¨«ìâà æ¨ï:',\ ;22
|
||||
'”¨«ìâàë: None ',\ ;23
|
||||
' Sub ',\ ;24
|
||||
' Up ',\ ;25
|
||||
' Avg ',\ ;26
|
||||
' Paeth ',\ ;27
|
||||
' Žè¨¡®ª: ',\ ;28
|
||||
<'—¥à¥ááâà®çë© PNG',13,10>,\ ;29
|
||||
<'<27>«®ª ¡¥§ ᦠâ¨ï',13,10>,\ ;30
|
||||
<'’¨¯ 梥⠥ ¯®¤¤¥à¦¨¢ ¥âáï',13,10>,\ ;31
|
||||
<'‚¢¥¤¨â¥ ¯ à®«ì ¤«ï § è¨ä஢ ®£® ä ©« :',13,10>,\ ;32
|
||||
<'<27>®¨áª ä ©« ...',13,10>,\ ;33
|
||||
'<27>¥ ¬®¤ã«ì SFX',\ ;34
|
||||
' ¥¢¥à ! ',\ ;35
|
||||
' OK: ',\ ;36
|
||||
<'‡ ¯¨áì OUT.TXT',13,10>,\ ;37
|
||||
' ',\ ;38
|
||||
<'<27>®¤£®â®¢ª ¨§®¡à ¦¥¨ï...',13,10>,\ ;39
|
||||
<'“ª ¦¨â¥ "R" ¤«ï ®¡à ¡®âª¨ áëàëå ¤ ëå. Žâ¬¥ .',13,10>,\ ;40
|
||||
<'<27>¥ å¢ â ¥â ¯ ¬ïâ¨! Žâ¬¥ .',13,10>,\ ; 41
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' <- ¥¨§¢¥áâë© ¬¥â®¤ ᦠâ¨ï',\ ;50
|
||||
' <- § è¨ä஢ ',\ ;51
|
||||
<'<27>¥ 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
|
||||
<'Not enough memory! Abort.',13,10>,\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' <- 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,(1024+16)/4
|
||||
rep stosd
|
||||
|
||||
;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,1024+16 ; size
|
||||
mcall
|
||||
|
||||
mcall 40,1000111b
|
||||
;
|
||||
; STEP 3 run SYSTEM XTREE with parameters
|
||||
;
|
||||
|
||||
mcall 70,run_fileinfo
|
||||
|
||||
call redproc
|
||||
|
||||
mov [get_loops],0
|
||||
getmesloop:
|
||||
mov eax,23
|
||||
mov ebx,50 ;0.5 sec
|
||||
mcall
|
||||
dec eax
|
||||
jz mred
|
||||
dec eax
|
||||
jz mkey
|
||||
dec eax
|
||||
jz mbutton
|
||||
cmp al, 7-3
|
||||
jz 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
|
||||
mcall
|
||||
cmp ah,1 ; button id=1 ?
|
||||
jne getmesloop
|
||||
mov eax,-1 ; close this program
|
||||
mcall
|
||||
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 1024 bytes path to SAVE/OPEN file
|
||||
; shl path string on 16 bytes
|
||||
;
|
||||
cld
|
||||
mov esi,path+16
|
||||
mov edi,path
|
||||
mov ecx,1024/4
|
||||
rep movsd
|
||||
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 7
|
||||
dd 0
|
||||
dd param
|
||||
dd 0
|
||||
dd 0
|
||||
;run_filepath
|
||||
db '/sys/SYSXTREE',0
|
||||
|
||||
}
|
||||
|
||||
; @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
|
||||
'<27>¥â ä ©« á â ª¨¬ ®¬¥à®¬',\ ;4
|
||||
<'FindByNumber ŽŠ',13,10>,\ ;5
|
||||
<'<27>¥¢¥àë© ID ¡«®ª • ää¬ ',13,10>,\ ;6
|
||||
<'Žè¨¡ª ¢ ª®¤ å • ää¬ !',13,10>,\ ;7
|
||||
<13,10,'<27> áç¥â â ¡«¨æë CRC32',13,10>,\ ;8
|
||||
'.',\ ;9
|
||||
'Adler32',\ ;10
|
||||
'CRC32',\ ;11
|
||||
<'‡ ¢¥à襮.',13,10>,\ ;12
|
||||
<'” ©« ¨¬¥¥â ã«¥¢ãî ¤«¨ã, à ᯠª®¢ª ®â¬¥¥ .',13,10>,\ ;13
|
||||
<'‘âà ï ¤«¨ ä ©« -¨áâ®ç¨ª . Žè¨¡ª ¢ ¨¬¥¨? Žâ¬¥ .',13,10>,\ ;14
|
||||
<'<27>¥ GZIP à娢',13,10>,\ ;15
|
||||
<'‘«¨èª®¬ ¡®«ì让 à §¬¥à ¢ë室®£® ä ©« ',13,10>,\ ;16
|
||||
<"Žè¨¡ª ¯à¨ à ᯠª®¢ª¥.",13,10>,\ ; 17
|
||||
<'<27>¥ à¨á㮪 PNG',13,10>,\ ; 18
|
||||
<13,10,'*¤'>,\ ;19
|
||||
<13,10,'*á'>,\ ;20
|
||||
'<27>¥®¦¨¤ ë© ª®¥æ ¡«®ª®¢ IDAT',\ ;21
|
||||
'„¥ä¨«ìâà æ¨ï:',\ ;22
|
||||
'”¨«ìâàë: None ',\ ;23
|
||||
' Sub ',\ ;24
|
||||
' Up ',\ ;25
|
||||
' Avg ',\ ;26
|
||||
' Paeth ',\ ;27
|
||||
' Žè¨¡®ª: ',\ ;28
|
||||
<'—¥à¥ááâà®çë© PNG',13,10>,\ ;29
|
||||
<'<27>«®ª ¡¥§ ᦠâ¨ï',13,10>,\ ;30
|
||||
<'’¨¯ 梥⠥ ¯®¤¤¥à¦¨¢ ¥âáï',13,10>,\ ;31
|
||||
<'‚¢¥¤¨â¥ ¯ à®«ì ¤«ï § è¨ä஢ ®£® ä ©« :',13,10>,\ ;32
|
||||
<'<27>®¨áª ä ©« ...',13,10>,\ ;33
|
||||
'<27>¥ ¬®¤ã«ì SFX',\ ;34
|
||||
' ¥¢¥à ! ',\ ;35
|
||||
' OK: ',\ ;36
|
||||
<'‡ ¯¨áì OUT.TXT',13,10>,\ ;37
|
||||
' ',\ ;38
|
||||
<'<27>®¤£®â®¢ª ¨§®¡à ¦¥¨ï...',13,10>,\ ;39
|
||||
<'“ª ¦¨â¥ "R" ¤«ï ®¡à ¡®âª¨ áëàëå ¤ ëå. Žâ¬¥ .',13,10>,\ ;40
|
||||
<'<27>¥ å¢ â ¥â ¯ ¬ïâ¨! Žâ¬¥ .',13,10>,\ ; 41
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' <- ¥¨§¢¥áâë© ¬¥â®¤ ᦠâ¨ï',\ ;50
|
||||
' <- § è¨ä஢ ',\ ;51
|
||||
<'<27>¥ 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
|
||||
<'Not enough memory! Abort.',13,10>,\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' ',\ ;
|
||||
' <- 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,(1024+16)/4
|
||||
rep stosd
|
||||
|
||||
;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,1024+16 ; size
|
||||
mcall
|
||||
|
||||
mcall 40,1000111b
|
||||
;
|
||||
; STEP 3 run SYSTEM XTREE with parameters
|
||||
;
|
||||
|
||||
mcall 70,run_fileinfo
|
||||
|
||||
call redproc
|
||||
|
||||
mov [get_loops],0
|
||||
getmesloop:
|
||||
mov eax,23
|
||||
mov ebx,50 ;0.5 sec
|
||||
mcall
|
||||
dec eax
|
||||
jz mred
|
||||
dec eax
|
||||
jz mkey
|
||||
dec eax
|
||||
jz mbutton
|
||||
cmp al, 7-3
|
||||
jz 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
|
||||
mcall
|
||||
cmp ah,1 ; button id=1 ?
|
||||
jne getmesloop
|
||||
mov eax,-1 ; close this program
|
||||
mcall
|
||||
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 1024 bytes path to SAVE/OPEN file
|
||||
; shl path string on 16 bytes
|
||||
;
|
||||
cld
|
||||
mov esi,path+16
|
||||
mov edi,path
|
||||
mov ecx,1024/4
|
||||
rep movsd
|
||||
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 7
|
||||
dd 0
|
||||
dd param
|
||||
dd 0
|
||||
dd 0
|
||||
;run_filepath
|
||||
db '/sys/SYSXTREE',0
|
||||
|
||||
}
|
||||
|
@ -1,182 +1,182 @@
|
||||
; @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 2
|
||||
dd 0
|
||||
dd 0
|
||||
.size dd 0
|
||||
.out dd output
|
||||
if ~SYS eq win
|
||||
dumpfile:
|
||||
db DUMPFILE,0
|
||||
dumpf_len=$-dumpfile
|
||||
end if
|
||||
attrinfo:
|
||||
dd 5
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd fileattr
|
||||
db 0
|
||||
dd filename
|
||||
Finfo:
|
||||
dd 0
|
||||
.block dd 0
|
||||
dd 0
|
||||
.count dd BUFSIZE*1024
|
||||
.ptr dd BUFPTR
|
||||
|
||||
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
|
||||
I_END:
|
||||
rb 1024+16-($-filename)
|
||||
|
||||
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
|
||||
|
||||
if ~SYS eq win
|
||||
fileattr rd 40/4
|
||||
end if
|
||||
|
||||
png_ dd ?
|
||||
fat_ dd ?
|
||||
fat_fnum dd ?
|
||||
lpath dd ?
|
||||
lpath_len dd ?
|
||||
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 ?
|
||||
|
||||
align 4
|
||||
fat:
|
||||
rb 4096;512
|
||||
child_stack:
|
||||
rb 1024
|
||||
child_stack_top:
|
||||
main_stack:
|
||||
rb 1024
|
||||
main_stack_top:
|
||||
area:
|
||||
rb INBUF
|
||||
os_work rb 4*1024
|
||||
|
||||
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
|
||||
|
||||
output:
|
||||
;rb OUTBUF
|
||||
|
||||
;png_image:
|
||||
if SYS eq win
|
||||
rb OUTBUF
|
||||
end if
|
||||
; @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 2
|
||||
dd 0
|
||||
dd 0
|
||||
.size dd 0
|
||||
.out dd output
|
||||
if ~SYS eq win
|
||||
dumpfile:
|
||||
db DUMPFILE,0
|
||||
dumpf_len=$-dumpfile
|
||||
end if
|
||||
attrinfo:
|
||||
dd 5
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd fileattr
|
||||
db 0
|
||||
dd filename
|
||||
Finfo:
|
||||
dd 0
|
||||
.block dd 0
|
||||
dd 0
|
||||
.count dd BUFSIZE*1024
|
||||
.ptr dd BUFPTR
|
||||
|
||||
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
|
||||
I_END:
|
||||
rb 1024+16-($-filename)
|
||||
|
||||
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
|
||||
|
||||
if ~SYS eq win
|
||||
fileattr rd 40/4
|
||||
end if
|
||||
|
||||
png_ dd ?
|
||||
fat_ dd ?
|
||||
fat_fnum dd ?
|
||||
lpath dd ?
|
||||
lpath_len dd ?
|
||||
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 ?
|
||||
|
||||
align 4
|
||||
fat:
|
||||
rb 4096;512
|
||||
child_stack:
|
||||
rb 1024
|
||||
child_stack_top:
|
||||
main_stack:
|
||||
rb 1024
|
||||
main_stack_top:
|
||||
area:
|
||||
rb INBUF
|
||||
os_work rb 4*1024
|
||||
|
||||
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
|
||||
|
||||
output:
|
||||
;rb OUTBUF
|
||||
|
||||
;png_image:
|
||||
if SYS eq win
|
||||
rb OUTBUF
|
||||
end if
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,357 +1,357 @@
|
||||
; @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
|
||||
and dword [attrinfo+32], 0
|
||||
mcall 70,attrinfo
|
||||
mov eax,[attrinfo+32]
|
||||
mov [filesize],ebx
|
||||
mcall 70,Finfo
|
||||
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
|
||||
sub esi,BUFPTR
|
||||
add esi,[Finfo.block]
|
||||
cmp ebx,1
|
||||
je .cur
|
||||
jb .begin
|
||||
mov esi,[filesize]
|
||||
not eax
|
||||
.cur:
|
||||
add eax,esi
|
||||
.begin:
|
||||
mov esi,BUFPTR
|
||||
mov [Finfo.block],eax
|
||||
if SYS eq win
|
||||
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*1024
|
||||
mcall 70,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,child_stack_top;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
|
||||
.ext:
|
||||
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
|
||||
mcall 71,1,filename,255 ;by Leency
|
||||
mov ecx,[PNG_info.Width]
|
||||
shl ecx,16
|
||||
add ecx,[PNG_info.Height]
|
||||
mcall 7,[png_],,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 64,1,MEMINIT
|
||||
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
|
||||
dec esi
|
||||
mov ecx,255
|
||||
mov edi,filename
|
||||
rep movsb
|
||||
jmp again;cmdl
|
||||
.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:
|
||||
cmp al,'L'
|
||||
jne .nolist
|
||||
or [Flags],LIST_MODE
|
||||
.nolist:
|
||||
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:
|
||||
pusha
|
||||
mov esi,[outfile.size]
|
||||
; dpd esi
|
||||
; convert number in esi to decimal representation
|
||||
mov ecx, 10
|
||||
push -'0'
|
||||
mov eax, esi
|
||||
@@:
|
||||
xor edx, edx
|
||||
div ecx
|
||||
push edx
|
||||
test eax, eax
|
||||
jnz @b
|
||||
mov edi, par_fsize
|
||||
@@:
|
||||
pop eax
|
||||
add al, '0'
|
||||
stosb
|
||||
jnz @b
|
||||
mcall 70,fileinfo
|
||||
mov ecx,eax
|
||||
mcall 5,20
|
||||
mcall 60,2,,[outfile.out];output
|
||||
mcall 64,1,MEMINIT
|
||||
popa
|
||||
ret
|
||||
|
||||
fileinfo:
|
||||
dd 7
|
||||
dd 0
|
||||
dd editor_par
|
||||
dd 0
|
||||
dd 0
|
||||
db '/sys/TINYPAD',0
|
||||
editor_par db '*'
|
||||
par_fsize rb 11
|
||||
; @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
|
||||
and dword [attrinfo+32], 0
|
||||
mcall 70,attrinfo
|
||||
mov eax,[attrinfo+32]
|
||||
mov [filesize],ebx
|
||||
mcall 70,Finfo
|
||||
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
|
||||
sub esi,BUFPTR
|
||||
add esi,[Finfo.block]
|
||||
cmp ebx,1
|
||||
je .cur
|
||||
jb .begin
|
||||
mov esi,[filesize]
|
||||
not eax
|
||||
.cur:
|
||||
add eax,esi
|
||||
.begin:
|
||||
mov esi,BUFPTR
|
||||
mov [Finfo.block],eax
|
||||
if SYS eq win
|
||||
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*1024
|
||||
mcall 70,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,child_stack_top;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
|
||||
.ext:
|
||||
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
|
||||
mcall 71,1,filename,255 ;by Leency
|
||||
mov ecx,[PNG_info.Width]
|
||||
shl ecx,16
|
||||
add ecx,[PNG_info.Height]
|
||||
mcall 7,[png_],,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 64,1,MEMINIT
|
||||
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
|
||||
dec esi
|
||||
mov ecx,255
|
||||
mov edi,filename
|
||||
rep movsb
|
||||
jmp again;cmdl
|
||||
.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:
|
||||
cmp al,'L'
|
||||
jne .nolist
|
||||
or [Flags],LIST_MODE
|
||||
.nolist:
|
||||
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:
|
||||
pusha
|
||||
mov esi,[outfile.size]
|
||||
; dpd esi
|
||||
; convert number in esi to decimal representation
|
||||
mov ecx, 10
|
||||
push -'0'
|
||||
mov eax, esi
|
||||
@@:
|
||||
xor edx, edx
|
||||
div ecx
|
||||
push edx
|
||||
test eax, eax
|
||||
jnz @b
|
||||
mov edi, par_fsize
|
||||
@@:
|
||||
pop eax
|
||||
add al, '0'
|
||||
stosb
|
||||
jnz @b
|
||||
mcall 70,fileinfo
|
||||
mov ecx,eax
|
||||
mcall 5,20
|
||||
mcall 60,2,,[outfile.out];output
|
||||
mcall 64,1,MEMINIT
|
||||
popa
|
||||
ret
|
||||
|
||||
fileinfo:
|
||||
dd 7
|
||||
dd 0
|
||||
dd editor_par
|
||||
dd 0
|
||||
dd 0
|
||||
db '/sys/TINYPAD',0
|
||||
editor_par db '*'
|
||||
par_fsize rb 11
|
||||
end if
|
5
programs/other/outdated/gifview/trunk/build_en.bat
Normal file
5
programs/other/outdated/gifview/trunk/build_en.bat
Normal file
@ -0,0 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm gifview.asm gifview
|
||||
@erase lang.inc
|
||||
@pause
|
5
programs/other/outdated/gifview/trunk/build_ru.bat
Normal file
5
programs/other/outdated/gifview/trunk/build_ru.bat
Normal file
@ -0,0 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm gifview.asm gifview
|
||||
@erase lang.inc
|
||||
@pause
|
485
programs/other/outdated/gifview/trunk/gif_lite.inc
Normal file
485
programs/other/outdated/gifview/trunk/gif_lite.inc
Normal file
@ -0,0 +1,485 @@
|
||||
; GIF LITE v3.0 by Willow
|
||||
; Written in pure assembler by Ivushkin Andrey aka Willow
|
||||
; Modified by Diamond
|
||||
;
|
||||
; This include file will contain functions to handle GIF image format
|
||||
;
|
||||
; Created: August 15, 2004
|
||||
; Last changed: June 24, 2007
|
||||
|
||||
; Requires kglobals.inc (iglobal/uglobal macro)
|
||||
; (program must 'include "kglobals.inc"' and say 'IncludeUGlobal'
|
||||
; somewhere in uninitialized data area).
|
||||
|
||||
; Configuration: [changed from program which includes this file]
|
||||
; 1. The constant COLOR_ORDER: must be one of
|
||||
; PALETTE - for 8-bit image with palette (sysfunction 65)
|
||||
; MENUETOS - for MenuetOS and KolibriOS color order (sysfunction 7)
|
||||
; OTHER - for standard color order
|
||||
; 2. Define constant GIF_SUPPORT_INTERLACED if you want to support interlaced
|
||||
; GIFs.
|
||||
; 3. Single image mode vs multiple image mode:
|
||||
; if the program defines the variable 'gif_img_count' of type dword
|
||||
; somewhere, ReadGIF will enter multiple image mode: gif_img_count
|
||||
; will be initialized with image count, output format is GIF_list,
|
||||
; the function GetGIFinfo retrieves Nth image info. Otherwise, ReadGIF
|
||||
; uses single image mode: exit after end of first image, output is
|
||||
; <dd width,height, times width*height[*3] db image>
|
||||
|
||||
if ~ (COLOR_ORDER in <PALETTE,MENUETOS,OTHER>)
|
||||
; This message may not appear under MenuetOS, so watch...
|
||||
display 'Please define COLOR_ORDER: PALETTE, MENUETOS or OTHER',13,10
|
||||
end if
|
||||
|
||||
if defined gif_img_count
|
||||
; virtual structure, used internally
|
||||
|
||||
struct GIF_list
|
||||
NextImg rd 1
|
||||
Left rw 1
|
||||
Top rw 1
|
||||
Width rw 1
|
||||
Height rw 1
|
||||
Delay rd 1
|
||||
Displacement rd 1 ; 0 = not specified
|
||||
; 1 = do not dispose
|
||||
; 2 = restore to background color
|
||||
; 3 = restore to previous
|
||||
if COLOR_ORDER eq PALETTE
|
||||
Image rd 1
|
||||
end if
|
||||
ends
|
||||
|
||||
struct GIF_info
|
||||
Left rw 1
|
||||
Top rw 1
|
||||
Width rw 1
|
||||
Height rw 1
|
||||
Delay rd 1
|
||||
Displacement rd 1
|
||||
if COLOR_ORDER eq PALETTE
|
||||
Palette rd 1
|
||||
end if
|
||||
ends
|
||||
|
||||
; ****************************************
|
||||
; FUNCTION GetGIFinfo - retrieve Nth image info
|
||||
; ****************************************
|
||||
; in:
|
||||
; esi - pointer to image list header
|
||||
; ecx - image_index (0...img_count-1)
|
||||
; edi - pointer to GIF_info structure to be filled
|
||||
|
||||
; out:
|
||||
; eax - pointer to RAW data, or 0, if error
|
||||
|
||||
GetGIFinfo:
|
||||
push esi ecx edi
|
||||
xor eax,eax
|
||||
jecxz .eloop
|
||||
.lp:
|
||||
mov esi,[esi]
|
||||
test esi,esi
|
||||
jz .error
|
||||
loop .lp
|
||||
.eloop:
|
||||
lodsd
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
if COLOR_ORDER eq PALETTE
|
||||
lodsd
|
||||
mov [edi],esi
|
||||
else
|
||||
mov eax,esi
|
||||
end if
|
||||
.error:
|
||||
pop edi ecx esi
|
||||
ret
|
||||
|
||||
end if
|
||||
|
||||
_null fix 0x1000
|
||||
|
||||
; ****************************************
|
||||
; FUNCTION ReadGIF - unpacks GIF image
|
||||
; ****************************************
|
||||
; in:
|
||||
; esi - pointer to GIF file in memory
|
||||
; edi - pointer to output image list
|
||||
|
||||
; out:
|
||||
; eax - 0, all OK;
|
||||
; eax - 1, invalid signature;
|
||||
; eax >=8, unsupported image attributes
|
||||
;
|
||||
|
||||
ReadGIF:
|
||||
push esi edi
|
||||
mov [.cur_info],edi
|
||||
xor eax,eax
|
||||
mov [.globalColor],eax
|
||||
if defined gif_img_count
|
||||
mov [gif_img_count],eax
|
||||
mov [.anim_delay],eax
|
||||
mov [.anim_disp],eax
|
||||
end if
|
||||
inc eax
|
||||
cmp dword[esi],'GIF8'
|
||||
jne .ex ; signature
|
||||
mov ecx,[esi+0xa]
|
||||
add esi,0xd
|
||||
mov edi,esi
|
||||
test cl,cl
|
||||
jns .nextblock
|
||||
mov [.globalColor],esi
|
||||
call .Gif_skipmap
|
||||
.nextblock:
|
||||
cmp byte[edi],0x21
|
||||
jne .noextblock
|
||||
inc edi
|
||||
if defined gif_img_count
|
||||
cmp byte[edi],0xf9 ; Graphic Control Ext
|
||||
jne .no_gc
|
||||
movzx eax,word [edi+3]
|
||||
mov [.anim_delay],eax
|
||||
mov al,[edi+2]
|
||||
shr al,2
|
||||
and eax,7
|
||||
mov [.anim_disp],eax
|
||||
add edi,7
|
||||
jmp .nextblock
|
||||
.no_gc:
|
||||
end if
|
||||
inc edi
|
||||
.block_skip:
|
||||
movzx eax,byte[edi]
|
||||
lea edi,[edi+eax+1]
|
||||
test eax,eax
|
||||
jnz .block_skip
|
||||
jmp .nextblock
|
||||
.noextblock:
|
||||
mov al,8
|
||||
cmp byte[edi],0x2c ; image beginning
|
||||
jne .ex
|
||||
if defined gif_img_count
|
||||
inc [gif_img_count]
|
||||
end if
|
||||
inc edi
|
||||
mov esi,[.cur_info]
|
||||
if defined gif_img_count
|
||||
add esi,4
|
||||
end if
|
||||
xchg esi,edi
|
||||
if defined GIF_SUPPORT_INTERLACED
|
||||
movzx ecx,word[esi+4]
|
||||
mov [.width],ecx
|
||||
movzx eax,word[esi+6]
|
||||
imul eax,ecx
|
||||
if ~(COLOR_ORDER eq PALETTE)
|
||||
lea eax,[eax*3]
|
||||
end if
|
||||
mov [.img_end],eax
|
||||
inc eax
|
||||
mov [.row_end],eax
|
||||
and [.pass],0
|
||||
test byte[esi+8],40h
|
||||
jz @f
|
||||
if ~(COLOR_ORDER eq PALETTE)
|
||||
lea ecx,[ecx*3]
|
||||
end if
|
||||
mov [.row_end],ecx
|
||||
@@:
|
||||
end if
|
||||
if defined gif_img_count
|
||||
movsd
|
||||
movsd
|
||||
mov eax,[.anim_delay]
|
||||
stosd
|
||||
mov eax,[.anim_disp]
|
||||
stosd
|
||||
else
|
||||
movzx eax,word[esi+4]
|
||||
stosd
|
||||
movzx eax,word[esi+6]
|
||||
stosd
|
||||
add esi,8
|
||||
end if
|
||||
push edi
|
||||
mov ecx,[esi]
|
||||
inc esi
|
||||
test cl,cl
|
||||
js .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
|
||||
if ~(COLOR_ORDER eq PALETTE)
|
||||
pop [.Palette]
|
||||
end if
|
||||
lea esi,[edi+1]
|
||||
mov edi,.gif_workarea
|
||||
xor eax,eax
|
||||
lodsb ; eax - block_count
|
||||
add eax,esi
|
||||
mov [.block_ofs],eax
|
||||
mov [.bit_count],8
|
||||
mov eax,1
|
||||
shl eax,cl
|
||||
mov [.CC],eax
|
||||
mov ecx,eax
|
||||
inc eax
|
||||
mov [.EOI],eax
|
||||
mov eax, _null shl 16
|
||||
.filltable:
|
||||
stosd
|
||||
inc eax
|
||||
loop .filltable
|
||||
if COLOR_ORDER eq PALETTE
|
||||
pop eax
|
||||
pop edi
|
||||
push edi
|
||||
scasd
|
||||
push esi
|
||||
mov esi,eax
|
||||
mov ecx,[.CC]
|
||||
@@:
|
||||
lodsd
|
||||
dec esi
|
||||
bswap eax
|
||||
shr eax,8
|
||||
stosd
|
||||
loop @b
|
||||
pop esi
|
||||
pop eax
|
||||
mov [eax],edi
|
||||
else
|
||||
pop edi
|
||||
end if
|
||||
if defined GIF_SUPPORT_INTERLACED
|
||||
mov [.img_start],edi
|
||||
add [.img_end],edi
|
||||
add [.row_end],edi
|
||||
end if
|
||||
.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 .end
|
||||
call .Gif_output
|
||||
.add:
|
||||
mov dword [.gif_workarea+edx*4],ebx
|
||||
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 .add
|
||||
.end:
|
||||
if defined GIF_SUPPORT_INTERLACED
|
||||
mov edi,[.img_end]
|
||||
end if
|
||||
if defined gif_img_count
|
||||
mov eax,[.cur_info]
|
||||
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
|
||||
jne .nextblock
|
||||
xchg esi,edi
|
||||
and dword [eax],0
|
||||
end if
|
||||
xor eax,eax
|
||||
.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,.gif_workarea
|
||||
.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
|
||||
|
||||
if COLOR_ORDER eq PALETTE
|
||||
stosb
|
||||
else
|
||||
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
|
||||
movsb
|
||||
movsb
|
||||
movsb
|
||||
end if
|
||||
end if
|
||||
|
||||
if defined GIF_SUPPORT_INTERLACED
|
||||
cmp edi,[.row_end]
|
||||
jb .norowend
|
||||
mov eax,[.width]
|
||||
if ~(COLOR_ORDER eq PALETTE)
|
||||
lea eax,[eax*3]
|
||||
end if
|
||||
push eax
|
||||
sub edi,eax
|
||||
add eax,eax
|
||||
cmp [.pass],3
|
||||
jz @f
|
||||
add eax,eax
|
||||
cmp [.pass],2
|
||||
jz @f
|
||||
add eax,eax
|
||||
@@:
|
||||
add edi,eax
|
||||
pop eax
|
||||
cmp edi,[.img_end]
|
||||
jb .nextrow
|
||||
mov edi,[.img_start]
|
||||
inc [.pass]
|
||||
add edi,eax
|
||||
cmp [.pass],3
|
||||
jz @f
|
||||
add edi,eax
|
||||
cmp [.pass],2
|
||||
jz @f
|
||||
add edi,eax
|
||||
add edi,eax
|
||||
@@:
|
||||
.nextrow:
|
||||
add eax,edi
|
||||
mov [.row_end],eax
|
||||
xor eax,eax
|
||||
.norowend:
|
||||
end if
|
||||
|
||||
loop .loop2
|
||||
pop edx eax esi
|
||||
ret
|
||||
|
||||
uglobal
|
||||
align 4
|
||||
ReadGIF.globalColor rd 1
|
||||
ReadGIF.cur_info rd 1 ; image table pointer
|
||||
ReadGIF.codesize rd 1
|
||||
ReadGIF.compsize rd 1
|
||||
ReadGIF.bit_count rd 1
|
||||
ReadGIF.CC rd 1
|
||||
ReadGIF.EOI rd 1
|
||||
if ~(COLOR_ORDER eq PALETTE)
|
||||
ReadGIF.Palette rd 1
|
||||
end if
|
||||
ReadGIF.block_ofs rd 1
|
||||
if defined GIF_SUPPORT_INTERLACED
|
||||
ReadGIF.row_end rd 1
|
||||
ReadGIF.img_end rd 1
|
||||
ReadGIF.img_start rd 1
|
||||
ReadGIF.pass rd 1
|
||||
ReadGIF.width rd 1
|
||||
end if
|
||||
if defined gif_img_count
|
||||
ReadGIF.anim_delay rd 1
|
||||
ReadGIF.anim_disp rd 1
|
||||
end if
|
||||
ReadGIF.gif_workarea rb 16*1024
|
||||
endg
|
293
programs/other/outdated/gifview/trunk/gifview.asm
Normal file
293
programs/other/outdated/gifview/trunk/gifview.asm
Normal file
@ -0,0 +1,293 @@
|
||||
; GIF VIEWER FOR MENUET v1.0
|
||||
; Written in pure assembler by Ivushkin Andrey aka Willow
|
||||
;
|
||||
; Uses GIF_LITE 2.0
|
||||
;
|
||||
; Created: August 31, 2004
|
||||
; Last changed: August 25, 2006
|
||||
;
|
||||
; COMPILE WITH FASM
|
||||
|
||||
appname equ 'GIF VIEWER'
|
||||
|
||||
; input line dimensions
|
||||
INP_X equ 5 shl 16+680
|
||||
INP_Y equ 5 shl 16+16
|
||||
INP_XY equ 10 shl 16+10
|
||||
|
||||
use32
|
||||
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01'
|
||||
dd 0x01
|
||||
dd START
|
||||
dd I_END
|
||||
dd 0x400000
|
||||
dd 0x400000
|
||||
dd filename ;0x0
|
||||
dd 0x0
|
||||
|
||||
include 'lang.inc'
|
||||
include '..\..\..\macros.inc' ; decrease code size (optional)
|
||||
|
||||
COLOR_ORDER equ PALETTE
|
||||
GIF_SUPPORT_INTERLACED = 1
|
||||
include 'gif_lite.inc'
|
||||
|
||||
START:
|
||||
cmp [filename],byte 0
|
||||
jne openfile2
|
||||
; jmp openfile2
|
||||
openfile:
|
||||
xor eax,eax
|
||||
mov [entered], eax
|
||||
mov [gif_img_count],eax
|
||||
mov esi,fn_input
|
||||
mov edi,filename
|
||||
mov ecx,[inp_pos]
|
||||
rep movsb
|
||||
stosb
|
||||
openfile2:
|
||||
mov ebx,file_info
|
||||
mov eax,70
|
||||
mcall
|
||||
cmp eax,6
|
||||
je temp
|
||||
test eax,eax
|
||||
jnz ok2
|
||||
temp:
|
||||
; cmp ebx,64
|
||||
; jbe ok2
|
||||
|
||||
xor eax,eax
|
||||
mov [entered], eax
|
||||
mov esi,filename
|
||||
mov edi,fn_input
|
||||
mov ecx,256/4 ;[filename_len]
|
||||
rep movsd
|
||||
|
||||
mov edi,fn_input
|
||||
mov ecx,256
|
||||
repne scasb
|
||||
sub edi,fn_input
|
||||
mov [inp_pos],edi
|
||||
|
||||
; test eax,eax
|
||||
; jnz .ok2
|
||||
; cmp ebx,64
|
||||
; jbe .ok2
|
||||
mov esi,workarea
|
||||
mov edi,Image
|
||||
call ReadGIF
|
||||
test eax,eax
|
||||
jz .ok
|
||||
and [gif_img_count], 0
|
||||
.ok:
|
||||
ok2:
|
||||
and dword[img_index],0
|
||||
|
||||
mov ebx,3
|
||||
mov ecx,sc
|
||||
mov edx,sizeof.system_colors
|
||||
mov eax,48
|
||||
mcall
|
||||
|
||||
red:
|
||||
|
||||
; *********************************************
|
||||
; ******* Ž<><C5BD>…„…‹…<E280B9>ˆ… ˆ Ž’<C5BD>ˆ‘Ž‚Š€ ŽŠ<C5BD>€ *******
|
||||
; *********************************************
|
||||
|
||||
draw_window:
|
||||
|
||||
mov ebx,1
|
||||
mov eax,12
|
||||
mcall
|
||||
|
||||
xor eax,eax
|
||||
mov ebx,50*65536+700
|
||||
mov ecx,50*65536+500
|
||||
mov edx,[sc.work]
|
||||
or edx,0x33000000
|
||||
mov edi,title
|
||||
mcall
|
||||
|
||||
call draw_input
|
||||
|
||||
xor ecx,ecx
|
||||
call draw_subimage
|
||||
cmp [gif_img_count],1
|
||||
jz @f
|
||||
|
||||
mov ecx,[img_index]
|
||||
call draw_subimage
|
||||
@@:
|
||||
|
||||
mov ebx,2
|
||||
mov eax,12
|
||||
mcall
|
||||
|
||||
still:
|
||||
cmp [gif_img_count], 1
|
||||
jbe .infinite
|
||||
mov ebx, [cur_anim_delay]
|
||||
test ebx, ebx
|
||||
jz .infinite
|
||||
mov eax, 23
|
||||
mcall
|
||||
jmp @f
|
||||
.infinite:
|
||||
mov eax, 10
|
||||
mcall
|
||||
@@:
|
||||
dec eax
|
||||
jz red
|
||||
dec eax
|
||||
jz key
|
||||
dec eax
|
||||
jz button
|
||||
mov eax,[gif_img_count]
|
||||
cmp eax,1
|
||||
je still
|
||||
inc [img_index]
|
||||
cmp eax,[img_index]
|
||||
jne redsub
|
||||
and [img_index],0
|
||||
redsub:
|
||||
mov ecx,[img_index]
|
||||
call draw_subimage
|
||||
jmp still
|
||||
|
||||
key:
|
||||
mov eax,2
|
||||
mcall
|
||||
cmp ah,13
|
||||
je is_input
|
||||
jmp still
|
||||
|
||||
button:
|
||||
mcall 17
|
||||
cmp ah,1
|
||||
jnz wait_input
|
||||
|
||||
_close:
|
||||
or eax,-1
|
||||
mcall
|
||||
|
||||
is_input: ; simple input line with backspace feature
|
||||
inc [entered] ; sorry - no cursor
|
||||
wait_input:
|
||||
call draw_input
|
||||
mov eax,10
|
||||
mcall
|
||||
cmp al,2
|
||||
jne still
|
||||
mov edi,[inp_pos]
|
||||
; mov eax,2
|
||||
mcall
|
||||
shr eax,8
|
||||
cmp al,27
|
||||
je still
|
||||
cmp al,13
|
||||
je openfile
|
||||
cmp al,8
|
||||
je backsp
|
||||
mov [fn_input+edi],al
|
||||
inc [inp_pos]
|
||||
jmp wait_input
|
||||
backsp:
|
||||
test edi,edi
|
||||
jz wait_input
|
||||
dec [inp_pos]
|
||||
jmp wait_input
|
||||
; jmp still
|
||||
|
||||
;****************************************
|
||||
;******* DRAW CONTENTS OF INPUT LINE ****
|
||||
;****************************************
|
||||
draw_input:
|
||||
mov esi,0xe0e0e0
|
||||
cmp [entered],0
|
||||
jne highlight
|
||||
mov esi,0x00aabbcc
|
||||
highlight:
|
||||
mov ecx,INP_Y
|
||||
mov edx,2
|
||||
mov ebx,INP_X
|
||||
mov eax,8
|
||||
mcall
|
||||
mov ecx,0x00107a30
|
||||
mov edx,fn_input
|
||||
mov esi,[inp_pos]
|
||||
mov ebx,INP_XY
|
||||
mov eax,4
|
||||
mcall
|
||||
ret
|
||||
|
||||
draw_subimage:
|
||||
cmp [gif_img_count],0
|
||||
jz .enddraw
|
||||
mov esi,Image
|
||||
mov edi,gif_inf
|
||||
call GetGIFinfo
|
||||
test eax,eax
|
||||
jz .enddraw
|
||||
mov ecx, dword [edi+GIF_info.Width-2]
|
||||
mov cx, [edi+GIF_info.Height]
|
||||
mov ebx,eax
|
||||
mov eax, [edi+GIF_info.Delay]
|
||||
mov [cur_anim_delay],eax
|
||||
mov edx, dword [edi+GIF_info.Left-2]
|
||||
mov dx, [edi+GIF_info.Top]
|
||||
add edx,5 shl 16 +25
|
||||
mov esi, 8
|
||||
mov edi, [edi+GIF_info.Palette]
|
||||
xor ebp, ebp
|
||||
mov eax, 65
|
||||
mcall
|
||||
.enddraw:
|
||||
ret
|
||||
|
||||
; ‡¤¥áì 室ïâáï ¤ ë¥ ¯à®£à ¬¬ë:
|
||||
|
||||
title db appname,0 ; áâப § £®«®¢ª
|
||||
|
||||
inp_pos dd inp_end-fn_input
|
||||
fn_input:
|
||||
; db '/hd/1/gif/smileys/sm100000.gif'
|
||||
db '/sys/meos.gif'
|
||||
; db '/hd/1/1/tex256.gif',0
|
||||
; db '/rd/1/tex256.gif'
|
||||
inp_end:
|
||||
rb 256-(inp_end-fn_input)
|
||||
|
||||
file_info:
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0x100000;0x200000
|
||||
dd workarea;0x100000
|
||||
I_END: ; ª®¥æ ¯à®£à ¬¬ë
|
||||
filename:
|
||||
; db '/hd/1/gif/smileys/sm112000.gif',0
|
||||
; db '/hd/1/gif/test.gif',0
|
||||
; db '/hd/1/gif/explode1.gif',0
|
||||
; db '/hd/1/gif/tapeta.gif',0
|
||||
; db '/hd/1/gif/meos.gif',0
|
||||
rb 257
|
||||
;filename_len dd 0
|
||||
|
||||
entered rd 1
|
||||
sc system_colors
|
||||
|
||||
gif_img_count rd 1
|
||||
cur_anim_delay rd 1
|
||||
img_index rd 1
|
||||
gif_inf GIF_info
|
||||
|
||||
IncludeUGlobals
|
||||
|
||||
workarea rb 0x100000
|
||||
|
||||
Image:
|
5
programs/other/outdated/jpegview/trunk/build_en.bat
Normal file
5
programs/other/outdated/jpegview/trunk/build_en.bat
Normal file
@ -0,0 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm jpegview.asm jpegview
|
||||
@erase lang.inc
|
||||
@pause
|
6
programs/other/outdated/jpegview/trunk/build_ru.bat
Normal file
6
programs/other/outdated/jpegview/trunk/build_ru.bat
Normal file
@ -0,0 +1,6 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm jpegview.asm jpegview
|
||||
@erase lang.inc
|
||||
@kpack jpegview
|
||||
@pause
|
77
programs/other/outdated/jpegview/trunk/filelib.asm
Normal file
77
programs/other/outdated/jpegview/trunk/filelib.asm
Normal file
@ -0,0 +1,77 @@
|
||||
file_handler:
|
||||
.operation=0
|
||||
.position=4
|
||||
.reserved=8
|
||||
.n_bytes=12
|
||||
.bufer=16
|
||||
.name=20
|
||||
.st_size=20+1024
|
||||
|
||||
open: ;esi=name_string
|
||||
;retorna eax
|
||||
pushad
|
||||
mov ecx,file_handler.st_size
|
||||
call mallocz
|
||||
mov [esp+28],edi
|
||||
push edi
|
||||
mov ecx,1024
|
||||
add edi,file_handler.name
|
||||
call movedata
|
||||
pop edi
|
||||
; test if file exists
|
||||
lea ebx,[edi+file_handler.operation]
|
||||
mov byte[ebx],5
|
||||
mov dword[ebx+16],fileattr
|
||||
mov eax,70
|
||||
int 0x40
|
||||
cmp eax,2
|
||||
jz .virtual
|
||||
test eax,eax
|
||||
jnz close.b
|
||||
@@:
|
||||
clc
|
||||
popad
|
||||
ret
|
||||
.virtual:
|
||||
mov byte [fileattr], 0x10
|
||||
jmp @b
|
||||
|
||||
close:
|
||||
pushad
|
||||
.b:
|
||||
mov edi,[esp+28]
|
||||
call free
|
||||
popad
|
||||
xor eax,eax
|
||||
ret
|
||||
|
||||
|
||||
read: ;(f,bufer,nbytes) eax,edi,ecx ncr
|
||||
;retorna bytes leidos en ecx
|
||||
pushad
|
||||
lea ebx, [eax+file_handler.operation]
|
||||
mov byte [ebx], 0
|
||||
mov [ebx+12], ecx
|
||||
mov [ebx+16], edi
|
||||
mov eax, 70
|
||||
int 0x40
|
||||
cmp ebx, -1
|
||||
sbb ebx, -1
|
||||
mov eax, [esp+28]
|
||||
add [eax+file_handler.position], ebx
|
||||
mov [esp+24], ebx
|
||||
popad
|
||||
ret
|
||||
|
||||
ftell: mov edx,[eax+file_handler.position]
|
||||
ret
|
||||
lseek: ;eax=file edx=pos
|
||||
mov [eax+file_handler.position],edx
|
||||
ret
|
||||
skip: ;eax=file edx=bytes to skip
|
||||
add [eax+file_handler.position],edx
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
22
programs/other/outdated/jpegview/trunk/jpegdat.asm
Normal file
22
programs/other/outdated/jpegview/trunk/jpegdat.asm
Normal file
@ -0,0 +1,22 @@
|
||||
modes:
|
||||
dd mcu100,color100,8,8 ;monocromo
|
||||
dd mcu111,color111,8,8
|
||||
dd mcu211,color211,16,8
|
||||
dd mcu411,color411,16,16
|
||||
|
||||
zigzag:
|
||||
db 0,0, 4+1,0, 32,1, 64,1, 36,2, 8+1,0, 12+1,0, 40,4
|
||||
db 68,2, 96,1, 128,1, 100,2, 72,4, 44,8, 16+1,0, 20+1,0
|
||||
db 48,16, 76,8, 104,4, 132,2, 160,1, 192,1, 164,2, 136,4
|
||||
db 108,8, 80,16, 52,32, 24+1,0, 28+1,0, 56,64, 84,32, 112,16
|
||||
db 140,8, 168,4, 196,2, 224,1, 228,2, 200,4, 172,8, 144,16
|
||||
db 116,32, 88,64, 60,128, 92,128, 120,64, 148,32, 176,16, 204,8
|
||||
db 232,4, 236,8, 208,16, 180,32, 152,64, 124,128, 156,128, 184,64
|
||||
db 212,32, 240,16, 244,32, 216,64, 188,128, 220,128, 248,64, 252,128
|
||||
|
||||
k:
|
||||
dd 1.41421,1.84776,1.08239,-2.6131
|
||||
k2:
|
||||
dd 0.3535534,0.49039264,0.46193953,0.415734806
|
||||
dd 0.3535534,0.277785116,0.191341716,0.0975451609
|
||||
|
1181
programs/other/outdated/jpegview/trunk/jpeglib.asm
Normal file
1181
programs/other/outdated/jpegview/trunk/jpeglib.asm
Normal file
File diff suppressed because it is too large
Load Diff
747
programs/other/outdated/jpegview/trunk/jpegview.asm
Normal file
747
programs/other/outdated/jpegview/trunk/jpegview.asm
Normal file
@ -0,0 +1,747 @@
|
||||
; IMGVIEW.ASM
|
||||
;
|
||||
; This program displays jpeg images. The window can be resized.
|
||||
;
|
||||
; Version 0.0 END OF 2003
|
||||
; Octavio Vega
|
||||
; Version 0.1 7th March 2004
|
||||
; Mike Hibbett ( very small part! )
|
||||
; Version 0.11 7th April 2004
|
||||
; Ville Turjanmaa ( 'set_as_bgr' function )
|
||||
; Version 0.12 29th May 2004
|
||||
; Ivan Poddubny (correct "set_as_bgr"+parameters+boot+...)
|
||||
; Version 0.12 30 de mayo 2004
|
||||
; Octavio Vega
|
||||
; bugs correction and slideshow
|
||||
; version 0.13 3 de junio 2004
|
||||
; Octavio Vega
|
||||
; unos retoques
|
||||
; version 0.14 10th August 2004
|
||||
; Mike Hibbett Added setting default colours
|
||||
; version 0.15 24th August 2006
|
||||
; diamond (rewritten to function 70)
|
||||
; version 0.16 19th May 2007
|
||||
; Mario79
|
||||
; 1) correction for changed function 15,
|
||||
; 2) use monochrome background if free memory there are less than 2 MB
|
||||
; 3) use COL0 - COL9 boot parameter
|
||||
; 0=black,1=white,2=green,3=lilas,4=grey
|
||||
; 5=light-blue,6=blue,7=salad,8=pink,9=yellow
|
||||
; version 0.17 17th June 2007
|
||||
; diamond (background definition now uses shared memory)
|
||||
; version 0.18 9th August 2007
|
||||
; Mario79
|
||||
; Open file with parameter in patch:
|
||||
; Size of parameter - 4 bytes. Parameter starts with the character "\",
|
||||
; the unused characters are filled by a blank (ASCII 20h).
|
||||
; '\T /hd0/1/1.jpg' - set background, mode: tile
|
||||
; '\S /hd0/1/1.jpg' - set background, mode: stretch
|
||||
|
||||
memsize=20000h
|
||||
org 0
|
||||
PARAMS = memsize - 1024
|
||||
|
||||
appname equ 'Jpegview '
|
||||
version equ '0.18'
|
||||
|
||||
use32
|
||||
|
||||
db 'MENUET01' ; 8 byte id
|
||||
dd 0x01 ; header version
|
||||
dd START ; start of code
|
||||
dd I_END ; size of image
|
||||
dd memsize ; memory for app
|
||||
dd memsize - 1024 ; esp
|
||||
dd PARAMS , 0x0 ; I_Param , I_Icon
|
||||
|
||||
stack_size=4096 + 1024
|
||||
|
||||
include '..\..\..\macros.inc'
|
||||
|
||||
START: ; start of execution
|
||||
mcall 68,11 ; initialize heap
|
||||
|
||||
cmp [PARAMS], byte 0
|
||||
jne check_parameters
|
||||
|
||||
; Calculate the 'free' memory available
|
||||
; to the application, and create the malloc block from it
|
||||
.l1:
|
||||
mov ecx,memsize-fin-stack_size
|
||||
mov edi,fin
|
||||
call add_mem
|
||||
|
||||
call colorprecalc ;inicializa tablas usadas para pasar de ybr a bgr
|
||||
call draw_window
|
||||
call read_string.rs_done
|
||||
|
||||
still:
|
||||
push still
|
||||
mov ebx,100 ;1 second
|
||||
mov eax,23 ; wait here for event
|
||||
mcall
|
||||
cmp eax,1 ; redraw request ?
|
||||
je draw_window
|
||||
cmp eax,2 ; key in buffer ?
|
||||
je read_string
|
||||
cmp eax,3 ; button in buffer ?
|
||||
je button
|
||||
jmp display_next
|
||||
|
||||
button: ; BUTTON
|
||||
mov eax,17
|
||||
mcall
|
||||
cmp ah,3
|
||||
je set_as_bgr2
|
||||
cmp ah,2
|
||||
je slideshow
|
||||
cmp ah,1 ; CLOSE PROGRAM
|
||||
jne close_program.exit
|
||||
close_program:
|
||||
mov eax,-1
|
||||
mcall
|
||||
.exit:
|
||||
ret
|
||||
|
||||
; Put a 'chunk' of the image on the window
|
||||
put_image:
|
||||
pushad
|
||||
|
||||
lea ebp,[edx+eax+7]
|
||||
cmp [winxs],bp
|
||||
jc .l1
|
||||
lea ebp,[ecx+ebx+20+2+17]
|
||||
cmp [winys],bp
|
||||
jc .l1
|
||||
|
||||
add eax,2 ; offset for boarder
|
||||
add ebx,2 ; offset for title bar
|
||||
push ax ; pox
|
||||
push bx ; pos
|
||||
push cx ; size
|
||||
push dx ; size
|
||||
pop ecx
|
||||
pop edx
|
||||
mov ebx,edi
|
||||
mov eax,7
|
||||
|
||||
mcall ; Put image function
|
||||
.l1:
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
|
||||
;******************************************************************************
|
||||
|
||||
check_parameters:
|
||||
cmp [PARAMS], dword "BOOT" ; received BOOT parameter -> goto handler
|
||||
je boot_set_background
|
||||
cmp [PARAMS], word "CO"
|
||||
jne @f
|
||||
cmp [PARAMS+2], byte "L"
|
||||
je boot_set_background
|
||||
@@:
|
||||
cmp byte [PARAMS], "\"
|
||||
jne @f
|
||||
cmp [PARAMS+1], byte "S"
|
||||
jne .tile
|
||||
mov [drawing_mode],2
|
||||
jmp @f
|
||||
.tile:
|
||||
cmp [PARAMS+1], byte "T"
|
||||
jne @f
|
||||
mov [drawing_mode],1
|
||||
@@:
|
||||
cmp byte [PARAMS], 1
|
||||
jz ipc_service
|
||||
mov edi, name_string ; clear string with file name
|
||||
mov al, 0
|
||||
mov ecx, 100
|
||||
rep stosb
|
||||
|
||||
mov ecx, 100 ; calculate length of parameter string
|
||||
mov edi, PARAMS
|
||||
repne scasb
|
||||
|
||||
sub edi, PARAMS
|
||||
mov ecx, edi
|
||||
mov esi, PARAMS ; copy parameters to file name
|
||||
mov edi, name_string
|
||||
cmp byte [PARAMS], "\"
|
||||
jne @f
|
||||
add esi,4
|
||||
sub ecx,4
|
||||
@@:
|
||||
cld
|
||||
rep movsb
|
||||
|
||||
cmp byte [PARAMS], "\"
|
||||
je boot_set_background.1
|
||||
|
||||
jmp START.l1 ; return to beggining of the progra
|
||||
;******************************************************************************
|
||||
boot_set_background:
|
||||
mov [drawing_mode],2
|
||||
.1:
|
||||
mcall 18,16
|
||||
cmp eax,1024*2
|
||||
jb set_mono
|
||||
mov ecx,memsize-fin-stack_size ; size
|
||||
mov edi,fin ; pointer
|
||||
call add_mem ; mark memory from fin to 0x100000-1024 as free
|
||||
call colorprecalc ; calculate colors
|
||||
mov esi,name_string
|
||||
call open
|
||||
test eax,eax
|
||||
jz close_program
|
||||
call jpeg_info
|
||||
mov dword [jpeg_st],ebp
|
||||
call set_as_bgr2 ; set wallpaper
|
||||
jmp close_program ; close the program right now
|
||||
|
||||
;******************************************************************************
|
||||
set_mono:
|
||||
mov eax, 15
|
||||
mov ebx, 1
|
||||
mov ecx, 1
|
||||
mov edx, 1
|
||||
mcall
|
||||
|
||||
cmp [PARAMS], dword "BOOT" ; received BOOT parameter -> goto handler
|
||||
jne @f
|
||||
.green:
|
||||
mov ecx,mono+6
|
||||
jmp .set
|
||||
@@:
|
||||
; cmp [PARAMS], word "CO" ; received BOOT parameter -> goto handler
|
||||
; jne .green
|
||||
xor ecx,ecx
|
||||
mov cl,[PARAMS+3]
|
||||
sub cl,0x30
|
||||
cmp ecx,0
|
||||
jb .green
|
||||
cmp ecx,9
|
||||
ja .green
|
||||
imul ecx,3
|
||||
add ecx,mono
|
||||
.set:
|
||||
mcall 15,5, ,0,3
|
||||
|
||||
; Stretch the image to fit
|
||||
mov eax, 15
|
||||
mov ebx, 4
|
||||
mov ecx, 1
|
||||
mcall
|
||||
|
||||
mov eax, 15
|
||||
mov ebx, 3
|
||||
mcall
|
||||
jmp close_program
|
||||
|
||||
mono:
|
||||
db 0,0,0 ; black
|
||||
db 255,255,255 ; white
|
||||
db 128,128,0 ; green
|
||||
db 240,202,166 ; lilas
|
||||
db 192,192,192 ; grey
|
||||
db 255,255,0 ; light-blue
|
||||
db 255,0,0 ; blue
|
||||
db 192,220,192 ; salad
|
||||
db 255,0,255 ; pink
|
||||
db 0,255,255 ; yellow
|
||||
;******************************************************************************
|
||||
|
||||
set_as_bgr2:
|
||||
mov ebp,dword[jpeg_st]
|
||||
test ebp,ebp
|
||||
jz .end
|
||||
|
||||
mov eax, 15
|
||||
mov ebx, 1
|
||||
mov ecx, [ebp + x_size]
|
||||
mov edx, [ebp + y_size]
|
||||
mcall
|
||||
|
||||
mov ebx, 6
|
||||
mcall
|
||||
test eax, eax
|
||||
jz .end
|
||||
mov [ipc_mem_out], eax
|
||||
|
||||
mov dword [ebp+draw_ptr],put_chunk_to_mem
|
||||
call jpeg_display
|
||||
|
||||
mov eax, 15
|
||||
mov ebx, 7
|
||||
mov ecx, [ipc_mem_out]
|
||||
mcall
|
||||
|
||||
; Stretch the image to fit
|
||||
mov eax, 15
|
||||
mov ebx, 4
|
||||
mov ecx, [drawing_mode] ;2
|
||||
mcall
|
||||
|
||||
mov eax, 15
|
||||
mov ebx, 3
|
||||
mcall
|
||||
|
||||
|
||||
.end:
|
||||
ret
|
||||
|
||||
;******************************************************************************
|
||||
|
||||
ipc_service:
|
||||
mov esi, PARAMS+1
|
||||
xor eax, eax
|
||||
xor ecx, ecx
|
||||
@@:
|
||||
lodsb
|
||||
test al, al
|
||||
jz @f
|
||||
lea ecx, [ecx*5]
|
||||
lea ecx, [ecx*2+eax-'0']
|
||||
jmp @b
|
||||
@@:
|
||||
add ecx, 16
|
||||
mov edx, ecx
|
||||
mcall 68, 12
|
||||
test eax, eax
|
||||
jnz @f
|
||||
.exit:
|
||||
mcall -1
|
||||
@@:
|
||||
mov ecx, eax
|
||||
and dword [ecx], 0
|
||||
mov dword [ecx+4], 8
|
||||
mov [ipc_mem], ecx
|
||||
mcall 60, 1
|
||||
mcall 40, 1 shl 6
|
||||
mcall 23, 500 ; wait up to 5 seconds for IPC message
|
||||
test eax, eax
|
||||
jz .exit
|
||||
; we got message with JPEG data, now decode it
|
||||
mov eax, [ecx+12]
|
||||
mov [ipc_mem_size], eax
|
||||
; init JPEG decoder
|
||||
mov ecx,memsize-fin-stack_size ; size
|
||||
mov edi,fin ; pointer
|
||||
call add_mem ; mark memory from fin to 0x100000-1024 as free
|
||||
call colorprecalc ; calculate colors
|
||||
; hook file functions
|
||||
mov ecx, 4
|
||||
call malloc
|
||||
and dword [edi], 0
|
||||
lea eax, [edi-file_handler.position]
|
||||
mov byte [read], 0xE9
|
||||
mov dword [read+1], read_from_mem - (read+5)
|
||||
; decode
|
||||
call jpeg_info
|
||||
mov dword [jpeg_st],ebp
|
||||
test ebp,ebp
|
||||
jz .end
|
||||
|
||||
mov eax, [ebp + x_size]
|
||||
mul dword [ebp + y_size]
|
||||
lea eax, [eax*3+8]
|
||||
mov ecx, eax
|
||||
mcall 68, 12
|
||||
test eax, eax
|
||||
jz .end
|
||||
add eax, 8
|
||||
mov [ipc_mem_out], eax
|
||||
mov ebx, [ebp + x_size]
|
||||
mov [eax-8], ebx
|
||||
mov ebx, [ebp + y_size]
|
||||
mov [eax-4], ebx
|
||||
|
||||
mov dword [ebp+draw_ptr],put_chunk_to_mem
|
||||
call jpeg_display
|
||||
|
||||
; IPC response
|
||||
mov esi, [ebp + x_size]
|
||||
imul esi, [ebp + y_size]
|
||||
lea esi, [esi*3+8]
|
||||
mov edx, [ipc_mem_out]
|
||||
sub edx, 8
|
||||
.response:
|
||||
mov ecx, [ipc_mem]
|
||||
mov ecx, [ecx+8]
|
||||
mcall 60,2
|
||||
|
||||
jmp close_program ; close the program right now
|
||||
|
||||
.end:
|
||||
mov esi, 8
|
||||
mov edx, x_pointer ; points to 2 null dwords
|
||||
jmp .response
|
||||
|
||||
read_from_mem:
|
||||
; in: eax=handle, ecx=size, edi=pointer to buffer
|
||||
; out: ecx=number of read bytes, buffer filled
|
||||
pushad
|
||||
mov esi, [ipc_mem]
|
||||
add esi, 16
|
||||
add esi, [eax+file_handler.position]
|
||||
add ecx, [eax+file_handler.position]
|
||||
cmp ecx, [ipc_mem_size]
|
||||
jb @f
|
||||
mov ecx, [ipc_mem_size]
|
||||
@@:
|
||||
sub ecx, [eax+file_handler.position]
|
||||
add [eax+file_handler.position], ecx
|
||||
rep movsb
|
||||
popad
|
||||
ret
|
||||
|
||||
;******************************************************************************
|
||||
|
||||
put_chunk_to_mem:
|
||||
; in: (eax,ebx) = start coordinates of chunk
|
||||
; (ecx,edx) = sizes of chunk
|
||||
; edi -> chunk data
|
||||
push esi edi edx
|
||||
mov esi, edi
|
||||
mov edi, ebx
|
||||
imul edi, [ebp + x_size]
|
||||
add edi, eax
|
||||
lea edi, [edi*3]
|
||||
add edi, [ipc_mem_out]
|
||||
@@:
|
||||
push ecx edi
|
||||
lea ecx, [ecx*3]
|
||||
rep movsb
|
||||
pop edi ecx
|
||||
add edi, [ebp + x_size]
|
||||
add edi, [ebp + x_size]
|
||||
add edi, [ebp + x_size]
|
||||
dec edx
|
||||
jnz @b
|
||||
pop edx edi esi
|
||||
ret
|
||||
|
||||
;******************************************************************************
|
||||
|
||||
|
||||
|
||||
; *********************************************
|
||||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||||
; *********************************************
|
||||
|
||||
|
||||
draw_window:
|
||||
|
||||
mov eax,48
|
||||
mov ebx,3
|
||||
mov ecx,sc
|
||||
mov edx,sizeof.system_colors
|
||||
mcall
|
||||
|
||||
mov eax,12
|
||||
mov ebx,1
|
||||
mcall
|
||||
|
||||
; Draw the window to the appropriate size - it may have
|
||||
; been resized by the user
|
||||
cmp [winxs], 0
|
||||
jne dw_001
|
||||
|
||||
; Give the screen some inital defaults
|
||||
mov [winxs], 400
|
||||
mov [winys], 300
|
||||
mov ax, 100
|
||||
mov [winxo], ax
|
||||
mov [winyo], ax
|
||||
jmp dw_002
|
||||
|
||||
dw_001:
|
||||
mov eax, 9
|
||||
mov ebx, memsize - 1024
|
||||
mov ecx, -1
|
||||
mcall
|
||||
mov eax, [ebx + 34]
|
||||
mov [winxo], ax
|
||||
mov eax, [ebx + 38]
|
||||
mov [winyo], ax
|
||||
mov eax, [ebx + 42]
|
||||
mov [winxs], ax
|
||||
mov eax, [ebx + 46]
|
||||
mov [winys], ax
|
||||
|
||||
dw_002:
|
||||
mov ebx, dword [winxo-2]
|
||||
mov bx, [winxs]
|
||||
mov ecx, dword [winyo-2]
|
||||
mov cx, [winys]
|
||||
|
||||
xor eax,eax ; DRAW WINDOW
|
||||
mov edx,[sc.work]
|
||||
or edx,0x33000000
|
||||
mov edi,title ; WINDOW LABEL
|
||||
mcall
|
||||
|
||||
|
||||
mov eax,8 ; BUTTON 2: slideshow
|
||||
mov ebx,57
|
||||
mov cx, [winys]
|
||||
sub cx, 39
|
||||
shl ecx, 16
|
||||
add ecx, 12
|
||||
mov esi, [sc.work_button]
|
||||
mov edx,2
|
||||
mcall
|
||||
|
||||
mov eax,4 ; Button text
|
||||
movzx ebx, word [winys]
|
||||
add ebx, 3 shl 16 - 36
|
||||
mov ecx,[sc.work_button_text]
|
||||
mov edx,setname
|
||||
mov esi,setnamelen-setname
|
||||
mcall
|
||||
|
||||
|
||||
mov eax,8 ; BUTTON 3: set as background
|
||||
mov bx, [winxs]
|
||||
sub bx, 65
|
||||
shl ebx, 16
|
||||
mov bx,55
|
||||
mov cx, [winys]
|
||||
sub cx, 39
|
||||
shl ecx, 16
|
||||
add ecx, 12
|
||||
mov esi, [sc.work_button]
|
||||
mov edx,3
|
||||
mcall
|
||||
|
||||
mov eax,4 ; Button text
|
||||
movzx ebx, word [winxs]
|
||||
sub ebx, 63
|
||||
shl ebx,16
|
||||
mov bx, word [winys]
|
||||
sub bx,36
|
||||
mov ecx,[sc.work_button_text]
|
||||
mov edx,setbgr
|
||||
mov esi,setbgrlen-setbgr
|
||||
mcall
|
||||
call print_strings
|
||||
call load_image
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
; Read in the image file name.
|
||||
read_string:
|
||||
movzx edi,byte[name_string.cursor]
|
||||
add edi,name_string
|
||||
mov eax,2
|
||||
mcall ; Get the key value
|
||||
shr eax,8
|
||||
cmp eax,13 ; Return key ends input
|
||||
je .rs_done
|
||||
cmp eax,8
|
||||
jnz .nobsl
|
||||
cmp edi,name_string
|
||||
je .exit
|
||||
dec edi
|
||||
mov [edi],byte 0;'_'
|
||||
dec byte[name_string.cursor]
|
||||
jmp print_strings
|
||||
.exit: ret
|
||||
.nobsl:
|
||||
cmp eax,31
|
||||
jbe .exit
|
||||
cmp eax,97
|
||||
jb .keyok
|
||||
sub eax,32
|
||||
.keyok:
|
||||
mov ah,0
|
||||
stosw
|
||||
cmp edi,name_string.end
|
||||
jnc print_strings
|
||||
inc byte[name_string.cursor]
|
||||
jmp print_strings
|
||||
.rs_done:
|
||||
call print_strings
|
||||
mov esi,name_string
|
||||
call open
|
||||
test eax,eax
|
||||
jz .exit
|
||||
call jpeg_info
|
||||
test ebp,ebp
|
||||
jz close
|
||||
xchg [jpeg_st],ebp
|
||||
call jpeg_close
|
||||
|
||||
load_image:
|
||||
|
||||
mov eax,13 ; clear picture area
|
||||
movzx ebx, word [winxs]
|
||||
add ebx, 1 shl 16 -10
|
||||
movzx ecx, word [winys]
|
||||
sub ecx, 40
|
||||
add ecx, 1 shl 16
|
||||
|
||||
mov edx,[sc.work]
|
||||
mcall
|
||||
mov ebp,[jpeg_st]
|
||||
test ebp,ebp
|
||||
jz .exit
|
||||
mov dword [ebp+draw_ptr],put_image
|
||||
jmp jpeg_display
|
||||
.exit: ret
|
||||
|
||||
print_strings:
|
||||
pusha
|
||||
mov eax,13 ; clear text area
|
||||
movzx ebx, word [winxs]
|
||||
add ebx, 59 shl 16 -125
|
||||
mov cx, [winys]
|
||||
sub cx, 39
|
||||
shl ecx, 16
|
||||
add ecx, 12
|
||||
mov edx,0xffffff
|
||||
mcall
|
||||
|
||||
mov eax,4 ;
|
||||
movzx ebx, word [winys]
|
||||
add ebx, 61 shl 16 - 37
|
||||
mov ecx,0x000000
|
||||
mov edx,name_string
|
||||
mov esi,60
|
||||
mcall
|
||||
popa
|
||||
ret
|
||||
|
||||
slideshow:
|
||||
cmp [file_dir], 0
|
||||
jnz .exit
|
||||
cmp [jpeg_st], 0
|
||||
jz .exit
|
||||
mov esi, name_string
|
||||
movzx ecx, byte [name_string.cursor]
|
||||
.l1:
|
||||
cmp byte [esi+ecx], '/'
|
||||
jz .l2
|
||||
loop .l1
|
||||
.exit:
|
||||
ret
|
||||
.l2:
|
||||
mov byte [esi+ecx], 0
|
||||
call open
|
||||
mov byte [esi+ecx], '/'
|
||||
test eax, eax
|
||||
jz .exit
|
||||
test byte [fileattr], 0x10
|
||||
jz .exit
|
||||
mov [file_dir], eax
|
||||
inc ecx
|
||||
mov [name_string.cursor], cl
|
||||
display_next:
|
||||
mov ebx, [file_dir]
|
||||
test ebx, ebx
|
||||
jnz @f
|
||||
ret
|
||||
@@:
|
||||
mov byte [ebx], 1
|
||||
mov byte [ebx+12], 1
|
||||
mov dword [ebx+16], dirinfo
|
||||
mov eax, 70
|
||||
mcall
|
||||
mov eax, [file_dir]
|
||||
inc dword [eax+4]
|
||||
cmp ebx, 1
|
||||
jz @f
|
||||
mov eax, [file_dir]
|
||||
and [file_dir], 0
|
||||
jmp close
|
||||
@@:
|
||||
movzx edi, byte [name_string.cursor]
|
||||
add edi, name_string
|
||||
lea esi, [dirinfo+32+40]
|
||||
@@:
|
||||
lodsb
|
||||
stosb
|
||||
test al, al
|
||||
jnz @b
|
||||
mov ecx, name_string.end
|
||||
sub ecx, edi
|
||||
rep stosb
|
||||
call print_strings
|
||||
mov esi,name_string
|
||||
call open
|
||||
test eax,eax
|
||||
jz display_next
|
||||
call jpeg_info
|
||||
test ebp,ebp
|
||||
jnz .l6
|
||||
call close
|
||||
jmp display_next
|
||||
.l6:
|
||||
mov dword[ebp+draw_ptr],put_image
|
||||
push ebp
|
||||
xchg [jpeg_st],ebp
|
||||
call jpeg_close
|
||||
pop ebp
|
||||
jmp jpeg_display
|
||||
|
||||
|
||||
include 'filelib.asm'
|
||||
include 'memlib.asm'
|
||||
include 'jpeglib.asm'
|
||||
|
||||
|
||||
; DATA AREA
|
||||
|
||||
wcolor dd 0x000000
|
||||
drawing_mode dd 2
|
||||
title db appname,version,0
|
||||
setname db 'SLIDESHOW'
|
||||
setnamelen:
|
||||
|
||||
setbgr db ' BGR '
|
||||
setbgrlen:
|
||||
|
||||
x_pointer dd 0
|
||||
x_offset dd 0
|
||||
x_numofbytes dd 0
|
||||
x_numofb2 dd 0
|
||||
x_counter dd 0
|
||||
winxo dw 0
|
||||
winyo dw 0
|
||||
winxs dw 0
|
||||
winys dw 0
|
||||
jpeg_st dd 0
|
||||
file_dir dd 0
|
||||
name_string: db '/sys/jpegview.jpg',0
|
||||
rb 256
|
||||
.end:
|
||||
.cursor: db 19
|
||||
.cursor2: db 0
|
||||
|
||||
align 4
|
||||
|
||||
rgb16: db 0,4,8,13,17,21,25,29,34,38,42,46,50,55,59,63
|
||||
rgb4: db 0,21,42,63
|
||||
|
||||
include 'jpegdat.asm'
|
||||
|
||||
align 4
|
||||
|
||||
iniciomemoria:
|
||||
dd -(iniciomemoria+4),-(iniciomemoria+4),(iniciomemoria+4),.l1,0
|
||||
.l1 dd 0
|
||||
|
||||
I_END:
|
||||
sc system_colors
|
||||
ipc_mem dd ?
|
||||
ipc_mem_size dd ?
|
||||
ipc_mem_out dd ?
|
||||
fileattr: rb 40
|
||||
dirinfo: rb 32+304
|
||||
fin:
|
210
programs/other/outdated/jpegview/trunk/memlib.asm
Normal file
210
programs/other/outdated/jpegview/trunk/memlib.asm
Normal file
@ -0,0 +1,210 @@
|
||||
|
||||
movedata:
|
||||
push eax
|
||||
xor eax,eax
|
||||
sub eax,edi
|
||||
and eax,3
|
||||
xchg ecx,eax
|
||||
sub eax,ecx
|
||||
jle .l1
|
||||
rep movsb
|
||||
mov ecx,eax
|
||||
shr ecx,2
|
||||
rep movsd
|
||||
and eax,3
|
||||
.l1: add ecx,eax
|
||||
rep movsb
|
||||
pop eax
|
||||
ret
|
||||
|
||||
mallocz:
|
||||
call malloc
|
||||
pushad
|
||||
add ecx,3
|
||||
xor eax,eax
|
||||
shr ecx,2
|
||||
rep stosd
|
||||
popad
|
||||
ret
|
||||
|
||||
mresize1: popad
|
||||
xor edi,edi
|
||||
stc
|
||||
mresize2: ret
|
||||
mresize: ; puntero en di ncr retorna nuevo puntero en di
|
||||
test edi,edi
|
||||
jz malloc
|
||||
cmp ecx,[edi-4]
|
||||
je mresize2
|
||||
call free
|
||||
malloc:
|
||||
mov edi,ecx
|
||||
jecxz mresize2
|
||||
pushad
|
||||
mov esi,iniciomemoria+4
|
||||
lea ebx,[ecx+3]
|
||||
and ebx,-4 ;redondeo a 4
|
||||
.l1: mov edi,esi
|
||||
add esi,[esi]
|
||||
jc mresize1
|
||||
lodsd
|
||||
cmp eax,ebx
|
||||
jc .l1
|
||||
cmp esi,[iniciomemoria+8]
|
||||
jc .l2
|
||||
jne mresize1
|
||||
lea edx,[ebx+esi+4]
|
||||
cmp edx,[iniciomemoria+12]
|
||||
jnc mresize1
|
||||
mov [iniciomemoria+8],edx
|
||||
.l2: pop dword [esi-4]
|
||||
push esi
|
||||
sub eax,ebx
|
||||
je .l3
|
||||
sub eax,4
|
||||
mov [esi+ebx],eax
|
||||
jz .l3
|
||||
;fragmentar
|
||||
add ebx,4
|
||||
add [edi],ebx
|
||||
mov eax,[esi]
|
||||
sub eax,ebx
|
||||
mov [esi+ebx],eax
|
||||
popad
|
||||
ret
|
||||
.l3: lodsd
|
||||
add eax,4
|
||||
add [edi],eax
|
||||
popad
|
||||
ret
|
||||
|
||||
realloc: test edi,edi
|
||||
jz malloc
|
||||
jecxz free
|
||||
pushad
|
||||
pop esi
|
||||
mov eax,[edi-4]
|
||||
call malloc
|
||||
push edi
|
||||
cmp ecx,eax
|
||||
jc .l1
|
||||
mov ecx,eax
|
||||
.l1: push esi
|
||||
call movedata
|
||||
pop edi
|
||||
call free
|
||||
popad
|
||||
.l2: ret
|
||||
free: ;puntero en di
|
||||
;no se comprueban los punteros
|
||||
;retorna di=0 , ncr
|
||||
test edi,edi
|
||||
jz realloc.l2
|
||||
pushad
|
||||
pop edi
|
||||
mov ebp,[edi-4]
|
||||
dec ebp
|
||||
and ebp,-4 ;redondeo a 4,dx=dx-4
|
||||
xor edx,edx
|
||||
push edx
|
||||
mov edx,iniciomemoria+4
|
||||
mov esi,edx
|
||||
;buscar puntero libre anterior
|
||||
.l1: mov ebx,esi
|
||||
lodsd
|
||||
add esi,eax
|
||||
cmp esi,edi
|
||||
jc .l1
|
||||
;enlazar
|
||||
mov ecx,esi
|
||||
sub ecx,edi
|
||||
sub eax,ecx
|
||||
sub ecx,4
|
||||
mov [ebx],eax
|
||||
;fusionar con el anterior
|
||||
cmp eax,[ebx-4]
|
||||
jne .l2
|
||||
cmp ebx,edx
|
||||
je .l2 ;no fusionar con el primero
|
||||
mov edi,ebx
|
||||
add eax,4
|
||||
add ecx,eax
|
||||
add ebp,eax
|
||||
.l2: mov ebx,ebp ;fusionar con bloques de tama¤o 0
|
||||
.l3: add ebx,4
|
||||
test dword [edi+ebx],-1
|
||||
jz .l3
|
||||
cmp ebx,ecx
|
||||
jne .l4
|
||||
;fusionar con el siguiente
|
||||
add ebx,[esi-4]
|
||||
add ecx,[esi]
|
||||
add ebx,4
|
||||
add ecx,4
|
||||
cmp esi,[edx+4]
|
||||
jne .l4
|
||||
mov [edx+4],edi
|
||||
.l4: mov [edi-4],ebx
|
||||
mov [edi],ecx
|
||||
popad
|
||||
ret
|
||||
|
||||
add_mem: ;edi,ecx ;el ultimo bloque libre debe ser >8 bytes para poder fragmentarlo
|
||||
cmp ecx,64
|
||||
jc .l1
|
||||
add ecx,edi
|
||||
add edi,3
|
||||
and edi,-4
|
||||
and ecx,-4
|
||||
mov eax,ecx
|
||||
sub ecx,edi ;redondeo
|
||||
xchg eax,[iniciomemoria+12]
|
||||
cmp edi,eax
|
||||
jna .l1
|
||||
lea esi,[edi+4]
|
||||
mov edx,esi
|
||||
xchg esi,[iniciomemoria+8]
|
||||
neg edx
|
||||
mov [edi],edx
|
||||
mov [edi+4],edx
|
||||
lea edx,[edi-4]
|
||||
sub edi,esi
|
||||
mov [esi],edi
|
||||
sub eax,4
|
||||
sub eax,esi
|
||||
mov [esi-4],eax
|
||||
add esi,eax
|
||||
sub edx,esi
|
||||
mov [esi],edx
|
||||
.l1: ret
|
||||
|
||||
check_mem: ;busqueda de errores en la memoria
|
||||
;retorna edx nbloques o 0 si error,ecx memoria libre
|
||||
;ncr: ebp,ebx,eax
|
||||
mov edi,iniciomemoria
|
||||
mov esi,edi
|
||||
xor edx,edx
|
||||
mov ecx,[edi]
|
||||
neg ecx ;el primer bloque no cuenta
|
||||
.l1: add ecx,[edi]
|
||||
add edi,4
|
||||
add edi,[edi]
|
||||
.l2: inc edx
|
||||
add esi,[esi]
|
||||
jc .l4
|
||||
add esi,7
|
||||
jc .l3
|
||||
and esi,-4
|
||||
cmp esi,edi
|
||||
jc .l2
|
||||
je .l1
|
||||
jmp .l4
|
||||
.l3: test edi,edi
|
||||
jnz .l4
|
||||
add ecx,[iniciomemoria+12]
|
||||
ret
|
||||
.l4: xor edx,edx
|
||||
stc
|
||||
ret
|
||||
|
||||
|
0
programs/other/kerpack/trunk/build.sh → programs/other/outdated/kerpack/trunk/build.sh
Executable file → Normal file
0
programs/other/kerpack/trunk/build.sh → programs/other/outdated/kerpack/trunk/build.sh
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user