ytmytm / geos

Source code of GEOS 2.0 for the Commodore 64 and 128

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

accelerated bitmaps (unpack RLE with Beamracer)

ytmytm opened this issue · comments

This requires rewrite of BitmapUp and BitmapClip. BSW's version generates stream of bytes, consumed one by one. Bytes outside clipping region are ignored.

Unpacking with Beamracer means that consumer (drawing routine) is in one of three states:

  • ignore X initial bytes in a row (left of margin)
  • consume X bytes (draw)
  • ignore final X bytes in a row (right of margin) until end of line (bitmap's width)

In every state we need to keep track of repeated values:

  • this byte appears only 1 time - write to memory port
  • this byte repeats 1+n times - one write to memory port, and then another to repeat register for n copies

For this we need to compare and subtract number of bytes until left margin, until right margin, until bitmap end of line. BSW version has only counters that decrease always by one.