flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > small bug ?

Author
Thread Post new topic Reply to topic
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 25 Feb 2010, 09:57
Code:
(fasm 1.69.12)

A)
--
db 0,\" 
1
extra characters on line (line 1) ..... ok

B-1)
---
db 0,\a
1
illegal instruction (line 2) ..... ??
instruction : 1

but ... with a space between "\" and "a", it's ok.

B-2)
---
db 0,\ a
1
extra characters on line (line 1) .... ok
    

A) and B-2)

in this two cases, "extra characters on line"
the answer is correct and logical.
PS : in "A)", it's ok, with or without space between "\" and ' " '

B-1)

Without space between "\" and 'a', there is a problem.
Question the answer should it not also be "extra characters on line"
and not "illegal instruction", opcode instruction : 1

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 25 Feb 2010, 09:57
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: 20338
Location: In your JS exploiting you and your system
revolution 25 Feb 2010, 15:24
A bit of a cosmetic bug. You still get some sort of error that is the main thing.
Post 25 Feb 2010, 15:24
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 25 Feb 2010, 15:38
The "\" character in fasm has a different function when immediatelly followed by a symbol token, and different when not. In the first case it creates the "escaped" symbol ("\a" in this sample), and in second case it marks the ignored line break and no other symbols should follow in the same line.
Post 25 Feb 2010, 15:38
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 25 Feb 2010, 15:40
PS You may notice that this is a perfectly valid code, because "\a" is a valid symbol:
Code:
\a:
  mov ax,\a    
Post 25 Feb 2010, 15:40
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 25 Feb 2010, 17:00

Thank you for your reply. I understood your explanation.
So yes, with this difference about function of the symbol "\",
followed by a symbol token, or not ...
then I am more in agreement with the reaction of the compiler.

however, i noticed this :
Code:
FASMW
-------
\a: 
mov ax,\a   ; with ax, or eax, it does compile, it's ok. (FASMW)

FASM
-----
\a: 
mov ax,\a   ; doesn't compile : invalid use of symbol (FASM)

But with "eax", it's ok.
\a: 
mov eax,\a   ; it does compile, it's ok. (FASM)
    


@revolution : "a cosmetic bug"
I do not try to bother, but simply to understand.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 25 Feb 2010, 17:00
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: 20338
Location: In your JS exploiting you and your system
revolution 26 Feb 2010, 02:08
ouadji wrote:
FASM
-----
\a:
mov ax,\a ; doesn't compile : invalid use of symbol (FASM)
Code:
flat assembler  version 1.69.07  (100000 kilobytes memory)
1 passes, 3 bytes.    
Works for me.
Post 26 Feb 2010, 02:08
View user's profile Send private message Visit poster's website Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 26 Feb 2010, 02:14
Hmm...
I though that would put word offset of label into AX?

Also, why/how can this be legal?
Code:
\a:
mov al,\a    
Post 26 Feb 2010, 02:14
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20338
Location: In your JS exploiting you and your system
revolution 26 Feb 2010, 02:42
bitshifter wrote:
Hmm...
I though that would put word offset of label into AX?
It does.
bitshifter wrote:
Also, why/how can this be legal?
Code:
\a:
mov al,\a    
mov al,0
Post 26 Feb 2010, 02:42
View user's profile Send private message Visit poster's website Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 26 Feb 2010, 05:24
Ahhh, i get it, offset was zero...
I thought we needed to use same reg size as code.
Its legal all the way up to MAX_BYTE

Within range:
Code:
times 255 db 0
\a:
mov al,\a    

Out of range:
Code:
times 256 db 0
\a:
mov al,\a    


Thanks for the clarification Smile
Post 26 Feb 2010, 05:24
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 26 Feb 2010, 08:17

(fasm 1.69.12)
Quote:

from revolution :Works for me.
indeed revolution, it does compile, but without "format MS COFF".

does compile
Code:
\a: 
mov ax,\a
    

this, below, does not compile
Code:
format MS COFF
\a: 
mov ax,\a
    

why ? i don't understand.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 26 Feb 2010, 08:17
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: 20338
Location: In your JS exploiting you and your system
revolution 26 Feb 2010, 08:25
A good example why one should always show all of one's code when asking for help. Otherwise one gets the wrong answer.

Anyhow, does this compile for you?
Code:
format MS COFF
a: 
mov ax,a    
If not then perhaps it is something other than the backslash (\) that is causing your problem.
Post 26 Feb 2010, 08:25
View user's profile Send private message Visit poster's website Reply with quote
cthug



Joined: 03 Apr 2009
Posts: 36
Location: /home/Australia
cthug 26 Feb 2010, 08:43
I am [edit]NOT[/edit] familiar with the COFF format but perhaps it uses 32bit symbols?

[edit]It has relocation, and symbol table.[/edit]


Last edited by cthug on 26 Feb 2010, 10:32; edited 1 time in total
Post 26 Feb 2010, 08:43
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 26 Feb 2010, 09:35

this doesn't compile either !
Code:
format MS COFF ;fasm 1.69.12
nop
b:
mov ax,b    
Quote:
always show all of one's code when asking for help
agree with you, but :

my_file.asm : 3220 lines
my_file.inc : 1420 lines

Wink

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 26 Feb 2010, 09:35
View user's profile Send private message Send e-mail Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 26 Feb 2010, 11:23
Cthug is right. How exactly do you expect compiler to move relocated symbol into 16-bit register?
Post 26 Feb 2010, 11:23
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 26 Feb 2010, 11:33

indeed, correct.
I had not thought of it ! thank you.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 26 Feb 2010, 11:33
View user's profile Send private message Send e-mail 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.