vasm - symbols in label names?
I have some unrolled loops that look a bit like this, with the loop body in a macro 'TDMR1COL'.
Code:
move.l .td_mr1_jt(pc,d5.w),a5 Is there a way to set up something like this with a REPT (or two) in vasm? I can't see a way to construct the .td_mr1_X labels automatically by including a symbol generated from the repeat count in a label name, either a REPTN or a SET-value. |
I'd be really interested in knowing if this is possible as well. I've not found any way to do it, but that doesn't mean it can't be done ;)
|
It is possible, although not in a very elegant way. If you look into the mot-syntax documentation you see that the special macro argument
\<symbolname>is supported (same syntax as Devpac?). It will insert the current decimal value of the absolute symbol with that name. So you can solve the problem by defining a helper-macro, like Code:
TDMR1COL_REPTN macro Code:
rept 8 |
This is pretty much what I used to do in Devpac.
I've put some tabs in your code and added an 'rts' into your macro: Code:
moveq #4,d5 ; Just so this is within the table. Code:
vasmm68k_mot -devpac -Fhunkexe test.s -o test And get the following result: Code:
vasm 1.8j (c) in 2002-2020 Volker Barthelmann |
Ah, of course!
For some reason I thought REPTN couldn't be used as a macro argument :confused Good to know it can. |
Quote:
So when you call the original macro as TDMR1COL REPTN, you will get eight times the same label .td_mr1_REPTN:as REPTN is regarded being part of the label name. Therefore you have to use \<symbol>within the macro to make the parser insert the current symbol's value instead. It has nothing to do with any argument given to the macro. EDIT: Maybe I confused you by designating \<symbol>as "special macro argument", like all other codes starting with '\' within a macro. These escape codes always insert some text, but only in some cases this text will be directly taken from an argument given to the macro. Refer to the documentation. |
I see, I misread that macro.
So, am I then correct in saying that the workaround is that you set a symbol to a value based on REPTN in a macro and then you expand that symbol in the same macro? |
Quote:
EDIT: Within \<REPTN>of course... |
Thanks, a clever trick. I have other loops like this with 24 and more iterations so it will be nice to tidy those up!
|
All times are GMT +2. The time now is 21:59. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.