| |
Slammer
Registered: Feb 2004 Posts: 416 |
Kick Assembler Thread 2
The previous thread took a little long to load, so this is a new fresh one.. |
|
... 596 posts hidden. Click here to view all posts.... |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
This is probably one of the most asked questions. There are different ways to handle these kind of cases one of them is shown by Trident. Let me point you to another feature that solves it quite nicely.
Normally, when you want label1, label2, etc. the labels are inside a loop, like:
spriteLoop: .for (var i=0; i<8; i++) {
lda data: #0 // <- Fancy inbetween label declaration so you dont need +1
sta $07f8+i
}
You can now use the 'spriteLoop' label to access the 'data' labels of the different iterations of the loop like this:
lda #0
sta spriteLoop[0].data // Sprite 0
sta spriteLoop[1].data // Sprite 1
sta spriteLoop[2].data // Sprite 2
...
// Or simply .for (var i=0; i<8; i++) sta spriteLoop[i].data
If you want to do a table with the addresses, simply:
addrTable: .fill 8, <spriteLoop[i].data
You can access the labels of an executed macros by putting a label in front of the execution, just like we did with the .for loop. |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
With regards to the dicussion earlier in the thread. Several years ago I moved the main feedback/support channel of Kick Assembler to the following facebook group:
https://www.facebook.com/groups/RetroAssembler
This was to ensure a forum were the discussion where not interupted by other things. You are welcome to join regardless of which assembler you are using.
(Please notice that I do not visit this CSDb thread often). |
| |
Frostbyte
Registered: Aug 2003 Posts: 166 |
Quote: With regards to the dicussion earlier in the thread. Several years ago I moved the main feedback/support channel of Kick Assembler to the following facebook group:
https://www.facebook.com/groups/RetroAssembler
This was to ensure a forum were the discussion where not interupted by other things. You are welcome to join regardless of which assembler you are using.
(Please notice that I do not visit this CSDb thread often).
Yesterday I sent a request to join that group, but it's still pending. :) |
| |
Frostbyte
Registered: Aug 2003 Posts: 166 |
Quote: This is probably one of the most asked questions. There are different ways to handle these kind of cases one of them is shown by Trident. Let me point you to another feature that solves it quite nicely.
Normally, when you want label1, label2, etc. the labels are inside a loop, like:
spriteLoop: .for (var i=0; i<8; i++) {
lda data: #0 // <- Fancy inbetween label declaration so you dont need +1
sta $07f8+i
}
You can now use the 'spriteLoop' label to access the 'data' labels of the different iterations of the loop like this:
lda #0
sta spriteLoop[0].data // Sprite 0
sta spriteLoop[1].data // Sprite 1
sta spriteLoop[2].data // Sprite 2
...
// Or simply .for (var i=0; i<8; i++) sta spriteLoop[i].data
If you want to do a table with the addresses, simply:
addrTable: .fill 8, <spriteLoop[i].data
You can access the labels of an executed macros by putting a label in front of the execution, just like we did with the .for loop.
Nice! As in my scenario I don't know how many labels I'll end up with, I suppose in the second loop I could also iterate while i < spriteLoop.size()? (in other words, compiler considers spriteLoop as an array or list?) |
Previous - 1 | ... | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 - Next |