AMOS:Working with bitplanes

From Amiga Coding
Revision as of 22:39, 17 September 2007 by Spellcoder (talk | contribs) (my work-in-progress tutorial about bitplanes in AMOS)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

(this is a work-in-progress tutorial and has not been tested yet!!!!!)


Amiga uses bitplanes, so instead of using one or more bytes per pixel, the screen exists of several layers (bitplanes) in which each byte contains 8 pixels. For every bitplane added the maximum amount of colors doubles:

  • 2^1 = 2 = 2 colors
  • 2^2 = 2*2 = 4 colors
  • 2^3 = 2*2*2 = 8 colors
  • 2^4 = 2*2*2*2 = 16 colors
  • 2^5 = 2*2*2*2*2 = 32 colors
  • 2^6 = 2*2*2*2*2*2 = 64 colors


If you want to know how many bytes a line takes in a bitplane use this formula:

size of one line within a bitplaneScreenWidth / 8
size of one bitplaneScreenWidth / 8 * ScreenHeight
Size of full pictureScreenWidth / 8 * ScreenHeight * AmountOfBitplanes


So say you want to copy a bitplane from an AMOS screen to an AMOS bank:

BitplaneSize = Screen Width / 8 * Screen Height

Reserve As Work 10,BitplaneSize
Copy Phybase(0),Phybase(0)+BitplaneSize To Start(10)
Wsave "RAM:Bitplane",10