Background Music
Moderator: Moderators
-
- Vic 20 Hobbyist
- Posts: 118
- Joined: Mon Jan 04, 2016 10:17 pm
- Website: http://www.tonyrocks.com
- Location: Pittsburgh
- Occupation: IBM Watson Engr
Background Music
Is it possible play sounds or background music using BASIC (and perhaps DATA) and not have the other basic routines get in the way?
Re: Background Music
Using only basic is hard but you can include a small ml-program in data statements which is poked in and started in the background with a sys.
-
- Vic 20 Hobbyist
- Posts: 118
- Joined: Mon Jan 04, 2016 10:17 pm
- Website: http://www.tonyrocks.com
- Location: Pittsburgh
- Occupation: IBM Watson Engr
Re: Background Music
thanks TLR. Anybody have any examples?
- Mike
- Herr VC
- Posts: 4839
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: Background Music
In BASIC you'd need a main loop that's executed in a fairly regular manner. Not that hard to accomplish, as such a loop is a central element of most games. Getting a constant execution time for that loop is a little more difficult. That given, you'd just POKE the sound registers with new values upon each new main loop iteration.
Here's an example that plays a children's song alongside a well known animation from the VIC user's guide: (link)
With interrupts, and in machine language, it's much easier to do, obviously. Like thus (download):
It's still (mostly) BASIC and DATA, so there you go.
Here's an example that plays a children's song alongside a well known animation from the VIC user's guide: (link)
With interrupts, and in machine language, it's much easier to do, obviously. Like thus (download):
Code: Select all
1 FORT=828TO939:READA:POKET,A:NEXT:SYS828
2 DATA 120,169,81,141,20,3,169,3,141,21,3,169,0,141,137,3,141,138,3,88,96,174,137,3,202
3 DATA 16,30,172,138,3,185,140,3,141,12,144,240,2,169,15,9,240,141,139,3,200,192,32,144
4 DATA 2,160,0,140,138,3,162,14,142,137,3,173,14,144,41,240,13,137,3,45,139,3,141,14
5 DATA 144,76,191,234,0,0,0,204,204,0,204,201,201,204,204,0,225,221,215,210,204,204,0
6 DATA 204,204,0,204,195,195,187,187,0,225,221,215,210,204,204,0
- pixel
- Vic 20 Scientist
- Posts: 1351
- Joined: Fri Feb 28, 2014 3:56 am
- Website: http://hugbox.org/
- Location: Berlin, Germany
- Occupation: Pan–galactic shaman
Re: Background Music
In the end you'd have get hold of an assembly coder or – much, much better – you get into assembly yourself which is a very rewarding experience. The 6502 instruction set is poetry.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
https://github.com/SvenMichaelKlose
-
- Vic 20 Hobbyist
- Posts: 118
- Joined: Mon Jan 04, 2016 10:17 pm
- Website: http://www.tonyrocks.com
- Location: Pittsburgh
- Occupation: IBM Watson Engr
Re: Background Music
thanks guys, you've been a big help. Im trying to push limits with BASIC for myself, but I'm finding it difficult to push where I want to go heh