Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Kick Assembler
2006-06-07 21:34
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 doesn’t 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 it’s 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....
 
2006-09-18 19:06
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.
2006-09-18 19:32
chatGPZ

Registered: Dec 2001
Posts: 11154
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)
2006-09-18 20:12
tlr

Registered: Sep 2003
Posts: 1730
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.
2006-09-18 21:22
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!



2006-09-18 21:46
chatGPZ

Registered: Dec 2001
Posts: 11154
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)
2006-09-19 05:31
Oswald

Registered: Apr 2002
Posts: 5031
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/ :)
2006-09-19 16:08
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 :-)
2006-09-19 16:14
Oswald

Registered: Apr 2002
Posts: 5031
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 ?
2006-09-19 16:43
chatGPZ

Registered: Dec 2001
Posts: 11154
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 :)
2006-09-19 16:49
Slammer

Registered: Feb 2004
Posts: 416
Yes you can. (just like you can have functions of the same name).

But lets end the discussion cos there are other problems involved too.
Previous - 1 | ... | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | ... | 27 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
FABS/HF
Walt/Bonzai
megasoftargentina
CA$H/TRiAD
zscs
Guests online: 108
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.7)
6 Aliens in Wonderland  (9.6)
7 Comaland 100%  (9.6)
8 No Bounds  (9.6)
9 Uncensored  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Cubic Dream  (9.6)
3 Party Elk 2  (9.6)
4 Copper Booze  (9.6)
5 Rainbow Connection  (9.5)
6 It's More Fun to Com..  (9.5)
7 Dawnfall V1.1  (9.5)
8 Daah, Those Acid Pil..  (9.5)
9 Birth of a Flower  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Nostalgia  (9.4)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 SHAPE  (9.3)
Top Logo Graphicians
1 Sander  (9.9)
2 Facet  (9.5)
3 Mermaid  (9.4)
4 Pal  (9.4)
5 Shine  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.067 sec.