Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user Erik_Bam ! (Registered 2024-05-26) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > *stupid* ASM Sid Player Example ?
2006-03-23 15:53
Trifox
Account closed

Registered: Mar 2006
Posts: 108
*stupid* ASM Sid Player Example ?

Hi i just started coding on the good old c64 and i am wondering how to play music in an assembler executable,
on some tutorials i found that the music usually is located at $1000 but if i load a sid file to that location and jump

jsr $1009

nothing happens, the c64 exits my programm, i think it is clear, a sid file is not an assembler programm to jump in, but how do i now play a music file ?!?!?!?

thanks for any reply ...
 
... 19 posts hidden. Click here to view all posts....
 
2006-03-25 21:27
Trifox
Account closed

Registered: Mar 2006
Posts: 108
'nkay, what is about interesting sid registers ?!?! any meaningful to display as bars ?!?!?!
2006-03-26 00:43
cadaver

Registered: Feb 2002
Posts: 1154
You plan to route all SID writes through the RAM underneath IO area? (no other way to read SID registers, unless you happen to know where/how the player in question stores its own internal data)

Just be aware that depending on the SID register write order, you may break how the player was intended to sound like when you then write the data from your register buffer to SID.

Unless you have a SuperCPU and implement a 6510 emulator for the playroutine to also capture the SID register write order :)

What to display.. don't know, maybe some equalizer bars based on frequency and detecting gate on/off changes.
2006-03-26 00:52
dalezy

Registered: Apr 2002
Posts: 475
trifox, do you happen to have been nicknamed brötchen during the 90s?
(sorry for this totally off-topic interrupt =)
2006-03-26 08:23
Oswald

Registered: Apr 2002
Posts: 5029
cadaver,

- last 2 sid regs are readable
- if you change sid writes to jsr's, you can know the order too.
2006-03-26 10:14
cadaver

Registered: Feb 2002
Posts: 1154
Hmm, that's clever. Though you'd still need the emulator (if possible to implement in sufficient speed) to get exact timing :)
2006-03-26 11:59
WVL

Registered: Mar 2002
Posts: 886
<smart idea to read registers and still keep timing>

how about calling the tune twice,

once with the tune writing below IO in the ramspace ($01=#$30), and then call it again ($01=#$35/#$37) so it will write the registers into IO.

The 'only' thing you'd have to do is backup all changing memory adresses in which the tune keeps where it's playing right now, and restore them when playing the tune the 2nd time.
</smart>
2006-03-26 12:14
cadaver

Registered: Feb 2002
Posts: 1154
Yeah it should not even be *terribly* expensive on rastertime, I guess the state doesn't in most cases exceed 100 bytes. Save+restore (unrolled) = lda,sta,lda,sta * 100 = 1600 cycles = about 27 lines. Plus calling the player twice :)
2006-03-26 12:19
Trifox
Account closed

Registered: Mar 2006
Posts: 108
Quote: trifox, do you happen to have been nicknamed brötchen during the 90s?
(sorry for this totally off-topic interrupt =)


ehrm yes: I AM BRÖTCHEN, not the Brötchen, simply BRÖTCHEN, hehe, it is an old relikt from Mailbox Modem Times ...
2006-03-26 12:20
WVL

Registered: Mar 2002
Posts: 886
another thing you can do is have the tune in memory twice, say once at $1000, and once at $2000..

saves the trouble of changing the state back, except maybe some 0page adresses.. ofcourse it does cost a bit more memory, and you have to relocate the tune..
2006-03-27 09:51
Oswald

Registered: Apr 2002
Posts: 5029
cadaver, I will play you $10000 if you can tell the difference between a music played "normally", and using stored register data for each frame. AFAIK modern players do sid writes like first doing the "calculations" then write sid regs at "one go", so if its 8 or 44 cycles between writes is highly negligable.

thats it about the importance of timinig.

but there's still a solution, which does not need the stupid emulation, to preserve timing:

each JSR-ed routine may read (and stop when entered) a cia timer, and compensate for the time the routine uses up. (and restart the timer when exiting the routine.)

then replaying the tune with the stored data and timing is a breeze.
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
DeeKay/Crest
acrouzet/G★P
megasoftargentina
Oxbow/Xenon
Macbeth/PSW
Jetboy/Elysium
Edhellon/Resource
Earthshaker/Silicon ..
mankeli/Extend
jmin
psych
csabanw
Jammer
Guests online: 87
Top Demos
1 Next Level  (9.8)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Aliens in Wonderland  (9.7)
5 Coma Light 13  (9.7)
6 Edge of Disgrace  (9.6)
7 No Bounds  (9.6)
8 Comaland 100%  (9.6)
9 Uncensored  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 It's More Fun to Com..  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Rainbow Connection  (9.5)
8 Dawnfall V1.1  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Covert Bitops  (9.4)
2 Nostalgia  (9.4)
3 Oxyron  (9.3)
4 Booze Design  (9.3)
5 Crest  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 Antitrack  (9.8)
3 OTD  (9.8)
4 S!R  (9.7)
5 Faayd  (9.7)

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