[Oberon] FPGA - Screen.Mod

Jörg joerg.straube at iaeth.ch
Mon Sep 18 08:53:15 CEST 2017

Hi Tomas

> Am 17.09.2017 um 15:58 schrieb Tomas Kral <thomas.kral at email.cz>:
> Why do we need bit reversal at all?
> Why the bitmap is stored as inverse video?

If the only OS you use is Oberon you are free to write and read the screen memory 1:1 to a file without any reversal or inverting.
However, if you want to exchange the picture of your screen with some other OSes (Windows, Mac, Linux, OS/2, iOS, AmigaOS, ...) you have to use a well defined file format.
There are two possibilities:
a) Either you define the picture format yourself and all other OSes have to understand it. (Unless you’re Microsoft or Apple this is rather unrealistic)
b) you take an already defined picture format and convert that external file format to your internal memory representation.

The BMP file format is license-free, well documented and supported by almost all OSes. So, it’s a good choice to exchange picture data from one device to an other.
Unfortunately however, the BMP file specification defines: (http://www.cs.ucc.ie/j.bowen/cs1107/imageFormats/bmp/formatDesc.html)
Pixel Data encoding for 1bit / black & white images

BitCount = 1 Compression = 0  
Every byte holds 8 pixels, its highest order bit representing the leftmost pixel of those. There are 2 color table entries. Some readers will ignore them though, and assume that 0 is black and 1 is white. If you are storing black and white pictures you should stick to this, with any other 2 colors this is not an issue. Remember padding with zeros up to a 32bit boundary (This can be up to 31 zeros/pixels!) 

Here you have it! As PO2013 defines the bit usage in memory differently than BMP you have to write code to convert the BMP definition to the PO2013 definition. A possible alternative to do this bit reversal is as follows: you define an array „rev" of 256 bytes, pre-populate it with the reversed bit values and while reading do:   Files.Read(pix); pix := rev[pix];


More information about the Oberon mailing list