flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > "push cr0" BUG in fasm?

Author
Thread Post new topic Reply to topic
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
I discovered a bug in fasm (1.67.20) while writing the "only8086.inc", namely that fasm allows instructions like "push cr0" or "pop cr5", which actually don't exist at all (intel docs, maybe the versions of the docs I got are a bit old?).

another small thing: how does it come that fasm got cr5 to cr9? are they documented somewhere? is there a reason to implement cr8 and cr9?

I also got a feature request for fasm: There should be a directive that makes fasm stop from compiling the code and makes fasm return a code defined error value. I would suggest to call this directive "error". I'm just not sure whether "error" should be at preprocessor or a assembler stage?

_________________
MCD - the inevitable return of the Mad Computer Doggy

-||__/
.|+-~
.|| ||
Post 17 Feb 2007, 04:23
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
from FASMLIB internal macros:
Code:
;define macros for compilation errors
__preprocess_error fix macro*
__pass_error fix __undefined_opcode_blahblahblah
__assembly_error fix rb -1
    
Post 17 Feb 2007, 08:11
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
vid wrote:
from FASMLIB internal macros:
Code:
;define macros for compilation errors
__preprocess_error fix macro*
__pass_error fix __undefined_opcode_blahblahblah
__assembly_error fix rb -1
    
I use similar constructions in some of my code (only8086.inc), but that's not what I mean.

There should be an error directive that stops fasm from compiling your code that doesn't display anything so you can make your own error messages with display because sometimes the built-in fasm error messages just don't describe the error well to which the message applies. Also, you can't make fasm return custom error codes like this.

consider this example that disallows shl with shift counts != 1
Code:
macro   shl     A,B{
  ;disallow shifts != 1
  if (B eqtype 0) & (B <> 1)
    display     "shift count not 1",0Ah
    shl
  end if
}

shl     ax,2
    


the output of that is:
Quote:

flat assembler version 1.67.20 (16384 kilobytes memory)
shift count not 1
a.asm [9]:
shl ax,2
a.asm [5] shl [4]:
shl
error: invalid operand.

well, you can guess the error from that, but fasms own error messages are just confusing people here.

With current fasm versions, the only workaround for that is to not use stuff that makes fasm stop with an error and simply display some messages and hope the coder sees and interprets the displayed message well, like this:
Code:
macro   shl     A,B{
  ;disallow shifts != 1
  if (B eqtype 0) & (B <> 1)
    display     "shift count not 1",0Ah
  end if
}

shl     ax,2
    

which output is:
Quote:

flat assembler version 1.67.20 (16384 kilobytes memory)
shift count not 1
1 passes, 0 bytes.

_________________
MCD - the inevitable return of the Mad Computer Doggy

-||__/
.|+-~
.|| ||
Post 17 Feb 2007, 14:52
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
For the older discussions about this, see http://board.flatassembler.net/topic.php?t=4828 (and follow the links).

As for the "push cr0" bug, it's fixed in 1.67.21.
Post 17 Feb 2007, 15:27
View user's profile Send private message Visit poster's website Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
Tomasz Grysztar wrote:
For the older discussions about this, see http://board.flatassembler.net/topic.php?t=4828 (and follow the links).

As for the "push cr0" bug, it's fixed in 1.67.21.
thanks! kinda fast response
Post 17 Feb 2007, 15:29
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
MCD:
Code:
__pass_error fix  'oh shit, error happened'    


not clear, but works good enough :]
Post 18 Feb 2007, 01:31
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
Tomasz: the new versions of fasm at the download page are described as version 1.67.21, but the actual version inside is still 1.67.20.

vid wrote:
MCD:
Code:
__pass_error fix  'oh shit, error happened'    


not clear, but works good enough :]

sorry, but that one won't display anything to the programmer neither, it just makes fasm display its default error message.
Post 18 Feb 2007, 03:41
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
Quote:
new versions of fasm at the download page are described as version 1.67.21, but the actual version inside is still 1.67.20


I found 1.67.21 (DOS Smile and Win32 Rolling Eyes ) .

But other bug: FASM.EXE (Win32 console) bloated by 22 KB !!!

_________________
Bug Nr.: 12345

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

Status: Closed: NOT a Bug


Last edited by DOS386 on 18 Feb 2007, 07:04; edited 1 time in total
Post 18 Feb 2007, 04:08
View user's profile Send private message Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
NTOSKRNL_VXE wrote:
Quote:
new versions of fasm at the download page are described as version 1.67.21, but the actual version inside is still 1.67.20


I found 1.67.21.

But other bug: FASM.EXE (Win32 console) bloated by 22 KB !!!

that smells a bit like some undefined data are now in the middle of some section instead at the end.

still, the version of fasm 1.67.21 is actually 1.67.20 (Linux version)
Post 18 Feb 2007, 05:40
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
MCD: sorry, i copy pasted it wrongly in hurry. i use
Code:
__pass_error 'oh shit, error happened'    

there, you see the instruction that caused problem displayed. Well... at least in FASMW that i use Smile
Post 18 Feb 2007, 10:32
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
Sorry, I had connection problems yesterday. Please try downloading now.
Post 18 Feb 2007, 10:36
View user's profile Send private message Visit poster's website Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
THX2A
Post 18 Feb 2007, 18:14
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
Quote:
try downloading now


Fixed Smile

_________________
Bug Nr.: 12345

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

Status: Closed: NOT a Bug
Post 21 Feb 2007, 04:33
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-2020, Tomasz Grysztar.

Powered by rwasa.