News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

ZipViewer beta

Started by jj2007, June 08, 2014, 08:23:00 AM

Previous topic - Next topic

jj2007

Attached a little project to view and search zip archive contents. It's a beta and might occasionally crash if fed with bad data.

Zen

JOCHEN,
When I launch ZipViewer, I get this:

QuoteFatal Error:
Could not open
\Mams32\MasmBasic\Res\UnicodeTest.zip
for Recall, FileRead$ etc.

I opened ZipViewer.asm (I don't really understand MASM Basic), but, it's not all that different from regular MASM.
I don't have a \Masm32\MasmBasic\ directory.
...And, what the heck is: Instr_ ??? I assume it is a macro or proc of some kind.

jj2007

Hi Zen,

You need a MasmBasic installation. Afterwards, you will have that directory, and also UnicodeTest.zip

Once the MasmBasic installer has finished, you can also go to File, Open and open the ZipViewer.asc. Hit F6 to build it, and let me know if it all worked as it should.

And yes, MasmBasic isn't that different from normal assembler. In fact, all *.asm files in \Masm32\examples work just fine if you open them in MB's editor, or if you replace the initial include & includelib lines with a simple include \masm32\MasmBasic\MasmBasic.inc ;)

Re Instr_, see here (same for Unicode version, wInstr).

Zen

#3
JOCHEN,
Ahh,...HAH,...MASM Basic Install,...I knew it had to be something obvious,...:icon_eek:
Thanks,...

...OK,...Update,...I have installed the the MasmBasic library and the RichMasm editor,...and ZipViewer now launches without error.
To test it,...I opened the zip file version of,...ZipViewer (posted, this thread, above),...and, it works, pretty well,...
Just out of curiosity,...(and, I haven't read any of the documentation yet),...what is the advantage of using MASM Basic over the Normal MASM way ???

jj2007

Quote from: Zen on June 24, 2014, 07:40:36 AMwhat is the advantage of using MASM Basic over the Normal MASM way ???

Under the hood of the BASIC syntax, you get a fast and powerful library. Open the file \Masm32\MasmBasic\Res\MbSnippets.asc with \Masm32\MasmBasic\RichMasm.exe, click on the listbox in the upper right corner and scroll down; hit F6 if you are curious ;)

For example (line 758 of MbSnippets.asc):

include \masm32\MasmBasic\MasmBasic.inc

MyLongLong  LONGLONG  12345678901234567890
MyDword     LONG      1234567890
MyWord      WORD      12345
MyByte      BYTE      123
MySingle    REAL4     12345678901234567890.0
MyDouble    REAL8     12345678901234567890.0
MyR10       REAL10    1234567890123456789012.0

  Init                  ; ## deb and the Art of Type Checking ##
  mov eax, MyDword
  mov bx, MyWord
  mov cl, MyByte
  fldpi                  ; PI, 3.14159
  fldl2e                  ; Log2(e), 1.4427
  fldlg2                  ; Log10(2), 0.3013
  movlps xmm0, MyLongLong
  movlps xmm1, MyDouble
  DefNum 16            ; set precision (only f:xmm1 affected)
  deb 4, "Any type missing?", u:MyLongLong, u:xmm0, f:xmm1, ST(0), ST(1), ST(2), MyDword, MyWord, MyByte, cl, bx, eax, MySingle, MyDouble, MyR10
  Exit
end start

Output:
Any type missing?
u:MyLongLong    12345678901234567890
u:xmm0          12345678901234567890
f:xmm1          1.234567890123457e+19
ST(0)           0.301029995663981195
ST(1)           1.44269504088896341
ST(2)           3.14159265358979324
MyDword         1234567890
MyWord          12345
MyByte          123
cl              123
bx              12345
eax             1234567890
MySingle        1.234568e+19
MyDouble        1.234567890123457e+19
MyR10           1.23456789012345679e+21


deb is the debug macro. It doesn't change registers or flags, and can be disabled with a simple usedeb=0 on top of the code. Those of my sources that are still under development have plenty of deb 4 lines.
deb 1, 2 or 3 show a MsgBox; you can cancel them individually
deb 4 prints to the console
deb 5 prints to a file
deb 6 ...99 prints to the console, but only n times - for use with loops; for example, if you want to see what happens in the first 20 iterations of a loop with, say, a Million iterations, you would use a deb 20.

deb can also use some prefixes:
deb 4, "Test", b:esp, u:xmm0, f:xmm1, x:esp  ; binary, unsigned, float, hex

Zen

JOCHEN,
Hey,...thanks for the intro. I'll have to play around with it some.:biggrin:
The Rich MASM Editor is VERY COLORFUL.
But,...many useful options,...

jj2007

Quote from: Zen on June 25, 2014, 03:34:05 AM
The Rich MASM Editor is VERY COLORFUL.

When typing, it uses colours very sparingly: push eax ... pop whatever for a balanced stack, ; comments in grey, MasmBasic keywords in blue

QuoteBut,...many useful options,...
Only what I really need. For example, select a structure definition and hit Ctrl F12; or select the name of a variable and hit F3. Or the edit history, i.e. the little left and right arrows in the upper right corner (Alt Left and Alt Right do the same). Test it on a really long source...