# HG changeset patch # User Paul Boddie # Date 1466437834 -7200 # Node ID 59d7fe6a9ba069922c713917213d6aac8258ca07 # Parent ea19ad85988b2cea60688ffaaf549202edc823fe Tidied, introducing a write_pixels function, removing PIXEL_POSITIONS. diff -r ea19ad85988b -r 59d7fe6a9ba0 ula.py --- a/ula.py Mon Jun 20 16:57:12 2016 +0200 +++ b/ula.py Mon Jun 20 17:50:34 2016 +0200 @@ -37,9 +37,6 @@ MAX_PIXELPOS = MIN_PIXELPOS + MAX_WIDTH -PIXEL_POSITIONS = 8 # the number of pixel positions per byte - # (doubled or quadrupled in lower resolutions) - SCREEN_LIMIT = 0x8000 # the first address after the screen memory MAX_MEMORY = 0x10000 # the number of addressable memory locations MAX_RAM = 0x10000 # the number of addressable RAM locations (64Kb in each IC) @@ -304,8 +301,9 @@ def in_frame(self): return MIN_PIXELLINE <= self.y < (MIN_PIXELLINE + self.display_height) def inside_frame(self): return MIN_PIXELLINE < self.y < (MIN_PIXELLINE + self.display_height) def read_pixels(self): return MIN_PIXELPOS <= self.x < MAX_PIXELPOS and self.in_frame() + def write_pixels(self): return self.pcycle != 0 + def next_pixel(self): return self.xscale == 1 or (self.xscale == 2 and self.cycle & 0b10101010) or (self.xscale == 4 and self.cycle & 0b10001000) def end_pixels(self): return self.pcycle == 1 - def next_pixel(self): return self.xscale == 1 or (self.xscale == 2 and self.cycle & 0b10101010) or (self.xscale == 4 and self.cycle & 0b10001000) def update(self): @@ -467,7 +465,7 @@ # Detect spacing between character rows. - if not self.pcycle: + if not self.write_pixels(): self.video.colour = BLANK # For pixels within the frame, obtain and output the value. @@ -480,7 +478,6 @@ if self.next_pixel(): self.next_pixel_value() - self.pcycle = rotate(self.pcycle, self.depth) # Finish writing pixels. @@ -501,6 +498,7 @@ def next_pixel_value(self): self.pdata = rotate(self.pdata, self.depth) + self.pcycle = rotate(self.pcycle, self.depth) def wrap_address(self): if self.address >= SCREEN_LIMIT: