Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!netsys!attctc!chasm From: chasm@attctc.DALLAS.TX.US (Charles Marslett) Newsgroups: comp.graphics Subject: Re: IBM CGA, Using Stack Pushes to Screen Memory. Summary: REP MOVSB better be interruptable! Message-ID: <8674@attctc.DALLAS.TX.US> Date: 16 Jul 89 20:48:16 GMT References: <313@edstip.EDS.COM> <2820@blake.acs.washington.edu> Distribution: comp Organization: The Unix(R) Connection, Dallas, Texas Lines: 30 In article <2820@blake.acs.washington.edu>, wiml@blake.acs.washington.edu (William Lewis) writes: > 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. "Read the manual" applies to this comment as well. See page 17-140 in the 386 Programmer's Ref. Manual from intel. (I don't have the 8088 or 286 books handy, but I believe they have identical, or at least equivalent, language describing interrupts and the REP instructions. To do a REP STOSB or REP MOVSB with interrupts off you had better bracket it with a CLI and an STI just like the code above. On the other hand, interrupts don't modify the memory pointed to by ES:DI (usually ;^). One final point, the CLI disables normal interrupts, not NMIs. If you have an odd computer that uses NMI for any normal operation, you may need to go through some gyrations to disable and reenable them too. (IBM's micro- channel computers and Tandy's old 1000 are two cases that come to mind.) > --- phelliax Charles Marslett chasm@attctc.dallas.tx.us