UNIX PC Graphics Questions

Ford Prefect ford at elgar.UUCP
Sun May 22 16:32:16 AEST 1988


In article <700 at naucse.UUCP> rrr at naucse.UUCP (Bob Rose ) writes:
>In article <267 at uncle.UUCP>, jbm at uncle.UUCP (John B. Milton) writes:
>> The UNIXpc screen memory is located at $420000, and the only way to access
>> that area of memory would be through a loadable driver. This kind of access
>> would screw up the window manager's view of things.
>
>What about opening `/dev/mem' for reading and writing.
>Note, I'm note responsible if you miss the screen and hit
>the drive controller crashing your hard disk.

Neither the video memory nor the drive controller can be accessed by
/dev/{k,}mem.  In fact, the standard driver won't even allow access into
the loadable driver area (above 0x300000).  I have a patch that fixes
this.

>There is an `ioctl' that allows you to get and put thing on the
>screen.

That is what I would recommend.

>BTW Does anyone know the location or symbol name of the x and y values
>of the mouse in `/dev/kmem.' There should be a way to open
>`/dev/kmem' (for reading only) and get these values. Using
>the tty driver is very SLOOOWWWWWW!!!!!!! (version 3.51)

In the kernel, there is a "struct msinfo" called "msinfo", which
contains the current mouse state, including button states.  You would
have to nlist for "msinfo" and read in a (struct msinfo).  The
structure is in <sys/mouse.h> and looks like:

	struct msinfo {
		long physmx;		/* horizontal */
		long physmy;		/* vertical */
		char mb;		/* current button states */
	};

The mouse buttons are encoded using the bits MBUTR, MBUTM, and MBUTL,
also defined in <sys/mouse.h>.

To see this, try (as root)

	adb /unix /dev/kmem
	msinfo/XXx

Move the mouse a bit and type a "/" [return].  Repeat several times.


Note that there is a bug in the keyboard/mouse driver which allows the
"physmy" value to go up to 0x2a6, rather than stopping at 0x15b which
is where the screen really ends, so be prepared for values that are
off the bottom of the screen, even though the pointer is displayed at
the last pixel.  I have a version of CAPCTRL that fixes this (yes, the
bug is in CAPCTRL, beleive it or not.  Actually, it is in the original
keyboard/mouse driver as well).


For some examples of how to read kernel memory in a program, I
recommend my "fuser" program, sources for which I will send to anyone
who asks.

					-=] Ford [=-

"Once there were parking lots,		(In Real Life:  Mike Ditto)
now it's a peaceful oasis.		ford%kenobi at crash.CTS.COM
This was a Pizza Hut,			...!sdcsvax!crash!kenobi!ford
now it's all covered with daisies." -- Talking Heads



More information about the Comp.sys.att mailing list