bjornb@rhi.hi.is (Bjorn H Bjornsson) (06/19/88)
Hi! I'm currently endulged in the writing of a graphical dump program for the Hercules card. So far I've managed to do the actual dumping through a TP4 program. Works like a dream, thank you. Anybody want the source? What I need now is the source to (a) detect whether a Hercules graphics card is installed (b) detect whether the card is in text or graphics mode. I believe the Hercules has two pages for graphics. Is there any software that uses both pages? If so, I'd also need to know how to detect which page is active. Thanks in advance for any help Bjorn -- Bjorn Heimir Bjornsson Internet: bjornb@rhi.hi.is University of Iceland UUCP: {mcvax,enea}!hafro!rhi!bjornb
eli@spdcc.COM (Steve Elias) (06/21/88)
i had to deal with this problem about a year ago. i think the problem was detecting whether a CGA or a Hercules was installed. in any case, i concluded that it was impossible. Hercules has a short routine which is supposed to handle the detection problem for you. but it doesn't work. i talked to their tech people on the phone, and they admitted this... i forget the exact nature of the problem -- something like: randomness on the bus can sometimes give the same behavior that an actual Hercules card would, at the specified locations... i ended up putting a "-hercules" command line switch in the program. (ugly, i know)...
sam@ncsuvx.ncsu.edu (Whad Upp) (06/22/88)
This code will test for a couple of display and adapter types. Some are assumed. The techniques are from: _Programmer's Guide To PC & PS/2 Video Systems_ by Richard Wilton A good book. His code does more than this and is in assembler. This code is taken from another system. I think I have all the vital parts. The last poster said it was impossible to detect the Herc card. This code has always work for me. =============================================================================\ Sam "Gookie" Moore || "Good morning Mr. Tree || NCSU COmputing Center || We're very glad to see you || Raleigh, NC || Wake up Mr. Tree || sam@ncsuvx.ncsu.edu || It's day time can't you see" || || - Lucy (Lucy's Toy Shop) || =============================================================================/ - Cut - /* * The techniques used here came from: * * _Programmer's Guide To PC & PS/2 Video Systems_ * by Richard Wilton * * Microsoft C. * */ /* * Video Device Data. */ #define WHO_KNOWS 0 #define MONO_monitor 1 #define CGA_monitor 2 #define EGA_monitor 3 #define MONO_adapter 1 #define CGA_adapter 2 #define EGA_adapter 3 #define MCGA_adapter 4 #define HGC_adapter 5 #define HGCP_adapter 6 #define INCOLOR_adapter 7 /* * Video Device Data. */ int MonitorType = WHO_KNOWS, AdapterType = WHO_KNOWS; char *MonitorName[] = { "Who Knows?", "Monochrome Monitor", "CGA Monitor", "EGA Monitor" }; char *AdapterName[] = { "Who Knows?", "Monochrome Adapter", "CGA Adapter", "EGA Adapter", "MCGA Adapter", "HGC Adapter", "HGC+ Adapter", "InColor Card" }; /* * Find display adapter and display types. */ void check_video() { union REGS regs; unsigned dipswitches; int i, j, k; /* * Check for MCGA or VGA. */ regs.x.ax = 0x1a00; int86(0x10, ®s, ®s); if (regs.h.al == 0x1a) { AdapterType = MCGA_adapter; return; } /* * Check for EGA. */ regs.h.ah = 0x12; regs.h.bl = 0x10; int86(0x10, ®s, ®s); if (regs.h.bl != 0x10) { AdapterType = EGA_adapter; dipswitches = regs.h.cl & 0x0e; dipswitches = (dipswitches >= 6 ? dipswitches-6 : dipswitches); if (dipswitches == 4) MonitorType = MONO_monitor; else if (dipswitches == 2) MonitorType = EGA_monitor; else if (dipswitches == 0) MonitorType = CGA_monitor; else MonitorType = CGA_monitor; return; } /* * Check for CGA. */ if (check_6845(0x03d4)) { AdapterType = CGA_adapter; return; } /* * Check for MONO. */ if (check_6845(0x03b4)) { i = inp(0x3ba); i &= 0x80; for (j = 0; j < 32768; j++) { k = inp(0x3ba); k &= 0x80; if (k != i) break; } MonitorType = MONO_monitor; if (k == i) AdapterType = MONO_adapter; else { k = inp(0x3ba); if ((k & 0x70) == 0) AdapterType = HGC_adapter; else if ((k & 0x10) == 0x10) AdapterType = HGCP_adapter; else { AdapterType = INCOLOR_adapter; MonitorType = EGA_monitor; } } } return; } /* * Check for presence of 6845. */ int check_6845(address) int address; { int i, j; outp(address++, 0x0f); i = inp(address); outp(address, 0x66); for (j = 0; j < 1000; j++) ; j = inp(address); outp(address, i); return(j == 0x66); } - Cut -
leonard@bucket.UUCP (Leonard Erickson) (06/26/88)
In article <323@krafla.rhi.hi.is> bjornb@krafla.UUCP (Bjorn H Bjornsson) writes:
<What I need now is the source to
<
< (a) detect whether a Hercules graphics card is installed
Easy, you just check the value of one of the registers, store it
and then check it in a tight loop for a while. If it changes, it's
a Hercules card. I can't remember which register though...
(This is all gone into in the manual!!!)
< (b) detect whether the card is in text or graphics mode.
<I believe the Hercules has two pages for graphics. Is there any
<software that uses both pages? If so, I'd also need to know how to
<detect which page is active.
Lots of luck! *Hercules* says it can't be done....
--
Leonard Erickson ...!tektronix!reed!percival!bucket!leonard
CIS: [70465,203]
"I used to be a hacker. Now I'm a 'microcomputer specialist'.
You know... I'd rather be a hacker."
Ralf.Brown@B.GP.CS.CMU.EDU (06/27/88)
In article <934@bucket.UUCP>, leonard@bucket.UUCP (Leonard Erickson) writes: }In article <323@krafla.rhi.hi.is> bjornb@krafla.UUCP (Bjorn H Bjornsson) writes: }< (b) detect whether the card is in text or graphics mode. }<I believe the Hercules has two pages for graphics. Is there any }<software that uses both pages? If so, I'd also need to know how to }<detect which page is active. } }Lots of luck! *Hercules* says it can't be done.... } It obviously is possible, because DESQview is able to determine when a program switched to graphics mode on the Herc (which doesn't go through BIOS, since there is no BIOS call for Herc graphics mode). For setting the modes, I/O port 3B8h: bit 1 set = graphics, clear = text bit 7 set = page 1, clear = page 0 I just tried it with DEBUG, and reading this port doesn't seem to be reliable. It may be necessary to send commands to other ports as well before attempting to read this one. -- UUCP: {ucbvax,harvard}!cs.cmu.edu!ralf -=-=-=- Voice: (412) 268-3053 (school) ARPA: ralf@cs.cmu.edu BIT: ralf%cs.cmu.edu@CMUCCVMA FIDO: Ralf Brown 1:129/31 Disclaimer? I | claimed something?| Insert your favorite quote here