I worked a lot on the project on the weekend. It is really a great feeling you get when building something.
From having two routes for the project (Simulator, "Text/Html Compiler" using an Intermediate Representation) I introduced a third route on sunday which is a Comparer of two Source Files.
Let me summarize, how it came:
After being satisfied with the generated Html files from the commented Source Code (ROM-4A_Acomplete.a99, ROM-4A_Bcomplete.a99, ROM-4A_Ccomplete.a99) I did go back to my collection of other Source Files.
The Cyc Dvd features a very nice file called con4ar0.txt in the path \vendors\ti\internal\consrc, which also represents the source code for Rom 0 of the TI-99/4A, therefore Memory Range >0000 - >1FFF.
So we are talking about a file that is about the same Memory Range and basically should compile to the same binary like the combination of the upper 3 files.
Never the less the Symbol Names are many times different. And there are many times that the file ROM-4A_A.a99 only features the resolved Value while there is a nicely named Symbol in con4ar0.txt.
con4ar0.txt has some different but also familiar looking format, and looks to be like some list output file from some TI-990 Assembler.
The original source code lines got trimmed because the lines got intended by adding line numbers, memory address and compiled values to the left. That sadly trimmed some of the valuable comments.
After playing a bit in Notepad++ I got the file back to the supposed original source code format, so I was able to run it into the Text/Html Compiler.
The Text Compiler is meant to recreate a perfect looking copy of the scanned file from the intermediate Representation, even though the various strings (">1000", ">0C", "124", "R4") got read in as correct objects with a value instead of a (not-so-intelligent) string representation.
It takes into account zero leading numbers, stores whether a number was in hexadecimal or decimal Format in the original File and the spacing and positioning of Label, Opcode, Operands and Comments.
con4ar0.txt brought some minor challenges:
+ last line in text file doesn't end with line break
+ spaces after the last non-whitespace Character in the line
+ first use of BYTE and EVEN opcodes and the requirements of their effect on the Memory address line.
After taking care of those the Text Compiler recreated a .txt file that was identical to the scanned in file of con4ar0.txt as well.
The Html Compiler created a well looking file with the Memory addresses matching the ones from TI Intern, at least on all occations I have checked.
After starting a manul comparison of ROM-4A_A.a99 with con4ar0.txt I have immediately detected the need to introduce some rendering options to allow proper comparison
+ Option to turn off keeping leading zero digits in numbers
+ Settings how to render Workspace Registers, whether always use R as Prefix or never or keep the original way from the scanned line.
+ Settings how to render Numbers, whether to always render as Hexadecimal or always as Decimal or keep the original way from the scanned line.
+ Option to not render Empty Lines
+ Option to not render Comment Lines
+ Option to not render Comments
+ Option to Merge lines where Labels are defined in a dedicated line, with the actual opcode following in the line below, to one line only. (tricky one)
It required some intensive changes, but the Text/Html Compiler can now recreate the Text/Html File based on the given Rendering Options.
The two source code files look a lot more comparable already with the right set of renderOptions already.
The last thing I am currently working on and I hope that clears out most of the remaining diffs, is an option to resolve Symbolic References to their actual value.
Besides those I only see that one file might use DATA to define a word while the other file uses BYTE twice to define the same. So this might also be something to integrate into Rendering Options.
Edited by kl99, Mon Feb 12, 2018 6:46 AM.