Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Play a SID in ACME
2010-03-03 19:42
MisterMSK
Account closed

Registered: Jul 2009
Posts: 37
Play a SID in ACME

Hi All,

I wanted to first thank stranger so much for his help with adding a Koala picture into a program. It worked beautify. I am also interested into adding music to the program. I went to code base and they had two examples. I found a few SIDs using Pokefinder and made sure they had a start address of $1000. Anyway, when I tried them I got nothing coming from the good old commodore speakers. I loaded the SID up in a player and it played fine. Just curious if anyone here (which I know the answer to) :) has any experience with adding SID music to some assembler code and can point me into the right direction.

Thanks,
MisterMsk


2010-03-03 20:35
Stryyker

Registered: Dec 2001
Posts: 468
Can you include example code of what you're doing along with a link to the in HVSC to the tune?
2010-03-03 21:24
chatGPZ

Registered: Dec 2001
Posts: 11386
first of all make sure you have a correctly working binary... load it, and do something like

10 sys4096
20 sys4096+3:goto20

that should make some (ugly) noise :)

and if that works, then doing

lda #0
jsr $1000

for init, and

jsr $1003

for playing (once per frame) should do the trick
2010-03-03 21:39
MisterMSK
Account closed

Registered: Jul 2009
Posts: 37
Each one can be found here and here.

The Sample SID I found was Bubble Trouble.
I'll list the first one for you with the modification.

;--------------------------------
;JCH, DMC, Whatever IRQ music plr (Modified)
;================================

             !to "workdarnit.prg",cbm
             * = $0810 ;Remember SYS 2064 to enable it

             sei
             lda #<irq
             ldx #>irq
             sta $314
             stx $315
             lda #$1b
             ldx #$00
             ldy #$7f 
             sta $d011
             stx $d012
             sty $dc0d
             lda #$01
             sta $d01a
             sta $d019 ; ACK any raster IRQs
             lda #$00
             jsr $1000 ;Initialize Richard's music
             cli
hold         jmp hold ;We don't want to do anything else here. :)
                      ; we could also RTS here, when also changing $ea81 to $ea31
irq
             lda #$01
             sta $d019 ; ACK any raster IRQs
             jsr $1003 ;Play the music
             jmp $ea31
            

             * = $1000-2
             !binary "BubbleTrouble.sid" 


2010-03-03 21:48
Mace

Registered: May 2002
Posts: 1799
A SID file holds more than just the binary of the music routine. It has a header, which, in your case, is at $1000.
The code part start higher up in the memory.

You need to truncate the SID so that you only have the real binary in the memory.
Check here for more information: SID header information.
2010-03-03 22:01
MisterMSK
Account closed

Registered: Jul 2009
Posts: 37
Mace,

Thank you. I had to remove the first 124 (7C) bytes off of that SID and it worked perfectly with the code. Would of been nice on Codebase64 to mention something like that, I guess instead of saying.

Quote:
Rip one of my tunes from the HVSC and save as music.dat if you like


Thanks Again,
MisterMsk
2010-03-03 22:04
chatGPZ

Registered: Dec 2001
Posts: 11386
try this:

*=$1000
!bin "BubbleTrouble.sid",,$007c+2
2010-03-04 05:47
Inge

Registered: Nov 2003
Posts: 144
Quote: Mace,

Thank you. I had to remove the first 124 (7C) bytes off of that SID and it worked perfectly with the code. Would of been nice on Codebase64 to mention something like that, I guess instead of saying.

Quote:
Rip one of my tunes from the HVSC and save as music.dat if you like


Thanks Again,
MisterMsk


I'll explain what "save as music.dat" means.

In Sidplay2/Win you can choose File->Save As. Choose to save as C64 data (.dat). You'll then get a C64 binary without the PSID header.
2010-03-04 09:16
Frantic

Registered: Mar 2003
Posts: 1648
I added some additional notes in this article, in order to make these things clearer for beginners:

http://codebase64.org/doku.php?id=base:simple_irq_music_player

..and while I am at it, I should also remind all the coders out there to keep adding stuff to codebase! (Well, there is in fact some contributions every now and then, so I am not complaining, but there could always be more. :)
2010-03-04 14:21
MisterMSK
Account closed

Registered: Jul 2009
Posts: 37
Quote: I added some additional notes in this article, in order to make these things clearer for beginners:

http://codebase64.org/doku.php?id=base:simple_irq_music_player

..and while I am at it, I should also remind all the coders out there to keep adding stuff to codebase! (Well, there is in fact some contributions every now and then, so I am not complaining, but there could always be more. :)


Thanks, Frantic. It looks great. Nice instructions. Step-by-Step and everything.

Inge, Thank you for explaining the saving of the .DAT stuff. It helps. I tend to use HxD for Hex-Editing in Windows, quick and easy goto 7C and delete all before and save.

Ok... Lets gets a little deeper into this playing music code. I kinda' want to play the SID while the users choices from a menu. Since I have a menu in code already, I could put a routine around there. With the above code, Would I remove the hold statement and put the menu in between where the hold statement was?
2010-03-04 14:41
Frantic

Registered: Mar 2003
Posts: 1648
Yes... If you want some sort of main loop running in your program, it should be instead of that jmp hold stuff.
 
... 18 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Microshark/Damage(HUN)
CA$H/TRiAD
Mihai
The Phantom
rikib80
Freeze/Blazon
Guests online: 89
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top NTSC-Fixers
1 Pudwerx  (10)
2 Booze  (9.7)
3 Stormbringer  (9.7)
4 Fungus  (9.6)
5 Grim Reaper  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.047 sec.