diff --git a/017.dual_playfield/Makefile b/017.dual_playfield/Makefile index e488a6e..1d8bd0d 100644 --- a/017.dual_playfield/Makefile +++ b/017.dual_playfield/Makefile @@ -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 diff --git a/017.dual_playfield/README.md b/017.dual_playfield/README.md index ccd1f43..1728c25 100644 --- a/017.dual_playfield/README.md +++ b/017.dual_playfield/README.md @@ -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 ------ diff --git a/017.dual_playfield/constants.i b/017.dual_playfield/constants.i index 2f85b31..0929ed5 100644 --- a/017.dual_playfield/constants.i +++ b/017.dual_playfield/constants.i @@ -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 diff --git a/017.dual_playfield/dual_playfield_mode.s b/017.dual_playfield/dual_playfield_mode.s index c553969..18f63c5 100644 --- a/017.dual_playfield/dual_playfield_mode.s +++ b/017.dual_playfield/dual_playfield_mode.s @@ -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 diff --git a/017.dual_playfield/init.s b/017.dual_playfield/init.s index 140a440..76ca918 100644 --- a/017.dual_playfield/init.s +++ b/017.dual_playfield/init.s @@ -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 diff --git a/017.dual_playfield/screenshots/screenshot.png b/017.dual_playfield/screenshots/screenshot.png new file mode 100644 index 0000000..122bf42 Binary files /dev/null and b/017.dual_playfield/screenshots/screenshot.png differ diff --git a/017.dual_playfield/screenshots/screenshot2.png b/017.dual_playfield/screenshots/screenshot2.png new file mode 100644 index 0000000..0100d02 Binary files /dev/null and b/017.dual_playfield/screenshots/screenshot2.png differ diff --git a/assets/playfield1_8.png b/assets/playfield1_8.png new file mode 100644 index 0000000..4eaa7d8 Binary files /dev/null and b/assets/playfield1_8.png differ diff --git a/assets/playfield2_8.png b/assets/playfield2_8.png new file mode 100644 index 0000000..c8774ec Binary files /dev/null and b/assets/playfield2_8.png differ diff --git a/include/bplconbits.i b/include/bplconbits.i index cda50b0..816b667 100644 --- a/include/bplconbits.i +++ b/include/bplconbits.i @@ -1,4 +1,5 @@ COLOR_ON equ $200 LACE equ $004 HOMOD equ $800 -DBLPF equ $400 \ No newline at end of file +DBLPF equ $400 +PF2PRI equ $040 \ No newline at end of file