| |
Nobody
Registered: Jan 2014 Posts: 20 |
Put x .sid-files together to one
Hi,
can someone tell me, how to make from x .sid-files one exactly?
What/how do I need to do?
How are the instruments shared between them? Does every ´subtune´ use its one set then, or is there any way to share them beteween the 7 tunes if they are the same?
And what about the startadress, actually every is at $1000, do I need to change them? To what? How do I find out how long the track is -
and how do I put everything together exactly?
Greets |
|
| |
TheRyk
Registered: Mar 2009 Posts: 2071 |
Shared instruments are not gonna happen, unless you create one .SID-File and do subtunes yourself in the tracker.
Rest's quite easy.
First you must relocate all the files, so they do not interfere with one another.
Use this:
Sidreloc V1.0
Next you need to build an own init routine which allocates via registers (accu, x-reg, y-reg) which tune is supposed to be initialised via its Init-Adress (after relocating) and then modifies the address for JSR $PLAY using the Play-Address (again the one after reloc of course).
Be warned, normally you'll sooner or later come across tunes that SIDReloc won't relocate and/or that write into RAM out of their own range, fixing this requires no geniius but some good old hacking effort :)
Finally dump the full memory you use including your own init routine as .PRG and make a SID header, e.g. using SID-Edit V4.02
PS: Especially if you wanna include older tunes, you should also include some decent reset of $d400-$d417 yourself in your init, just to be on the sure side.
PPS: You find songlenghts.txt in each HVSC "Documents" folder, http://csdb.dk/release/?id=139393. If this plays any role in your code, you need to build a counter via CIA/TOD registers or VIC frame counter to calculate playing time. |
| |
Nobody
Registered: Jan 2014 Posts: 20 |
Ok, (I understand nothing but want to fight myself through it) step by step:
Sidreloc usage:
---------------
I opened sidreloc and have my .sids in the same folder.
As I can see there are some options set with default-values (page, zp-reloc, frames...) - can I simply leave them as they are? I do know nothing about zeropages, bits and bytes - I am happy that I was able to get a hexeditor installed and being able to change some .sid-properties like track-titles with it until today...
Regarding option tolerance: what does wrong pitches mean? (how do I find them?)
In short words: How does Sidreloc work exactly, how exactly do I need to relocate my files step by step that they not interfere with each other?
While writing here I found a manual on the homepage, but it still is not completely clear to me:
EXAMPLE
The following command line can be used to relocate Zoids by Rob Hubbard from its original load address of $1000 to the address $4200, and move the zero-page variables from $fb-$fe to $c0-$c3:
sidreloc -p 42 -z c0-ff Zoids.sid Zoids-4200.sid
What are the zero-page variables, do I have these, too? How do I find out, furthermore, do I need to change mine? Or can I simply try to relocate my short 7 tracks to 1000, 1500, 2000, 2500 and so on for example? |
| |
TheRyk
Registered: Mar 2009 Posts: 2071 |
Especially regarding "I understand nothing", I recommend to work with less complicated batch in SIDreloc, e.g.
sidreloc.exe -f -k -p 40 InfilePageXY.sid OutfileTo4000.sid
pause
Don't worry too much about ZP regs atm. Unless you do not use ZP regs in the player code, they're not important for your purpose. IF they are important, just initialise the ones you need, e.g. dump default ZP values from $02 to $ff and restore them before init, _if_ you think, your SIDs clobber ZP regs. |
| |
Nobody
Registered: Jan 2014 Posts: 20 |
Ok, I´ll simply try around a bit.
Regarding the playroutine/.prg:
How to? With an assembler? Is there any easy example that I can use/modify/have a look into how to somewhere? |
| |
TheRyk
Registered: Mar 2009 Posts: 2071 |
Actually some(!) primitive assembler knowledge is unavoidable to set up new Init routine, sorry. If that's too much for you, just do the relocating and then get some coder's help, shouldn't take an average coder a great deal of time. |
| |
Nobody
Registered: Jan 2014 Posts: 20 |
I am able to load and save something in Tass and being able to change border/backgroundcolors :)
But maybe I can do something If I see how....C64Studio already is running, I only need some more input... |
| |
TheRyk
Registered: Mar 2009 Posts: 2071 |
Quick and primitive code could look sth like this (for 2 tunes, 1st initialised with LDA #$00, 2nd with LDA #$01)
*= $c000
InitAddress
bne +; Accumulator not Zero -> 2nd tune
lda #<$1003; 1st PlayAdress LowByte
sta PlayAdress+1
lda #>$1003; 1st PlayAdress HighByte
sta PlayAdress+2
jmp $1000; 1st tune's init address no JSR/RTS as Init should end with RTS
+ lda #<$2003; 2nd tune's play adress
sta PlayAdress+1
lda #>$2003
sta PlayAdress+2
jmp $2000; 2nd tune's init no JSR/RTS as Init should end with RTS
*= $c080
PlayAdress
jmp $1003; JMP because play routine ends with RTS
In your SID-File header flag
Init as $C000
Play as $C080
Did not compile/test this, but hope you get the idea :)
Of course it's getting somewhat more complicated if you merge SIDs with various subtunes on their own. And there are more effective ways of doing this, esp if the no. of merged files is higher than just a few.
PS: In that case insert CMP #$00 at beginning of Init, CMP #$01 at "+", #$02 at "++" and so on... |
| |
Nobody
Registered: Jan 2014 Posts: 20 |
Ok, I´ll definately need a programmer *lol*:
!to "BT2rmx.prg", cbm
* = 1000
!bin "BT2-1r.sid",, $7c+2
* = 2100
!bin "bt2-2r.sid"
* = 3300
!bin "bt2-3r.sid"
* = 4400
!bin "bt2-4r.sid"
* = 5500
!bin "bt2-5r.sid"
* = 6600
!bin "bt2-6r.sid"
* = 7700
!bin "bt2-7r.sid"
*= $1000
InitAddress
bne +; Accumulator not Zero -> 2nd tune
lda #<$1003
sta PlayAdress+1
lda #>$1003
sta PlayAdress+2
jmp $1000; no JSR/RTS as Init should end with RTS
+ jsr $2100; 2 init adress
lda #<$2103
sta PlayAdress+3
lda #>$2103
sta PlayAdress+4
jmp $2100;
+ jsr $3300; 3 init adress
lda #<$3303
sta PlayAdress+5
lda #>$3303
sta PlayAdress+6
jmp $3300;
+ jsr $4400; 4 init adress
lda #<$4403
sta PlayAdress+7
lda #>$4403
sta PlayAdress+8
jmp $4400;
+ jsr $5500; 5 init adress
lda #<$5503
sta PlayAdress+9
lda #>$5503
sta PlayAdress+10
jmp $5500;
+ jsr $6600; 6 init adress
lda #<$6603
sta PlayAdress+11
lda #>$6603
sta PlayAdress+12
jmp $6600;
+ jsr $7700; 7 init adress
lda #<$7703
sta PlayAdress+13
lda #>$7703
sta PlayAdress+14
jmp $7700;
*= $c080
PlayAdress
jmp $1003; JMP because play routine ends with RTS
Who can tell me what is missing and what is wrong? (more detailed than "everything", pls :D)
And does this .asm-file also need a playroutine like
sei
lda #$00
tax
tay
jsr $1000
again
lda #$40
cmp $d012
bne *-3
inc $d020
jsr $1003
dec $d020
jmp again ? |
| |
TheRyk
Registered: Mar 2009 Posts: 2071 |
hehehe, for a beginning, ALL(!) your binaries need to be free of SID header and load address ;)
think about the meaning of
,, $7c+2 |
| |
Nobody
Registered: Jan 2014 Posts: 20 |
In the meanwhile Ian has finished this job, a BIT faster...
I think I upload it now and hope that he simply can show me how he has done this, for understanding.
Yes, the ,, $7c+2 caught my eye, too :) |
| |
TheRyk
Registered: Mar 2009 Posts: 2071 |
hmhkey :) Hopefully, you or someone has learned sth in this thread, anyway, and if it's just "use subtunes right from the start" :D |
| |
Count Zero
Registered: Jan 2003 Posts: 1823 |
Ask someone to code a "proper" music collection for you :) |
| |
Nobody
Registered: Jan 2014 Posts: 20 |
I still have another, larger, multifile-project in my pipeline...... (without subtunes cause I work on it since years). But 1. I need to finish them and 2. I think they are too large to put them all together - but I need to see when they´re ready. |
| |
DeMOSic
Registered: Aug 2021 Posts: 126 |
Yes i know, reviving 6 year old thread, Stumbled upon this thread, decided to fix the Code uploaded by TheRyk (and added support for 4 subtunes! (you can add more))
Use with Init LDA #$00-03 JSR $c000 Play JSR $c080
Didnt compile it but it seems logical.
*= $1000
song1:
t1init = $1000
t1play = $1003
.binary "songname1.sid",7c+2
*= $2000
song2:
t2init = $2000
t2play = $2003
.binary "songname2.sid",7c+2
*= $3000
song3:
t3init = $3000
t3play = $3003
.binary "songname3.sid",7c+2
*= $4000
song4:
t4init = $4000
t4play = $4003
.binary "songname4.sid",7c+2
*= $c000
InitAdress:
cmp #$01
beq sub2 ; If what's in accumulator = #$01, Init 2nd Subtune
cmp #$02
beq sub3 ; If what's in accumulator = #$02, Init 3rd Subtune
cmp #$03
beq sub4 ; If what's in accumulator = #$03, Init 4th Subtune
; If what's in accumulator = #$00, Init 1st Subtune
jmp t1init; 1st tune's init address no JSR/RTS as Init should end with RTS
sub2:
lda #<t2play; 2nd tune's play adress Hi Byte
sta PlayAdress+1
lda #>t2play; 2nd tune's play adress Lo Byte
sta PlayAdress+2
jmp t2init; 2nd tune's init no JSR/RTS as Init should end with RTS
sub3:
lda #<t3play; 3rd tune's play adress Hi Byte
sta PlayAdress+1
lda #>t3play; 3rd tune's play adress Lo Byte
sta PlayAdress+2
jmp t3init; 3rd tune's init no JSR/RTS as Init should end with RTS
sub4:
lda #<t4play; 4th tune's play adress Hi Byte
sta PlayAdress+1
lda #>t4play; 4th tune's play adress Lo Byte
sta PlayAdress+2
jmp t4init; 4th tune's init no JSR/RTS as Init should end with RTS
*= $c080
PlayAdress:
jmp t1play; JMP because play routine ends with RTS |
| |
Bansai
Registered: Feb 2023 Posts: 34 |
Quoting TheRykEspecially regarding "I understand nothing", I recommend to work with less complicated batch in SIDreloc, e.g.
sidreloc.exe -f -k -p 40 InfilePageXY.sid OutfileTo4000.sid
pause
Thanks. That tool is worth its weight in gold for identifying absolute addresses embedded in tune data areas (e.g., absolute "subroutine" addresses for patterns) in an automated fashion, epecially when they are discontiguous in memory such as if they're embedded in song data and are not in a table. I'll have to hack on the source as it looks extremely useful if I'd want to do something like extract only one subtune's song data then cut and paste it back into a player, modify it, etc. |