flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > numeric labels

Author
Thread Post new topic Reply to topic
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich
shutdownall
Is there anything which could be problematic while using numeric labels ?
As in the other thread I want to use FASM for BASIC instructions.

Like this example.

10 LET A=5
20 PRINT A+1
30 GOTO 20

I think this could be easily done because I already integrated the label autodetection in my version. But I am not sure if numeric labels could cause problems. Wink
Post 12 Apr 2012, 21:58
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: 17332
Location: In your JS exploiting you and your system
revolution
For BASIC programs the line numbers are only used in specific places (GOTO, GOSUB, etc.) but for assembly we have ambiguous situations:
Code:
mov eax,10 ; is this a label or a constant?    
Post 12 Apr 2012, 22:03
View user's profile Send private message Visit poster's website Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich
shutdownall
Good hint.
In fact I need the labels only in the beginning of a line.

For 30 GOTO 20 I would interprete the number 20 as number and not as label.
So I have to prevent FASM for replacing numeric labels with addresses.

Maybe that's why numeric labels are not supported. Rolling Eyes
Anyway I will use it only in a BASIC section.
Maybe find some easier solution.
Let see tomorrow. Wink
Post 12 Apr 2012, 22:20
View user's profile Send private message Send e-mail Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich
shutdownall
Anyway I want to use an autonumber feature and use code like this

Code:
;autolinenumber:start=100
;autolinenumber:step=10
      LET A=1
lp1: PRINT A
      GOTO lp1
    


which should be handled internally like
Code:
100 LET A=1
110 PRINT A
120 GOTO 110
    


So I am not sure now what the best way to implement. Shocked
Post 12 Apr 2012, 22:28
View user's profile Send private message Send e-mail Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
I never used basic on old systems, but I think numeric labels where designed because perhaps you coudnt't edit lines that was already writen.
So if you forgot a line, you just put:
Code:
100 let a=1
120 goto 110
110 print a

    


Now days, using alpha labels shouldn't be a problem.
Post 13 Apr 2012, 14:52
View user's profile Send private message Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich
shutdownall
I not use BASIC instructions for programming, I use it for compatibility to old software and old humans programming old style. Very Happy

Anyway it's a funny adventure doing things like this. Vintage computing is quite popular. Wink

And is assembler programming in general not a little bit vintage ? Cool
Post 13 Apr 2012, 20:38
View user's profile Send private message Send e-mail Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich
shutdownall
Enko wrote:
I never used basic on old systems, but I think numeric labels where designed because perhaps you coudnt't edit lines that was already writen.


Yes because editors were not available on all systems and used signifcantly more ressources than line based editing.

I need compatibility for maybe loading existing programs and let the user change / add something. That's why numeric labels (or in this case use of line numbers) are a must.
Post 13 Apr 2012, 20:42
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.