flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > JG vs JA .... bug :-(

Author
Thread Post new topic Reply to topic
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 04 Feb 2007, 18:52
I finally found a bug in my code: used JNG instruction and did not work.
Why ? JNG seems to perform a signed comparison.

FASM.TXT unfortunately does NOT contain any info about possible sign Sad

http://maven.smith.edu/~thiebaut/ArtOfAssembly/CH06/CH06-5.html#HEADING5-226

Here ^^^ ( MA$M Sad ) I found the truth Sad

The text maybe should be updated to warn from this fact Wink

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 04 Feb 2007, 18:52
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 04 Feb 2007, 19:32
i agree, there should be some note in manuals that "above" and "below" means unsigned and "greater", "lesser" means signed.
Post 04 Feb 2007, 19:32
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 04 Feb 2007, 20:04
The table of conditions defines the exact condition "(SF xor OF) or ZF = 1" for the NG. Since the fasm's instruction set manual was intended to document the syntax for each possible instructions settings, and some hints about what the instructions do were just a small addition, I consider this more than enough. The syntax manual was never intended to replace the processor manual, and I recall that I stated something abou it in the introduction to the chapter about x86 instruction set. Perhaps I should replace it with a capitalized warning or something similar.
Post 04 Feb 2007, 20:04
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 04 Feb 2007, 20:14
it is not easy to figure out from condition, especially not from beginner. there is also a description of what name means, and "above" vs. "greater" are not that descriptive. just a sentence:

In conditional jump names, "above" and "below" refers to result of unsigned operation, "greater" and "lesser" to signed.

warning about processor manuals and some hints where to find them is good idea.
Post 04 Feb 2007, 20:14
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 07 Feb 2007, 00:47
Quote:
exact condition "(SF xor OF) or ZF = 1"


YES, but the sign is not really obvious ... Confused

Quote:
fasm's instruction set manual was intended to document the syntax for each possible instructions settings, and some hints about what the instructions do were just a small addition, I consider this more than enough. The syntax manual was never intended to replace the processor manual, and I recall that I stated something abou it in the introduction to the chapter about x86 instruction set. Perhaps I should replace it with a capitalized warning


Rather some more info about the instructions should be added. YES, there
is a HUUUGE amount of manuals, but they all are based on MA$M Sad ,
adding the low amount of missing stuff into FASM manual:

Quote:
In conditional jump names, "above" and "below" refers to result of unsigned operation, "greater" and "lesser" to signed.


,

warns about CPU compatibility and Privilege ("This instruction is privileged
and supported starting from P2")

,

and the numbers syntax

(as far as I found out so far)

would obsolete the need for additional instruction manuals. Wink
Finally, this manual could be included into the IDE Wink

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 07 Feb 2007, 00:47
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 07 Feb 2007, 13:35
NTOSKRNL_VXE wrote:

warns about CPU compatibility and Privilege ("This instruction is privileged
and supported starting from P2")


Well, if you're like me, you have NASM too, and its manual does describe this (well, not x86-64, but I don't have that kind of cpu anyways).

Quote:

SYSRET ; 0F 07 [P6,AMD,PRIV]
Post 07 Feb 2007, 13:35
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.