flat assembler
Message board for the users of flat assembler.

flat assembler > Macroinstructions > xor in arithmetical expressions

Author
Thread Post new topic Reply to topic
omega_red



Joined: 13 Mar 2004
Posts: 19
Location: Poland
Code:
macro        call2   target
{
    push    (@f xor 0xdeadbeef)
 jmp     target
@@:
   add     esp, 4
}    

This yields error: invalid expression.
However, if I replace xor with +, it compiles fine. It seems that compiler takes the xor as a cpu instruction, not operator. How to use the xor operator? Why it has the same form as an instruction, and not ^ like in C, for example?

_________________
Vulnerant omnes, ultima necat
Post 03 Oct 2004, 17:34
View user's profile Send private message Visit poster's website Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
omega_red wrote:
Code:
macro  call2   target
{
    push    (@f xor 0xdeadbeef)
 jmp     target
@@:
   add     esp, 4
}    

This yields error: invalid expression.
However, if I replace xor with +, it compiles fine. It seems that compiler takes the xor as a cpu instruction, not operator. How to use the xor operator? Why it has the same form as an instruction, and not ^ like in C, for example?


HY, these whould be interesting cause' for example on my hungarian keyboard < means delete line Sad

MATRIX
Post 03 Oct 2004, 17:47
View user's profile Send private message Visit poster's website Reply with quote
omega_red



Joined: 13 Mar 2004
Posts: 19
Location: Poland
OK, I found that this is a relocation problem, not parser failure Wink
+ worked instead of xor because it does't have to know absolute address.

Code:
macro    call2   target
{
    local f
     f = BASE + RVA @f
   push    (f xor 0xdeadbeef)
  jmp     target
@@:
   add     esp, 4
}    
Post 03 Oct 2004, 18:16
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.