fix: pass cpu to mem_listener

This commit is contained in:
shokre 2021-09-16 16:07:58 +02:00
parent d0f6126307
commit 8b1cd8c99b
2 changed files with 2 additions and 2 deletions

View file

@ -103,7 +103,7 @@ class CPU(object):
self.memory[addr] = val & 0xFF
for listener in self.store_mem_listeners:
listener(addr, val)
listener(addr, val, self)
def stack_push(self, value):
self.store_byte(256 + self.sp, value & 0xFF)

View file

@ -4,7 +4,7 @@ terminal = pygame.Surface((256, 256), pygame.SRCALPHA, depth=32)
terminal.fill((255, 255, 255))
alphaarray = pygame.surfarray.pixels_alpha(terminal)
def mem_listener(addr, val):
def mem_listener(addr, val, cpu):
if 0x6000 <= addr <= 0x7FFF: # Video RAM
y, x = divmod((addr - 0x6000) * 8, 256)
for i in range(8):