Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user eightbitswide ! (Registered 2024-12-24) 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-26 00:43
cadaver

Registered: Feb 2002
Posts: 1160
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: 476
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: 5094
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: 1160
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: 902
<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: 1160
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: 902
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: 5094
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.
2006-03-27 10:04
chatGPZ

Registered: Dec 2001
Posts: 11386
prepare the money for transfer, there are a bunch of tunes that sound terribly wrong if the timing is somehow disturbed (even slightly). example is the cucumber-juice 2 note tune by zardax, the bassdrum makes funny bleep noise if played with wrong timing.
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
CreaMD/React
Guests online: 76
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 The Demo Coder  (9.6)
6 Edge of Disgrace  (9.6)
7 What Is The Matrix 2  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Cubic Dream  (9.6)
3 Party Elk 2  (9.6)
4 Copper Booze  (9.6)
5 X-Mas Demo 2024  (9.5)
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 Original Suppliers
1 Derbyshire Ram  (9.7)
2 Fungus  (9.3)
3 Black Beard  (9.2)
4 Baracuda  (9.2)
5 hedning  (9.1)

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