Updates for dual playfield example

This commit is contained in:
alpine9000 2016-03-13 19:39:42 +11:00
parent 9a0ea27e36
commit d895290a8a
10 changed files with 84 additions and 18 deletions

View File

@ -1,8 +1,8 @@
MODULE=dual_playfield_mode.s
FLOPPY=bin/dual_playfield_mode.adf
IMAGEDATA=out/playfield1-palette.s out/playfield2-palette.s out/playfield1.bin out/playfield2.bin
PF1_FILE=../assets/playfield1.png
PF2_FILE=../assets/playfield2.png
PF1_FILE=../assets/playfield1_8.png
PF2_FILE=../assets/playfield2_8.png
EXTRA=$(IMAGEDATA) init.s utils.s constants.i Makefile
BASE_ADDRESS=10000

View File

@ -1,7 +1,61 @@
dual playfield
==============
Work in progress
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](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](dual_playfield_mod.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
;; for 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:
;; for 3 bitplanes per playfieldd, 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:
```
;; 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, and optionally re-order the bitplanes:
```
;; 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
------

View File

@ -3,7 +3,7 @@ LVL3_INT_VECTOR equ $6c
SCREEN_WIDTH equ 320
SCREEN_HEIGHT equ 256
SCREEN_WIDTH_BYTES equ (SCREEN_WIDTH/8)
SCREEN_BIT_DEPTH equ 1
SCREEN_BIT_DEPTH equ 3 ; 3 bitplanes per playfield
SCREEN_RES equ 8 ; 8=lo resolution, 4=hi resolution
RASTER_X_START equ $81 ; hard coded coordinates from hardware manual
RASTER_Y_START equ $2c

View File

@ -1,23 +1,22 @@
include "../include/registers.i"
include "hardware/dmabits.i"
include "hardware/intbits.i"
include "constants.i"
entry:
lea CUSTOM,a6
bsr init
bsr.s installColorPalette
.mainLoop:
bsr waitVerticalBlank
bra .mainLoop
include "init.s"
include "utils.s"
pokeBitplanePointers: ; d0 = frame offset in bytes, a0 = BPLP copper list address
pokeBitplanePointers:
;; a0 = BPLP copper list address
;; a1 = address of playfield's interleaved bitplane data
movem.l d0-a6,-(sp)
moveq #SCREEN_BIT_DEPTH-1,d0
.bitplaneloop:
@ -33,24 +32,30 @@ pokeBitplanePointers: ; d0 = frame offset in bytes, a0 = BPLP copper list addr
installColorPalette:
;; these palette files set the correct colors for each playfield
;; playfield1 uses COLOR00 -> COLOR07
include "out/playfield1-palette.s"
;; playfield2 uses COLOR08 -> COLOR15
include "out/playfield2-palette.s"
rts
copper:
;; bitplane pointers must be first else poking addresses will be incorrect
pf1_bitplanepointers:
pf1_bitplanepointers:
;; this is where bitplanes are assigned to playfields
;; http://amigadev.elowar.com/read/ADCD_2.1/Hardware_Manual_guide/node0079.html
;; for 3 bitplanes per playfield, playfield1 gets bitplanes 1,3,5
dc.w BPL1PTL,0
dc.w BPL1PTH,0
pf2_bitplanepointers:
dc.w BPL2PTL,0
dc.w BPL2PTH,0
dc.w BPL3PTL,0
dc.w BPL3PTH,0
dc.w BPL4PTL,0
dc.w BPL4PTH,0
dc.w BPL5PTL,0
dc.w BPL5PTH,0
pf2_bitplanepointers:
;; for 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

View File

@ -8,10 +8,12 @@ init:
;; set up default palette
bsr.s installColorPalette
;; 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
@ -19,13 +21,17 @@ init:
;; set up playfield
move.w #(RASTER_Y_START<<8)|RASTER_X_START,DIWSTRT(a6)
move.w #((RASTER_Y_STOP-256)<<8)|(RASTER_X_STOP-256),DIWSTOP(a6)
move.w #(RASTER_X_START/2-SCREEN_RES),DDFSTRT(a6)
move.w #(RASTER_X_START/2-SCREEN_RES)+(8*((SCREEN_WIDTH/16)-1)),DDFSTOP(a6)
;; enabled 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)
move.w #SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH-SCREEN_WIDTH_BYTES,BPL1MOD(a6)
move.w #SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH-SCREEN_WIDTH_BYTES,BPL2MOD(a6)
;; install copper list, then enable dma and selected interrupts

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
assets/playfield1_8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
assets/playfield2_8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -1,4 +1,5 @@
COLOR_ON equ $200
LACE equ $004
HOMOD equ $800
DBLPF equ $400
DBLPF equ $400
PF2PRI equ $040