orao/orao/video.py

15 lines
432 B
Python
Raw Normal View History

2023-10-28 11:22:41 +00:00
# -*- coding: utf-8 -*-
import pygame
terminal = pygame.Surface((256, 256), pygame.SRCALPHA, depth=32)
terminal.fill((255, 255, 255))
alphaarray = pygame.surfarray.pixels_alpha(terminal)
2023-10-28 11:22:41 +00:00
2021-09-16 14:07:58 +00:00
def mem_listener(addr, val, cpu):
2023-10-28 11:22:41 +00:00
if 0x6000 <= addr <= 0x7FFF: # Video RAM
y, x = divmod((addr - 0x6000) * 8, 256)
for i in range(8):
alphaarray[x + i, y] = 255 if (val >> i) & 1 else 40 # Transparency mask