Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!shelby!neon!rokicki From: rokicki@Neon.Stanford.EDU (Tomas G. Rokicki) Newsgroups: comp.sys.amiga.tech Subject: Re: How do I blit this? Message-ID: <1991Jan8.220206.769@Neon.Stanford.EDU> Date: 8 Jan 91 22:02:06 GMT References: <9101061957.AA20737@en.ecn.purdue.edu> Organization: Computer Science Department, Stanford University Lines: 39 >I've got a 320x200 bitplane, and I want to blit out a 16x16 bit rectangle. >I want it to go into a buffer area the size of 16 words. Sounds fine. It's >easy if the source rectangle is on a word boundary, too. But supposing the >source rectangle is shifted off the word boundary, I'll have to use the bit >shifter in the blitter. No problem there. Let me draw a picture of the >The question is, how do I get the blitter to not WRITE the first word on >each line? For a two-word wide blit, I'll need a two-word wide place to put >the result. I only want to use my 1-word by 16-line storage for the result. The simplest way is to work from the bottom up (using negative modulos.) With this, you will write the first word, but it will be overwritten later with the correct value. (Note that you do not use descending mode, just negative modulos.) Otherwise, you can set something up like D = C . ~A + B . A and use the masking capabilities of the blitter to restore whatever was there originally in the destination. The only difficulty with this is that the blitter is pipelined---let's say your destination is short a[], the blitter will: First `line' (two words): fetch a[-1], compute new a[-1], store nothing fetch a[0], compute new a[0], store a[-1] Next `line' (two words) fetch *old* a[0], compute `new' incorrect a[0], store pipelined a[0] fetch a[1], compute new a[1], store new incorrect a[0]. I don't think the blitter flushes the pipeline at the end of each line. If it did, this wouldn't be a problem. But using negative modulos can do magic . . . -tom