User Tools

Site Tools


software:emulation:emulator_oem

This is an old revision of the document!


The GameTank Emulator

The GameTank has an emulator that was developed alongside the hardware and continues to be improved as both a software development tool and a wrapper for GameTank binaries to run on modern desktop, laptop, and mobile devices.

This page is specifically about the original emulator developed in C++ and SDL at https://github.com/clydeshaffer/gametankemulator

Get the emulator

Windows

Download latest windows build

Currently for the Windows version a prebuilt packages is created every 24h and available at this link.

Building for windows

Building the GameTankEmulator is assumed here to be done under WSL, and you should have git already installed and set up.

Get the emulator source:

git clone https://github.com/clydeshaffer/GameTankEmulator.git
cd GameTankEmulator
git submodule update --init --recursive

You'll also need SDL2 development files, at time of writing the emulator uses version 2.26.2 for MinGW https://github.com/libsdl-org/SDL/releases/tag/release-2.26.2 This should be extracted into the same parent folder that you cloned the GameTankEmulator repo

wget https://github.com/libsdl-org/SDL/releases/download/release-2.26.2/SDL2-devel-2.26.2-mingw.tar.gz
tar -xvf SDL2-devel-2.26.2-mingw.tar.gz

Finally you'll also need the MinGW compiler suite for cross building from Linux to Windows

sudo apt install mingw-w64

Once you have the tools and libraries installed you should be able to build the emulator. For some reason when the windows version is launched from WSL it has a very long initial load time ONLY when the exe is stored in the WSL drive. Copying the exe file to a location in your normal windows drives such as C: and running it from there fixes the issue.

make OS="Windows_NT" XCOMP=yes SDL_ROOT=../SDL2-2.26.2/i686-w64-mingw32 -j 1
mkdir -p /mnt/c/Users/{YOUR WINDOWS NAME}/Emulators/GameTank/
unzip dist/GTE_Win32.zip -d /mnt/c/Users/{YOUR WINDOWS NAME}/Emulators/GameTank/
/mnt/c/Users/{YOUR WINDOWS NAME}/Emulators/GameTank/GameTankEmulator.exe ./roms/badapple.gtr

Mac

Building on OSX, for OSX is a bit more straightforward:

Get SDL:

brew install sdl2

Get and build the emulator:

git clone https://github.com/clydeshaffer/GameTankEmulator.git
cd GameTankEmulator
git submodule update --init --recursive
make OS="macos"
./build/GameTankEmulator ./roms/badapple.gtr

Linux

Building on Linux, for Linux is also somewhat simple:

Get SDL:

sudo apt install libsdl2-dev

Get and build the emulator:

git clone https://github.com/clydeshaffer/GameTankEmulator.git
cd GameTankEmulator
git submodule update --init --recursive
make OS="ubuntu"
./build/GameTankEmulator ./roms/badapple.gtr

Memory Browser

The emulator has a memory browser tool that can pick up the out.map file from CC65, which the SDK uses. If you're not using the C SDK and want to use this feature, you can create an out.map at ../build/out.map relative to your rom file and format it like this:

Exports list by value:
----------------------
__CONSTRUCTOR_COUNT__     000000 REA    __DESTRUCTOR_COUNT__      000000 REA    
__RAM_FILEOFFS__          000000  EA    __ZEROPAGE_LOAD__         000000  LA    
__ZEROPAGE_RUN__          000000  LA    __ZP_FILEOFFS__           000000  EA    
__ZP_START__              000000  LA    __STARTUP__               000001 REA    
_tile_anim_counters       000014 RLZ    c_sp                      00001E RLZ    
sp                        00001E RLZ    sreg                      000020 RLZ    
regsave                   000022  LZ    ptr1                      000026 RLZ    
ptr2                      000028 RLZ    ptr3                      00002A RLZ    
ptr4                      00002C RLZ    tmp1                      00002E RLZ    
tmp2                      00002F  LZ    tmp3                      000030  LZ    
tmp4                      000031  LZ    regbank                   000032 RLZ    
__ZEROPAGE_SIZE__         000038  EA    __ZP_LAST__               000038  LA    
__ZP_SIZE__               000100  EA    __DATA_RUN__              000200 RLA    
__RAM_START__             000200 RLA    _call_mob_draw_func       000200 RLA    
_call_mob_update_func     000217 RLA    _call_mob_hitbox_func     00022E RLA    
_core_tile_draw_loop      000245 RLA    _grab_dsf_entry           0002EC RLA    
_grab_dsf_entry_mini      000318 RLA    _health_string            000336  LA    

The emulator doesn't care about the third or sixth columns, it just expects there to be any string there. The first and fourth columns are names of memory locations, and the second and fifth are hexadecimal addresses.

software/emulation/emulator_oem.1757380425.txt.gz · Last modified: 2025/09/09 01:13 by clyde