# HG changeset patch # User Paul Boddie # Date 1466451142 -7200 # Node ID c0f8098f982fa6a13e631c4cd8c8c1ad659e7b62 # Parent e116a929dcdf0bc6604c0b593ac729842b54f84b Made the next_vertical control-flow more hierarchical. diff -r e116a929dcdf -r c0f8098f982f ula.py --- a/ula.py Mon Jun 20 18:54:52 2016 +0200 +++ b/ula.py Mon Jun 20 21:32:22 2016 +0200 @@ -269,34 +269,37 @@ self.y += 1 self.x = 0 - if not self.inside_frame(): - return + if self.inside_frame(): + self.line += 1 - self.line += 1 + # At the end of a row... + + if self.line == self.row_height: - # After the end of the last line in a row, the address should already - # have been positioned on the last line of the next column. + # After the end of the last line in a row, the address should already + # have been positioned on the last line of the next column. - if self.line == self.row_height: - self.address -= LINES_PER_ROW - 1 - self.wrap_address() - self.line = 0 + self.address -= LINES_PER_ROW - 1 + self.wrap_address() + self.line = 0 + + # Record the position of the start of the pixel row. - # Support spacing between character rows. + self.line_start = self.address - elif not self.in_line(): - return + # Before any spacing between character rows... - # If not on a row boundary, move to the next line. Here, the address - # needs bringing back to the previous character row. + elif self.in_line(): - else: - self.address = self.line_start + 1 - self.wrap_address() + # If not on a row boundary, move to the next line. Here, the address + # needs bringing back to the previous character row. - # Record the position of the start of the pixel row. + self.address = self.line_start + 1 + self.wrap_address() - self.line_start = self.address + # Record the position of the start of the pixel row. + + self.line_start = self.address def in_line(self): return self.line < LINES_PER_ROW def in_frame(self): return MIN_PIXELLINE <= self.y < (MIN_PIXELLINE + self.display_height)