Author Topic: MasmBasic  (Read 144218 times)

LordAdef

  • Member
  • ***
  • Posts: 255
Re: MasmBasic
« Reply #405 on: May 31, 2017, 12:46:19 PM »
  . the result in the Find is not updated for the include files, and still shows the old expression

Implemented in version 31 May - please reinstall the whole package, there was also a bug in the Ansi version of FileOpen$().

Let me know if it's OK like that, Alex. In contrast to the current version, the "external" matches now respect also the "case" and "fw" checkboxes, i.e. case-sensitive and full word mode are working correctly for the include files now.

Great update Johen. I'm downloading it tonight when I get back home.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
MasmBasic update
« Reply #406 on: June 13, 2017, 08:33:56 AM »
Version 13 June fixes an exotic bug in RichMasm - it choked if many uppercase INCLUDE files were found.

New feature: Console input with character limit as discussed here:

Code: [Select]
  .Repeat
      Print At(5, Locate(y)) " "
      Let esi=Input$("Go ahead, edit that string: ", "123456789012345678", max20)
      PrintLine "                       you typed [", esi, "]"
  .Until Len(esi)<5

Attached is a beta, exe only, that plays media files. Drag an audio or video file over the exe, if the codec is installed it will play. Cursor left, space, cursor right are relevant keys. Hold Ctrl for fast forward, Shift for slow back+forth.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #407 on: July 11, 2017, 06:28:10 PM »
Minor update 11 July (download):

jd@150 equ KernelBase                               ; a little hack for a missing WinAPI,
j@VirtualProtectFromApp equ jbNextApi/150:s1111     ; may be refined in the near future
...
  mov r12, rv(MessageBoxA, @address)    ; address of MessageBoxA in the DLL


This is a rather exotic function needed for 64-bit code when you need the true address of a function in its DLL. Full example here.

Plus, RichMasm produces now better formatted output for this forum.

jiucenglou

  • Regular Member
  • *
  • Posts: 12
Re: MasmBasic
« Reply #408 on: July 15, 2017, 11:27:36 PM »
Wow ! Such a wonderful project !
Would you recommend which debugger to use if MasmBasic dialect is used together with ML.exe ? (I mean, VS seems to provide a really decent and productive debugger for C/C++ or even MASM.)

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #409 on: July 15, 2017, 11:37:44 PM »
Wow ! Such a wonderful project !
Would you recommend which debugger to use if MasmBasic dialect is used together with ML.exe ? (I mean, VS seems to provide a really decent and productive debugger for C/C++ or even MASM.)

Thanks ;-)
Re debugger, many of us here use Olly.

jiucenglou

  • Regular Member
  • *
  • Posts: 12
Re: MasmBasic
« Reply #410 on: July 16, 2017, 12:37:04 AM »
Thank you for your recommendation very much ! I will try OllyDbg 2 :t

Rob260z

  • Regular Member
  • *
  • Posts: 9
Re: MasmBasic
« Reply #411 on: August 01, 2017, 01:05:14 PM »
Yes... What a wonderful project. Extremely grateful for all the hard work and effort that has gone into developing this. Starting using the Rand function last week, but then I discovered Deb!, and it's been love at first site :)

Working with a lot of loops that involve the creation and use of indexed addressing. Can't recommend this function enough, especially the ability to output to a text file.

Keep up the good work :)

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #412 on: August 01, 2017, 05:14:46 PM »
Thanks, Rob - that is the kind of feedback I've been looking for the last 20 years :greensml:

Re deb: I rarely use deb 5 (to file) nowadays, but it can be useful. For monitoring a loop, try deb 7 or deb 30 - any number above 5 shows n times the result, then the loop continues. Also, deb 4, "The error:", eax, $Err$() is a very useful one in WinAPI programming ;-)

Rob260z

  • Regular Member
  • *
  • Posts: 9
Re: MasmBasic
« Reply #413 on: August 01, 2017, 07:06:52 PM »
Cheers for the advice jj :)

deb 7 or 30 , I'll have to have a look. Excuse my ignorance , but these will require a Win32 console/window ? . Just had a quick read through the help file , but didn't see any info about these.

I'm using SDL2 , simply as a means of spitting out a custom texture , so I'm simply going into an Opengl/DirectX full screen mode. That's why I'm currently using the text file approach. Using the same approach to spit out any performance/benchmark info.


Cheers,
Rob

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #414 on: August 01, 2017, 07:12:46 PM »
so I'm simply going into a full screen Opengl mode.

So that doesn't allow a separate console window, right? Then deb 5 is the only solution indeed. Or deb 0...3, you can cancel the messageboxes separately.

; OPT_Susy Console ; forces console mode

Rob260z

  • Regular Member
  • *
  • Posts: 9
Re: MasmBasic
« Reply #415 on: August 01, 2017, 09:29:12 PM »
Well...I can actually make it run in a windowed mode. I'm going to explore this a little further. Has real potential.

Real-time debugging is going to be really beneficial, once I move past this initial setup phase.

Cheers for the info.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #416 on: August 01, 2017, 11:17:54 PM »
Well...I can actually make it run in a windowed mode. I'm going to explore this a little further. Has real potential.

Another trick:
Code: [Select]
  winX=150
  winW=900
  ifidni @Environ(oSusy), <console> ; OxPT_Susy Console ; RichMasm autodetect will pick Windows, delete the x to force console
winX=450  ; leave more space for console output
winW=600
deb 4, "Hey, we are using a console in parallel to a window", $wc.lpszClassName
  endif
  invoke CreateWindowEx, WS_EX_ACCEPTFILES, wc.lpszClassName, chr$("Hello World"), ; set window title here
     WS_OVERLAPPEDWINDOW or WS_VISIBLE,
     winX, 150, winW, 400, ; window position: x, y, width, height
     NULL, NULL, wc.hInstance, NULL

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #417 on: August 26, 2017, 10:38:00 AM »
Please download and run the 26 August 2017 version of the package. As always, you can just follow the instructions, the new installation does not change any of your sources or settings, does not write anything to the registry, and does not interfere with your Masm32 installation (I do reinstallations frequently myself when testing...).

Note that you can use an xmm reg as destination in QuadMath mode, but it has to be prefixed as MovVal q:xmm0, "123", otherwise, an ordinary 64-bit integer will be loaded:

include \masm32\MasmBasic\MasmBasic.inc         ; download
include \masm32\MasmBasic\Res\QuadMath.inc
  Init quad                                     ; requires C:\TDM-GCC-32\bin\libquadmath-0.dll
  mov esi, Chr$("1234567890123456789.0123456789012345678901234567890")
  MovVal xmm0, esi
  PrintLine "64-bit int: ", Tb$, Str$(xmm0)
  MovVal f:xmm0, esi
  PrintLine "double/Real8: ", Tb$, Str$(f:xmm0)
  MovVal q:xmm0, esi
  PrintLine "Quad float e:", Tb$, Quad$(xmm0)
  MovVal q:xmm0, esi
  PrintLine "Quad float g:", Tb$, Quad$(xmm0, "%*.33Qg")        ; formats
EndOfCode


Output:
Code: [Select]
64-bit int:     1234567890123456789
double/Real8:   1.23456789012346e+18
Quad float e:   1.23456789012345678901234567890123e+18
Quad float g:   1234567890123456789.01234567890123

The other aspect concerns UAsm: By default, RichMasm will from now on use the faster UAsm64 for building 32-bit as well as "dual" 64/32-bit sources. If UAsm64 is not present in \Masm32\bin, RichMasm will ask you if you want to install it, and download and extract a recent version.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
For_ each ecx in Files$(): PrintLine ecx
« Reply #418 on: September 06, 2017, 12:44:29 PM »
include \masm32\MasmBasic\MasmBasic.inc         ; download version 6 September
  Init
  GetFiles \Masm32\examples\unicode_generic\*.asm|*.inc|*.rc  ; use the "or" character to separate masks
  For_ each ecx in Files$() : <PrintLine Str$("file %_i\t", ForNextCounter), ecx>   ; one line is enough ;-)
EndOfCode


Output:
Code: [Select]
file # 0        \Masm32\examples\unicode_generic\console\hello\hello.asm
file # 1        \Masm32\examples\unicode_generic\console\textio\textio.asm
file # 2        \Masm32\examples\unicode_generic\diskfile\diskfile.asm
file # 3        \Masm32\examples\unicode_generic\diskfile\WININC.INC
file # 4        \Masm32\examples\unicode_generic\multi_lingual\multi_lingual.asm
file # 5        \Masm32\examples\unicode_generic\multi_lingual\multi_lingual.inc
file # 6        \Masm32\examples\unicode_generic\multi_lingual\ansi.rc
file # 7        \Masm32\examples\unicode_generic\multi_lingual\rsrc - Copia.rc
file # 8        \Masm32\examples\unicode_generic\multi_lingual\rsrc.rc
file # 9        \Masm32\examples\unicode_generic\string_examples\append$\append$.asm
file #10        \Masm32\examples\unicode_generic\string_examples\cat$\cat$.asm
file #11        \Masm32\examples\unicode_generic\string_examples\find$\find$.asm
file #12        \Masm32\examples\unicode_generic\string_examples\switch$\switch$.asm
file #13        \Masm32\examples\unicode_generic\template\misc.asm
file #14        \Masm32\examples\unicode_generic\template\template.asm
file #15        \Masm32\examples\unicode_generic\template\template.inc
file #16        \Masm32\examples\unicode_generic\template\rsrc.rc

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #419 on: September 12, 2017, 08:23:37 AM »
MasmBasic update 12 September:
- ifdeb allows single lines that create code only in debug mode:

include \masm32\MasmBasic\MasmBasic.inc         ; download
  Init
  usedeb=1
  For_ ecx=1 To 20
        ifdeb push ecx : Print "[": .if 0
       Print Str$("%_i ", ecx)
        ifdeb .endif : PrintLine "]" : pop ecx
  Next

EndOfCode

- RichMasm has got a more advanced "Obscure string" feature (more)
- an error will be thrown if the handle for ToolTips is passed in esi

- finally, dynamic string arrays got a bit speedier, they are now practically as fast as fixed Dim some$(100) arrays:

include \masm32\MasmBasic\MasmBasic.inc
  Init
  PrintCpu 0
  Dim MyArray$()                ; create a dynamic array
  NanoTimer()                   ; start high resolution timer
  xor ecx, ecx
  .Repeat
        Let MyArray$(ecx) = Str$("This is string %i", ecx)
        inc ecx
  .Until ecx>=1000000
  Print Str$("%i ms", NanoTimer(ms)), Str$(", %i Million strings allocated\n", MyArray$(?)/1000000)

  Dim FixedArray$(1000000)      ; create a fixed size array
  NanoTimer()
  For_ each ecx in FixedArray$(): <Let FixedArray$(ForNextCounter) = Str$("This is string %i", ForNextCounter)>
  Inkey Str$("%i ms", NanoTimer(ms)), Str$(", %i Million strings allocated\n", FixedArray$(?)/1000000)
EndOfCode


Code: [Select]
Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz
353 ms, 1 Million strings allocated
349 ms, 1 Million strings allocated