MEGA65 FORUM

Goattracker for MEGA65

append delete Zaadii

Is there a HowTo avialable on how to use the sound-files generated with the Goattracker (which originally creates that files for the C64) on the MEGA?

Reply RSS

Replies

append delete #1. pmprog

I assume if you export your tune as a PRG file, then inject it into a D64 file, you could probably mount it using the hypervisor, then just load the tune up in 64 mode

append delete #2. Zaadii

Hi pmprog,

thanks for that Idea.
However I would like to have it to run in the C65 mode. Once I got that to run, I think it would be possible to have one goattracker file to be playe on one sid and one on the other. But, of course, such things are only working in the C65 mode....

append delete #3. pmprog

When you say "one file on one sid and another on the other", you do know GoatTracker only exports a single SID tune. On top of that, the C65 isn't exactly a multi-tasking computer, so it's not like you can load up two "SIDplayer" programs and play a track on each.

If you're thinking about playing two different tunes at the same time, you're probably going to need to write a completely new application that allows you to specify two SID files, load them into memory and have an interrupt routine that processes each tune and updates the associated SID.

This isn't available "out of the box" (AFAIK), at least it's nothing supported by GoatTracker

append delete #4. Zaadii

Might be I have exmplaines it in the wrong way.
For the C64 if you use a sid-file in your own program it works like this:
First you load the sid-binary into the memory.

*=$c800
!bin "hack_sound.sid",,$7e

Then you ahve a short init section somewhere at the beginning of the code.

;init music
jsr copy_sound
lda #$00
jsr SOUNDADRESSE
;init music end

And then you call the algorithem to play the sound for the next 1/60 sek. This is the followed by the other code - so you achieve parallelity to the code for example of your game.

;play sound
jsr SOUNDADRESSE+3; $e003
asl $d019
;play sound end

-----------

So what I mean by playing two sid-files on the two sids would be the following:

1) Loading both sid-binayies to the memory.
2) Having two inits.
3) Having the two sections after each other in a interrupt routine.

You are right - this is not real parallelity, but it would seem like it to the humans ear (as it was before with sound and game for the human on the C64).

--------------

So comming now back to my question:
In order to do what I explanied above I need to adapt either the calling code or the sid files themself.
Does someon have something where I can learn form how to do that?

append delete #5. pmprog

I understand what you are after. You will need to write brand new init and interrupt routines; which means you'll either need to write a new "export" function inside of GoatTracker, or write some C65 that can read either the GT source file, or one of it's exports.

The reason this is the case is because the C64 only has one SID chip, so the player that is used in the GT export only writes to a single set of SID registers. If you ran two different SID tracks on the C65 (or even the C64) in the manner below:

main:
call init_sid_a
call init_sid_b
loopforever:
jmp loopforever

interrupt:
call play_sid_a
call play_sid_b
reti

(Sorry, this is probably more x86 than 6502, but hopefully still understandable)

All this will do on the interrupt will play SID B, because the SID registers known in both players point to the same SID chip, so "play_sid_b" will overwrite all the registers just set by "play_sid_a".

So you'd either need to patch your second SID, or write a new playroutine that accepts a SID chip number in (A) or something, and use that to select which registers/addresses to use when setting the values.

I hope that's a bit clearer

append delete #6. Zaadii

@pmprog,
thank you so much for that detailed descrpition. Especiall at the important technical part, concerning the play routines, I see now much clearer. But might be, I can get the oppinion of some others, as well.

@others:
Is there a way to patch the sid-file from the goattacker to make it play on the MEAG65 in C65 mode?
According to my assumptions only few bytes concering some register adresses and something concerning the timer would have to be patched.
I allready have the corresponding workflow to patch a sid-file to run on the C128 in C128 mode, and my first idea was to learn from that, but the person that started that couldn't finish it...so I do no see the compleete way.

append delete #7. pmprog

Using the following source code:
https://github.com/MEGA65/mega65-core/blob/af3f8ef4a0eeb6d506ca82f39e83544d66aa4dfd/src/vhdl/iomapper.vhdl#L857-L860

It appears the "right" SID is mapped at $D400 which is where the C64 SID chip is mapped (meaning GT files should play without any changes, would need to test this though), and the "left" SID is mapped at $D440.

This means to play a SID track on the "left" SID, you need to add $40 to each address in the INIT and PLAY subroutines. Whether you do this to your SID file, or if you patch this as you load the file into RAM is entirely your choice.

Anyway, there's not much more I can say here; maybe deft or gardners or somebody else who's actually got their dev board up and running can confirm what I've said, or even correct me if I'm wrong.

append delete #8. LGB

@Zaadii: well, it depends who those SID files work. Honestly I have no experience with that at all :( But if you give examples, or you have well specified questions ... Basically, if the question is about to load something in C65 mode (something like the usual BASIC stub with a SYS line), it can be done with writing C65 version (it would need a BANK token as well, and another memory address), then maybe some init code to set C64 speed, alter memory configuration etc etc, and then the program will more or less "sense" it's a C64 or so. However you may have problem with illegal opcodes especially on a real C65. On M65 though, as far as I know there is an ongoing change to use 6502 CPU personality if VIC-II I/O mode is set so it can help in that situation at least. But I am not sure if you want this, or you'd be more happy to port things to "really C65 mode" not something like "mangled" ... Well, I am not sure I could explain myself clearly enough ...

append delete #9. gpz

there is also a stereo version of GT that should work just fine on mega65 if you select the right address for second SID

append delete #10. pmprog

@gpz: I did think about mentioning that, but Zaadii implied that he wanted to play two different seperate SIDs

append delete #11. gardners

@gpz is right: If you pick the correct SID addresses, it should just work fine from C64 mode, any illegal opcodes not withstanding.

Reply

(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Your friendly neighbourhood moderators: Deft, gardners, MARCOM