Commits

gryf committed 3ccd96c

Fixed bug with unusual sector end

Comments (0)

Files changed (1)

 the emulator for the VIC20, C64, C128 and other computers made by Commodore.
 
 Changelog:
+    2.2 Fixed bug(?) with unusual sector end (marked as sector 0, not 255),
+        causing endless directory reading on random locations.
     2.1 Fixed bug with filenames containing slash.
     2.0 Added reading raw D64 image, and mapping for jokers. Now it is
         possible to read files with PET-ASCII/control sequences in filenames.
     1.0 Initial release
 
 Author: Roman 'gryf' Dobosz <gryf73@gmail.com>
-Date: 2012-09-04
-Version: 2.1
+Date: 2012-09-21
+Version: 2.2
 Licence: BSD
 """
 
         """
 
         filename = list()
-        in_fname = True
 
         for chr_ in string:
+            if ord(chr_) == 160:  # shift+space character; $a0
+                break
+
             character = D64.CHAR_MAP.get(ord(chr_), '?')
-
-            if in_fname:
-                if ord(chr_) == 160:
-                    in_fname = False
-                else:
-                    filename.append(character)
+            filename.append(character)
 
         LOG.debug("string: ``%s'' mapped to: ``%s''", string,
                   "".join(filename))
         Return False if the chain ends, True otherwise
         """
 
-        if self.next_track == 0 and self.next_sector == 255:
+        if self.next_track == 0 and self.next_sector in (0, 255):
             LOG.debug("End of directory")
             return False