News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

MasmBasic

Started by jj2007, May 23, 2012, 10:16:07 PM

Previous topic - Next topic

sinsi

Downloaded and installed a version 12 hours ago, all OK.
Saw the new version, downloaded and installed OK until the very end showing RichMasm

Faulting application name: RichMasm.exe, version: 0.0.0.0, time stamp: 0x53a20f44
Faulting module name: RichMasm.exe, version: 0.0.0.0, time stamp: 0x53a20f44
Exception code: 0xc0000005
Fault offset: 0x0000ff0c
Faulting process ID: 0x1940
Faulting application start time: 0x01cf8b99d380e62d
Faulting application path: C:\Masm32\MasmBasic\RichMasm.exe
Faulting module path: C:\Masm32\MasmBasic\RichMasm.exe
Report ID: 130f4421-f78d-11e3-bfda-bc5ff496160b
Faulting package full name:
Faulting package-relative application ID:


jj2007

Thanks for the feedback, Sinsi. If the offset means "from entry", then it is pcmpeqb xmm0, xmmword ptr [edx] in MbStrLen. So a nullpointer was passed ::)

I always wonder what a len() routine should return if a nullpointer is passed. Zero maybe? Minus one??

Which Windows version was that? Anybody else having the same problem?

jj2007

#182
The SetGlobals macro allows now to initialise DWORD, WORD, REAL4, REAL8 and string variables in the declaration:

include \masm32\MasmBasic\MasmBasic.inc      ; download
  SetGlobals v1=123456789, MyFile$="SomeTest.txt", v2
  SetGlobals MyR4:REAL4=123456.789012345678, MyR8:double=123456.789012345678
  SetGlobals v3:WORD=12345, v4

  Init
  SetGlobals            ; no args = load ebx, initialise variables
  Print "MyFile$=", MyFile$, CrLf$
  Print Str$("V1=%i", v1), Str$(", v3=%i\n", v3)
  Print Str$("R4=%If\n", MyR4)
  Print Str$("R8=%If\n", MyR8)
  Exit
end start

String variables must have the '$' suffix. In the first call of the .code section (i.e. the line below Init), SetGlobals without arguments initialises these variables.

EDIT: Update 3 July fixed a very odd bug: Recall, when reading an ANSI file that had Unicode embedded, had extremely long strings containing the Unicode parts; that may happen if you saved an inc file as Unicode, and afterwards you create e.g. with copy *.inc AllIncludes.txt a file that will have, oops, an embedded Unicode part. The BadLines variable can be used to test this:

include \masm32\MasmBasic\MasmBasic.inc      ; download
      Init
      Recall "\Masm32\include\AllIncludes.txt", L$()
      ExternDef BadLines:DWORD
      Print Str$("%i lines, of which ", eax), Str$("%i badly formatted", BadLines)
      Exit
end start


In the new version, the array will simply contain Unicode strings where Recall found them; no more obscure crashes, but still, garbage in, garbage out...
Note that Recall has no problems with regular Unicode files - it returns the string array in UTF-8 format (and you can use wRec$(My$(123)) if you need UTF-16, e.g. for menus).

guga

Hi JJ

not sure if you are aware of this small bug on masmbasic, but with winXP SP3, the menus text are being detached when you resize the window.

To see the error, you need to open masmbasic and then press the mouse upon a windows and drag it vertically.
1st - Double click the window to you be able to drag it
2nd one the window is not maximixed, click on the title bar with the left button pressed and drag the window

Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

jj2007

Hi Gustavo,

It's a feature, not a bug ;-)

On my machines (Win XP, W7-32, 2*W7-64) it works, though. The menus get detached while dragging or resizing but follow some milliseconds later. Strange that for you it's different.

The background for this strange feature is

a) Aero (not allowing drawing directly on the caption) and

b) the fact that assembly is a "vertical" language, with one short instruction per line: I didn't want to sacrifice a line for a stupid standard menu.

Besides, the menu activates itself without clicking, like most browser menus nowadays.

Still, I am curious why the menu stays put in the middle of the desktop in your case... ::)

guga

A feature ? Hmm..interesting...I never used aero before to see what exactly it is.

But...since this is the normal behavior, son´t worry...the menus on the middle of the desktop goes back to the original position after a few time (milliseconds, in fact)....I took the screenshot pressing "PrintScreen" thinking it was a bug to show you, because i didn´t found other way to explain.

But...do aero works on XP ? I would like to see what is this feature. It is unusual, but, interesting.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

jj2007

No aero on XP. It was introduced with Vista, but it seems not very popular. Most people I know reverted to the classic non-aero themes. Don't even know if it still exists on Win8.

BTW the editor is not needed to assemble MasmBasic code, but it has some nice features. For example, load a big source (>10,000 lines), select a global variable like "buffer" and hit F3...

jj2007

Just for fun, a 40 lines app to find duplicate files, starting from the current folder:

include \masm32\MasmBasic\MasmBasic.inc      ; download
  Init
  Let esi=CurDir$()+"*.*"
  .While 1
      Let esi=Input$("\nEscape+Return to quit\nEnter path & wildcards:\t", esi)      ; e.g. C:\Masm32\*.*
      .Break .if !Len(esi)            ; user pressed Escape
      .if !Instr_(esi, "*")
            PrintLine "Unrestricted search not allowed"
      .else
            GetFiles esi
            .if eax
                  push eax
                  Print Str$("%i files found\n\n", eax)
                  xor ecx, ecx
                  .Repeat
                        mov edi, Files$(ecx)
                        mov ebx, Rinstr(edi, "\")            ; let's move the name part to the front for sorting
                        .if ebx
                            Let Files$(ecx)=Mid$(edi, ebx+1)+Tb$+GfDate$(ecx)+Spc2$+GfTime$(ecx)+Spc2$+Str$(GfSize(ecx))+Spc2$+Left$(edi, ebx)
                        .endif
                        inc ecx
                  .Until ecx>=stack
                  SortFiles name, asc            ; sort by name, ascending
                  xor ecx, ecx
                  Let ebx="#"            ; no such file
                  .Repeat
                        mov edi, Files$(ecx)
                        .if Instr_(ebx, Left$(edi, Instr_(edi, Tb$)), 1)==1
                            PrintLine CrLf$, edi, CrLf$, ebx
                        .endif
                        Let ebx=Files$(ecx)
                        inc ecx
                  .Until ecx>=stack
                  pop eax
            .endif
      .endif
  .Endw
  Print "bye"
  Exit
end start

Gunther

Jochen,

nice little application. I've no redundancy on my machine.  :lol:

Gunther
You have to know the facts before you can distort them.

jj2007

Quote from: Gunther on August 19, 2014, 05:17:02 AM
nice little application. I've no redundancy on my machine.  :lol:

Thanks, Gunther.

Update 20 August (here):

- GfSetInfo allows to copy a file's timestamp and size to another element of the Files$() array generated by GetFiles, or time & size of the last match of Exist(); example:

GfSetInfo 1, GfLastWrite(-1)      ; set Files$(1) to Exist() time and size
Destination is an element of Files$(), source is either Files$ (index 0 ... n) or the last match of Exist() with index -1.

- wChr$() can now have embedded zeros:
mov esi, wChr$("All files", 0, "*.*", 0)

This allows to avoid a bug in LoadStringW when loading a resource string with trailing zeros..

- the menus of RichMasm are now better aligned, see Pelles C

jj2007

  CASE WM_DROPFILES
            GetFiles WM_DROPFILES      ; put dropped files into the Files$() array
            push eax
            Let esi=Str$("%i files and folders dropped:", eax)
            xor ecx, ecx
            .Repeat
                  void Rinstr(Files$(ecx), "\")      ; strip the path: Rinstr() returns absolute pos in eax (and relative pos in edx)
                  lea edi, [eax+1]
                  Let esi=esi+Str$("\n%i\t", GfSize(ecx))+GfDate$(ecx)+Spc2$+GfTime$(ecx)+Tb$+edi      ; size, date, time and filename
                  inc ecx
            .Until ecx>=stack
            pop eax
            SetWin$ hEdit=esi                 


Sample output:
7 files and folders dropped:
0       13.01.2012  19:59:15   procs
0       13.01.2012  19:59:14   tutorial
0       13.01.2012  19:59:14   tools
65536   17.08.2014  15:04:04   uniedit.exe
5598    17.08.2014  04:13:03   AllFiles.zip
22528   17.08.2014  00:40:24   topgun.exe
37376   17.08.2014  00:25:44   qeditor.exe


Full source attached, requires MasmBasic of 25 August 2014.

Gunther

Good idea, Jochen. Thanks.  :t

Gunther
You have to know the facts before you can distort them.

jj2007

#192
Version 22 Sept 14 (download):

- BUGFIX: Val("12.34.56") returns now correctly 12.34
- BUGFIX: StringsDiffer used wrong location to test the case-insensitive flag

- New feature: Now dialogs close apart from IDOK and IDCANCEL also for IDs 100...120, and return the ID


jj2007

Bugfix 5 October (download):

For a while, the FileRead$() function had "forgotten" how to read a file from the Internet - sorry :redface:

Now the snippet below works again. It downloads an attachment from this forum, checks the zip directory for the first *.asm file, and displays the first 1.8 k on the screen:

include \masm32\MasmBasic\MasmBasic.inc      ; download
  Init
  ; assign contents of a well-known file to esi:
  Let esi=FileRead$("http://masm32.com/board/index.php?action=dlattach;topic=49.0;attach=30")
  FileWrite "tmp.zip", esi, LastFileSize      ; write contents to a temporary file
  UnzipInit "tmp.zip"      ; expects a filename, returns a comment (if present)
  .if Sign?
      Print eax      ; print an error message
  .else
      For_ ecx=0 To edx-1      ; #files returned in edx
            mov esi, Files$(ecx)
            .if Instr_(esi, ".asm", 1)      ; assembler source, plain text?
                PrintLine "## First 1800 chars of ", esi, " ################# : ", CrLf$, Left$(UnzipFile(ecx), 1800), " ..."
            .endif
      Next
      UnzipExit
  .endif
  Inkey "## Cute, isn't it? #################"
  Exit
end start

jj2007

MasmBasic update of 15 October (download) concerns mainly improvements of the editor:

- plugins don't need to be registered in the menus.ini file, it is sufficient to build them in the plugin folder
- all menus allow now tooltips, as shown below; for plugins, they can be defined in the source using txName db "name in menu§description of\nthe plugin", 0