# 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
```python
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
```ca65
; 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
```ca65
*=0x008000
jsr.l _intro
```
## Scopes
```ca65
some_address = 0x54
{
lda.b some_address
beq no_action
; this label is only visible inside this scope
no_action:
}
```
### Named scopes
```ca65
*=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)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "a816",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "assembly, romhack, super famicom, supernes",
"author": null,
"author_email": "Emmanuel Peralta <manz@ringum.net>",
"download_url": null,
"platform": null,
"description": "# a816\nAnother 65c816 assembler\n\n## Usage\n\n### Command line\n```\n$ a816 --help\nusage: x816 [-h] [--verbose] [-o OUTPUT_FILE] [-f FORMAT] [-m MAPPING] [--copier-header] [--dump-symbols] [-D KEY=VALUE [KEY=VALUE ...]] input_file\n\nx816 usage\n\npositional arguments:\n input_file The asm file to assemble.\n\noptions:\n -h, --help show this help message and exit\n --verbose Displays all log levels.\n -o OUTPUT_FILE, --output OUTPUT_FILE\n Output file\n -f FORMAT Output format\n -m MAPPING Address Mapping\n --copier-header Adds 0x200 address delta corresponding to copier header in ips writer.\n --dump-symbols Dumps symbol table\n -D KEY=VALUE [KEY=VALUE ...], --defines KEY=VALUE [KEY=VALUE ...]\n Defines symbols.\n```\n\nor directly from python code:\n\n### From python code\n\n```python\nfrom a816.program import Program\n\ndef build_patch(input, output):\n program = Program()\n program.assemble_as_patch(input, output)\n program.resolver.dump_symbol_map()\n```\n\n## Supported Syntax\n\n### Memonics\n\n```\nadc, 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\n```\n\n## Macros\n\n```ca65\n; define a macro\n.macro test(var_1, var_2) {\n lda.w var_1 << 16 + var_2\n}\n\n; use that macro\ntest(0x10, 0x10)\n\n; should expand that way\nlda.w 0x10 << 16 + 0x10\n\n; code generated\nlda.w 0x1010\n```\n\n\n## Code pointer relocation\n\n```ca65\n*=0x008000\n jsr.l _intro\n```\n\n\n## Scopes\n\n```ca65\nsome_address = 0x54\n{\n lda.b some_address\n beq no_action\n ; this label is only visible inside this scope\n no_action:\n}\n```\n\n### Named scopes\n\n```ca65\n*=0x009000\nnamed_scope {\n addr = 0x1234\n youhou_text:\n .text 'youhou'\n .db 0\n yaha_text:\n .text 'yaha'\n .db 0\n}\n\n*=0x019A52\n\tload_system_menu_text_pointer(named_scope.youhou_text)\n\n*=0x019A80\n\tload_system_menu_text_pointer(named_scope.yaha_text)\n\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "65c816 patching assembler (Super Famicom)",
"version": "1.0.4",
"project_urls": {
"homepage": "https://a816.ringum.net",
"repository": "https://github.com/manz/a816"
},
"split_keywords": [
"assembly",
" romhack",
" super famicom",
" supernes"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "79fce0d5424b36422992ade79afd299fb45449f7ec49b7ae723dc0475ee090de",
"md5": "aec839993c1e3ad4974fdcf897882910",
"sha256": "bec6e6d46ecb3c44c707d97066f1acad7891084daf3906c4d809a0947bdde2ef"
},
"downloads": -1,
"filename": "a816-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "aec839993c1e3ad4974fdcf897882910",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 34853,
"upload_time": "2025-01-02T12:34:02",
"upload_time_iso_8601": "2025-01-02T12:34:02.017449Z",
"url": "https://files.pythonhosted.org/packages/79/fc/e0d5424b36422992ade79afd299fb45449f7ec49b7ae723dc0475ee090de/a816-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-02 12:34:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "manz",
"github_project": "a816",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "hatch",
"specs": [
[
"==",
"1.12.0"
]
]
}
],
"lcname": "a816"
}