[comp.sys.amiga.tech] dual playfields under Intuition

phi@goanna.oz (Philip Hingston) (09/25/89)

Hi All,
	Someone has probably asked this before but...

	How do you go about setting up a dual playfield display under
	Intuition?

	The Intuition manual suggests it's possible, but doesn't give details.
The RKM shows how to set up a dual playfield display but not with Intuition.

	I've sort of got it working by opening an Intuition window with
DUALPF set and then reorganising things the way I want them. However, the
display momentarily does colorful things during this setup, and I then seem
to have a problem with the color map.

	I opened the window with 6 bitplanes, and Intuition initialised it
with two playfields, one with 6 bitplanes and the other with none! I
changed this to use 3 bitplanes for each playfield. Unfortunately, I only
seem to have 8 colours, shared by the two playfields, instead of 16 colours
with the first 8 for playfield 1 and the second for playfield 2.

	Are there any wise people out there who can suggest the "correct" way
to do this thing?

					cheers		phi
					(phi%goanna.cs.rmit.oz.au@australia)

papa@pollux.usc.edu (Marco Papa) (09/26/89)

In article <2413@goanna.oz> phi@goanna.oz (Philip Hingston) writes:
>	How do you go about setting up a dual playfield display under
>	Intuition?

All the required code is available on pp. 69-75 of the Amiga Enhancer 
Software manual Version 1.2, courtesy of Jim Mackraz.

-- Marco Papa 'Doc'
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
uucp:...!pollux!papa       BIX:papa       ARPAnet:pollux!papa@oberon.usc.edu
"There's Alpha, Beta, Gamma, Diga and Caligari!" -- Rick Unland
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

addison@pollux.usc.edu (Richard Addison) (09/27/89)

In article <20125@usc.edu> papa@pollux.usc.edu (Marco Papa) writes:
>In article <2413@goanna.oz> phi@goanna.oz (Philip Hingston) writes:
>>	How do you go about setting up a dual playfield display under
>>	Intuition?
>
>All the required code is available on pp. 69-75 of the Amiga Enhancer 
>Software manual Version 1.2, courtesy of Jim Mackraz.

I do, at one time, remember seeing this manual.  However, when I was finally
able to get an Amiga of my very own (after moving some 2000 miles away from
the one I had been using) I bought an Amiga 2000 which came with Version
1.2.  I now have version 1.3.  I do not, however, have the Amiga Enhancer
Software manual Version 1.2 that Marco refers to here.

Is there, or will there be, a manual that is a proper superset of the
Amiga Enhancer Manual?

Richard Addison
"This quote space for rent."

rap@peck.ardent.com (Rob Peck) (09/30/89)

In article <2413@goanna.oz> phi@goanna.oz (Philip Hingston) writes:
>	How do you go about setting up a dual playfield display under
>	Intuition?
>	The Intuition manual suggests it's possible, but doesn't give details.
>The RKM shows how to set up a dual playfield display but not with Intuition.
>	Are there any wise people out there who can suggest the "correct" way
>to do this thing?


Creating A Dual Playfield Display
 
(on a custom screen, without making Intuition barf)

1. You open your custom screen WITHOUT the DUALPF bit set in view modes.
   The maximum depth of your bitmap of the custom screen must be 3 or
   less, because in dual playfield mode, there are a maximum of 6 bitplanes.

2. If you open the screen as a SCREENBEHIND, nobody will see the munging
   that you do before it is displayed.  But when Jim Mackraz's example
   does munging, the display did not flash or anything so this part
   might not be necessary.

3. Allocate additional rasters (AllocRaster) to be used as the second
   playfield.  They should preferably be the same size as that of the
   first playfield (it IS possible to make the second set of rasters
   larger or smaller -- I have done it, but not in an Intuition-compatible
   example).  The number of rasters allocated must be the same as or
   one fewer than the number allocated to the first playfield because
   the system will allocate bitmaps to playfields (a hardware limitation)
   as: 

	Total Planes: 1 2 3 4 5 6

	Playfield 1:  1 1 2 2 3 3
        Playfield 2:  0 1 1 2 2 3 
  
   The default value used by Intuition for custom.bplcon2 places Playfield
   1 in front of Playfield 2.  This is a value of 0x24.  Regarding playfields,
   The only critical bit is bit 6 of this value.   Bits 0-5 control the
   priority of the placement of the sprites with respect to the playfields.
   (See the Amiga Hardware Manual, System Control Hardware, for more info).
   For those bits you want values of (binary) 100100 to make sure that
   all of your sprites can be seen, regardless of the placement of the
   Playfields.

   Playfield 1's colors come from color registers 0-7, and any place where
   color 0 is used, Playfield 1 becomes transparent.

   Playfield 2's colors come from color registers 8-15.  These are "real"
   colors, where even color 8 shows up when drawn.  If a RastPort is
   created and attached to the bitmap that defines playfield 2, the
   pen colors 0-7 of that bitmap (assuming a 3 plane deep second playfield
   display) are mapped to colors 8-15.

4. Allocate a rasinfo structure (rasinfo2) and a bitmap structure (bitmap2)
   that will be associated with the second playfield.  Initialize the
   bitmap to correspond to the size and depth of plane set to which it will
   be attached.  Then point the planes pointers in the bitmap to the
   planepointers obtained from AllocRaster.
   
5. Allocate a RastPort and attach it to the same bitmap (bitmap2) so that
   you can draw into the second playfield.

6. SetRGB4 some colors in registers 8-15 for the second playfield.

7. Forbid(), attach the new rasinfo structure to the existing one in
   the viewport of the custom screen, set the DUALPF bit in the viewport
   modes in for the custom screen.  Permit(), MakeScreen(screen) and
   RethinkDisplay().

   Now you can render into either the screen (or open windows or whatever),
   or you can render into the background playfield using the new RastPort.
   Intuition won't know you were foolin' around at all. The screen
   remains pushable, draggable etc.

   Before you close the screen, however:  Forbid(), reset the DUALPF
   bit to zero in the viewport modes, reset the rasinfo->Next pointer
   to NULL, Permit(), MakeScreen(screen), RethinkDisplay();  And
   free the rasters, bitmaps and rasinfo you allocated for this second
   playfield.

Jim Mackraz provided the example that folks have been talking about,
for which he turns the Workbench into a dualplayfield (2 + 1) display.
I have modified his example to do this to a custom screen, as a 3 + 3,
320 by 200.  Though I believe that all of the details above are accurate,
there is nothing like a functioning example to let folks figure it out on
their own and with which to experiment.  THAT will be posted (with Jimm's
permission) on Monday, with my mods installed.


Rob Peck