This commit is contained in:
FyloZ 2023-09-22 14:39:25 -04:00
parent 75516e41cf
commit 69e730141a
Signed by: william
GPG Key ID: 835378AE9AF4AE97
7 changed files with 43 additions and 1 deletions

BIN
bin/emu

Binary file not shown.

BIN
obj/cpu.o

Binary file not shown.

View File

@ -18,10 +18,16 @@
#include <stdio.h>
#include <stdlib.h>
#define test(x) \
print_##x(x)
long cpu_clock = 0;
void cpu_step_to(long cycle) {
cpu_clock = cycle;
printf("Clock: %ld", cpu_clock);
test(f);
// test("b");
}

26
src/cpu/op.c Normal file
View File

@ -0,0 +1,26 @@
#include "op.h"
#define IS_ALU_OP_CODE_(op, offset) \
case op + offset: \
op_##op(); \
break;
#define IS_ALU_OP_CODE(op) \
IS_ALU_OP_CODE_(op, 0x01) \
IS_ALU_OP_CODE_(op, 0x05) \
IS_ALU_OP_CODE_(op, 0x09) \
IS_ALU_OP_CODE_(op, 0x0d) \
IS_ALU_OP_CODE_(op, 0x11) \
IS_ALU_OP_CODE_(op, 0x15) \
IS_ALU_OP_CODE_(op, 0x19) \
IS_ALU_OP_CODE_(op, 0x1d)
void process_op_code(int op) {
switch (op) {
IS_ALU_OP_CODE(AND)
}
}
void op_AND() {
}

10
src/cpu/op.h Normal file
View File

@ -0,0 +1,10 @@
enum op_code {
ORA = 0x00,
AND = 0x20,
EOR = 0x40,
ADC = 0x60,
STA = 0x80,
LDA = 0xa0,
CMP = 0xc0,
SBC = 0xe0
};

View File

@ -17,7 +17,7 @@
*/
#include <stdlib.h>
#include "cpu.h"
#include "cpu/cpu.h"
long master_clock = 0;