ROM Hack CheatASM - Assembly language for Atmosphere Cheats

tslater2006

New Member
OP
Newbie
Joined
Nov 22, 2021
Messages
2
Trophies
0
Age
33
XP
11
Country
United States
I wanted to share this utility I've created (at the suggestion of a user here that filed an issue on my GitHub), but I've created a utility called CheatASM which aims to provide an assembly-like language for writing cheats for games. It has full support for every cheat opcode supported by Atmosphere (and will receive updates as new opcodes get added).

(Due to being a brand new account I cannot link to the project, but a quick google search of "github CheatASM" should land you there. Once my account is unrestricted I'll update with a link here.)
Staff edit
https://github.com/tslater2006/CheatASM

The basic usage is you can either -a to assemble a cheat or -d to disassemble a cheat. There is also a --repl mode for you to play around with CheatASM. i've tried to put together an exhaustive readme on the repository and have published a portable release which should be runable anywhere you can install dotnet (it runs on .NET 5.0).

There are some example files in the repository, but please note, I don't actually write cheats for games, so the examples are a bit contrived/senseless as they were intended to test out the features of the assembler, and not actually make sense :)

To give a small taste of what this utility enables:

Code:
.if.q R4 == 0x1234
   mov.b [MAIN+R5], 0x5
.else
   mov.b [MAIN+R5], 0x6
.fi

Assembles to:

Code:
C0854400 00000000 00001234
01050000 00000000 00000005
21000000
01050000 00000000 00000006
20000000

And something like this:
Code:
.title {1234}
.build {1234}

floatTest: .f32 4.83
mainOffset: .u32 const 0x1234
coinOffset: .u32 const 0x12
ten: .u32 0xA

.cheat master "Setup"
mov.d [R0 + 0x123], floatTest
mov.q R0, [MAIN + mainOffset]

.cheat "Always 10 coins"
mov.d [R0 + coinOffset], ten
mov.q [R1 + 0x123], floatTest

Assembles down to:
Code:
[Assembled by CheatASM]
{Setup}
400F0000 00000000 409A8F5C
A4F00200 00000123
58000000 00001234

[Always 10 coins]
400F0000 00000000 0000000A
400E0000 00000000 409A8F5C
A4F00200 00000012
A8E10200 00000123

I hope some of you may find this utility useful and welcome any feedback/issues on the repository.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
34,340
Trophies
2
Website
trastindustries.com
XP
23,438
Country
United Kingdom
Quasi assembler as an abstraction to most cheat codes bytecode abstraction... interesting.

Not sure how much I would have called for such a thing but most cheats I deal with tend to max out in complexity at button activators, flag activators, self made flags and slide codes so that is OK.
Such a thing might also be useful for porting between regions, updates, hacks that alter things and such like.
 

tslater2006

New Member
OP
Newbie
Joined
Nov 22, 2021
Messages
2
Trophies
0
Age
33
XP
11
Country
United States
Quasi assembler as an abstraction to most cheat codes bytecode abstraction... interesting.

Not sure how much I would have called for such a thing but most cheats I deal with tend to max out in complexity at button activators, flag activators, self made flags and slide codes so that is OK.
Such a thing might also be useful for porting between regions, updates, hacks that alter things and such like.

I really built it as an excuse to play with ANTLR and language parsing. I also had an interest in understanding what certain cheats do, and the format needed by Atmosphere isn't exactly human readable, so the disassembler was helpful. I don't really create cheats for games so who knows if its actually practical to use, but an issue was filed on the project and they suggested I share it here :)
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
34,340
Trophies
2
Website
trastindustries.com
XP
23,438
Country
United Kingdom
I really built it as an excuse to play with ANTLR and language parsing. I also had an interest in understanding what certain cheats do, and the format needed by Atmosphere isn't exactly human readable, so the disassembler was helpful. I don't really create cheats for games so who knows if its actually practical to use, but an issue was filed on the project and they suggested I share it here :)
Atmosphere is worse than some of the classics ( https://web.archive.org/web/20191123185758/https://doc.kodewerx.org/hacking_nds.html ) but after a while it sort of becomes second nature, or if we are going back to assembly then you probably know the core instructions but will have to go look up something when it is an instruction to take the absolute value of a double precision float or whatever.

On language parsing now having recently watched
I am wondering if I could convert it to brainfuck or maybe even https://truxgoservers.com/blog/ook-language-a-language-to-break-in-laughter/
Granted if I was being sensible I should probably make sure I have perl on lock as it has been too many years now.
 

gbatempfan1

Well-Known Member
Member
Joined
Nov 2, 2010
Messages
178
Trophies
0
XP
897
Country
I think the disassembler has a lot of utility as well and perhaps could be emphasized more. It is nice for codes that have a very deep pointer, but it doesn't seem to handle button combos well. For example the bellow has a ZR+B combo keycheck but it leaves that field blank in the disassembly.


Code:
[Example to disassmble]
580C0000 7264C888
580C1000 00000124
580C1000 00000000
580C1000 000000F4
580C1000 000002D0
580C1000 000000E8
580C1000 00000014
9803C100 00000000 00000044
9804C100 00000000 00000040
58041000 00000000 A4430000
80000202
640C0000 00000000 22960000
20000000
..snip..

Code:
[Example]
mov.q RC, [MAIN + 0x7264C888]
mov.q RC, [RC + 0x124]
mov.q RC, [RC]
mov.q RC, [RC + 0xF4]
mov.q RC, [RC + 0x2D0]
mov.q RC, [RC + 0xE8]
mov.q RC, [RC + 0x14]
add.q R3, RC, 0x44
add.q R4, RC, 0x40
mov.q R4, [R4]
keycheck
  mov.d [RC], 0x22960000
endcond
..snip...
 
General chit-chat
Help Users
  • No one is chatting at the moment.
    The Real Jdbye @ The Real Jdbye: pickle riiiiiiiiick