Author Topic: MasmBasic  (Read 129248 times)

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7206
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #405 on: May 12, 2017, 09:34:58 PM »
"find" now finds key words in INCLUDE files (with Capital letters) and shows them in the find window. But "Replace" can't replace them in the include files.

Thanks, Alex. Version 12 May has a warning now, please let me know if that is the right choice. It would be technically possible to replace strings in the include files, but updating include files is not something I would support - too risky.

Among the other changes:

- By holding Ctrl and moving the mousewheel, the RichEdit control can zoom the display. At my age and my eyesight, I need 110%, but there may be people who have brilliant eyes and want to see more code. Pressing Alt Z saves the current zoom level; this is a global setting, i.e. RichMasm remembers this when opening any document (it also affects the font in the Find listbox, but only after restarting RichMasm).

- introduced a new Event variable VKey2:

Event Key
  Switch_ VKey2
  Case_ VK_LEFT:      wAddWin$ hMyEdit=" текст", 44       ; insert Unicode text at position 44
  Case_ VK_RIGHT:      AddWin$ hMyEdit=" missed", 50, 57  ; insert Ansi text at position 50, overwrite 7 bytes
  Case_ VK_UP     
            Let My$=FileRead$("UnicodeIsEasy.asc")
            wAddWin$ hMyEdit=My$
  Case_ VK_DOWN:      <wAddWin$ hMyEdit=wRec$(cfm$("\nВведите\nтекст\nздесь\n"))>  ; append & use cfm$ for \n escapes
  Endsw_


Until now, VKey was available to test for e.g. VK_SPACE or whatever; and the rule was that a positive VKey comes from the main application, a negative one (.if VKey==-VK_SPACE) from the riched control. Now you can catch a keypress independently of whether the control has the focus or not. Full example attached.

The snippet above also demonstrates new optional arguments for AddWin$:
AddWin$ hRichEdit="Text" [, startpos][, endpos]

The online doc for AddWin$ says it's normal edit controls only, but that is wrong. I should update that page...

LordAdef

  • Member
  • ***
  • Posts: 257
Re: MasmBasic
« Reply #406 on: May 13, 2017, 02:39:46 AM »
Quote
Thanks, Alex. Version 12 May has a warning now, please let me know if that is the right choice. It would be technically possible to replace strings in the include files, but updating include files is not something I would support - too risky.

ok JJ.
One other issue for you, still on the Find:
  .Once I make a change in the include file and save it,
  . come back to Main source code and
  . search for something...
  . the result in the Find is not updated for the include files, and still shows the old expression

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7206
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #407 on: May 29, 2017, 11:35:41 AM »
Version 29 May is online. As usual, you can just reinstall the package, no need to delete old files or backup your own sources.

Pens and brushes can now be created to arrays. This creates 100 random circles in random colours (attached):

include \masm32\MasmBasic\Res\MbGui.asm
  Dim Pens() As DWORD
  Dim Brushes() As DWORD
  For_ ct=0 To 99
      MakePen Pens(ct), Rand(-1), width 10      ; use random colours
      MakeBrush Brushes(ct), Rand(-1)      ; also for the fill
  Next
  MakePath      123, Circle(200)      ; ID, type circle: radius 20%, i.e. n/1000 of window rect
Event Paint
  For_ ct=0 To 99  ; ID       pen/brush          x        y     scaleX      scaleY
      GuiDraw 123, <Pens(ct)/Brushes(ct)>, <Rand(850).>, <Rand(850).>, eax, <Rand(900)>      ; ScaleX is eax, same as scaleY
  Next
GuiEnd



the result in the Find is not updated for the include files, and still shows the old expression

Sorry, Alex, no time to fix that right now. You can reload, though: Shift F5

Good news: RichMasm works on Windows XP. Again. It had stopped working due to a hilarious Windows bug, see
Code pages and batch files - fun with XP.

As a side effect, I had to write a new macro:

include \masm32\MasmBasic\MasmBasic.inc
      Init
      Print Str$("This is Windows version %i", MbWinVersion()), Str$(".%i", ecx)
      void MbWinVersion()
      Print Str$(", build %i", dx)
EndOfCode
Rem      returns major version in eax, minor version in ecx, and build in dx


Output: This is Windows version 6.1, build 7601

Note this is the real Windows version, not what you declare via "compatibility settings".

Btw when building a project in RichMasm, the environment variable is accessible via
Code: [Select]
  ifidn @Environ(oWin), <5>
MsgBox 0, "Built on XP", "Hi", MB_OK
  endif

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7206
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #408 on: May 30, 2017, 02:24:47 AM »
Drag an avi file over the exe, for example Mikl's demo file - see Uncle Remus tales:#37a Animation.

GuiParas equ "SysAnimate32 demo", w452, h374, bRgbCol(255, 255, 160)
include \masm32\MasmBasic\Res\MbGui.asm            ; part of MasmBasic
GuiControl Avi, "SysAnimate32"
invoke SendMessage, hAvi, ACM_OPEN, 0, CL$()
invoke SendMessage, hAvi, ACM_PLAY, -1, 0FFFF0000h
GuiEnd


I was surprised how easy it is, but its usage is rather limited: no sound :(

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7206
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #409 on: May 31, 2017, 09:21:38 AM »
  . 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.

LordAdef

  • Member
  • ***
  • Posts: 257
Re: MasmBasic
« Reply #410 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: 7206
  • Assembler is fun ;-)
    • MasmBasic
MasmBasic update
« Reply #411 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: 7206
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #412 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 #413 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: 7206
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #414 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 #415 on: July 16, 2017, 12:37:04 AM »
Thank you for your recommendation very much ! I will try OllyDbg 2 :t