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


Forums > C64 Coding > Kick Assembler Thread 2
2009-07-21 17:20
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..
 
... 595 posts hidden. Click here to view all posts....
 
2023-08-09 21:51
Frostbyte

Registered: Aug 2003
Posts: 174
Quote: Instead of using a bunch of labels, you can create a list to keep track of the addresses, and then use that list to reach them. Like this:

.var ldas = List()

.macro the_macro_that_creates_the_code() {
.eval ldas.add(* + 1)
lda #0
sta $d020
}

Then, further down in the code:

.macro the_macro_that_refers_to_the_created_code() {
.for (var i = 0; i < ldas.size(); i++) {
lda colors + i,x
sta ldas.get(i)
}
}


Ahhh of course, brilliant! Thank you! I haven't tried it yet, but I can already see it solves my problem. :)
2023-08-09 22:35
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.
2023-08-09 22:40
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).
2023-08-10 12:49
Frostbyte

Registered: Aug 2003
Posts: 174
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. :)
2023-08-10 12:54
Frostbyte

Registered: Aug 2003
Posts: 174
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?)
2024-05-11 13:28
mutetus

Registered: Dec 2020
Posts: 12
I'm having a small problem (ka 5.25). So, this works:
.var filename = "textfile.txt"
.import binary filename

But .import text filename doesn't work and it doesn't even tell me what the problem is. Any way around this?
2024-05-12 13:33
Maxlide

Registered: Apr 2003
Posts: 30
Huhm.
When using a string literal instead of a variable it works.
.import text "textfile.txt"

But why .import binary is working fine with a variable and .import text is not... Well, very odd!
Previous - 1 | ... | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 - 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
Alakran_64
Airwolf/F4CG
Cupid/Padua/The Solu..
nucleus/TempesT
bepp/ΤRIΛD
curtcool
CA$H/TRiAD
Operator Teleksu
Guests online: 121
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.7)
6 No Bounds  (9.6)
7 Aliens in Wonderland  (9.6)
8 Comaland 100%  (9.6)
9 Uncensored  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Happy Birthday Dr.J  (9.7)
2 Layers  (9.6)
3 It's More Fun to Com..  (9.6)
4 Cubic Dream  (9.6)
5 Party Elk 2  (9.6)
6 Copper Booze  (9.6)
7 TRSAC, Gabber & Pebe..  (9.5)
8 Rainbow Connection  (9.5)
9 Dawnfall V1.1  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Nostalgia  (9.4)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 SHAPE  (9.3)
Top Original Suppliers
1 Black Beard  (9.7)
2 Derbyshire Ram  (9.5)
3 hedning  (9.2)
4 Baracuda  (9.1)
5 Jazzcat  (8.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.059 sec.