English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 14 March 2024, 18:42   #1
Argh
Registered User
 
Join Date: Jun 2017
Location: Kiel/Germany
Posts: 13
Easy games for learning to disassemble?

Hi, I’m currently getting into disassembling Amiga games using Ghidra and the FS-UAE debugger. I started at pretty much zero, and I’ve learned quite a lot, but I’m struggling to identify easy games to get anywhere with.

For example, I’ve been mostly digging around in PD games running in Workbench with modest success (but lots of fun) but I wonder if going through games building on lots of libraries like this is actually making it harder to understand what’s going on. I’ve also dug a little around in Portal (just a bunch of text data shifted around, can’t be that hard, right?) but I got absolutely nowhere with it. Well, at least I learned early that I better avoid AMOS games…

Can someone point me to a list with games that you’d consider easy targets for disassembling?
Argh is offline  
Old 14 March 2024, 20:11   #2
copse
Registered User
 
Join Date: Jul 2009
Location: Lala Land
Posts: 522
What is easy? Is it something small that you can disassemble completely? Is it something that you can just jump in and work out an isolated part of and then alter that? Is it something you are actually interested in? I don't have an answer for you. I think one approach might be to pick something that interests you and which you have an incentive to complete.

One approach might be to forget disassembling or decompiling a whole game. Instead think about changing some aspect of behaviour, perhaps patching a routine. An example might be something I have at the back of my mind, I'd like to replay Captive but the mouse controls are tedious. If I just located the keyboard routines and isolated which was used for which, I could patch out those and add extra keyboard handling. Then I could patch in new keyboard handling that made replaying Captive completely keyboard driven. I wouldn't need to care about the gameplay, the graphics and so on.
copse is offline  
Old 14 March 2024, 20:34   #3
copse
Registered User
 
Join Date: Jul 2009
Location: Lala Land
Posts: 522
Biplanes is a small game.
https://www.lemonamiga.com/games/details.php?id=1248

There's also intros and cracktros that can help get familiar with hardware usage to aid in later more complicated game decompilation.
copse is offline  
Old 14 March 2024, 21:03   #4
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
would be useful if someone disassembled/RE'ed arcade games like Jungle Hunt or Bosconian.

not amiga, but smaller thus easier. Even 16k code can be a drag, be careful!

If you want 68k there's also Marble Madness 2 that I have started

https://github.com/jotd666/GameReloc...MarbleMadness2
jotd is offline  
Old 15 March 2024, 12:12   #5
Argh
Registered User
 
Join Date: Jun 2017
Location: Kiel/Germany
Posts: 13
Quote:
Originally Posted by copse View Post
What is easy?
Valid question, guess I should have been a bit more specific. Easy for me at this stages means short, no hardware-specific trickery, no complex structures, no copy protection that might interfere, ideally easy to debug (no fast gameplay and not too many things going on at the same time).

My main motivation is learning more about the internals of the game that fascinated me as a child (mostly Shareware, coverdisk games, unfinished game demos, etc.), partly out antiquarian interest, partly to maybe rewrite them in a modern language at some point in the far future.

Thanks for the Biplanes tip, I’ll check that out, and looking into cracktros is another good hint and probably easier to grasp than a complete game as well!

Quote:
Originally Posted by jotd
would be useful if someone disassembled/RE'ed arcade games like Jungle Hunt or Bosconian.
Thanks for bringing that up but tbh I have no touching point with arcade stuff (it was ruled out for children here in Germany, haha), I think I’ll leave that to real arcade devotees
Argh is offline  
Old 15 March 2024, 13:03   #6
VladR
Registered User
 
Join Date: Dec 2019
Location: North Dakota
Posts: 741
I honestly don't think it gets any easier than what jotd is making publicly available on GitHub as you get an actual source code you can compile, tweak and test on your own.

I'd start with something like DonkeyKong:
https://github.com/jotd666/donkey_kong

But, any other projects he's been working on and put on GitHub would work.

This way, you can at any point, instead of just using a disassembler, check the source code, which is a huge bonus in my book...
VladR is offline  
Old 15 March 2024, 15:46   #7
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,975
Quote:
Originally Posted by jotd View Post
would be useful if someone disassembled/RE'ed arcade games like Jungle Hunt or Bosconian.

not amiga, but smaller thus easier. Even 16k code can be a drag, be careful!

If you want 68k there's also Marble Madness 2 that I have started

https://github.com/jotd666/GameReloc...MarbleMadness2
If I will back to life (in 1 year) and my Amiga will be still working, then perhaps I can disassemble some 68k arcade games. Many years ago I started to resourcing Japan version of Rastan. But it was only for test. I dont know other CPU's to be sure that disassembling is correct.
Don_Adan is offline  
Old 15 March 2024, 15:56   #8
Master484
Registered User
 
Master484's Avatar
 
Join Date: Nov 2015
Location: Vaasa, Finland
Posts: 525
Maybe try out a space invaders clone called Amoeba Invaders. If I remeber right it only uses the CPU for everything, nothing complex, and probably was coded in ASM.

Also there is an old asteroids clone called Cosmoroids. I would imagine that both of these games are small in code size, and (hopefully) easy to analyze thanks to the very simple game mechanics.

Both of these games were on a CU Amiga magazine disk called "21 Games", which also had many other simple and small games.
Master484 is offline  
Old 15 March 2024, 18:10   #9
paraj
Registered User
 
paraj's Avatar
 
Join Date: Feb 2017
Location: Denmark
Posts: 1,104
Quote:
Originally Posted by copse View Post
What is easy? Is it something small that you can disassemble completely? Is it something that you can just jump in and work out an isolated part of and then alter that? Is it something you are actually interested in? I don't have an answer for you. I think one approach might be to pick something that interests you and which you have an incentive to complete.

One approach might be to forget disassembling or decompiling a whole game. Instead think about changing some aspect of behaviour, perhaps patching a routine. An example might be something I have at the back of my mind, I'd like to replay Captive but the mouse controls are tedious. If I just located the keyboard routines and isolated which was used for which, I could patch out those and add extra keyboard handling. Then I could patch in new keyboard handling that made replaying Captive completely keyboard driven. I wouldn't need to care about the gameplay, the graphics and so on.
I second this idea. Fully disassembling/reversing anything but the smallest programs is incredibly tedious. IMHO you'll learn more by looking at different games a bit more shallow than understanding one game completely (unless of course, that game is your white whale).

After a couple of games you'll start to notice important patterns of what you can skip, and what is probably important. You could for example set some challenges for yourself like:
- Find where handlers (interrupt/keyboard etc.) are installed and roughly what they do
- How is input handled
- See if you could make some kind of "trainer" (e.g. figure out where "lives remaining" is stored in memory)

Using ghidra on something where the source code (or close enough reference) is available is also a good exercise if you want to get more adapt at using it (e.g. defining structures) and so on.
paraj is offline  
Old 15 March 2024, 18:46   #10
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
Quote:
Originally Posted by Don_Adan View Post
If I will back to life (in 1 year) and my Amiga will be still working, then perhaps I can disassemble some 68k arcade games. Many years ago I started to resourcing Japan version of Rastan. But it was only for test. I dont know other CPU's to be sure that disassembling is correct.

1) you don't need amiga to disassemble.
2) Z80 is not that hard to get used to. I still cannot code in Z80 but I can understand what the code does.
3) if you have complete or 90% disassembly of something, please share!
jotd is offline  
Old 15 March 2024, 20:08   #11
copse
Registered User
 
Join Date: Jul 2009
Location: Lala Land
Posts: 522
I have a largely decompiled Pool of Radiance I am putting aside. If people want the ghidra files let me know. I reached the point where I thought, you know I could just write my own engine and I would never have to deal with the stage where I have to get the decompiled C compiling :-) Then there's the conflicts with how the original code works and ghidra, like how the arrays are 1-based which means all the references start from the 0 point which is in the previous data. It's not a big deal but that stuff wears you down lol.
copse is offline  
Old 15 March 2024, 20:30   #12
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,975
Quote:
Originally Posted by jotd View Post
1) you don't need amiga to disassemble.
2) Z80 is not that hard to get used to. I still cannot code in Z80 but I can understand what the code does.
3) if you have complete or 90% disassembly of something, please share!
I prefer to disassembling on Amiga, even if this is slower.
From my memory, I only started to wrote program to disassembling/transcoding SPC700 code for SNES to 68000. But it was many years ago.
Learning others 8bit CPU code has for me sense, only for arcade games which I played/liked. F.e Circus Charlie, Spelunker, Pitfall, Athena.
But I think that these arcade games can be not easy for porting to Amiga, due graphics.
For now my Amigas are inactive, then no files available.
Even if some projects was finished or almost finished.
Don_Adan is offline  
Old 15 March 2024, 20:36   #13
Pyromania
Moderator
 
Pyromania's Avatar
 
Join Date: Jan 2002
Location: Chicago, IL
Posts: 3,375
@Argh

Great question!
Pyromania is offline  
Old 18 March 2024, 12:34   #14
Lyverbe
Registered User
 
Join Date: Sep 2007
Location: Montreal, Canada
Age: 55
Posts: 68
Quote:
Originally Posted by copse View Post
I'd like to replay Captive but the mouse controls are tedious. If I just located the keyboard routines and isolated which was used for which, I could patch out those and add extra keyboard handling.
This is a bit off topic but just passing by to say that, unfortunately, there's no centralized location of keyboard management in Captive. It's just a bunch of 'if' scattered all around. To give you an idea, first key is checked at 417a and last at 8bf2.
Lyverbe is offline  
Old 18 March 2024, 12:44   #15
Argh
Registered User
 
Join Date: Jun 2017
Location: Kiel/Germany
Posts: 13
Quote:
Originally Posted by Master484 View Post
Both of these games were on a CU Amiga magazine disk called "21 Games", which also had many other simple and small games.
I think this (and the specific small games you mentioned) is exactly what I was looking for, thanks!
Quote:
Originally Posted by paraj View Post
IMHO you'll learn more by looking at different games a bit more shallow than understanding one game completely (unless of course, that game is your white whale).

After a couple of games you'll start to notice important patterns of what you can skip, and what is probably important. You could for example set some challenges for yourself like:
- Find where handlers (interrupt/keyboard etc.) are installed and roughly what they do
- How is input handled
- See if you could make some kind of "trainer" (e.g. figure out where "lives remaining" is stored in memory)

Using ghidra on something where the source code (or close enough reference) is available is also a good exercise if you want to get more adapt at using it (e.g. defining structures) and so on.
These are some great points. In a way I ended up that route because I haven’t been getting far with what I’ve been looking into so far and just started looking into the next game. But it helps me not feeling bad about it :P And my experiences really varied greatly between games, plus there’s still a lot to learn when it comes to using Ghidra and the UAE debugger (documentation seems to be very sparse).
Argh is offline  
Old 18 March 2024, 15:37   #16
modrobert
old bearded fool
 
modrobert's Avatar
 
Join Date: Jan 2010
Location: Bangkok
Age: 56
Posts: 779
Quote:
Originally Posted by Argh View Post
Can someone point me to a list with games that you’d consider easy targets for disassembling?
Try to find games which were originally written in assembly language rather than compiled from C or other language, it will be easier to follow (except for deliberately obfuscated sections of the code like copy protection).
modrobert is offline  
Old 18 March 2024, 15:58   #17
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
I think you should not think about disassembling something easy just to do it.

Focus on a goal (add feature, fix bug, add cheat...) on a particular game and go for it.

whdload is a good environment to apply your fixes too.
jotd is offline  
Old 18 March 2024, 19:39   #18
paraj
Registered User
 
paraj's Avatar
 
Join Date: Feb 2017
Location: Denmark
Posts: 1,104
NB Ghidra can be a real pain in the neck for games written completely in assembly with custom calling convention. Not necessarily for understanding a specific function, but if you're reversing at a slightly higher level it can be tedious (having to use "custom storage" etc.).

Another note is that if you're working at assembly level in tandem with the WinUAE (or similar) debugger, something that takes over system and loads things at fixed addresses is much easier to deal with than system friendly stuff where load addresses may differ depending on configuration (e.g. number of enabled drives will move buffers).
paraj is offline  
Old 19 March 2024, 09:26   #19
dlfrsilver
CaptainM68K-SPS France
 
dlfrsilver's Avatar
 
Join Date: Dec 2004
Location: Melun nearby Paris/France
Age: 46
Posts: 10,420
Send a message via MSN to dlfrsilver
Quote:
Originally Posted by paraj View Post
I second this idea. Fully disassembling/reversing anything but the smallest programs is incredibly tedious. IMHO you'll learn more by looking at different games a bit more shallow than understanding one game completely (unless of course, that game is your white whale).

After a couple of games you'll start to notice important patterns of what you can skip, and what is probably important. You could for example set some challenges for yourself like:
- Find where handlers (interrupt/keyboard etc.) are installed and roughly what they do
- How is input handled
- See if you could make some kind of "trainer" (e.g. figure out where "lives remaining" is stored in memory)

Using ghidra on something where the source code (or close enough reference) is available is also a good exercise if you want to get more adapt at using it (e.g. defining structures) and so on.
I did try ressourcing arcade coin-ops game programs. It's incredibly huge to do, because those games not only have a big game logic, but they also have lots of metadata for tilemaps, animations and sprites. Those are quite often coded in byte, and word. But in such quantities that from a 512kb of code, you will get a source that is 20mb in length
dlfrsilver is offline  
Old 19 March 2024, 09:41   #20
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
disassembling MAME games is better from MAME debugger than from ROM dumps: you only disassemble ROM code and data, but not tiles and all. I've disassembled Marble Madness 2 and it was not 20MB for a 512K game
jotd is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Play Amiga Games on Windows PC 2022 Easy Tutorial kad3t Retrogaming General Discussion 5 27 April 2022 18:11
Learning how to hack Amiga games. Shatterhand support.Other 15 11 November 2019 16:19
Easy, Short Attention Span Games steve_mynott support.Games 11 06 July 2018 14:43
HOBRing - Easy loadable Amiga games! Neil79 Amiga scene 0 29 October 2012 02:59
Playpower - 8 bit learning games for the developing world girv Retrogaming General Discussion 5 24 March 2009 22:00

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:39.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10988 seconds with 15 queries