Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user Coinoperator ! (Registered 2024-06-17) 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
2006-06-08 07:27
HCL

Registered: Feb 2003
Posts: 717
Impressing!! Think i'll try this sometimebutnotnow :).
2006-06-08 08:25
WVL

Registered: Mar 2002
Posts: 887
w000t :D Have to try this :))
2006-06-08 10:30
Cruzer

Registered: Dec 2001
Posts: 1048
About time! ;) Finally people can compie the source for my last couple of 256b'ers.
2006-06-08 19:37
Slammer

Registered: Feb 2004
Posts: 416
HCL: Thanks for the letter. Always nice with some feedback.

Cruzer: Ahh.. I suspected you had a hidden agenda when you argued for a soon release :-D
2006-06-09 10:25
Monte Carlos

Registered: Jun 2004
Posts: 351
Great work, did you get motivated by Cruzers "dont know the routine" demos? Or was it the other way round?
I'm looking forward on the time after my diploma ...

Monte

2006-06-09 21:04
Ghostrider
Administrator

Posts: 43
OMG this is too good to be true!! I'm halfway through the reference manual, and I don't believe my eyes. Modern compiler technology working in the service of our dear old C64! This could change the way we code - the ease of developing demos - the convenience!!
2006-06-09 22:12
Burglar

Registered: Dec 2004
Posts: 1051
this sounds really promising, but uhm...

inflating: KickAssembler_BetaRelease2/KickAss.jar bad CRC 7e255f76 (should be 70d1f6ab)
2006-06-09 22:48
Danzig

Registered: Jun 2002
Posts: 430
@enno: syhte! the same :(
2006-06-10 02:07
Moloch

Registered: Jan 2002
Posts: 2902
A R G H !
2006-06-10 07:37
Slammer

Registered: Feb 2004
Posts: 416
Sorry guys. Hcl was so kind to point out some typos in the manual. I quickly made a re-release, but the upload resulted in a bad file on the server. It should be fixed now. (Remember to clear your cache so the browser dosnt download the cached old file)
2006-06-10 08:26
Slammer

Registered: Feb 2004
Posts: 416
Monte Carlos: Kind of.. The story of Kick Assembler goes something like this. When Cruzer started coding "You know the routine" I thought about getting into c64 coding again, so he send me the Assembler he was using. Unfortunately it contained a bug (a pointer that was referencing an invalid memory location) which did that I couldn't run it on the os I used on my computer. I also develop programs for a living, and at the time I was trying to convince the management that we could easily do a script-language for our product. If I succeded then I had to produce a quick proof of concept. To make sure I could do this, I meade some research and this research project was what became the first version of Kick Assembler. This was however, never realeased. Time passed.. Then at the Retro Concert last year in Copenhagen I kind of got caught by the old c64 spirit. I met some old sceners and especially Drax's enthusiasm was catching. So in the following months i reprogrammed Kick Assembler from scratch with a new architecture that allowed alot of new features. At christmas time I had a running assembler and had programmed my first part in it.
2006-06-10 13:07
Krill

Registered: Apr 2002
Posts: 2857
What HCL said. :D
2006-06-10 15:47
Monte Carlos

Registered: Jun 2004
Posts: 351
Nice Story,

sometimes i have the strange feeling, i'm the only c64 coder not involved in any business software development.

I like especially the features to import sid files, because i have changing the jump adresses always when trieing different musics. 2nd i like all the math function for generating tables, what is not even possible in ca65(the complexest 6510 assembler i know) and the graphics converting option for importing pc painted images without having to convert them again after every little pen strike.

What i dislike a little bit is, that kickass uses its own syntax for macros and recyclelabels, which is not compatible with other assemblers like ca65. If that would be the case one could benefit of the advantages of both assemblers.
Btw.: I already wrote me a library for use with ca65, which makes me a little bit bounded.

But this is a very personal opinion, because other people use dreamass or as64 or some other crossass. They cant all be syntax compatible, but perhaps the commonnesses(english for runaways) could be.

Monte
2006-06-11 21:44
Slammer

Registered: Feb 2004
Posts: 416
Monte: Yep. It would be nice if all assemblers had the same syntax. The recycle lables got to look as the do due to some compilier techincal reasons. Cruzer also complained, but now he has gotten used to it.. (TGD actually talked about doing a converter, but I guess it was only talk..)

However, its kewl with feedback, also the things you miss or dislike. The earlier I get it, the easier it is to change. Btw. I just added a .pseudopc directive which will be in the next release (Thanks to Danzig for pointing out that it was missing)
2006-06-14 20:53
Slammer

Registered: Feb 2004
Posts: 416
Kick Assembler is now supported by Relaunch64, but you will have to use the new release wich can be found on the homepage. I also added a .pseudopc command and a fractal example as a little gimmick:

 
.pc = $0400
.function toRe(i) .return -2+2.7*[i-floor(i/40)*40]/39
.function toIm(i) .return -1.6+3.2*floor(i/40)/24
.function mandelbroot(re,im) {
   .var zr = 0
   .var zi = 0 
   .var iter=0
   .for(;[zr*zr+zi*zi]<4 && iter<20;iter++) {
      .var newZr = zr*zr-zi*zi + re
      .var newZi = 2*zr*zi + im
      .eval zr = newZr
      .eval zi = newZi
   }
   .var colors = List().add($20,$0f,$20,$08)
   .return colors.get(iter&3) 
} 
.fill 25*40,mandelbroot(toRe(i),toIm(i))
2006-08-26 10:03
Slammer

Registered: Feb 2004
Posts: 416
Hi Guys

I decided that the Assembler have been stable long enough to make a offical release which can be found here on CSDB. The imporvements and the latest updates can still be found on www.theweb.dk/KickAssembler.htm
2006-08-27 05:22
LordNikon

Registered: Dec 2001
Posts: 42
even runs on mac osx =)
2006-08-27 21:34
raven
Account closed

Registered: Jan 2002
Posts: 137
What HCL & Krill said :)

I still use the good old Turbo Assembler on the 64 (with
some mods).
Using a PC to program for the 64 just takes all the fun out
of it.. (yeah I know I'm wierd ;)
2006-08-28 05:16
Style

Registered: Jun 2004
Posts: 498
raven: Quetzal/Chrome still uses AR monitor, I believe.

2006-08-28 06:23
Bastet

Registered: Jul 2005
Posts: 88
As long as you dont code in fscking screencodes... ;)

For the assembler, how good is that one for games, especialy RPGs? *g*
2006-08-28 06:31
JackAsser

Registered: Jun 2002
Posts: 1995
@BassetFurry: o_O ?!? :D WTF!
2006-08-28 09:51
Bastet

Registered: Jul 2005
Posts: 88
Its Bastet, like the pen and paper rpg or the egypt goddes ;)

And i heard from someone from Triad(?) that he coded in screencodes inside the basic editor. A little SYS1024 in the end and the programm ran. *g*

2006-08-28 10:16
Quetzal

Registered: Jul 2002
Posts: 71
Yeah, it's true, all of my stuff, including an entire game (Xiom) was coded in the monitor of my AR IV cart. Used an assembler one time only to write a RLE depacker for use in a demo part... Probably goes a long way towards explaining my totally destructured programming style, looks just like something has exploded in the memory :) Never went as far as using screencodes, but an Amiga friend was VERY shocked when watching me code that I remembered the numbers for all the opcodes and was doing stuff like typing 60 to do an RTS and save myself a keystroke....
Having said all that, this new Kick Assembler sounds very nice indeed from what I've read so far. Might even be enough for me to turn over a new leaf and start coding in a more normal fashion?
2006-08-28 10:17
Jetboy

Registered: Jul 2006
Posts: 233
what are screencodes?
assembler is assembler - its good to write programs in. There are no assemblers designed especialy to make RPGs... huh!
2006-08-28 10:46
tlr

Registered: Sep 2003
Posts: 1732
Quote: what are screencodes?
assembler is assembler - its good to write programs in. There are no assemblers designed especialy to make RPGs... huh!


You type characters at the top of the screen that you know resembles the right opcodes in ram, then SYS1024.
I once coded a raster interrupt split this way at a museum.
Pretty stupid actually.
I think I had to rewrite it 4 times or so. Pressing restore clears the screen... :P
2006-08-28 10:49
tlr

Registered: Sep 2003
Posts: 1732
@Quetzal: A lot of demo coders work/used to work this way.

Mastermind of Horizon even made it a point not to save the memory before the demo part actually worked. It has bitten him a number of times, especially at parties where the power was cut at some point. ;)

Kjer of Horizon coded most stuff in a monitor, and so does Crossbow AFAIK.
2006-08-28 11:05
JackAsser

Registered: Jun 2002
Posts: 1995
@Bastetfurry: Ahh, sorry about the typo. I actually meant your statement: "For the assembler, how good is that one for games, especialy RPGs?". Is that a joke I don't get? :D
2006-08-28 11:22
Scout

Registered: Dec 2002
Posts: 1568
Quote: You type characters at the top of the screen that you know resembles the right opcodes in ram, then SYS1024.
I once coded a raster interrupt split this way at a museum.
Pretty stupid actually.
I think I had to rewrite it 4 times or so. Pressing restore clears the screen... :P


You just admitted that you're autistic :)

---
8Bit Mayhem - The C64 Scenemusic Podcast
http://8bitmayhem.untergrund.net
2006-08-28 11:35
tlr

Registered: Sep 2003
Posts: 1732
Quote: You just admitted that you're autistic :)

---
8Bit Mayhem - The C64 Scenemusic Podcast
http://8bitmayhem.untergrund.net


Well... we kind of practised doing some simple code one afternoon before going there... ;)
(not that particular code though)

You'd be surprised how few different values you really need to enter to implement it.

You'll need to know the value of the actual opcodes though.
2006-08-28 11:55
enthusi

Registered: May 2004
Posts: 675
I did some poking into screenram to change a loader-code there but actual petscii is another thing :) way different....
On one c64 I had no $-key working and poked it into screen to load directories. Did that for weeks before I changed kb - hm, that makes me look lazier than I usually am
2006-08-28 13:13
Bastet

Registered: Jul 2005
Posts: 88
Quote: @Bastetfurry: Ahh, sorry about the typo. I actually meant your statement: "For the assembler, how good is that one for games, especialy RPGs?". Is that a joke I don't get? :D

No, i realy meant it, how good is the assembler to write games especialy _r_ole_p_laying_g_ames(BardsTale, Ultima,...)?
I tryed my luck with Xlang but gave up as he simply ignored a second org directive.
And dont mention cc65 ,ok unfair its a c compiler but, it steals too much power from the programmer. ;)
ATM i am using acme, but i am not that happy with it.
What i realy want is some middlething betwhen assembler and compiler, ok, that would be Slang, but its useless when i want my basic start at $0801, want to insert some music from external file to $1000, some charset at $2000 and my code at $4000.
2006-08-28 15:16
MagerValp

Registered: Dec 2001
Posts:
Slang can do that easily. Read up on how the linker works.
2006-08-28 15:52
tlr

Registered: Sep 2003
Posts: 1732
@BastetFurry: I believe that Kick Assembler would be extremly well suited for complex games!
It supports all sorts of importing of graphics, generation of tables, ...

I currently use Dasm which is a quite good all purpose assembler, but no specific c64 features.
I haven't used Kick Assembler yet. Mainly because the syntax is a bit different I guess.

@Slammer: Did you implement the .transform directive? :)
(i.e call an external program to transform the enclosed code/data)

A switch to enable support for DTV opcodes would be nice too. (SAC #<imm>/SIR #<imm>/BRA <rel>)

2006-08-28 16:50
Jetboy

Registered: Jul 2006
Posts: 233
> A switch to enable support for DTV opcodes would be nice too. (SAC #<imm>/SIR #<imm>/BRA <rel>)

DTV emulator would be cooler :)
Anyway - they sait at the Lipsk game fair, that they intend to do new version of DTV with build in keyboard plug, though they dont intend to add disc drive support. Maybe some kind of flash rom. Atleast that's what my workmate was able to get out of them.

btw. Commodore keychain I got, is so friggin cool!
2006-08-28 17:24
tlr

Registered: Sep 2003
Posts: 1732
@Jetboy: It already has flashrom you know. 2Mb Flash + 2Mb RAM.
Keyboard connector sounds nice, but no IEC? Pretty daft considering the chip has both keyboard and IEC implemented.

There is some fuzz about it here aswell:
http://jledger.proboards19.com/index.cgi?board=dtvhacking&actio..

2006-08-28 18:48
Bastet

Registered: Jul 2005
Posts: 88
Ok, read the manual, nice features and i will give it a try.
But, why for goddes sake fucking java? ;)
2006-08-28 18:53
JackAsser

Registered: Jun 2002
Posts: 1995
@BastetFurry: Try nice language, try platform independant, try has lots of stuff, try doesn't depend on zillions of libs... :D
2006-08-28 18:58
Cruzer

Registered: Dec 2001
Posts: 1048
Agree with JackAsser. I can't see any reason why to make something like this in anything else than Java. It's nice that it automagically works on my PowerBook, even though it's developed on a Windoze box.
2006-08-28 19:04
Bastet

Registered: Jul 2005
Posts: 88
Cant agree as i dislike OO-Languages, interoperabilty bought with interpreter, good point, depends on rather large download (Java interpreter)....
OTOH, who cares, use what you like and what gets the job done ;)

2006-08-28 19:10
enthusi

Registered: May 2004
Posts: 675
though Im not totally fond of Java either this is an amazing example of a perfect java-code/use.
I mean 'compilers' love OOP and actually I love being able to run it on most unix-machines too...
I dont want java in anything that needs performance though but who am I? :)
2006-08-28 19:30
tlr

Registered: Sep 2003
Posts: 1732
The worst thing about java command line utilities is the terrible command line they require.

java -jar program.jar ...

Sure you could do an alias, but it leaves a bad aftertaste.

That said, Kick Assembler looks very good, and I intend to try it out.
2006-08-29 12:14
Viktor
Account closed

Registered: Apr 2002
Posts: 78
I have read the documentation too. Is it poosible, to put your macros avaible? :)

Viktor
2006-08-29 15:45
Slammer

Registered: Feb 2004
Posts: 416
Tlr: No, not yet. There where some technical dificulties that made it not that simple to do. But its still on my list :-). DTV opcodes is rather quick to implement so send me a list of the opcodes an they will be in the next release.

Bastet Furry: I selected java because its a nice language :-) Its easy to support multiple operating systems, its guards you against adressing invalid memory and it will be easy for others to write plugins for kickass in java (I have plans of giving the user access to write his own functions in java)

Viktor: I havn't distibuted my macros since I then would have to intensely test/debug them. One exception is the :BasicUpstart(address) macro I guess its will be used alot.

However. If anybody writes a tested library Ill be willing to distribute it with Kick Assembler / Insert it as standard library





2006-08-29 21:22
Danzig

Registered: Jun 2002
Posts: 430
I once had to debug/fix/finish a large SWING-Application (for those who don't know, SWING is the "successor" :D to AWT). And it was PAIN IN THE ASS, SLOW, RAM-INTENSIVE...

Later on I had to implement a Webserver-driven huge data-conversion-programm (fyi:running on ColdFusionMX) and JAVA was the way to go to create this MASSIVE amount of "commandline-tools" (non-GUI) triggered by the Webserver to be run in a JVM. And it was fast :)

for me, the only reason JAVA exists is to create CMDline-Tools ;) and its the right choice for KickAssembler.. Check it out and you will NOT encounter any "speedproblems"... Its fast!
2006-08-29 21:35
enthusi

Registered: May 2004
Posts: 675
I developed my own view on 'fast' :)
Im ok with waiting - still lovin' tapes.
But when something runs either idling or due to real heavy maths, I'd hate to be inefficient. So Id be ok if Kickasm would run in brainfuck. But due to Java I can run it at work and at home and blabla. First time something of importance used that advantage of java (actually C ist THE language for portable commandline if you keep ansi C99 :).
So Im happy to see this asm being so well designed apparently. Btw, Ophis-asm was in Python and quite fast/nice (simple) too.:)
2006-08-30 06:04
JackAsser

Registered: Jun 2002
Posts: 1995
So, people stop being lame.... Since when couldn't you afford to waste 80M on your harddrive when 300Gb costs like 100euro max?!? Just install JRE1.5.x and you have Java whenever you need it for tools like this.
2006-08-30 11:08
Shadow
Account closed

Registered: Apr 2002
Posts: 355
This seems like it could be a damn good assembler, going to give it a try.

Anyone happened to create a syntax-highlight-wordfile for UltraEdit yet? I'm so spoiled nowadays that I have trouble looking at non-highlighted code...

2006-08-30 14:57
Viktor
Account closed

Registered: Apr 2002
Posts: 78
Yes, it is good, and the documentation is good enough.

Do somebody have a display routine for the Vector section?

Slammmer:
Are the Vector calculations usable on a multicolor picture too?
2006-08-30 15:34
Jetboy

Registered: Jul 2006
Posts: 233
@Victor: those are VECTOR calculations. They give you operations over vectors, there is nothing that actualy draws any vectors. That you need to implement yourself. Those Vector objects are only so you can easily prepare precalcs.
2006-08-30 19:31
Slammer

Registered: Feb 2004
Posts: 416
Victor: Look in the examples that comes with the assembler. There is a full running vector example :-)
2006-09-01 19:36
The Syndrom

Registered: Aug 2005
Posts: 56
Hey Mads,

I think you did a great job on kickassembler! I recently used it to reassemble my (lost) sourcecode of "microtracker" (which infact is no tracker but just a very low-rastertime musicplayer), and working on that went very smoothly.

greets,
Matthias
2006-09-03 08:25
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 :-)
2006-09-03 09:44
Slammer

Registered: Feb 2004
Posts: 416
I just uploaded a new bete release that supports DTV commands to the homepage.
2006-09-03 11:08
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.
2006-09-11 06:31
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
2006-09-11 07:46
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?
2006-09-11 18:09
Slammer

Registered: Feb 2004
Posts: 416
I haven’t 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 wasn’t 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 won’t 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 won’t 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 doesn’t 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 I’ll try to make a better error message so it’s easier to understand this.
2006-09-11 19:54
Danzig

Registered: Jun 2002
Posts: 430
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?
2006-09-11 19:57
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 :-)
2006-09-12 05:51
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.
2006-09-12 08:55
Oswald

Registered: Apr 2002
Posts: 5032
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...
2006-09-12 09:11
Copyfault

Registered: Dec 2001
Posts:
Quote: 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...

I also didn't get this point... Wondering if there is a function

script_language -> 6510 speedcode_generator ???


As this seems not to be the case ;p, KickAss advantages mainly show when making some proof_of_concept - routines... or am I completely wrong here???

CF
2006-09-12 09:15
chatGPZ

Registered: Dec 2001
Posts: 11154
huge speedcode packs quite good though (ofcourse not exactly as good as with a speedcode generator)... i've almost never bothered to write a generator for that very reason (although for the stuff i'm working on atm i'm doing it a lot ...)
2006-09-12 10:14
Monte Carlos

Registered: Jun 2004
Posts: 351
The speedcodegeneration routine problem ist not so easy to solve. All speedcode generators have in common, that they copy a sequence of code somewhere into memory, then modify the sourcesequenz, copy the modified seq to a following location and so on...
It depends on what you want to do with the speedcode, when, where and how the modifications are done. This makes it difficult to write a generator for a whole class of speedcodes.
I tried it sometime ago, to write a copier for the speedcodesequences which calls a routine at an adress you passed before as parameter.
The called routine then modifies the code and returns into the copy routine.
I made this with cc65 and the result was heavily bloated code.
Then i made an attempt in assembler, but this lead to a similar complicated routine.
Perhaps i did'nt come up with the right idea then.


Monte
2006-09-12 10:17
Cruzer

Registered: Dec 2001
Posts: 1048
I agree with Oswald and copyfault. Scripting should be used for proof of concepts, and when you have seen that it works, you can bootstrap your routine by replacing the scripts with code generating assembly code.

Of course, for small pieces of code it doesn't matter, but generally I think it's faster to load a small code generator and have it generate the code than loading and depacking the generated speedcode.
2006-09-12 13:38
Copyfault

Registered: Dec 2001
Posts:
@Monte Carlos: while trying to do a userfriendly version of the ILM-editor, I also did some FLI-speedcode_generator in 6510 asm... I found it by far more comfortable to run the generator_routine in a main loop which calls a "paste_code" subroutine when necessary; is there a reason to do it the other way around? Maybe I didn't really get your point...

@Groepaz&Cruzer: [exaggerationmode=true] what about not packing all the speedcode and streaming new code_fragments from disk *rotfl* ???
2006-09-12 13:46
chatGPZ

Registered: Dec 2001
Posts: 11154
Quote:
@Groepaz&Cruzer: [exaggerationmode=true] what about not packing all the speedcode and streaming new code_fragments from disk *rotfl* ???


not so terribly rotfl at all :) in mathematica there is a part that does exactly that (inside torus followed by tunnel, one speedcode overloads the next, which results in the crossfade effect you can see)
2006-09-12 14:27
Oswald

Registered: Apr 2002
Posts: 5032
Groepaz, lol :) not at all, the speedcode is the same all the time, only it loads the tunel data while the torus is displayed, then simply copies the torus data over the tunel one. Have you ever checked how that routine works ?=)

copyfault, loading speedcode is stupid and will be always slower than generating doesnt matter how you do it.

besides you dont need copy code routine. If you want to do it fast do it all low level: lda #opcode sta (),y iny ....
2006-09-12 16:47
chatGPZ

Registered: Dec 2001
Posts: 11154
Quote:
Groepaz, lol :) not at all, the speedcode is the same all the time, only it loads the tunel data while the torus is displayed, then simply copies the torus data over the tunel one. Have you ever checked how that routine works ?=)


oh? no i've never checked it...thats how i remember how quiss explained it to me, but ofcourse...that was like 10 years ago =)
2006-09-12 19:04
Slammer

Registered: Feb 2004
Posts: 416
Hi Oswald, Nice with a bit of poking, It gives me the opportunity to state some points :-)

First of all it seams to me that you equals Kick Assembler with loop unrolling and nothing else, and ignoring all the other advantages the script language offers.

When you have converted a logo to koala format with p1 and want to reallocate the data, or use only part of the picture, I guess you do the task by hand and do it every time you change the logo. With Kick Assembler you just write a couple of lines to that does this for you.

When you want to convert a charset from a gif picture to a c64 charset, I guess you have to run a 3rd party converter or write one yourself in another programming language which you have to run every time you select another charset. Why not just write the converter directly in your assembler. It’s a lot easier and it runs automatically each time you assemble.

Small jobs like generating a sinus table, some random numbers, a bounce table, etc. you would normally do in other languages. But with Kick Assembler you can do it directly in the assembler.


Secondly, it sounds like you are neglecting macros. Well I don’t know about you, but I like to write :BasicUpstart($3000), and then get a basic program that starts my program at $3000, but you can ofcause also generate it the old fashioned way. And I guess my move macro does just as good a job as your hand coded one since it’s decides on making speed code or normal code depending on how many bytes you want to copy:

.macro Move(source, target, size) {
	.if (size<=$1000)   :FastMove(source,target,size)
	.if (size>$1000)    :GeneralMove(source,target,size)
} 

(Hey style, the above works since the size is given directly, but I guess you got that by now)

And finally, about making speed code. It’s correct that if you want a part to load quickly you should probably unroll you your loops by hand. However, rapidly developing the part and then hand-packing the loop afterwards saves a lot of time since you are sure you pack the correct loop the first time… And by the way, there is a couple of directive to support unrolling of loops on my todo-list, but thats another story.
2006-09-12 19:15
Burglar

Registered: Dec 2004
Posts: 1051
slammer, for what it's worth (not a lot), if I'd ever get back to coding on 64, this is the assembler I'd be using.
2006-09-12 19:30
Slammer

Registered: Feb 2004
Posts: 416
Quote: Groepaz, lol :) not at all, the speedcode is the same all the time, only it loads the tunel data while the torus is displayed, then simply copies the torus data over the tunel one. Have you ever checked how that routine works ?=)

copyfault, loading speedcode is stupid and will be always slower than generating doesnt matter how you do it.

besides you dont need copy code routine. If you want to do it fast do it all low level: lda #opcode sta (),y iny ....


Oswald: When you like lda #opcode sta (),y then you must like the lastest version of Kick Assembler since it has all the opcodes incoperated as constants. So if you want to store an immediate lda command then you do like this:

lda #LDA_IMM
sta ($30),y

which is more readable than

lda #$a9
sta ($30),y

Burglar: Thanks :-) One of the reasons I made the Assembler was to make it easier to make C64 demos, so more coders would return to the scene ;-)
2006-09-12 19:47
Burglar

Registered: Dec 2004
Posts: 1051
Quote:
Burglar: Thanks :-) One of the reasons I made the Assembler was to make it easier to make C64 demos, so more coders would return to the scene ;-)

hell, I even tested the whole thing, I was blown away by the ease of the vector example. makes you eager when you dont want to get into (= too stupid) the mathematics of 3d, but still want to use it ;)
2006-09-13 05:54
Oswald

Registered: Apr 2002
Posts: 5032
Slammer, right I understand that macros and scripting is very powerful, but being an old fart used to TASM I just had to troll around a bit :) But now you made me really curious, so when I finally will decide to make that damn step for cross coding kick ass will be the first to check out :)
2006-09-13 06:29
Style

Registered: Jun 2004
Posts: 498
Oswald: Do it now. I thought ca65 was awesome, and kickass...well.... kicks its ass.

2006-09-13 07:00
chatGPZ

Registered: Dec 2001
Posts: 11154
one thing i always wanted to see in an assembler (and pretty much the only thing i really miss in ca65 :=P) would be the possibility to define a section for linking which is not continues as usual but interupted by various "dont use" areas. image you are coding a FPP style routine... every $400 bytes you would use 40 bytes, but everything else would be free to use (ok, over simplyfying here, but thats not the point). now if you could tell the linker what areas not to use, the linker would skip them (and if its a code section insert a JMP over that area). the linker could also sort data in a way to use the gaps most efficiently. etc. you get the idea :)
2006-09-13 12:08
Monte Carlos

Registered: Jun 2004
Posts: 351
@Copyfault:

Perhaps i should try it this way round.
Don't know how its better.

Monte
2006-09-13 19:41
Oswald

Registered: Apr 2002
Posts: 5032
is it possible to have macros for 16 bit addition, with automatic adress type recognition?

so we could write stuff like add16 #56,$fc or add16 $1000,$2003, etc etc :) this would make life so much easyer, I hate all the similar over and over again repeating code patterns for doing stuff thats only one instruction on a modern cpu.
2006-09-13 20:44
Cruzer

Registered: Dec 2001
Posts: 1048
@Oswald:

// define macro...
.macro add16 (adr, number) {
    lda adr
    clc
    adc #<number
    sta adr
    lda adr+1
    adc #>number
    sta adr+1
}

//use it...
    :add16($fe,3)
    :add16($2000,$ffff)

You need to define different macros for different address modes though, like immidiate (the version above), absolute (add one address to another), absolute,y etc.

@Slammer: Maybe addressing mode recognition would be an idea, so it could distinguish between :add16(2,2) and :add16(2,#2) ?
2006-09-14 06:40
Oswald

Registered: Apr 2002
Posts: 5032
yeah if adressing mode recognition would be supported then a whole new world opens for pseudo opcodes \o/ :) inc16,add16 etc etc :D
2006-09-14 17:31
Slammer

Registered: Feb 2004
Posts: 416
I agree. A way to make pseudo commands so you could avoid making add16, sbc16, move16 etc, for all addressing modes would be nice. I thought of difference ways of doing this with macros, and I don’t think there is any solution that will be satisfactory. However, if we make a special .pseudocommand directive then it would be possible. The biggest difficulty is to make a convenient notation. Let’s take a look at the addressing modes:

No argument
Immediate
Indirect zeropage,x
Indirect zeropage,y
Abolute
Absolute,x
Absolute,y
Indirect

(From the above is missing Zeropage, Zeropage,x , Zeropage,y and Relative, but they are automatically derived from the above when needed, so we don’t have to consider those.)

Now how should a macro call with parameters in each of these modes look? Since it's not a macro, we can skip the parenthesis around the call so we can use it for the indirect modes, and we must use another separator than comma for separating the argument since its used in some addressing modes. I need some suggestions here because the ones I thought of look like garbage.

However, Using the existing system is not that bad. You can implement the add16 command like this:

.enum {IMM, ABS, ABSX, ABSY}
.macro add16(mode, arg1, arg2) {
	clc
	:add8_nc(mode,arg1,arg2)
	:add8_nc(mode,arg1+1,arg2+1)
}

// Add8 no carry
.macro add8_nc(mode, arg1, arg2) {	
 	lda arg1
 	.if (mode==IMM)		adc #arg2
 	else .if (mode==ABS)	adc arg2
        else .if (mode==ABSX)	adc arg2,x	
        else .if (mode==ABSY)	adc arg2,y
        else .print "Error: Invalid mode!"
        sta arg1
}


The usage of the command is like this:

	:add16(IMM,point1,$0800)
	:add16(ABS,point1,point2)
	ldx #27
	:add16(ABSX,point1,pointTable)





2006-09-14 17:44
chatGPZ

Registered: Dec 2001
Posts: 11154
he, i'm disappointed. this can be done perfectly fine in ca65 =P
2006-09-14 17:59
Slammer

Registered: Feb 2004
Posts: 416
ok, that must mean that they have found a good notation. I will check it out.. Anything special I should look for? Or better, could you write a little example of how you would do in ca65?
2006-09-14 18:26
Slammer

Registered: Feb 2004
Posts: 416
I just chekked out the manual for ca65 and I dont think they have the solution to our problems. In the example they give (ldax) they determine the mode using a stringcompare telling if the fist char is a '#' - So the user have to do the detecting by himself.

Secondly they limit themselves to one argument, so they havnt solved the notation issue. How should add16 abs, absy look like? :add a,b,y (<- is y now an argument or telling that its adressmode abs,y?). In the example they only consider immediate and absolute.

Finally, they don't eliminate the use of an if sentence for each supported adressing mode.

If I have missed something then please show me.

2006-09-14 19:48
Monte Carlos

Registered: Jun 2004
Posts: 351
Talk to Ullrich (Author: cc65), as you both did very good assemblers. He appreciates feedback.
Perhaps both of you can get some ideas from the other.
That's what i would do ...

Monte
2006-09-14 19:56
Oswald

Registered: Apr 2002
Posts: 5032
I dont know anything about assembler coding, but when you resolve adresses you have to decide wether its absolute, indexed, immediate, etc. couldnt you add a simple new function like adressmode(argument) ?

if adressmode(arg1) = "absolute" then goto 16bit
if adressmode(arg1) = "immediate" then goto fastie

etc...
2006-09-14 21:32
Slammer

Registered: Feb 2004
Posts: 416
I guess I didn't formulate the problem clear :-)
Comma is used in some adressing modes (like ($32),y) so we cant use this to seperate arguments. What should be used instead? Well, I just tried some different possibilities and the best I can come up with is semicolon:

:add16 point ; #2
:add16 point ; point2
:add16 point1,y ; ($32),y

Looks a bit odd, but it will do the trick..

Oswald: The addressmode function is definetely possibility to mode-detection.
2006-09-15 00:55
Monte Carlos

Registered: Jun 2004
Posts: 351
Perhaps seperated lda16 sta16 will do.
This would be something intermediate.
2006-09-15 08:35
chatGPZ

Registered: Dec 2001
Posts: 11154
@slammer: ca65 philosophy is to not implement a certain feature if the problem can be solved with existing features. (because more features means more bugs) so there seem to be few features at first sight, but on a second look they are usually very powerful. (the argument parsing stuff is one of them)

that said, long ago i've implemented the full huc6280 instruction set in macros (and even longer ago gbz80), so parsing whatever you need is definetly possible (can't paste any examples though since i have lost these files :/)
2006-09-15 09:46
Oswald

Registered: Apr 2002
Posts: 5032
thats not always the best policy, check brainfuck for a nice example.
2006-09-15 09:57
chatGPZ

Registered: Dec 2001
Posts: 11154
well i prefer having a few features that work 100% as expected than thousends of seemingly nice but halfassed and bugging ones :) just tried too many crossassemblers before i guess, and most of them go into the second cathegory.
2006-09-15 10:03
Oswald

Registered: Apr 2002
Posts: 5032
lol, TASM+VICE works like magic I can tell you :)
2006-09-15 10:12
chatGPZ

Registered: Dec 2001
Posts: 11154
1) its TASS. TASM is a X86 assembler</smartass>
2) it plain sucks for any bigger projects. look at the turrican3 sources. its horrible pain to assemble them with tass
2006-09-15 10:19
Oswald

Registered: Apr 2002
Posts: 5032
sure it is, but for coding a demopart for me its still the best. I have the fastest edit-test cycle with alt+w, and alt+s, alt+l :)
2006-09-15 10:44
chatGPZ

Registered: Dec 2001
Posts: 11154
once your part takes a lot of memory so you have to assemble to disk i pretty much doubt that :)
2006-09-15 11:19
Spinball

Registered: Sep 2002
Posts: 87
Quote: once your part takes a lot of memory so you have to assemble to disk i pretty much doubt that :)

and that´s why i love the reu emulation in vice. just like i used to code wth reu+tasm on the real thing.
last crossassembler i tested was AS (http://john.ccac.rwth-aachen.de:8000/as/). i even did some macros that generated sin-tabs and stuff.
2006-09-15 11:40
Oswald

Registered: Apr 2002
Posts: 5032
groapaz, as my memory usage is mostly due to speedcode thats not a problem :) I will hang myself sooner then assembling to disk :)
2006-09-15 11:58
chatGPZ

Registered: Dec 2001
Posts: 11154
so you always save source to disk and reload assembler and source? same crap for me :=P
2006-09-15 12:10
WVL

Registered: Mar 2002
Posts: 887
Quote: so you always save source to disk and reload assembler and source? same crap for me :=P

no, he uses save+load state.. I did that too when I was working on Arcanum ;)
2006-09-15 12:12
chatGPZ

Registered: Dec 2001
Posts: 11154
and i still cant see how that would be significantly faster than using crossasm :)
2006-09-15 14:19
Oswald

Registered: Apr 2002
Posts: 5032
the edit-test cycle will be faster.
2006-09-15 15:10
MagerValp

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

Registered: Dec 2001
Posts: 11154
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: 5032
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: 11154
vice has a cartridge built in? wtf! o_O
2006-09-15 16:07
Oswald

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

Registered: Dec 2001
Posts: 11154
-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: 5032
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: 11154
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! ;-)

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: 1732
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: 5032
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: 5032
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.
2006-09-24 19:04
Slammer

Registered: Feb 2004
Posts: 416
Hi, I have been a bit busy lately, but I finally manages to write som dokumentation. So the new beta-release with .pseudocommands are now posted on http://www.theweb.dk/KickAssembler.htm

The manual shows how to define inc16, mov16 and add16 in just a few lines (shorter than the above posted example), so the rest of a 16 bit instructionset should be straight forward to implement. (Check out page 25-26 at http://www.theweb.dk/KickAssembler_Manual.pdf)

I must admit that when the subject of adressmode detection was brought up I thought it was only a matter of cosmetics to the already existing macros. But now that the pseudocommands are implemented I thinks it's a really cool feature with alot of possibilities which I am gonna use alot :-)
2006-09-24 19:09
Cruzer

Registered: Dec 2001
Posts: 1048
"use alot" - as in coding demo parts? :D
2006-09-25 06:22
Oswald

Registered: Apr 2002
Posts: 5032
pseudo commands will be really useful, any coder must know that there are a lot of 3-6 line code segments (16 bit stuff, loops, pointer increment,etc) we use over and over and over again, its way much better to write just one statement instead.
2006-10-01 22:01
Jammer

Registered: Nov 2002
Posts: 1293
a little problem of a person who cannot code nonetheless sticks his fingers into ass (obviously it's me):

.pc=$0801 "Basic"
:BasicUpstart($1000)

.pc=$1000 "Main"

lda #$00
sta $d020
sta $d021
lupek: jmp lupek

why can't i compile such trivial piece of code? i get 'null' in logfile :| don't laugh at me :P
2006-10-02 15:46
Slammer

Registered: Feb 2004
Posts: 416
Quote: a little problem of a person who cannot code nonetheless sticks his fingers into ass (obviously it's me):

.pc=$0801 "Basic"
:BasicUpstart($1000)

.pc=$1000 "Main"

lda #$00
sta $d020
sta $d021
lupek: jmp lupek

why can't i compile such trivial piece of code? i get 'null' in logfile :| don't laugh at me :P


Sounds really strange. I tried to copy paste your program into a file and assemble it and it works fine.

You mention something about getting null in a logfile, so I guess you are using Relaunch64? (Otherwise you don't need to use the logfile option). Remember to use the latest Relaunch version, where you can set up KickAss like shown below.

If you don't use Relauch then check the command line you are using for running KickAss. The error is probably to be found there.

2006-10-02 16:42
Jammer

Registered: Nov 2002
Posts: 1293
Quote: Sounds really strange. I tried to copy paste your program into a file and assemble it and it works fine.

You mention something about getting null in a logfile, so I guess you are using Relaunch64? (Otherwise you don't need to use the logfile option). Remember to use the latest Relaunch version, where you can set up KickAss like shown below.

If you don't use Relauch then check the command line you are using for running KickAss. The error is probably to be found there.



err, i only copy kickass.jar to program's dir and use

java -jar kickass.jar programtitle.asm -log log.txt

it works fine with all the examples included in the package. unfortunately it doesn't compile this one from me :|
2006-10-02 19:57
Slammer

Registered: Feb 2004
Posts: 416
There is nothing wrong with your code, and your command line look ok too.

What editor are you using? Perhaps it saves the sourcefile in a format that isn't supported by the lexical analyzer. You can test if that is the case in the following way.

Open one of my sourcefiles in your editer, make a small change (fx, insert a space) and save it againg. Then try to assemble it. If it won't assemble, then your editor have saved it in an unsuppored format.

To fix this you should look for a format option in your save file dialog. If you have saved it in a perfectly normal format and still can't get it to compile then send me the sourcefile and I'll look into it (The email address is in the introduction). Btw. both unix and windows textfiles works fine, and unicode chars like æøå is also ok.





2006-10-02 20:15
Jammer

Registered: Nov 2002
Posts: 1293
i use plain notepad then save as filename.asm, maybe that's the reason. however, i was modyfying examples in the notepad too and it worked.
2006-10-02 20:30
Slammer

Registered: Feb 2004
Posts: 416
I don't see why notepad shouldn't work. Try mailing me the sourcefile an I'll look at it.
2006-10-19 14:13
cavey

Registered: Jul 2002
Posts: 68
Quote: i use plain notepad then save as filename.asm, maybe that's the reason. however, i was modyfying examples in the notepad too and it worked.

hmm

ahem, couple of questions:

a) do you have known-extensions hidden in the explorer display options?
b) are you sure notepad saves it as name.asm, with the asm extension?
c) check the filename.. notepad has a habit of adding .txt when saving (even though you specify it as name.asm), and with known-extensions hidden.. well, you wouldn't notice ;)
d) while you're at it, check for "hide system files" and uncheck that as well. I hate it when windows thinks it needs to hide stuff from me.




e) hit me when I totally misunderstood the problems ;)
2006-10-19 14:59
Oswald

Registered: Apr 2002
Posts: 5032
I'd like to throw an axe into bill gates' head every time windows wants to hide something or windows wants to tell me what to do.
2006-10-19 15:01
chatGPZ

Registered: Dec 2001
Posts: 11154
"it looks like you are writing a letter, do you want me to..." =)
2006-10-19 15:18
Oswald

Registered: Apr 2002
Posts: 5032
nooooooooooooo!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :)
2006-10-20 18:26
Slammer

Registered: Feb 2004
Posts: 416
Cavey: I got the files, and they assembled ok. Jammer told me the problem comes when you place the files in a cetain way, but I havn't been able to reconstruct it.
2006-10-26 19:44
Frantic

Registered: Mar 2003
Posts: 1634
Just started trying out Kick Assembler and it seems to work OK in most respects.

However, when an error occurs during assembly, the program do not seem to end with an error code (return 1), so my makefile can not detect that a problem occured and goes on to transfer a binary to my c64 memory even though no new binary file was generated by the assembler. Fixable?

Also, I find it very disturbing that Kick Assembler uses another symbol for linecomments than _every other_ assembler I know of. Kinda pointless to be forced to fix this over and over again when grabbing some code from an old project.

Anyway, it seems like a nice assembler, well worth trying out!
2006-10-26 20:00
Slammer

Registered: Feb 2004
Posts: 416
I guess the return of an error code is fixed quite easily. Does anyone know an easy way of displaying the return code of a dos program, so I can test this?

BTW. Have you noticed the execute option that let you execute a program in case the assembling is successfull. I normally use it to run Vice.

The lack of ;-comments is because it would be even more irritating not to use the ; in the for loops (fx: .for(var i=0; i<10; i++) {})

EDIT: Btw. the fixing of old code can be done quite fast with a search/replace ; -> //
2006-10-26 21:31
Cruzer

Registered: Dec 2001
Posts: 1048
I for one welcome Slammer's new line comments. About time for some innovation in this area. ;)

Seriously, this is the smallest problem when migrating code from other assemblers. It's a bit more cumbersome to e.g. convert MXass style local variables to KickAss style. But still it's only a matter of like 10-15 mins to get a rather big project converted, and since I usually use several months on one routine, it's not really a big deal.

But it still would be nice with an "import other formats" feature.
2006-10-27 07:41
Devia

Registered: Oct 2004
Posts: 401
Quoting Slammer
Does anyone know an easy way of displaying the return code of a dos program, so I can test this?


C:\>echo %ERRORLEVEL%

Beware though when implementing it. I seem to remember that there are both a Return Code and an Exit Code and only the Return Code is accessible via the ERRORLEVEL environment variable.
2006-10-27 17:13
Slammer

Registered: Feb 2004
Posts: 416
Devia: Thanks for the tip.

I just implemented ERRORLEVEL=1 on errors. I will upload the new version to the webpage sometime this weekend.
2006-10-29 04:31
Style

Registered: Jun 2004
Posts: 498
Slammer - why am I suddenly getting syntax errors after upgrading?

eg

 :Do_irq (controlirq,$0090,true)
                     ^

Error: Syntax error



Doesnt it like hex anymore? :)


EDIT: Found it, you mustve changed the parser's handling of whitespace, because it no longer accepts a space between a macro call and its parameters.
2006-10-29 10:22
Slammer

Registered: Feb 2004
Posts: 416
Style: You are right, it no longer accepts whitespace.When implementing pseudo commands I had to make this assumptions in order to tell the difference between executing a macro and a pseudo command with an argument that starts with a parantesis (like ($30),y). I understand your confusion - hope it didn't cause too much trouble.

2006-10-29 11:49
Style

Registered: Jun 2004
Posts: 498
nope, its fine - took me 5 mins to figure it out. Wish Id spent the 5 mins before posting, really :)
2006-10-29 13:25
Slammer

Registered: Feb 2004
Posts: 416
Now release 2.17 is on the site, including error codes. You can download at http://www.theweb.dk/KickAssembler.htm
2006-11-05 21:29
Frantic

Registered: Mar 2003
Posts: 1634
...and I can confirm that my makefiles work as expected now. Thanks for the fix!

//FTC
2006-11-29 14:58
Frantic

Registered: Mar 2003
Posts: 1634
Another feature that would be nice in association with this error code return stuff is to have another kind of print statement (called something like .error) that would not only print strings in the same way as .print, but also make sure Kick Assembler returns a fail errorcode. I guess this would be quite easy to implement?

In effect, this would make it possible to issue user defined errors when some kind of restriction is violated in a function, macro, memoryusage or whatever, and actually halt the assembly process and not just print it on the screen and then go on with loading VICE or sending the code to your C64 via RR-Net or similar.

The .assert statement is there of course, but does not return an error code when failing.

(A similar feature exists in ca65 and DreamAss and...).

Just an idea... ;)

//FTC
2006-11-29 19:40
Slammer

Registered: Feb 2004
Posts: 416
You are right, that would be nice so I just implemented it. The new version 2.18 can be found on http://www.theweb.dk/KickAssembler.htm

2006-11-29 19:48
Frantic

Registered: Mar 2003
Posts: 1634
Ah! hehe.. You rule dude!

Thanks a lot for this! (..and for the bugfix I requested too.) Fast service indeed! ;)

2006-11-30 07:56
Frantic

Registered: Mar 2003
Posts: 1634
Hmm.. Dunno if it's just me that misunderstands something, or if there is something fishy going on.

.print IEEEremainder(7,4)
.print IEEEremainder(8,3)

Prints -1 and -2 respectively, where I would have expected them to produce 1 and 2.

But it seems not to be the case that it always just produces negative versions of the results, becuase:

.print IEEEremainder(10,3)

Prints 1 nicely on the screen.

Uh.. huhu.. ? :)

Just to be clear: I expect this operation to work like modulo. Perhaps that is wrong?

Of course I can do "modulo" with binary-nice values like 8 and so on, but in this case I want to "divide" by 3...
2006-11-30 08:57
JackAsser

Registered: Jun 2002
Posts: 1995
Quote: Hmm.. Dunno if it's just me that misunderstands something, or if there is something fishy going on.

.print IEEEremainder(7,4)
.print IEEEremainder(8,3)

Prints -1 and -2 respectively, where I would have expected them to produce 1 and 2.

But it seems not to be the case that it always just produces negative versions of the results, becuase:

.print IEEEremainder(10,3)

Prints 1 nicely on the screen.

Uh.. huhu.. ? :)

Just to be clear: I expect this operation to work like modulo. Perhaps that is wrong?

Of course I can do "modulo" with binary-nice values like 8 and so on, but in this case I want to "divide" by 3...


Kickass uses java.Math.IEEERemainder for this operation, see http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Math.html#IEE.. for more indepth explanation. I guess is has to do with working with doubles, where you assume integers.

Slammer: May I suggest you add mod or % operator, aswell, which uses java's % operator directly (assuming integers ofcourse). Like:
In cml.kickass.libraries.MathLibrary:

if(name.equals("mod"))
{
   nrOfArgs(2, args, a);
   return new NumberValue((double)(((int)a[0]) % ((int)a[1])));
}


Or whatever... :D

/Andreas
2006-11-30 18:19
Slammer

Registered: Feb 2004
Posts: 416
Damn I got Hacked :-)

Well you are right, Kick Assembler uses the java math library and IEEERemainer works correct but a bit odd. You can however easily define your own modulo function like this:

.function mod(a,b) .return a-floor(a/b)*b

and used it like this:

.var x = mod(8,3)


I guess I will include a % operator in the next release since it's used rather often.

Btw. If you wanna hack the assembler further, it is possible to insert a the above function in the 'standard library'. In the kickass.jar, find the file called autoinclude.asm and insert '.function mod(a,b) .return a-floor(a/b)*b', then you can use the mod function everywhere in you programs.. .. Or you can just wait for the next release.
2006-12-03 20:16
Slammer

Registered: Feb 2004
Posts: 416
I just uploaded a new release including the mod command.

http://www.theweb.dk/KickAssembler.htm

At first I made the % operator, but found out that it collides with the notation for binary numbers..
2006-12-04 12:31
Mace

Registered: May 2002
Posts: 1799
Magnificent concept!

In fact, this idea once crossed my mind when I was coding PHP for a webpage. Since it is possible to combine JavaScript, HTML and PHP all in one page, the idea of combining 'languages' for the C64 came to mind.
The exact thought I had, was: "woah, wouldn't it be nice to be able to add script to assembly code for C64?!".

Never said it out loud and I'm not capable of programming an assembler either, so you can guess my interest :-)

I started reading the manual. When I'm done, you'll receive an email with all the glitches and errors I found.

Also, I was wondering how it would be possible to distinguish between ASCII and screencodes in .text.
2006-12-04 20:48
Slammer

Registered: Feb 2004
Posts: 416
Thanks, Always nice with some feedback.

I'm not sure I understand what you mean by screen codes. The .text directives put out the chars corrosponding to the letters that would come out with the lower/upper case standard charset (Shifted mode). If you work in unshifted mode remember to write your text with small letters.



2006-12-04 21:09
tlr

Registered: Sep 2003
Posts: 1732
@slammer: Screencode = what you poke into the screen memory to get the corresponding char.

@ = 0, A = 1, B = 2, etc...
2006-12-04 21:21
Slammer

Registered: Feb 2004
Posts: 416
Ok, then I guess my previos post answered the question: The .text directive always outputs shifted-mode screen codes. Is there a need for a ascii or unshifted-mode option?
2006-12-05 16:15
Mace

Registered: May 2002
Posts: 1799
(former post deleted)

Ok, so writing in small chars would give 'a' as a $01 in the memory?
Then that's sorted, then :)
2006-12-07 20:52
Slammer

Registered: Feb 2004
Posts: 416
Hi guys,

My internetprovider's mailserver is highly unreliable these days, so if you want to be sure that your Kick Assembler feedback, bugreports etc. reach me then use private messaging here on CSDB..

2006-12-08 13:55
LordNikon

Registered: Dec 2001
Posts: 42
Is there a way to override warnings? ...
I try to import a huge binary and i only want to change some bytes in it with the following source code. When i compile that stuff the assembler gives me a warning and doesn't produce a prg.
2006-12-08 17:12
Slammer

Registered: Feb 2004
Posts: 416
Hi, can't see your source code so I dont know precisely what you are doing.

However, I guess you get a warning because you have reached an address higher than $10000. If you only want to use some of the binary file, then use the LoadBinary command to load it into a variable and the .fill command to dump the selected part to memory:

// Use the first $2000 bytes of a file
.var file = LoadBinary("myFile")
.fill $2000, file.get(i)

Edit: On second thought, perhaps thats not what you are trying to do. Is it that you want to have overlapping memory segments?

2006-12-09 17:30
Cruzer

Registered: Dec 2001
Posts: 1048
I think I've had the same problem as LordNikon. Solution: Load the file into a List, modify the bytes there, and dump the content of the List.
2006-12-09 23:16
LordNikon

Registered: Dec 2001
Posts: 42
Slammer: ... second ;) I want to have overlapping memory segments.
2006-12-10 13:40
Slammer

Registered: Feb 2004
Posts: 416
LordNikon: Here is a little christmas present. Release number 20: http://www.theweb.dk/KickAssembler.htm. The -aom option will do the trick and the -warningsoff option will turn off the warnings if you get tired of looking at them..

Cruzer: I don't think the list solution will work in Nikon's case. It sounds like he will replace bytes with source code, which means that he should assemble the code by hand before storing it into the list.



2006-12-10 14:31
LordNikon

Registered: Dec 2001
Posts: 42
THANX!

yeah "replace" was the right word for my case ;)
2006-12-10 17:33
Oswald

Registered: Apr 2002
Posts: 5032
using overlapping memory segments is silly. use one 64k segment and forget about the whole concept if you want to do that.
2007-05-25 21:41
Case

Registered: Aug 2002
Posts: 139
I have just decided to have a go at coding again after a few years break and would like to use this assembler, however i'm using crimson editor and i cannot get it to assemble anything, not even the example files.

I would be grateful if someone could help me with this.
2007-05-26 09:00
Cruzer

Registered: Dec 2001
Posts: 1048
What kinda error do you get?
2007-05-26 09:39
Slammer

Registered: Feb 2004
Posts: 416
I suggest that as a start, you try to assemble the example files from a command promt.
2007-05-26 17:28
Case

Registered: Aug 2002
Posts: 139
It's ok now, I've switched to ReLaunch64 and started to reformat my source code.


I'm still having some problems assembling my code, getting silly errors:

cannot resolve symbol "anext" but i have defined it. If anyone can help me please contact me.
2007-05-27 00:11
Style

Registered: Jun 2004
Posts: 498
post code here (or in a new thread) if you like.

2007-05-27 08:59
Cruzer

Registered: Dec 2001
Posts: 1048
My guess would be that you refer to it before you define it, or it could be a case error - KickAss is case sensitive, so "anext" and "aNext" are two different things.

But as Style said - post the code.
2007-07-31 18:14
Iapetus/Algarbi/Wood

Registered: Dec 2004
Posts: 71
Is there a way to export a lables file with Kickassembler to use in vicemon?

Thanks
2007-07-31 21:22
Slammer

Registered: Feb 2004
Posts: 416
No, not at the moment. If you need this feature now, then I suggest you use the print command to print out the labels you need and then copy them from the console into a label-file. Something like:

.print "al C:"+toHexString(myLabel1) + " .myLabel1"
.print "al C:"+toHexString(myLabel2) + " .myLabel2"
etc.


I agree that an export of the labels would be nice, so it might be included in one of the future versions
2007-07-31 21:41
Iapetus/Algarbi/Wood

Registered: Dec 2004
Posts: 71
Thank you
2007-08-16 10:13
tlr

Registered: Sep 2003
Posts: 1732
Ok, doing some coding in Kick Assembler now.
Maybe I'm missing something here, but how do I declare uninitialized storage?

In dasm I used to do this:
    seg.u zp
    org $a0
ptr_zp:
    ds.w 1

And this:
    seg.u bss
    org $a000
var:
    ds.b 1
    align 256
table:
    ds.b 256

This just generates the addresses for the labels in a structured way and outputs no data. ds.[b|w|l] is "define storage", although dasm will accept dc.b's and such and ignore the actual data.
The concept of a segment is an entity with a "pc" and a "uninitialized" flag. You only need to set the origin once for each segment. Everytime a seg <name> is encountered, that segment will be continued upon. (.u's need to be matched)

I'd also love to see some kind of symbol table output/export facility for those multi part code overlay demos. :)
(sure, could probably be done by parsing the ".print" output)
2007-08-16 10:34
Iapetus/Algarbi/Wood

Registered: Dec 2004
Posts: 71
.pc= $xxxx

.byte
.word
.text

.pc= $xxxx

.
.
.

from the manual:
there is also

.align $100 //Alignment to the nearest page boundary saves a cycle

.pseudopc <expr>

Assembles code as if it was placed at a different
location.

hope this helps
2007-08-16 10:38
tlr

Registered: Sep 2003
Posts: 1732
But that generates initialized storage, no?
I'm looking for generating labels _only_ for selected regions.
2007-08-16 10:40
Iapetus/Algarbi/Wood

Registered: Dec 2004
Posts: 71
ah ok sorry

Lets see if Slammer shows up...
2007-08-16 11:15
Slammer

Registered: Feb 2004
Posts: 416
The next version of Kick Assembler is almost ready. In this you can add a virtual flag to your memory block declaration:

.pc = $8000 virtual

label1: .byte 1,2,3,4,5,6,7,8 // This will not be stored in memory since its virtual

.pc = $9000
label2: .byte 1,2,3,4,5,6,7,8 // But this will

I guess this is what you want?
Further more, virtual memory sections can overlap other memory sections..

The new version will be out this weekend
2007-08-16 11:19
Cruzer

Registered: Dec 2001
Posts: 1048
@tlr: Not sure what you're trying to do, but is it something with reserving some memory, and then being able to write some data there later? If so, a List in KickAss might do the trick...

.var myList = List()

.eval myList.add(data)
.eval myList.add(moreData)

.pc = whereToStoreIt
.fill myList.size(), myList.get(i)

// this only works for bytes, if it's words then replace the last line with:

.for (var i=0; i<myList.size(); i++) {
.wo myList.get(i)
}
2007-08-16 11:21
Cruzer

Registered: Dec 2001
Posts: 1048
Oh, hi Slammer, hadn't seen your answer. Looking forward to the new version :)
2007-08-16 11:24
Iapetus/Algarbi/Wood

Registered: Dec 2004
Posts: 71
Slammer don't forget about the label export... =-)
2007-08-16 11:29
tlr

Registered: Sep 2003
Posts: 1732
Basically, yes! :)

I'd very much like the pop in and out of segments concept too though.
You might consider this a named scope of some kind.
For every named scope there should be a different state (pc, and so on). You should be able to end the scope, and then continue on it later by adding an identical scope statement.
Think: namespace in c++ with a twist.

Something like this:
.segment zp {
  .pc = $a0 virtual
  ptr_zp: .word 0
  flag_zp: .byte 0
}
.segment code {
  .pc = $1000
  sei
  ... code here ...
}
.segment bss {
  .pc = $4000 virtual // or even .pc = segment(code).end or similar
  flag: .byte 0
  .align 256
  tab: .fill 256 // should default to .fill 256,0 if it doesn't already
}

.segment zp {
  ptr2_zp: .word 0
}
.segment code {
  ... more code ...
}
.segment bss {
  ... more bss ...
}


maybe even:
.segment code {
  scope: {
    .segment zp {
      ptr_zp: .word 0
    }
  }
}

to allow ptr_zp to be available only in a local scope.

What do you think?
2007-08-16 11:48
tlr

Registered: Sep 2003
Posts: 1732
A cool thing about segments appart from organizing large code is if the possibility to save segments separately is added in some form.
If overlapping segments are allowed (by segment flag), overloading code (and data) parts of a demo can be conveniently represented.
2007-08-16 19:16
Slammer

Registered: Feb 2004
Posts: 416
I'll consider it for future version. However, the features for next version is already done.
2007-08-16 20:21
tlr

Registered: Sep 2003
Posts: 1732
Sounds great!

I'll be happy with "virtual" for now. :)

The usefulness of segments really shows when you start splitting your program into many files (which I often do).
With segments you can add stuff to bss and zp locally within each file. No need to keep that in a special place.
2007-08-17 10:54
tlr

Registered: Sep 2003
Posts: 1732
Quote: No, not at the moment. If you need this feature now, then I suggest you use the print command to print out the labels you need and then copy them from the console into a label-file. Something like:

.print "al C:"+toHexString(myLabel1) + " .myLabel1"
.print "al C:"+toHexString(myLabel2) + " .myLabel2"
etc.


I agree that an export of the labels would be nice, so it might be included in one of the future versions


Not entierly required but is there a way to do something like this?
(i.e can I get the passed symbol name and or type from within a macro (or other construct))
.macro export(sym) {
    .print ".var " + sym.name + "= $" + toHexString(sym)
}

label:
        jmp label
    :export(label)

Currently I'm just passing the name as a string as well.

BTW, redirecting print output to different files would be cool.
'>>' syntax perhaps, or .open and .print <file> <string>?
2007-08-17 13:23
Oswald

Registered: Apr 2002
Posts: 5032
tlr, you are getting over the moon with all that stuff imho. so far I have never needed anything more complex than the good ole tasm. when I will switch over finally to crossing that will be solely for the better editing capabilities, and some sutff like +/-, but definitly not for virtual or real segments, label exporting, and 3d matrices in objects...
2007-08-17 13:49
Scout

Registered: Dec 2002
Posts: 1568
Quote: tlr, you are getting over the moon with all that stuff imho. so far I have never needed anything more complex than the good ole tasm. when I will switch over finally to crossing that will be solely for the better editing capabilities, and some sutff like +/-, but definitly not for virtual or real segments, label exporting, and 3d matrices in objects...

I was thinking the same thing.
Isn't the code going to be bloated with structs, macro's, functions now which make it unreadable?

?too many options error

I think i'll skip using this assembler...
2007-08-17 17:02
tlr

Registered: Sep 2003
Posts: 1732
Oswald, Scout: Sure, but I already use things like the segment feature of dasm extensively in my code and I intend to port much of that to kick assembler.

Besides, Kick Assembler is already about "many options"...
Sure it can be done with pen and paper, but with a small kid at home I need all the timesaving I can get. :)

The main thing I like about kick assembler is to be able to generate stuff like sine tables parametrized directly in the source. No need to generate that externally just to fix some rounding error or thing like that.

That said, I have just started doing one part in it and so far it works out fine and I'll probably be happy with just the forthcoming "virtual".

The other stuff is just suggestions of functionality from other assemblers which I thought might fit.
All of which should ofcourse be optional!
2007-08-18 06:04
Slammer

Registered: Feb 2004
Posts: 416
Many options gives you a choice. You are free to take advantage of them, and if you don't like them just program as you normally would. I don't se how this can be a bad thing.

2007-08-18 08:15
tlr

Registered: Sep 2003
Posts: 1732
Maybe it's not obvious for everyone that you can program basically the normal way if you like, hence the critisism?

e.g this is still a valid program in kick assembler, no need for any frills if you don't need it.
    .pc = $1000
    sei
loop:
    inc $d020
    jmp loop

I think kick assembler is a very fresh and flexible way of doing coding.
Just pick and choose the features you like! :)

Slammer, you did a very good job on this!
2007-08-18 14:13
Iapetus/Algarbi/Wood

Registered: Dec 2004
Posts: 71
Keep up the good job Slammer!
2007-08-19 15:18
Slammer

Registered: Feb 2004
Posts: 416
Thanks guys.

I have just uploaded the new version so now you can user virtual memory blocks.
2007-08-19 17:21
tlr

Registered: Sep 2003
Posts: 1732
Quote: Thanks guys.

I have just uploaded the new version so now you can user virtual memory blocks.


Super, works like a charm! :)

I have another question:
Is it possible to reference the pc/define labels that is not equal to the current pc (like in Tasm/dasm or others)

e.g:
    lda #$00
hi_addr = * + 2
    sta $1000

or
sintab:
    .fill 256, blahblah...
costab = sintab + 64

I tried with .var or .const, but that won't allow forward references which is a bit awkward.
Maybe I missed something in the docs?

EDIT: well, I missed the pc stuff in the docs, it's actually precisely '*'. :)
2007-08-20 10:31
Mace

Registered: May 2002
Posts: 1799
Just got a weird idea the other day, that might not be usefull in a lot of occasions, but it would be nice if it existed... something to code on a rainy Sunday, so to speak ;)

In a program I'm working on, I want to use as little a memory footprint as possible. So I put code in the bitmap, where there are no visible graphics and make sure the colour codes are black.
However, weaving the monolithic code through the available space is a rather awkward job.

Wouldn't it be nice to have some way to 'reserve' certain spaces of the memory and drop data/code in the gaps between it, automatically splitting it and perhaps add JMPs to link the parts?

Just a thought... and I found it very much in the idea of Kick Assembler :)
2007-08-20 10:48
JackAsser

Registered: Jun 2002
Posts: 1995
Quote: Just got a weird idea the other day, that might not be usefull in a lot of occasions, but it would be nice if it existed... something to code on a rainy Sunday, so to speak ;)

In a program I'm working on, I want to use as little a memory footprint as possible. So I put code in the bitmap, where there are no visible graphics and make sure the colour codes are black.
However, weaving the monolithic code through the available space is a rather awkward job.

Wouldn't it be nice to have some way to 'reserve' certain spaces of the memory and drop data/code in the gaps between it, automatically splitting it and perhaps add JMPs to link the parts?

Just a thought... and I found it very much in the idea of Kick Assembler :)


I want this feature as well in ca65. Although the cases where it's useful are rather limited. But for example interleave speed code that changes the graphics in an FPP-based effect would be a school book case. =)
2007-08-20 10:57
Frantic

Registered: Mar 2003
Posts: 1634
In ca65 it would be useful in the following case too:

You want a segment with code from 0800 or so to somewhere like $8000, however, you also want a segment "inserted" from $1000 to $xxxx containing a tune. It would be nice if the linker would be able to figure out by itself where to split the contents of the codesegment WITHOUT explicitly having to supply the absolute size of the tune and divide the code segment in two and move code from codesegment_part1 to codesegment_part2 in case the first one overflows or so.
2007-08-21 19:30
Slammer

Registered: Feb 2004
Posts: 416
I finally got at litte time to check up on the latest ideas.

- Symbol exports for vice : Can't take long to implement so I guess it will be in the next release. Scoped variables might collide, but I guess we can find a solution.

- Segments / namespaces : The more I think about it, the more I think it's a great idea. Its quite simple, but It will solve alot of problems. Do you prefer brackets {}?. There are both pros and cons and I havn't really made up my mind on heavily indented assembler code. however I don't fancy notations like .namespace_start, .namespace_end.

- Export of symbols (for multi part demos): That is allready on my todolist. Are there any preferences? Should we export all symbols or only ones given by export commands? (If it's combined with a namespace the symbols won't collide)

- Splitted codememoryblocks with jmp instructions to tie them together: This is an interesting idea. Not quite trivial. I guess it requires branch commands (bne, beq, bcc .. ) that can jump to a random address, since your normal branch commands easily could get out of range. It can be done, but I think it will take some time.
2007-08-21 20:55
tlr

Registered: Sep 2003
Posts: 1732
Quote:
- Segments / namespaces : The more I think about it, the more I think it's a great idea. Its quite simple, but It will solve alot of problems. Do you prefer brackets {}?. There are both pros and cons and I havn't really made up my mind on heavily indented assembler code. however I don't fancy notations like .namespace_start, .namespace_end.

The indentation is a concern I haven't resolved either, but I think I still prefer brackets.

Quote:
- Export of symbols (for multi part demos): That is allready on my todolist. Are there any preferences? Should we export all symbols or only ones given by export commands? (If it's combined with a namespace the symbols won't collide)

Doesn't matter to much because unless it produces something that can be directly used when assembling another file it still has to be parsed and processed.
All symbols to a file will help me achieve that, others may have higher demands. :)

The process could be streamlined with .print to a custom file + macros though.
A structured export would help if you decide to implement some object-format (as in .o) later.

I'd like all of the above, but if I had to pick one it would be just a symbol table dump.


A couple of others:
- how about defining labels from an expression like in my post above? (i.e allowing forward references to a calculated address)

- toDecString() (so you can print integers)

- some way to resolve a passed parameters "name" when inside a macro/function. I guess it will be kind of a hack as I assume you do call by value. It would be quite useful though.
2007-08-21 21:24
Frantic

Registered: Mar 2003
Posts: 1634
@tlr: Hehe.. nice to see someone request all those things I found KickAssembler to be lacking when I tried it it a year ago or so. ;)

The assembler has some great potential. The biggest reason for me not to use it was the fact that it was not as good as other assemblers in figuring out expressions involving the *, since the script stuff seemed to be resolved long before the value of * is resolved.

Right?
2007-08-21 22:07
Iapetus/Algarbi/Wood

Registered: Dec 2004
Posts: 71
Is there problems with files names bigger than 8.3?
I had a big file name and when I tried to run it in vice it would display an error "JAM at $200A", I didn't know how to sort this and asked to some friends about this and couldn't find why it was happening.... today... I renamed my file to just 5 characters plus extension and it worked , no need to recompile just change the file name, now I don't know if this is a problem of Kickassembler, Pucrunch or Vice... 80
2007-08-22 05:38
Mace

Registered: May 2002
Posts: 1799
Quote:
- Splitted codememoryblocks with jmp instructions to tie them together: This is an interesting idea. Not quite trivial. I guess it requires branch commands (bne, beq, bcc .. ) that can jump to a random address, since your normal branch commands easily could get out of range. It can be done, but I think it will take some time.

Thank you for picking up the idea and thanks JackAsser for the support ;)

The CodeWeave() should have the option to be used OVER existing code/binary/whatever and IN BETWEEN code. What I mean is that it should either weave over a binary (graphics) given a certain mask byte and snap (will get to that later) or it should weave between code blocks that are generated out of the source code.

For binary weaving, like I am doing with graphics, I need to have a recognition byte, over which the code can be inserted. But not on EVERY location where this byte is, I want code. Only if, say, the piece of weaved code is long enough AND if it stays between the margins of a cluster of 8 bytes (for char colour purposes).
So you should be able to set a lower limit of code length and a snap value.

But with code generated from the source, you can't set the byte, so there should be something to tell the compiler that it should put the code in 'virtual empty' memory, if you catch my drift...

Hope this helps :-)
2007-08-22 07:06
Frantic

Registered: Mar 2003
Posts: 1634
I haven't followed the discussion in detail, but wouldn't a CodeWeave()-function be optimally useful it it could be used both to fill spaces in terms of bytes, but also in terms of cycles.

I mean, if you open the sideborder on every line and want to weave code in the free time in between, rather than filling up a specified number of bytes, then it would be Kick Ass(embler) handy-pandy crazy bikini-nice to be able to weave it in there.. :)

//FTC
2007-08-22 17:53
Slammer

Registered: Feb 2004
Posts: 416
tlr: I thought abount making constants (const) be visible like labels in the whole scope. I guess that will solve your label definintion problem. toDecString - why not. I thought nobody needed it since you can just write .print "x="+x and get the floating point representation. Resolving a parameters name inside a macro might get a little hard, since variables are dereferenced when parsed as parameters.

Frantic: I don't know your exact problem, but I can tell that I have a new evaluation mechanism on the sketchboard that don't bind a tasks to a specific parse. Insted as much as possible is done in the current parse and if something is missing then another parse is executed. This will eliminate problems occuring because you have defined one memoryblock before another etc. About weaving with cycles. I don't think it will work since the sideborder code will trash the register and statusflags.

Algarbi: I dont think the filename length have anything to do with Kick Assembler. It works on javas String class which has no limitations as far as I am aware of.

Mace: You lost me a bit there. I dont think it's good to make directives so specialized. Its better to keep the simple and flexible. So an approach could be to use a simple loop from the scriptlanguage to search through the graphicsdata to find empty spaces and put them in a list which you can give to the weave directive.
2007-08-22 18:22
tlr

Registered: Sep 2003
Posts: 1732
Quote:
tlr: I thought abount making constants (const) be visible like labels in the whole scope. I guess that will solve your label definintion problem. toDecString - why not. I thought nobody needed it since you can just write .print "x="+x and get the floating point representation. Resolving a parameters name inside a macro might get a little hard, since variables are dereferenced when parsed as parameters.

consts visible as labels is perfect for me. Doesn't break the paradigm either as consts cannot be redefined.

About dec, I just though it looked strange when doing prints like this: "(300.0 bytes, 2.0 blocks)" :)

I thought the parameter stuff might get hard. I'll think up some more cool use cases first and maybe you'll get interested. ;)
2007-08-22 18:35
Mace

Registered: May 2002
Posts: 1799
Quote:
Its better to keep the simple and flexible. So an approach could be to use a simple loop from the scriptlanguage to search through the graphicsdata to find empty spaces and put them in a list which you can give to the weave directive.

Define 'empty'. In bitmaps it should at least stick to a snap of 8 bytes and it should set to a minimum of space in which code will be weaved, otherwise you end up having a lot of small parts...

But hey, I just gave an idea, you work it out ;)
2007-08-23 12:11
Sasq

Registered: Apr 2004
Posts: 155
I was just wondering if you plan to support other targets than C64 ? I'm considering using KickAssembler for Atari 2600 programming... (allthough I guess it's pretty easy to just ORG it to the right place and strip the first 2 bytes from the file)
2007-08-23 13:42
Slammer

Registered: Feb 2004
Posts: 416
I have never owned an atari, so I don't know which chages are required.

But if all that have to be done is to add a target switch, which outputs to a file without the adressbytes and makes the memory block start at a predefined adress, then sure. But I will have to have someone who can test that it works (and tell me what the predefined adress is).
2007-08-24 08:55
Cruzer

Registered: Dec 2001
Posts: 1048
I'm definitely against a cycle based code weaving function, since I just finished coding one in machine code, so I don't want my work to be wasted. :)
2007-08-28 21:17
Barbarossa

Registered: May 2007
Posts: 31
Hi all,

A year ago today I picked up 6510 coding again after 14 years of absence. I discovered the wonders of crossassembling and started out to work again on a large project I abandoned back then. I found C64Asm and started to work with that. This was before I discoverd more assemblers and before I discovered forums like this one.

C64Asm was perfectly suited for my needs. It did everything I wanted except for the inability to use variables for zeropage locations (which are converted to absolute as you all probably know). I therefore used the absolute numbers in my sources. But managing the sources (especially in a large project when zeropage locations change frequently) was a pain in the ass.

I then decided after a year (I waited this long, since I saw no other limitations of C64asm and was reluctant to change) to switch to another assembler. After studying CA65 I decided to go with KickAssembler (I read some good reviews here).

I started translated a 1500 line source (which was a lot of work due to the very different syntax) and I finally got it to work.

Some questions remain:

1. When I use :BasicUpstart($7700) it compiles as 10 SYS 30464.0
I don't really need this function and it works like this, but I was wondering why is there a float and not an integer?

2. With C64Asm I could dissamble my old binaries .prg files so I didn't have to start from scratch again. Any chance this will become a feature in KickAssembler? Or should I dissamble with C64Asm and then translate the source to KickAssembler (sigh)?

3. What I really miss in KickAssembler is dissambly output. In C64Asm you could generate a reportfile, with the dissambly and the source in one file. This is, in my opinion, crucial for debugging. Is there a way to do this?

Thanks in advance for your answers and kudos to your great forum.

John
2007-08-28 21:57
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: 
}

2007-08-29 08:25
tlr

Registered: Sep 2003
Posts: 1732
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...
2007-08-29 09:23
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.
2007-08-29 13:46
Slammer

Registered: Feb 2004
Posts: 416
Tlr: Thanks

Barbarossa: That would be nice, I'll pm you an email address to send it to.
2007-09-07 23:02
Jammer

Registered: Nov 2002
Posts: 1293
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++)
2007-09-08 11:59
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.

2007-09-23 20:57
Slammer

Registered: Feb 2004
Posts: 416
A small update(v2.25) is now on the website with a couple of the things discussed here.
2007-09-24 07:47
tlr

Registered: Sep 2003
Posts: 1732
Thanks! Will try.
2007-10-31 20:43
The Shadow

Registered: Oct 2007
Posts: 304
Slammer,

thank you for the info to the Kick Assembler.
2007-10-31 22:54
Slammer

Registered: Feb 2004
Posts: 416
No problem. I'm happy to help
2007-12-08 17:32
Conrad

Registered: Nov 2006
Posts: 838
Hello Slammer,

just been trying out this new cross-assembler for first time... I'm really impressed :) will be using this from now on!

Keep the very impressive work up, sir!
2007-12-14 16:57
Burglar

Registered: Dec 2004
Posts: 1051
finally actually doing something with this kick ass assembler. the only small probs I ran into so far were easily solved as the manual seems quite complete ;)
2007-12-14 17:39
TDJ

Registered: Dec 2001
Posts: 1879
Quote: finally actually doing something with this kick ass assembler. the only small probs I ran into so far were easily solved as the manual seems quite complete ;)

Dude, you're coding? I expect a new SCS+TRC demo for X2008 then!
2007-12-14 18:15
Burglar

Registered: Dec 2004
Posts: 1051
Quote: Dude, you're coding? I expect a new SCS+TRC demo for X2008 then!

you gotta be kidding me ;)
2007-12-14 19:09
TDJ

Registered: Dec 2001
Posts: 1879
Quote: you gotta be kidding me ;)

When it comes to a new SCS+TRC demo, I do not kid.

But a new Pain demo is welcome too .. maybe you can get Sonix to do the graphics for it? :)
2007-12-14 19:39
Scout

Registered: Dec 2002
Posts: 1568
Quote: finally actually doing something with this kick ass assembler. the only small probs I ran into so far were easily solved as the manual seems quite complete ;)

o_O

W00t!
2008-01-07 02:46
Conrad

Registered: Nov 2006
Posts: 838
Dear Slammer (or anyone using kickass),

I'm having some trouble with this particular code to declare a list of strings and read a char from each string to store as a byte in memory. here's the code:
.var InfoList = List(12)

.pc=$0400
.for(var j=0; j<InfoList.size(); j++)
{
  .for(var i=0; i<InfoList.get(j).size(); i++)
  {
    .by [InfoList.get(j).charAt(i)]
  }
}
(and yes I've put the .eval stuff in aswell to enter strings, but that's too much to look at right now ;)

But I'm getting this common message:
"Error: Cant get a numeric representation from a value of type string"

Am I missing some function out to read a character and store as byte or is it something wrong in the code?
2008-01-07 07:25
Cruzer

Registered: Dec 2001
Posts: 1048
have you tried ".te" instead of ".by"?
2008-01-07 10:38
Conrad

Registered: Nov 2006
Posts: 838
Hello Cruzer.
Thank you for your suggestion as now the routine logically works, however it isn't doing exactly what i want it to do...

Basically what I want to do is when writing the list of strings to screen memory, encrypt each character with a certain byte. e.g. "A" character in list string shows "B" character on screen memory if encrypted by +$1.

if i do this:
.te [InfoList.get(j).charAt(i)]+$1
it only concatenates the "1" figure to the string, which is why I thought .by would do it.
Any other methods ?
2008-01-07 22:01
Slammer

Registered: Feb 2004
Posts: 416
Hi Conrad

Kick Assembler doesnt support char objects (yet), so when you use the charAt(i) function it really just returns a string with the char at position i. Since its a small pretty straight forward job to implement it, it will probably be included in one of the future versions.

Right now im working on Kick Assembler 3.0 which makes major changes the underlying architecture of the assembler (Dont worry, the syntax for the sourceode will be unchanged). This means that their migth go some time before the next Kick Ass version.

However, you can make a charValue routine with a hashtable like this:
.var allChars = "abcdefghijklmnopqrstuvwxyz"
.var charToValueTable = Hashtable()
.var valueToCharTable = Hashtable()
.for (var i=0; i<allChars.size(); i++) {
  .eval charToValueTable.put(allChars.charAt(i), i)
  .eval valueToCharTable.put(i, allChars.charAt(i))
}

So in your code you write:
.by charToValueTable.get(InfoList.get(j).charAt(i))+1
2008-01-07 23:17
Conrad

Registered: Nov 2006
Posts: 838
Hey Mads.

I've managed to get the code working using hashtable as you shown, so thank you so much for your help! :) much appreciated.

Looking forward to your next version, once complete of course.
2008-01-08 06:05
JackAsser

Registered: Jun 2002
Posts: 1995
@conrad: I've never actually used Kick Assembler, but I suggest you put your encryption scheme directly into the Hashtable also, thus making the Hashtable-hack a little bit less ugly and a bit more justified. ;D

Anyways Slammer, this seems to be a great assembler. As I've stated earlier, I'd like Kick Assembler joined with the linking from CC65... ;D
2008-01-08 13:11
Conrad

Registered: Nov 2006
Posts: 838
@Ja: Point taken, thanks! - even though the encryption I'm including is nothing more than just a simple addition/subtraction of so many bytes ;)
2008-02-13 20:13
Ricky

Registered: Jan 2008
Posts: 3
Just converted some source from my old patched a6-assembler to kickass today...

Thanks Mads! Your assembler will be my prime choice from now on!

/Ricky
2008-02-15 17:18
Slammer

Registered: Feb 2004
Posts: 416
Thanks, good to hear.
2008-02-22 16:47
Iapetus/Algarbi/Wood

Registered: Dec 2004
Posts: 71
Thx for the export symbol functionality :)
2008-03-31 11:57
Burglar

Registered: Dec 2004
Posts: 1051
I found a small bug in v2.25, when you import a c64 file say ranging from $1000-$1fff, I can't set the .pc to $2000 without causing an overlap warning. seems its off by 1...
2008-03-31 14:56
JackAsser

Registered: Jun 2002
Posts: 1995
Quote: I found a small bug in v2.25, when you import a c64 file say ranging from $1000-$1fff, I can't set the .pc to $2000 without causing an overlap warning. seems its off by 1...

Sorry for the really really stupid question but isn't a "c64 file" a .prg-file? A .prg-file ranging from $1000-$1fff would take exactly $2002 bytes on disk due to the start address, and thus overlap by 2 bytes.

But then again I'm probably completely wrong since I've never used Kick-Ass. ;D
2008-03-31 15:22
Slammer

Registered: Feb 2004
Posts: 416
KickAssembler supports imports from source, binary, c64 and text files. So if you write:
    .import c64 “myfile.prg” 
It will skip the first two bytes. I will check it out if there is an error.
2008-03-31 16:25
Burglar

Registered: Dec 2004
Posts: 1051
Quote: KickAssembler supports imports from source, binary, c64 and text files. So if you write:
    .import c64 “myfile.prg” 
It will skip the first two bytes. I will check it out if there is an error.


yes but

.pc = $1000 "Bla"
.import c64 "bla.prg"

.pc = $2000 "Bla 2"

jmp *

will throw a warning if bla.prg is a prg from $1000-$1fff (including $1fff)
2008-03-31 16:40
wattie

Registered: Dec 2003
Posts: 57
I'm having the same problem here as Burglar

.pc = $0800 "Program"
<code till $080c>

.pc = $080d "Program"
.import c64 "file.bin"

leads me to the same error.
2008-03-31 17:52
Cruzer

Registered: Dec 2001
Posts: 1048
Quote:
leads me to the same error.
If you get this as an error you can always give it the "-aom" argument to reduce it to a warning.
2008-03-31 19:09
Slammer

Registered: Feb 2004
Posts: 416
Hi, I can't reproduce the error. The following works ok:
.pc = $1000 "one byte"
.byte 1
.pc = $1001 "one more"
.byte 1

.pc = $2000 "charset"
.import c64 "endcharset.c64" 
.pc = $2800 "byte after charset"
.byte 1

with this result:
Memory Map
----------
$1000-$1000 one byte
$1001-$1001 one more
$2000-$27ff charset
$2800-$2800 byte after charset

Notice that the last byte in the range in the memory block belongs to the block so the one byte from $1000 gives a block from $1000-$1000 which means that you have to start the next block which endrange+1.

Also check the range of your input file

If none of the above explains the warning then send your code and file to me and I will check it out.

2008-04-01 12:31
Burglar

Registered: Dec 2004
Posts: 1051
hmmm, odd, maybe indeed my input prgs are 1 byte too long, and I thought I checked it properly... ;)

will check it out later today and thanks for the quick response!
2008-07-27 17:37
Barbarossa

Registered: May 2007
Posts: 31
I get a strange error in the script language. It looks like it is impossible to uses parenthesis within the arguments of the .if command.

For example:
.if ((i+1)*8<j) results in a syntax error, but
.if (i+1*8<j) compiles okay but obviously results in a wrong argument.

Anybody encountered this before? Is there a workaround? The only thing I can come up with is to put the left argument in a variable and use that in the .if statement. Not very pretty but works if there is no other solution available.
2008-07-27 21:48
Shadow
Account closed

Registered: Apr 2002
Posts: 355
Use square parenthesis [ ]inside the if:

.if([i+1]*8<j)

At least that's how I recall it.
2008-07-27 21:50
JackAsser

Registered: Jun 2002
Posts: 1995
Quote: I get a strange error in the script language. It looks like it is impossible to uses parenthesis within the arguments of the .if command.

For example:
.if ((i+1)*8<j) results in a syntax error, but
.if (i+1*8<j) compiles okay but obviously results in a wrong argument.

Anybody encountered this before? Is there a workaround? The only thing I can come up with is to put the left argument in a variable and use that in the .if statement. Not very pretty but works if there is no other solution available.


For a more pretty workaround you could:

(i+1)*8 => i*8 + 1*8 => i*8 + 8

:D
2008-07-28 09:09
Barbarossa

Registered: May 2007
Posts: 31
Of course brackets, that's a good solution. Thanks!
I never thought of that. I use them already in arguments for opcodes (e.g. lda #[3*23]) but I never thought of that for the scriptlanguage. A bit strange though that it doesn't allow for that. Maybe future update!
2009-05-30 22:12
Slammer

Registered: Feb 2004
Posts: 416
Hi Guys

I have started a new series of improvements on Kick Assembler. First of all some major core changes have been made which have resulted in version 3.0. The assembling is now done using a flexible pass algorithm and some techniques have been added to make the assembling more flexible and efficient.

The current version is now version is now 3.1, featuring chars and namespaces. More features will follow. Currently no known errors exist and all old sources are assembling, however a major release will first be uploaded to CSDB when I have seen Kick Assembler 3.x work stable for some time. If you want to use the latest beta you can find it on the website (http://www.theweb.dk/KickAssembler/Main.php)
2009-05-31 06:21
Mix256
Account closed

Registered: Dec 2008
Posts: 26
Cool! Seems a bit faster.
But the virtual-stars on the mem-map has disappeared.
2009-05-31 07:28
LOGAN
Account closed

Registered: Aug 2003
Posts: 71
Hey Slammer, thanks for working on KickAss, it kicks ass. Things like supporting some formats like images and PC formatted SID files is great, innovative and useful as is the import c64 binaries addition. Also macros are useful to create your own libraries. Memory maps generation are also nice.

I switched for compiling MOTAS to KickAss and while it has it's own quirks (ie // as remarks, only lower case opcodes/addressing, specific syntax it's an assembler with advanced options. I hope more and more people will switch to KickAss.

Keep up the good work!
2009-05-31 18:24
Slammer

Registered: Feb 2004
Posts: 416
Mix256: Good observation. I Just upped version 3.2 which takes care of the problem.

Logan: Thanks.
2009-05-31 18:41
Mix256
Account closed

Registered: Dec 2008
Posts: 26
Great, but their length are now -1... :)

-----
v2.25
-----
$62ac-$6bb5 Object Routines - Common
*$6e00-$7966 Object Routines - World 1
*$6e00-$779e Object Routines - World 2

-----
v3.20
-----
$62ac-$6bb5 Object Routines - Common
*$6e00-$6dff Object Routines - World 1
*$6e00-$6dff Object Routines - World 2

2009-05-31 19:07
Slammer

Registered: Feb 2004
Posts: 416
I upped a new one.. Try again :-)
2009-05-31 19:38
Mix256
Account closed

Registered: Dec 2008
Posts: 26
Works like a charm, thanks!

KNG wouldn't (become to) exist if it wasn't for this excellent asm. Great work!
2009-07-21 12:28
assiduous
Account closed

Registered: Jun 2007
Posts: 343
Quote: Cavey: I got the files, and they assembled ok. Jammer told me the problem comes when you place the files in a cetain way, but I havn't been able to reconstruct it.

i get "parsing,null" using plain kickass.jar prog.asm -log textfile.txt if an exclamation mark is used somewhere in the dir path.
2009-07-21 15:04
Slammer

Registered: Feb 2004
Posts: 416
Could you be a little more specific of how you get this error?

I just tried -log test!test/a!b.txt and it works ok.

Then i tried and an exclamation mark in the Kick!Assembler dir, which works fine too:
C:\Download\Kick!Assembler\Examples\MusicIrq>java -jar ..\..\KickAss.jar MusicIr
q.asm
//------------------------------------------------------
//------------------------------------------------------
//   Kick Assembler v3.4 - (C)2006-2009 Mads Nielsen
//------------------------------------------------------
//------------------------------------------------------
parsing
flex pass 1
flex pass 2
Output pass
Writing file: MusicIrq.prg

2009-07-21 15:40
assiduous
Account closed

Registered: Jun 2007
Posts: 343
test.asm:

.pc= $1000

rts


along with the latest version of KickAss.jar located in D:\kickasstest!\

command prompt:

D:\kickasstest!\KickAss.jar test.asm -log textfile.txt

the content of textfile.txt:

parsing
null


then "!" is removed from the dir name and the following prompt is run:

D:\kickasstest\KickAss.jar test.asm -log textfile.txt

the content of textfile.txt:

parsing
flex pass 1
Output pass
Writing file: test.prg
2009-07-21 17:11
Slammer

Registered: Feb 2004
Posts: 416
Ok, now I reconstructed it. You found a bug in Java!! It handles resources wrong in jar-files when the the dir-path ends with an !. So C:\KickAssTest! is bad and but C:\KickAssTest!x is ok. Just place the jarfile in a dir that doesnt end with !.

The funny thing is that if you unpack the jar file to KickAss!, set the CLASSPATH and run KickAssembler without the jarfile, then it works ok. So if you want dirs ending with '!' you can have it, but its a bit easier just to rename you dir.

.. unzip to KickAss!, then 
C:\KickAssTest!>set CLASSPATH=c:\KickAssTest!\KickAss!

C:\KickAssTest!>java cml.kickass.KickAssembler test.asm

parsing
flex pass 1
Output pass
Writing file: test.prg

C:\KickAssTest!> 

2009-07-21 17:21
Slammer

Registered: Feb 2004
Posts: 416
Thread is closed, use "Kick Assembler Thread 2" instead.
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
ccr/TNSP
Smasher/F4CG
Krill/Plush
Sabbi/Hokuto Force
Knut Clausen/SHAPE/F..
Guests online: 119
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 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Comaland 100%  (9.6)
9 Wonderland XIV  (9.6)
10 Aliens in Wonderland  (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 Fullscreen Graphicians
1 Joe  (9.7)
2 Veto  (9.6)
3 Facet  (9.6)
4 The Sarge  (9.6)
5 Carrion  (9.5)

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