Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!csd4.milw.wisc.edu!indri!caesar!blake!wiml From: wiml@blake.acs.washington.edu (William Lewis) Newsgroups: comp.graphics Subject: Re: IBM CGA, Using Stack Pushes to Screen Memory. Summary: urg, ug, yuk Message-ID: <2820@blake.acs.washington.edu> Date: 15 Jul 89 05:21:38 GMT References: <313@edstip.EDS.COM> Reply-To: wiml@blake.acs.washington.edu (William Lewis) Distribution: comp Organization: University of Washington, Seattle Lines: 33 In article <313@edstip.EDS.COM> alf@edstip.EDS.COM (John Hamill) writes: >I am writing a MASM program for the IBM PC CGA monitor. I am setting the >stack pointer to the screen memory and using PUSHes to move data to this >area of the screen. This works fine for the whole screen, but when I >do a small rectangle area there is a problem. The problem is: I think >the computer is doing an interupt and pushing and poping from the stack, >which is the screen, so now there is garbage on the screen. This doesn't >happen when I do the whole screen becouse I write over the whole screen and >this writes over the garbage. Is there a way to make the computer not do >any interupts while I'm doing this screen push? Any other comments would >be helpful. I am doing this form of screen update becouse 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. I've seen this question several times just recently. It makes me wonder how well people read manuals. There are two ways around this problem that just spring to mind. The first way is just enlarging on the kludge of PUSHing to screen memory. (Ugh!). "Is there a way to make the computer not do any interrupts while I'm doing this screen push?". Yes: turn off the interrupts! This is done with the "CLI" instruction. But remember to turn 'em back on with "STI". (Those are CLear Interrupt flag, and STart Interrupts.) The second way is what you should have done in the first place. Use a REP MOVSB (or REP MOVSW or...) instruction. Not only is this instruction uninterruptible (on mostm processors), but it is also faster. Not only that, but you are using "the right opcode for the job", which tends to get better results. setflame(0); /* end of message clean-up */ --- phelliax ""