Announcement

Collapse

Forum Rules and Etiquette

Our mission ...

This forum is part of our mission to promote the preservation of vintage computers through education and outreach. (In real life we also run events and have a museum.) We encourage you to join us, participate, share your knowledge, and enjoy.

This forum has been around in this format for over 15 years. These rules and guidelines help us maintain a healthy and active community, and we moderate the forum to keep things on track. Please familiarize yourself with these rules and guidelines.


Rule 1: Remain civil and respectful

There are several hundred people who actively participate here. People come from all different backgrounds and will have different ways of seeing things. You will not agree with everything you read here. Back-and-forth discussions are fine but do not cross the line into rude or disrespectful behavior.

Conduct yourself as you would at any other place where people come together in person to discuss their hobby. If you wouldn't say something to somebody in person, then you probably should not be writing it here.

This should be obvious but, just in case: profanity, threats, slurs against any group (sexual, racial, gender, etc.) will not be tolerated.


Rule 2: Stay close to the original topic being discussed
  • If you are starting a new thread choose a reasonable sub-forum to start your thread. (If you choose incorrectly don't worry, we can fix that.)
  • If you are responding to a thread, stay on topic - the original poster was trying to achieve something. You can always start a new thread instead of potentially "hijacking" an existing thread.



Rule 3: Contribute something meaningful

To put things in engineering terms, we value a high signal to noise ratio. Coming here should not be a waste of time.
  • This is not a chat room. If you are taking less than 30 seconds to make a post then you are probably doing something wrong. A post should be on topic, clear, and contribute something meaningful to the discussion. If people read your posts and feel that their time as been wasted, they will stop reading your posts. Worse yet, they will stop visiting and we'll lose their experience and contributions.
  • Do not bump threads.
  • Do not "necro-post" unless you are following up to a specific person on a specific thread. And even then, that person may have moved on. Just start a new thread for your related topic.
  • Use the Private Message system for posts that are targeted at a specific person.


Rule 4: "PM Sent!" messages (or, how to use the Private Message system)

This forum has a private message feature that we want people to use for messages that are not of general interest to other members.

In short, if you are going to reply to a thread and that reply is targeted to a specific individual and not of interest to anybody else (either now or in the future) then send a private message instead.

Here are some obvious examples of when you should not reply to a thread and use the PM system instead:
  • "PM Sent!": Do not tell the rest of us that you sent a PM ... the forum software will tell the other person that they have a PM waiting.
  • "How much is shipping to ....": This is a very specific and directed question that is not of interest to anybody else.


Why do we have this policy? Sending a "PM Sent!" type message basically wastes everybody else's time by making them having to scroll past a post in a thread that looks to be updated, when the update is not meaningful. And the person you are sending the PM to will be notified by the forum software that they have a message waiting for them. Look up at the top near the right edge where it says 'Notifications' ... if you have a PM waiting, it will tell you there.

Rule 5: Copyright and other legal issues

We are here to discuss vintage computing, so discussing software, books, and other intellectual property that is on-topic is fine. We don't want people using these forums to discuss or enable copyright violations or other things that are against the law; whether you agree with the law or not is irrelevant. Do not use our resources for something that is legally or morally questionable.

Our discussions here generally fall under "fair use." Telling people how to pirate a software title is an example of something that is not allowable here.


Reporting problematic posts

If you see spam, a wildly off-topic post, or something abusive or illegal please report the thread by clicking on the "Report Post" icon. (It looks like an exclamation point in a triangle and it is available under every post.) This send a notification to all of the moderators, so somebody will see it and deal with it.

If you are unsure you may consider sending a private message to a moderator instead.


New user moderation

New users are directly moderated so that we can weed spammers out early. This means that for your first 10 posts you will have some delay before they are seen. We understand this can be disruptive to the flow of conversation and we try to keep up with our new user moderation duties to avoid undue inconvenience. Please do not make duplicate posts, extra posts to bump your post count, or ask the moderators to expedite this process; 10 moderated posts will go by quickly.

New users also have a smaller personal message inbox limit and are rate limited when sending PMs to other users.


Other suggestions
  • Use Google, books, or other definitive sources. There is a lot of information out there.
  • Don't make people guess at what you are trying to say; we are not mind readers. Be clear and concise.
  • Spelling and grammar are not rated, but they do make a post easier to read.
See more
See less

The myth of the vertical retrace interrupt on EGA/VGA

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    The myth of the vertical retrace interrupt on EGA/VGA

    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...%20Adapter.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/bzobfyhmpp...etirq.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.
    http://scalibq.wordpress.com/just-ke...o-programming/

    #2
    I remember Dave Haynie talking about this on Usenet. IIRC he mentioned that in his experience some devices that at first appear to trigger the interrupt correctly actually do so with no apparent relationship with the vertical retrace, i.e. the interrupt could occur at any time. Dave seemed pretty horrified by the situation. I'll see if I can find the post.

    Comment


      #3
      Originally posted by cthulhu View Post
      I remember Dave Haynie talking about this on Usenet. IIRC he mentioned that in his experience some devices that at first appear to trigger the interrupt correctly actually do so with no apparent relationship with the vertical retrace, i.e. the interrupt could occur at any time. Dave seemed pretty horrified by the situation. I'll see if I can find the post.
      That is interesting... perhaps for version 2 of my test-program, I should change the palette when the IRQ fires, and turn it off again at the next scanline.
      Then you will have a visual cue of the raster position at which the IRQ is triggered.
      http://scalibq.wordpress.com/just-ke...o-programming/

      Comment


        #4
        Found it: https://groups.google.com/forum/#!se...U/YVEJqshjI8UJ

        Comment


          #5
          Is this the optional IRQ 9 enable jumper I've seen on a few SVGA cards..... and in the configuration for my old Matrox G400? All the documentation states its for some EGA software, but not much else.

          Comment


            #6
            Originally posted by njroadfan View Post
            Is this the optional IRQ 9 enable jumper I've seen on a few SVGA cards..... and in the configuration for my old Matrox G400? All the documentation states its for some EGA software, but not much else.
            Probably. See [here].

            Comment


              #7
              Couple results:

              386DX/25, no-name board based on a "Solutions" chipset, ET4000AX ISA (Diamond SpeedStar), PC-DOS 2000 - works in all three video modes

              P233MMX, i430TX (Advantech single-board PC on a 14-slot ISA backplane), S3 Virge DX PCI, FreeDOS 1.1 - doesn't work in any mode (i.e doesn't count any interrupts & sits at zero)
              ^^ I tried both FreeDOS's JEMMEX and Microsoft's HIMEM/EMM386 just in case that made any difference. Same result.

              I'll try it on a couple more DOS PCs I have around when I get some more time.

              Comment


                #8
                Originally posted by modem7 View Post
                Probably. See [here].
                I don't agree with that explanation though.
                Only real CGA suffers from snow on VRAM access, and only in 80x25 textmode. Many clone CGA cards already solved the snow-issue.
                Neither the PCjr nor the EGA suffer from snow on VRAM access.
                The use for the IRQ is more to facilitate tear-free animation (eg page-flipping), and changing the palette outside of the visible area.

                I don't know of any software that uses it, but it seems that at least for VGA it's not very important, as there are various cards that either don't support it at all, or have a jumper to enable it, and are configured with the IRQ disabled by default. DOSBox also doesn't emulate it, unless you configure it to machine=ega.
                Yet all VGA software appears to run fine on such machines.

                I have tested three of my own machines so far:
                Diamond SpeedStar PRO VLB, CL5426 chipset: works fine in all modes, IRQ generated directly at the end of the visible area.
                Unbranded Tseng Labs ET4000AX ISA: works fine in all modes, IRQ generated directly at the end of the visible area.
                Paradise PVGA1A 8-bit ISA: IRQ is generated in all modes, but seems to appear at 'random' places on screen, jumping all over the place, so it does not seem to be synchronized with the refresh rate at all (although I cannot rule out that there is other hardware that also generates IRQ2, since I tested in a Commodore PC20-III with a custom chipset and Amiga-compatible bus mouse, which may use IRQ2 as well. I will have to try the card in the ET4000-machine to be sure).
                http://scalibq.wordpress.com/just-ke...o-programming/

                Comment


                  #9
                  An update on the Paradise PVGA1A card:
                  I have tested the card in my 486, which is known to work correctly with the CL5426 card. The PVGA1A did not work in it.
                  My suspicions were correct: the card's PCB does not have the 'B4' pin on the ISA bus for IRQ2, so it physically cannot generate an IRQ2 at all. So the IRQ2s in the Commodore PC20-III must have been generated by some other hardware (question is: what? Must be something onboard, since there were no other ISA cards installed).

                  I found the datasheet for the PVGA1A here: http://datasheet.datasheetarchive.co...I000175793.pdf
                  And yes, it documents pin 35 as being the vertical retrace IRQ pin.
                  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.

                  Over at the Vogons forum, someone has been testing with Trident 8900 and 9000 cards, and found the same thing: the IRQ2 line was not connected on the PCB at all, but the chips do have IRQ pins. So he connected a wire from the Trident chips to the proper ISA pin on both cards, and in both cases the IRQs worked fine.
                  http://scalibq.wordpress.com/just-ke...o-programming/

                  Comment


                    #10
                    Originally posted by Scali View Post
                    So he connected a wire from the Trident chips to the proper ISA pin on both cards, and in both cases the IRQs worked fine.
                    Question: What was the upshot?
                    Surely not everyone was Kung-Fu fighting

                    Comment


                      #11
                      Originally posted by Agent Orange View Post
                      Question: What was the upshot?
                      Upshot of what?
                      http://scalibq.wordpress.com/just-ke...o-programming/

                      Comment


                        #12
                        Originally posted by Scali View Post
                        Upshot of what?
                        Connecting the IRQ2 line. What was the end result?
                        Surely not everyone was Kung-Fu fighting

                        Comment


                          #13
                          Originally posted by Agent Orange View Post
                          Connecting the IRQ2 line. What was the end result?
                          That it behaved correctly, and signaled an interrupt at the end of the visible area every frame, as per the IBM EGA, VGA and XGA specification.
                          http://scalibq.wordpress.com/just-ke...o-programming/

                          Comment


                            #14
                            Originally posted by Scali View Post
                            That it behaved correctly, and signaled an interrupt at the end of the visible area every frame, as per the IBM EGA, VGA and XGA specification.
                            Not to nit-pick, but what would the observer see? Would performance or viewing be noticeably enhanced?
                            Surely not everyone was Kung-Fu fighting

                            Comment


                              #15
                              Originally posted by Agent Orange View Post
                              Not to nit-pick, but what would the observer see? Would performance or viewing be noticeably enhanced?
                              I don't think the user would notice a difference. It seems that because of the poor support of this functionality on clone VGA systems, that it was rarely used by software, if at all.
                              My intention with this thread is two-fold:
                              1) To see if we can get a decent idea of how well-supported this feature really is, and whether developers in the past were right to avoid this functionality.
                              2) If it is supported widely enough, I might use it in my future DOS demos. The PC platform has a nasty shortage of timers. Being able to use the 8253 PIT for music and timing the graphics on the vertical retrace would make some things a lot easier/more accurate.
                              http://scalibq.wordpress.com/just-ke...o-programming/

                              Comment

                              Working...
                              X