Skip to main content

65c816 patching assembler (Super Famicom)

Project description

a816

Another 65c816 assembler

Usage

Command line

$ x816 --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

a816-1.0.0.dev2-py3-none-any.whl (31.6 kB view details)

Uploaded Python 3

File details

Details for the file a816-1.0.0.dev2-py3-none-any.whl.

File metadata

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

File hashes

Hashes for a816-1.0.0.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 4e99f63fa5234ea8556637d86028022b5f7ca44cac88dacc26f9c8ba097f9043
MD5 2d4982922e526d8004758539af40e29b
BLAKE2b-256 49126ce26d02505f0b7458eada5682fe73bc998dfdb4bab00e9ff69556e533f1

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