changeset 111:872637684299

NES_ROM: limit byte-shifting functions to 8 bytes There's no need to move beyond those 8 bytes in either direction, and it simplifies some things to assume this limit.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Thu, 19 Sep 2019 17:09:02 -0400
parents 5858225c600e
children b6002eead003
files nes.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/nes.py
+++ b/nes.py
@@ -59,12 +59,18 @@
             tile.clear_caches()
 
     def byte_forward(self):
+        if self.initial_position == -8:
+            return
+
         x = self.tile_data.pop(0)
         self.tile_data.append(x)
         self.initial_position -= 1
         self.update_tiles()
 
     def byte_backward(self):
+        if self.initial_position == 8:
+            return
+
         x = self.tile_data.pop(-1)
         self.tile_data.insert(0, x)
         self.initial_position += 1