| |
Slammer
Registered: Feb 2004 Posts: 416 |
Kick Assembler
I recently did a new 6510 assembler and I hereby make it open to the public so you can use it too.
Kick Assembler is the combination of an assembler for doing 6510 machine code and a high level script language. With the assembler functionalities, you can write your assembler programs, and with the script language, you can write programs that generate data to use in the assembler programs. This could be data such as sine waves, coordinates for a vector object, or graphic converters. In addition, you can combine assembler commands and scripting commands which is a powerful combination. A little example: Where other assemblers can do simple unrolling of loops, Kick Assembler can base the unrolling of a loop on a list generated by the script language and select the content of the loop body based on the content of the list. This makes it more flexible when generating speed code.
The script language can handle values such as Numbers, Booleans, Strings, Lists, Vectors, Hashtables, Matrixes and you can define your own structures if the build in doesnt meet your needs. The assembler contains a replica of the java math library + a special 3d library for doing vector math (Rotation, move and projection matrixes). You can also define your own functions.
Finally, I want to mention that the assembler contains some special objects that makes it easy to import graphics (and convert it into you own spooky format which fits into the part you are working on) and music. Since finding the correct play address for a tune has recently been an issue in the *stupid* ASM Sid Player Example- thread I will here show how its done in kick Assembler. You simply load you PSID file into a variable in the script language and then read the things you need to know from the variable.
// Load the music into an object in the script language
.var music = LoadSid("C:/C64Music/Tel_Jeroen/Closing_In.sid")
// init the music
lda #music.startSong-1
jsr music.init
// play the music
jsr music.play
(The full example is listed in the manual)
Feel free to check out the assembler at http://www.theweb.dk/KickAssembler.htm
|
|
... 251 posts hidden. Click here to view all posts.... |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Style: You are right, it no longer accepts whitespace.When implementing pseudo commands I had to make this assumptions in order to tell the difference between executing a macro and a pseudo command with an argument that starts with a parantesis (like ($30),y). I understand your confusion - hope it didn't cause too much trouble.
|
| |
Style
Registered: Jun 2004 Posts: 498 |
nope, its fine - took me 5 mins to figure it out. Wish Id spent the 5 mins before posting, really :)
|
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Now release 2.17 is on the site, including error codes. You can download at http://www.theweb.dk/KickAssembler.htm |
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
...and I can confirm that my makefiles work as expected now. Thanks for the fix!
//FTC |
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
Another feature that would be nice in association with this error code return stuff is to have another kind of print statement (called something like .error) that would not only print strings in the same way as .print, but also make sure Kick Assembler returns a fail errorcode. I guess this would be quite easy to implement?
In effect, this would make it possible to issue user defined errors when some kind of restriction is violated in a function, macro, memoryusage or whatever, and actually halt the assembly process and not just print it on the screen and then go on with loading VICE or sending the code to your C64 via RR-Net or similar.
The .assert statement is there of course, but does not return an error code when failing.
(A similar feature exists in ca65 and DreamAss and...).
Just an idea... ;)
//FTC
|
| |
Slammer
Registered: Feb 2004 Posts: 416 |
You are right, that would be nice so I just implemented it. The new version 2.18 can be found on http://www.theweb.dk/KickAssembler.htm
|
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
Ah! hehe.. You rule dude!
Thanks a lot for this! (..and for the bugfix I requested too.) Fast service indeed! ;)
|
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
Hmm.. Dunno if it's just me that misunderstands something, or if there is something fishy going on.
.print IEEEremainder(7,4)
.print IEEEremainder(8,3)
Prints -1 and -2 respectively, where I would have expected them to produce 1 and 2.
But it seems not to be the case that it always just produces negative versions of the results, becuase:
.print IEEEremainder(10,3)
Prints 1 nicely on the screen.
Uh.. huhu.. ? :)
Just to be clear: I expect this operation to work like modulo. Perhaps that is wrong?
Of course I can do "modulo" with binary-nice values like 8 and so on, but in this case I want to "divide" by 3...
|
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
Quote: Hmm.. Dunno if it's just me that misunderstands something, or if there is something fishy going on.
.print IEEEremainder(7,4)
.print IEEEremainder(8,3)
Prints -1 and -2 respectively, where I would have expected them to produce 1 and 2.
But it seems not to be the case that it always just produces negative versions of the results, becuase:
.print IEEEremainder(10,3)
Prints 1 nicely on the screen.
Uh.. huhu.. ? :)
Just to be clear: I expect this operation to work like modulo. Perhaps that is wrong?
Of course I can do "modulo" with binary-nice values like 8 and so on, but in this case I want to "divide" by 3...
Kickass uses java.Math.IEEERemainder for this operation, see http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Math.html#IEE.. for more indepth explanation. I guess is has to do with working with doubles, where you assume integers.
Slammer: May I suggest you add mod or % operator, aswell, which uses java's % operator directly (assuming integers ofcourse). Like:
In cml.kickass.libraries.MathLibrary:
if(name.equals("mod"))
{
nrOfArgs(2, args, a);
return new NumberValue((double)(((int)a[0]) % ((int)a[1])));
}
Or whatever... :D
/Andreas |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Damn I got Hacked :-)
Well you are right, Kick Assembler uses the java math library and IEEERemainer works correct but a bit odd. You can however easily define your own modulo function like this:
.function mod(a,b) .return a-floor(a/b)*b
and used it like this:
.var x = mod(8,3)
I guess I will include a % operator in the next release since it's used rather often.
Btw. If you wanna hack the assembler further, it is possible to insert a the above function in the 'standard library'. In the kickass.jar, find the file called autoinclude.asm and insert '.function mod(a,b) .return a-floor(a/b)*b', then you can use the mod function everywhere in you programs.. .. Or you can just wait for the next release. |
Previous - 1 | ... | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | ... | 27 - Next |