Skip to content

Commit

Permalink
added -seqTiming option
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-carre committed Dec 3, 2022
1 parent 495ccce commit 55d6777
Show file tree
Hide file tree
Showing 11 changed files with 245 additions and 160 deletions.
4 changes: 2 additions & 2 deletions Example/Example_Insane.asm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
lea LSPMusic,a0
lea LSPBank,a1
lea copperDMAConPatch+3,a2
bsr LSP_MusicDriver
bsr LSP_MusicInitInsane

; setup copper list & interrupt
move.l #copperInterrupt,$6c.w
Expand All @@ -37,7 +37,7 @@ copperInterrupt:

move.w #$f00,$dff180
lea $dff0a0,a6 ; always set a6 to dff0a0 before calling LSP tick
bsr LSP_MusicDriver+4 ; player+4 = music tick
bsr LSP_MusicPlayTickInsane ; player music tick
move.w #$0,$dff180

movem.l (a7)+,d0/a0/a1/a2/a3
Expand Down
2 changes: 1 addition & 1 deletion Example/convert.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
..\LSPConvert rink-a-dink.mod -amigapreview
..\LSPConvert rink-a-dink.mod -amigapreview -insane
pause
Binary file modified Example/rink-a-dink.lsbank
Binary file not shown.
Binary file modified Example/rink-a-dink.lsmusic
Binary file not shown.
Binary file removed Example/rink-a-dink_amiga.wav
Binary file not shown.
170 changes: 80 additions & 90 deletions Example/rink-a-dink_insane.asm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;*****************************************************************
;
; Light Speed Player v1.05
; Light Speed Player v1.10
; Fastest Amiga MOD player ever :)
; Written By Arnaud Carré (aka Leonard / OXYGENE)
; https://github.com/arnaud-carre/LSPlayer
Expand All @@ -10,29 +10,97 @@
; (this source code is generated by LSPConvert)
; You can also use the generic LightSpeedPlayer.asm player ( less than 512bytes! )
;
; MOD in : 206KiB + 38KiB (rink-a-dink.mod)
; LSP out : 206KiB + 23KiB
; *WARNING* This generated source code specific to "rink-a-dink.lsmusic" LSP file
;
; --------How to use---------
;
; bsr LSP_MusicDriver+0 : Init LSP player code
; bsr LSP_MusicInitInsane : Init LSP player code & music
; a0: LSP music data(any memory)
; a1: LSP sound bank(chip memory)
; a2: DMACON 8bits byte address (should be odd address!)
; a2: DMACON 8bits low byte address (odd)
;
; bsr LSP_MusicDriver+4 : LSP player tick (call once per frame)
; bsr LSP_MusicPlayTickInsane : LSP player tick (call once per frame)
; a6: should be $dff0a0 (and not $dff000)
; Used regs: d0/a0/a1/a2/a3/a4
;
;*****************************************************************

opt o- ; switch off ALL optimizations(we don't want vasm to change some code size, and all optimizations are done!)
LSP_MusicInitInsane:
move.l #$5910f52a,d0
cmp.l (a1),d0
bne.s .dataError
cmpi.l #'LSP1',(a0)+
bne.s .dataError
cmp.l (a0)+,d0
bne.s .dataError
lea 850(a0),a0 ; skip header
lea LSP_StateInsane(pc),a3
move.l a2,12(a3)
move.l a0,16(a3) ; word stream ptr
movea.l a0,a4
add.l #9634,a4
move.l a4,8(a3) ; byte stream ptr

LSP_MusicDriver:
bra.w .LSP_PlayerInit
move.l a0,(a3) ; word stream loop ptr
move.l a4,24(a3) ; byte stream loop ptr
tst.b 4(a3)
bne.s .noReloc
st 4(a3)
moveq #28-1,d0
lea LSP_InstrumentInfoInsane(pc),a0
move.l a1,d1
.rloop: add.l d1,(a0)
add.l d1,6(a0)
lea 12(a0),a0
dbf d0,.rloop
.noReloc: bset.b #1,$bfe001 ; disable this fucking Low pass filter!!
lea LSP_StateInsane+6(pc),a0
move.w #125,(a0) ; music BPM
rts

.dataError: illegal
LSP_StateInsane: dc.l 0 ; 0 word stream loop
dc.w 0 ; 4 reloc has been done
dc.w 0 ; 6 current music BPM
dc.l 0 ; 8 byte stream
dc.l 0 ; 12 m_lfmDmaConPatch
dc.l 0 ; 16 word stream
dc.l 0 ; 20 word stream loop
dc.l 0 ; 24 byte stream loop

; WARNING: in word stream, instrument offset is shifted by -12 bytes (3 last long of LSP_StateInsane)
LSP_InstrumentInfoInsane: ; (28 instruments)
dc.w $0000,$95c0,$30c3,$0000,$b928,$1f0f
dc.w $0000,$0004,$0a19,$0000,$0dfe,$031c
dc.w $0001,$815c,$09ad,$0001,$815c,$0001
dc.w $0000,$1436,$0329,$0000,$1436,$0001
dc.w $0002,$1c3e,$0851,$0002,$1c3e,$0001
dc.w $0000,$1a88,$02a1,$0000,$1a88,$0001
dc.w $0000,$1fca,$3afb,$0000,$1fca,$0001
dc.w $0001,$e712,$1a96,$0002,$0b84,$085d
dc.w $0000,$f746,$07b7,$0000,$f746,$0001
dc.w $0001,$1540,$0845,$0001,$1540,$0001
dc.w $0001,$06b4,$0746,$0001,$06b4,$0001
dc.w $0001,$31c2,$03a3,$0001,$31c2,$0001
dc.w $0001,$7078,$0872,$0001,$7078,$0001
dc.w $0001,$3908,$0ed3,$0001,$3908,$0001
dc.w $0002,$d77e,$1728,$0002,$d77e,$0001
dc.w $0002,$7996,$0937,$0002,$7996,$0001
dc.w $0001,$94b6,$292e,$0001,$94b6,$0001
dc.w $0001,$5eee,$08c5,$0001,$5eee,$0001
dc.w $0003,$05ce,$110a,$0003,$05ce,$0001
dc.w $0002,$3a9e,$1f7c,$0002,$3a9e,$0001
dc.w $0002,$2ce0,$06df,$0002,$2ce0,$0001
dc.w $0003,$27e2,$037f,$0003,$27e2,$0001
dc.w $0003,$2ee0,$039a,$0003,$2ee0,$0001
dc.w $0002,$c218,$0ab3,$0002,$c218,$0001
dc.w $0002,$8c04,$1645,$0002,$9ca0,$0df7
dc.w $0002,$b88e,$04c5,$0002,$b88e,$0001
dc.w $0001,$25ca,$05fc,$0001,$25ca,$0001
dc.w $0001,$56ae,$0420,$0001,$56ae,$0001

;LSP_MusicDriver+4 ; Player tick to call each frame
lea .LSPVars+8(pc),a1
LSP_MusicPlayTickInsane:
lea LSP_StateInsane+8(pc),a1
move.l (a1),a0 ; byte stream
.process: moveq #0,d0
move.b (a0)+,d0
Expand All @@ -44,6 +112,7 @@ LSP_MusicDriver:
move.l 24-8(a1),a0
bra.s .process

.resetv: dc.l 0,0,0,0

.LSP_JmpTable: ; (240 codes)
dc.w -1 ; extended code
Expand Down Expand Up @@ -288,85 +357,6 @@ LSP_MusicDriver:
dc.w .r_rewind-.LSP_JmpTable
dc.w $ffff ; SetBpm code (not used in this music)

.LSPVars: dc.l 0 ; 0 word stream loop
dc.w 0 ; 4 reloc has been done
dc.w 0 ; 6 current music BPM
dc.l 0 ; 8 byte stream
dc.l 0 ; 12 m_lfmDmaConPatch
dc.l 0 ; 16 word stream
dc.l 0 ; 20 word stream loop
dc.l 0 ; 24 byte stream loop

; WARNING: in word stream, instrument offset is shifted by -12 bytes (3 last long of .LSPVars)
.LSP_InstrumentInfo: ; (28 instruments)
dc.w $0000,$95c0,$30c3,$0000,$b928,$1f0f
dc.w $0000,$0004,$0a19,$0000,$0dfe,$031c
dc.w $0001,$815c,$09ad,$0001,$815c,$0001
dc.w $0000,$1436,$0329,$0000,$1436,$0001
dc.w $0002,$1c3e,$0851,$0002,$1c3e,$0001
dc.w $0000,$1a88,$02a1,$0000,$1a88,$0001
dc.w $0000,$1fca,$3afb,$0000,$1fca,$0001
dc.w $0001,$e712,$1a96,$0002,$0b84,$085d
dc.w $0000,$f746,$07b7,$0000,$f746,$0001
dc.w $0001,$1540,$0845,$0001,$1540,$0001
dc.w $0001,$06b4,$0746,$0001,$06b4,$0001
dc.w $0001,$31c2,$03a3,$0001,$31c2,$0001
dc.w $0001,$7078,$0872,$0001,$7078,$0001
dc.w $0001,$3908,$0ed3,$0001,$3908,$0001
dc.w $0002,$d77e,$1728,$0002,$d77e,$0001
dc.w $0002,$7996,$0937,$0002,$7996,$0001
dc.w $0001,$94b6,$292e,$0001,$94b6,$0001
dc.w $0001,$5eee,$08c5,$0001,$5eee,$0001
dc.w $0003,$05ce,$110a,$0003,$05ce,$0001
dc.w $0002,$3a9e,$1f7c,$0002,$3a9e,$0001
dc.w $0002,$2ce0,$06df,$0002,$2ce0,$0001
dc.w $0003,$27e2,$037f,$0003,$27e2,$0001
dc.w $0003,$2ee0,$039a,$0003,$2ee0,$0001
dc.w $0002,$c218,$0ab3,$0002,$c218,$0001
dc.w $0002,$8c04,$1645,$0002,$9ca0,$0df7
dc.w $0002,$b88e,$04c5,$0002,$b88e,$0001
dc.w $0001,$25ca,$05fc,$0001,$25ca,$0001
dc.w $0001,$56ae,$0420,$0001,$56ae,$0001

.resetv: dc.l 0,0,0,0

; a0: music data (any mem)
; a1: sound bank data (chip mem)
; a2: 8bit DMACON byte address
.LSP_PlayerInit:
move.l #$2198aaad,d0
cmp.l (a1),d0
bne.s .dataError
cmpi.l #'LSP1',(a0)+
bne.s .dataError
cmp.l (a0)+,d0
bne.s .dataError
lea 846(a0),a0 ; skip header
lea .LSPVars(pc),a3
move.l a2,12(a3)
move.l a0,16(a3) ; word stream ptr
movea.l a0,a4
add.l #9634,a4
move.l a4,8(a3) ; byte stream ptr

move.l a0,(a3) ; word stream loop ptr
move.l a4,24(a3) ; byte stream loop ptr
tst.b 4(a3)
bne.s .noReloc
st 4(a3)
moveq #28-1,d0
lea .LSP_InstrumentInfo(pc),a0
move.l a1,d1
.rloop: add.l d1,(a0)
add.l d1,6(a0)
lea 12(a0),a0
dbf d0,.rloop
.noReloc: bset.b #1,$bfe001 ; disable this fucking Low pass filter!!
lea .LSPVars+6(pc),a0
move.w #125,(a0) ; music BPM
rts

.dataError: illegal
; 239 specific callback
.r_None:
move.l a0,(a1)+
Expand Down
Binary file modified LSPConvert.exe
Binary file not shown.
Loading

0 comments on commit 55d6777

Please sign in to comment.