diff options
author | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-12-07 17:34:18 +1100 |
---|---|---|
committer | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-12-07 17:34:18 +1100 |
commit | f8df4908fe6986e691ea96b4b07ffbff349ccce0 (patch) | |
tree | a868c23e64fb41bd1e25d3e4f34d738ebd0c549a /log | |
parent | 68cdad3be01539e583627e1c8929f182255541be (diff) |
changed shift ins.s and now log CPU state
Diffstat (limited to 'log')
-rw-r--r-- | log/log-readable.cpp | 38 |
1 files changed, 25 insertions, 13 deletions
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) { } |