Enable abusive CPU_TRACING test

This commit is contained in:
Aaron Culliney 2014-11-02 12:09:30 -08:00
parent c7c888d218
commit 9144b48885
3 changed files with 23 additions and 23 deletions

View File

@ -727,7 +727,7 @@ GLUE_C_WRITE(cpu65_trace_epilogue)
switch (opcodes_65c02[cpu65_opcode].mode) {
case addr_implied:
case addr_accumulator: /* no arg */
sprintf(buf, "%04X: %02X %s %s", current_pc, cpu65_opcode, opcodes_65c02[cpu65_opcode].mnemonic, disasm_templates[opcodes_65c02[cpu65_opcode].mode]);
sprintf(buf, "%04X:%02X %s %s", current_pc, cpu65_opcode, opcodes_65c02[cpu65_opcode].mnemonic, disasm_templates[opcodes_65c02[cpu65_opcode].mode]);
break;
case addr_immediate:
@ -737,7 +737,7 @@ GLUE_C_WRITE(cpu65_trace_epilogue)
case addr_indirect:
case addr_indirect_x:
case addr_indirect_y: /* byte arg */
sprintf(fmt, "%04X: %02X%02X %s %s", current_pc, cpu65_opcode, (uint8_t)arg1, opcodes_65c02[cpu65_opcode].mnemonic, disasm_templates[opcodes_65c02[cpu65_opcode].mode]);
sprintf(fmt, "%04X:%02X%02X %s %s", current_pc, cpu65_opcode, (uint8_t)arg1, opcodes_65c02[cpu65_opcode].mnemonic, disasm_templates[opcodes_65c02[cpu65_opcode].mode]);
sprintf(buf, fmt, (uint8_t)arg1);
break;
@ -746,12 +746,12 @@ GLUE_C_WRITE(cpu65_trace_epilogue)
case addr_absolute_y:
case addr_j_indirect:
case addr_j_indirect_x: /* word arg */
sprintf(fmt, "%04X: %02X%02X%02X %s %s", current_pc, cpu65_opcode, (uint8_t)arg1, (uint8_t)arg2, opcodes_65c02[cpu65_opcode].mnemonic, disasm_templates[opcodes_65c02[cpu65_opcode].mode]);
sprintf(fmt, "%04X:%02X%02X%02X %s %s", current_pc, cpu65_opcode, (uint8_t)arg1, (uint8_t)arg2, opcodes_65c02[cpu65_opcode].mnemonic, disasm_templates[opcodes_65c02[cpu65_opcode].mode]);
sprintf(buf, fmt, (uint8_t)arg1, (uint8_t)arg2);
break;
case addr_relative: /* offset */
sprintf(fmt, "%04X: %02X%02X %s %s", current_pc, cpu65_opcode, (uint8_t)arg1, opcodes_65c02[cpu65_opcode].mnemonic, disasm_templates[opcodes_65c02[cpu65_opcode].mode]);
sprintf(fmt, "%04X:%02X%02X %s %s", current_pc, cpu65_opcode, (uint8_t)arg1, opcodes_65c02[cpu65_opcode].mnemonic, disasm_templates[opcodes_65c02[cpu65_opcode].mode]);
if (arg1 < 0) {
sprintf(buf, fmt, current_pc + arg1 + 2, '-', (uint8_t)(-arg1));
} else {

View File

@ -99,12 +99,10 @@ TEST test_boot_disk_bytes() {
PASS();
}
#if 0
#error this is not a stable test ... we don't know exactly where the CPU will be at when we begin
// This test is fairly abusive ... it creates an ~88MB file in $HOME
// ... but if it's correct, you're fairly assured the cpu/vm is working =)
#define EXPECTED_CPU_TRACE_FILE_SIZE 87611579
#define EXPECTED_CPU_TRACE_SHA "8DE74ED640E0CE4AB1AAC40E95BE9B8507A37434"
#define EXPECTED_CPU_TRACE_FILE_SIZE 86057107
#define EXPECTED_CPU_TRACE_SHA "525098EDD23E4602791D0167DAE0FB65ACE33ABD"
TEST test_boot_disk_cputrace() {
char *homedir = getenv("HOME");
char *output = NULL;
@ -141,7 +139,6 @@ TEST test_boot_disk_cputrace() {
PASS();
}
#endif
TEST test_boot_disk() {
BOOT_TO_DOS();
@ -3352,9 +3349,7 @@ GREATEST_SUITE(test_suite_vm) {
// TESTS --------------------------
RUN_TESTp(test_boot_disk_bytes);
//RUN_TESTp(test_boot_disk_cputrace);
RUN_TESTp(test_boot_disk_cputrace);
RUN_TESTp(test_boot_disk);
RUN_TESTp(test_inithello_dsk);

View File

@ -24,6 +24,18 @@
#define DebugCurrOpcode SN(cpu65_opcode)
#define DebugCycleCount SN(cpu65_opcycles)
#define CommonSaveCPUState() \
movw EffectiveAddr, DebugCurrEA; \
movb A_Reg, SN(cpu65_a); \
xorw %ax, %ax; \
movb F_Reg, %al; \
SNX_PROLOGUE(cpu65_flags_encode); \
movb SNX(cpu65_flags_encode,_XAX,1), %al; \
movb %al, SN(cpu65_f); \
movb X_Reg, SN(cpu65_x); \
movb Y_Reg, SN(cpu65_y); \
movb SP_Reg_L, SN(cpu65_sp)
#if CPU_TRACING
# define TRACE_PROLOGUE \
movw PC_Reg, SN(cpu65_pc); \
@ -35,7 +47,9 @@
# define TRACE_ARG2 \
callLQ CALL(cpu65_trace_arg2);
# define TRACE_EPILOGUE \
movw EffectiveAddr, DebugCurrEA; \
pushLQ _XAX; \
CommonSaveCPUState(); \
popLQ _XAX; \
callLQ CALL(cpu65_trace_epilogue);
#else
# define TRACE_PROLOGUE
@ -2238,17 +2252,8 @@ E(cpu65_run)
exit_cpu65_run:
// Save CPU state when returning from being called from C
movw EffectiveAddr, DebugCurrEA
movw PC_Reg, SN(cpu65_pc)
movb A_Reg, SN(cpu65_a)
xorw %ax, %ax
movb F_Reg, %al
SNX_PROLOGUE(cpu65_flags_encode)
movb SNX(cpu65_flags_encode,_XAX,1), %al
movb %al, SN(cpu65_f)
movb X_Reg, SN(cpu65_x)
movb Y_Reg, SN(cpu65_y)
movb SP_Reg_L, SN(cpu65_sp)
CommonSaveCPUState()
jmp exit_frame
emul_reinit: movb $0, SN(cpu65__signal)