From 876ae08cf31f4003ccfee22da87efa6102cd90dd Mon Sep 17 00:00:00 2001 From: Byron Lathi Date: Sun, 29 Oct 2023 21:38:04 -0700 Subject: [PATCH] Fix off by 1 in o65 option decoding --- sw/bios/boot2.s | 1 - sw/script/o65dump.py | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sw/bios/boot2.s b/sw/bios/boot2.s index 7f8a0cd..6fd2cce 100644 --- a/sw/bios/boot2.s +++ b/sw/bios/boot2.s @@ -263,7 +263,6 @@ _start: clc adc olen dec - dec pha bra @opt_len diff --git a/sw/script/o65dump.py b/sw/script/o65dump.py index 4318bb8..91f6b40 100755 --- a/sw/script/o65dump.py +++ b/sw/script/o65dump.py @@ -88,10 +88,14 @@ def main() -> None: print(filename) o65 = O65(filename) for item, value in o65.header.items(): - print(f"{item}:\t{value:x}") + print(f"{item}:\t{value:#x}") + total_olen = 0 for option in o65.options: - print(f"Type: {option[1]}, Data: {option[2]}") + print(f"Length: {option[0]:#x} Type: {option[1]:#x}, Data: {option[2]}") + total_olen += option[0] + + print(f"Total option length: {total_olen:#x}") print(f"Text size: {len(o65.text)}") print(f"Data size: {len(o65.data)}")