News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

ML64 BNF GRAMMAR

Started by TouEnMasm, July 07, 2020, 11:36:38 PM

Previous topic - Next topic

TouEnMasm

There is on the microsoft site,a page dedicated to the BNF grammar of ml64,i find this interesting
Quote
invokeArg
    register :: register | expr | ADDR expr
invokeDir
    INVOKE expr ⟦ , ⟦ ;; ⟧ invokeList ⟧ ;;
invokeList
    invokeArg | invokeList , ⟦ ;; ⟧ invokeArg
Quote
I thing you see the one very interesting:INVOKE expr ⟦ , ⟦ ;; ⟧ invokeList ⟧ ;;
All i get is "INVOKE syntax error",any help ?



Fa is a musical note to play with CL

hutch--

Yves,

I learnt early in the piece not to take much notice of what people posted about how to use 64 bit MASM as it was almost exclusively nonsense. Few grasped the details of the Win64 calling convention or how the stack worked. The only solution was to write and test using a debugger to see what ended up where. Default 64 bit MASM does not provide many of the things that the 32 bit version did and it meant writing macros to do those things but it freed you from old assumptions and let you code the macros to do it in a clear reliable way.

TouEnMasm


It was just a dream,that is view ml64 generate an error in an invoke statement if there is an error in the call.
Msdn say "invoke supported only in 32 bits"
Is there not a way by MACRO to verify the number and size of arguments  ?
Fa is a musical note to play with CL

hutch--

It can be done by a very messy technique but the simple answer is use the right number of arguments and data types. Once you are free of endless prototyping, you code so much faster and you would not go back.

Vortex

Hi ToutEnMasm,

Here is an attempt to check the number of parameters :

http://masm32.com/board/index.php?topic=6153.msg65279#msg65279

You can write a better version of that macro but it's preferable to use the right number of arguments and data types as Hutch said.

jj2007

Quote from: TouEnMasm on July 10, 2020, 04:28:12 PM
Is there not a way by MACRO to verify the number and size of arguments  ?

Sure there is: MultiByteToWideChar wants 6 arguments
- if you forget one, you get forced error : ## not enough arguments for MultiByteToWideChar ##
- if you add one more, it will choke with forced error : ## too many arguments for MultiByteToWideChar ##
The real fun is CreateWindowEx with 11 arguments, but according to Hutch a real assembly programmerTM does not need a macro to hold his hot little hand :cool:
include \Masm32\MasmBasic\Res\JBasic.inc ; ## console demo, builds in 32- or 64-bit mode with UAsm, ML, AsmC ##
MyText db "Добро пожаловать", 0         ; "Welcome" in Russian
MyTextW dw 100 dup(?)                 ; OPT_Assembler ML
HelloWorld dw "H", "i", 0         ; OPT_64 1 ; put 0 for 32 bit, 1 for 64 bit assembly
Init
  PrintLine Chr$("This program was assembled with ", @AsmUsed$(1), " in ", jbit$, "-bit format.")
  jinvoke MultiByteToWideChar, 65001, 0, addr MyText, -1, addr MyTextW, 100
  jinvoke MessageBoxW, 0, addr MyTextW, addr HelloWorld, MB_OK
EndOfCode

hutch--

 :biggrin:

Yeah,

You have to watch those hot little hands, they obviously don't belong to real men[TM]. Once you no longer have to rat around for the prototype or worse, have to keep editing the prototype while you are designing the procedure, you are set free to write fast code quickly and as far as arg count errors, you have a perfect technique that has worked well for years, it crashes around your ears and make a jerk out of you.

People who work at the coal face make far fewer mistakes because they know that it will crash like a ton of bricks if they stuff it up.

TouEnMasm

Macro perhaps or other things perhaps also,I have the choice of the soluce.
Thinks my IDE,will be of great help,no hot hands,no need of speed ,no need of labourious work as a minor,just let it done.
Fa is a musical note to play with CL