{"id":15937029,"url":"https://github.com/cyberzhg/mos-6502-restricted-assembler","last_synced_at":"2025-04-03T19:44:09.659Z","repository":{"id":57443259,"uuid":"325936044","full_name":"CyberZHG/mos-6502-restricted-assembler","owner":"CyberZHG","description":"A 6502 assembler with restricted functions","archived":false,"fork":false,"pushed_at":"2021-11-28T06:45:11.000Z","size":197,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-10T07:06:04.201Z","etag":null,"topics":["6502-assembler"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CyberZHG.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-01T07:29:22.000Z","updated_at":"2021-11-28T06:45:14.000Z","dependencies_parsed_at":"2022-09-05T08:02:19.346Z","dependency_job_id":null,"html_url":"https://github.com/CyberZHG/mos-6502-restricted-assembler","commit_stats":null,"previous_names":["lwislvislie/mos-6502-restricted-assembler","cyberzhg/mos-6502-restricted-assembler"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberZHG%2Fmos-6502-restricted-assembler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberZHG%2Fmos-6502-restricted-assembler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberZHG%2Fmos-6502-restricted-assembler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberZHG%2Fmos-6502-restricted-assembler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CyberZHG","download_url":"https://codeload.github.com/CyberZHG/mos-6502-restricted-assembler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247070780,"owners_count":20878581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["6502-assembler"],"created_at":"2024-10-07T04:41:46.752Z","updated_at":"2025-04-03T19:44:09.626Z","avatar_url":"https://github.com/CyberZHG.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 6502 Restricted Assembler\n\n[![Python application](https://github.com/CyberZHG/cpu-6502-restricted-assembler/actions/workflows/python-test.yml/badge.svg)](https://github.com/CyberZHG/cpu-6502-restricted-assembler/actions/workflows/python-test.yml)\n[![Coverage Status](https://coveralls.io/repos/github/CyberZHG/mos-6502-restricted-assembler/badge.svg?branch=main)](https://coveralls.io/github/CyberZHG/mos-6502-restricted-assembler?branch=main)\n\nA 6502 assembler with restricted functions.\n\n## Install\n\n```bash\npip install mos-6502-restricted-assembler\n```\n\n## Usage\n\n```python\nfrom asm_6502 import Assembler\n\ncode = \"\"\"\nSTART ORG $0080\n      JMP START\n\"\"\"\nassembler = Assembler()\nresults = assembler.assemble(code, add_entry=False)\n# Results will be `[(0x0080, [0x4C, 0x80, 0x00])]`\n#     0x0080 is the offset of the codes, the following are the bytes generated by the assembler.\n\ncode = \"\"\"\nORG $0080\nJMP $abcd\n\"\"\"\nresults = assembler.assemble(code)\n# Results will be `[\n#     (0x0080, [0x4C, 0xcd, 0xab]),\n#     (0xFFFC, [0x80, 0x00]),\n# ]`\n# By default, the assembler will set to 0xFFFE/F the address of the first line that can be executed.\n```\n\n## Instructions\n\n### List\n\nOfficial:\n\n|     |     |     |     |     |     |     |     |     |     |     |     |     |     |\n|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|\n| ADC | AND | ASL | BCC | BCS | BEQ | BIT | BMI | BNE | BPL | BRK | BVC | BVS | CLC |\n| CLD | CLI | CLV | CMP | CPX | CPY | DEC | DEX | DEY | EOR | INC | INX | INY | JMP |\n| JSR | LDA | LDX | LDY | LSR | NOP | ORA | PHA | PHP | PLA | PLP | ROL | ROR | RTI |\n| RTS | SBC | SEC | SED | SEI | STA | STX | STY | TAX | TAY | TSX | TXA | TXS | TYA |\n\nUndocumented:\n\n|     |     |     |     |     |     |     |     |     |     |     |     |     |     |\n|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|\n| ANC | ARR | ASR | DCP | ISC | JAM | LAS | LAX | RLA | RRA | SAX | SBX | SHA | SHS |\n| SHX | SHY | SLO | SRE | XAA |  -  |  -  |  -  |  -  |  -  |  -  |  -  |  -  |  -  |\n\n\n### Pseudo\n\n```\nORG $0080    ; The following codes will be generated from this offset\n.BYTE $AB    ; Set to the current address $0080 with a byte $AB\n.WORD $ABCD  ; Set to the current address $0081 with two bytes $CD and $AB\n.END         ; This is equivelent to JMP *\n```\n\n### Addressing\n\n```\nSTART ORG $0080\n      .WORD *+3\n      NOP                 ; Implied addressing\n      JMP (START)         ; Indirect addressing\n      LDA #10             ; Load $0A into the accumulator\n      LDA #LO $ABCD       ; Load $CD into the accumulator\n      LDA #HI $ABCD       ; Load $AB into the accumulator\n      LDA $00             ; Load into accumulator from zero-page address $00\n      LDA $10,X           ; Load into accumulator from zero-page address ($10 + X) % $0100\n      LDX $10,Y           ; Load into X from zero-page address ($10 + Y) % $0100\n      LDA $ABCD           ; Load into accumulator from address $ABCD\n      LDA $ABCD,X         ; Load into accumulator from address $ABCD + X\n      LDA $ABCD,Y         ; Load into accumulator from address $ABCD + Y\n      LDA ($40,X)         ; Load into accumulator from the 2-byte address contained in ($40 + X) % $0100\n      LDA ($40),Y         ; Load into accumulator from (the 2-byte address contained in $40) + Y\n```\n\nSpecial rules for zero-page addressing:\n\n```\nLDA $0010           ; This is not zero-page addressing as the input contains a word\nLDA *               ; This is not zero-page addressing no matter what the current code address is\nLDA LABEL           ; This is not zero-page addressing no matter where LABEL points to\nLDA $FF+10-10       ; This is not zero-page addressing as the intermedidate result is greater than a byte\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyberzhg%2Fmos-6502-restricted-assembler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyberzhg%2Fmos-6502-restricted-assembler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyberzhg%2Fmos-6502-restricted-assembler/lists"}