| |
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 |
Monte C: Don't think lda16, sta16 will do, since it was add16 that brought up the topic. However, now that I got used to the semicolon idear, I think I turned out rather well.
Groepaz: I understand the ca65 philosophy, and respect it. My approach is to make general building blocks instead of alot of special cases, when im programming. When I'm extending the assembler I usually tend to do the blocks more general instead of making a new case. This makes testing easier (since there is less brances to tested), and the assembler more flexible. So you can say that im using the philosophi internally in the assembler.
btw. taking the philosophy to the extreames would mean that we only needed the .byte directive! ;-)
|
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Groepaz: Due to the flexibility of where to put commands etc. relative to lines (You can put more commands on one line if you like), you have to have something that signals to the assembler that it's a macro. We can change the semicolon into something else, but I guess it wasnt what you ment. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
Quote:
Due to the flexibility of where to put commands etc. relative to lines (You can put more commands on one line if you like), you have to have something that signals to the assembler that it's a macro.
why? if the parser sees a "word", it checks if its a known (pseudo)opcode, and if not checks if its a known macro. if its neither it must be a label or variable assignment. (actually the first two cases are redundant, since internally all known opcodes can be implemented as macros...thats how many assemblers work anyway)
cant see a (technical) reason at all why a macro has to start with a certain character :) (even a label delimiter is not necessary - although i think THAT is a good think to have, since it doesnt delay errors)
|
| |
tlr
Registered: Sep 2003 Posts: 1790 |
Quote: Groepaz: Due to the flexibility of where to put commands etc. relative to lines (You can put more commands on one line if you like), you have to have something that signals to the assembler that it's a macro. We can change the semicolon into something else, but I guess it wasnt what you ment.
I'd like the ';' to be an alternative to '//'.
This very common with assemblers, and will work straight away with the unmodified asm-mode of emacs. |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Groepaz: Sorry, but its not that simple. To implement both an assembler and a scriptlanguage, Kick Assembler relies on modern compiler techniques to analyze the source code. The first step is done with a lexical analyzer which is precalculated to fit the language. The analyzer can identify a 6510 command because it knows the mnemonics in advance, but it can't know the macro names in advance.
Tlr: I know what you mean. In the first beta versions of Kick Assembler ';' was used as oneline comments. However, this collides with using ';' in for-loops, so it had to be removed.
(.for(var i=0; i<10; i++) { <-everything after the first ; would be a comment)
But thanks for the feedback. It's appreciated!
|
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
Quote:Groepaz: Sorry, but its not that simple. To implement both an assembler and a scriptlanguage, Kick Assembler relies on modern compiler techniques to analyze the source code. The first step is done with a lexical analyzer which is precalculated to fit the language. The analyzer can identify a 6510 command because it knows the mnemonics in advance, but it can't know the macro names in advance.
i never said its simple (or even trivial). but its certainly doable :) what you are saying only means that your approach of implementing parsing/preprocessing/macros cant do it :o) |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
simple to solve, you have to define macros in separated areas like
.startmacrodefinitions
.endmacrodefinitions
in pass 0 the compiler can resolve the macronames :)
edit: btw _wonderful_ solution to the problem I proposed, slammer for president \o/ :) |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
No, sorry.. its not the approach. As I wrote in the first explanation its tied together with the fact that you can place commands freely (have more command on the same line), so we need a way to tell that this is the next command. Take a look at the following example:
lsr add16
add16: .byte 1,2,3
.pseudocommand add16 arg1; arg2; arg3 {
...
}
Now tell me, Is the above a lsr with an absolote argument or a lsr with no argument and a call to the add16 pseudo command? There is no way of telling.
Edit: Oswald: thanks :-) |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
I'm lost in the syntax, but maybe its not stupid to ask that can add16 be at the same time a label and a name of a pseudocommand ? |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
its pretty easy - labels are the last option, and if a label has the name of a known opcode or macro then error out. thats how most sane assemblers work anyway :) |
Previous - 1 | ... | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | ... | 26 | 27 - Next |