Skip to main content

65c816 patching assembler (Super Famicom)

Project description

a816

Another 65c816 assembler

Usage

Command line

$ a816 --help
usage: x816 [-h] [--verbose] [-o OUTPUT_FILE] [-f FORMAT] [-m MAPPING] [--copier-header] [--dump-symbols] [-D KEY=VALUE [KEY=VALUE ...]] input_file

x816 usage

positional arguments:
  input_file            The asm file to assemble.

options:
  -h, --help            show this help message and exit
  --verbose             Displays all log levels.
  -o OUTPUT_FILE, --output OUTPUT_FILE
                        Output file
  -f FORMAT             Output format
  -m MAPPING            Address Mapping
  --copier-header       Adds 0x200 address delta corresponding to copier header in ips writer.
  --dump-symbols        Dumps symbol table
  -D KEY=VALUE [KEY=VALUE ...], --defines KEY=VALUE [KEY=VALUE ...]
                        Defines symbols.

or directly from python code:

From python code

from a816.program import Program

def build_patch(input, output):
    program = Program()
    program.assemble_as_patch(input, output)
    program.resolver.dump_symbol_map()

Supported Syntax

Memonics

adc, and, asl, bcc, bcs, beq, bit, bmi, bne, bpl, bra, brk, brl, bvc, bvs, clc, cld, cli, clv, cmp, cop, cpx, cpy, db, dec, dex, dey, eor, inc, inx, iny, jml, jmp, jsl, jsr, lda, ldx, ldy, lsr, mvn, mvp, nop, ora, pea, pei, per, pha, phb, phd, phk, php, phx, phy, pla, plb, pld, plp, plx, ply, rep, rol, ror, rti, rtl, rts, sbc, sec, sed, sei, sep, sta, stp, stx, sty, stz, tax, tay, tcd, tcs, tdc, trb, tsb, tsc, tsx, txa, txs, txy, tya, tyx, wai, xba, xce

Macros

; define a macro
.macro test(var_1, var_2) {
    lda.w var_1 << 16 + var_2
}

; use that macro
test(0x10, 0x10)

; should expand that way
lda.w 0x10 << 16 + 0x10

; code generated
lda.w 0x1010

Code pointer relocation

*=0x008000
    jsr.l _intro

Scopes

some_address = 0x54
{
    lda.b some_address
    beq no_action
    ; this label is only visible inside this scope
    no_action:
}

Named scopes

*=0x009000
named_scope {
   addr = 0x1234
   youhou_text:
   .text 'youhou'
   .db 0
   yaha_text:
   .text 'yaha'
   .db 0
}

*=0x019A52
	load_system_menu_text_pointer(named_scope.youhou_text)

*=0x019A80
	load_system_menu_text_pointer(named_scope.yaha_text)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

a816-1.0.4-py3-none-any.whl (34.9 kB view details)

Uploaded Python 3

File details

Details for the file a816-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: a816-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 34.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for a816-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bec6e6d46ecb3c44c707d97066f1acad7891084daf3906c4d809a0947bdde2ef
MD5 aec839993c1e3ad4974fdcf897882910
BLAKE2b-256 79fce0d5424b36422992ade79afd299fb45449f7ec49b7ae723dc0475ee090de

See more details on using hashes here.

Supported by

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