[lkml]   [2005]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Screen regen buffer at 0x00b8000
On Fri, 20 May 2005, Richard B. Johnson wrote:

> Why can't I consistantly write to the VGA screen regen buffer
> and have it appear on the screen????

I wrote the following little program and understood the effect you are

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <fcntl.h>
#include <errno.h>
#include <time.h>
#include <sys/mman.h>

#define SCREEN 0x000b8000
#define ATTRIB 0x1700

int main (int argc, char **argv) {

int fd;
void *va;
size_t page_size = getpagesize();
unsigned short c = ATTRIB | '0';
int i;

fd = open("/dev/mem", O_RDWR | O_SYNC);
if (!fd) {

va = mmap(0, page_size, PROT_READ | PROT_WRITE, MAP_SHARED,
fd, SCREEN);
if (va == (void *) -1) {
perror ("mmap");

/* first column of second line of the hardware buffer */
va += 160;

/* printing ascii '0' to '9' */
for (i = 0; i < 10; i++) {
*((unsigned short *) va) = c;
c += 1;

return 0;

Do you remember that the linux console uses hardware buffers for
its scrolling capabilities (shift-pgup and shift-pgdown)?

When you hit enter to run your program the display line you are
addressing in your program has gone off by one so it is out of visual.

To see your line you must go to the begginning of the buffer in the
console (shift-pgup until at the top) since you write to the first
line in the hardware buffer.

Hope this helps

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-05-20 18:39    [W:0.028 / U:7.632 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site