From 4b2b1a425e3abacdb30d098e36dafdaa15d88191 Mon Sep 17 00:00:00 2001 From: Byron Lathi Date: Fri, 25 Aug 2023 21:26:28 -0700 Subject: [PATCH] Parse options properly --- sw/bios/boot2.s | 27 ++++++++++++++++++++++++--- sw/script/o65dump.py | 3 +++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/sw/bios/boot2.s b/sw/bios/boot2.s index fc723ef..4dd9e42 100644 --- a/sw/bios/boot2.s +++ b/sw/bios/boot2.s @@ -205,10 +205,12 @@ _start: stx dlen + 1 ldy #O65_OPT_START + phy @opt_len: lda #opt_str jsr pushax + ply lda filebuf,y beq @opt_end sta olen @@ -220,12 +222,30 @@ _start: sta otype phy jsr pusha0 - ply ldy #$6 jsr _cprintf + lda #word_str + jsr pushax + + pla + adc olen + dec + dec + pha + bra @opt_len + @opt_end: - ; do something + iny ; account for reading size + phy + lda #opt_done + jsr pushax + pla + jsr pusha0 + ldy #$4 + jsr _cprintf @end: bra @end @@ -236,4 +256,5 @@ kernel_str: .asciiz "KERNEL O65" _good: .asciiz "Found KERNEL\r\n" word_str: .asciiz "Word Value: %x\r\n" -opt_str: .asciiz "Opt Len: %x, Opt Type: %x\r\n" \ No newline at end of file +opt_str: .asciiz "Opt Len: %x, Opt Type: %x\r\n" +opt_done: .asciiz "Options done. total option length: %x\r\n" \ No newline at end of file diff --git a/sw/script/o65dump.py b/sw/script/o65dump.py index 637de94..4318bb8 100755 --- a/sw/script/o65dump.py +++ b/sw/script/o65dump.py @@ -37,6 +37,9 @@ class O65(): self.options.append((olen, otype, obytes)) olen = int.from_bytes(_file.read(1)) + text_offs = _file.tell() + print(f"Text offset: {text_offs}") + self.text = _file.read(self.header["tlen"]) self.data = _file.read(self.header["dlen"])