Author Topic: MasmBasic  (Read 138462 times)

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7460
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic - a fast and easy-to-use library
« Reply #15 on: November 04, 2012, 04:03:49 AM »
Hi jj,

Does MB supports nested for loop?

Example:
Code: [Select]
include \masm32\MasmBasic\MasmBasic.inc

Init

For_ ebx=1 To 3
    For_ ecx=1 To (4-ebx)
        Print Str$(edx," ")
    Next
    Print CrLf$
Next

Exit

end start

Hi Anta,

No brackets for 4-ebx, and Str$() has a different syntax:

   For_ ebx=1 To 3
      For_ ecx=1 To 4-ebx   
         Print Str$(ecx), " "
      Next
      Print CrLf$
   Next

anta40

  • Member
  • ***
  • Posts: 293
Re: MasmBasic - a fast and easy-to-use library
« Reply #16 on: November 05, 2012, 01:42:39 AM »
Ah, a small typo :redface:

Thanks jj, now it works as expected  :t

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7460
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic - a fast and easy-to-use library
« Reply #17 on: November 05, 2012, 10:23:52 AM »
Great ;-)

Version 5 Nov 2012 is out:
- FileOpen$() keeps user's folder changes
- IsFolder() macro
- Dll & Declare speedup: see example here

frktons

  • Member
  • ***
  • Posts: 491
Re: MasmBasic - a fast and easy-to-use library
« Reply #18 on: November 25, 2012, 03:21:08 AM »
Hi jj.

MasmBasic is really a nice project. If I had enough knowledge I'd started
a similar project myself. Unfortunately I'm not able to do much with it for the time
being.

It remains, however, one of my goal to learn and use some MasmBasic as soon
as I've enough capacity to do it.

Carry on this optimal work.

Frank

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7460
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic - a fast and easy-to-use library
« Reply #19 on: December 03, 2012, 10:43:42 AM »
Thanks a lot, Frank.

Version 3 December features an improved xHelp, now included in the MasmBasic package.
Inter alia, xHelp has learned how to add F1 context-sensitive help to qEditor. After extraction of the package (the archive in post #1 of this thread) with "use folder names", launch \Masm32\InstallXhelp.exe. Afterwards, you can select some text, e.g. CreateWindowEx in qEditor, and press F1. Compliments to Hutch who made such a great plugin interface for the Masm32 editor :t

And apologies that I stole the idea to create a plugin interface for RichMasm, too - PM me for details ;-)

frktons

  • Member
  • ***
  • Posts: 491
Re: MasmBasic - a fast and easy-to-use library
« Reply #20 on: December 05, 2012, 01:25:15 AM »
One lesson a day keeps the teacher away [somehow]  :lol:

The only thing I really miss for an extension of MASM32 like
MasmBasic is a tutorial to learn step by step the use of the
MACROS library and routines.

Probably some help can be found in the editor and in the
examples, but a Tutorial is always welcome.  :t

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7460
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic - a fast and easy-to-use library
« Reply #21 on: December 26, 2012, 10:00:02 AM »
Changes in the update of 26.12.2012 (attached to first post, details in \Masm32\MasmBasic\MbGuide.rtf):

AddWin$
        AddWin$ hEdit=CrLf$+"[one line more]"        ; append some text to an edit control
        ; this line appends the current date and time to an edit control:
        AddWin$ hEdit=CrLf$+"["+Trim$(Launch$("cmd.exe /C date /T"))+", "+Trim$(Launch$("cmd.exe /C time /T"))+"]"

WritePipe
        Launch "cmd.exe /C time", SW_RESTORE, cb:hEdit        ; launch an app that requires console input; show its output in the edit control
        WritePipe "20:40:50"                        ; set the time
        ; you may add a 0 as second argument if you don't want a CrLf sequence to be appended:
        WritePipe esi, 0        ; write zero-delimited string in esi, do not append CrLf
Rem        will show an error message if the pipe was closed for some reason

Gunther

  • Member
  • *****
  • Posts: 3515
  • Forgive your enemies, but never forget their names
Re: MasmBasic - a fast and easy-to-use library
« Reply #22 on: January 03, 2013, 12:00:20 AM »
Jochen,

it seems you've done a great effort for the new update. Did you burn the midnight oil?

Gunther
Get your facts first, and then you can distort them.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7460
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic - a fast and easy-to-use library
« Reply #23 on: January 03, 2013, 02:23:28 AM »
it seems you've done a great effort for the new update. Did you burn the midnight oil?

Yes I did, Gunther - but I just fixed a "midnight bug". Launch$() returns output from a console proggie, but it is not designed for proggies that expect input, and it choked badly when I tried. Version 2 Jan b behaves better, it just returns La$? to indicate an error.
----
Changes in the update of 2 Jan 2013 concern the handling of pipes in Launch (more in \masm32\MasmBasic\MbGuide.rtf):

        dec ready2load                ; set the "we launched a process" flag
        Launch esi, SW_MINIMIZE, cb:hOutput  ; cb: = we want to see the output

...

        CASE WM_TIMER
                .if ready2load        ; flag "we launched a process"
                        .if ExitCode()!=STILL_ACTIVE        ; process finished?
                                and ready2load, 0        ; clear the flag and
                                call LvGetFiles        ; load the processed files
                        .endif
                .endif


Basically, you can thus:
- launch an external preprocessor
- watch its output in an edit window
- and proceed once the external process is no longer STILL_ACTIVE.

It is now also possible to have a permanent pipe, e.g. with cmd.exe, and to retrieve output from other processes with Launch$() in parallel.

anta40

  • Member
  • ***
  • Posts: 293
Re: MasmBasic - a fast and easy-to-use library
« Reply #24 on: January 08, 2013, 02:10:34 PM »
Hi jj,

This code compiles fine and works as expected (with the latest MasmBasic)
Code: [Select]
include \masm32\MasmBasic\MasmBasic.inc

.data?
aNumber dd ?

Init
MovVal aNumber,Input$("Input: ")
add aNumber, 123
Print "Result: ",Str$(aNumber)
Exit
end start

But if you shorten the input message like this:
Code: [Select]
include \masm32\MasmBasic\MasmBasic.inc

.data?
aNumber dd ?

Init
MovVal aNumber,Input$("N: ")
add aNumber, 123
Print "Result: ",Str$(aNumber)
Exit
end start

Then the result is compilation error

Quote
JWasm v2.10pre, Dec 30 2012, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.

input.asm(7) : Error A2172: Initializer magnitude too large:
 repargA(55)[MasmBasic.inc]: Macro called from
  cStyle$(99)[MasmBasic.inc]: Macro called from
   Input$(3)[MasmBasic.inc]: Macro called from
    input.asm(7): Main line code
input.asm: 11 lines, 1 passes, 78 ms, 0 warnings, 1 errors

Is this a bug?

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7460
  • Assembler is fun ;-)
    • MasmBasic
Always trouble with four-letter words...
« Reply #25 on: January 08, 2013, 05:41:01 PM »
Is this a bug?

YES, fat and ugly (but harmless). Will be fixed asap, thanks for the feedback :t

The reason is that "abcd" is an immediate for the macro engine, not a string. For example, you can write mov eax, "abcd" or mov al, "x". But the macro can check for the <"> and then decide to treat it as a string. The bug didn't show up until now because all my test examples had more then four chars - and then JWasm & Ml are clever enough to realise "no, can't fit into 32 bits, so it must be a string". Cute, ain't it?  ;)

anta40

  • Member
  • ***
  • Posts: 293
Re: MasmBasic - a fast and easy-to-use library
« Reply #26 on: January 08, 2013, 06:05:52 PM »
Ah I see.
Indeed it's not harmful, just a little annoying.
I was confused for a while why my code wouldn't compile, until somehow I reverted back the input message, and finally the assembler accepted it.

:P

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 7460
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic - a fast and easy-to-use library
« Reply #27 on: January 08, 2013, 08:18:19 PM »
Until the new version is ready, you can use Chr$() as a workaround:

; MovVal aNumber,Input$("nu: ", "1000")
MovVal aNumber, Input$(Chr$("nu: "), "1000")

jeivarmarr

  • Guest
Re: MasmBasic - a fast and easy-to-use library
« Reply #28 on: January 09, 2013, 07:03:34 AM »
I have this problem  :(
Then the result is compilation error
MasmBasic.inc (5871): error A2102: Symbol not defined: CP_UTF8
MasmBasic.inc (6288): error A2102: Symbol not defined: OFN_ENABLESIZING
MasmBasic.inc (6289): error A2102: Symbol not defined: OFN_ENABLESIZING

some solution?

dedndave

  • Member
  • *****
  • Posts: 8733
  • Still using Abacus 2.0
    • DednDave
Re: MasmBasic - a fast and easy-to-use library
« Reply #29 on: January 09, 2013, 08:41:34 AM »
both symbols are defined in windows.inc

you are simply not including the proper include files
it is possible that you are trying to assemble a file on a different drive than the one where masm32 is installed