Display

This module encapsulates the PyGame library and provides a mixin class ScreenRAMMixin for the oberon.risc.ByteAddressed32BitRAM class that visualizes the memory-mapped raster display on a PyGame surface.

oberon.display.DISPLAY_SIZE_IN_BYTES = 98304

As the name implies, the number of bytes in the display portion of the RAM.

oberon.display.DISPLAY_START = 950016

RAM address of the start of the memory-mapped raster display.

oberon.display.SIZE = (1024, 768)

Size of the screen in pixels.

class oberon.display.ScreenRAMMixin[source]

A mixin class for the oberon.risc.ByteAddressed32BitRAM that updates the PyGame screen pixels when data are written to RAM addresses within the memory-mapped raster display.

put(address, word)[source]

Extends oberon.risc.ByteAddressed32BitRAM.put() to check for writes to the memory-mapped raster display RAM and update the PyGame screen accordingly.

set_screen(screen)[source]

Connect a PyGame surface to the RAM.

oberon.display.WORDS_IN_SCANLINE = 32

The number of 32-bit words in one horizontal scan line of the display.

oberon.display.bits_of_int(i)[source]

Yield thirty-two bits of an integer as 0 or 1, LSB to MSB.

oberon.display.coords_of_word(address)[source]

Given the address in words already adjusted for DISPLAY_START return a generator that yields the (x, y) coords of the pixels in that word.

oberon.display.initialize_screen()[source]

Fire up PyGame and return a screen surface of SIZE.

oberon.display.screen_size_hack(ram, width=1024, height=768)[source]

Tuck a “magic number” and the screen dimensions into a location in RAM at the start of the display. (I forget how they are used by the system.) If you have PyGame installed you can see the data in the pixels in the lower-left (origin) corner of the screen.

oberon.display.update_screen(screen, address, value)[source]

Update the contents of the PyGame screen at address with the bit values from the integer value.