Masm32 SDK description, downloads and other helpful links

Main Menu


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

Previous topic - Next topic


Avast dislikes many things, just disable it temporarily. I have no time and no money to sue them for damaging the reputation of the library, but false positives are a fat problem. Did you know that we have even a dedicated sub-forum called AV Software sh*t list?

Attached an updated "MasmBasic for C" example. Extract to a folder named \Masm32\MasmBasic\Mb4C and make sure it's on the same drive as Masm32 and Pelles C (this is clumsy, I know, and will change when I find time to fix it).


should i uninstall an older version first, or will the new one take care of it ?


better question here....

how do i do a clean uninstall of MasmBasic?


Quote from: dedndave on September 26, 2015, 03:15:45 AMshould i uninstall an older version first, or will the new one take care of it ?
how do i do a clean uninstall of MasmBasic?

The installer will just overwrite any MB files, unless they have been altered after the new version. Normally, you can't do anything wrong with this logic; unless you fumble with, and forget to make a backup. But that would be about as stupid as improving and re-installing Masm32 :biggrin:

Re uninstall: It doesn't write anything to the registry, so it's just the \Masm32\MasmBasic folder. The editor has the habit to save user-written code to \Masm32\MasmBasic\AscUser, so you might check if there is anything valuable in there.

Attached a list of all currently installed files.


thanks Jochen   :t

it's been a while since i updated it
so, i will delete the folder and install "anew"



Version 1 October 15 features the new ultrafast variant of Instr_():

Instr_, Rinstr, wInstr, InstrOr
      Print "The current drive is ", Left$(ThisExe$, Instr_(ThisExe$, "\")-1)
      mov pos, Instr_(1, L$(n), "equ", 1+4)      ; 1=start pos, 1=case-insensitive + 4=full word
Rem   - returns relative pos in edx, absolute in eax
      - if no match is found, zero is returned in edx, and eax points to the start of the 'haystack'; same if 'needle' is empty
      - six syntax variants allowed:
         A: has startpos:      Instr_(1, "Test", "Te", 2)     ; 4 args
         B: no startpos:      Instr_("Test", "Te", 2)         ; 3 args, last one immediate = mode
         C: has startpos:      Instr_(1, "Test", "Te")        ; 3 args, last one not immediate
         D: no startpos:      Instr_("Test", "Te")            ; 2 args
         E: test several patterns:      InstrOr("Test", "Te" or "st", 1)  ; 3 args (startpos is 1)
         F: extra fast mode:      Instr_(FAST, My$(ecx), "Hello", 0)      ; 4 args, no startpos, modes 0+2 only
       - case & mode (bitwise flag):
         0=case-sensitive, +1=insensitive, +2=intellisense (Name=name),
         +4=full word search, +8=include start of line in text block search
         Note: full word search returns failure for chars above ASCII 64 to the left or right
         Example: Nostructfoundhere, this123struct456isfound, this@struct, too

         The FAST option is about twice as fast as CRT strstr, and three times
         as fast when used with string arrays;

         using FAST, binary search in haystacks containing zeros is possible by
         assigning the buffer size to edx:
           mov edx, LastFileSize      ; any info on length of buffer can be used with edx
           Print Str$("Pos in executable: %i", Instr_(FAST, esi, "kernel32", 2 or 64)      ; 2=case-insensitive, 64=len in edx

       - wRinstr is available but only as wRinstr(src, pattern) with a one-byte pattern (e.g. "\")


MasmBasic version 3 October features Enum$(), the companion to Enum:

Enum            ; create a list of IDs
Enum      IdMenuNew, IdMenuSave, IdMenuCopy, IdTimer
Enum      20:IdEdit, IdButton1, 30:IdButton2, IdStatic, IdFind, IdFindStatic
Remdefault start is 10, but (as shown above) new start values can be specified with nn:

Enum$          ; return numeric constant as text
  Enum 20:IdEdit, IdButton1, 30:IdButton2, IdStatic, IdFind, IdFindStatic
  ; use with CreateWindowEx
  ; ID is loword(wParam), print it as Enum$(ID, list of numeric constants)
  PrintLine "command for control ", Enum$(word ptr wParam, IdEdit, IdButton1, IdButton2, IdStatic, IdFind, IdFindStatic)
  .if byte ptr [ecx]!="?"      ; if no matching entry is found, Enum$() returns a question mark
      PrintLine "Message: ", ecx      ; output e.g. Message: WM_PAINT

Below and attached a full example showing a practical use of Enum$().

include \masm32\MasmBasic\      ; download
uselib ntdll            ; for RtlGetVersion
  Init                  ; OPT_Assembler JWasm ; ML chokes with version suite string
  push RTL_OSVERSIONINFOEXW      ; set size member
  invoke RtlGetVersion, esp
  mov ecx, esp      ; ecx is pointer to RTL_OSVERSIONINFOEXW structure
  ovi equ [ecx.RTL_OSVERSIONINFOEXW]      ; MSDN
  .if eax
      PrintLine "RtlGetVersion failed with ", Err$()
      PrintLine Str$("RtlGetVersion\t%i.", ovi.dwMajorVersion), Str$(ovi.dwMinorVersion), Str$(" SP %i.", ovi.wServicePackMajor), Str$(ovi.wServicePackMinor), Str$(" build %i", ovi.dwBuildNumber)
      Print "Suite mask", Tb$, Hex$(ovi.wSuiteMask), ": "
      For_ esi=0 To 31      ; see Geoff Chappell: The Product Suite
            xor eax, eax
            bts eax, esi
            and ax, ovi.wSuiteMask      ; extra long line requires JWasm or AsmC
            .if byte ptr [ebx]!="?"
                  Print Mid$(ebx, 11), " "
      PrintLine CrLf$, "ProductType", Tb$, Mid$(Enum$(ovi.wProductType, VER_NT_WORKSTATION, VER_NT_DOMAIN_CONTROLLER, VER_NT_SERVER), 8)
      lea eax, ovi.szCSDVersion
      wPrintLine "CSDVersion", wTb$, eax, wCrLf$      ; Unicode

  Inkey CrLf$, "---- hit any key ----"
EndOfCode            ; see MSDN

Output for Win7-64:
RtlGetVersion   6.1 SP 1.0 build 7601
Suite mask      0300: SINGLEUSERTS PERSONAL
ProductType     WORKSTATION
CSDVersion      Service Pack 1


XP - not much help - lol

i guess that would formatted as "5.1.2600 SP 3.0"

RtlGetVersion   5.1 SP 3.0 build 2600
Suite mask      0100: SINGLEUSERTS
ProductType     WORKSTATION
CSDVersion      Service Pack 3


Update 6 October: Inspired by James Fuller, the Choose command was added to the library:

include \masm32\MasmBasic\      ; download
tx123      db "This is tx123", 0

  mov ecx, Chr$("ecx is a string")
  Dim My$()
  Let My$(0)="array element 0"
  Let My$(1)="array element 1"
  .While 1
      Inkey "Gimme a letter from a-z: "
      .Break .if eax==VK_ESCAPE
      xchg eax, ecx
      .if Choose(ecx-"a", 100, 101, 102, "abc", 124, 12345.67, 12345678.90123456789, offset tx123, ecx, My$(1), "the letter k")<=ChooseString
            .if eax==ChooseReal
                  Print Str$("You chose the real number %Jf\n", ST(0))
                  fstp st
            .elseif eax==ChooseError
                  PrintLine "You typed the letter ", Chr$(ecx), " - error..."
                  push eax
                  Print Str$("You chose the integer %i ", eax)
                  pop eax
                  PrintLine " (hex", Hex$(eax), ")"
            PrintLine "You chose the string [", eax, "]"

P.S.: VB Choose Function on MSDN uses a double as the index - funny idea 8)


MasmBasic update of 11 October improves on its GUI interface:

GuiParas equ "Plotting a sinus and a map", x30, y30, w1200, h700, bnone
include \masm32\MasmBasic\Res\MbGui.asm
  ToolTips                  ; initialise the tooltips, they will
  ToolTips end              ; show the country names
  ArrayLoadMap 0, "\masm32\MasmBasic\Res\"
Event Paint
  ArrayPlot hWnd, RgbCol(144, 240, 255)          ; init with window (or control) handle and background colour
  ArrayPlot 0, RgbCol(127, 127, 127), lines=2    ; display map #0 with grey borders 2px thick
  ArrayPlot exit, "Europe"                       ; finish with a title
  GuiTextBox 35.0, 92.0, 120, 32, "This application is sizeable - try it!!!!", fcol 0ffh, bcol RgbCol(204, 255, 204)
  GuiTextBox 29.0, 63.0, 85, 66, "Move the mouse over a country to see its name", fcol 0, bcol RgbCol(255, 255, 128)
Event Message
  .if uMsg==WM_MOUSEMOVE
      ArrayMapRegion(lParam, 0, hWnd)      ; activate tooltip if mouse enters a region

Screenshot below. It's heavily sized, to save bandwidth - the full version looks better ;-)


i like the idea - but have no idea how it works - lol

i'd like to write a program that generates "great circle" maps (azimuthal equidistant)
they have them - they even have online generators, but i'd like my own
at any rate - no time to play with it for now   :(


here's one, with the center on "some town" in France
they are different for every location in the world - lol

we use them to "aim" our antennas
some guy in France wants to talk to a guy in Alaska, he aims his antenna about 350 degrees


Once upon a time, MSIE had a function that allowed to extract a table to Excel (the only reason I ever used Explorer instead of Firefox). That seems to have stopped working a long time ago, so I wrote a little proggie (70 lines) that does the job.

It is not for general use, though; some manual adjustment will be needed to download other tables. Here is the main loop that generates the string array (full code & exe attached, requires MB of 14 October 2015)

  .While ct<maxcountries      ; xs mode: use in loop, exclude left and right search strings
      Let t$(ct, Rank)=Extract$(esi, '<td>', '</td>', xsLoop or xsExcL or xsExcR)
      Let t$(ct, Country)=Extract$(esi, 'title="', Chr$(34, 62), xsLoop or xsExcL or xsExcR)
      Let t$(ct, Int$)=Extract$(esi, '<td>', '</td>', xsLoop or xsExcL or xsExcR)
      inc ct

So if you are feeling strong in HTML, press Ctrl U in FF or MSIE and try to guess which left and right matches are suitable for extracting the table :P

P.S.: Download of the library appears to be disturbed today. I managed once to download and install with MSIE, but very, very slowly. FF downloads at under 3kB/s, and doesn't complete. Is it just my line, or have the Aussies been cut off from the Internet once more? The forum is also really slow today.


I was attempting to install your masmbasic library but the install screen is too large for my laptop screen. The max resolution for my laptop is 1366 x 768. I'm unable to see any buttons at the bottom of the screen to press to install masmbasic. Here is a screenshot:

Just used my desktop to install your library and copied the files onto my laptop. Couple things I noticed.

- The ReadMeMasmBasic.txt shows the download location for JWasm at "" which seems to be an invalid location now.

- After replacing ml.exe with Jwasm.exe I received  an error when attempting to assemble my program. Example of code where I encountered and error below:

.if eax == 1
     do this
     do this

Now my .elseif should have been an .else in the first place but just wanted to let you know since it appears you wanted Jwasm to be a backwards compatible with microsofts ml.exe. Jwasm was just letting me know about my poor programming which microsofts ml.exe didn't care about.

Also just FYI. I'm sure you already know but Avast is throwing some fits about your installer.