| 1 | package com.rox.cpu.mos6502.assembler; | |
| 2 | ||
| 3 | /** The 13 addressing modes of the 6502 instruction set, as used by the assembler's operand grammar. */ | |
| 4 | enum AddressingMode { | |
| 5 | IMPLIED, | |
| 6 | ACCUMULATOR, | |
| 7 | IMMEDIATE, | |
| 8 | ZERO_PAGE, | |
| 9 | ZERO_PAGE_X, | |
| 10 | ZERO_PAGE_Y, | |
| 11 | ABSOLUTE, | |
| 12 | ABSOLUTE_X, | |
| 13 | ABSOLUTE_Y, | |
| 14 | INDIRECT, | |
| 15 | INDIRECT_X, | |
| 16 | INDIRECT_Y, | |
| 17 | RELATIVE; | |
| 18 | ||
| 19 | /** @return the number of operand bytes this mode encodes in an instruction, after the opcode byte */ | |
| 20 | int operandByteCount() { | |
| 21 |
1
1. operandByteCount : replaced int return with 0 for com/rox/cpu/mos6502/assembler/AddressingMode::operandByteCount → KILLED |
return switch (this) { |
| 22 | case IMPLIED, ACCUMULATOR -> 0; | |
| 23 | case ABSOLUTE, ABSOLUTE_X, ABSOLUTE_Y, INDIRECT -> 2; | |
| 24 | default -> 1; // IMMEDIATE, ZERO_PAGE(+X/Y), INDIRECT_X, INDIRECT_Y, RELATIVE | |
| 25 | }; | |
| 26 | } | |
| 27 | } | |
Mutations | ||
| 21 |
1.1 |