flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > hiword macro, problem

Author
Thread Post new topic Reply to topic
snifit



Joined: 10 Dec 2004
Posts: 12
Location: Sweden
snifit 11 Jan 2005, 22:36
What I want is:
First compare the HIWORD in a 32 bit value, if it's a match then jump somewhere and there test the LOWORD.

This is what my macros look like:

HIWORD
Code:
macro casehiw var,[cons,label] {
  common
  push var
  xor var,0FFFFh
  shr var,16

  forward
  cmp var,cons
  je label

  common
  pop var
}    


LOWORD
Code:
macro caselow var,[cons,label] {
  common
  push var
  and var,0FFFFh

  forward
  cmp var,cons
  je label

  common
  pop var
}    


I need the pushed value poped before jumping to the label and in these macros I don't think that's the case.
So somehow i need to pop the value if equal (so I can check the loword later on), and that's what I don't know how to do.

Any help is appreciated.
Post 11 Jan 2005, 22:36
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 12 Jan 2005, 00:08
maybe:
Code:
macro casehiw var,[cons,label] { 
  common 
  local ..behind,..taken
  push var 
  xor var,0FFFFh 
  shr var,16 

  forward 
  cmp var,cons 
  je ..taken

  common 
  jmp ..behind
  ..taken:
  pop var
  jmp label
..behind
  pop var 
}    
Post 12 Jan 2005, 00:08
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 12 Jan 2005, 06:30
In all cases
Code:
xor var,0FFFFh    
is meaningless. Smile
Post 12 Jan 2005, 06:30
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
snifit



Joined: 10 Dec 2004
Posts: 12
Location: Sweden
snifit 12 Jan 2005, 08:20
True, since shr shifts in zeros, well thanks guys
Post 12 Jan 2005, 08:20
View user's profile Send private message 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.