From 8f218de40d2f4ac8ac1fce2189265e3acf5c99e6 Mon Sep 17 00:00:00 2001 From: jborza Date: Sun, 14 Apr 2019 11:55:35 +0200 Subject: [PATCH] re-enabled tests --- cpu.c | 10 +++++----- emu6502.c | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cpu.c b/cpu.c index 68fa7ca..fa3562d 100644 --- a/cpu.c +++ b/cpu.c @@ -74,7 +74,7 @@ word pop_word(State6502 * state) { return result; } -word get_word(State6502 * state, word address) { +word read_word(State6502 * state, word address) { return state->memory[address] | state->memory[address + 1] << 8; } @@ -91,7 +91,7 @@ int emulate_6502_op(State6502 * state) { //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); + word address = read_word(state, address_indirect); ORA(state, state->memory[address]); break; } @@ -104,7 +104,7 @@ int emulate_6502_op(State6502 * state) { case ORA_INDY: //ORA, indirect, y (post_indexed) { word address_indirect = pop_word(state); - word address = get_word(state, address_indirect) + state->y; + word address = read_word(state, address_indirect) + state->y; ORA(state, state->memory[address]); unimplemented_instruction(state); break; @@ -177,7 +177,7 @@ int emulate_6502_op(State6502 * state) { //zero-page address is added to x register byte indirect_address = pop_byte(state) + state->x; //pointing to address of a word holding the address of the operand - word address = get_word(state, indirect_address); + word address = read_word(state, indirect_address); LDA(state, state->memory[address]); break; } @@ -185,7 +185,7 @@ int emulate_6502_op(State6502 * state) { { //post-indexed indirect byte indirect_address = pop_byte(state); - word address = get_word(state, indirect_address) + state->y; + word address = read_word(state, indirect_address) + state->y; LDA(state, state->memory[address]); break; } diff --git a/emu6502.c b/emu6502.c index ea3f3cb..cee5efa 100644 --- a/emu6502.c +++ b/emu6502.c @@ -211,12 +211,12 @@ void test_LDA_INDY() { int main() { - //test_LDA_IMM(); - //test_LDA_ZP(); - //test_LDA_ZPX(); - //test_LDA_ABS(); - //test_LDA_ABSX(); - //test_LDA_ABSY(); + test_LDA_IMM(); + test_LDA_ZP(); + test_LDA_ZPX(); + test_LDA_ABS(); + test_LDA_ABSX(); + test_LDA_ABSY(); test_LDA_INDX(); test_LDA_INDY(); }