Added music example

This commit is contained in:
alpine9000
2016-02-27 14:15:25 +11:00
parent 1f315f7806
commit 250e7d977e
23 changed files with 4720 additions and 88 deletions
+71
View File
@@ -0,0 +1,71 @@
include ../include/registers.i
include hardware/dmabits.i
include hardware/intbits.i
LVL3_INT_VECTOR equ $6c
SCREEN_WIDTH_BYTES equ (320/8)
SCREEN_BIT_DEPTH equ 4
entry:
lea level3InterruptHandler,a3
move.l a3,LVL3_INT_VECTOR
;; install copper list and enable DMA
lea CUSTOM,a1
lea copper(pc),a0
move.l a0,cop1lc(a1)
move.w COPJMP1(a1),d0
move.w #(DMAF_SETCLR!DMAF_COPPER!DMAF_RASTER!DMAF_MASTER),dmacon(a1)
.mainLoop:
bra.b .mainLoop
level3InterruptHandler:
movem.l d0-a6,-(sp)
.checkVerticalBlank:
lea CUSTOM,a5
move.w INTREQR(a5),d0
and.w #INTF_VERTB,d0
beq.s .checkCopper
.verticalBlank:
move.w #INTF_VERTB,INTREQ(a5) ; Clear interrupt bit
.resetBitplanePointers:
lea bitplanes,a1
lea $dff0e0,a2
moveq #SCREEN_BIT_DEPTH,d0
.bitplaneloop:
move.l a1,(a2)
lea SCREEN_WIDTH_BYTES(a1),a1 ; Bit plane data is interleaved
addq #4,a2
dbra d0,.bitplaneloop
.checkCopper:
lea CUSTOM,a5
move.w INTREQR(a5),d0
and.w #INTF_COPER,d0
beq.s .interruptComplete
.copperInterrupt:
move.w #INTF_COPER,INTREQ(a5) ; Clear interrupt bit
.interruptComplete:
movem.l (sp)+,d0-a6
rte
copper:
dc.w DIWSTRT,$2c81
dc.w DIWSTOP,$2cc1
dc.w BPLCON0,(SCREEN_BIT_DEPTH<<12)|$200 ; Set color depth and enable COLOR
dc.w BPL1MOD,SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH-SCREEN_WIDTH_BYTES
dc.w BPL2MOD,SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH-SCREEN_WIDTH_BYTES
include "out/image-copper.s"
dc.l $fffffffe
bitplanes:
incbin "out/image-data.bin"
+1
View File
@@ -0,0 +1 @@
alex@blizzard.local.78583
-3
View File
@@ -1,3 +0,0 @@
out/
bin/
*~
+5 -35
View File
@@ -1,41 +1,11 @@
MAKEADF=../tools/makeadf
FLOPPY=bin/image.adf
IMAGE_DATA=out/image-copper.s out/image-data.bin
EXTRA=out/image-copper.s out/image-data.bin
all: bin out $(MAKEADF) $(FLOPPY)
MODULE=image.s
gdrive: all
cp $(FLOPPY) ~/Google\ Drive
include ../base.mk
test: all
cp $(FLOPPY) ~/Projects/amiga/test.adf
$(EXTRA): images/hello.png ../tools/bitplanify.py
../tools/bitplanify.py images/hello.png --copper $(EXTRA)
bin:
mkdir bin
out:
mkdir out
$(MAKEADF): ../tools/makeadf.c
gcc ../tools/makeadf.c -o $(MAKEADF)
$(FLOPPY): out/bootblock.bin
$(MAKEADF) out/bootblock.bin > $(FLOPPY)
out/bootblock.bin: out/bootblock.o
vlink -brawbin1 $< -o $@
out/bootblock.o: bootblock.s out/main.bin
vc -c $< -o $@
out/main.o: image.s $(IMAGE_DATA)
vc -c $< -o $@
out/main.bin: out/main.o
vlink -brawbin1 $< -o $@
$(IMAGE_DATA): images/hello.png ../tools/bitplanify.py
../tools/bitplanify.py images/hello.png --copper $(IMAGE_DATA)
clean:
rm -rf out bin
-30
View File
@@ -1,30 +0,0 @@
include exec/io.i
include lvo/exec_lib.i
bootblock:
dc.b "DOS",0
dc.l 0
dc.l 880
bootEntry:
;; a6 = Exec base
;; a1 = trackdisk.device I/O request pointer
lea $70000,a5 ; main.s entry point
;; Load the progam from the floppy using trackdisk.device
move.l #mainEnd-mainStart,IO_LENGTH(a1)
move.l a5,IO_DATA(a1)
move.l #mainStart-bootblock,IO_OFFSET(a1)
jsr _LVODoIO(a6)
jmp (a5) ; -> main.s entry point
;; Pad the remainder of the bootblock
cnop 0,1024
mainStart:
incbin "out/main.bin"
cnop 0,512
mainEnd:
end
+3 -15
View File
@@ -8,12 +8,11 @@ SCREEN_BIT_DEPTH equ 4
entry:
lea level3InterruptHandler(pc),a3
move.l a3,LVL3_INT_VECTOR
lea CUSTOM,a1
lea level3InterruptHandler,a3
move.l a3,LVL3_INT_VECTOR
;; install copper list and enable DMA
lea CUSTOM,a1
lea copper(pc),a0
move.l a0,cop1lc(a1)
move.w COPJMP1(a1),d0
@@ -57,22 +56,11 @@ level3InterruptHandler:
rte
copper:
dc.w DIWSTRT,$2c81
dc.w DIWSTOP,$2cc1
dc.w BPLCON0,(SCREEN_BIT_DEPTH<<12)|$200 ; Set color depth and enable COLOR
dc.w BPL1MOD,SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH-SCREEN_WIDTH_BYTES
dc.w BPL2MOD,SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH-SCREEN_WIDTH_BYTES
rem // Original copper list from https://github.com/vilcans/amiga-startup
dc.l $008e2c81,$00902cc1
dc.l $00920038,$009400d0
dc.w $0100,(SCREEN_BIT_DEPTH<<12)|$200
dc.l $01020000,$01060000,$010c0011
dc.w $108,SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH-SCREEN_WIDTH_BYTES
dc.w $10a,SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH-SCREEN_WIDTH_BYTES
dc.l $01fc0000
erem
include "out/image-copper.s"