Language…
11 users online: Gonzales555, HaruMKT, Isikoro, Jadeturtle, Jamie, Klug, Masaya Murakami, MaxtonChao, TheOrangeToad, vampirelich, Xulon - Guests: 92 - Bots: 192
Users: 69,745 (2,535 active)
Latest user: Johnny hotbody

trashkas (trasm->xkas converter)

Small tool I made which converts TRASM style sprites into a format usable by xkas or asar. Haven't tested with every TRASM sprite of course but a good many were successfully converted. Download link.

It fixes all defines, appends a colon to all labels/tables, fixes some crappy TRASM syntax and converts certain keywords like the sprite INIT and MAIN declarations.

I don't expect any replies in this dead forum but I thought I may as well show it off so. :P
This is good to hear. For the longest time, I kept hearing "it should be frivolous to make a converter" while nobody does.

World Community Grid: Thread | Team
 
Originally posted by Ultimaximus
This is good to hear. For the longest time, I kept hearing "it should be frivolous to make a converter" while nobody does.

Like this?
That one doesn't fix MANY things, though. All it does is pretty much add a colon to every label and replace "dcb" with "db". Try it out with a number of TRASM sprites. They won't be fully converted properly.

Originally posted by wiiqwertyuiop
I haven't tried it yet, but I'll be sure to if I ever need to convert anything. Also just a idea, it might be worth to consider making one that converts TRASM and xkas/asar to imamelia's format for his spritetool.

Hmm, this is a pretty good idea. I'll need to know each and every difference between Tessera sprites and xkas sprites though.
Originally posted by wiiqwertyuiop
I haven't tried it yet, but I'll be sure to if I ever need to convert anything. Also just a idea, it might be worth to consider making one that converts TRASM and xkas/asar to imamelia's format for his spritetool.

> imamelia's format of spritetool
Actually, I think it was bad idea to ignore backward compatibility. I don't care about TRASM, but sprites have to be changed for that SpriteTool (this is also reason why I don't like HuFlungDu's AddMusic). Is it hard to catch output of xkas to know where is INIT and MAIN in older patches?

It reminds me this experimental piece of code which I've written some time ago (XKAS -> bass).

Also, after looking at .exe file with notepad (I like doing it :P), I didn't knew that Visual Studio 2010 throws so much useless stuff... like localization of pdb file with all parent directories...?

Also, I guess that you convert using regular expressions (and normal string replace) - in the Notepad I have seen ^[ \t]*(?<word>[A-Za-z0-9_]{4,})\s*=. Some of those are flawed, for example dcb "MAIN" (ok, it's not regexp, but I wanted to mention it anyways) - what if there would be two spaces between those. At least, I think it's nice you have included list what is opcode and what isn't - labels syntax of TRAS[MH] is so ambigous.
Yeah, I took the easy way out on a few things but honestly it shouldn't really matter much. I haven't seen a single sprite with a big whitespace after the dcb in dcb "MAIN" so it's not like it matters. The same goes for a very few other minor things.

I should probably rewrite this in PHP or something and make this an online tool. I barely know PHP but I'm sure people would appreciate it being an online tool. :P
Oh, this sounds quite useful! I'd mainly use it for Tessera, though, especially if you included the compatibility with it as wiiquertyuiop mentioned.
Well, we'll see. Apart from fixing the sprite spawning routine, it doesn't seem too difficult.

Also, courtesy of GlitchMr (as well as p4 for allowing me to use his server), the tool now exists as a PHP script. You can now convert your sprite ASM code online!
There's some bad news. I don't think an xkas -> Tessera converter is viable because of the sprite generation routine which is slightly different in Tessera. That itself isn't a problem, but the fact that users write the sprite generation code in far too many ways makes it close to impossible to convert.

Kind of sucks since an xkas > Tessera converter would have been more useful. But if anyone has any ideas on how I could overcome this problem, that'd be great.
Well, once they're in xkas format, making them work with Tessera shouldn't be too hard...if the sprite-spawning routines are the only things that need to be changed. It's the sprite status-related code that I'm worried about; I still haven't gotten the hang of that.

Also, what about TRASM -> Asar? Granted, Asar syntax is almost identical to xkas syntax, but still...

----------------

I'm working on a hack! Check it out here. Progress: 64/95 levels.
Originally posted by imamelia
Also, what about TRASM -> Asar? Granted, Asar syntax is almost identical to xkas syntax, but still...


There (done in 30 minutes or something) (accidentally TRASM -> bass)

Hopefully it would work, but I think it could break on more complex stuff. Have fun!

@Iceguy: Also those sprites use "dcw"... it might be nice to include it...

Code
            //This is specific to only one sprite again..
            txt = Regex.Replace(txt, @"^(?>(XC))(?!:)", "XC:", RegexOptions.Multiline);


Which sprite? As far I can see, it breaks that sprite linked above (it does nice hacks with xkas)...
Code
XCOORDS		dcb $F1,$F1,$F1,$F2
		dcb $F2,$F3,$F3,$F4
Yeah, small bug. I should have placed word boundaries (\b) around the "XC" part. Also, the sprite was phanto.asm.

Also, I completely forgot about dcw. But yeah it'll be easy to add that in.

Quote
Well, once they're in xkas format, making them work with Tessera shouldn't be too hard...if the sprite-spawning routines are the only things that need to be changed. It's the sprite status-related code that I'm worried about; I still haven't gotten the hang of that.

Also, what about TRASM -> Asar? Granted, Asar syntax is almost identical to xkas syntax, but still...

Changing the INIT/MAIN declarations is the easiest part but that's not a proper conversion. I can't do anything about the sprite-spawning codes.

This converter converts the code to a format usable by both asar/xkas, BTW. The syntax is pretty much the same but asar treats some things as a warning while xkas treats them as an error.

Edit: Should be fixed. PHP version is also fixed.