locked
developing further masm RRS feed

  • General discussion

  • I use procedure in MASM like

    defStruct STRUC
        string db 100dup(99)
    defStruct ENDS
    
    myProc PROC myVar:defStruct
        LOCAL number:dword
        ret
    myProc ENDP
    
    invoke myProc,myVar
    

    but after disassembling I see that It copied all string onto stack.

    It is copying every structure onto stack. I believe it is mistake as it should copy only its address.

    C# and Java would copy only class pointer but MASM copies all so after changing variables 

    inside procedure they are not changed after returning from procedure.

    WOULD MICROSOFT REPAIR THIS WRONG BEHAVIOUR?

    I am also looking to buy or find and use MACROS allowing me to code following way:

    myProc(myVar);

    so it is same as in C# or Java rather than using INVOKE.

    I am also looking to use if statement the way below:

    if(myVar1==myVar2){

       instructions

    }(myVar1!=myVar2){

      instructions

    }{

     instructions

    }

    WHERE I would like MASM to compare two variables by moving them to registers and comparing.

    BUT ALSO there is not any THEN statement but looks more clear while reading second condition.

    I WOULD LIKE else TO BE JUST }{} WITHOUT writing ELSE keyword. It is more clear.

    AND FINALLY i would like to put procedure into structure and execute it normally like class:

     

    defStruct STRUC
        string db 100dup(99)
        myProcInClass PROC myVar:dword
            LOCAL number:dword
          ret
        myProcInClass ENDP
    defStruct ENDS
    
    myVar defStruct {}
    
    myVar.myProcInClass(4);
    

    Also I would like loops REPEAT and WHILE work normally as:

    repeat{

       instructions

    }while(var1==var2)

    AND

    while(var1==var2){

      instructions

    }

    WOULD microsoft DEVELOPE MASM FURTHER?

    • Moved by CoolDadTx Wednesday, November 11, 2020 2:58 PM Not C# related
    Wednesday, November 11, 2020 2:50 PM

All replies

  • This forum is for C# specific questions only. We don't support MASM here. Honestly I have no idea where you should post but it isn't in this forum. I will recommend you post in the new Microsoft Q&A forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, November 11, 2020 2:58 PM
  • following code also fails to work out:

    .WHILE(!var1==var2)
    inc x
    .ENDW

    .WHILE(var1&var2==var3)
    inc x
    .ENDW

    .WHILE(var1|var2==var3)
    inc x
    .ENDW

    .WHILE(var1^var2==var3)
    inc x
    .ENDW

    they are NOT, AND, OR, and XOR

    WOULD MICROSOFT develope MASM further?

    Wednesday, November 11, 2020 7:52 PM
  • NASM (intel syntax) is much closer to MASM (intel syntax) than GAS (att syntax). It's open source and you can run it anywhere. MASM has some weird quirks (typed symbols, offset) that NASM was careful to avoid, so NASM is just a better assembly language anyway. GAS optionally supports intel syntax, but it's weird.

    Tuesday, December 1, 2020 10:58 AM