flat assembler
Message board for the users of flat assembler.

Index > Main > Include non-whitespace character issues

Author
Thread Post new topic Reply to topic
jiangfasm



Joined: 08 Mar 2015
Posts: 60
jiangfasm 25 Jul 2018, 14:46
MSCOFF.ASM
Code:
include 'win32a.inc'
format coff
extrn '__imp__MessageBoxA@16' as MessageBox:dword
public _demo
_demo:
        push    0
        push    _caption
        push    _message
        push    0
        call    [MessageBox]
        ret
_caption db 'Win32 assembly',0
_message db 'Coffee time!',0    


MSCOFF1.ASM
Code:
include'win32a.inc'
format coff
extrn '__imp__MessageBoxA@16' as MessageBox:dword
public _demo
_demo:
        push    0
        push    _caption
        push    _message
        push    0
        call    [MessageBox]
        ret
_caption db 'Win32 assembly',0
_message db 'Coffee time!',0    



Code:
$ git diff MSCOFF.ASM MSCOFF1.ASM
diff --git a/MSCOFF.ASM b/MSCOFF1.ASM
index 4eabe64..266daa5 100644
--- a/MSCOFF.ASM
+++ b/MSCOFF1.ASM
@@ -1,4 +1,4 @@
-include 'win32a.inc'
+include'win32a.inc'^M ;<--There's been a mistake.
 format coff
 extrn '__imp__MessageBoxA@16' as MessageBox:dword
 public _demo
    


Code:
$ fasmg MSCOFF.ASM
flat assembler  version g.i8q67
3 passes, 201 bytes.

$ fasmg MSCOFF1.ASM
flat assembler  version g.i8q67
MSCOFF1.ASM [1]:
        include'win32a.inc'
Processed: include'win32a.inc'
Error: illegal instruction.
    
Post 25 Jul 2018, 14:46
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 25 Jul 2018, 14:59
A single or double quote is not on a list of special characters, neither for fasm nor for fasmg. This means that this character can be a part of a name, like in this example from Understanding fasm 1:
Code:
    Jule's:    

The quotes are only treated specially when they begin a new token. So to have a quoted string recognized you need to have it separated from other name with special characters and/or whitespace. Note how fasm's syntax highlighter that works on this message board emphasizes these rules, including in your samples above.
Post 25 Jul 2018, 14:59
View user's profile Send private message Visit poster's website Reply with quote
jiangfasm



Joined: 08 Mar 2015
Posts: 60
jiangfasm 25 Jul 2018, 16:42
Tomasz Grysztar wrote:
A single or double quote is not on a list of special characters, neither for fasm nor for fasmg. This means that this character can be a part of a name, like in this example from Understanding fasm 1:
Code:
    Jule's:    

The quotes are only treated specially when they begin a new token. So to have a quoted string recognized you need to have it separated from other name with special characters and/or whitespace. Note how fasm's syntax highlighter that works on this message board emphasizes these rules, including in your samples above.


Thank you so much!
Post 25 Jul 2018, 16:42
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.