Programming
As part of its commercial packaging, the Hercules Graphics Card included a diskette with HBASIC, an interpreted version of the BASIC computer language that enabled programming graphics on a monochrome monitor. An integrated development environment with the same name (HBasic) has appeared.
In text modes, the memory appears just like an MDA card. The screen has 80×25 chars, so there are 80 ASCII code/attribute pairs per line (160 bytes per line, 2 bytes per symbol). The address of a given screen location in memory is given by the formula:
address = (0xb0000) + ( row * 160 ) + (column * 2)In graphics mode, the lines are interleaved so it is a bit harder. There are 8 pixels per byte, 90 bytes per line. Consecutive lines on the screen are interleaved by 4 lines in memory, so in memory it looks like this:
Screen Line #0 starts at B000:0000
Screen Line #1 starts at B000:2000
Screen Line #2 starts at B000:4000
Screen Line #3 starts at B000:6000
Screen Line #4 starts at B000:005A ...
The memory address that contains a given pixel is given by:
mem = (0xb8000) + ((y&3)<<13)+(y>>2)*90+(x>>3)This code would set the correct pixel in that byte:
bitwise or contents with (128 >> (x & 7))Read more about this topic: Hercules Graphics Card
Famous quotes containing the word programming:
“If there is a price to pay for the privilege of spending the early years of child rearing in the drivers seat, it is our reluctance, our inability, to tolerate being demoted to the backseat. Spurred by our success in programming our children during the preschool years, we may find it difficult to forgo in later states the level of control that once afforded us so much satisfaction.”
—Melinda M. Marshall (20th century)