Jump to content
IGNORED

Creating Cheats


SainT

Recommended Posts

The Cheat File

The 7800GD.CHT file is a text file containing instructions letting the 7800GD know what it can do when certain files are loaded to enable cheats. You can find your own cheats using an emulator with debugger, such as A7800, and locating the memory addresses to modify to alter the way the game plays. These can either be patches to the ROM which happen when the cheat is enabled or disabled or writes to RAM locations which happen once per frame to alter the state of the game. Instructions on how to develop cheats are out of the scope of this post. Here I will cover the format of the 7800GD.CHT file such that you can add your own cheats to the database.

 

Cheat Format

I'll take a couple of examples and explain what they are doing. Here is the Basketbrawl and Crossbow --

 

#$f7f1b8c1,$9436c704        ; Basketbrawl
[Freeze Timer]
:FRAME
@<$75=$59
[Player 2 Scores 0]
:FRAME
@<$2262=0
[Player 1 Scores 999]
:FRAME
@<$2260=$99,9
        
#$24227e7e                  ; Crossbow, NTSC
[Light Gun Calibration]     ; cheat option, will always have ON/OFF
?[Offset]=B{0-7}:3          ; parameter, can be altered in-game, range 0-7, default 3
:ON                         ; on action
@$d3b=$d0,[Offset]          ; bne offset
:OFF                        ; off action
@$d3b=$ea,$ea               ; nop nop

 

#$xxxxxxxx

This is the hexadecimal CRC32 of the ROM data (not including the A78 header) which is used to uniquely identify the game. This can be found with 7800gdcheat using the crc option. If your cheat can work with multiple ROM images (such as PAL and NTSC versions) you can include multiple CRC32 values here separated by a comma.

 

[Freeze Timer]

Each cheat is started by defining its name in square brackets. The name will appear in the cheat menu and can be enabled or disabled.

 

?[Offset]=B{0-7}:3

Some cheats may benefit from option values being input by the user to tweak how they work. A ? followed by the name of the option in square brackets defines a variable for use within the cheat code. The format of the option is specified after the =, which can be SB/B (signed byte) or UB (unsigned byte). The valid range can also be specified in {} curly braces and the default value after the : colon.

 

:FRAME (:ON, OFF)

Cheat commands are run when a condition is triggered. The current triggers are :FRAME, which executes the cheat commands every frame, :ON which runs once when the cheat is enabled and :OFF which runs once when the cheat is disabled. Following the trigger are a series of commands to execute when the condition is met.

 

@<$75=$59 (@$xxxxx @<$xxxx =$xx =ddd =[Variable])

The @ symbol specifies a memory address to modify. Specifically @$xxxxx specifies an address in the ROM, which is an offset in the file from the beginning of the ROM data (not including header), and @<$xxxx specifies and address in the 7800 address space. Frame based cheats will be mostly using @<$xxxx format while ROM patches will use @$xxxxx.

 

Once a memory address has been set, the =$xx (hex), =ddd (decimal) or =[Name] (option variable) instruction writes a value to memory. The = instruction doesn't have to follow the @ instruction and each write increments the write pointer by one byte. Many bytes can be specified for write as a comma separated list.

 

Multiple writes can be performed per trigger and the code to execute for the trigger continues to be defined until another trigger command is found or another cheat is started.

 

Verifying Cheats

As the cheat format is relatively complex, there is a program which can be used to verify you haven't made any mistakes. If any mistakes are found, the 7800GD will not execute the cheats, so it's important to check it's correct! The source code and executable for 7800GDCheat can be found at the GitHub repo 7800GD-Cheat.

 

Example uses:

>7800gdcheat crc "Joust (NTSC) (Atari) (1987).a78"
Joust (NTSC) (Atari) (1987).a78 : $90759dd8

>7800gdcheat parse 7800GD.CHT
Parsed '7800GD.CHT', 35 cheats, 0 errors found.

 

 

  • Like 5
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...