Skip to content

Commit

Permalink
Adding support table to main README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusgomes28 committed Oct 11, 2024
1 parent b7ceb80 commit 0069486
Show file tree
Hide file tree
Showing 2 changed files with 171 additions and 1 deletion.
164 changes: 164 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,170 @@ through 6504 applications, showing state of flags, registers, and memory:

![cli frontend](images/end-goal-65k-emulator.png)

## Opcode support

This section contains support tables for each operation. The tickbox in the
`supported` column indicates whether or not the operation is isupported.


### ADC - Add to Accumulator with Carry

| **Opcode** | **Addressing Mode** | **Opcode (Hex)** | **Bytes** | **Cycles** | **Supported** |
|------------|---------------------|------------------|-----------|------------|---------------|
| ADC | Immediate | 0x69 | 2 | 2 | [ ] |
| ADC | Zero Page | 0x65 | 2 | 3 | [ ] |
| ADC | Zero Page, X | 0x75 | 2 | 4 | [ ] |
| ADC | Absolute | 0x6D | 3 | 4 | [ ] |
| ADC | Absolute, X | 0x7D | 3 | 4* | [ ] |
| ADC | Absolute, Y | 0x79 | 3 | 4* | [ ] |
| ADC | (Indirect, X) | 0x61 | 2 | 6 | [ ] |
| ADC | (Indirect), Y | 0x71 | 2 | 5* | [ ] |

Total number of `ADC` instructions: `8`.

### AND - And Memory with Accumulator

| **Opcode** | **Addressing Mode** | **Opcode (Hex)** | **Bytes** | **Cycles** | **Supported** |
|------------|---------------------|------------------|-----------|------------|---------------|
| AND | Immediate | 0x29 | 2 | 2 | [x] |
| AND | Zero Page | 0x25 | 2 | 3 | [x] |
| AND | Zero Page, X | 0x35 | 2 | 4 | [x] |
| AND | Absolute | 0x2D | 3 | 4 | [x] |
| AND | Absolute, X | 0x3D | 3 | 4* | [x] |
| AND | Absolute, Y | 0x39 | 3 | 4* | [x] |
| AND | (Indirect, X) | 0x21 | 2 | 6 | [x] |
| AND | (Indirect), Y | 0x31 | 2 | 5* | [x] |

Total number of `AND` instructions: `8`

### EOR - Exclusive-Or Memory with Accumulator

| **Opcode** | **Addressing Mode** | **Opcode (Hex)** | **Bytes** | **Cycles** | **Supported** |
|------------|---------------------|------------------|-----------|------------|---------------|
| EOR | Immediate | 0x49 | 2 | 2 | [x] |
| EOR | Zero Page | 0x45 | 2 | 3 | [x] |
| EOR | Zero Page, X | 0x55 | 2 | 4 | [x] |
| EOR | Absolute | 0x4D | 3 | 4 | [x] |
| EOR | Absolute, X | 0x5D | 3 | 4* | [x] |
| EOR | Absolute, Y | 0x59 | 3 | 4* | [x] |
| EOR | (Indirect, X) | 0x41 | 2 | 6 | [x] |
| EOR | (Indirect), Y | 0x51 | 2 | 5* | [x] |

Total number of `EOR` instructions: `8`

### ORA - Or Memory with Accumulator

| **Opcode** | **Addressing Mode** | **Opcode (Hex)** | **Bytes** | **Cycles** | **Supported** |
|------------|---------------------|------------------|-----------|------------|---------------|
| ORA | Immediate | 0x09 | 2 | 2 | [x] |
| ORA | Zero Page | 0x05 | 2 | 3 | [x] |
| ORA | Zero Page, X | 0x15 | 2 | 4 | [x] |
| ORA | Absolute | 0x0D | 3 | 4 | [x] |
| ORA | Absolute, X | 0x1D | 3 | 4* | [x] |
| ORA | Absolute, Y | 0x19 | 3 | 4* | [x] |
| ORA | (Indirect, X) | 0x01 | 2 | 6 | [x] |
| ORA | (Indirect), Y | 0x11 | 2 | 5* | [x] |

Total number of `ORA` instructions: `8`.

### LDA - Load Accumulator with Memory

| **Opcode** | **Addressing Mode** | **Opcode (Hex)** | **Bytes** | **Cycles** | **Supported** |
|------------|---------------------|------------------|-----------|------------|---------------|
| LDA | Immediate | 0xA9 | 2 | 2 | [x] |
| LDA | Zero Page | 0xA5 | 2 | 3 | [x] |
| LDA | Zero Page, X | 0xB5 | 2 | 4 | [x] |
| LDA | Absolute | 0xAD | 3 | 4 | [x] |
| LDA | Absolute, X | 0xBD | 3 | 4* | [x] |
| LDA | Absolute, Y | 0xB9 | 3 | 4* | [x] |
| LDA | (Indirect, X) | 0xA1 | 2 | 6 | [x] |
| LDA | (Indirect), Y | 0xB1 | 2 | 5* | [x] |

Total number of `LDA` instructions: `8`.

### LDX - Load X Register with Memory

| **Opcode** | **Addressing Mode** | **Opcode (Hex)** | **Bytes** | **Cycles** | **Supported** |
|------------|---------------------|------------------|-----------|------------|---------------|
| LDX | Immediate | 0xA2 | 2 | 2 | [x] |
| LDX | Zero Page | 0xA6 | 2 | 3 | [x] |
| LDX | Zero Page, Y | 0xB6 | 2 | 4 | [x] |
| LDX | Absolute | 0xAE | 3 | 4 | [x] |
| LDX | Absolute, Y | 0xBE | 3 | 4* | [x] |

Total number of `LDX` instructions: `5`.

### LDY - Load X Register with Memory

| **Opcode** | **Addressing Mode** | **Opcode (Hex)** | **Bytes** | **Cycles** | **Supported** |
|------------|---------------------|------------------|-----------|------------|---------------|
| LDY | Immediate | 0xA0 | 2 | 2 | [x] |
| LDY | Zero Page | 0xA4 | 2 | 3 | [x] |
| LDY | Zero Page, Y | 0xB4 | 2 | 4 | [x] |
| LDY | Absolute | 0xAC | 3 | 4 | [x] |
| LDY | Absolute, Y | 0xBC | 3 | 4* | [x] |

Total number of `LDY` instructions: `5`.

### LDY - Load Y Register with Memory

| **Opcode** | **Addressing Mode** | **Opcode (Hex)** | **Bytes** | **Cycles** | **Supported** |
|------------|---------------------|------------------|-----------|------------|---------------|
| LDY | Immediate | 0xA0 | 2 | 2 | [x] |
| LDY | Zero Page | 0xA4 | 2 | 3 | [x] |
| LDY | Zero Page, Y | 0xB4 | 2 | 4 | [x] |
| LDY | Absolute | 0xAC | 3 | 4 | [x] |
| LDY | Absolute, Y | 0xBC | 3 | 4* | [x] |

Total number of `LDY` instructions: `5`.

### STA - Store Accumulator in Memory

| **Opcode** | **Addressing Mode** | **Opcode (Hex)** | **Bytes** | **Cycles** | **Supported** |
|------------|---------------------|------------------|-----------|------------|---------------|
| STA | Zero Page | 0x85 | 2 | 3 | [x] |
| STA | Zero Page, X | 0x95 | 2 | 4 | [x] |
| STA | Absolute | 0x8D | 3 | 4 | [x] |
| STA | Absolute, X | 0x9D | 3 | 4* | [x] |
| STA | Absolute, Y | 0x99 | 3 | 4* | [x] |
| STA | (Indirect, X) | 0x81 | 2 | 6 | [ ] |
| STA | (Indirect), Y | 0x91 | 2 | 5* | [x] |

Total number of `STA` instructions: `7`.

### STX - Store Accumulator in Memory

| **Opcode** | **Addressing Mode** | **Opcode (Hex)** | **Bytes** | **Cycles** | **Supported** |
|------------|---------------------|------------------|-----------|------------|---------------|
| STX | Zero Page | 0x86 | 2 | 3 | [x] |
| STX | Zero Page, Y | 0x96 | 2 | 4 | [x] |
| STX | Absolute | 0x8E | 3 | 4 | [x] |

Total number of `STX` instructions: `3`.

### STY - Store Accumulator in Memory

| **Opcode** | **Addressing Mode** | **Opcode (Hex)** | **Bytes** | **Cycles** | **Supported** |
|------------|---------------------|------------------|-----------|------------|---------------|
| STY | Zero Page | 0x84 | 2 | 3 | [x] |
| STY | Zero Page, Y | 0x94 | 2 | 4 | [x] |
| STY | Absolute | 0x8C | 3 | 4 | [x] |

Total number of `STY` instructions: `3`.

### Transfer Functions

| **Opcode** | **Addressing Mode** | **Opcode (Hex)** | **Bytes** | **Cycles** | **Supported** |
|------------|---------------------|------------------|-----------|------------|---------------|
| TAX | Implied | 0xAA | 1 | 2 | [x] |
| TAY | Implied | 0xA8 | 1 | 2 | [x] |
| TSX | Implied | 0xBA | 1 | 2 | [x] |
| TXA | Implied | 0x8A | 1 | 2 | [x] |
| TXS | Implied | 0x9A | 1 | 2 | [x] |
| TYA | Implied | 0x98 | 1 | 2 | [x] |

Total number of transfer instructions: `6`.

## Contributing

Feel free to submit issues or pull requests. Contributions are welcome!
Expand Down
8 changes: 7 additions & 1 deletion emulator/emulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1447,17 +1447,19 @@ std::array<Instruction, 256> get_instructions()
supported_instructions[0x95] = st_zeropage_indexed(&emulator::Registers::a, &emulator::Registers::x);
supported_instructions[0x99] = sta_absolute_indexed(&emulator::Registers::y);
supported_instructions[0x9d] = sta_absolute_indexed(&emulator::Registers::x);
// supported_instructions[0x81] = sta_absolute_indexed(&emulator::Registers::x);

// STX Instructions
supported_instructions[0x86] = st_zeropage(&emulator::Registers::x);
supported_instructions[0x8e] = st_absolute(&emulator::Registers::x);
supported_instructions[0x96] = st_zeropage_indexed(&emulator::Registers::x, &emulator::Registers::y);

// STY Isntructions
// STY opcodes
supported_instructions[0x84] = st_zeropage(&emulator::Registers::y);
supported_instructions[0x8c] = st_absolute(&emulator::Registers::y);
supported_instructions[0x94] = st_zeropage_indexed(&emulator::Registers::y, &emulator::Registers::x);

// LDA opcodes
supported_instructions[0xa9] = ld_immediate(&emulator::Registers::a);
supported_instructions[0xa5] = ld_zeropage(&emulator::Registers::a);
supported_instructions[0xb5] = ld_zeropage_indexed(&emulator::Registers::a, &emulator::Registers::x);
Expand All @@ -1466,11 +1468,15 @@ std::array<Instruction, 256> get_instructions()
supported_instructions[0xa1] = ld_index_indirect(&emulator::Registers::a, &emulator::Registers::x);
supported_instructions[0xb1] = ld_indirect_index(&emulator::Registers::a);
supported_instructions[0xad] = ld_absolute(&emulator::Registers::a);

// LDX opcodes
supported_instructions[0xa2] = ld_immediate(&emulator::Registers::x);
supported_instructions[0xa6] = ld_zeropage(&emulator::Registers::x);
supported_instructions[0xb6] = ld_zeropage_indexed(&emulator::Registers::x, &emulator::Registers::y);
supported_instructions[0xae] = ld_absolute(&emulator::Registers::x);
supported_instructions[0xbe] = ld_absolute_plus_reg(&emulator::Registers::x, &emulator::Registers::y);

// LDY opcodes
supported_instructions[0xa0] = ld_immediate(&emulator::Registers::y);
supported_instructions[0xa4] = ld_zeropage(&emulator::Registers::y);
supported_instructions[0xb4] = ld_zeropage_indexed(&emulator::Registers::y, &emulator::Registers::x);
Expand Down

0 comments on commit 0069486

Please sign in to comment.