Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in 
CSDb User Forums


Forums > C64 Coding > 64tass: labels inside FOR ... NEXT loops
2016-12-01 16:45
ready.

Registered: Feb 2003
Posts: 423
64tass: labels inside FOR ... NEXT loops

hello,
does 64tass have the possibility to use indexed labels, like inside a FOR...NEXT loop?

Something like:
.FOR X=0, X<X_MAX-1, X=X+1
LABEL(X)
LDA #ABC
STA ZXY
.NEXT
so to have X_MAX labels.

Unrolled:

LABEL1
LDA #ABC
STA ZXY
LABEL2
LDA #ABC
STA ZXY
.....
 
... 8 posts hidden. Click here to view all posts....
 
2016-12-02 18:58
Groepaz

Registered: Dec 2001
Posts: 7928
Quote:
A great example of why code comments and symbols always should be in English

come on.... at least its not japanese :)
2016-12-02 19:42
Hein

Registered: Apr 2004
Posts: 772
Quoting soci
        *= $1000

lista   := []        ; empty
        .for i=0,i<8,i=i+1
lista   ..= [*]      ; collect
        lda #i
        .if i>3
        nop
        .fi
        .next

        .word lista   ;all
        .word lista[4];5th

Thanks, will try that.
2016-12-02 21:19
Oswald

Registered: Apr 2002
Posts: 4010
soci, could you explain the ..= operator?
2016-12-02 21:37
Flavioweb

Registered: Nov 2011
Posts: 327
Quote: soci, could you explain the ..= operator?

http://tass64.sourceforge.net/#compound
2016-12-02 22:12
soci

Registered: Sep 2003
Posts: 312
Yes, "..=" is the compound assignment version of the concatenate operator "..".

So "a ..= b" is the shorter form of "a := a .. b" or "a .var a .. b". Just like "a += b" is "a := a + b".

Btw. compound assignments for ".for" loops are only available since r1245. The last release was r1237 which is the reason I still used "i = i + 1" instead of the shorter "i += 1" in the example.
2016-12-03 15:56
Compyx

Registered: Jan 2005
Posts: 202
Quoting soci
The "^" prefix for macro parameters is gone since r98. It did an expression evaluation and the result was converted to a decimal string which in turn was used for textual replacement. Similar to the "^" operator.

While it could be resurrected I'd like to see it dead and buried. Unfortunately the non-macro operator variant of this can't go away that easy due to it's common use in basic start lines. The sad thing is there's no other useful use of it at all. It should have been assigned as the bank byte operator but it couldn't due to it's 1.3x legacy.


Why not remove it, with an error message when people use it. I'm sure I can change ^2016 to .text "2061" or something like it in my sources if 64tass borks and prints a clear message.
2016-12-03 17:07
soci

Registered: Sep 2003
Posts: 312
Normally it isn't used as '^2061' directly, but more as '^start'. An equivalent replacement is 'format("%d", start)' as that's what it does.

Possibly I can make a deprecation warning which directs to the use of format function instead.

It can't be changed to mean the bank byte immediately as it will compile without error if ".text $9e, ^start" was used. For ".null $9e, ^start" of course not as the result is likely 0 which is an error.

So there needs to be at least one release with the warning before it could change. And then the current "`" bank byte operator needs be there for even longer as an alias. But that's not a big problem as it's like the old "//" alias for modulo (now "%") and there's no plan to reuse it for something else yet.

Edit: It seems I have more than ~450 instances of ^xxx of which only ~50 or so is ^year, ^revision and such, rest is ^start. Oh well...
2016-12-03 19:29
Compyx

Registered: Jan 2005
Posts: 202
Sorry, I meant ^start of course.

Personally I'd rather break stuff now than later if it makes sense. Keeping old cruft around doesn't make maintaining things easier.
Deprecation warnings only serve to have people think "I'll fix that later", which they only do when stuff actually breaks.
2016-12-03 21:49
soci

Registered: Sep 2003
Posts: 312
It's not a maintenance issue as the code implementing it was refactored a few times already and is not much.

The concern is that the de facto standard notation for bank bytes still can't be used while there was a 100% replacement for years to create the exact same strings (and more).

I've added the warning for now as it helps to identify what needs to be changed and how. Especially that the breakage is hard to spot in some cases. Then sometime next year or so "^xxx" will be changed to calculate the bank bytes instead.
2016-12-03 21:52
Groepaz

Registered: Dec 2001
Posts: 7928
Quote:
Keeping old cruft around doesn't make maintaining things easier.

you only say that because you don't like it =P
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Kickback/G★P/Venom
ptoing
Guests online: 34
Top Demos
1 Uncensored  (9.7)
2 The Shores of Reflec..  (9.7)
3 Edge of Disgrace  (9.7)
4 Coma Light 13  (9.6)
5 Lunatico  (9.6)
6 Comaland 100%  (9.6)
7 Incoherent Nightmare  (9.5)
8 Wonderland XII  (9.5)
9 Comaland  (9.5)
10 Neon  (9.5)
Top onefile Demos
1 Dawnfall V1.1  (9.5)
2 Daah, Those Acid Pil..  (9.4)
3 Treu Love [reu]  (9.4)
4 Dawnfall  (9.3)
5 Tunnel Vision  (9.3)
6 One-Der  (9.2)
7 Goatbeard  (9.2)
8 Globe 2016 [reu]  (9.2)
9 Hardware Accelerated..  (9.2)
10 Safe VSP  (9.1)
Top Groups
1 Booze Design  (9.4)
2 Oxyron  (9.4)
3 Censor Design  (9.4)
4 Crest  (9.3)
5 SHAPE  (9.2)
Top Hardware-Gurus
1 Soci  (9.9)
2 Wiesel  (9.9)
3 Grue  (9.8)
4 Zer0-X  (9.8)
5 Lemming  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2017
Page generated in: 0.529 sec.