; A minimal ProTracker modplayer ; Written by Harry Sintonen ; ; Uses ptplayer from Frank Wille. You can grab the source code from: ; https://aminet.net/package/mus/play/ptplayer ; ; Known problems ; -------------- ; ; - The player routine isn't totally bug free and does play some ; modules wrong. ; ; - The commandline argument must only contain the name of the ; file to load, no quotes, extra spaces or some such. ; ; - There is no checking whether the file provided is a mod or not. ; It is just sent to the player routine as-is. ; ; - No audio channels or CIA timer is allocated. Things will break ; if there's a resource conflict. ; ; To Compile: ; 1) extract ptplayer.lha to the source dir ; 2) phxass minimod.asm exe z _LVOSupervisor EQU -30 _LVOAllocMem EQU -198 _LVOFreeMem EQU -210 _LVOOpenLibrary EQU -552 _LVOCloseLibrary EQU -414 _LVOWait EQU -318 MEMF_CHIP EQU 2 AttnFlags EQU 296 AFB_68010 EQU 0 PowerSupplyFrequency EQU 531 _LVOOpen EQU -30 _LVOClose EQU -36 _LVORead EQU -42 _LVOWrite EQU -48 _LVOOutput EQU -60 _LVOLock EQU -84 _LVOUnLock EQU -90 _LVOExamine EQU -102 ACCESS_READ EQU -2 MODE_OLDFILE EQU 1005 fib_Size EQU 124 fib_SIZEOF EQU 260 SIGBREAKF_CTRL_C EQU $1000 MC68010 main: moveq #20,d7 ; remove commandline linefeed clr.b -1(a0,d0.l) ; save commandline move.l a0,a2 move.l (4).w,a6 ; get VBR moveq #0,d0 btst #AFB_68010,(AttnFlags+1,a6) beq.b .is68000 lea (.getvbr,pc),a5 jsr (_LVOSupervisor,a6) .is68000: move.l d0,_vbr lea (dosname,pc),a1 moveq #0,d0 jsr (_LVOOpenLibrary,a6) tst.l d0 beq .nodos move.l a6,a5 move.l d0,a6 move.l a2,d1 move.l #ACCESS_READ,d2 jsr (_LVOLock,a6) move.l d0,d4 beq.b .nolock move.l d4,d1 move.l #_fib,d2 jsr (_LVOExamine,a6) tst.l d0 beq.b .noexamine move.l _fib+fib_Size,d0 moveq #MEMF_CHIP,d1 exg a5,a6 jsr (_LVOAllocMem,a6) exg a5,a6 move.l d0,d6 beq.b .nomem move.l a2,d1 move.l #MODE_OLDFILE,d2 jsr (_LVOOpen,a6) move.l d0,d5 beq.b .nofile move.l d5,d1 move.l d6,d2 move.l _fib+fib_Size,d3 jsr (_LVORead,a6) cmp.l d0,d3 bne.b .readfail jsr (_LVOOutput,a6) move.l d0,d1 lea (msg,pc),a0 move.l a0,d2 moveq #msgend-msg,d3 jsr (_LVOWrite,a6) move.l a6,-(sp) lea $dff000,a6 cmp.b #50,(PowerSupplyFrequency,a5) seq d0 ; PAL=0xff, NTSC=0 move.l _vbr,a0 jsr _mt_install_cia move.l d6,a0 ; a1=NULL -> instruments after pattern data sub.l a1,a1 moveq #0,d0 jsr _mt_init ; start playback st _mt_Enable ; Wait until CTRL-C move.l #SIGBREAKF_CTRL_C,d0 exg a5,a6 jsr (_LVOWait,a6) exg a5,a6 jsr _mt_end jsr _mt_remove_cia move.l (sp)+,a6 ; all ok moveq #0,d7 .readfail: move.l d5,d1 jsr (_LVOClose,a6) .nofile: move.l d6,a1 move.l _fib+fib_Size,d0 exg a5,a6 jsr (_LVOFreeMem,a6) exg a5,a6 .nomem: .noexamine: move.l d4,d1 jsr (_LVOUnLock,a6) .nolock: move.l a6,a1 move.l a5,a6 jsr (_LVOCloseLibrary,a6) .nodos: move.l d7,d0 rts .getvbr: movec vbr,d0 rte dosname: dc.b "dos.library",0 msg: dc.b "minimod 1.0 by Harry Sintonen. Public Domain.",10 dc.b $bb,$bb,$bb dc.b " Press CTRL-C to exit " dc.b $ab,$ab,$ab,10 msgend: CNOP 0,2 _vbr: ds.l 1 _fib: ds.b fib_SIZEOF SECTION CODE,CODE MINIMAL EQU 1 include "ptplayer.asm"