Yesterday, 21:19 | #1 |
Registered User
Join Date: Jun 2009
Location: United States
Posts: 65
|
How do you prefer to write anonymous/discarded labels?
Writing for 68k, my code is full of tiny branches, stuff like this:
Code:
tst.w d0 bpl .0 neg.w d0 .0: rts .0and increment the number for each label in the function. This only goes for local labels that aren't worth naming—for larger chunks of logic, I try to give them descriptive names. But a while back, I did some 6502 Assembly, and I really enjoyed the convention for anonymous labels. Most 6502 assemblers (including the 6502 module for vasm) allow for this kind of anonymous label, with slightly varying syntax: Code:
cmp #0 bpl :+ eor #$ff inc : rts :denotes an anonymous label, which can be used more than once in the function. Then, a +means to branch to the next anonymous label. A -would branch to the previous one. IMO, it's really nice to see the +or -and instantly know whether you're branching forwards or backwards. I wish there was an equivalent for 68k for simple use cases like this. |
Yesterday, 22:07 | #2 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,388
|
I do local labels depending on what they are, f.e. .loop.
In your examples, they could be .pos and .ret ; i find this more readable. |
Yesterday, 22:56 | #3 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,096
|
I also use meaningfull names and/or abbreviations. It's easier to read and understand when you get back to old code, and could also be a semi-decent substitute for comments (doesn't mean you don't need them, just that if you put more effort into names/labels/..., they're not needed as much).
I rarely need to write a lot of code fast, I typically go through several optimization phases and lots of tinkering, so taking time to write a few extra characters works fine for me. |
Today, 11:51 | #4 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,577
|
I agree with the two previous posts and I will probably not add anonymous labels to the mot-syntax module.
But you can always recompile vasm to use a different syntax-module with the m68k backend. Even the oldstyle-syntax one, originally intended for 8-bit architectures, which offers you the anonymous ':' labels. Or you could use the std-syntax module, with the syntax known from the GNU-assembler. There you have anonymous labels with digits from 1 to 9, followed by 'b' for next label backwards (-) or 'f' for forward (+). |
Currently Active Users Viewing This Thread: 2 (1 members and 1 guests) | |
Apollo |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
vasm - anonymous labels? | pants | Coders. Asm / Hardware | 3 | 01 October 2017 00:40 |
What Crunchers do you guys prefer? | Plagueis/KRX | Coders. General | 67 | 30 July 2014 23:20 |
Which would prefer handheld or laptop | Vars191 | Amiga scene | 5 | 06 June 2011 23:13 |
Anonymous contributions | TCD | HOL contributions | 2 | 24 November 2010 06:42 |
Civilization Anonymous | oldpx | Retrogaming General Discussion | 0 | 29 August 2005 00:21 |
|
|