News:

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

Main Menu

A guide to the RichMasm editor

Started by jj2007, April 28, 2016, 10:09:34 PM

Previous topic - Next topic

jj2007

#15
Quote from: mabdelouahab on February 14, 2017, 04:23:46 PMHow do I deal with this?
Error A2106: Cannot open file: "tmp_file.asm" [ENOENT]

Sorry for that, mabdelouahab :icon14:

It works for me with Win7-64 and Win10, Italian versions. Now the question is why RichMasm can't open (or can't find) your tmp_file.asm :(

Does your folder name contain non-Ansi characters? If yes, then version 14 Feb 2017 should work for you. I just uploaded it, there was a SetCurrentDirectoryA that made the assembly fail if the path contained "true" Unicode. Please let me know if it works now.

Anybody else having this kind of problems?

LordAdef

Rock solid here JJ.

By the way, did you notice this line in his report:

Quote*** Assemble, link and run صندوÙ, رساÙ,,Ø© ***


jj2007

#17
Quote from: LordAdef on February 15, 2017, 07:44:48 PM
Rock solid here JJ.

Thanks :biggrin:

QuoteBy the way, did you notice this line in his report:

Quote*** Assemble, link and run صندوÙ, رساÙ,,Ø© ***

Yes indeed, RichMasm used Ansi filenames - call it a bug. The latest version (15 Feb) handles it correctly (F9 produces the big MessageBox):



Project attached, needs MasmBasic 15 Feb 2017.

jj2007

#18
The attached beta has a new version of RichMasm allowing, inter alia, to translate hyperlinks very directly into source code - see second attachment.

GuiParas      equ "ToolTips for the SysLink control", w300, h80
include \masm32\MasmBasic\Res\MbGui.asm
  GuiControl GetHelp, "syslink", h0+20, "Click here to download MasmBasic, or here for online help"
  GuiControl VisitMoscow, "syslink", y0+20, h0+40, "Get info on Moscow: Развлечения, история, музеи, рестораны-кафе, гостиницы, информация"

Event Command
  .if NotifyCode==NM_CLICK && (wParam==GetHelp || wParam==VisitMoscow)
      wMsgBox 0, Link$(), "Open this page?", MB_OKCANCEL
      If_ eax==IDOK Then <wShEx Link$()>
  .endif
GuiEnd
Rsrc
#include "resource.h"
IDI_APPLICATION ICON      "\\Masm32\\MasmBasic\\icons\\Smiley.ico"
01 RT_MANIFEST      "\\Masm32\\MasmBasic\\Res\\XpManifest.xml"
Rsrc

This is how it looks in the editor:

EDIT: Beta removed, the current version has the new features now.

jj2007

As Edsger Wybe Dijkstra once noted,
QuoteIt is practically impossible to teach good programming to students that have had a prior exposure to Visual Studio: as potential programmers they are mentally mutilated beyond hope of regeneration.

For these poor beings, who spread their PROTOs and MACROs over a dozen tiny files in order to call their mess a "project", there is HELP now: The attached RichMasm beta extends the search feature (select a word, hit F3) to files that are INCLUDEd in the source.

This is limited to those files that are included by an UPPERCASE INCLUDE at the moment when the file was opened. So to test it, change the desired include to INCLUDE, then save and reload the file:

include \masm32\MasmBasic\MasmBasic.inc
; include \masm32\include\masm32rt.inc

INCLUDE mymacros.inc
INCLUDElib msvcrt.lib

Here, only mymacros.inc is included in the search.

TWell

#20
QuoteIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.
At that time BASIC was weak with subroutines and structured programming. Quick Basic and Turbo Basic correct some problems.

Asm programmers needs those little files when creating libraries as ml don't have support for COMDAT.

EDIT: forgot to say [h]jwasm and asmc have support for it.

A good IDE's have a 'Find in files' feature, like poide.exe has.

hutch--

I wonder what capacity the COMDAT (common data) has that cannot be done with MASM's "PUBLIC" keyword. It is routine to make something PUBLIC in MASM and access it from other modules.

jj2007

Quote from: TWell on May 01, 2017, 12:41:44 PMA good IDE's have a 'Find in files' feature, like poide.exe has.

Pelle's IDE is among the better ones, but the "find in files" feature is a joke. Check out the RichMasm beta to see the difference.

TWell

I tried to download it, but Avast ate it.
So what kind of feature it should be?

LordAdef

Tim, bypass Avast for 10 minutes and download it. Avast is not asm community friend  :icon_redface:

LiaoMi

Hi!

I compared the toolbar by looking at the picture in this top and noticed that only my menu is so badly displayed ... About how it looks like you can see below - https://ibb.co/bWF8Lk


Maybe this problem has already happened?

Thankeee!

jj2007

Quote from: LiaoMi on May 02, 2017, 04:20:39 AMonly my menu is so badly displayed

The menu font is a problem indeed. One day I will have to find a solution :(

Reason is that when the Aero themes came out, the old GetWindowDC trick stopped working.

@Tim: really, can't you disable Avast for 5 minutes?? Btw Jotti shows that 16 out of 19 AVs are OK with that RM beta. For the unpacked version, it's 18/19 OK.

LordAdef


jj2007

#28
EDIT: As discovered in the HeapAlloc vs HeapReAlloc thread, the Debugging Tools for Windows used here disable the Low Fragmentation Heap (LFH). As a consequence, allocating huge amounts (100,000+) of small buffers may take several seconds.

A simple demo showing how to detect heap corruption:

include \masm32\include\masm32rt.inc ; plain Masm32

.code
txString db "Hello, this is a simple string, 50 characters long", 0
start:
  mov esi, rv(HeapAlloc, rv(GetProcessHeap), HEAP_ZERO_MEMORY, 22h) ; 22h=34 bytes, not enough for txString

  print "before doing illegal things to esi="
  print hex$(esi), 13, 10

  invoke lstrcpy, esi, addr txString ; this is commonly called "buffer overflow"
  print " after doing illegal things", 13, 10, 10, "[" ; but it works just fine, because the heap
  print esi, "]", 13, 10, 10 ; doesn't yet know that it's "corrupt" now ;-)

  print "----- OK, we are now freeing esi, and strange things will happen: -----"
  invoke HeapFree, rv(GetProcessHeap), 0, esi
  inkey "----- buffer was freed -----"
  exit

end start ; OPT_Debug 1 ; this option requires RichMasm


When hitting F6 in RichMasm (MasmBasic's IDE), you will see this output:before doing illegal things to esi=002A5920
after doing illegal things

[Hello, this is a simple string, 50 characters long]

----- OK, we are now freeing esi, and strange things will happen: -----
## HEAP[HeapCorruption.exe]:
## Heap block at 002A5918 modified at 002A5942 past requested size of 22

## HEAP[HeapCorruption.exe]:
## Invalid address specified to RtlFreeHeap( 002A0000, 002A5920 )
----- buffer was freed -----


Project attached. Let me know if it can be improved.

jj2007

With MasmBasic version 11 July 2017, the formatted output has been improved: select text, hit F11, paste in a reply. Example:

include \masm32\MasmBasic\MasmBasic.inc         ; download
  if 0  ; copy the line below, then hit F6 to get the db version
        chartab                 dw "10","01","12","21","13","31"
        ; expected output:
        chartab                 db "0","1","1","0","2","1","1","2","3","1","1","3"
  endif
  Init                          ; *** translate Masm dw format to db for use with UAsm ***
  Let esi=Clip$()               ; get string from clipboard (limit is about 160k)
  lea ecx, [2*Len(esi)]         ; the byte format is longer, so we need a bigger buffer
  Let edi=New$(ecx)
  push esi
  push edi
  .Repeat
        lodsb
        If_ al=="w" Then mov al, "b"    ; dw->db
        stosb
        .Break .if !al
        .if al==34
                push [esi]
                lodsb
                movsb           ; first digit
                mov al, 34
                stosb
                mov al, ","
                stosb
                mov al, 34
                stosb
                pop eax
                stosb           ; second digit
                movsb           ; second quote
        .endif
  .Until 0
  pop edi
  pop esi
  Inkey "Before: ", esi, CrLf$, "After:  ", edi, CrLf$, "Copy to clipboard? (y)", CrLf$
  If_ eax=="y" Then SetClip$ edi
EndOfCode