flat assembler
Message board for the users of flat assembler.
Index
> Main > Push byte zero-extend |
Author |
|
revolution 15 May 2012, 01:52
Did you try assembling those?
Code: use32 push $FFFFFFF5 push $FFFFFFA9 |
|||
15 May 2012, 01:52 |
|
fwd 15 May 2012, 09:15
Yes, I did.
However I have a 'source' that doesn't use that format and thought perhaps someone might know of a quick solution involving FASM, rather than my having to write a script or something to convert hundreds or thousands of push (some byte) instructions. |
|||
15 May 2012, 09:15 |
|
revolution 15 May 2012, 09:18
Maybe:
Code: macro push something { db 0x6a,something } |
|||
15 May 2012, 09:18 |
|
shutdownall 15 May 2012, 12:14
revolution wrote: Did you try assembling those? I did try and was very surprised. Isn't that a bug ??? Code: use32 push $100 push $1000 push $10000 push $F5 push $FFF9 push $FFFFF9 push $FFFFFFF9 The above code does always push a dword on stack except the last one which does only a byte push ?! (version 1.69.35 used) If changed last instruction to push dword $FFFFFFF9 it's handled correctly but I wouldn't expect to put a byte instead of the dword by default. |
|||
15 May 2012, 12:14 |
|
revolution 15 May 2012, 12:16
shutdownall wrote: Isn't that a bug ??? |
|||
15 May 2012, 12:16 |
|
LostCoder 15 May 2012, 20:37
push is sign-extended, not zero. And it works only if immediate value fit into -128...127 values (one byte). Also default operand size for 32bit architecture is dword. So:
Code: use32 push $100 ; push dword $00000100 ; sign: 0 ; $100 > $7F push $1000 ; push dword $00001000 ; sign: 0 ; $1000 > $7F push $10000 ; push dword $00010000 ; sign: 0 ; $10000 > $7F push $F5 ; push dword $000000F5 ; sign: 0 ; $F5 > $7F push $FFF9 ; push dword $0000FFF9 ; sign: 0 ; $FFF9 > $7F push $FFFFF9 ; push dword $00FFFFF9 ; sign: 0 ; $FFFFF9 > $7F push $FFFFFFF9 ; push dword $FFFFFFF9 ; sign: 1 ; $FFFFFFF9 = -7; -128 < -7 < 127; <- sign-extended |
|||
15 May 2012, 20:37 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.