Shop OBEX P1 Docs P2 Docs Learn Events
Another problem with VGA_Demo.spin — Parallax Forums

Another problem with VGA_Demo.spin

RaymanRayman Posts: 14,221
edited 2007-12-06 18:35 in Propeller 1
I just got tripped up by another problem with the library example file "VGA_Demo.spin"...

I already found the error in the clear screen routine that should fill with $220 instead of $200...

Just found out that if you try to write a character to the last row, you will overflow the screen buffer...· This is because the Print(c) routine does not check to make sure it isn't on the last row before writing the bottom half of a character.

I would recommend these changes to anybody using this:

  case c
    $00..$FF:           'character?
      k := color << 1 + c & 1
      i := k << 10 + $200 + c & $FE
      screen[noparse][[/noparse]row * cols + col] := i
      if (row+1)<rows
        screen[noparse][[/noparse](row + 1) * cols + col] := i | 1
      if ++col == cols
        newline
    $100:               'clear screen?
      wordfill(@screen, $220, screensize)
      col := row := 0
Sign In or Register to comment.