Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!cornell!batcomputer!itsgw!imagine!rpics!guilford
From: guilford@rpics (Jim Guilford)
Newsgroups: comp.sys.amiga.tech
Subject: Re: MINTERM_SWAP?
Summary: Needs three blits
Keywords: MINTERM graphics how
Message-ID: <1946@imagine.PAWL.RPI.EDU>
Date: 5 Dec 88 15:50:35 GMT
References: <1576@nmtsun.nmt.edu>
Sender: news@imagine.PAWL.RPI.EDU
Reply-To: guilford@turing.cs.rpi.edu (Jim Guilford)
Organization: RPI CS Dept.
Lines: 42

In article <1576@nmtsun.nmt.edu> wbnsnsr@nmtsun.nmt.edu (William Norris) writes:
>Is there a simple way to swap two bitmaps without a third temporary bitmap?
>
>I've looked over the MINTERMS, but none seem to do the trick.  How come
>the lower nibble in the MINTERM is always 0?  If 0xC0 is a copy, shouldn't
>0xCC be a swap?
>
>
>-- 
>wbnsnsr@nmtsun.nmt.edu                             |    /// Seulement
>William B. Norris IV                               |\\ ///  l'Amiga peut 
>POB #2185 C/S                                      | \\//   vous l'offrir.
>Socorro, NM  87801                                 |=-=-=-=-=-=-=-=-=-=-=-=-=


I don't have the RKM handy, so I can't give you a detailed answer
about 0xC0. Off hand, I would say that the low order nibble is zer
because the examples are only using two input sources. In this case
there are 2^2 or four minterms (bits) needed. The only time you need
to worry about the low order nibble is when you are dealing with three
sources (don't quote me on this, this is off the top of my head).

In any event, since there is only one destination, it is definately
impossible to do a swap in one blit. It is possible to do a swap in
three blits without a temp space. If you let your two bit maps be A
and B, then the following will swap them:

A <- A xor B
B <- A xor B
A <- A xor B

If you check the math:

A1 <- A0 + B0
B1 <- A1 + B0 == (A0 + B0) + B0 == A0 + (B0 + B0) == A0 + 0 == A0
A2 <- A1 + B1 == (A0 + B0) + A0 == B0 + (A0 + A0) == B0

Check the RKM, but I would guess that an XOR minterm is $60 ??

--JimG
guilford@cs.rpi.edu
...!rutgers!nysernic!rpics!guilford