Performance improvements

This commit is contained in:
Stefan Arentz 2017-09-22 01:55:05 +00:00
parent b41e1b658a
commit 9255162ed7

View File

@ -32,21 +32,21 @@
#include "utl.h"
#include "lua.h"
int test(int model, uint16_t start_addr, uint16_t success_addr, char *rom_path) {
int test(int model, uint16_t start_addr, uint16_t success_addr, char *rom_path, int with_lua) {
struct cpu_t *cpu = cpu_create(model);
cpu_add_ram_file(cpu, 0x0000, rom_path);
cpu_reset(cpu);
cpu->state.pc = start_addr;
#if 0
cpu->lua = ewm_lua_create();
ewm_cpu_init_lua(cpu, cpu->lua);
if (with_lua) {
cpu->lua = ewm_lua_create();
ewm_cpu_init_lua(cpu, cpu->lua);
if (ewm_lua_load_script(cpu->lua, "cpu_test.lua") != 0) {
printf("Lua script failed to load\n"); // TODO Move errors reporting into C code
exit(1);
if (ewm_lua_load_script(cpu->lua, "cpu_test.lua") != 0) {
printf("Lua script failed to load\n"); // TODO Move errors reporting into C code
exit(1);
}
}
#endif
uint16_t last_pc = cpu->state.pc;
@ -114,7 +114,12 @@ int test(int model, uint16_t start_addr, uint16_t success_addr, char *rom_path)
int main(int argc, char **argv) {
fprintf(stderr, "TEST Running 6502 tests\n");
test(EWM_CPU_MODEL_6502, 0x0400, 0x3399, "rom/6502_functional_test.bin");
test(EWM_CPU_MODEL_6502, 0x0400, 0x3399, "rom/6502_functional_test.bin", 0);
fprintf(stderr, "TEST Running 65C02 tests\n");
test(EWM_CPU_MODEL_65C02, 0x0400, 0x24a8, "rom/65C02_extended_opcodes_test.bin");
test(EWM_CPU_MODEL_65C02, 0x0400, 0x24a8, "rom/65C02_extended_opcodes_test.bin", 0);
fprintf(stderr, "TEST Running 6502 tests - With Lua\n");
test(EWM_CPU_MODEL_6502, 0x0400, 0x3399, "rom/6502_functional_test.bin", 1);
fprintf(stderr, "TEST Running 65C02 tests - With Lua\n");
test(EWM_CPU_MODEL_65C02, 0x0400, 0x24a8, "rom/65C02_extended_opcodes_test.bin", 1);
}