Skip to content

Commit

Permalink
Merge pull request #5 from kostDev/dev
Browse files Browse the repository at this point in the history
merge dev
  • Loading branch information
kostDev authored Aug 21, 2024
2 parents cefef97 + 0bc22b4 commit 7f7b834
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,20 @@ A minimalist and educational 6502 CPU emulator written in JavaScript. This proje
• Memory Management: Includes basic read/write operations for memory handling.
• Customizable: Designed with simplicity in mind, making it easy to extend and modify.
• Testing: Covered with tests 11/151 OPCODES, which are official and documented guidelines. (in progress)


### 6502 Instructions by Category

| Load | Trans | Stack | Shift | Logic | Arith | Inc | Ctrl | Bra | Flags | Nop |
|------|-------|-------|-------|-------|-------|-----|------|-----|-------|-----|
| LDA | TAX | PHA | ASL | AND | ADC | DEC | BRK | BCC | CLC | NOP |
| LDX | TAY | PHP | LSR | BIT | CMP | DEX | JMP | BCS | CLD | |
| LDY | TSX | PLA | ROL | EOR | CPX | DEY | JSR | BEQ | CLI | |
| STA | TXA | PLP | ROR | ORA | CPY | INC | RTI | BMI | CLV | |
| STX | TXS | | | | SBC | INX | RTS | BNE | SEC | |
| STY | TYA | | | | | INY | | BPL | SED | |
| | | | | | | | | BVC | SEI | |
| | | | | | | | | BVS | | |

#### Installation

Clone the repository and navigate to the project directory:
Expand Down
2 changes: 1 addition & 1 deletion js/opcodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ const OPCODES = {
},
0x87: "", // sax("d") // illegal
0x88: {
name: "DEX", // Decrement Index X by One
name: "DEY", // Decrement Index Y by One
t: 2,
code: 0x88,
run: (cpu) => {
Expand Down
45 changes: 45 additions & 0 deletions js/opcodes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
### Opcodes progress (22/151)

| Dec | Opcode | Instruction | Status |
|:---:|:------:|:--------------:|:------:|
| 0 | 0x00 | BRK ||
| 9 | 0x09 | ORA #immediate ||
| 29 | 0x29 | AND #immediate ||
| 41 | 0x49 | EOR #immediate ||
| 84 | 0x84 | STY zeropage ||
| 85 | 0x85 | STA zeropage ||
| 86 | 0x86 | STX zeropage ||
| 88 | 0x88 | DEY ||
| 90 | 0x90 | BCC ||
| 98 | 0x98 | TYA ||
| 105 | 0x69 | ADC #immediate ||
| 138 | 0x8A | TXA ||
| 160 | 0xA0 | LDY #immediate ||
| 162 | 0xA2 | LDX #immediate ||
| 168 | 0xA8 | TAY ||
| 169 | 0xA9 | LDA #immediate ||
| 170 | 0xAA | TAX ||
| 200 | 0xC8 | INY ||
| 202 | 0xCA | DEX ||
| 232 | 0xE8 | INX ||
| 233 | 0xE9 | SBC #immediate ||
| 234 | 0xEA | NOP ||


### Opcodes in progress:

<details>
<summary><b>Opcodes for <span style="color: orange">LDA</span></b></summary>

| Dec | Opcode | Instruction | Mode | Cycles | Status |
|:-----:|:--------:|:------------------:|:------------:|:--------:|----------|
| 169 | 0xA9 | LDA #immediate | Immediate | 2 | ✅️ |
| 165 | 0xA5 | LDA zeropage | Zeropage | 3 ||
| 181 | 0xB5 | LDA zeropage,X | Zeropage,X | 4 ||
| 173 | 0xAD | LDA absolute | Absolute | 4 ||
| 189 | 0xBD | LDA absolute,X | Absolute,X | 4 (+1) ||
| 185 | 0xB9 | LDA absolute,Y | Absolute,Y | 4 (+1) ||
| 161 | 0xA1 | LDA (indirect,X) | Indirect,X | 6 ||
| 177 | 0xB1 | LDA (indirect),Y | Indirect,Y | 5 (+1) ||

</details>

0 comments on commit 7f7b834

Please sign in to comment.