Gunstar Heros disassembly?

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Natsumi
Very interested
Posts: 81
Joined: Mon Oct 05, 2015 3:00 pm
Location: 0x0
Contact:

Re: Gunstar Heros disassembly?

Post by Natsumi » Fri Feb 26, 2016 1:43 pm

MintyTheCat wrote:Do you mean GNU AS or GAS right?

If so this is simply not the case and GAS runs fast, you are able to find the bugs in your code from the Assembler alone and what's more you have the symbols, listing and such available. You may be referring to a multi object file that you turn into an ELF file though but that is not an issue in GAS itself.
I am not sure. All I kow is Sonic 2 and Sonic & Knuckles disassemblies (Git versions) use this assembler called AS macro assembler (asw.exe) and its terrible. It may be a different assembler, and if op was talking about that, then I apologize for the mixup. However the error report seems rather familiar to the AS I was talking about which gave me the impression he was using it.

MintyTheCat
Very interested
Posts: 484
Joined: Sat Mar 05, 2011 11:11 pm
Location: Berlin, Germany

Re: Gunstar Heros disassembly?

Post by MintyTheCat » Fri Feb 26, 2016 1:55 pm

Natsumi wrote:
MintyTheCat wrote:Do you mean GNU AS or GAS right?

If so this is simply not the case and GAS runs fast, you are able to find the bugs in your code from the Assembler alone and what's more you have the symbols, listing and such available. You may be referring to a multi object file that you turn into an ELF file though but that is not an issue in GAS itself.
I am not sure. All I kow is Sonic 2 and Sonic & Knuckles disassemblies (Git versions) use this assembler called AS macro assembler (asw.exe) and its terrible. It may be a different assembler, and if op was talking about that, then I apologize for the mixup. However the error report seems rather familiar to the AS I was talking about which gave me the impression he was using it.
Is that a fixed version of AS then this asw.exe?

AS gives pretty bad error reporting and is practically useless as I recall - which is why I jumped ship, partially why I jumped ship to another Assembler. VASM is pretty good and is compatible with GAS and supports a lot of conventions.

One of the main reasons I use GNU GAS is that it will be around when we are all grey and old but I cannot say the same for the other Assemblers.
UMDK Fanboy

OrangyTang
Interested
Posts: 29
Joined: Tue Feb 23, 2016 4:45 pm

Re: Gunstar Heros disassembly?

Post by OrangyTang » Fri Feb 26, 2016 2:01 pm

MintyTheCat wrote:
OrangyTang wrote:
MintyTheCat wrote: Actually, IDA could if you tell it or it thinks the bytes are opcodes get it wrong and thereby generate illegal code :D
I guess this is my fundamental confusion - it seems like it should be straight forward for IDA to sanity check it's generated code, and if it's not valid, fall back to something safer (even if that requires more human effort). I was expecting IDA to go for the safe-but-assembleable route rather than potentially introduce errors.

I think I'm going to convert everything to data in IDA just to get something that compiles, even if that means throwing out it's analysis.

Also, yes I'm using the AS assembler from the S3k disassem, largely because it was what I had lying around handy. Sounds like I need to investigate some other options.

MintyTheCat
Very interested
Posts: 484
Joined: Sat Mar 05, 2011 11:11 pm
Location: Berlin, Germany

Re: Gunstar Heros disassembly?

Post by MintyTheCat » Fri Feb 26, 2016 2:52 pm

What is S3k disassem?

IDA is a tool but it has to be pushed along and you the developer have the upper hand; IDA can only guess.
UMDK Fanboy

OrangyTang
Interested
Posts: 29
Joined: Tue Feb 23, 2016 4:45 pm

Re: Gunstar Heros disassembly?

Post by OrangyTang » Fri Feb 26, 2016 3:19 pm

Sorry, typing too fast. :) There's a version of AS in the Sonic 3 & Knuckles disassembly from sonicretro.org, which is the one Natsumi is referring to. After having to poke around in the internals ages ago to get it compiling on OSX, it is pretty crapping internally. :S

Natsumi
Very interested
Posts: 81
Joined: Mon Oct 05, 2015 3:00 pm
Location: 0x0
Contact:

Re: Gunstar Heros disassembly?

Post by Natsumi » Fri Feb 26, 2016 7:14 pm

in case you use OSX, ASM68K may not be suitable option either; It is mainly for MSDOS and early Windows OSes, although it still works (with a bit of tweaking, done by Nemesis long ago) in modern Winodws OSes. VASM could be an option, as its source code is available, and people keep telling me its nearly as good as ASM68K is. I can't personally confirm this (Haven't got around to get messy with it yet), but considering this comes from people I trust to know what they are doing it could be a fairly safe option.

MintyTheCat
Very interested
Posts: 484
Joined: Sat Mar 05, 2011 11:11 pm
Location: Berlin, Germany

Re: Gunstar Heros disassembly?

Post by MintyTheCat » Fri Feb 26, 2016 8:33 pm

Natsumi wrote:in case you use OSX, ASM68K may not be suitable option either; It is mainly for MSDOS and early Windows OSes, although it still works (with a bit of tweaking, done by Nemesis long ago) in modern Winodws OSes. VASM could be an option, as its source code is available, and people keep telling me its nearly as good as ASM68K is. I can't personally confirm this (Haven't got around to get messy with it yet), but considering this comes from people I trust to know what they are doing it could be a fairly safe option.
Yes, it is VERY old now, ASM68K is.

I got into VASM actually through the Amiga and it compatible with DevPac which I use on the Amiga for Assembly.

To be really honest, it does not matter that much for Assemblers but having the flexibility and features can be what pushes you one way or the other.

VASM had been maintained by a few developers now so it seems to be an Assembler that will be around for long to come. It is very popular in the Amiga world and builds under any Unix type OS or Cygwin.

Best advice is to try them all out. OS X is pretty but feels a but like you are forced into doing things the Apple way to me; I used to simply ssh into a Unix machine from OS X when I used a Mac as my main Desktop.
UMDK Fanboy

OrangyTang
Interested
Posts: 29
Joined: Tue Feb 23, 2016 4:45 pm

Re: Gunstar Heros disassembly?

Post by OrangyTang » Fri Feb 26, 2016 9:55 pm

Yeah, I've switched back to Win7 right now as most of the tools I've been experimenting with have required some flavour of windows.

I have a super crude asm listing now which compiles (by making most of it data in IDA), but I think I have some kind of alignment issue. These ops:

Code: Select all

dc.b "GM MK-01077-0"    ; Serial Number
		dc.b $30 ; 0
		dc.b $AB ;
End up with the string being assembled into the correct bytes, but the $30 ends up being inflated to '00 30', followed by the $AB being inflated to '00 AB' instead of just '30' and 'AB'. I suspect this is probably the point where I need to switch away from asw.exe and pick an assembler with some actual documentation. :)

Natsumi
Very interested
Posts: 81
Joined: Mon Oct 05, 2015 3:00 pm
Location: 0x0
Contact:

Re: Gunstar Heros disassembly?

Post by Natsumi » Sat Feb 27, 2016 7:08 am

This is likely caused by automatic evens. In ASM68K you can either append '/o ae-' to commandline or use 'opt ae-' in the ASM file. AS should have option to disable this as well, but I cant remember what it is. To be fair though, the serial number should also include the next 0 as well.

Since M68000 can not run code or read 16 or 32-bit data at odd address, it makes sense to have automatic evens off, because this will insert null byte between code or word pointers to ensure there is no unaligned data, but in a disassembly where you dont control what code is written, it may sometimes work against you. A good assembler should not have inserted 0 there, but like we have discussed, AS isn't that intelligent, and I think it guesses the two areas are part of a different collection.

KanedaFr
Administrateur
Posts: 1130
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Re: Gunstar Heros disassembly?

Post by KanedaFr » Sun Feb 28, 2016 9:45 am

a little hint using IDA :

For some reason, it see RAM access like ROM access with some instructions.
Mainly lea if I remember.
It seems related to a trick of the 68k when, 0xFFxxxx is similar to 0x00xxxx
Dr Mefisto told me it fixed it on his IDA tools, so you should use it rather than MIDA

MIDA is useful (for my point of view, because I made it for this), to quickly understand how work some part of a game, or check how a sub function was compiled (from C to bin) but it lacks a lot to be able to create a full game source code.
For ex, you alrealy understood you have to reconvert to data some part of the automatically disassembled code because it wrongly though it was code.
And you'll spend a lot of hours converting jump tables, trust me ;)

So give a try to Dr Mefisto tools (based of Hardwareman if I rememer), and use the shortuct a lot !! ;)
https://github.com/lab313ru/smd_ida_tools

OrangyTang
Interested
Posts: 29
Joined: Tue Feb 23, 2016 4:45 pm

Re: Gunstar Heros disassembly?

Post by OrangyTang » Sun Feb 28, 2016 10:49 am

I've given up on whatever the hacked assembler AS.exe is with the sonicretro assemblies, and switched to ASM68 now (oddly, the VASM site appears down over the last couple of days, seems back now though). It's nice to have some actual documentation on the assembler now. :) And after basically marking the whole rom other than the header as data I finally have an export from IDA that reassembles into what looks like a byte-identical rom. Which is a start.

Now I have to figure out some strategies for deciding what's code/data I guess. Exodos' 'Active Disassembly' seems to crash, so I'm probably doing something wrong there. Can't seem to find any documentation on the various options though. smd_ida_tools looks interesting as well, thanks. Also documentation light though :S.

Exodus is lovely though, I hadn't realised MD emulation had come on so far. If all else fails I can always drop back to stepping through in Exodus to figure out what's code, even if that will be hilariously inefficient.

RetroGames
Interested
Posts: 34
Joined: Mon Oct 19, 2015 12:34 pm

Re: Gunstar Heros disassembly?

Post by RetroGames » Sun Feb 28, 2016 11:34 am

OrangyTang wrote:I've given up on whatever the hacked assembler AS.exe is with the sonicretro assemblies, and switched to ASM68 now (oddly, the VASM site appears down over the last couple of days, seems back now though). It's nice to have some actual documentation on the assembler now. :)
I wonder if this is the assembler you are talking about:

The Macro Assembler AS

Looks like it is still being maintained, and there appears to be documentation. Not sure if this is useful to you, but I hope it helps.

Natsumi
Very interested
Posts: 81
Joined: Mon Oct 05, 2015 3:00 pm
Location: 0x0
Contact:

Re: Gunstar Heros disassembly?

Post by Natsumi » Sun Feb 28, 2016 11:48 pm

Yes there is documentation, but its really poorly written and doesnt describe its usage very well. Unlike the PSY-Q manual which has about 200 lines dedicated for almost literally everything about ASM68K and its macro language, and is very well written. Having poor documentation is almost the same as having no documentation.

RetroGames
Interested
Posts: 34
Joined: Mon Oct 19, 2015 12:34 pm

Re: Gunstar Heros disassembly?

Post by RetroGames » Mon Feb 29, 2016 8:34 am

Natsumi wrote:Having poor documentation is almost the same as having no documentation.
Ain't THAT the truth. :(

MintyTheCat
Very interested
Posts: 484
Joined: Sat Mar 05, 2011 11:11 pm
Location: Berlin, Germany

Re: Gunstar Heros disassembly?

Post by MintyTheCat » Mon Feb 29, 2016 2:27 pm

RetroGames wrote:
Natsumi wrote:Having poor documentation is almost the same as having no documentation.
Ain't THAT the truth. :(
...GNU GAS has very good documentation going back all the way to the late 1980s and good support too.
UMDK Fanboy

Post Reply