The myth of the vertical retrace interrupt on EGA/VGA

Discussion about old graphics cards, monitors and video related things.

The myth of the vertical retrace interrupt on EGA/VGA

Postby Scali » 2018-2-10 @ 18:53

Over the years, I've heard various stories on the vertical retrace interrupt on EGA/VGA cards, and how this may or may not be supported, is broken, or whatever...
So I want to put this myth to bed and find out what's what.
To begin at the beginning... IBM first implemented a vertical retrace interrupt on the PCjr in 1984. This is implemented on IRQ5. The interrupt is always enabled on the video chip, but is masked on the 8259A PIT by default.
Later that year, IBM introduced EGA. It also has a vertical retrace interrupt, but it works differently. It is implemented on IRQ2, but it is not enabled by default.
EGA has an extended/enhanced version of the 6845 CRTC. The IRQ control is implemented in bits 4 and 5 of register 11h (vertical retrace end) of the 6845, which is on port 3D4h.
Bit 5 is set by default, which disables(!) the IRQ. Set it to 0 to enable the IRQ.
Bit 4 is used to acknowledge the interrupt. When an interrupt occurs, you first write a 0 to bit 4 to clear the interrupt, then you write a 1 again, so a new interrupt can be triggered.
See the IBM EGA manual at page 72 for the description: http://minuszerodegrees.net/oa/OA%20-%2 ... dapter.pdf

While I have never found the original VGA manual, I did find the IBM VGA/XGA manual from 1992, which fully documents VGA as well: http://mcamafia.de/pdf/ibm_vgaxga_trm2.pdf
And if you look at page 2-69, it documents this functionality in the exact same way as EGA. So this proves that VGA/XGA are fully backwards compatible with the vertical retrace interrupt of EGA.

However... if you run DOSBox, the IRQ only works if you set machine=ega. Why is that?
Also, if you check OSDev.org, they do not document these bits and the functionality at all: https://wiki.osdev.org/VGA_Hardware#Registers
The same goes for osdever.net: http://www.osdever.net/FreeVGA/vga/crtcreg.htm#11
This seems to be revisionist history...

So, I decided to make a little test-program: https://www.dropbox.com/s/bzobfyhmppin4 ... q.zip?dl=0
It basically enables the vertical retrace IRQ, and installs a handler that increments a counter every time it is triggered.
The program constantly prints the value of this counter in the top left corner of the screen. So you can easily verify whether it works or not: if it works, it should increment at the refresh rate of the screen (generally 60 or 70 Hz).
The following keys are supported:
ESC - exit the program
1 - switch to 80x25 textmode (mode 03h)
2 - switch to 320x200x16 mode (EGA mode 0Dh)
3 - switch to 320x200x256 mode (VGA mode 13h)

I tested it on my 486 with Diamond SpeedStar PRO VLB, and as expected, the counter counts up in all three modes.
So I would like everyone with an EGA, VGA, SVGA or XGA system to run this program, and report their video card and whether or not the counter counted up.
Scali
l33t
 
Posts: 3875
Joined: 2014-12-13 @ 14:24

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby keropi » 2018-2-10 @ 19:43

Just tested this on my
- ATI Egawonder 800 , modes 1 and 2 show the same message on the top left part of the screen: IRQs: 0
- S3 Trio3D/2x , all three modes display the same message as above
Last edited by keropi on 2018-2-10 @ 22:27, edited 1 time in total.
User avatar
keropi
l33t++
 
Posts: 6906
Joined: 2003-9-08 @ 06:45
Location: Greece

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby Scali » 2018-2-10 @ 21:26

keropi wrote:Just tested this on my
- ATI Egawonder 800+ , modes 1 and 2 show the same message on the top left part of the screen: IRQs: 0
- S3 Trio3D/2x , all three modes display the same message as above


Hmm, not a very good score so far.
Did you test both cards in the same machine?
I don't specifically enable IRQs 2 and 9 on the interrupt controllers (it wasn't required on my 486, everything seems to be enabled at bootup).
I may have to create a new version where I specifically enable the interrupts, just to be safe. That way we can rule out the situation where the video chip does generate the IRQ, but the PC's BIOS prevents it from being handled.
Scali
l33t
 
Posts: 3875
Joined: 2014-12-13 @ 14:24

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby Scali » 2018-2-10 @ 21:40

Here is an updated version of the program, which makes sure IRQ2 and IRQ9 are not masked: https://www.dropbox.com/s/bzobfyhmppin4 ... q.zip?dl=0
Scali
l33t
 
Posts: 3875
Joined: 2014-12-13 @ 14:24

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby Falcosoft » 2018-2-10 @ 22:24

Even the updated version produces 'IRQs: 0' in all modes on a Compaq Contura Aero 4/25 (486 SX) with a custom (Tseng Labs) 256K VGA.
User avatar
Falcosoft
Oldbie
 
Posts: 816
Joined: 2016-5-21 @ 13:46
Location: Pécs, Hungary

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby keropi » 2018-2-10 @ 22:28

yes I am also getting the 0 value - maybe because I have MPUs in my systems that use IRQ2 ?

also I have EGA Wonder 800 , a true EGA and not the + version that is vga core
User avatar
keropi
l33t++
 
Posts: 6906
Joined: 2003-9-08 @ 06:45
Location: Greece

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby Scali » 2018-2-10 @ 22:45

Falcosoft wrote:Even the updated version produces 'IRQs: 0' in all modes on a Compaq Contura Aero 4/25 (486 SX) with a custom (Tseng Labs) 256K VGA.


Interesting... I've just tested it on my 286 with an ET4000, and it works fine, same as the CL5426 in my 486.
I've pulled out my Commodore PC20-III now, which has an early Paradise card. Wonder what that is going to do.
Scali
l33t
 
Posts: 3875
Joined: 2014-12-13 @ 14:24

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby Scali » 2018-2-10 @ 23:04

Results on the PC20-III are interesting to say the least: the IRQ fires, and it seems to fire at approximately the correct rate.
However, I've added a simple palette change to the interrupt handler, so you have a visual cue of when the IRQ fires. On the CL5426 and the ET4000 it fires just at the end of the visible area at the bottom of the screen, as you'd expect, and it is pretty solid there.
The Paradise however results in a 'running' bar over the screen, which seems to indicate that the interrupt it generates is not synced to the display at all.

So this Paradise card may be an example of a 'dodgy' clone, where the functionality is just not implemented correctly, and using it would result in severe bugs on screen.
Scali
l33t
 
Posts: 3875
Joined: 2014-12-13 @ 14:24

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby Scali » 2018-2-10 @ 23:30

keropi wrote:yes I am also getting the 0 value - maybe because I have MPUs in my systems that use IRQ2 ?


That shouldn't matter... It just means that both VGA and the MPU can generate IRQ2, so if my handler is called, you're not sure whether it was the VGA card or the MPU that signaled it.
Since the counter isn't updating, it is never called, so nobody has signaled an IRQ2.
Scali
l33t
 
Posts: 3875
Joined: 2014-12-13 @ 14:24

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby keropi » 2018-2-10 @ 23:41

I see , so that means on these graphics cards vertical retrace interrupt is not supported or it's broken. coolio LOL LOL LOL
User avatar
keropi
l33t++
 
Posts: 6906
Joined: 2003-9-08 @ 06:45
Location: Greece

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby Scali » 2018-2-10 @ 23:42

Well, I have read that some cards have a jumper to enable/disable IRQ, because enabling it could lead to problems in some cases.
So perhaps some of these cards just need to change a jumper.

I think the Paradise is beyond help though, I think that one just has a broken implementation.
It also doesn't seem to care about flip-flopping the interrupt, it just keeps going regardless.
I already noticed something strange with its CGA compatibility mode. That is, CGADEMO shows the rasterbars in the wrong place. That seems to indicate that the hsync signals are not properly generated either.
Scali
l33t
 
Posts: 3875
Joined: 2014-12-13 @ 14:24

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby keropi » 2018-2-10 @ 23:51

Yes indeed some have.
I have an ISA 5429 that has an IRQ jumper but it causes instabilities on the systems I have tried it with...
The trio3d/2x doesn't have a jumper - and the "Assign IRQ for VGA" BIOS setting does not make any difference.

Not sure about the EGA wonder though.
User avatar
keropi
l33t++
 
Posts: 6906
Joined: 2003-9-08 @ 06:45
Location: Greece

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby Scali » 2018-2-11 @ 11:12

keropi wrote:I have an ISA 5429 that has an IRQ jumper but it causes instabilities on the systems I have tried it with...


That's interesting... I don't know of any software that uses it. The IRQ needs to be enabled specifically before it fires, so theoretically nothing should happen by just enabling it with the jumper.
But perhaps its implementation is broken in another way.

All three cards I tested with, have no jumper to disable or enable the IRQ at all, I think.
Scali
l33t
 
Posts: 3875
Joined: 2014-12-13 @ 14:24

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby Tiido » 2018-2-11 @ 21:20

All my ISA and VLB cards have a jumper to enable or disable interrupt signal on IRQ2/9 line on the slot, and on most the jumper is set to no IRQ by default. I'll run the program soon on my various hardware. Some of my PCI cards have IRQ jumper but PCI has no mechanism for signalling IRQs to specific level without help from BIOS (i.e "assign IRQ to VGA" option).
User avatar
Tiido
Oldbie
 
Posts: 634
Joined: 2018-1-14 @ 04:40
Location: Estonia

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby Tiido » 2018-2-17 @ 10:15

So I finally tested out the program and here are the results :

* C2D machine with PCI-E Radeon X550, no IRQs. BIOS assign IRQ to VGA setting didn't help
* Pentium MMX machine with PCI Mach64, no IRQs. BIOS has no options and I cannot look at the card to see if it has its IRQ jumper set (machine is buried under others).
* i486DX2 with VLB ET4000/W32-1, IRQs work perfectly in all modes.
* am386DX-40 with Trident 8900D, no IRQs. The card has IRQ9 pin not connected so I looked up the pinout of the chip and soldered a wire to pin10 that ran to IRQ9 signal on ISA slot, result IRQs work !
* i286-16 with Trident 9000i, no IRQs. Card also had IRQ9 not connected, I soldered a wire to pin111 and ran it to IRQ9 on ISA slot and IRQs work now.
* I also tested an UM85C408AF based card in that 386 and IRQs work fine.
* I then tested an OAK OTI037C based card in that 386 and IRQs also work fine.
* Pentium 300 and a Pentium II laptop, both with NeoMagic128, no IRQs.
* I also tried to test my Cyrix 5x86 based ThinkPad 365E but the floppy drive didn't cooperate and I couldn't transfer the program...

Here's some pics of the mods and the result :
http://www.tmeeco.eu/BitShit/VGAIRQ0.jpg
http://www.tmeeco.eu/BitShit/VGAIRQ1.jpg
http://www.tmeeco.eu/BitShit/VGAIRQ2.jpg
http://www.tmeeco.eu/BitShit/VGAIRQ3.jpg
http://www.tmeeco.eu/BitShit/VGAIRQ4.jpg
User avatar
Tiido
Oldbie
 
Posts: 634
Joined: 2018-1-14 @ 04:40
Location: Estonia

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby Scali » 2018-2-17 @ 12:11

Thanks for testing all these machines, Tiido!
And great that you connected the Trident IRQ lines, and that it actually works! I had read some posts on the internet somewhere that said that IRQs weren't implemented on Trident cards. But apparently the chip supports it, for some reason it's just not connected on the cards.

I think there is something interesting here:
So far we've seen that the IRQ is at least implemented on most ISA and VLB cards, and on many of them it also appears to work correctly (my Paradise PVGA1A supports it, but the timing is just broken).
But on newer systems, Pentium/PCI or newer, I don't think we have seen any system yet where the IRQ works.
Question is: is this because the VGA chipsets don't support it? Or is it because of the motherboard whose PCI implementation doesn't translate the IRQ lines?

Perhaps it is most interesting to try and find PCI cards that use the same chipset as ISA/VLB cards, but with a PCI bridge chip. So a chipset where we know that the IRQ works on ISA/VLB.
For example, we know that the ET4000 works on ISA/VLB, and there are PCI cards with ET4000.
Perhaps also CL54xx chips, since the 5426 works fine.
I also wonder about S3 chips... do those work on ISA/VLB?
Scali
l33t
 
Posts: 3875
Joined: 2014-12-13 @ 14:24

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby Scali » 2018-2-17 @ 16:05

I was suspicious of the Paradise VGA card... I was wondering if perhaps the IRQs were not being generated by the PVGA at all...
So I tested the card in my 486 and indeed, it simply doesn't generate any IRQs.
I checked the PCB... IRQ2 should be on the 4th pin from the left on the back of the card, right? 'B4'. There is no pin at all on the PCB, so it can't generate an IRQ2 (which makes me wonder if there is a pin on the VGA chip itself which generates the IRQ, like on the Tridents).

I wonder what generates the IRQ2s in the Commodore machine then. Perhaps the onboard video chip? A Paradise PVC4, which supports Plantronics mode.

Edit:
I found the datasheet for the PVGA1A here: http://datasheet.datasheetarchive.com/o ... 175793.pdf
And yes, it documents pin 35 as being the vertical retrace IRQ pin. So like the Trident cards, it is implemented on the chip, but not connected on the PCB.
It also says this: "In an AT system IRQ is not connected, but it may be connected if desired".
They say that IRQ9 is used in Microchannel mode. What exactly does that mean then? VGA is originally a standard from PS/2, so it is normally connected. Why would you not connect it in an AT? EGA had it connected, and that has nothing to do with PS/2 or MCA.

The chip apparently has separate 'AT' and 'MCA' modes... perhaps they mean that in AT mode, the IRQ isn't generated? Weird.
Scali
l33t
 
Posts: 3875
Joined: 2014-12-13 @ 14:24

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby BloodyCactus » 2018-2-17 @ 17:53

K6-2+, G400 MAX, irq 0's, no colour changing.

I do have a midi card on irq 2 (midiman mm401)

tested in real mode (nothing loaded, not even himem) and normal xms/jemmex etc

*edit* because I'm dumb, its not an isa card :P
Last edited by BloodyCactus on 2018-2-17 @ 18:58, edited 1 time in total.
--/\-[ Stu : Bloody Cactus :: http://kråketær.com :: http://mega-tokyo.com ]-/\--
User avatar
BloodyCactus
Oldbie
 
Posts: 801
Joined: 2016-2-03 @ 13:34
Location: Lexington VA

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby Tiido » 2018-2-17 @ 18:39

Just connect the signal and it will most probably work. Those trident chipsets had all sorts of talk about MCA modes too but that doesn't matter at all in reality. Hard part will probably be connecting a wire to one of the chip pins directly, I have doubts there's any nice test pad to solder onto lol.

I dug out my Pentium machine from the computer stack and took a look inside and turned out the IRQ jumper was disabled, but enabling it doesn't help because the mobo won't assign IRQ to PCI video and even if it did there's some complications as PCI cannot signal a specific IRQ. There are 4 IRQs on PCI : A, B, C and D. It is up to BIOS to map those to physical IRQs. it would be possible to write an utility that programs the chipset directly to map those IRQs wherever you want, chipset premitting.

All my PCI video cards connected IRQA, other IRQs are unconnected. Also almost all cards had IRQ jumper set to disabed by default.
So I enabled IRQs on all, and took a motherboard from my stash that allowed VGA to get an IRQ but not specify what exactly so then I reserved all IRQs but 9. After reboot the video card got that particular IRQ :D before doing that it got 11 and the assignment did not change with slot nor with card type. Anyway once POST showed that card had IRQ9 I got IRQs on all all modes on my Ati cards (several Mach64 and Rage II cards), but not on S3 Trio64 or Cirrus Logic GD5446 cards in any mode despite them connecting the IRQ and Cirrus even having a jumper on that line.

http://www.tmeeco.eu/BitShit/VGAIRQ5.jpg
http://www.tmeeco.eu/BitShit/VGAIRQ6.jpg
User avatar
Tiido
Oldbie
 
Posts: 634
Joined: 2018-1-14 @ 04:40
Location: Estonia

Re: The myth of the vertical retrace interrupt on EGA/VGA

Postby Scali » 2018-2-17 @ 18:59

Tiido wrote:Hard part will probably be connecting a wire to one of the chip pins directly, I have doubts there's any nice test pad to solder onto lol.


Yea, there's no pin on the edge connector at all, so that's one problem.
The other problem is that my card has the PLCC package chip, but not socketed. So the pins are soldered directly under the chip, you can't solder a wire on that.
Image

I don't think I'll try.

Tiido wrote:Anyway once POST showed that card had IRQ9 I got IRQs on all all modes on my Ati cards (several Mach64 and Rage II cards), but not on S3 Trio64 or Cirrus Logic GD5446 cards in any mode despite them connecting the IRQ and Cirrus even having a jumper on that line.


Okay, that's interesting.
So you definitely need a chipset/BIOS that is capable of supporting IRQ2/9 for VGA first. But if you have such a board, then it is possible for PCI cards to be compatible with the EGA/VGA vertical retrace interrupt... But even then, apparently not all cards are.

Edit:
There appears to be a BIOS API for getting PCI info and reprogramming the IRQ routing:
http://www.delorie.com/djgpp/doc/rbinter/id/03/24.html

So perhaps with the right utility it can be enabled on a wider range of hardware.
Scali
l33t
 
Posts: 3875
Joined: 2014-12-13 @ 14:24

Next

Return to Video

Who is online

Users browsing this forum: No registered users and 2 guests