NEWS ARTICLES


    What's News in the PlayBasic world ? - Find out here.



 Challenge #27 - Learn binary operations

By: Kevin Picone Added: February 5th, 2014

Category: All,Challenge

     Those who grew up in the age of 8bit computers would no doubt remember the pain of writing video games on these systems. It wasn't just the speed, but it felt like the graphics hardware designers were conspiring against the programmer at times, intentionally making it difficult to do the most trivial of tasks. Like you'd think drawing a DOT would be easy right ? Unfortunately not, as many if those systems have scrambled video memory layouts and packed bit / planar displays. The upside of that, is it really made you learn about Binary operations and low level memory access. Which seems to be a thing of the past today in BASIC programming.

     One common format seen in many retro computer systems for bitmap graphics are variations of planar. Generally in these formats 8 pixels on screen are represented within a single byte (plus generally a character map). Each bit in the byte is an individual pixel on screen. This can be pretty efficient in terms of memory usage, but it raises the complexity of drawing bitmap graphics. So to make this challenge somewhat easier the Retro Computer Environment library emulates a 2 colour planar graphics hardware.

     The screen is 640*400 pixels, each pixel is a single BIT, so it's two possible colours. The screen memory is (640/8)*400 bytes. Each row is a (640/80) 80 bytes long. To manipulate the individual pixels, you'll need to calculate the location of the byte that contains the pixel group then AND / OR / XOR the bits manually.

     Read More..






 

 
     
 
       

(c) Copyright 2002 / 2024 Kevin Picone , UnderwareDesign.com  - Privacy Policy   Site: V0.99a [Alpha]