VOGONS


about the hgc->cga hack

Topic actions

First post, by noshutdown

User metadata
Rank Oldbie
Rank
Oldbie

i am not a big fan of monochrome, but remembered that in the 1980s there was some hack getting cga games running on hgc cards.
can someone explain how it works, and is it possible to merge it into the Herc9x windows drivers to get 320*200 or 320*240 fullscreen mode for games?

Reply 1 of 14, by middlenibble

User metadata
Rank Newbie
Rank
Newbie
noshutdown wrote on Yesterday, 04:16:

i am not a big fan of monochrome, but remembered that in the 1980s there was some hack getting cga games running on hgc cards.
can someone explain how it works, and is it possible to merge it into the Herc9x windows drivers to get 320*200 or 320*240 fullscreen mode for games?

I vaguely remembering using hercules.com to play one of those. There's a review of some TSRs [1]. I don't know how they work; I only can theorise that they wrap around BIOS calls. Maybe they even periodically grab the CGA memory address space, if there is anything, and copy/transform the contents over to Hercules address space, but that wouldn't work if the CGA memory address space is empty.

[1] https://www.dosdays.co.uk/topics/cga_simulato … or_hercules.php

Reply 2 of 14, by Grzyb

User metadata
Rank l33t
Rank
l33t

CGA/MDA/HGC test program

In 2003, I voted in favour of joining the European Union. However, due to recent developments - especially the restrictions on cash usage - I'm hereby withdrawing my support. DOWN WITH THE EU!

Reply 3 of 14, by rmay635703

User metadata
Rank Oldbie
Rank
Oldbie

Intercepts writes to the CGA space instead writing to MDA space

Reply 4 of 14, by mkarcher

User metadata
Rank l33t
Rank
l33t
rmay635703 wrote on Yesterday, 23:32:

Intercepts writes to the CGA space instead writing to MDA space

You can't intercept memory access with the tools you have on an IBM XT. There is no on-processor MMU (which appeared in the 386 an can be programmed by a virtualization manager like EMM386), and there is no external MMU as well. Instead, the Hercules card has 64KB of memory, and there is a control bit that enables the second 32K being visible on the ISA bus exactly in the address range of the CGA card. Furthermore, there is another control bit that chooses whether the first 32K (in MDA range on the ISA bus) or the second 32K (in CGA range on the ISA bus) should be displayed. So if you configure the card into a graphics mode that uses 80 bytes per scanline (that is 640 monochrome pixel, as CGA does), has banks of 8K (as CGA does, and yeah, Hercules banks are always 8K as well, so no need to configure anything), and displays the contents of the "upper half" of Hercules memory, this is directly CGA compatible without any kind of "interception".

Reply 5 of 14, by noshutdown

User metadata
Rank Oldbie
Rank
Oldbie
mkarcher wrote on Today, 00:38:

You can't intercept memory access with the tools you have on an IBM XT. There is no on-processor MMU (which appeared in the 386 an can be programmed by a virtualization manager like EMM386), and there is no external MMU as well. Instead, the Hercules card has 64KB of memory, and there is a control bit that enables the second 32K being visible on the ISA bus exactly in the address range of the CGA card. Furthermore, there is another control bit that chooses whether the first 32K (in MDA range on the ISA bus) or the second 32K (in CGA range on the ISA bus) should be displayed. So if you configure the card into a graphics mode that uses 80 bytes per scanline (that is 640 monochrome pixel, as CGA does), has banks of 8K (as CGA does, and yeah, Hercules banks are always 8K as well, so no need to configure anything), and displays the contents of the "upper half" of Hercules memory, this is directly CGA compatible without any kind of "interception".

so is it possible to implement such a hack in that herc9x driver, to provide a 320*200 mode faking vga for games?
this is not expected to work in dos, but windows games are supposed to send rendered data to video driver rather than hardware, so there is room for hacking as long as the resolution can be displayed.

Reply 6 of 14, by onethirdxcubed

User metadata
Rank Newbie
Rank
Newbie

You would have to configure the CRTC for 640x400 line mode with the same horizontal line rate as the monitor expects, which some googling suggests can be done. There's some discussion in the comments on the post here: https://nerdlypleasures.blogspot.com/2014/02/ … aspect.html?m=1

Then it's a matter of dithering the 256 color image down to monochrome at 2x the vertical and horizontal resolution in some way (accounting for the palette colors) and copying into the Hercules buffer. Apparently the DOS port of Super Mario 64 of all things does this. There are several approaches you can take for dithering, ordered dither or error diffusion, but ordered dither is probably more appropriate so one pixel changing doesn't shift the whole pattern down the screen.

Reply 7 of 14, by BitWrangler

User metadata
Rank l33t++
Rank
l33t++

Might want to look at the dithering methods used for Wolfenstein 3D CGA port for fast routines. Just an idea that pops into my head for such stuff.

Unicorn herding operations are proceeding, but all the totes of hens teeth and barrels of rocking horse poop give them plenty of hiding spots.

Reply 8 of 14, by Grzyb

User metadata
Rank l33t
Rank
l33t
onethirdxcubed wrote on Today, 03:28:

Apparently the DOS port of Super Mario 64 of all things does this.

https://www.youtube.com/watch?v=4qXImwCfZco

But note that the CPU is Athlon XP 2600+.
No way for real-time dithering with typical Hercules-era CPUs, ie. 8088..286.

In 2003, I voted in favour of joining the European Union. However, due to recent developments - especially the restrictions on cash usage - I'm hereby withdrawing my support. DOWN WITH THE EU!

Reply 9 of 14, by mkarcher

User metadata
Rank l33t
Rank
l33t
onethirdxcubed wrote on Today, 03:28:

You would have to configure the CRTC for 640x400 line mode with the same horizontal line rate as the monitor expects, which some googling suggests can be done. There's some discussion in the comments on the post here: https://nerdlypleasures.blogspot.com/2014/02/ … aspect.html?m=1

You can't get to 400 visible lines at standard MDA/Hercules frequencies. That thread suggests a CRTC configuration that runs horizontal at around 19kHz (instead of 18.4kHz) and a vertical at around 45Hz (instead of 50Hz), which might be OKish for the original 5151. Contrary to popular belief, the 5151 does not blow up if driven at an excessively high horizontal rate, but if driven at an excessively low rate. The is because a too low horizontal rate will cause the energy stored in the flyback transformer core each line to be bigger, resulting in a higher flyback voltage (which might kill things), and in the worst case saturate the flyback transformer, causing an uncontrolled current rise in the horizontal output circuit (which again might kill things). Trying a 5151 at 19kHz thus is not as dangerous at it might initially sound.

In an earlier VOGONs discussion, I actually tested a basic C64 emulator that uses dithering from 320*200 to 640*400 on a Hercules card, and it worked perfectly on my multisync TTL monitor, see Re: So many choices so little time - Hercules graphics card decision (cloned title :-)) for a photo.

Reply 10 of 14, by Grzyb

User metadata
Rank l33t
Rank
l33t
mkarcher wrote on Today, 13:59:

You can't get to 400 visible lines at standard MDA/Hercules frequencies.

Yes you can - even to about 700 lines - using interlace.
That's how the 640 x 400 tweak works, and there was at least one card providing 720 x 700 mode on MDA monitors - Tecmar Graphics Master.

In 2003, I voted in favour of joining the European Union. However, due to recent developments - especially the restrictions on cash usage - I'm hereby withdrawing my support. DOWN WITH THE EU!

Reply 11 of 14, by rmay635703

User metadata
Rank Oldbie
Rank
Oldbie
Grzyb wrote on Today, 14:23:
mkarcher wrote on Today, 13:59:

You can't get to 400 visible lines at standard MDA/Hercules frequencies.

Yes you can - even to about 700 lines - using interlace.
That's how the 640 x 400 tweak works, and there was at least one card providing 720 x 700 mode on MDA monitors - Tecmar Graphics Master.

I forget the brand but one off brand Hercules display claimed 120 columns of text on your ibm 5151.

That is likely around 1080x350

Reply 12 of 14, by Grzyb

User metadata
Rank l33t
Rank
l33t
rmay635703 wrote on Today, 20:08:

I forget the brand but one off brand Hercules display claimed 120 columns of text on your ibm 5151.

That is likely around 1080x350

I know about Eizo MD-B05 - it can do 132 columns with 8-pixel-wide characters, therefore 1056 x 350.
With 9-pixel-wide characters, it should approach 120 columns.

Anyway, with analog signal, the monitor in theory has unlimited horizontal resolution.
Vertical resolution is strictly limited by HSYNC and VSYNC frequencies, and can only be doubled using interlace.

In 2003, I voted in favour of joining the European Union. However, due to recent developments - especially the restrictions on cash usage - I'm hereby withdrawing my support. DOWN WITH THE EU!

Reply 13 of 14, by mkarcher

User metadata
Rank l33t
Rank
l33t
Grzyb wrote on Today, 20:27:

Anyway, with analog signal, the monitor in theory has unlimited horizontal resolution.

True. Yet the bandwidth of the video amplifier and the sharpness of the beam is limited, turning high frequency horizontal structure into uniform gray at some point, so no unlimited number of discernable vertical line pairs. The limited number of line pairs limits the amount of characters per line that are readable, so I expect it doesn't make sense to try to display considerably more than 132 characters per line on a 5151.

On the other hand, you do get nearly infinite resolution in positioning where a line with a given sharpness and width can be located. This is especially true on monochrome monitors that don't have a dot mask.

Reply 14 of 14, by wierd_w

User metadata
Rank Oldbie
Rank
Oldbie

Depending on what you are trying to do, that might be desirable. (Smudgy uniform grey).

If you do that with interleaved modes, you can get something approximating grey shading on odd scanline, with larger, sharper dots on even, and rely on phosphor persistence to avoid flicker.