arnaud-carre / LSPlayer

Fastest Amiga Module player ever
MIT License
97 stars 8 forks source link

Micro version causes double speed? #12

Closed Ozzyboshi closed 5 months ago

Ozzyboshi commented 5 months ago

I tried to give a try to the micro version which promises to be shrinkler friend, and in some way it's true because i saved a lot of bytes but... the mod it seems to go double speed.

I dont know if I am using the right way, I first recreated lsbank and lsmusic files usinng lspconvert modfile -micro then added /LightSpeedPlayer_cia.asm and LightSpeedPlayer_Micro.asm to my project. Then I changed the calls to routines inside LightSpeedPlayer_Micro.asm

in particular

LSP_MusicInitMicro replaced LSP_MusicInit LSP_MusicPlayTickMicro replaced LSP_MusicPlayTick

all works fine except, as I said, the music seems to go double speed. this is what I did

https://github.com/Ozzyboshi/tunnel/blob/lsp_micro/musicnew/LightSpeedPlayer_cia.asm

am I doing something wrong? THe modfile is always the same i used with non-micro version, without using -micro it seems to work fine.

Ozzyboshi commented 5 months ago

I did a little investigation, this is the lsmusic file produced by lspconvert:

root@daa8822baadf:/data/phaze/tunnel# xxd -l 100 musicnew/ozzyvirgil3_micro.lsmusic
00000000: 4c53 506d 0115 0002 0000 20a2 1000 0000  LSPm...... .....
00000010: 20a2 0001 0000 0004 104f 0000 0004 0001   ........O......
00000020: 0000 0042 0000 01c2 0000 0342 0000 04c2  ...B.......B....
00000030: 0000 0642 0000 0643 0000 0644 0000 0645  ...B...C...D...E
00000040: 0000 0000 0000 0002 0000 003e 0000 0040  ...........>...@
00000050: 0000 0646 0000 064e 0000 066c 0000 066c  ...F...N...l...l
00000060: 00d6 01ac 

at addr 0x60 there is the value 0xd6, my understanding is this is the bpm (I call this tempo).

without the -micro parameter the bpm was 0x7d (125 in decimal) which is exactly what i set on protracker

So, my theory is that, for some reason , if you add the -micro switch, the tempo is increased.

I fixed doing this on cia.asm:

lea     .pMusicBPM(pc),a2
            move.l  a0,(a2)                 ; store music BPM pointer
            move.w  (a0),d0                 ; start BPM
            lea     .curBpm(pc),a2
            move.w  d0,(a2)
            moveq   #1,d1
            and.w   (a7)+,d1
            move.l #$7d,d0
            bsr.s   .LSP_IrqInstall

            rts

Here i forced the correct value before calling LSP_IrqInstall. This fixes for me but I just want to know if this is a lsp bug or not

arnaud-carre commented 5 months ago

good catch! I just fixed it and pushed ( v1.24 )