[comp.graphics] IBM CGA, Using Stack Pushes to Scre

brown@m.cs.uiuc.edu (07/16/89)

>Is there a way to make the computer not do
>any interrupts while I'm doing this screen push?  Any other comments would
>be helpful.  I am doing this form of screen update because it is very very
>fast, and I don't want to see the screen being painted, I want the screen
>to snap to a new image.


    The "answer" to your question (about how to shut off interrupts on the
PC) is to use the "CLI" instruction (clear interrupt enable) to ignore
interrupts.  Interrupts are turned back on with the "STI" instruction (set
interrupt enable).  


    But. . . relocating the stack to screen memory and PUSHing your data
to the display is a profoundly clumsy and inefficient way to handle a
bit-mapped display.  (BTW:  it is not the fastest way to access the display
buffer either--the "REP MOVSW" (move string word, repeated instruction) is
the fastest.)  Also, it is not a good idea to leave interrupts shut off for
long time periods (which pushes to the display buffer require), since some
event (ie. data coming into the serial port) might be missed.

    If you're doing graphics work on a PC, get a copy of Richard Wilton's
"Programmer's Guide to PC and PS/2 Video Systems" (from Microsoft Press).
It contains detailed descriptions of PC video hardware (even the horribly
obsolete Children's Graphics Adapter) and MASM code to do many common
video operations.  It'll save you a lot of time over reinventing the wheel,
and the code he presents is a good deal more efficient than pushing to the
display buffer.  



        William Brown
        brown@cs.uiuc.edu
        University of Illinois at Urbana-Champaign