Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!ucsd!ucsdhub!jack!elgar!ford From: ford@elgar.UUCP (Ford Prefect ) Newsgroups: comp.sys.att Subject: Re: UNIX PC Graphics Questions Summary: extern struct msinfo msinfo; Keywords: unixpc kernel hack Message-ID: <151@elgar.UUCP> Date: 22 May 88 06:32:16 GMT References: <2271@inco.UUCP> <267@uncle.UUCP> <700@naucse.UUCP> Reply-To: ford@kenobi.UUCP (Mike Ditto) Organization: Omnicron Data Systems, Bonita, CA Lines: 65 In article <700@naucse.UUCP> rrr@naucse.UUCP (Bob Rose ) writes: >In article <267@uncle.UUCP>, jbm@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 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 . 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@crash.CTS.COM This was a Pizza Hut, ...!sdcsvax!crash!kenobi!ford now it's all covered with daisies." -- Talking Heads