mirror of
https://github.com/jborza/emu6502.git
synced 2024-11-25 03:34:40 +00:00
re-enabled tests
This commit is contained in:
parent
d4bbfaba95
commit
8f218de40d
10
cpu.c
10
cpu.c
@ -74,7 +74,7 @@ word pop_word(State6502 * state) {
|
|||||||
return result;
|
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;
|
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)
|
//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_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]);
|
ORA(state, state->memory[address]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ int emulate_6502_op(State6502 * state) {
|
|||||||
case ORA_INDY: //ORA, indirect, y (post_indexed)
|
case ORA_INDY: //ORA, indirect, y (post_indexed)
|
||||||
{
|
{
|
||||||
word address_indirect = pop_word(state);
|
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]);
|
ORA(state, state->memory[address]);
|
||||||
unimplemented_instruction(state);
|
unimplemented_instruction(state);
|
||||||
break;
|
break;
|
||||||
@ -177,7 +177,7 @@ int emulate_6502_op(State6502 * state) {
|
|||||||
//zero-page address is added to x register
|
//zero-page address is added to x register
|
||||||
byte indirect_address = pop_byte(state) + state->x;
|
byte indirect_address = pop_byte(state) + state->x;
|
||||||
//pointing to address of a word holding the address of the operand
|
//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]);
|
LDA(state, state->memory[address]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -185,7 +185,7 @@ int emulate_6502_op(State6502 * state) {
|
|||||||
{
|
{
|
||||||
//post-indexed indirect
|
//post-indexed indirect
|
||||||
byte indirect_address = pop_byte(state);
|
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]);
|
LDA(state, state->memory[address]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
12
emu6502.c
12
emu6502.c
@ -211,12 +211,12 @@ void test_LDA_INDY() {
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
//test_LDA_IMM();
|
test_LDA_IMM();
|
||||||
//test_LDA_ZP();
|
test_LDA_ZP();
|
||||||
//test_LDA_ZPX();
|
test_LDA_ZPX();
|
||||||
//test_LDA_ABS();
|
test_LDA_ABS();
|
||||||
//test_LDA_ABSX();
|
test_LDA_ABSX();
|
||||||
//test_LDA_ABSY();
|
test_LDA_ABSY();
|
||||||
test_LDA_INDX();
|
test_LDA_INDX();
|
||||||
test_LDA_INDY();
|
test_LDA_INDY();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user