EASy68K  
It is currently Thu Mar 30, 2017 8:43 am

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: local labels
PostPosted: Sun Feb 18, 2007 11:07 pm 
Offline

Joined: Mon Apr 17, 2006 8:45 pm
Posts: 10
Location: England
I would like to be able to use local labels as follows:

Code:
foo     moveq.l #5,D0
        moveq.l #$a5,D1
        lea     buffer,A0
.loop   move.b  D1,(A0)+
        dbra    D0,.loop


where local labels are preceded with a "." and are only valid in between global labels.

alternatively, as follows:

Code:
foo     moveq.l #5,D0
        moveq.l #$a5,D1
        lea     buffer,A0
1$      move.b  D1,(A0)+
        dbra    D0,1$


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Feb 19, 2007 4:32 am 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1036
Location: Monroe County Community College, Monroe Michigan, U.S.A.
Since EASy68K supports structured assembly there is really no need for local labels. Another thread on this board is discussing the DBcc branch and how it should be handled in structured code. http://www.easy68k.com/EASy68Kforum/viewtopic.php?t=337

_________________
Prof. Kelly


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu May 07, 2009 3:30 pm 
Offline

Joined: Fri Dec 19, 2008 1:12 pm
Posts: 37
profkelly wrote:
Since EASy68K supports structured assembly there is really no need for local labels. Another thread on this board is discussing the DBcc branch and how it should be handled in structured code. http://www.easy68k.com/EASy68Kforum/viewtopic.php?t=337
Now I know I only really program in 68k on my Amiga with AsmOne, but IMHO it's a bad idea to have to replace local labels with high level commands. They're nice if people want to use them, but because they're not assembler, not everyone will want to use them. For this reason, implementing local lables might not be a bad idea.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu May 07, 2009 4:23 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1036
Location: Monroe County Community College, Monroe Michigan, U.S.A.
Structured assembly has always been a part of 68000 assembly programming. The structured assembly statements in EASy68K are modeled after those included in the original Motorola 68000 Structured Assembler. Any 68000 assemblers that do not include them are deviating from the standard.

_________________
Prof. Kelly


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu May 07, 2009 7:56 pm 
Offline

Joined: Fri Dec 19, 2008 1:12 pm
Posts: 37
Hehe, I didn't know that, cool :) However, it doesn't change the fact that not everyone likes to use them (me included :o). Most people in the Amiga 680x0 coding scene have probably always written everything by hand (as far as I can guess), and I've actually never seen any Amiga related 680x0 code that has higher level directives in it.

My personal opinion is that it's actually a bad idea to include higher level directives in 680x0 assemblers. This opinion is completely subjective, of course, except for perhaps an educational reason: People should first learn how to do everything by hand without making a mess of things. When they know how to write proper code without higher level directives, they can start to use them.

Another problem may be that those directives might not always be compiled to the most optimum code, witch might be a problem when writing tight loops that have to run on actual hardware. I must admit that I don't have any facts, because I've never used those directives, and don't even know if my favorite Amiga assembler actually supports them (highly unlikely).

Anyway, seeing how it's probably reasonably easy to implement local labels, why not?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon May 25, 2009 12:55 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1036
Location: Monroe County Community College, Monroe Michigan, U.S.A.
I have local labels working. The final details may change before release. Currently if a label begins with an underscore it is treated as a local label. The assembler generates a unique global name by appending the local label to the previous global label name. Simple name mangling is done by replacing the underscore with a colon in the symbol table to prevent duplicate label errors with user created labels.

_________________
Prof. Kelly


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jun 01, 2009 10:20 pm 
Offline

Joined: Fri Dec 19, 2008 1:12 pm
Posts: 37
Thanks alot :thumbup: This really helps with keeping code clean. Great. It would be nice if they could start with a point. Looks best, IMHO.

Thanks again.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jun 02, 2009 1:05 am 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1036
Location: Monroe County Community College, Monroe Michigan, U.S.A.
Thorham wrote:
It would be nice if they could start with a point. Looks best, IMHO.

I tried that first but EASy68K uses .L to force long addressing.
Code:
    move.b  stuff.L,d0

Using a point to start local labels confused the parser. I'm going to take a look at the parser code and see if it is easy to change. If not I'll probably stick with underscore or something.

_________________
Prof. Kelly


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jun 02, 2009 7:15 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1036
Location: Monroe County Community College, Monroe Michigan, U.S.A.
Available in v4.7.0

Local labels begin with a dot '.'

_________________
Prof. Kelly


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jun 29, 2009 7:38 pm 
Offline

Joined: Fri Dec 19, 2008 1:12 pm
Posts: 37
Profkelly, thank you very much, it's appreciated :thumbup:


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group