changeset 2274:bf1bb893f104

Properly ignore low bits of SP start address in disassembler
author Michael Pavone <pavone@retrodev.com>
date Thu, 29 Dec 2022 22:44:35 -0800
parents ff726f53d75a
children e27ab5f4bfe3
files dis.c
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dis.c	Thu Dec 29 19:52:40 2022 -0800
+++ b/dis.c	Thu Dec 29 22:44:35 2022 -0800
@@ -252,6 +252,7 @@
 				do_cd_labels = 1;
 			} else {
 				uint32_t sub_start =filebuf[0x40/2] << 16 | filebuf[0x42/2];
+				sub_start &= ~0x7FF;
 				uint32_t sub_end = sub_start + (filebuf[0x44/2] << 16 | filebuf[0x46/2]);
 				if (sub_start > (boot_size - 0x20)) {
 					fprintf(stderr, "System Program start offset is %X, but image is only %X bytes\n", sub_start, (uint32_t)boot_size);