From f8df4908fe6986e691ea96b4b07ffbff349ccce0 Mon Sep 17 00:00:00 2001 From: alekseiplusplus Date: Thu, 7 Dec 2023 17:34:18 +1100 Subject: changed shift ins.s and now log CPU state --- log/log-readable.cpp | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'log') diff --git a/log/log-readable.cpp b/log/log-readable.cpp index 82e263d..e110cdc 100644 --- a/log/log-readable.cpp +++ b/log/log-readable.cpp @@ -37,24 +37,36 @@ int main() ifstream Log("log.raw"); ofstream Output("log.new"); - Output << "Time PC Label Instruction Comment\n" << endl; + Output << "Time PC acc X Y Flags S Label Instruction Comment\n" << endl; while(!Log.eof()) { + string pc; string t; - // Expects time counter, and prints. - Log >> t; - Output << t; - // Expecting a delimiter surrounded with space. - Log >> t; - Output << " : "; - // Expecting program counter - Log >> t; - Output << t; +#define GobbleDelimiter Log >> t; Output << " : " + // Time Counter + Log >> t; Output << t; GobbleDelimiter; + // Program counter + Log >> pc; Output << pc; GobbleDelimiter; + // acc + Log >> t; Output << t; GobbleDelimiter; + // X + Log >> t; Output << t; GobbleDelimiter; + // Y + Log >> t; Output << t; GobbleDelimiter; + // Flags for( ) + for (int i = 0; i < 8; i++) { + char c; + Log >> c; + Output << c; + } + GobbleDelimiter; + //Log >> t; Output << t; GobbleDelimiter; + // Stack Pointer + Log >> t; Output << t; // If a mapping exists, print out the program counter and line code. try { - string s = Convert[t]; - Output << t << " : "; - Output << s; + string s = Convert[pc]; + Output << " " << s; } // Otherwise, don't do anything. catch (out_of_range) { } -- cgit v1.2.3