From 45813c492b454cbc4d17aa6db154e64ee6699d0d Mon Sep 17 00:00:00 2001 From: Stefan Arentz Date: Fri, 22 Sep 2017 11:36:24 +0000 Subject: [PATCH] Update cpu_test.lua --- src/cpu_test.lua | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/src/cpu_test.lua b/src/cpu_test.lua index 9ef2343..639ec28 100644 --- a/src/cpu_test.lua +++ b/src/cpu_test.lua @@ -1,31 +1,13 @@ --- EWM Meets Lua -local function myerrhandler(err) - print(err) - print(debug.traceback()) - return false -end +cpu:onBeforeExecuteInstruction(0x60, function(cpu, opcode, operand) +end) --- TODO How do we do this in C? -xpcall(function() - -- Add some random intercepts to measure the performance impact +cpu:onBeforeExecuteInstruction(0x20, function(cpu, opcode, operand) +end) - local cpu = require 'cpu' +cpu:onAfterExecuteInstruction(0x60, function(cpu, opcode, operand) +end) - cpu.onBeforeExecuteInstruction(0x60, function(state, opcode, operand) - --print(string.format('Before RTS from 0x%.4x', state.pc)) - end) +cpu:onAfterExecuteInstruction(0x20, function(cpu, opcode, operand) +end) - cpu.onBeforeExecuteInstruction(0x20, function(state, opcode, operand) - --print(string.format('Before JSR from 0x%.4x', state.pc)) - end) - - cpu.onAfterExecuteInstruction(0x60, function(state, opcode, operand) - --print(string.format('After RTS from 0x%.4x', state.pc)) - end) - - cpu.onAfterExecuteInstruction(0x20, function(state, opcode, operand) - --print(string.format('After JSR from 0x%.4x', state.pc)) - end) - -end , myerrhandler)