Page 1 of 1

Hacking ST Games

PostPosted: 06 Mar 2007, 04:10
by xot
Hey Kroah,

I was wondering what tools you are using to hack games for Atari ST. Are there any particular emulators, debuggers, or ripping tools you can recommend? Can you recommend any good reference materials concerning TOS or ST hardware?

PostPosted: 08 Mar 2007, 22:06
by Kroah
I know your skill Xot, but before recommending tools, i must say to other people: learn how the computer work!

For the Atari 8bit serie:
- MOS Technology 6502 assembly,
- Hardware periphals accesses by the OS (rom).

For the Atari ST serie:
- Motorola 68000 assembly,
- The GEM programming (structures, function calls...).

Without this knowledge, it's like trying to understand a mathematical formula without knowing the meaning of the variables... good luck...

You don't need to know exactly how it works (sounds, player missiles, rasters), but you need to know what the code is about: "wow, here it's a sound call, ok, let's comment it, but i don't need to know what blip it does".

I have to say, i only use ressources from the net. If you need some informations about the OS or assembly language, i'll add the references.

Now about the method. I've tried several ways to decompile/understand the code. But i've found only one way which was really faster and easier: working with the smallest memory dump we can have. Thus, you avoid (according the program only loads at the beginning):
- the decrunching/decrypting routines
- the floppy disk accesses routines

This solution is entirely linked with the tool i use: an old version of IDA Pro i've bought. This tool is really... wonderful. No need to decompile everything. You search the entry point (with the debugger) and you hit the touch "c" to decompile. The software instantaneously looks for the function calls and procedures. Nice! It does 75% of the work and you help him for the remaining code (indirect function calls, self-modifying codes...).

But the hard work comes when you must understand the decompiled code! Here the Steem Engine Debugger (or Atari 800 Win) comes in handy to follow the executed code with your decompiled code in IDA. And the good news with this method: you have the same addresses for your decompiled code and your current executing code in the debugger (use heavily the "save state" of the emulator, especially if the program doesn't load at the same memory address when you boot...). Next you look at your unknown code in IDA and you put break points on execution line or read/write access in the debugger. So easy ;)

If your aim is to reverse engineer the code, you can start again the decompilation from the binary. It will be really easy because you already know the variables/functions meaning. You only have to understand the loading routines of the program and the data (raw copy from sectors, copy from files...).

Maybe the most painful part of the decompilation is the Gem part where big structures are used to call functions. Hopefully, IDA can use structure too.

That's the basics, now it's your turn! Start from an easy game and look how easy it is ;)

Edit: Typos

PostPosted: 09 Mar 2007, 11:45
by xot
Ah ha! I never knew there was a debug version of Steem. That will certainly make things easier. :) I could never understand why Steem didn't have a debugger. I guess I was looking in the wrong place.

I have a lot of basic reference materials for XBIOS, BIOS, GEMDOS, TOS and 68000 already. I did quite a bit of GFA Basic programming on my ST back in the old days and got pretty familiar with the various aspects of the machine. Although I've never programmed 68000, I have read a lot about it and at one point translated some 68000 code into 6502. Believe it or not I used the code to build a 32-bit fractal plotter for the 8-bit 6502. Hand assembled, of course. :lol:

I found a freeware version of IDA (which I know nothing about), I'm eager to see what that has in store.

Thanks for the info and the vital clue about Steem Debug.

PostPosted: 09 Mar 2007, 12:28
by Kroah
xot wrote:Thanks for the info and the vital clue about Steem Debug.

Yep, only the Debug version of Steem contains the debugger. It can be found on the programmers page here:

Right now, it's the most powerful debugger i've ever seen.