# HG changeset patch # User Paul Boddie # Date 1466345739 -7200 # Node ID bface8225ae4ece6093f7d2e448688cd6a0963f9 # Parent ac90d199ac33897a8852ce6f62830297e74ecdc4 Use the horizontal position counter by itself to manage the pixel buffer. diff -r ac90d199ac33 -r bface8225ae4 ula.py --- a/ula.py Sat Jun 18 00:03:20 2016 +0200 +++ b/ula.py Sun Jun 19 16:15:39 2016 +0200 @@ -379,7 +379,6 @@ # Initialise the pixel buffer if appropriate. if not self.writing_pixels and self.have_pixels: - self.pixelpos = 0 self.buffer_index = 0 self.fill_pixel_buffer() self.writing_pixels = 1 @@ -497,6 +496,8 @@ self.vsync(1) + self.x += 1 + # Pixel production. @@ -508,22 +509,19 @@ # For pixels within the frame, obtain and output the value. else: - self.pixelpos += 1 self.video.colour = self.buffer[self.buffer_index] # Scale pixels horizontally, only accessing the next pixel value # after the required number of scan positions. - if self.pixelpos % self.xscale == 0: + if self.x % self.xscale == 0: self.buffer_index += 1 # Finish writing pixels. - if self.pixelpos == PIXEL_POSITIONS: + if self.x % PIXEL_POSITIONS == 0: self.writing_pixels = 0 - self.x += 1 - def fill_pixel_buffer(self): """