1
0
mirror of https://github.com/jborza/emu6502.git synced 2024-09-30 03:57:16 +00:00

ORA indirect

This commit is contained in:
jborza 2019-04-14 09:38:09 +02:00
parent b7b199129d
commit 686ba9b601

23
cpu.c
View File

@ -86,24 +86,29 @@ int emulate_6502_op(State6502 * state) {
break; //BRK
case NOP: break; //NOP
case ORA_IND_X: //ORA, indirect, x
unimplemented_instruction(state);
//The address to be accessed by an instruction using X register indexed absolute addressing is computed by taking the 16 bit address
//from the instruction and added the contents of the X register.
//For example if X contains $92 then an STA $2000,X instruction will store the accumulator at $2092 (e.g. $2000 + $92). (STA)
{
word address_indirect = pop_word(state) + state->x;
word address = get_word(state, address_indirect);
ORA(state, state->memory[address]);
break;
}
case ORA_ZP: //ORA, zero page
{
byte address = pop_byte(state);
ORA(state, state->memory[address]);
break;
}
case ORA_IND_Y:
//The value in Y is added to the address at the little-endian address stored at the two-byte pair of the specified address (LSB) and the specified address plus one (MSB).
//The value at the sum address is used to perform the computation. Indeed addressing mode actually repeats exactly the accumulator register's digits.
// Example
//The value $03 in Y is added to the address $C235 at addresses $002A and $002B for a sum of $C238. The value $2F at $C238 is shifted right (yielding $17) and written back to $C238.
//word address = pop_word(state) + state->y;
//word value = get_word(state, address);
//ORA(state, state->memory[value]);
case ORA_IND_Y: //ORA, indirect, y (post_indexed)
{
word address_indirect = pop_word(state);
word address = get_word(state, address_indirect) + state->y;
ORA(state, state->memory[address]);
unimplemented_instruction(state);
break;
}
case ORA_IMM:
ORA(state, pop_byte(state));
break;