Added music example
This commit is contained in:
parent
1f315f7806
commit
250e7d977e
|
@ -1,34 +1,5 @@
|
|||
MAKEADF=../tools/makeadf
|
||||
FLOPPY=bin/test.adf
|
||||
MODULE=main.s
|
||||
|
||||
all: bin out $(MAKEADF) $(FLOPPY)
|
||||
|
||||
gdrive: all
|
||||
cp $(FLOPPY) ~/Google\ Drive
|
||||
|
||||
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: main.s
|
||||
vc -c $< -o $@
|
||||
|
||||
out/main.bin: out/main.o
|
||||
vlink -brawbin1 $< -o $@
|
||||
|
||||
clean:
|
||||
rm -rf out bin
|
||||
include ../base.mk
|
|
@ -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"
|
||||
|
|
@ -0,0 +1 @@
|
|||
alex@blizzard.local.78583
|
|
@ -1,3 +0,0 @@
|
|||
out/
|
||||
bin/
|
||||
*~
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
MAKEADF=../tools/makeadf
|
||||
FLOPPY=bin/sprite.adf
|
||||
|
||||
all: bin out $(MAKEADF) $(FLOPPY)
|
||||
|
||||
gdrive: all
|
||||
cp $(FLOPPY) ~/Google\ Drive
|
||||
|
||||
test: all
|
||||
cp $(FLOPPY) ~/Projects/amiga/test.adf
|
||||
|
||||
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: sprite.s
|
||||
vc -c $< -o $@
|
||||
|
||||
out/main.bin: out/main.o
|
||||
vlink -brawbin1 $< -o $@
|
||||
|
||||
clean:
|
||||
rm -rf out bin
|
|
@ -0,0 +1,6 @@
|
|||
Display a simple image
|
||||
======================
|
||||
|
||||
Building on trackdisk.device, we now display a simple color image
|
||||
|
||||
Image display code and conversion tools from https://github.com/vilcans/amiga-startup
|
|
@ -1,6 +1,7 @@
|
|||
include exec/io.i
|
||||
include lvo/exec_lib.i
|
||||
|
||||
include devices/trackdisk.i
|
||||
|
||||
bootblock:
|
||||
dc.b "DOS",0
|
||||
dc.l 0
|
||||
|
@ -17,6 +18,11 @@ bootEntry:
|
|||
move.l a5,IO_DATA(a1)
|
||||
move.l #mainStart-bootblock,IO_OFFSET(a1)
|
||||
jsr _LVODoIO(a6)
|
||||
|
||||
;; Turn off drive motor
|
||||
move.l #0,IO_LENGTH(a1)
|
||||
move.w #TD_MOTOR,IO_COMMAND(a1)
|
||||
jsr _LVODoIO(a6)
|
||||
|
||||
jmp (a5) ; -> main.s entry point
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -0,0 +1,147 @@
|
|||
include ../include/registers.i
|
||||
include hardware/dmabits.i
|
||||
include hardware/intbits.i
|
||||
|
||||
LVL3_INT_VECTOR equ $6c
|
||||
|
||||
entry:
|
||||
lea level3InterruptHandler(pc),a3
|
||||
move.l a3,LVL3_INT_VECTOR
|
||||
;;
|
||||
;; sprite_display.asm
|
||||
;;
|
||||
;; This example displays the spaceship sprite at location V = 65,
|
||||
;; H = 128. Remember to include the file hw_examples.i.
|
||||
;;
|
||||
;; First, we set up a single bitplane.
|
||||
;;
|
||||
LEA CUSTOM,a0 ;Point a0 at custom chips
|
||||
MOVE.W #$1200,BPLCON0(a0) ;1 bitplane color is on
|
||||
MOVE.W #$0000,BPL1MOD(a0) ;Modulo = 0
|
||||
MOVE.W #$0000,BPLCON1(a0) ;Horizontal scroll value = 0
|
||||
MOVE.W #$0024,BPLCON2(a0) ;Sprites have priority over playfields
|
||||
MOVE.W #$0038,DDFSTRT(a0) ;Set data-fetch start
|
||||
MOVE.W #$00D0,DDFSTOP(a0) ;Set data-fetch stop
|
||||
|
||||
;; Display window definitions.
|
||||
|
||||
MOVE.W #$2C81,DIWSTRT(a0) ;Set display window start
|
||||
;; Vertical start in high byte.
|
||||
;; Horizontal start * 2 in low byte.
|
||||
MOVE.W #$F4C1,DIWSTOP(a0) ;Set display window stop
|
||||
;; Vertical stop in high byte.
|
||||
;; Horizontal stop * 2 in low byte.
|
||||
;;
|
||||
;; Set up color registers.
|
||||
;;
|
||||
MOVE.W #$0008,COLOR00(a0) ;Background color = dark blue
|
||||
MOVE.W #$0000,COLOR01(a0) ;Foreground color = black
|
||||
MOVE.W #$0FF0,COLOR17(a0) ;Color 17 = yellow
|
||||
MOVE.W #$00FF,COLOR18(a0) ;Color 18 = cyan
|
||||
MOVE.W #$0F0F,COLOR19(a0) ;Color 19 = magenta
|
||||
;;
|
||||
;; Move Copper list to $20000.
|
||||
;;
|
||||
MOVE.L #$20000,a1 ;Point A1 at Copper list destination
|
||||
LEA COPPERL(pc),a2 ;Point A2 at Copper list source
|
||||
CLOOP:
|
||||
MOVE.L (a2),(a1)+ ;Move a long word
|
||||
CMP.L #$FFFFFFFE,(a2)+ ;Check for end of list
|
||||
BNE CLOOP ;Loop until entire list is moved
|
||||
;;
|
||||
;; Move sprite to $25000.
|
||||
;;
|
||||
MOVE.L #$25000,a1 ;Point A1 at sprite destination
|
||||
LEA SPRITE(pc),a2 ;Point A2 at sprite source
|
||||
SPRLOOP:
|
||||
MOVE.L (a2),(a1)+ ;Move a long word
|
||||
CMP.L #$00000000,(a2)+ ;Check for end of sprite
|
||||
BNE SPRLOOP ;Loop until entire sprite is moved
|
||||
;;
|
||||
;; Now we write a dummy sprite to $30000, since all eight sprites are activated
|
||||
;; at the same time and we're only going to use one. The remaining sprites
|
||||
;; will point to this dummy sprite data.
|
||||
;;
|
||||
MOVE.L #$00000000,$30000 ;Write it
|
||||
;;
|
||||
;; Point Copper at Copper list.
|
||||
;;
|
||||
MOVE.L #$20000,COP1LC(a0)
|
||||
;;
|
||||
;; Fill bitplane with $FFFFFFFF.
|
||||
;;
|
||||
MOVE.L #$21000,a1 ;Point A1 at bitplane
|
||||
MOVE.W #1999,d0 ;2000-1(for dbf) long words = 8000 bytes
|
||||
FLOOP
|
||||
MOVE.L #$FFFFFFFF,(a1)+ ;Move a long word of $FFFFFFFF
|
||||
DBF d0,FLOOP ;Decrement, repeat until false.
|
||||
;;
|
||||
;; Start DMA.
|
||||
;;
|
||||
MOVE.W d0,COPJMP1(a0) ;Force load into Copper
|
||||
;; program counter
|
||||
MOVE.W #$83A0,DMACON(a0) ;Bitplane, Copper, and sprite DMA
|
||||
.mainLoop:
|
||||
bra.s .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
|
||||
|
||||
.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
|
||||
|
||||
;;
|
||||
;; This is a Copper list for one bitplane, and 8 sprites.
|
||||
;; The bitplane lives at $21000.
|
||||
;; Sprite 0 lives at $25000; all others live at $30000 (the dummy sprite).
|
||||
;;
|
||||
COPPERL:
|
||||
DC.W BPL1PTH,$0002 ;Bitplane 1 pointer = $21000
|
||||
DC.W BPL1PTL,$1000
|
||||
DC.W SPR0PTH,$0002 ;Sprite 0 pointer = $25000
|
||||
DC.W SPR0PTL,$5000
|
||||
DC.W SPR1PTH,$0003 ;Sprite 1 pointer = $30000
|
||||
DC.W SPR1PTL,$0000
|
||||
DC.W SPR2PTH,$0003 ;Sprite 2 pointer = $30000
|
||||
DC.W SPR2PTL,$0000
|
||||
DC.W SPR3PTH,$0003 ;Sprite 3 pointer = $30000
|
||||
DC.W SPR3PTL,$0000
|
||||
DC.W SPR4PTH,$0003 ;Sprite 4 pointer = $30000
|
||||
DC.W SPR4PTL,$0000
|
||||
DC.W SPR5PTH,$0003 ;Sprite 5 pointer = $30000
|
||||
DC.W SPR5PTL,$0000
|
||||
DC.W SPR6PTH,$0003 ;Sprite 6 pointer = $30000
|
||||
DC.W SPR6PTL,$0000
|
||||
DC.W SPR7PTH,$0003 ;Sprite 7 pointer = $30000
|
||||
DC.W SPR7PTL,$0000
|
||||
DC.W $FFFF,$FFFE ;End of Copper list
|
||||
;;
|
||||
;; Sprite data for spaceship sprite. It appears on the screen at V=65 and H=128.
|
||||
;;
|
||||
SPRITE:
|
||||
DC.W $6D60,$7200 ;VSTART, HSTART, VSTOP
|
||||
DC.W $0990,$07E0 ;First pair of descriptor words
|
||||
DC.W $13C8,$0FF0
|
||||
DC.W $23C4,$1FF8
|
||||
DC.W $13C8,$0FF0
|
||||
DC.W $0990,$07E0
|
||||
DC.W $0000,$0000 ;End of sprite data
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
MAKEADF=../tools/makeadf
|
||||
FLOPPY=bin/music.adf
|
||||
EXTRA=out/image-copper.s out/image-data.bin
|
||||
MODULE=music.s
|
||||
|
||||
include ../base.mk
|
||||
|
||||
$(EXTRA): images/hello.png ../tools/bitplanify.py
|
||||
../tools/bitplanify.py images/hello.png --copper $(EXTRA)
|
||||
|
Binary file not shown.
|
@ -0,0 +1,164 @@
|
|||
P61mode =2 ;Try other modes ONLY IF there are no Fxx commands >= 20.
|
||||
;(f.ex., P61.new_ditty only works with P61mode=1)
|
||||
|
||||
|
||||
;; --- options common to all P61modes ---
|
||||
|
||||
usecode =-1 ;CHANGE! to the USE hexcode from P61con for a big
|
||||
;CPU-time gain! (See module usecodes at end of source)
|
||||
;Multiple songs, single playroutine? Just "OR" the
|
||||
;usecodes together!
|
||||
|
||||
;...STOP! Have you changed it yet!? ;)
|
||||
;You will LOSE RASTERTIME AND FEATURES if you don't.
|
||||
|
||||
P61pl=usecode&$400000
|
||||
|
||||
split4 =0 ;Great time gain, but INCOMPATIBLE with F03, F02, and F01
|
||||
;speeds in the song! That's the ONLY reason it's default 0.
|
||||
;So ==> PLEASE try split4=1 in ANY mode!
|
||||
;Overrides splitchans to decrunch 1 chan/frame.
|
||||
;See ;@@ note for P61_SetPosition.
|
||||
|
||||
|
||||
splitchans=1 ;#channels to be split off to be decrunched at "playtime frame"
|
||||
;0=use normal "decrunch all channels in the same frame"
|
||||
;Experiment to find minimum rastertime, but it should be 1 or 2
|
||||
;for 3-4 channels songs and 0 or 1 with less channels.
|
||||
|
||||
visuctrs=1 ;enables visualizers in this example: P61_visuctr0..3.w
|
||||
;containing #frames (#lev6ints if cia=1) elapsed since last
|
||||
;instrument triggered. (0=triggered this frame.)
|
||||
;Easy alternative to E8x or 1Fx sync commands.
|
||||
|
||||
asmonereport =0 ;ONLY for printing a settings report on assembly. Use
|
||||
;if you get problems (only works in AsmOne/AsmPro, tho)
|
||||
|
||||
p61system=0 ;1=system-friendly. Use for DOS/Workbench programs.
|
||||
|
||||
p61exec =0 ;0 if execbase is destroyed, such as in a trackmo.
|
||||
|
||||
p61fade =0 ;enable channel volume fading from your demo
|
||||
|
||||
channels=4 ;<4 for game sound effects in the higher channels. Incompatible
|
||||
; with splitchans/split4.
|
||||
|
||||
playflag=0 ;1=enable music on/off capability (at run-time). .If 0, you can
|
||||
;still do this by just, you know, not calling P61_Music...
|
||||
;It's a convenience function to "pause" music in CIA mode.
|
||||
|
||||
p61bigjtab=0 ;1 to waste 480b and save max 56 cycles on 68000.
|
||||
|
||||
opt020 =0 ;1=enable optimizations for 020+. Please be 68000 compatible!
|
||||
;splitchans will already give MUCH bigger gains, and you can
|
||||
;try the MAXOPTI mode.
|
||||
|
||||
p61jump =0 ;0 to leave out P61_SetPosition (size gain)
|
||||
;1 if you need to force-start at a given position fex in a game
|
||||
|
||||
C =0 ;If you happen to have some $dffxxx value in a6, you can
|
||||
;change this to $xxx to not have to load it before P61_Music.
|
||||
|
||||
clraudxdat=0 ;enable smoother start of quiet sounds. probably not needed.
|
||||
|
||||
optjmp =1 ;0=safety check for jump beyond end of song. Clear it if you
|
||||
;play unknown P61 songs with erroneous Bxx/Dxx commands in them
|
||||
|
||||
oscillo =0 ;1 to get a sample window (ptr, size) to read and display for
|
||||
;oscilloscope type effects (beta, noshorts=1, pad instruments)
|
||||
;IMPORTANT: see ;@@ note about chipmem dc.w buffer.
|
||||
|
||||
quietstart=0 ;attempt to avoid the very first click in some modules
|
||||
;IMPORTANT: see ;@@ note about chipmem dc.w buffer.
|
||||
|
||||
use1Fx=0 ;Optional extra effect-sync trigger (*). If your module is free
|
||||
;from E commands, and you add E8x to sync stuff, this will
|
||||
;change the usecode to include a whole code block for all E
|
||||
;commands. You can avoid this by only using 1Fx. (You can
|
||||
;also use this as an extra sync command if E8x is not enough,
|
||||
;of course.)
|
||||
|
||||
;(*) Slideup values>116 causes bugs in Protracker, and E8 causes extra-code
|
||||
;for all E-commands, so I used this. It's only faster if your song contains 0
|
||||
;E-commands, so it's only useful to a few, I guess. Bit of cyclemania. :)
|
||||
|
||||
;Just like E8x, you will get the trigger after the P61_Music call, 1 frame
|
||||
;BEFORE it's heard. This is good, because it allows double-buffered graphics
|
||||
;or effects running at < 50 fps to show the trigger synced properly.
|
||||
|
||||
|
||||
|
||||
;; --- CIA mode options (default) ---
|
||||
|
||||
ifeq P61mode-1
|
||||
|
||||
p61cia =1 ;call P61_Music on the CIA interrupt instead of every frame.
|
||||
|
||||
lev6 =1 ;1=keep the timer B int at least for setting DMA.
|
||||
;0="FBI mode" - ie. "Free the B-timer Interrupt".
|
||||
|
||||
;0 requires noshorts=1, p61system=0, and that YOU make sure DMA
|
||||
;is set at 11 scanlines (700 usecs) after P61_Music is called.
|
||||
;AsmOne will warn you if requirements are wrong.
|
||||
|
||||
;DMA bits will be poked in the address you pass in A4 to
|
||||
;P61_init. (Update P61_DMApokeAddr during playing if necessary,
|
||||
;for example if switching Coppers.)
|
||||
|
||||
;P61_Init will still save old timer B settings, and initialize
|
||||
;it. P61_End will still restore timer B settings from P61_Init.
|
||||
;So don't count on it 'across calls' to these routines.
|
||||
;Using it after P61_Init and before P61_End is fine.
|
||||
|
||||
noshorts=0 ;1 saves ~1 scanline, requires Lev6=0. Use if no instrument is
|
||||
;shorter than ~300 bytes (or extend them to > 300 bytes).
|
||||
;It does this by setting repeatpos/length the next frame
|
||||
;instead of after a few scanlines,so incompatible with MAXOPTI
|
||||
|
||||
dupedec =0 ;0=save 500 bytes and lose 26 cycles - I don't blame you. :)
|
||||
;1=splitchans or split4 must be on.
|
||||
|
||||
suppF01 =1 ;0 is incompatible with CIA mode. It moves ~100 cycles of
|
||||
;next-pattern code to the less busy 2nd frame of a notestep.
|
||||
;If you really need it, you have to experiment as the support
|
||||
;is quite complex. Basically set it to 1 and try the various
|
||||
;P61modes, if none work, change some settings.
|
||||
|
||||
endc
|
||||
|
||||
;; --- VBLANK mode options ---
|
||||
|
||||
ifeq P61mode-2
|
||||
|
||||
p61cia =0
|
||||
lev6 =1 ;still set sound DMA with a simple interrupt.
|
||||
noshorts=0 ;try 1 (and pad short instruments if nec) for 1 scanline gain
|
||||
dupedec =0
|
||||
suppF01 =P61pl ;if 1, split4=1 may cause sound errors. but try it anyway. :)
|
||||
|
||||
endc
|
||||
|
||||
;; --- COPPER mode options ---
|
||||
|
||||
ifeq P61mode-3
|
||||
|
||||
p61cia =0
|
||||
lev6 =0 ;don't set sound DMA with an interrupt.
|
||||
;(use the copper to set sound DMA 11 scanlines after P61_Music)
|
||||
noshorts=1 ;You must pad instruments < 300 bytes for this mode to work.
|
||||
dupedec =0
|
||||
suppF01 =P61pl ;if 1, split4=1 may cause sound errors. but try it anyway. :)
|
||||
|
||||
endc
|
||||
|
||||
;; --- MAXOPTI mode options ---
|
||||
|
||||
ifeq P61mode-4
|
||||
|
||||
p61cia =0
|
||||
lev6 =0
|
||||
noshorts=1 ;You must pad instruments < 300 bytes for this mode to work.
|
||||
dupedec =1
|
||||
suppF01 =P61pl ;if 1, split4=1 may cause sound errors. but try it anyway. :)
|
||||
|
||||
endc
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,10 @@
|
|||
Play music using the P61 Player
|
||||
===============================
|
||||
|
||||
Building on simple_image, we now try and play some music.
|
||||
|
||||
We use the P6112 Player. See P6112-Options.i for configuration details for the Player.
|
||||
|
||||
Tutorial video here: http://youtu.be/xBtHO-IuN9E
|
||||
Tutorial source here: http://coppershade.org/asmskool/
|
||||
Source here: http://coppershade.org/asmskool/P6112/
|
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -0,0 +1,89 @@
|
|||
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
|
||||
|
||||
include "P6112-Options.i"
|
||||
|
||||
entry:
|
||||
lea level3InterruptHandler,a3
|
||||
move.l a3,LVL3_INT_VECTOR
|
||||
|
||||
;; initialise P61
|
||||
lea Module1(pc),a0
|
||||
sub.l a1,a1
|
||||
sub.l a2,a2
|
||||
moveq #0,d0
|
||||
jsr P61_Init(pc)
|
||||
|
||||
;; 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
|
||||
movem.l d0-a6,-(sp)
|
||||
jsr P61_Music ;and call the playroutine manually.
|
||||
movem.l (sp)+,d0-a6
|
||||
|
||||
.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
|
||||
|
||||
Playrtn:
|
||||
include "P6112-Play.i"
|
||||
|
||||
Module1:
|
||||
incbin "P61.sowhat-intro" ;usecode $9410
|
||||
|
||||
bitplanes:
|
||||
incbin "out/image-data.bin"
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
SUBDIRS=000.trackdisk 001.simple_image 002.sprite_display 003.music
|
||||
|
||||
.PHONY: subdirs $(SUBDIRS)
|
||||
|
||||
all: subdirs
|
||||
|
||||
clean:
|
||||
for dir in $(SUBDIRS); do \
|
||||
echo Cleaning $$dir; \
|
||||
make -C $$dir clean; \
|
||||
done
|
||||
|
||||
subdirs: $(SUBDIRS)
|
||||
|
||||
$(SUBDIRS):
|
||||
@echo ""
|
||||
make -C $@
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
(re)Learning how to program an Amiga after a 20 year break
|
||||
==========================================================
|
||||
|
||||
Cross development environment
|
||||
-----------------------------
|
||||
Built on OSX 10.11.3
|
||||
Notes:
|
||||
* My /usr/local is writable by me. You will probable need to add "sudo" to any "make install" lines
|
||||
* I have gcc-5.3.0 installed in /usr/local
|
||||
|
||||
1. autoconf
|
||||
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz
|
||||
tar xzf autoconf-2.69.tar.gz
|
||||
cd autoconf-2.69
|
||||
./configure --prefix=/usr/local
|
||||
make
|
||||
make install
|
||||
|
||||
2. automake
|
||||
curl -OL http://ftpmirror.gnu.org/automake/automake-1.15.tar.gz
|
||||
tar xzf automake-1.15.tar.gz
|
||||
cd automake-1.15
|
||||
./configure --prefix=/usr/local
|
||||
make
|
||||
make install
|
||||
|
||||
3. pkg-config
|
||||
curl -OL https://pkg-config.freedesktop.org/releases/pkg-config-0.29.tar.gz
|
||||
tar zxf pkg-config-0.29.tar.gz
|
||||
cd pkg-config-0.29
|
||||
./configure --with-internal-glib --prefix=/usr/local LDFLAGS="-framework CoreFoundation -framework Carbon"
|
||||
make
|
||||
make install
|
||||
|
||||
4. lha
|
||||
git clone https://github.com/jca02266/lha.git
|
||||
aclocal
|
||||
autoheader
|
||||
automake -a
|
||||
autoconf
|
||||
./configure --prefix=/usr/local
|
||||
make
|
||||
make install
|
|
@ -0,0 +1,37 @@
|
|||
all: bin out $(MAKEADF) $(FLOPPY)
|
||||
|
||||
gdrive: all
|
||||
cp $(FLOPPY) ~/Google\ Drive
|
||||
|
||||
test: all
|
||||
cp $(FLOPPY) ~/Projects/amiga/test.adf
|
||||
|
||||
go: test
|
||||
~/Google\ Drive/Amiga/amiga500.sh
|
||||
|
||||
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: ../shared/bootblock.s out/main.bin
|
||||
vc -c $< -o $@
|
||||
|
||||
out/main.o: $(MODULE) $(EXTRA)
|
||||
vc -c $< -o $@
|
||||
|
||||
out/main.bin: out/main.o
|
||||
vlink -brawbin1 $< -o $@
|
||||
|
||||
clean:
|
||||
rm -rf out bin *~
|
|
@ -1,6 +1,6 @@
|
|||
include exec/io.i
|
||||
include exec/io.i
|
||||
include lvo/exec_lib.i
|
||||
|
||||
include devices/trackdisk.i
|
||||
bootblock:
|
||||
dc.b "DOS",0
|
||||
dc.l 0
|
||||
|
@ -13,10 +13,16 @@ bootEntry:
|
|||
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)
|
||||
jsr _LVODoIO(a6)
|
||||
|
||||
;; Turn off drive motor
|
||||
move.l #0,IO_LENGTH(a1)
|
||||
move.w #TD_MOTOR,IO_COMMAND(a1)
|
||||
jsr _LVODoIO(a6)
|
||||
|
||||
jmp (a5) ; -> main.s entry point
|
||||
|
Loading…
Reference in New Issue