From adf1a4c1dc1abd1d1520ca3134398744717f4b30 Mon Sep 17 00:00:00 2001 From: Samuel Deutsch Date: Sun, 4 Oct 2020 05:51:04 -0700 Subject: [PATCH] NOVA: Fix carry display in CPU instruction history Problem: Currently when viewing the Nova CPU history the carry flag is always displayed as 0 regardless of it's actual value at the time. Cause: The carry bit is stored in bit 17 and is lost when stored into the int16 carry member of struct Hist_entry Solution: Shift carry into bit 0 before storing it in the CPU history. Improve code for displaying carry bit. --- NOVA/nova_cpu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/NOVA/nova_cpu.c b/NOVA/nova_cpu.c index 05c63ab9..beab03f5 100644 --- a/NOVA/nova_cpu.c +++ b/NOVA/nova_cpu.c @@ -1,6 +1,6 @@ /* nova_cpu.c: NOVA CPU simulator - Copyright (c) 1993-2017, Robert M. Supnik + Copyright (c) 1993-2020, Robert M. Supnik Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -25,6 +25,7 @@ cpu Nova central processor + 03-Oct-20 RMS Fixed bug in history handling of C bit (Samuel Deutsch) 07-Sep-17 RMS Fixed sim_eval declaration in history routine (COVERITY) 17-Mar-13 RMS Added clarifying brances to IND_STEP macro (Dave Bryan) 04-Jul-07 BKR DEV_SET/CLR macros now used, @@ -1316,7 +1317,7 @@ if ( hist ) hist_ptr->ac1 = AC[ 1 ] ; hist_ptr->ac2 = AC[ 2 ] ; hist_ptr->ac3 = AC[ 3 ] ; - hist_ptr->carry = C ; + hist_ptr->carry = C >> 16 ; hist_ptr->fp = FP ; hist_ptr->sp = SP ; hist_ptr->devBusy = dev_busy ; @@ -1388,7 +1389,7 @@ if ( hptr ) (hptr->ac1 & 0xFFFF), (hptr->ac2 & 0xFFFF), (hptr->ac3 & 0xFFFF), - ((hptr->carry) ? 1 : 0) + (hptr->carry & 1) ) ; if ( cpu_unit.flags & UNIT_STK /* Nova 3 or Nova 4 */ ) {