Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user Werner ! (Registered 2024-05-30) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > ACME fetch immediate values from array/table?
2012-04-25 09:04
Bitbreaker

Registered: Oct 2002
Posts: 501
ACME fetch immediate values from array/table?

Hi Folx,

anyone an idea how to do the following within acme:

for (a = 0; a < x; a++) {
pos += offsets[a];
}

that would then be:

!for .a, .x {
!set .pos = .pos + ???
}

At the moment i solve the problem like this, but looks rather bloated:

!for .s, .size {
!if .s = 1 { !set .offset = 4 }
!if .s = 2 { !set .offset = 8 }
!if .s = 3 { !set .offset = 12 }
!if .s = 4 { !set .offset = 14 }
!if .s = 5 { !set .offset = 14 }
!if .s = 6 { !set .offset = 16 }
!if .s = 7 { !set .offset = 16 }
!if .s = 8 { !set .offset = 18 }
!if .s = 9 { !set .offset = 18 }
!if .s = 10 { !set .offset = 18 }
!if .s = 11 { !set .offset = 18 }
!if .s = 12 { !set .offset = 16 }
!if .s = 13 { !set .offset = 16 }
!if .s = 14 { !set .offset = 14 }
!if .s = 15 { !set .offset = 14 }
...
sta .bank,y
!set .bank = .bank + .offset
}
2012-04-26 12:41
Skate

Registered: Jul 2003
Posts: 491
you didn't get any response probably because there is no way to do it using ACME. you need to use some not that pretty workarounds like those "!if"s i'm afraid. you may move those "!if"s to a macro. macro would still look very ugly but for loop would look much cleaner that way.
2012-04-26 15:28
chatGPZ

Registered: Dec 2001
Posts: 11148
ppl should really go back to coding their tools in an actual programming language instead of in the assembler =)
2012-04-26 16:09
Peiselulli

Registered: Oct 2006
Posts: 81
The problem is that ACME don't have arrays. Maybe you can implement a preprocesssor that inserts your "ugly" macro into the output of it instead of a better syntax ...
2012-04-26 16:12
Frantic

Registered: Mar 2003
Posts: 1630
If we turn the question around (if I may): Which assemblers DO actually have arrays, apart from KickAssembler. ca65?
2012-04-26 16:19
chatGPZ

Registered: Dec 2001
Posts: 11148
only kickasm? i dont remember it from anywhere else atleast.... its quite an unusual feature for an assembler =)
2012-04-26 16:21
Cruzer

Registered: Dec 2001
Posts: 1048
In that case I'm really glad to be using KickAss. Couldn't live without arrays, or lists as we KickAssers call it.
2012-04-27 06:17
Bitbreaker

Registered: Oct 2002
Posts: 501
Okay, thanks for the feedback. As i am not much into fanatic stuff, i don't bother if others favour KickAss or other Assemblers. Seems like i have to live with the !if statements. No need to move to yet another crossassembler :-)
2012-04-27 07:43
andym00

Registered: Jun 2009
Posts: 44
The only thing I can think of is to (ab)use the conversion table used for character codes..

You could do some code as part of your code to generate the table you want and output it to a file in the code..
	!to "bodgytablething.bin", plain
	* = 0
	!for i, 256 { !byte i - 1 }

The swap back to the correct output file for the code..

And then later set it as the conversion table
	!ct "bodgytablething.bin"

And then access it using:
	lda #something + 'a'

To be honest I've not even tried it to see if it'll work, but I can't think why not, apart from it being a bit of a mindfuck :)

A few macros would make it more useable, and you could then have multiple tables to access by using multiple !ct to select to table you want to lookup..

Yeah.. It's a travesty, but it's the only way I can see ACME doing this :)
2012-04-27 14:42
chatGPZ

Registered: Dec 2001
Posts: 11148
"The only thing I can think of is to (ab)use the conversion table used for character codes.."
i cant help myself but point to post #3 =P
2012-04-27 15:02
andym00

Registered: Jun 2009
Posts: 44
I do kind of agree, although I've not really played much with KickAss and it's lists, and I'm not sure it suits the kind of thing I like to do, but it is a hugely powerful technique, as the bitmap conversion stuff demonstrated very nicely..
Half of me says overkill, half of me says yummy :)
 
... 1 post hidden. Click here to view all posts....
 
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
Laurikka
Nordischsound/Hokuto..
Arkaxow
Poison/Singular Crew
krissz
iceout/Avatar/HF
Airwolf/F4CG
CA$H/TRiAD
Guests online: 106
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.6)
6 Aliens in Wonderland  (9.6)
7 No Bounds  (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 Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.8)
4 Acidchild  (9.7)
5 Starlight  (9.6)

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