Improved version of lace_mode
This commit is contained in:
parent
82c28097a2
commit
f244f9f345
|
@ -1,10 +1,15 @@
|
|||
INTERLACE=1
|
||||
MODULE=lace_mode.s
|
||||
FLOPPY=bin/lace_mode.adf
|
||||
IMAGEDATA=out/image-palette.s out/image-ham.bin
|
||||
ifeq ($(INTERLACE),1)
|
||||
IMAGEFILE=../assets/gigi_320x512.png
|
||||
else
|
||||
IMAGEFILE=../assets/gigi.png
|
||||
endif
|
||||
EXTRA=$(IMAGEDATA) $(BOB_IMAGEDATA) init.s utils.s constants.i Makefile
|
||||
BASE_ADDRESS=40000
|
||||
|
||||
BASE_ADDRESS=40000 # The extra data in a 512 row bitplane dataset caused the original base (0x70000) to crash into something bad
|
||||
VASM_EXTRA_ARGS=-DINTERLACE=$(INTERLACE)
|
||||
USE_PALETTE=--use-palette gigi.pal
|
||||
DITHER=--dither
|
||||
|
||||
|
|
|
@ -1,7 +1,49 @@
|
|||
interlaced playfield
|
||||
====================
|
||||
|
||||
Work in progress
|
||||
For interlace mode, we can enable it by simply setting the LACE bit in BPLCON0:
|
||||
|
||||
```
|
||||
move.w #(SCREEN_BIT_DEPTH<<12)|COLOR_ON|HOMOD|LACE,BPLCON0(a6)
|
||||
`` `
|
||||
|
||||
Now each alternating frame will be offset vertically by half a scan line.
|
||||
|
||||
So for this to work, we need to make some other changes. Firstly we need twice the number of rows in our bitplane data. Then on each alternating frame we need to set up the bitplane pointers such that they point at the correct set of row data. For this we set up two copper lists, then poke offset bitplane pointers into one of them:
|
||||
|
||||
```
|
||||
;; poke the bitplane pointers for the two copper lists.
|
||||
move.l #SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH,d0
|
||||
lea copper(pc),a0
|
||||
bsr.s pokeBitplanePointers
|
||||
|
||||
moveq.l #0,d0
|
||||
lea copperLOF(pc),a0
|
||||
bsr.s pokeBitplanePointers
|
||||
```
|
||||
|
||||
Then, during the vertical blank, depending on the LOF bit in the VPOSR register, we install the correct copper list:
|
||||
|
||||
```
|
||||
.mainLoop:
|
||||
bsr waitVerticalBlank
|
||||
|
||||
btst.w #VPOSRLOFBIT,VPOSR(a6)
|
||||
beq.s .lof
|
||||
lea copper(pc),a0
|
||||
move.l a0,COP1LC(a6)
|
||||
bra .done
|
||||
.lof:
|
||||
lea copperLOF(pc),a0
|
||||
move.l a0,COP1LC(a6)
|
||||
.done
|
||||
bra .mainLoop
|
||||
```
|
||||
|
||||
This example allows your to enable/disable INTERLACE mode in the [Makefile](Makefile)
|
||||
```
|
||||
INTERLACE=1
|
||||
```
|
||||
|
||||
try it
|
||||
------
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
VPOSRLOFBIT equ 15
|
||||
LVL3_INT_VECTOR equ $6c
|
||||
SCREEN_WIDTH equ 320
|
||||
SCREEN_HEIGHT equ 512
|
||||
SCREEN_HEIGHT equ (256+(256*INTERLACE))
|
||||
SCREEN_WIDTH_BYTES equ (SCREEN_WIDTH/8)
|
||||
SCREEN_BIT_DEPTH equ 6
|
||||
SCREEN_RES equ 8 ; 8=lo resolution, 4=hi resolution
|
||||
|
|
|
@ -7,6 +7,17 @@ init:
|
|||
|
||||
;; set up default palette
|
||||
bsr.s installColorPalette
|
||||
|
||||
if INTERLACE == 1
|
||||
;; poke the bitplane pointers for the two copper lists.
|
||||
move.l #SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH,d0
|
||||
lea copper(pc),a0
|
||||
bsr.s pokeBitplanePointers
|
||||
endif
|
||||
|
||||
moveq.l #0,d0
|
||||
lea copperLOF(pc),a0
|
||||
bsr.s pokeBitplanePointers
|
||||
|
||||
;; set up playfield
|
||||
move.w #(RASTER_Y_START<<8)|RASTER_X_START,DIWSTRT(a6)
|
||||
|
@ -14,13 +25,20 @@ init:
|
|||
|
||||
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)
|
||||
|
||||
|
||||
if INTERLACE == 1
|
||||
move.w #(SCREEN_BIT_DEPTH<<12)|COLOR_ON|HOMOD|LACE,BPLCON0(a6)
|
||||
move.w #2*SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH-SCREEN_WIDTH_BYTES,BPL1MOD(a6)
|
||||
move.w #2*SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH-SCREEN_WIDTH_BYTES,BPL2MOD(a6)
|
||||
else
|
||||
move.w #(SCREEN_BIT_DEPTH<<12)|COLOR_ON|HOMOD,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)
|
||||
endif
|
||||
|
||||
|
||||
;; install copper list, then enable dma and selected interrupts
|
||||
lea copper(pc),a0
|
||||
lea copperLOF(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)
|
||||
|
|
|
@ -5,69 +5,50 @@
|
|||
include "constants.i"
|
||||
|
||||
entry:
|
||||
lea CUSTOM,a6
|
||||
lea CUSTOM,a6
|
||||
bsr init
|
||||
bsr.s installColorPalette
|
||||
|
||||
.mainLoop:
|
||||
bsr waitVerticalBlank
|
||||
cmpi.w #0,cycle
|
||||
bne.s .alternate
|
||||
move.w #1,cycle
|
||||
bsr.s pokeBitplanePointers2
|
||||
|
||||
if INTERLACE == 1
|
||||
btst.w #VPOSRLOFBIT,VPOSR(a6)
|
||||
beq.s .lof
|
||||
lea copper(pc),a0
|
||||
move.l a0,COP1LC(a6)
|
||||
bra .done
|
||||
.alternate:
|
||||
move.w #0,cycle
|
||||
bsr.s pokeBitplanePointers
|
||||
.lof:
|
||||
lea copperLOF(pc),a0
|
||||
move.l a0,COP1LC(a6)
|
||||
.done
|
||||
endif
|
||||
bra .mainLoop
|
||||
|
||||
include "init.s"
|
||||
include "utils.s"
|
||||
|
||||
pokeBitplanePointers:
|
||||
;; poke bitplane pointers
|
||||
movem.l d0-a6,-(sp)
|
||||
lea bitplanes(pc),a1
|
||||
lea copper(pc),a2
|
||||
moveq #SCREEN_BIT_DEPTH-1,d0
|
||||
.bitplaneloop:
|
||||
move.l a1,d1
|
||||
move.w d1,2(a2)
|
||||
swap d1
|
||||
move.w d1,6(a2)
|
||||
lea SCREEN_WIDTH_BYTES(a1),a1 ; bit plane data is interleaved
|
||||
addq #8,a2
|
||||
dbra d0,.bitplaneloop
|
||||
movem.l (sp)+,d0-a6
|
||||
rts
|
||||
|
||||
pokeBitplanePointers2:
|
||||
;; poke bitplane pointers
|
||||
movem.l d0-a6,-(sp)
|
||||
lea bitplanes(pc),a1
|
||||
add.w #SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH,a1
|
||||
lea copper(pc),a2
|
||||
moveq #SCREEN_BIT_DEPTH-1,d0
|
||||
.bitplaneloop:
|
||||
move.l a1,d1
|
||||
move.w d1,2(a2)
|
||||
swap d1
|
||||
move.w d1,6(a2)
|
||||
lea SCREEN_WIDTH_BYTES(a1),a1 ; bit plane data is interleaved
|
||||
addq #8,a2
|
||||
dbra d0,.bitplaneloop
|
||||
movem.l (sp)+,d0-a6
|
||||
rts
|
||||
|
||||
|
||||
pokeBitplanePointers: ; d0 = frame offset in bytes, a0 = BPLP copper list address
|
||||
movem.l d0-a6,-(sp)
|
||||
lea bitplanes(pc),a1
|
||||
add.l d0,a1 ; Offset for odd/even frames
|
||||
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/image-palette.s"
|
||||
rts
|
||||
|
||||
cycle:
|
||||
dc.l 0
|
||||
copper:
|
||||
;; bitplane pointers must be first else poking addresses will be incorrect
|
||||
dc.w BPL1PTL,0
|
||||
|
@ -83,7 +64,24 @@ copper:
|
|||
dc.w BPL6PTL,0
|
||||
dc.w BPL6PTH,0
|
||||
|
||||
dc.l $fffffffe
|
||||
dc.l $fffffffe
|
||||
|
||||
copperLOF:
|
||||
;; bitplane pointers must be first else poking addresses will be incorrect
|
||||
dc.w BPL1PTL,0
|
||||
dc.w BPL1PTH,0
|
||||
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
|
||||
|
||||
bitplanes:
|
||||
incbin "out/image-ham.bin"
|
Loading…
Reference in New Issue