Commit Graph

5 Commits

Author SHA1 Message Date
Zorchenhimer 193ce21297
[script] Rework CDL & Label stuff
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`
2025-09-21 22:26:59 -04:00
Zorchenhimer 11cfad1e1a
[script] Add CDL; Add "smart" parsing
- 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.
2025-09-14 16:52:06 -04:00
Zorchenhimer 4b9f04874b
[script] Better auto label support
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.
2025-09-06 22:38:39 -04:00
Zorchenhimer 468f7c780a
Some stuff with the script decoding
I honestly don't remember what these changes are, lol.
2024-09-29 15:03:21 -04:00
Zorchenhimer 6c72977f17
Initial commit
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.
2024-04-27 15:19:14 -04:00