flat assembler
Message board for the users of flat assembler.

Index > Main > Constraints on label characters

Author
Thread Post new topic Reply to topic
MattBro



Joined: 08 Nov 2003
Posts: 37
MattBro 31 Dec 2008, 21:20
What sorts of constraints are placed on the actual characters that labels consist of? For example could I make a label that looks something like this?


q@@=:

I am trying to use fasm as a back end for a little compiler project and I'd like to be able to overload operators. I though I'd generate some labels with the operand contained inside them somehow, but I know there must be some restrictions. It is clear for example that the label

@@: has special significance.

_________________
-- -------------------------------------------------------
"I am the Way and the Truth and the Light, no one comes to the Father except through me" - Jesus
---------------------------------------------------------
Post 31 Dec 2008, 21:20
View user's profile Send private message Visit poster's website Reply with quote
kempis



Joined: 12 Jun 2008
Posts: 49
kempis 01 Jan 2009, 00:08
Code:
ABCDEFGHIJKLMNOP:
QRSTUVWXYZ:
abcdefghij:
klmnopqrstuvwxyz:

!@$%^?....!!!!:

;number
dd 09,$56715,0.43536

;symbol
`~#&*()-+={}[]|,/\

;Quote is valid if it's not first char
yahghasghs'"'"'"'"'"'"'jdh^'"'"':
   ;I dont't check it, but I use FASMW syntax highlighting.    
Look at the color Smile, except the "!" character.
Happy new year 2009...
Post 01 Jan 2009, 00:08
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4020
Location: vpcmpistri
bitRAKE 01 Jan 2009, 00:10
This thread might be relevant. @@ does have special meaning as a anonymous label - addressable through @F/@B.
Post 01 Jan 2009, 00:10
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 01 Jan 2009, 01:38
the only problem i see with fasm labels is:

Code:
1stboot:
2ndboot:
3Dengine:
dd 4s,'44',
4s:
    


it might be usefull to be able to give labels names starting with a number.
Post 01 Jan 2009, 01:38
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: 20299
Location: In your JS exploiting you and your system
revolution 01 Jan 2009, 01:44
edfed wrote:
it might be usefull to be able to give labels names starting with a number.
I think it is only useful for creating confusion.
Code:
1b: db 1b ;<---- is this a label or a number?    
Post 01 Jan 2009, 01:44
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 01 Jan 2009, 02:08
i don't see where is the problem there.

just do the number convertion first, if it is a valid number, it is a number
else, it is probably a label or equate, and will be very usefull to define labels for floating point unit.

5dot0 dd 2.0
fld [5dot0]

it was just a suggestion.
Post 01 Jan 2009, 02:08
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: 20299
Location: In your JS exploiting you and your system
revolution 01 Jan 2009, 02:13
edfed wrote:
just do the number convertion first, if it is a valid number, it is a number.
But then the label 1b can never be used because it always looks like a number first. That is why labels cannot start with numbers. Too confusing.
Post 01 Jan 2009, 02:13
View user's profile Send private message Visit poster's website Reply with quote
MattBro



Joined: 08 Nov 2003
Posts: 37
MattBro 01 Jan 2009, 02:30
For my purposes I'm happy if I can start with some ordinary readable english letters and then have it's suffix be the user defined operator. So maybe something like

op+=:

I think there are problems with sequences that contain certain characters though like # or $$ etc. At least I notice the syntax highlighter start to go crazy when I use these things.
Post 01 Jan 2009, 02: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: 20299
Location: In your JS exploiting you and your system
revolution 01 Jan 2009, 02:37
I think the best way to find out if your desired label syntax is valid is just to try it and see if it assembles for you. If it doesn't assemble then just try something else.
Post 01 Jan 2009, 02:37
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 01 Jan 2009, 02:41
a valid number should not be a label, it is evident.
but all the rest, like my dear 3dengine, or 3dprojection or 3dcircle etc, etc, cannot be used as labels.
a number is always a number, but for the rest, it is something else.

i use sometimes lables like this:
Code:
efx dd 0
mov eax,[efx]
...
xx dw 0
mov ax,[xx]
..
    

and it is not so confusing. for me.
Post 01 Jan 2009, 02:41
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4020
Location: vpcmpistri
bitRAKE 01 Jan 2009, 02:57
<SARCASM>
I think instruction mnemonics should be allowed as labels.

mov:
mov eax,mov

What is wrong with that?
</SARCASM>

Rolling Eyes
Post 01 Jan 2009, 02:57
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: 20299
Location: In your JS exploiting you and your system
revolution 01 Jan 2009, 03:08
Then our source code can look like this:
Code:
eax dd 000O
mov: mov eax,eax
3d: mov [mov],3d    
Post 01 Jan 2009, 03:08
View user's profile Send private message Visit poster's website Reply with quote
MattBro



Joined: 08 Nov 2003
Posts: 37
MattBro 01 Jan 2009, 04:50
Yes the fact that this is disallowed is clearly a flaw in the assembler
lol.

In fact it is clearly functional programming when you can use labels as instructions too.
Post 01 Jan 2009, 04:50
View user's profile Send private message Visit poster's website Reply with quote
MattBro



Joined: 08 Nov 2003
Posts: 37
MattBro 01 Jan 2009, 04:57
After trying to compile a few cases, it looks like most of the shift first row characters on my keyboard:
!@#$%^&* cause problems. e.g. here's one that does compile,


Code:
org(0)
ooo dd "text",0
op$%:
mov ax, ooo  
    



and here is one that does not:
Code:
org(0)
ooo dd "text",0
op+=:
mov ax, ooo  
    

_________________
-- -------------------------------------------------------
"I am the Way and the Truth and the Light, no one comes to the Father except through me" - Jesus
---------------------------------------------------------
Post 01 Jan 2009, 04:57
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.