flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [solved] searching strings for reserved words? FASM

Author
Thread Post new topic Reply to topic
Azagaros



Joined: 18 Jan 2013
Posts: 26
Azagaros 19 Jun 2018, 16:26
Code:
table:  db 0x00,0x00,0x00,'ALIGN'
        db 0x00, 0x01,0x00,'AAS'
    


It searched the string constant for reserved word? It is the error I am coming back to. The contents of the string should not matter for the compiler. Wow, talk about a big bug..


Last edited by Azagaros on 19 Jun 2018, 16:31; edited 1 time in total
Post 19 Jun 2018, 16:26
View user's profile Send private message ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 19 Jun 2018, 16:28
Works for me:
Code:
1 passes, 18 bytes.    
There must some other problem with your code that you haven't shown, because fasm doesn't search string literals for anything.

Maybe you have overridden db?
Post 19 Jun 2018, 16:28
View user's profile Send private message Visit poster's website Reply with quote
Azagaros



Joined: 18 Jan 2013
Posts: 26
Azagaros 19 Jun 2018, 16:32
Try it now..
Post 19 Jun 2018, 16:32
View user's profile Send private message ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 19 Jun 2018, 16:59
No problem:
Code:
1 passes, 14 bytes.    
Code:
00000000  00 00 00 41 4c 49 47 4e  00 01 00 41 41 53        |...ALIGN...AAS|    
Post 19 Jun 2018, 16:59
View user's profile Send private message Visit poster's website Reply with quote
Azagaros



Joined: 18 Jan 2013
Posts: 26
Azagaros 19 Jun 2018, 19:43
Appears this is what is giving me headaches. The idea of readable code.

Code:
foo equ 0x02
bar equ 0x03

table:  db  0x00, foo, 0x00, 'ABCDEF'
          db  bar, 0x00, 0x00, 'adcBXY'
    


I do not want to hard code the numbers, it is a substantial list. Both in NASM and FASM
Post 19 Jun 2018, 19:43
View user's profile Send private message ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 19 Jun 2018, 20:21
Still no problem:
Code:
foo equ 0x02
bar equ 0x03

table:  db  0x00, foo, 0x00, 'ABCDEF'
          db  bar, 0x00, 0x00, 'adcBXY'     
Code:
1 passes, 18 bytes.    
Code:
00000000  00 02 00 41 42 43 44 45  46 03 00 00 61 64 63 42  |...ABCDEF...adcB|
00000010  58 59                                             |XY|    
Post 19 Jun 2018, 20:21
View user's profile Send private message Visit poster's website Reply with quote
Azagaros



Joined: 18 Jan 2013
Posts: 26
Azagaros 19 Jun 2018, 20:44
You have the gist of what I am doing. I am still trying to find the reserved word then. db I have not messed with. It defines like that but is much longer per row and still looking.

I do something like this too:

Code:
foo equ 0x02
bar equ 0x03

dumb equ 0b00010001
dumber equ 0b10001000

table:  db  0x00, foo, dumb, 'abcdef'
         db bar, 0x00, dumber, 'abxdef'
         db 0x00, 0x00, dumber|dumb , 'abzabx'

    



I am still cleaning up the table, seeing what works but reserved word problem and it points to lines that looks like these.
Post 19 Jun 2018, 20:44
View user's profile Send private message ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 19 Jun 2018, 20:56
In fasm binary-or is spelled out in full.
Code:
         db 0x00, 0x00, dumber or dumb , 'abzabx'    
If you use the pipe | then you get a logical-or which can't be used for number generation.
Post 19 Jun 2018, 20:56
View user's profile Send private message Visit poster's website Reply with quote
Azagaros



Joined: 18 Jan 2013
Posts: 26
Azagaros 19 Jun 2018, 21:05
can I stack 'or's like dumb or dumber or dumbest? I am use to using the | pipe...c thing..

the other problem is that reserved word does not show up on a line with the |. Where do I find a complete list of reserved words? I might be running into an undocumented one.
Post 19 Jun 2018, 21:05
View user's profile Send private message ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 19 Jun 2018, 21:07
You can use as many ors as you need. Just don't use the pipe unless you are doing logical tests.
Azagaros wrote:
the other problem is that reserved word does not show up on a line with the |. Where do I find a complete list of reserved words? I might be running into an undocumented one.
Show us the error output with the "processed" text.

For a list of reserved words you can look into the source code "tables.inc".
Post 19 Jun 2018, 21:07
View user's profile Send private message Visit poster's website Reply with quote
Azagaros



Joined: 18 Jan 2013
Posts: 26
Azagaros 19 Jun 2018, 21:27
In c logical test is || and unary math with | in C\C++. You are telling me that && and & are & and 'and' for fasm too..

Exact error is: error: reserved word used as symbol.
Post 19 Jun 2018, 21:27
View user's profile Send private message ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 19 Jun 2018, 21:30
or, and, xor are all spelled out in full. There is no || or && in fasm.

The order of precedence is listed in the the manual. I always forget what it is and have to refer to the manual regularly.
Post 19 Jun 2018, 21:30
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 19 Jun 2018, 21:33
Azagaros wrote:
Exact error is: error: reserved word used as symbol.
fasm also outputs a "processed:" line just before the error. Show us what is being processed.

For example:
Code:
test.asm [1]:
and = 4
processed: and=4
error: reserved word used as symbol.    
Or slightly more indirect:
Code:
x equ and
x = 4    
Code:
test.asm [2]:
x = 4
processed: and=4
error: reserved word used as symbol.    
Post 19 Jun 2018, 21:33
View user's profile Send private message Visit poster's website Reply with quote
Azagaros



Joined: 18 Jan 2013
Posts: 26
Azagaros 19 Jun 2018, 21:58
How do I make that processed concept you are talking about? I am not familiar with the fasm command line options fully. I do not do anything you are stating.
Code:
foo equ 0x10; hex value 10h, decimal 16
;                  word      byte, byte ,byte, byte , byte, word,                null-terminate string length 16 and padded out to make a nice square line.
table: db 0x00,0x02, foo, 0x00, 0x00, 0x00, foo, dumb or dumber, 'stringx', 0x00, 0x00
    


I am working with SASM editor and it is not indicating anything as a keyword in the equate statements. The line before it does not generate the error and zeros in it. The line it errors on and every line just like it that follow, if I comment out the offending line errors out.

equ is a preprocessor thing? or does it need to be in the data block? NASM its preprocessor, FASM?
Post 19 Jun 2018, 21:58
View user's profile Send private message ICQ Number Reply with quote
Azagaros



Joined: 18 Jan 2013
Posts: 26
Azagaros 19 Jun 2018, 23:10
Code:
C:\Users\drago\AppData\Local\Temp\SASM\program.asm [185]:
            db  0x00,0x02,  imm8,   0x00,   0x00,   0x00,   0x00,          0xD5,  0x00,   0x0A,  eIMM,            'AAD',0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
error: reserved word used as symbol.
    


it does not tell me the offending symbol.
Code:
InstTable:  db  0x00,0x01,  0x00,   0x00,   0x00,   0x00,   0x00,          0x37,  0x00,   0x00,  0x0000,          'AAA',0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
            db  0x00,0x02,  imm8,   0x00,   0x00,   0x00,   0x00,          0xD5,  0x00,   0x0A,  eIMM,            'AAD',0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    


imm8 equ 10h and eimm equ 1. The first concept I went to was the string and the other two I am not finding in FASM. The first line compiles fine the second one errors..
Post 19 Jun 2018, 23:10
View user's profile Send private message ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 20 Jun 2018, 04:52
Still no problem:
Code:
imm8 equ 10h
eIMM equ 1
InstTable:  db  0x00,0x01,  0x00,   0x00,   0x00,   0x00,   0x00,          0x37,  0x00,   0x00,  0x0000,          'AAA',0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
            db  0x00,0x02,  imm8,   0x00,   0x00,   0x00,   0x00,          0xD5,  0x00,   0x0A,  eIMM,            'AAD',0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00    
Code:
1 passes, 54 bytes.    
There must be something else in your code.

To show the "processed" output I just use the command fasm test.asm in the console window. And make sure you are using the latest version of fasm.
Post 20 Jun 2018, 04:52
View user's profile Send private message Visit poster's website Reply with quote
Azagaros



Joined: 18 Jan 2013
Posts: 26
Azagaros 20 Jun 2018, 05:15
I realized a problem with all the equates and it was not one in either line but I did define something twice or redefined. It has been cleared up and it compiles. No warnings that I may have done that.

one compile it gets by it and fix the next error it return to the same line with the same error. It is a current version of SASM, gui editor with fasm built in. I will get it setup on linux and not window where I am editing it right now. SASM claims this version fasm 1.71.39
Post 20 Jun 2018, 05:15
View user's profile Send private message ICQ Number 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.