| |
ready.
Registered: Feb 2003 Posts: 441 |
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
..... |
|
... 25 posts hidden. Click here to view all posts.... |
| |
ready.
Registered: Feb 2003 Posts: 441 |
thanks I got it working, very useful stuff. However I spotted a possible bug with 64TASS 1.54.1900
This is compiles ok:
FRAMES := []
.FOR FRAME=0, FRAME<=6, FRAME += 2
ZOOMS := []
.FOR ZOOM=1, ZOOM<=3, ZOOM += 1
- .binary .....
ZOOMS ..= [-] ; collect in zooms
.NEXT
FRAMES ..= [ZOOMS] ; collect zooms in frames
.NEXT
lda #<FRAMES[2][0]
ldx #>FRAMES[2][0]
while this complains "error: not defined ident 'FRAMES'"
lda #<FRAMES[2][0]
ldx #>FRAMES[2][0]
FRAMES := []
.FOR FRAME=0, FRAME<=6, FRAME += 2
ZOOMS := []
.FOR ZOOM=1, ZOOM<=3, ZOOM += 1
- .binary .....
ZOOMS ..= [-] ; collect in zooms
.NEXT
FRAMES ..= [ZOOMS] ; collect zooms in frames
.NEXT
so basically I am forced to declare the labels in RAM before they are actually used. In my program I call the labels in upper RAM but store the tables with labels definition much further down. |
| |
ready.
Registered: Feb 2003 Posts: 441 |
ok just found a workaround which compiles fine:
lda #<support_label
ldx #>support_label
FRAMES := []
.FOR FRAME=0, FRAME<=6, FRAME += 2
ZOOMS := []
.FOR ZOOM=1, ZOOM<=3, ZOOM += 1
- .binary .....
ZOOMS ..= [-] ; collect in zooms
.NEXT
FRAMES ..= [ZOOMS] ; collect zooms in frames
.NEXT
support_label = FRAMES[2][0]
I guess I can live with that :) |
| |
oziphantom
Registered: Oct 2014 Posts: 478 |
variables that are defined as := are defined in linear order and reset on each pass. So := before usage is required. By doing
x = variable
x is now a permanent value that remains across passes and hence the assembler can sub it in on the next pass for you. |
Previous - 1 | 2 | 3 | 4 - Next |