The MASM Forum

General => The Campus => Topic started by: Evan on December 05, 2013, 12:48:59 PM

Title: Warning: I think I am less confused.
Post by: Evan on December 05, 2013, 12:48:59 PM

define:
        xor EAX+00001b
xor EAX EAX


   xor EAX EAX




   xor CS CS+000001b
XOR CS CS
   xor DS DS+000001b
XOR DS DS
   xor ES ES+000001b
XOR ES ES
   xor FS FS+000001b
XOR FS FS
   xor GS GS+000001b
XOR GS GS
   xor SS SS+000001b
XOR SS SS

end define:
Title: Re: Warning: I think I am less confused.
Post by: Evan on December 05, 2013, 12:52:26 PM
/**********************/
Title: Re: Warning: I think I am less confused.
Post by: dedndave on December 05, 2013, 02:58:51 PM
none of that makes any sense
explain what you are trying to do
Title: Re: Warning: I think I am less confused.
Post by: Magnum on December 05, 2013, 04:04:10 PM
It looks likes he's trying to zero out everything ?
Title: Re: Warning: I think I am less confused.
Post by: Evan on December 05, 2013, 04:47:54 PM
xor hates me.

1.asm(47) : error A2008: syntax error : in instruction
1.asm(48) : error A2008: syntax error : in instruction
1.asm(51) : error A2008: syntax error : in instruction
1.asm(56) : error A2008: syntax error : in instruction
1.asm(57) : error A2008: syntax error : in instruction
1.asm(58) : error A2008: syntax error : in instruction
1.asm(59) : error A2008: syntax error : in instruction
1.asm(60) : error A2008: syntax error : in instruction
1.asm(61) : error A2008: syntax error : in instruction
1.asm(62) : error A2008: syntax error : in instruction
1.asm(63) : error A2008: syntax error : in instruction
1.asm(64) : error A2008: syntax error : in instruction
1.asm(65) : error A2008: syntax error : in instruction
1.asm(66) : error A2008: syntax error : in instruction
1.asm(67) : error A2008: syntax error : in instruction

start:                          ; The CODE entry point to the program

    print chr$("Hey, this actually doesn't works.",13,10)
    print chr$("_________________________",13,10)
    print chr$("____/\_____________/\____",13,10)
    print chr$("______o___________o______",13,10)
    print chr$("____________I____________",13,10)


;define:
        xor EAX+00001b
    xor EAX EAX
   xor CS CS+000001b
XOR CS CS
   xor DS DS+000001b
XOR DS DS
   xor ES ES+000001b
XOR ES ES
   xor FS FS+000001b
XOR FS FS
   xor GS GS+000001b
XOR GS GS
   xor SS SS+000001b
XOR SS SS

;end define:


; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

exit
Title: Re: Warning: I think I am less confused.
Post by: jj2007 on December 05, 2013, 05:28:50 PM
Hi Evan,

You cannot redefine Masm keywords, such as the xor mnemonic. If you want to get an idea what is possible with macros and defines, check here (http://www.webalice.it/jj2006/MasmBasicQuickReference.htm) (all that assembles with ML 6.15 ... 10.0 and JWasm).
Title: Re: Warning: I think I am less confused.
Post by: dedndave on December 05, 2013, 10:09:53 PM
let's start with one register   :t
        xor     eax,eax

the first word, "xor" is the instruction
the second word, "eax" is the destination operand
the third word, "eax" is the source operand
the destination and source operands are seperated by a comma ","

in the case above, the contents of the source operand are XOR'ed onto the contents of the destination operand
because they are the same value, the result will be 0 (the nature of the XOR operation)

i don't think you can do that with the "segment" registers
only a few instructions work with those registers (MOV, PUSH, POP - maybe a couple others)

another example of XOR....
        xor     eax,1

in this case, the value "1" is the source operand
EAX is altered by inverting bit 0
Title: Re: Warning: I think I am less confused.
Post by: dedndave on December 05, 2013, 10:12:52 PM
"define" is probably not a good choice of names for the entry point
use "start" or "main"

start:

;code here

        end     start


notice that the label has a colon ":"
the reference to the label does not
Title: Re: Warning: I think I am less confused.
Post by: dedndave on December 05, 2013, 10:21:01 PM
build as a console app.....
        INCLUDE    \Masm32\Include\Masm32rt.inc

;###############################################################################################

        .DATA

dwTest  dd 0F0F0F0Fh

;***********************************************************************************************

        .DATA?

;###############################################################################################

        .CODE

;***********************************************************************************************

_main   PROC

        print   uhex$(dwTest),13,10

        xor     dwTest,5A5A5A5Ah

        print   uhex$(dwTest),13,10

        mov     eax,dwTest
        xor     eax,eax

        print   uhex$(eax),13,10

        print   chr$(13,10)
        inkey
        INVOKE  ExitProcess,0

_main   ENDP

;###############################################################################################

        END     _main