| |
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
} |
|
| |
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. |
| |
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 =) |
| |
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 ... |
| |
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? |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
only kickasm? i dont remember it from anywhere else atleast.... its quite an unusual feature for an assembler =) |
| |
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. |
| |
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 :-) |
| |
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 :) |
| |
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 |
| |
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 :)
|
... 1 post hidden. Click here to view all posts.... |
Previous - 1 | 2 - Next |