| |
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 |
Matthias: Hey Matthias :-) Nice to hear from you! Please tell me if you release anything made with Kick Assembler :-) |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
I just uploaded a new bete release that supports DTV commands to the homepage. |
| |
Style
Registered: Jun 2004 Posts: 498 |
when I have the energy to learn new assembler syntax kickass will be my weapon of choice. The scripting rules.
|
| |
Style
Registered: Jun 2004 Posts: 498 |
OK, Im using kickass now - but I have a problem.
Sometimes it refuses to resolve symbols!
I cant quite get the logic of when and how.....
Ill post some simplified code soon |
| |
Style
Registered: Jun 2004 Posts: 498 |
OK, I managed to work around it
Basically if you have a macro with parameters and pass nulls, and in some way operate on those parameters, it throws this error.
How are nulls handled? |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
I havent seen your code yet, but as written on the Kick Assembler page, I guess you use an .if or some other statements which requires to run in pass 2 together with labels, which are resolved at pass 2 and available after they are resolved + in pass 3.
The cause of this is quite an interesting problem and I guess that no macro assembler can solve it 100% smooth. Why? Well check the following example:
.pc = $1000
.if (trickyLabel<$2000) {
.fill $2000,0
}
trickyLabel:
The program makes no sense because you cannot decide whether the fill command is going to be executed or not. If it is executed then trickyLabel=$3000 so it should not have been executed. If it wasnt executed then trickyLabel=$1000 so then it should have been executed.
Therefore, conditional commands (like .if) needs their arguments to be resolved before executing in pass 2. However, others do not. Kick Assemblers approach to this is to try to assemble as far as possible, and if a problem arises then throw and exception where the problem first arose. So unresolved labels (= what you call null values) generates a special value type called UnresolvedValue which you wont notice in most contexts. For example the following will work:
.var x = labelResolveLater // Assignments works fine
.var y = min(x + 400, pow(x,3)) // Functions etc. work fine
sta $1000+y // Asm commands works fine
labelResolvedLater:
However this will not work:
.var x = labelResolveLater // Assignments works fine
.var y = min(x + 400, pow(x,3)) // Functions etc. work fine
.if (y<100) sta $1000+y // .ifs wont work
labelResolvedLater:
In you example, Kick Assembler has executed your macro and come to a statement that needed its arguments to be resolved, and then thrown an exception where you used it the first time (=the macro call). So why doesnt Kick Assembler give an error at the .if statement? Actually, it did until v2.10, but that was quite confusing in other situations. I guess Ill try to make a better error message so its easier to understand this.
|
| |
Danzig
Registered: Jun 2002 Posts: 440 |
I encountered a problem with local variables in macros. so i checked it with the precalculated vector-example!
and it gave me the same error!
scenario:
In the example there is ONE object and the macro is called ONCE => works!
If I copy the Object and create a second one (changing the coords :) ) and call the macro a second time KickAssembler gives an error (Array index out of bounds:8 ) <= No Smiley ;)
It seems the local variable is not set properly!?
Copying the Macro and renaming it (like: .macro PrecalcObject2(object, animLength, nrOfXrot, nrOfYrot, nrOfZrot) fixes the problem and works...
But copying the Macro dozens of times for dozens of objects makes no sense at all :D
@Mads: Any suggestions?
|
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Danzig: Thats a bug. I actuallly found it this weekend and released a correction for this yesterday, so my suggestion is to download the newest version :-) |
| |
Style
Registered: Jun 2004 Posts: 498 |
Thanks slammer, indeed I was passing a label that hadnt been resolved yet to a macro with conditional assembly that would affect the value of the unresolved label :)
Anyway, Ive changed my libraries so I no longer rely on that sort of thing.
Thanks again for kickass - it rules.
|
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
can stand not to poke you guys, although using scripting and macros makes things incredibly easy, if you code a demo you will have to code a speedcode generator at the end of the day, otherwise you will face the problem of loading the huge speedcode... |
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | ... | 27 - Next |