English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 30 September 2017, 16:35   #1
pants
Registered User

 
Join Date: Feb 2017
Location: fastmem
Posts: 42
vasm - anonymous labels?

Does anyone know a nice way of replicating anonymous labels in vasm (ala MASM/FASM etc)?

Excuse nonsensical example:

Code:
     REPT   32
     ....
     cmp.l  d0, d1
     bne    @F
     move.l d2, d1
@@:  sub.l  d3, d1
     beq    @F
     move.l d4, d1
@@:
     ....
     ENDR
Where @F & @B are forward/back to next/previous @@?

Yes, it's a lazy 'convenience', but it is convenient and I am lazy :)

It also solves a problem I haven't been able to figure out with vasm - labels in rept blocks (like above). Currently if I have any rept block with labels I'm having to manually expand them (complete with unique label names). The macro solutions (\@, \@!, \@@ etc) don't work outside macros, afaict - or am I missing something obvious?

TIA folks :)

[Edit: Evil thought - macro expansion /inside/ a rept block may just work. Ew...]

Last edited by pants; 30 September 2017 at 16:59.
pants is offline  
AdSense AdSense  
Old 30 September 2017, 20:12   #2
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,019
Yes, anonymous labels are on my to do list since a long time. But it's not easily implemented into vasm without being too intrusive. I also need it for the gas-compatibilty in the std-syntax module.

Currently you have the following workarounds:

1. (Ugly & dangerous) Do branches relative to the current location symbol '*', e.g.:
Code:
        bne.b   *+4
2. (Better) Use the INLINE and EINLINE directives, which create a new local name space. Your example works now:
Code:
        REPT    32
        inline
        cmp.l   d0,d1
        bne     .1
        move.l  d2,d1
.1:     sub.l   d3,d1
        beq     .2
        move.l  d4,d1
.2:
        einline
        endr
phx is offline  
Old 01 October 2017, 01:32   #3
pants
Registered User

 
Join Date: Feb 2017
Location: fastmem
Posts: 42
Quote:
Originally Posted by phx View Post
2. (Better) Use the INLINE and EINLINE directives, which create a new local name space. Your example works now:
Code:
        REPT    32
        inline
        cmp.l   d0,d1
        bne     .1
        move.l  d2,d1
.1:     sub.l   d3,d1
        beq     .2
        move.l  d4,d1
.2:
        einline
        endr
Nice! Tested and works on all my rept usecases (local/global never mixed) - many thanks for pointing it out! (couldn't find inline/einline in the docs, but just noticed it was in the release notes).

Last edited by pants; 01 October 2017 at 01:34. Reason: typo :s
pants is offline  
Old 01 October 2017, 01:40   #4
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,019
Quote:
Originally Posted by pants View Post
couldn't find inline/einline in the docs
Should be in the doc since last year. It's in chapter 4.4: mot-syntax directives.
phx is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Floppy Labels caver99 support.Hardware 6 27 April 2011 00:05
Anonymous contributions TCD HOL contributions 2 24 November 2010 07:42
Workbench 3.1 Labels lopos2000 Amiga scene 6 11 November 2005 18:31
Civilization Anonymous oldpx Retrogaming General Discussion 0 29 August 2005 01:21

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:28.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.12965 seconds with 12 queries