Skip to content
Permalink
Browse files

use reset/init routine from kernal ROM if present

  • Loading branch information...
irmen committed Jul 11, 2018
1 parent e65737c commit f607170cf048a4ef34e186c5fa95574959828f95
Showing with 4 additions and 3 deletions.
  1. +4 −3 pyc64/memory.py
@@ -270,13 +270,14 @@ def __init__(self, columns=40, rows=25, sprites=8, rom_directory=""):
self.using_roms = True
except IOError:
print("can't load rom-file {:s}/{:s}, consider supplying it".format(rom_directory, rom))
# apply some ROM patches to make the reset routine work on the simulator:
self.memory._patch(0xe388, 0x4c) # JMP to same address near the end of the reset routine
self.memory._patch(0xe389, 0x88) # to avoid entering actual basic program loop. RTS won't work because the stack is clobbered I think.
self.memory._patch(0xe38a, 0xe3) # (this jmp loop is recognised by the cpu emulator as an 'end of the program')
self.memory._patch(0xe389, 0x88) # ...to avoid entering actual basic program loop. RTS won't work because the stack is clobbered I think.
self.memory._patch(0xe38a, 0xe3) # ...(this jmp loop is recognised by the cpu emulator as an 'end of the program')
# self.memory._patch(0xfce5, 0xea) # NOP to not clobber stack pointer register in reset routine
self.memory._patch(0xfcf6, 0x90) # skip a large part of the memory init routine that is very slow and may cause issues
self.memory._patch(0xff61, 0xea) # NOP to skip a loop in the reset routine
self.memory._patch(0xff62, 0xea) # NOP to skip a loop in the reset routine
self.memory._patch(0xfcf6, 0x90) # skip a large part of the memory init routine that is very slow and may cause issues
self.hz = 60 # NTSC
self.columns = columns
self.rows = rows

0 comments on commit f607170

Please sign in to comment.
You can’t perform that action at this time.