Author Topic: MasmBasic  (Read 243134 times)

HSE

  • Member
  • *****
  • Posts: 1028
  • <AMD>< 7-32>
Re: MasmBasic
« Reply #450 on: November 30, 2018, 03:16:20 AM »
It has been a while..

- could not open MenusRM.ini
- problem with @AsmUsed$()

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 9513
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #451 on: November 30, 2018, 02:09:40 PM »
- could not open MenusRM.ini
- problem with @AsmUsed$()

Both problems fixed, please reinstall MasmBasic. Grateful if you could test this snippet with the new version:

GuiParas equ "Hello World", w160, h100
include \masm32\MasmBasic\Res\MbGui.asm
GuiControl MyEdit, "RichEdit", Cat$("This program was assembled with "+@AsmUsed$()+" and uses common controls version "+ComCtl32$())
GuiEnd xp
« Last Edit: November 30, 2018, 03:33:14 PM by jj2007 »

Phrediac

  • Regular Member
  • *
  • Posts: 1
Re: MasmBasic
« Reply #452 on: January 17, 2019, 09:46:13 AM »
Hi

I get this popping up when I try to run the program. It's not from the AV software (Avast).
I'm running Windows 7.

Sorry, can't figure out how to upload images.

Many thanks
-Ian

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 9513
  • Assembler is fun ;-)
    • MasmBasic
Avast false positive
« Reply #453 on: January 17, 2019, 02:15:51 PM »
Hi Ian,

RichMasm.exe is the editor, and I use it all the time on several machines. It is clean, no virus there, I know it because I build it from the source, over 20,000 lines. However, several AV scanners report malware, see the VirusTotal results: 18 out of 70! Here is the report for the same file but uncompressed, and the detection rate drops to 6 of 69. So simple compression is sufficient for 12 of these brilliant AV engines to shout foul. The reason is that no AV can test for all viruses and trojans in the wild, the databases would be huge, and testing would slow down your Windows to a crawl. So they use "heuristics" for detecting "suspicious behaviour", such as: Does the instruction "pushad" appear in the exe? Normal for assembler, almost never used by C compilers.

Check what the better AV engines report, like Kaspersky, Symantec etc., and then decide whether you really want to learn assembly. Once your executables grow a bit in size, they will never look like mainstream C/C++ executables - bad luck :P

I see you are using Avast. Virustotal says Avast reports Win32:Evo-gen, and googling for that virus leads quickly to
Is Win32.Evo-gen(Susp) a False Positive? and What's with all the new Win32:Evo-gen [Susp] false positives?  (Read 23100 times), so RichMasm.exe is not the only victim of Avast.

If you are interested, the forum has a dedicated section "AV Software sh*t list".

Cheers, Jochen

P.S.: VirusTotal has "Details" and "Behaviour" tabs. Here are details for the attached uncompressed RichMasm.exe:
Code: [Select]
Win32 Executable MS Visual C++ 4.x (59.6%)
Win32 Executable MS Visual C++ (generic) (13.8%)
Win64 Executable (generic) (12.2%)
Windows screen saver (5.8%)
Win32 Dynamic Link Library (generic) (2.9%)

So they believe with 59.6+13.8%=73.4% probability that it was built with MS Visual Crap :icon_mrgreen:

Here is another example, it is the Download URL with UTF8 executable:
Code: [Select]
Win64 Executable (generic) (47.7%)
Windows screen saver (22.6%)
Win32 Dynamic Link Library (generic) (11.3%)
Win32 Executable (generic) (7.7%)
OS/2 Executable (generic) (3.5%)

So they believe it's a Win64 exe. Or a DLL, or maybe a screensaver. Oh well, this is hitech, folks :t

I attach the uncompressed version of RichMasm.exe - welcome to the Forum :icon14:

felipe

  • Member
  • *****
  • Posts: 1200
  • Eagles are just great!
Re: MasmBasic
« Reply #454 on: January 18, 2019, 04:00:31 AM »
nice info  :icon14:
Felipe.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 9513
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #455 on: January 25, 2019, 11:36:04 AM »
Please reinstall MasmBasic, updated on 25 January 2019.

Minor improvements under the hood, plus:

1. A new macro, _Local; my old favourite programming language, GfaBasic, had local variables (of course), but in contrast to MASM one could initialise them. This is now possible in Assembler:

include \masm32\MasmBasic\MasmBasic.inc         ; download
.code

MyTest proc uses esi edi ebx arg1, arg2
 LOCAL var1, var2, rc:RECT, buffer[100]:BYTE                   ; "normal" locals, will be initialised to zero
_Local MyR4:REAL4=12345.6789, MyR8:REAL8=1234567890.1234567890         ; REAL variables
_Local var3=arg2, var4=200, x$=arg1, y$="Hello World"                  ; DWORDs and strings
  ClearLocals                          ; clear or set locals
  Print Str$("v1=%i", var1), Str$(", v2=%i", var2), Str$(", v3=%i", var3), Str$(", v4=%i", var4), Str$(", a2=%i", arg2)
  Print Str$(", R4=%7f", MyR4), Str$(", R8=%Df", MyR8)
  PrintLine ", x$=", x$, ", y$=", y$
  ret
MyTest endp

  Init
  For_ ecx=0 To 150
        invoke MyTest, Str$(ecx), ecx
  Next
EndOfCode


The syntax is _Local var=whatever (i.e. understroke plus camel case Local). The declarations must be followed by ClearLocals. Full project is attached.

2. NoTag$() recognises many more special characters now. Test it:

include \masm32\MasmBasic\MasmBasic.inc         ; download
  Init
  Let esi=FileRead$("http://masm32.com/board/index.php?topic=94.0")     ; assign page to a string
  FileWrite "temp.txt", NoTag$(esi)     ; strip the tags and write plain text to disk
  ShEx "temp.txt"               ; have a look with ShellExecute
EndOfCode


3. A bugfix for the SysLink GuiControl; the tooltips didn't appear. Now it's working fine, see attached project and screenshot below.

anunitu

  • Member
  • *****
  • Posts: 1110
Re: MasmBasic
« Reply #456 on: January 26, 2019, 05:11:27 AM »
as always JJ love your hard work on masmbasic

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 9513
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #457 on: January 26, 2019, 05:30:40 AM »
Thanks, anunitu :icon14:

anunitu

  • Member
  • *****
  • Posts: 1110
Re: MasmBasic
« Reply #458 on: January 26, 2019, 05:32:10 AM »
you sly asm devil

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 9513
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #459 on: January 31, 2019, 01:54:36 PM »
Update 31 January 2019:
- Rand(): randomness of REAL8 variables improved
- add2m and sub2m macros (use like m2m)
- MakePath: graphs can now be modified 'on the fly', e.g. in the Timer event, thus allowing moving shapes (demo attached):

  MakePen hPenBez, RgbCol(255, 255, 0, 0), width 4
  ArraySet pts() As DWORD = 10, 10, 80, 40, 40, 190, 190, 50, 100, 170, 180, 170, 100, 0
  MakePath 123, Bezier(pts())

Event Timer
  add2m pts(2), dirX
  add2m pts(7), dirY

Event Paint
  GuiDraw 123, hPenBez, 10.0, 10.0, 2500, 5000  ; x, y, scaleX, scaleY

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 9513
  • Assembler is fun ;-)
    • MasmBasic
ArrayIndex(SomeNumericArray(), SomeNumber)
« Reply #460 on: February 05, 2019, 10:54:52 PM »
The MasmBasic update of 5 February 2019 features a new ArrayIndex() macro inspired by Guga's Fast Compare Real8 with SSE thread. The macro returns in eax the position of a number in a sorted array; if dl is zero, an exact match was found, otherwise the nearest position will be returned in eax. Syntax example:

Print Str$("The position of the number 8377 in the array table() is %i", ArrayIndex(table(), 83777))

The sorted array, table() in this example, can be composed of DWORD, QWORD or REAL8 values. Below and attached a complete example:

include \masm32\MasmBasic\MasmBasic.inc
  Init
  StringToArray FileRead$(99), table() As DWORD  ; read an array from resource #99
  ArraySort table()    ; sort ascending
  Let esi="83777"      ; just a suggestion
  Print "Hit Escape & Return to exit"
  .While 1
        Print At(0, 1)
        Let esi=Input$("Gimme a prime: ", esi)
        .Break .if !Len(esi)
       void ArrayIndex(table(), Val(esi))      ; works with DWORD, QWORD and REAL8 arrays
        .if dl
                PrintLine esi, Str$(" is not a prime, sorry!!!! - the nearest prime is %i   ", table(eax))
        .else
                PrintLine Str$("congrats, prime found at pos #%i !!", eax), Space$(32)
        .endif
  .Endw
EndOfCode

guga

  • Member
  • *****
  • Posts: 1041
  • Assembly is a state of art.
    • RosAsm
Re: MasmBasic
« Reply #461 on: February 06, 2019, 02:14:01 AM »
Tks, JJ :)

Found only a small issue. Whenever the searching number is bigger or equal to the last one on the table it should return the last one and not 2 before.

For example, i gave a try with only 10 numbers to search:
Table =  101, 103, 107, 109, 113, 127, 131, 137, 139, 149
(So, the Index/Pos = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)

Number is smaller or equal to the 1st one is ok :t Ex:
Number to Search = 100. Return nearest number is 101. (So, index = 0)  OK !! :t
Number to Search = 101. Return nearest number is 101. (So, index = 0)  OK !! :t

Numbers in between are Ok :t
Number to Search = 104. Return nearest number is 103. (So, index = 1)  OK !! :t


Number is equal,is ok only when it is not the last one. Ex:
Number to Search = 103. Return index = 1  OK !! :t
Number to Search = 139. Return index = 8  OK !! :t
But....
Number to Search = 149. Not found. Return index should be 9.


but...when Number is bigger or equal to the last, it is returning 2 positions backwards and not the last one

Number to Search = 149. Not finding the proper number. Is giving a message of nearest The correct should be 149. So, index (Pos from 0 to XX) = 9
Number to Search = 150. Return nearest number is 139. The correct should be 149. So, index (Pos from 0 to XX) = 9
Number to Search = 151. Return nearest number is 139. The correct should be 149 So, index = 9
Number to Search = 2751. Return nearest number is 139. The correct should be 149 So, index = 9
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

guga

  • Member
  • *****
  • Posts: 1041
  • Assembly is a state of art.
    • RosAsm
Re: MasmBasic
« Reply #462 on: February 06, 2019, 04:08:34 AM »
Btw. the same issue i described happens when the size of the table is odd. For example , table size = 11
Table =  101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 177
(So, the Index/Pos = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

Number to search = 149; Found at pos 8 (139) rather then 9

It cannot find the number and, this time (For odd sized table), is returning 3 positions backwards, rather then 2 when the same error happens for even sized table.
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

  • Moderator
  • Member
  • *****
  • Posts: 9513
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #463 on: February 06, 2019, 05:06:36 AM »
Thanks a lot, Guga. I'm working on it...

guga

  • Member
  • *****
  • Posts: 1041
  • Assembly is a state of art.
    • RosAsm
Re: MasmBasic
« Reply #464 on: February 06, 2019, 06:01:41 AM »
You´re welcome, JJ  :t :t :t

Thank you for the effort. This function will be very helpful for the CieLCH functions i´m making. I´m still working on the pdf i told. I finished part of it, but still trying to find the limits of all those equations. For what i saw so far, those equations are utterly incorrect, since they allows the user to input any RGB value despite the fact that some of those combination simply don´t matches to the results of their own formulas. The major problem is find a way to make them work ok, without using incorrect RGB values whose combinations, simply were impossible on the CieLab/CieLCH color spaces. This is the main reason why the backwards convertion allows clipping and generate incorrect results.

For example, when the user inputs a RGB value originate form a HSL convertion it is not guaranteed that it will result the proper Lab or LCH values from the perceptual colorspaces, since the input can be a combination of colors that don´t actually "exists".
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