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: 500
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
}
 
... 1 post hidden. Click here to view all posts....
 
2012-04-26 15:28
chatGPZ

Registered: Dec 2001
Posts: 11136
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: 1628
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: 11136
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: 500
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: 11136
"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 :)
2012-04-27 15:19
chatGPZ

Registered: Dec 2001
Posts: 11136
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
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
Dymo/G★P
K-reator/CMS/F4CG
Jammer
bOOZElEE
Guests online: 97
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Quadrants  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top NTSC-Fixers
1 Pudwerx  (10)
2 Booze  (9.7)
3 Stormbringer  (9.7)
4 Fungus  (9.6)
5 Grim Reaper  (9.3)

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