Labels are now in a json file instead of a dumb custom format. This
should make things easier to maintain, both in code and data. Address
values are in hexadecimal format inside strings.
The CDL handling has been cleaned up a bit. Internally, all the values
are indexed by CPU address instead of by file offset. This is done
because it seems that *all* of the tapes put *all* of their scripts
starting at $6000. The only difference between locations is the bank ID
used. An offset of +/-0x6000 has been added in a bunch of places to keep
the index values in CPU address space.
Additionally, setting CDL data for Data has been fixed. This includes
creating tokens for Unknown and Data bytes so they can be output in the
source. They will have a label of either "UNKN" or "DATA" in the
bytecode column.
Some smaller things:
- EntryPoints array is now in the CDL, allowing to add more starting
points for SmartParse().
- script-decode.go now accepts a --no-addr-prefix to suppress the
address output on the beginning of each line of script. This enables
diffing scripts and having the output mean something.
- `push_data` string has been tweaked. Instead of using %q for
everything, we build a string from scratch. If there are no bytes
outside of the ASCII printable character range just print the ASCII.
Otherwise, print out the hex value for every byte. If an individual
byte is printable ASCII, print that charater in curly brackets.
- Label files will be updated with auto-generated labels.
- Provding a non-existent filename for labels or CDL will print a
warning, but will write out a file if no other errors occur.
- Added DebugCDL() that will write the raw CDL values to a file. This
enables comparing the CDL values directly to the script binary.
- Added newlines after `long_return` and `long_jump`
- CDL data can now be output to a file. If --cdl-output isn't given,
but --cdl is given, the input file is overwritten with the new data.
If no CDL file is given no data is written.
- Count arguments as "Code"
- The SmartParse function no longer creates a new CDL. It will use and
update what it was given.
- The just-stats command does not write CDL data even though it
generates it.
Variable length arguments are not properly handled yet. Currently, just
the OP code and first argument (length) are set at Code. The rest are
ignored.
- Added a CDL implementation. It is still very incomplete and is not
really used yet.
- Added "smart" parsing. This will disassemble the code and follow any
jumps and calls. Anything not found by this is currently excluded
from output.
Labels are now their own object instead of just a string. This allows
for a bit more control with them. Labels can also now have comments.
Additionally, add the ability to load user-defined labels from a file.
The format of this file is subject to change, but for now it is just a
simple text file. Each line of the file is a label definition. Each
line has three fields, separated by spaces. The first field is the
address, second is the label name, and the rest of the line is a
comment. If a label name is just a dollar sign ($) it will not have a
name. This is used when adding comments without a bespoke label.
- Fixed instructions that have -3 as the OpCount (count then count
words). There is not an extra word that acts as the default
selection. These instructions do nothing if the argument is out of
range.
- Fixed off-by-one eating the byte following the -3 OpCount
instructions.
- Fixed panic when a -2 op code goes beyond the end of the script.
Starting with some script parsing. This script is the Domain Specific
Language that is on the tapes of the studybox. Not every opcode is
fully decoded/named yet.