Skip to main content

A tool to make Gecko code from ASM for SMS

Project description

supSMSASM

A tool to make Gecko code from ASM for SMS

This tool only runs on Windows currently.

Installation

First, install devkitPro.

Then, use pip to install supSMSASM:

pip install supSMSASM

Usage

This tool can make C0, C2, and Fixed-Location-C2 code from ASM code. See Supported Code Type for more information.

With all files prepared, use the following command to generate the Gecko code:

supSMSASM {*.s} [JP|JPA]

The generated code will be copied to your clipboard.

Symbols

Symbols defined in ldscript/ can be used in *.s and *.ld.

Supported Code Type

C0

Simply write your ASM code in *.s and use supSMSASM to convert it into Gecko code.

C2

You will need the following two files:

  • *.s: ASM source code
  • *.ld: LD script for defining the entry points of C2. You need to define a symbol $$ and set the value to 0.

To define a C2 entry, define a symbol with $C2$ prepending to the symbol defined in *.s file.

For example, to make 2 C2 codes, first write the body of the code in your xxx.s file:

SomeC2Code:
  # ...

AnotherC2Code:
  # ...

Then, in your xxx.ld file, define the entry points:

/* The following line is required for C2 code type */
$$ = 0;

$C2$SomeC2Code = 0x80345678;
$C2$AnotherC2Code = 0x80DEFABC;

Finally, use supGeckoCode xxx.s to generate Gecko code. The result will be like:

C2345678 XXXXXXXX
... (instructions in SomeC2Code)
C2DEFABC XXXXXXXX
... (instructions in AnotherC2Code)

Note that you can't branch to absolute address with bl or b directly since the location of the code is unknown. You will need to set the destination to register and use blr, bctr etc. instead.

Fixed-Location-C2

To solve the problem that C2 code type can't branch to absolute address directly, you can use 06 to place the code into a fixed location and then use 04 to replace the instruction with b or bl to the code.

You will need the following two files (same as C2):

  • *.s: ASM source code
  • *.ld: LD script for defining the entry points and the address to place the code

To define a entry, define a symbol with $b$ or $bl$ prepending to the symbol defined in *.s file. This will replace the instruction at the given address with b or bl to the the symbol.

For example, to make 2 Fixed-Location-C2 codes, first write the body of the code in your xxx.s file:

SomeCodeWithB:
  b $b$SomeCodeWithB+4

AnotherCodeWithBL:
  # ...
  blr

Then, in your xxx.ld file, define the entry points:

/* The following line defines the address to place the code.
   It will be 0x817F9800 if you don't specify */
$$ = 0x817F9800;

$b$SomeCodeWithB = 0x80345678;
$bl$AnotherCodeWithBL = 0x80DEFABC;

Finally, use supGeckoCode xxx.s to generate Gecko code. The result will be like:

04345678 494B4188 <-- b from 80345678 to SomeCodeWithB
04DEFABC 48A09D49 <-- bl from 80DEFABC to AnotherCodeWithBL
077F9800 XXXXXXXX
... (instructions in SomeCodeWithB and AnotherCodeWithBL)

Note that unlike C2, you have to explicitly do b or blr back to the original program. In addition, just like C2, you have to put the original instruction manually if needed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

supSMSASM-0.1.1.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

supSMSASM-0.1.1-py3-none-any.whl (2.1 MB view details)

Uploaded Python 3

File details

Details for the file supSMSASM-0.1.1.tar.gz.

File metadata

  • Download URL: supSMSASM-0.1.1.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for supSMSASM-0.1.1.tar.gz
Algorithm Hash digest
SHA256 54db68b021933cbdd81b94b6fdd78890c067f9773b854026230498b8bffd1266
MD5 29eb6bc0b97a497de816b7ef995b7603
BLAKE2b-256 81319a97d8b55a5d9f0a222dd80561ce87ad181c002efb3f801ff8afc85306d2

See more details on using hashes here.

File details

Details for the file supSMSASM-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: supSMSASM-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for supSMSASM-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ae155e8b346e5fc35cd39def4599dfd0e03d3c2a20ab2d0822cbbbd6852da878
MD5 7f6bf05f7f02518de971b519e1bccf34
BLAKE2b-256 5d9190d5a23a991ffc8790bddca80cabdd3891364f9b7219d394d62122dcfe1a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page