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 > ACME fetch immediate values from array/table?
2012-04-25 09:04
Bitbreaker

Registered: Oct 2002
Posts: 508
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: 494
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: 11386
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: 1648
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: 11386
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: 508
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: 45
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: 11386
"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: 45
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 :)
2012-04-27 15:19
chatGPZ

Registered: Dec 2001
Posts: 11386
i find it rather cumbersome to be honest ... to me it looks like the result of what happens when someone who hates makefiles and external tools starts writing an assembler =P
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
Brush/Elysium
zscs
ΛΛdZ
Guests online: 96
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Original Suppliers
1 Derbyshire Ram  (9.7)
2 Fungus  (9.3)
3 Black Beard  (9.2)
4 Baracuda  (9.2)
5 hedning  (9.1)

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