1
0
mirror of https://frontier.innolan.net/github/AmigaExamples.git synced 2025-11-22 01:36:06 +00:00
Files
AmigaExamples/017.dual_playfield
2016-03-20 21:11:56 +11:00
..
2016-03-13 19:51:01 +11:00
2016-03-13 19:39:42 +11:00
2016-03-20 21:11:56 +11:00
2016-03-13 19:39:42 +11:00
2016-03-13 20:00:54 +11:00
2016-03-13 18:05:59 +11:00

dual playfield

hardware reference link

We now try and set up a dual playfield screen with 3 bitplanes per playfield. This gives us 7 colors + transparent for each playfield.

Set the number of bitplanes per playfield in constants.i

SCREEN_BIT_DEPTH	equ 3   ; 3 bitplanes per playfield

New copper list that assigns bitplanes to each playfield after poking in dual_playfield_mode.s

copper:
pf1_bitplanepointers:
  ;; this is where bitplanes are assigned to playfields
  ;; http://amigadev.elowar.com/read/ADCD_2.1/Hardware_Manual_guide/node0079.html
  ;; 3 bitplanes per playfield, playfield1 gets bitplanes 1,3,5
  dc.w	BPL1PTL,0
  dc.w	BPL1PTH,0
  dc.w	BPL3PTL,0
  dc.w	BPL3PTH,0
  dc.w	BPL5PTL,0
  dc.w	BPL5PTH,0
pf2_bitplanepointers:
  ;; 3 bitplanes per playfield, playfield2 gets bitplanes 2,4,6
  dc.w	BPL2PTL,0
  dc.w	BPL2PTH,0
  dc.w	BPL4PTL,0
  dc.w	BPL4PTH,0
  dc.w	BPL6PTL,0
  dc.w	BPL6PTH,0
  dc.l	$fffffffe

Poke the copper list with the bitplane pointer addresses in init.s:

  ;; poke playfield 1 bitplane pointers
  lea     pf1_bitplanepointers(pc),a0
  lea     pf1_bitplanes(pc),a1
  bsr.s   pokeBitplanePointers

  ;; poke playfield 2 bitplane pointers
  lea     pf2_bitplanepointers(pc),a0
  lea     pf2_bitplanes(pc),a1
  bsr.s   pokeBitplanePointers	

Enable 2x the bitplanes, set the DBLPF bit in BPLCON0 to enable dual playfields. Optionally re-order the playfields with PF2PRI in BPLCON2. See init.s:

  ;; enable 2x the bitplanes as 2x playfields
  move.w #((SCREEN_BIT_DEPTH*2)<<12)|COLOR_ON|DBLPF,BPLCON0(a6)
  ;; set playfield2 to have priority
  move.w #PF2PRI, BPLCON2(a6)

try it

Screenshots:

playfield 1

playfield 1

playfield 2

playfield 2

dual playfields, playfield 2 in front

	move.w #PF2PRI, BPLCON2(a6)

dual playfields, playfield 2 in front dual playfields, playfield 1 in front

	move.w #0, BPLCON2(a6)

dual playfields, playfield 1 in front