flat assembler
Message board for the users of flat assembler.

Index > Main > mov eax,neg 1000h

Author
Thread Post new topic Reply to topic
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 03 Nov 2010, 14:54
Code:
mov eax, neg 1000h
    
yes ... i could easily do it with "0-1000h"
but it would be more elegant, more "neat", with "neg". Wink

(never satisfied (me) ... yes, it is also true ! Razz Wink )

a little macro bitRAKE ? <-- Wink

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 03 Nov 2010, 14:54
View user's profile Send private message Send e-mail Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 03 Nov 2010, 14:59
ouadji wrote:
Code:
mov eax, neg 1000h
    
yes ... i could easily do it with "0-1000h"
but it would be more elegant, more "neat", with "neg". Wink

(never satisfied (me) ... yes, it is also true ! Razz Wink )

a little macro bitRAKE ? <-- Wink



Why not simply:
Code:
mov eax, -1000h    


Or better:
Code:
mov eax, -$1000    
Post 03 Nov 2010, 14:59
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 03 Nov 2010, 15:02
Or even better Wink
Code:
mov eax,-0x1000    
Post 03 Nov 2010, 15:02
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4020
Location: vpcmpistri
bitRAKE 03 Nov 2010, 15:09
Code:
macro mov dest,src {
  temp equ src
  match =neg num,src \{
    restore temp
    temp equ -num
  \}
  mov dest,num
}    
...just off the top of my head. Wink
Post 03 Nov 2010, 15:09
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 03 Nov 2010, 15:47
ouadji,

I've seen a = -1*b at least once.

----8<----
bitRAKE,

imul dest, src, -1 probably will handle all other flavors of src, then. Wink
Post 03 Nov 2010, 15:47
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 03 Nov 2010, 16:06

ok ... i still missed a good opportunity to keep quiet ! Wink Razz

imul dest, src, -1 <--- Laughing

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 03 Nov 2010, 16:06
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 03 Nov 2010, 16:10
baldr wrote:
imul dest, src, -1 probably will handle all other flavors of src, then. Wink
Should that be: imul dest, src, neg 1? Razz
Post 03 Nov 2010, 16:10
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 03 Nov 2010, 16:15
Quote:
Should that be: imul dest, src, neg 1
revolution, you make me laugh

some recursion ? Very Happy Very Happy

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 03 Nov 2010, 16:15
View user's profile Send private message Send e-mail Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 03 Nov 2010, 17:33
revolution,

Isn't it my turn to be Mr. Hyde? Wink
Post 03 Nov 2010, 17:33
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 04 Nov 2010, 00:09
ouadji: You can also use this:
Code:
neg fix -    
baldr wrote:
Isn't it my turn to be Mr. Hyde? Wink
Okay, tag, you're it. I'll try to be the smart Dr. J but I'm not sure I can do it as well as you.
Post 04 Nov 2010, 00:09
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4020
Location: vpcmpistri
bitRAKE 04 Nov 2010, 00:52
Code:
macro mov dest,src {
  temp equ src
  match =neg num,src \{
    restore temp
    temp equ -num
  \}
  mov dest,temp
  restore temp
}    
...fixed.

He aska for a macro I give 'em a macro.

The pattern works for all kinds of domain specific syntax tweaks.

"NEG fix -" woo, scary.

Actually, it would be trivial to add NEG to FASM's expression calculator.
Code:
single_operand_operators:
 db 1,'+',0
 db 1,'-',083h
 db 3,'neg',083h
 db 3,'not',0D0h
 db 3,'plt',0E1h
 db 3,'rva',0E0h
 db 0    

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 04 Nov 2010, 00:52
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.