6502 Restricted Assembler
A 6502 assembler with restricted functions.
Install
pip install mos-6502-restricted-assembler
Usage
from asm_6502 import Assembler
code = """
START ORG $0080
JMP START
"""
assembler = Assembler()
results = assembler.assemble(code, add_entry=False)
# Results will be `[(0x0080, [0x4C, 0x80, 0x00])]`
# 0x0080 is the offset of the codes, the following are the bytes generated by the assembler.
code = """
ORG $0080
JMP $abcd
"""
results = assembler.assemble(code)
# Results will be `[
# (0x0080, [0x4C, 0xcd, 0xab]),
# (0xFFFC, [0x80, 0x00]),
# ]`
# By default, the assembler will set to 0xFFFE/F the address of the first line that can be executed.
Instructions
List
Official:
| ADC | AND | ASL | BCC | BCS | BEQ | BIT | BMI | BNE | BPL | BRK | BVC | BVS | CLC |
| CLD | CLI | CLV | CMP | CPX | CPY | DEC | DEX | DEY | EOR | INC | INX | INY | JMP |
| JSR | LDA | LDX | LDY | LSR | NOP | ORA | PHA | PHP | PLA | PLP | ROL | ROR | RTI |
| RTS | SBC | SEC | SED | SEI | STA | STX | STY | TAX | TAY | TSX | TXA | TXS | TYA |
Undocumented:
| ANC | ARR | ASR | DCP | ISC | JAM | LAS | LAX | RLA | RRA | SAX | SBX | SHA | SHS |
| SHX | SHY | SLO | SRE | XAA | - | - | - | - | - | - | - | - | - |
Pseudo
ORG $0080 ; The following codes will be generated from this offset
.BYTE $AB ; Set to the current address $0080 with a byte $AB
.WORD $ABCD ; Set to the current address $0081 with two bytes $CD and $AB
.END ; This is equivelent to JMP *
Addressing
START ORG $0080
.WORD *+3
NOP ; Implied addressing
JMP (START) ; Indirect addressing
LDA #10 ; Load $0A into the accumulator
LDA #LO $ABCD ; Load $CD into the accumulator
LDA #HI $ABCD ; Load $AB into the accumulator
LDA $00 ; Load into accumulator from zero-page address $00
LDA $10,X ; Load into accumulator from zero-page address ($10 + X) % $0100
LDX $10,Y ; Load into X from zero-page address ($10 + Y) % $0100
LDA $ABCD ; Load into accumulator from address $ABCD
LDA $ABCD,X ; Load into accumulator from address $ABCD + X
LDA $ABCD,Y ; Load into accumulator from address $ABCD + Y
LDA ($40,X) ; Load into accumulator from the 2-byte address contained in ($40 + X) % $0100
LDA ($40),Y ; Load into accumulator from (the 2-byte address contained in $40) + Y
Special rules for zero-page addressing:
LDA $0010 ; This is not zero-page addressing as the input contains a word
LDA * ; This is not zero-page addressing no matter what the current code address is
LDA LABEL ; This is not zero-page addressing no matter where LABEL points to
LDA $FF+10-10 ; This is not zero-page addressing as the intermedidate result is greater than a byte
Metadata
Release files for mos-6502-restricted-assembler 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mos-6502-restricted-assembler-0.1.1.tar.gz | 21.3 kB | Without provenance | Details for mos-6502-restricted-assembler-0.1.1.tar.gz |
Release files / mos-6502-restricted-assembler-0.1.1.tar.gz
| Download URL | mos-6502-restricted-assembler-0.1.1.tar.gz |
|---|---|
| Size | 21.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b20ac31b97a00dbced5842262ab5694849ad1f8679a1ab8f35e4e3a263b3f7b
|
|
BLAKE2b-256 checksum How to use checksums |
a501d5e567efe130cae4de6c1d09a9c1de35b186f5c776df4181813413054633
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4
|
Security for mos-6502-restricted-assembler 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.