| |
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 |
1. BasicUpstart is just a macro which is autoincluded when you load kick assembler. It looks like this:
.macro BasicUpstart(address) {
.byte <upstartEnd, >upstartEnd,10,0,$9e
.text ""+address
.byte 0,0,0
upstartEnd:
}
Since we do not yet have a toDecimalString function I just use the normal toString function to write the string of the adress. It will probably be included in the next version since tlr needs it.
NB. I just reverse engineered the basic code. If somebody have better knowlegde of the basic format then tell me.
2. Perhaps it will, but it will not be the first project i will do.
3. Sounds interesting, I'll check it out..
Btw. If any of you need the toDecString now you can just define it in the scriptlanguage like this:
// The function
.function toDecString(value) {
.var strValue = ""+value
.for (var i=0;i<strValue.size(); i++)
.if (strValue.charAt(i)==".") .return strValue.substring(0,i)
.return strValue
}
// Some examples
.print "decString1="+toDecString(15.12324)
.print "decString1="+toDecString(11)
.print "decString1="+toDecString(-3.9)
// Basic upstart macro with decString
.macro BasicUpstart2(address) {
.byte <upstartEnd, >upstartEnd,10,0,$9e
.text ""+toDecString(address)
.byte 0,0,0
upstartEnd:
}
|
| |
tlr
Registered: Sep 2003 Posts: 1790 |
Quote:1. BasicUpstart is just a macro which is autoincluded when you load kick assembler. It looks like this:
.macro BasicUpstart(address) {
.byte <upstartEnd, >upstartEnd,10,0,$9e
.text ""+address
.byte 0,0,0
upstartEnd:
}
Your end pointer is wrong!
Do this:
.macro BasicUpstart(address) {
.word upstartEnd // link address
.word 10 // line num
.byte $9e // sys
.text ""+address
.byte 0
upstartEnd:
.word 0 // empty link signals the end of the program
}
In reality only the MSB of the last link address has to be $00, so upstartEnd can be the start of the program if certain instructions are used. e.g LDA #$00 ($A9 $00), etc... |
| |
Barbarossa
Registered: May 2007 Posts: 31 |
Slammer,
If you need some example output from C64Asm from my source, let me know. It will give you an idea to work with.
How I normally debug on my 2-monitor system (yes I am that spoiled :) ) is to run the C64 emulator in single step trace mode on the left screen, and have the output text file on the right screen.
Then during debugging I would have al the variables, all the comments and everyting from the source available including of course real address info.
|
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Tlr: Thanks
Barbarossa: That would be nice, I'll pm you an email address to send it to. |
| |
Jammer
Registered: Nov 2002 Posts: 1336 |
help! i got something like this:
;--------------------------------------------------
;--------------------------------------------------
; Kick Assembler v2.15 - (C)2006 Mads Nielsen
;--------------------------------------------------
;--------------------------------------------------
parsing
pass 0
pass 1
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.HashMap.<init>(Unknown Source)
at cml.kickass.state.StdScope.<init>(StdScope.java:20)
at cml.kickass.state.ForScope.addIteration(ForScope.java:34)
at cml.kickass.directives.ForDirective.doLooping(ForDirective.java:83)
at cml.kickass.directives.ForDirective.parse1(ForDirective.java:36)
at cml.kickass.AssemblerToolbox.runParse1(AssemblerToolbox.java:54)
at cml.kickass.directives.BlockDirective.parse1(BlockDirective.java:30)
at cml.kickass.directives.ForDirective.doLooping(ForDirective.java:90)
at cml.kickass.directives.ForDirective.parse1(ForDirective.java:36)
at cml.kickass.AssemblerToolbox.runParse1(AssemblerToolbox.java:54)
at cml.kickass.directives.BlockDirective.parse1(BlockDirective.java:30)
at cml.kickass.directives.ForDirective.doLooping(ForDirective.java:90)
at cml.kickass.directives.ForDirective.parse1(ForDirective.java:36)
at cml.kickass.AssemblerToolbox.runParse1(AssemblerToolbox.java:54)
at cml.kickass.KickAssembler.main(KickAssembler.java:124)
what could have made it happen and how to solve it? my source is barely 6700 bytes long so i have no clue :/
edit: consider it solved ;) it was just typo in on of the loops filling memory with bytes (x=0; x<blahblah; but here incorrect z++)
|
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Good to hear you solved it (Endless loops - a classic)
It is possible to make programs that are so large that the default java heapspace is too small. You can raise it with the argument Xms (initial heapspace) and Xmx (maximum heapsize). Eg:
java -Xms800m -Xmx1000m -jar KickAss.jar sourcefile.asm
It don't happend very often.
|
| |
Slammer
Registered: Feb 2004 Posts: 416 |
A small update(v2.25) is now on the website with a couple of the things discussed here. |
| |
tlr
Registered: Sep 2003 Posts: 1790 |
Thanks! Will try. |
| |
The Shadow
Registered: Oct 2007 Posts: 304 |
Slammer,
thank you for the info to the Kick Assembler. |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
No problem. I'm happy to help |
Previous - 1 | ... | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 - Next |