BartmanAbyss / vscode-amiga-debug

One-stop Visual Studio Code Extension to compile, debug and profile Amiga C/C++ programs compiled by the bundled gcc 12.2 with the bundled WinUAE/FS-UAE.
GNU General Public License v3.0
314 stars 39 forks source link

Setting up The Player at link time #62

Closed blitmaps closed 2 years ago

blitmaps commented 3 years ago

Hey, I haven't issued a PR as I don't know if you're interested / didn't want to mess with the generic template; however I have done some work making The Player work better in the toolchain.

  1. I am using the new(ish) version by Photon - p6112
  2. I am wrtiting the xdef in assembler before assembling like this:
    
    xdef PlayRun
    PlayRun:
    movem.l d0-a6,-(sp)
    lea incbin_mymod_start,a0
    jsr ThePlayerStart
    movem.l (sp)+,d0-a6
    rts

ThePlayerStart: sub.l a1,a1 sub.l a2,a2 moveq #0,d0 lea p61coppoke+3,a4 ;only used in P61mode >=3 jsr P61_Init rts xref incbin_mymod_start


3. I then use vasm to make a binary:
`vasm -Felf my_player.asm`

4. Then, the xref reference can be defined, and the xdef called in the C++:

// This gets exported as the symbol incbin_mymod_start, so our assembly will see it. INC_BIN(mymod, "P61.mymod")

// This will allow us to call our assembly extern "C" void PlayRun();



5.  Then we can just add the player elf to the make command before it gets hunked, and we are golden.

`@$(CC) $(CCFLAGS) $(LDFLAGS) $(objects) player610.o obj/gcc8_a_support.o -o $@
`
BartmanAbyss commented 3 years ago

Hi, this is certainly an interesting alternative. I included ThePlayer in the sample project just to illustrate how you can use a binary player without recompilation. I think that's easier for most people.

blitmaps commented 3 years ago

For sure, I've had a right headache getting it working right. I still haven't got vasm in the toolchain, I just built it externally. btw, thanks for the toolchain, my game would not have been possible without it!

resom-d commented 3 years ago

Hi guys, I'm trying to use the player coming with the vscode extension. But my converted tracks play much too slow if I set the tempo of the song via a tracker command - even the 'newDitty' mod by photon does the same thing. I use PT315 and have also tried PT361 - but the result is the same. If tempo is not changed all seems good. Any hints what I might do wrong? Regards Hank

BartmanAbyss commented 2 years ago

maybe the ProTracker is too new? Usually we use 2.x versions. On the other hand, if you modify the CIA tempo from the default, it's probably not supported in the player as it runs from vertical blank IRQ. If you're used to NTSC timings (60Hz), running on PAL amiga (50Hz) is 20% slower.

resom-d commented 2 years ago

Hi, thanks for your answer. Found out it was really the timing. Playing now fine. Hank

14.10.2021 20:32:42 BartmanAbyss @.***>:

maybe the ProTracker is too new? Usually we use 2.x versions. On the other hand, if you modify the CIA tempo from the default, it's probably not supported in the player as it runs from vertical blank IRQ. If you're used to NTSC timings (60Hz), running on PAL amiga (50Hz) is 20% slower.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub[https://github.com/BartmanAbyss/vscode-amiga-debug/issues/62#issuecomment-943615643], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AEM5HGADQ3AEAZMGFXZGQW3UG4O4RANCNFSM4ZVMMKQA]. Triage notifications on the go with GitHub Mobile for iOS[https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675] or Android[https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub]. [https://github.com/notifications/beacon/AEM5HGD5XEWCTZCHJQQZEFTUG4O4RA5CNFSM4ZVMMKQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHA7G5GY.gif]