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-15 15:10
MagerValp

Registered: Dec 2001
Posts: 1078
Codenet is even faster.
2006-09-15 15:16
chatGPZ

Registered: Dec 2001
Posts: 11386
Quote:
the edit-test cycle will be faster.


i pretty much doubt that, if anything it will be just as fast, but still be more hazzle.
2006-09-15 15:45
Oswald

Registered: Apr 2002
Posts: 5094
well 1600% speed compiling must be on par with cross assemblers, right ? secondly vice doesnt needs to be started, no kernal memory check, etc. and I can have my fave cartridge instead of sticking to the built in vice one.

codenet = you have to switch between 2 monitors and keyboards
2006-09-15 15:48
chatGPZ

Registered: Dec 2001
Posts: 11386
vice has a cartridge built in? wtf! o_O
2006-09-15 16:07
Oswald

Registered: Apr 2002
Posts: 5094
can u add a cartridge on the commandline ?
2006-09-15 18:14
chatGPZ

Registered: Dec 2001
Posts: 11386
-ramcart
+ramcart
-ramcartimage <name>
-ramcartsize <size in KB>
-cartreset
+cartreset
-cartcrt <name>
-cart8 <name>
-cart16 <name>
-cartar <name>
-cartrr <name>
-cartide <name>
-cartap <name>
-cartepyx <name>
-cartss4 <name>
-cartss5 <name>
-cartieee488 <name>
-cartwestermann <name>
-cartstb <name>
-cartexpert

that enough options for you ? :o)
2006-09-16 05:14
Oswald

Registered: Apr 2002
Posts: 5094
ok u win & lets stop spamming this topic :)
2006-09-18 18:31
Slammer

Registered: Feb 2004
Posts: 416
Hi Guys, I just implemented a pseudocommands which basically are macros that takes Command arguments (#20, ($10),y, ($1000), etc.) as arguments. You can use getType() and getValue() on the command arguments and create new ones with the CmdArgument function. Here a quick example of an add16 command:

.pseudocommand add16 arg1;arg2;arg3 {
	// Use first argument as target if none is given
	.if (arg3.getType()==AT_NONE)
		.eval arg3=arg1

	// Arg1		
	.var arg1a = CmdArgument(arg1.getType(), arg1.getValue()) 
	.var arg1b = CmdArgument(arg1.getType(), arg1.getValue()+1) 
	
	// Arg2
	.if (arg2.getType()==AT_IMMEDIATE) {
		.var arg2a = CmdArgument(arg2.getType(), <arg2.getValue()) 
		.var arg2b = CmdArgument(arg2.getType(), >arg2.getValue()) 
	} else {
		.var arg2a = CmdArgument(arg2.getType(), arg2.getValue()) 
		.var arg2b = CmdArgument(arg2.getType(), arg2.getValue()+1) 
	}
	
	// Arg3 (Destination)
	.var arg3a = CmdArgument(arg3.getType(), arg3.getValue()) 
	.var arg3b = CmdArgument(arg3.getType(), arg3.getValue()+1) 

	clc
	lda arg1a
	adc arg2a
	sta arg3a
	lda arg1b
	adc arg2b
	sta arg3b
}


And you use it like this:
	:add16 point1 ; #$1234               // p1=p1+$1234
	nop
	:add16 point1 ; point2               // p1=p1+p2
	nop
	:add16 point1 ; point2 ; point3      // p3=p1+p2
	nop
	:add16 pointTable,x ; pointTable,y ; point3 // p3 = pointTable[x] + pointTable[y]


Which will generate code like this:

.C:1000 18 CLC
.C:1001 AD 00 30 LDA $3000
.C:1004 69 34 ADC #$34
.C:1006 8D 00 30 STA $3000
.C:1009 AD 01 30 LDA $3001
.C:100c 69 12 ADC #$12
.C:100e 8D 01 30 STA $3001
.C:1011 EA NOP
.C:1012 18 CLC
.C:1013 AD 00 30 LDA $3000
.C:1016 6D 02 30 ADC $3002
.C:1019 8D 00 30 STA $3000
.C:101c AD 01 30 LDA $3001
.C:101f 6D 03 30 ADC $3003
.C:1022 8D 01 30 STA $3001
.C:1025 EA NOP
.C:1026 18 CLC
.C:1027 AD 00 30 LDA $3000
.C:102a 6D 02 30 ADC $3002
.C:102d 8D 04 30 STA $3004
.C:1030 AD 01 30 LDA $3001
.C:1033 6D 03 30 ADC $3003
.C:1036 8D 05 30 STA $3005
.C:1039 EA NOP
.C:103a 18 CLC
.C:103b BD 00 20 LDA $2000,X
.C:103e 79 00 20 ADC $2000,Y
.C:1041 8D 04 30 STA $3004
.C:1044 BD 01 20 LDA $2001,X
.C:1047 79 01 20 ADC $2001,Y
.C:104a 8D 05 30 STA $3005

Any comments / suggestions to this? Please comment now because its less likely to change when it has been released (People expect syntax etc. to be backward compatible)

Otherwise I'll make a new beta release as soon as I have tested it a bit more and written some dokumentation.

2006-09-18 18:44
chatGPZ

Registered: Dec 2001
Posts: 11386
i would prefer if macros wouldnt have to start with a colon... (then again, i havent checked kickass at all yet =P)
2006-09-18 19:04
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! ;-)

Previous - 1 | ... | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | ... | 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
Ramon B5/DESiRE
wacek/arise
Technotron/I-I F
Guests online: 108
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 X-Mas Demo 2024  (9.5)
7 Dawnfall V1.1  (9.5)
8 Rainbow Connection  (9.5)
9 Onscreen 5k  (9.5)
10 Morph  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 Antitrack  (9.8)
3 OTD  (9.8)
4 Fungus  (9.8)
5 S!R  (9.8)

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