1
0
mirror of https://frontier.innolan.net/github/AmigaExamples.git synced 2025-11-22 19:58:45 +00:00

First try and dual playfield

This commit is contained in:
alpine9000
2016-03-13 18:05:59 +11:00
parent 4f14513425
commit 1fd19b7844
7 changed files with 170 additions and 0 deletions

View File

@ -0,0 +1,17 @@
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
EXTRA=$(IMAGEDATA) init.s utils.s constants.i Makefile
BASE_ADDRESS=10000
include ../shared/base.mk
$(IMAGEDATA): $(IMAGECON) $(PF1_FILE) $(PF2_FILE)
echo "imagecon = " $(IMAGECON)
$(IMAGECON) --input $(PF1_FILE) --output out/playfield1 --output-bitplanes --output-palette-asm --output-palette
$(IMAGECON) --input $(PF2_FILE) --output out/playfield2 --output-bitplanes --output-palette-asm --palette-offset 8 --output-palette

View File

@ -0,0 +1,18 @@
dual playfield
==============
Work in progress
try it
------
* [Download disk image](bin/dual_playfield_mode.adf?raw=true)
* <a href="http://alpine9000.github.io/ScriptedAmigaEmulator/#amiga_examples/dual_playfield_mode.adf" target="_blank">Run in SAE</a>
interlaced
----------
![interlaced](screenshots/laced-new.png?raw=true)
non-interlaced
--------------
![non-interlaced](../013.dithered_ham/screenshots/dithered.png?raw=true)

Binary file not shown.

View File

@ -0,0 +1,11 @@
VPOSRLOFBIT equ 15
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_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
RASTER_X_STOP equ RASTER_X_START+SCREEN_WIDTH
RASTER_Y_STOP equ RASTER_Y_START+256

View File

@ -0,0 +1,63 @@
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
movem.l d0-a6,-(sp)
moveq #SCREEN_BIT_DEPTH-1,d0
.bitplaneloop:
move.l a1,d1
move.w d1,2(a0)
swap d1
move.w d1,6(a0)
lea SCREEN_WIDTH_BYTES(a1),a1
addq #8,a0
dbra d0,.bitplaneloop
movem.l (sp)+,d0-a6
rts
installColorPalette:
include "out/playfield1-palette.s"
include "out/playfield2-palette.s"
rts
copper:
;; bitplane pointers must be first else poking addresses will be incorrect
pf1_bitplanepointers:
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
dc.w BPL6PTL,0
dc.w BPL6PTH,0
dc.l $fffffffe
pf1_bitplanes:
incbin "out/playfield1.bin"
pf2_bitplanes:
incbin "out/playfield2.bin"

38
017.dual_playfield/init.s Normal file
View File

@ -0,0 +1,38 @@
include "../include/bplconbits.i"
;; custom chip base globally in a6
init:
movem.l d0-a6,-(sp)
move #$7ff,DMACON(a6) ; disable all dma
move #$7fff,INTENA(a6) ; disable all interrupts
;; set up default palette
bsr.s installColorPalette
lea pf1_bitplanepointers(pc),a0
lea pf1_bitplanes(pc),a1
bsr.s pokeBitplanePointers
lea pf2_bitplanepointers(pc),a0
lea pf2_bitplanes(pc),a1
bsr.s pokeBitplanePointers
;; 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)
move.w #((SCREEN_BIT_DEPTH*2)<<12)|COLOR_ON|DBLPF,BPLCON0(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
lea copper(pc),a0
move.l a0,COP1LC(a6)
move.w COPJMP1(a6),d0
move.w #(DMAF_BLITTER|DMAF_SETCLR!DMAF_COPPER!DMAF_RASTER!DMAF_MASTER),DMACON(a6)
;; move.w #(INTF_SETCLR|INTF_VERTB|INTF_INTEN),INTENA(a6)
movem.l (sp)+,d0-a6
rts

View File

@ -0,0 +1,23 @@
waitVerticalBlank:
movem.l d0-a6,-(sp)
.loop move.l $dff004,d0
and.l #$1ff00,d0
cmp.l #303<<8,d0
bne.b .loop
movem.l (sp)+,d0-a6
rts
waitRaster: ;wait for rasterline d0.w. Modifies d0-d2/a0.
movem.l d0-a6,-(sp)
move.l #$1ff00,d2
lsl.l #8,d0
and.l d2,d0
lea $dff004,a0
.wr: move.l (a0),d1
and.l d2,d1
cmp.l d1,d0
bne.s .wr
movem.l (sp)+,d0-a6
rts