# Fixing Amiga Rogue

## The Roguelikest Roguelike

Amiga Rogue

Rogue is the original roguelike, created by Michael Toy and Glenn Witchman around 1980.

Toy and Jon Lane formed a company called Artificial Intelligence Design, and developed ports for common computer platforms, among these the Amiga.

Michael Toy did the Amiga version, which was published in 1986. The Amiga version is based on Rogue version 5, where possibly copyright infringing references to monsters from Dungeons & Dragons such as Floating Eyes and Kobolds were replaced by lamer ones like Ice Monsters and Kestrals.

## Amiga 1000 and 500

Amiga 1000 commercial

I have a hardware Amiga 500 retrofitted with a Gotek Floppy Emulator that replaces the good old floppy disk drive with a floppy emulator that reads disk image files (ADF) from a USB stick.

I downloaded an ADF with the Amiga version of Rogue and tried starting it on my Amiga, but it didn't work - most of the graphics was missing, and the game was unplayable.

Now, in 1986, when this game was released, the Amiga 500 didn't exist yet. The game was probably developed for an Amiga 1000, which was very similar to the Amiga 500. Both the Amiga 1000 and the Amiga 500 could be bought with 512 KB of built-in so-called 'chip' memory, named so because the memory is shared directly between the CPU and all the custom graphics and sound chips of the Amiga. A very cool feature.

One major difference is that my Amiga 500 has a memory expansion with 512 KB extra so-called 'slow memory', which cannot be used for graphics or sound data. The graphics and audio chips are simply not able to access this memory. When allocating memory using the system call AllocMem, you can specify whether you want chip memory or just any old memory.

Looking at the year of release of the game, I formed a hypothesis that the game probably allocated memory without specifying any requirements and loaded graphics data into whatever came back, which would work on an Amiga 1000 or even an Amiga 500 without memory expansion, but couldn't be guaranteed to work on other configurations.

## Using FS-UAE for Testing

Amiga 500 memory expansion

I wanted to test this, so I turned to FS-UAE, which is a well-designed Amiga emulator based on the same UAE emulation code as the more well-known WinUAE, but much less confusing to use.

I wrote a config file for booting FS-UAE as an Amiga 500 with no memory expansion:

amiga_model=a500
slow_memory=0
fullscreen=1


And ran it from the command-line:

fs-uae myconfig.fs-uae


It worked.

Now, I wanted to run the game on my hardware Amiga 500, which does have the memory expansion, and I don't want to pull that thing out anytime I want to play Rogue, so a more compatible solution would be preferable.

I remembered that there was a tool called 'NoFastMem' on the standard Workbench 1.3 disk, and wondered if it could be used for this purpose. I never used it in the 10 years of using an Amiga every day, but it was worth a shot. I booted FS-UAE as an Amiga 500 with the extra memotry from a Workbench disk image with Rogue in the second floppy drive DF1:

amiga_model=a500
fullscreen=1


After starting the Amiga command prompt, the Shell, I could start Rogue and verify that the graphics was still broken:

cd df1:
rogue

Workbench 1.3, running NoFastMem
After that, I tried starting NoFastMem first. Running NoFastMem from the command-line will hang forever, so I started it in the background using the 'run' command:
run sys:system/nofastmem
cd df1:
rogue


It worked! My guess is that NoFastMem simply allocates all the non-chip memory as long as it's running.

And now to make this run direcly from the Rogue disk. I found two ways to edit the contents of ADF files. The most practical but also most boring way is using Total Commander with the AmigaDX plugin, allowing direct copying and editing of files stored in ADF files.

A more fun approach is done directly on the emulated Amiga.

## Modifying startup-sequence From the Workbench

Amiga Workbench default editor Ed

To be able to write directly to an ADF in FS-UAE, we need to add an option to the config file:

writable_floppy_images=1


I could only get this to work with ADF that are not in .zip files. Now, we can boot our Workbench with the Rogue ADF in DF1:, run the Shell and type:

copy sys:system/nofastmem df1:
copy c:run df1:
ed df1:s/startup-sequence


Here we edit the boot sequence of the Rogue disk, I prepended our nofastmem command:

run nofastmem
stack 10240
rogue


Save the file in the weird ED editor using Escape,s,a, and quitting using Escape,q.

After testing, I could transfer the ADF to an USB stick and plug it into my hardware Amiga, and run the game for the first time, memory expansion be damned.

## References

Rogue fixed by Syltefar