Showing posts with label amiga. Show all posts
Showing posts with label amiga. Show all posts

Sunday, 11 November 2012

Peasauce, interactive disassembler.. someday

From Resource to Peasauce

I have a list of hobby projects that I've always wanted to find the time and energy to work on, and one of these is an interactive disassembler.  Years ago when people used a type of computer called "the Amiga", it had an extremely usable interactive disassembler called Resource.  You would point it at a file and it would turn the file into assembly language code and data, after which you would interactively disassemble some more, and finally make it write out a file containing the assembly language source code.

Disassembled and commented code in Resource.
Recently I finally managed to start using some spare time to work on "Peasauce", and have made a pretty good start.  What it can currently do isn't really useful yet, given that editing a disassembled file or exporting it isn't implemented yet. But being able to select a file, see the disassembled results and then scroll around it qualifies as interactive disassembling in the loosest sense.  So it's a good start.

Disassembled code in Peasauce.
In order to help make the code more general, in addition to Amiga executable files, it also loads those from the Atari ST and X68000 platforms. I've never used either, but they're both based on the Motorola 680x0 CPU family so it's a minimal amount of extra work over and above parsing a few semi or undocumented file structures.

UI

I initially started usng the Tkinter, because it comes with the standard library.  Unfortunately, out of the box it just wasn't flexible enough to work in the way I wanted.  As an alternative, I first looked at PySide but wasn't able to locate documentation to make it easy to work out if it suited my needs.  The website looks like it is in a transitional phase and several links to useful sounding documentation were dead unfortunately.  This left wxPython, which I've used before.  As a fringe benefit of having a small play around with PySide, I first encountered crashes and then with Anselm Kruis' recent patch to Stackless Python was able verify this decade long ABI incompatibility was fixed and that the crashes went away.

With wxPython, I'm currently using the ListCtrl where it simply knows how many list items there are and requests list items as needed for display.  Strangely, as the number of list items increase it gets slower, but that's likely my fault for some reason. As a short term solution while there's minimal interactivity, it's good enough, but the time is almost right for something more dynamic.

The bisect module

I was iterating over ordered lists looking for the right entry, and this was profiling as the place most time was spent.  A quick browse of the Python documentation introduced me to a module I'd never heard of before, the bisect module.  By keeping two lists instead of one, bisect let me look up objects in the second list by passing it the first list.  That makes it sound rather complicated, a simplified piece of example code is a lot more helpful.
 lookup_index = bisect.bisect_left(lookup_keys, lookup_key)
 if lookup_keys[lookup_idx] != lookup_key:
  lookup_value = lookup_values[lookup_idx-1]
 else:
  lookup_value = lookup_values[lookup_idx]
While I haven't actually looked, writing this up has made me suspect that if I also bung judicial use of this in the list control virtual item fetching, it might even solve the slowness problem with larger files.  Actually going away and looking at the code confirms it.  I'll need another indexing list though, and to keep that synchronised with the other two.

Opensauce

My laptop is a little unreliable and addressing that isn't on the table, so a good way to ensure I don't lose the source code should anything happen, is to throw it up on github with everyone else's half completed projects where it can also sit mouldering and abandoned.  Or slowly be developed further, of course.

Link: Peasauce on github.

Friday, 9 September 2011

Amiga game playthrough videos

There weren't many Amiga games available in my New Zealand home town. The few that made it there, were too expensive or unappealing. There were many games in the computer magazines (which were readily available) which I wanted to play but was unable to. These days people play through (AKA longplay) the old computer games, record it in their entirety and then upload it to YouTube. This gives me a chance to see what the games had to offer, without having to invest the time myself.

Link: Recorded Amiga Games.
Link: Longplays YouTube channel.

Cadaver:


Castle Master:


Kult:


There's actually a lot of playthroughs for games for other platforms, even recent games. Gives me a chance to experience the best parts of a game without wasting time and money to find out if it was worth it. Not that I would have played them anyway.

Sunday, 4 September 2011

Amiga cracktro remakes

In the local city newspaper, there used to be pirated games advertised for sale. Send a disk with a self-addressed, stamped envelope and you'd receive a catalogue back on disk. Or so I heard, there was a guy in town who I knew who had started up his own business like this and gotten a call warning him from the piracy police. One of the things on these pirated games disks were these cracktro things.

There's a community now, Retro Remakes, where people recreate these with versions that run on Windows. The forum hosts competitions with demo effect related challenges, and people discuss how to recreate the various effects.

Scoopex:


Classic:

Paranoimia:

Monday, 14 December 2009

Reverse engineering Amiga software

When I was young I had to walk to school, and it was ten miles both ways, in bare feet, always raining, with snow coming at me sideways on gravel roads. Oh, and everything was a lot more interesting then, because nostalgia hadn't been invented yet.

Living in New Zealand, television shows and movies made their way over here quite a while after they had debuted wherever they originated from. And so did computer games of course. Unfortunately, the only way to get access to software in a manner that didn't require a lifestyle consisting of yacht ownership, smoking jacket wearing or coke sniffing through one hundred dollar bills, was buying pirated disks through the mail.

Reverse engineering

One of the most interesting parts of the pirated software, was the material added by the groups which had originally pirated it. Take for example this video taken from the first disk of Pools of Darkness.


The Amiga console supported an extended range of ANSI commands, some of which allowed moving the cursor an arbitrary number of pixels. By printing a character, then moving the cursor so the next printed character would overwrite some of the last, and repeating this, an image could be rendered in the console. The slow rendering of the image is also a nice effect.

There was one commercial disassembler available for the Amiga, named ReSource. Like IDA Pro, it is an interactive disassembler, an environment where code can be progressively reverse engineered over time.

Here's a screenshot of the SKID_ROW program disassembled in ReSource:

Interestingly, the slow rendering effect is the maximum speed of the console, as the screenshot shows that the complete text to be displayed is written to the console as one lump.

A wiki

In any case, there's a wealth of interesting material preserved from the early days of the Amiga when it was still a contender. If you share my interest in examining it, the most convenient way to do so is by running WinUAE, and perhaps running ReSource within that. But there is also domain knowledge in the tip and tricks to being able to access some of the data, and also what tools can be used in which ways.

I suggested that it would be nice to collect this knowledge on a forum and someone responded by suggesting I start a wiki on one of those sites that are around these days. On a whim, I decided to do so, but in order to make it both easier and more appealing for others to jump in and add their own content, I seeded it with all the information I could find or recall.

It is all very well to start a wiki and throw some information in it. But there must be some level of required information to be present, before others with an interest will consider it a viable place to participate. Or before the effort required on their part to add whatever they may have a whim to, is sufficiently reduced perhaps. I spent a day and a half filling this wiki, before announcing it. It will be interesting to see whether anyone jumps on board.

Link: Reverse engineering for the Commodore Amiga

On a related note

The effect of the text rendering shown above, reminds me of the demo DOS by Andromeda. Embedded Youtube video follows..


Let's face it, AmigaDOS in Kickstart v1.3 just looked plain cool with its blue background and white lines.