Dithered HAM test

This commit is contained in:
alpine9000
2016-03-08 21:30:47 +11:00
parent c3f9cc4bde
commit fd78ce7001
10 changed files with 172 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
MODULE=dithered_ham.s
FLOPPY=bin/dithered_ham.adf
IMAGEDATA=out/image-palette.s out/image-ham.bin
IMAGEFILE=../assets/gigi.png
#IMAGEFILE=../assets/demo.png
EXTRA=$(IMAGEDATA) $(BOB_IMAGEDATA) init.s utils.s constants.i Makefile
USE_PALETTE=--use-palette gigi.pal
#USE_PALETTE=--use-palette demo.pal
#USE_PALETTE=--ham-brute-force
DITHER=--dither
include ../shared/base.mk
$(IMAGEDATA): $(IMAGECON) $(IMAGEFILE) Makefile
$(IMAGECON) --input $(IMAGEFILE) --output out/image --ham --output-bitplanes --output-palette-asm $(USE_PALETTE) --output-palette $(DITHER)
+8
View File
@@ -0,0 +1,8 @@
Ditherered HAM
==============
Work in progress
[Download disk image](bin/dither_ham.adf?raw=true)
Binary file not shown.
+10
View File
@@ -0,0 +1,10 @@
LVL3_INT_VECTOR equ $6c
SCREEN_WIDTH equ 320
SCREEN_HEIGHT equ 256
SCREEN_WIDTH_BYTES equ (SCREEN_WIDTH/8)
SCREEN_BIT_DEPTH equ 6
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+SCREEN_HEIGHT
+16
View File
@@ -0,0 +1,16 @@
caa
d2d
cef
333
c85
4be
be3
c7f
d18
222
655
25d
c97
6c2
d22
cda
+41
View File
@@ -0,0 +1,41 @@
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"
installColorPalette:
include "out/image-palette.s"
rts
copper:
;; 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"
+16
View File
@@ -0,0 +1,16 @@
875
542
ca7
89a
421
853
c85
565
cc9
a63
211
642
689
8ab
531
997
+42
View File
@@ -0,0 +1,42 @@
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
;; 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<<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)
;; poke bitplane pointers
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
;; 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
Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

+23
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