summaryrefslogtreecommitdiff
path: root/log
diff options
context:
space:
mode:
Diffstat (limited to 'log')
-rw-r--r--log/log-readable.cpp38
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) { }