From e358de5cebf6f2e8b38638c3afeb9df3a848fb1d Mon Sep 17 00:00:00 2001 From: Ross Wilson Date: Mon, 29 Feb 2016 15:30:01 +0700 Subject: [PATCH] Better handling of end-of-tape --- idasm/loadptp.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/idasm/loadptp.py b/idasm/loadptp.py index 0c81a36..2279ae3 100755 --- a/idasm/loadptp.py +++ b/idasm/loadptp.py @@ -92,7 +92,11 @@ def skipzeros(ptp_data, index): """ while True: - val = ptp_data[index] + try: + val = ptp_data[index] + except IndexError: + # off end of tape + return None if val > 0: return index index += 1 @@ -174,7 +178,7 @@ def c8lds_handler(ptp_data, memory): # skip any leading zeros index = skipzeros(ptp_data, index) if index is None: - break + return (None, None) # end of tape # get data word count result = get_byte(ptp_data, index)