flat assembler
Message board for the users of flat assembler.

Index > Main > operand size not specified

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
serfasm,

If b and a are signed, subtraction overflows and signed result is incorrect. If they are unsigned, b>a.
Post 05 Mar 2010, 19:13
View user's profile Send private message Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko
Fasm should have his own flags register and some interface to access those. Poor Tomasz!
Post 05 Mar 2010, 20:05
View user's profile Send private message Reply with quote
a115433



Joined: 05 Mar 2010
Posts: 144
a115433
Never thought how fasm does number comparison.., it is signed.
b-a = 10b - 01b = 01b which is unsigned.
All is fine.

signed and unsigned differ only by flags checked.
signed ops use SF and OF, unsigned use only CF.
above/bellow - unsigned, greater/less - signed.


Fasm should have his own flags register and some interface to access those. Poor Tomasz!
fasm its just a link between you and cpu, it cant have anything. flags register is a part of CPU. anyway FASM is already broken in few places, because it use high level encoding. you cant encode eevry instruction with it, and its sad.
Post 05 Mar 2010, 20:11
View user's profile Send private message Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko
sad
Post 05 Mar 2010, 20:34
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
erf and lol.

fasm don't have its own flags.
fasm is coded with fasm.
it uses the X86 flags regicter inside your CPU.

the code you compile with fasm does not differ to the code used to compile.

it is all assembler.

i don't see the use of this off topic subject.


Last edited by edfed on 05 Mar 2010, 20:41; edited 1 time in total
Post 05 Mar 2010, 20:40
View user's profile Send private message Visit poster's website Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko
hll approach. BTW fasmd.asm compiles in 0.1 seconds as uses no macros, Delphi uses lot-a-lot high level "macro" but no speed consumption(background?).
Post 05 Mar 2010, 20:40
View user's profile Send private message Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko
baldr wrote:
This problem looks similar to signed vs. unsigned contradiction:
Code:
a = 1 shl 63 - 1; 0x7FFF'FFFF'FFFF'FFFF
b = a+1
if b>a
  display "b>a", 13, 10
else
  display "b<=a", 13, 10
end if
if b-a>0
  display "b-a>0", 13, 10
else
  display "b-a<=0", 13, 10
end if    
Not a big surprise for those who are familiar with FASM internals, though.

b = a+1 <- should fasm inform OF=1?
Post 07 Mar 2010, 23:22
View user's profile Send private message Reply with quote
a115433



Joined: 05 Mar 2010
Posts: 144
a115433
> < are signed or unsigned?

of will be only when yoy cross sign boundary.
for example, try to add something to (byte mode) 127, or substract something from -128.


-128 + 1 = -127, OF = 0
-128 - 1 = 127, OF = 1
127 + 1 = -128, OF = 1
127 - 1 = 127, OF = 0
Post 07 Mar 2010, 23:29
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< 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-2020, Tomasz Grysztar.

Powered by rwasa.