IRQ-Driven SID Music: Commodore 64 BASIC and Machine Language

  Рет қаралды 34,209

8-Bit Show And Tell

8-Bit Show And Tell

Күн бұрын

We take a look at several techniques to play SIDs on a C64, starting with a very simple BASIC method, and then working up to raster interrupts in machine language. Download the player: psw.ca/prg/musicplayer.d64
Links:
High Voltage Sid Collection: hvsc.c64.org/
PSID64: psid64.sourceforge.net/
Index:
0:00 A request - and a donation!
1:20 A bit about SIDs
2:37 Converting .sid to .prg with PSID64
5:47 Playing the SID from BASIC ** I should have spelled out that the converted SID needs to be loaded first, with LOAD”SONG”,8,1
8:32 Simplest machine language implementation - busy loop, no IRQs yet
10:39 Looking for zero page conflicts
13:36 CIA IRQ-driven player
18:43 Moving the start of BASIC to protect the music
21:17 Raster IRQ-driven player
26:57 Some final words

Пікірлер: 282
@vytah
@vytah 5 жыл бұрын
If anyone's wondering why $1000 is the most common address for loading SIDs: VIC cannot read RAM in ranges $1000-$1fff and $9000-$9fff (it sees the character ROM there instead), so if you have a part of memory where you can't put graphics, why not put music in there instead.
@8_Bit
@8_Bit 5 жыл бұрын
It seems no matter how much I try to cram into a video, I always forget to say something obvious. I guess that's what the comments are for, eh? :) Thanks!
@stefanjohansson3578
@stefanjohansson3578 5 жыл бұрын
More Machine Language videos please, I really like your calm style when explaining and showing things.
@WarrenMarshallBiz
@WarrenMarshallBiz 5 жыл бұрын
I think you should focus on whatever interests YOU. It's your channel. Don't chase views. Everyone and their brother did a Mario videos and, sure, it's cool and all but I'd rather hear about weird BASIC optimizations and assembly tips/tricks and things like that. You've got a head full of history and great commodore content ... keep it coming! :)
@8_Bit
@8_Bit 5 жыл бұрын
Thanks! Definitely good advice.
@RandomInsano2
@RandomInsano2 4 жыл бұрын
I like the trick of changing the background colour on the boarder! It’s a great way to visualize how long the interrupt is running.
@JeremyNasmith
@JeremyNasmith 5 жыл бұрын
Niche. No question. Loads of content all over YT of Mario etc. There's far too little on what you termed "niche". I know I speak for many of your viewers as well as myself: as a kid, I could see these amazing games, so I knew the C64 was capable of far more than what could be achieved using basic. (Heck, poking a sprite or two into memory and doing a simple "bounce off the walls" program already caused things to crawl)... Most of us didn't have an assembler or the memory map. Most tried listing or favorite game to find simply '10 SYS #####' and wondered how on earth one line of code made Paperboy work. Where was the hidden code? The "good stuff?" Parents had far less of a clue than we did. 33 years later, and I finally start to see how things were done, and what tools were needed!
@RedSkyHorizon
@RedSkyHorizon 5 жыл бұрын
Same here
@Koxi73
@Koxi73 5 жыл бұрын
Yes, I totally agree. After 35 years I start understanding assembler a bit on the C64 and this is mostly because of this niche videos. And damn you Super Mario .. Great Giana Sisters rules the 8bit world.
@bierundkippen720
@bierundkippen720 4 жыл бұрын
I absolutely agree with all of you guys.
@TimToolman
@TimToolman 5 жыл бұрын
Please keep up the knowledge transfer on c64 coding! Of course super mario is going to attract views, but i really appreciate your in depth videos most. Very keen to hear more about interrupts. What happens if one routine runs long, are other interrupts delayed or dropped? Or is the long runner dropped? A full overview on how to understand them would be ace!
@8_Bit
@8_Bit 5 жыл бұрын
A more in-depth video about interrupts is a good idea. In the meantime, a quick (and rough) explanation: after a SEI (set interrupt disable opcode) no other IRQs interrupts will occur until a CLI (clear interrupt disable) occurs, so the long running interrupt will just keep going as long as it likes. However, other interrupt sources will wait and cause an IRQ as soon as possible. But they can't queue up more than one request from each source, additional IRQs are dropped.
@Mr_ToR
@Mr_ToR 5 жыл бұрын
@@8_Bit Definitely hoping for an in-depth episode about the interrupts. Thnx a lot.
@werre2
@werre2 5 жыл бұрын
www.c64-wiki.com/wiki/Raster_interrupt
@tiger1x
@tiger1x Жыл бұрын
When I watched that video some (long) time ago, I didn't understand much what it is about but now I watched it again and I was even able to replace the music player with my own (little) assembler program which is just reading character from $0400, add one to it and write it again there as a background process while running the maze in basic! What a pleasant feeling when you finally understand stuff you didn't some time ago! Thanks Robin for those kind of videos! And since you asked: please more of that kind of videos! I admire those excursions into C64 assembler! 😃
@3vi1J
@3vi1J 4 жыл бұрын
I only recently found your channel, but I'm loving the vids in this series. In all my playing around with 65xx assembly, I never thought about using raster timing to benchmark routines - simple and effective... I wish 14 year old me could have seen this! Keep up the great work.
@LatherFace
@LatherFace 5 жыл бұрын
Some of this was over my head, but I still watched it twice because it was oddly relaxing.
@chromosundrift
@chromosundrift 5 жыл бұрын
I love the machine language coding videos best
@miserychordia
@miserychordia 4 жыл бұрын
i really like how you go in depth on the commodore..back in the 80's i was kind of a "lamer" who only played games, i had a hard time figuring out programming..or "what to do with it"... watching you explain it makes me more and more curious about learning how to program .also you have a really nice voice so it's really relaxing to watch your videos!
@johnrickard8512
@johnrickard8512 2 жыл бұрын
Man the C64 was a surprisingly well specced computer for its time. No wonder it was so popular!
@MichaelBLive
@MichaelBLive 5 жыл бұрын
I love ALL the videos! Especially the niche ones.
@darkstatehk
@darkstatehk 4 жыл бұрын
This is quickly becoming one of my favourite must watch channels!
@madpuppet666
@madpuppet666 3 жыл бұрын
I JUST BOUGHT AN ORIGINAL C64C SO I WILL BE WATCHING A LOT OF THESE VIDEOS!!! Sorry for yelling but I also bought a bottle of spiced rum that I'm halfway through.
@velthoenify
@velthoenify 5 жыл бұрын
This channel is getting better with each new video. Keep up the good work!
@75slaine
@75slaine 5 жыл бұрын
Excellent yet again Robin, always learn something new on this channel.
@ProjectGeek1
@ProjectGeek1 5 жыл бұрын
So weird! I've been spending all week getting SID files to play on my C64. This helps!
@00Skyfox
@00Skyfox 5 жыл бұрын
I’d say please keep up these niche programming videos. Knowing all these little programming tricks and what the various memory registers are for is a fading knowledge that will be lost to time if experts like you aren’t around to teach the next generation of enthusiasts. Videos have much more of a human touch than simply reading a book or programmers reference guide and can go into much more detail.
@BillAnt
@BillAnt Жыл бұрын
I was thinking the same, these nice niche tutorials are what's gonna be left once the old timer c64 coders depart this Earth (sadly we all do at some point). While online Wikis and such will remain, there's nothing better than Robin explaining and demonstrating it in his cool calm voice. :)
@fluffyfoxbunny
@fluffyfoxbunny 5 жыл бұрын
This is awesome, these are the best C64 assembly tutorials, and I'd love to see more, especially maybe a series on making a simple game in ASM with sprite movement, controls and stuff? Either way it's great to see this stuff presented in a way that doesn't make my head spin
@azofeclipse
@azofeclipse 2 жыл бұрын
I feel like that last SID tune is gonna take me back to the past.
@jameshyde6395
@jameshyde6395 4 жыл бұрын
keep up the video's they really are appreciated. you are a treasure to the C64 community, long live the commodore 64!
@G.B...
@G.B... 4 жыл бұрын
I realize that videos about C64 games are probably going to be more popular, especially when the video is about the remake of a popular hit (like mario). Nevertheless, I think a big part of your audience is here mainly for the assembly videos, myself included. C64 was always a paradise for machine language crunchers. The 6502/10 has a simple yet effective instruction set, and the C64 hardware provides you the tools to make something cool easier than other machines based on the same processor. Not to mention the challenge to make something impressive on a machine with total RAM similar to what a png logo on a website takes. You explain everything in detail, and your assembly videos are great for both old coders and people wanting to learn assembly. We need more videos like this one, e.g. another episode about IRQ-driven applications, or a (pseudo) random number generator not based on SID oscillator 3, or implementing math functions in assembly - you name it.
@8_Bit
@8_Bit 4 жыл бұрын
I definitely want to make an episode about LFSRs, a type of pseudo-random number generator. I've used them quite a bit in my games, after hearing that the Atari 2600 classics Pitfall! and River Raid used them.
@LivingInAVan
@LivingInAVan 5 жыл бұрын
This is a excellent video and you are great at producing tutorials. Keep up the excellent work!
@inphanta
@inphanta 3 жыл бұрын
Fascinating, I definitely enjoy your niche C64 videos. 6502 has always seemed like a black art to me, but in seeing you break it down like this, it's slowly making sense.
@Nelwyn
@Nelwyn 5 жыл бұрын
I enjoy videos like this. I never learned to program in machine language, but I did fiddle around with basic quite a bit. Even though I don't really understand what you're doing it's still interesting to watch.
@75slaine
@75slaine 5 жыл бұрын
And I love niche stuff, plenty of other channels cover the big ticket items and while I like to hear your take on it, it’s not why I come here.
@SteveGuidi
@SteveGuidi 4 жыл бұрын
Thank you for another great and informative video, Robin. Back in the day, I use to rip music from various intros and demos, releasing a disk of sid music every now and then. A fellow BBS'er wrote a machine language routine for me that would play the music, and I wrote a BASIC front-end to drive the player with play/stop/load operations. I had no understanding of ML at the time and I would often think his routine was some low-level complicated magic! But after watching your demonstration, its much clearer how his "magic" was done :)
@JohnKerrashVirgo
@JohnKerrashVirgo 5 жыл бұрын
Absolutely love the obscure niche things! Keep them coming 😄
@LaLa-6581
@LaLa-6581 4 жыл бұрын
Just discovered this. Fantastic explanation, clear and easy to understand with all the visual aids. Nicely done! (NB: I used to be in the HVSC Crew, so cheers for mentioning the HVSC, too. ;-)
@8_Bit
@8_Bit 4 жыл бұрын
Thanks for being a part of HVSC, it's awesome! :)
@PregnantSausage
@PregnantSausage 5 жыл бұрын
You always have the most fascinating videos.
@borismatesin
@borismatesin 5 жыл бұрын
This is by far the most succinct explanation on both how to set up a minimal player and how raster (and stable raster) interrupts work. I need to rewatch this with an open emulator (or actual machine) and start messing with players pronto.
@superx9619
@superx9619 4 жыл бұрын
I have no idea what hes talking about but I watch these vids cuz I find them calming lol
@jamesrbrindle
@jamesrbrindle 4 жыл бұрын
Learned some things I didn’t know about raster programming on the c64 from this. Used to write demos and cracktros back in the 80’s but never really understood the system.
@evileyeball
@evileyeball 5 жыл бұрын
That was pretty neat. I haven't done any assembly since back in my university days when I had to take a course on it. I subscribed because I enjoy watching neat stuff like this or well mostly listening to help keep myself awake on long night shift nights.
@8_Bit
@8_Bit 5 жыл бұрын
Thanks for watching - or listening! I used to work night shifts too, I'm glad to hear these episodes help a bit.
@thicclink
@thicclink 5 жыл бұрын
I have to admit that, being a beginner, most of this is pretty over my head. However, I think you do a great job by starting simple (dare I say BASIC?) and building up to the more technical things through the video. You also do a great job explaining things, even if I'm not able to pick up all of the information. Anyway, what I'm trying to say is you should keep making these niche videos along with your more "mainstream" ones!
@8_Bit
@8_Bit 5 жыл бұрын
Thanks, I'll keep making them. Is there a particular subject you think would be helpful to you and other beginners?
@thicclink
@thicclink 5 жыл бұрын
@@8_Bit BASIC is a little easier to comprehend for beginners vs machine language. But i understand that it has a lot of limitations, so that limits you on what you can demonstrate. And i do still enjoy the machine language even if I'm not proficient in it
@thamessinclair2010
@thamessinclair2010 5 жыл бұрын
@@thicclink BASIC 2.0 on the C64 is quite limited. All the cool stuff needs at least poking, which often ends up being almost like machine language anyway. If you actually have a C128, you could just stay in C128 mode and use the much richer BASIC 7.0 there.
@MorreskiBear
@MorreskiBear 3 жыл бұрын
@Kurt Pedersen It's been 4 months, please allow my reply... When you add or edit a line in a large BASIC program, the computer must move an (increasingly larger) chunk of memory to make room for your new line, then update the hidden links that connect the lines of your program. You must be patient. If you hit STOP / RESTORE before the cursor returns (aborting this memory management process midway) it will corrupt your program. I've done it.
@jeffryan7672
@jeffryan7672 3 жыл бұрын
Thanks for making this video Robin! Exactly what I need to do in my curling game. Gonna try this ASAP!
@mikegarland4500
@mikegarland4500 Жыл бұрын
These are just immensely informative. Enjoying every one of them so far. Thank you!!! (I have my VICE emulator running, and usually either the built-in monitor feature, as well as CBM prg Studio, open at the same time so I can follow along with the videos. Plus, I've got Notepad++ open in the background so I can take notes.) I can't tell you how many books and videos I've watched that tried to explain about this, and previous topics you've done in this series, but they never really made sense. Until now. You have a style that builds on current topics and keeps branching logically through variations that are not on interesting but helpful. You're not afraid to show and example, then explain why it might not be the best option, but it's there if you want to use it. I tend to work through code in a very similar way, and your approach is very easy to follow and build upon previous stuff.
@Breakfast_of_Champions
@Breakfast_of_Champions 5 жыл бұрын
Robin you are elite without the bullshit! I've always wished for a normal person to explain these more intricate things about the 64 👍
@8_Bit
@8_Bit 5 жыл бұрын
Haha, maybe I need to put "1337 without the bull$#17" on my nametag at the next Vintage Computer Festival I go to :)
@xotmatrix
@xotmatrix 5 жыл бұрын
Learned a lot from this great video. Thanks Robin!
@RonnyOlufsen
@RonnyOlufsen 5 жыл бұрын
wow! this is inspiring stuff!
5 жыл бұрын
Just subbed, great video, very well explained. This brings back old but fun memories. I contributed Sprite Driver to CDU then which also included components helping you to create platform style games (the sprite driver component itself was interrupt driven). This was an exciting time when 'bedroom programming' had just started, no internet, learning through self-innovation due to minimal programming examples available. Huge contrast with today where the internet/Google has made such an immense change with places like stack exchange etc allowing you to pretty much program by cut-and-paste, in many cases without needing to know how the replies to your questions actually work.
@8_Bit
@8_Bit 5 жыл бұрын
Thanks. I didn't even know about "Commodore Disk User" until today, but I found a scan of your contribution here: archive.org/details/commodore-diskuser-19/page/n11 Looks very interesting, nice work!
5 жыл бұрын
@@8_Bit Thanks! until recently I thought I'd lost this - things like archive.org are great! The submission was rushed and needs some clarification on getting the demo running(mainly resetting basic at the right time): Run spdriver.bas Make the emulator run faster by selecting Options/5x speed (or max) - the next stages are a bit slow otherwise. Enter “Y” 6 times (down to and including “load chars”). Enter “N” three times to exit the program (i.e. don’t enter data into memory - it will overwrite the basic program itself & error out). Now, reset Basic by selecting Reset/C64-Soft from the File menu Enter: Load “spdriver.bas”,8 to load in the same program Enter “Run” and enter “N” to load programs/data Enter “Y” to enter pattern data into memory, then exit by entering “N” for the next three questions. Reset Basic again by selecting Reset/C64-Soft from the File menu. Enter: Load “plat.bas”,8 to load in the platform encoder program then enter “run” to run the program and enter the 4 demo screens into memory. Take note of the sys call (sys 32771) - the game start location. (almost there...) The sprite data will have been overwritten by now, so we need to load it in again… Reset Basic again by selecting Reset/C64-Soft from the File menu. Enter: Load “spdriver.bas”,8 and enter Run Enter Y,N,N,Y(load sprites), then enter N till you exit the program. Configure the emulator input keys - left/right/up/down and fire. Return the emulation to normal speed Run the demo by entering sys 32771. It was all programmed without an external development system, which makes things a bit cumbersome/difficult. I've only very recently looked into this again and see that we have great utilities like CBM prg Studio and D64Editor, so with these, I'm going to have a look at this again. I don't know if there's any better utilities out there.
@Loeil22
@Loeil22 5 жыл бұрын
I really like your video man... keep em coming !! Cheers
@joshhiner729
@joshhiner729 5 жыл бұрын
I love your niche videos. Very interesting/riveting. Great episode. Watched many pieces twice so it sank in. The raster interrupt portion was my favorite part. Believe thats part of how smooth scrolling works. Would be a great episode (smooth scrolling) but maybe too long. Also cant wait for an 80 column mode video. I remember you mentioning the hardware was on the way. Sure hope you get to that too. Anyways keep up the excellent videos.
@8_Bit
@8_Bit 5 жыл бұрын
Thanks Josh, I will probably do an episode about smooth scrolling. A simple example, such as a horizontal text scroller, shouldn't be overly long. And yes, I'm looking forward to working on some videos about 80-column mode. I've got 2 out of 3 of the things I need - the final piece (RGB to VGA converter) is on a boat from China I believe :)
@TechLord79
@TechLord79 Жыл бұрын
What an amazingly thorough video and also great book suggestion, many thanks! I wished someone like you would make a stable raster interrupt video some time. There is a lot of info on the net but it always eludes me, feels like stuff from electrical engineers that inhaled C64 timing diagrams and such :D
@laurent64
@laurent64 5 жыл бұрын
One neat stuff to try is to copy ~200 bytes from the SID player memory (i think it's around $1600 or $1700 in your example) to the screen $0400 in the ISR when you call $1003. That way you see the internal SID player variables change as it is playing the tune (fetching pattern data/notes, modulating instruments, etc). Quite a lot of fun ! :) you can then use this info to synchronize some visual effects to the music like flashing the screen each time a snare is played...
@BillAnt
@BillAnt Жыл бұрын
Or you could scroll the notes of the three channels as being played, like a tracker player.
@artisticgoose2609
@artisticgoose2609 2 жыл бұрын
Your coding tips are the dogs bolox, sir! Keep up the good work. love it
@tapmantwo
@tapmantwo 3 жыл бұрын
Just watched this for the second time - thank you! I still don't 100% get interupts, but your explanation helped me fix up some code.
@elmariachi5133
@elmariachi5133 5 жыл бұрын
I like the unedited end better than the rest, because when trying to learn from you, one sometimes needs a few seconds for thinking about. So one can watch the end fluently, while the rest has to be paused, resumed and repeated all the time, for gathering more of that dense information.
@esshahn
@esshahn 5 жыл бұрын
Great video Robin, cheers.
@86Carrera911
@86Carrera911 3 жыл бұрын
Another great video! I'm just getting going on programming in 6510 assembly. I've decided to use the setup you use, even though I currently don't have a Commodore computer (it's on the way!). The program that I think I want to make is one that exercises the SID to help me investigate the different sounds that it can make by varying the ADSR values. I'd like to use the keyboard to control the values and display the values along with some text to put the values into context, so I know what I'm looking at. I'd be interested in seeing some videos on creating strings in assembly, displaying them on the screen, getting input from the keyboard, and some of the basics of creating your own sounds and music with the SID. Cheers!
@jack002tuber
@jack002tuber 5 жыл бұрын
Love the video. I like interrupts too. I remember the first time I saw a sprite cloud moving and basic was all working. The top of basic is held in the pointer start of basic, or SOB for short. Once you hear SOB, you never forget. LOL
@hugovangalen
@hugovangalen 5 жыл бұрын
I like all the videos you do and in fact I prefer the so-called niche stuff over Mario! (I used to program the C64 as a kid; in fact, that's why I am now a software engineer.) Your videos are entertaining and you often manage to show a thing or two that I never knew about. Thanks for your videos and keep them coming. :)
@eugenetswong
@eugenetswong 2 жыл бұрын
I appreciate the niche stuff more. Thanks from BC, Robin.
@shieladixon
@shieladixon 4 жыл бұрын
Thanks Robin. More niche! Don't chase the views. But whatever, I really enjoy what you do. Keep doing it.
@paulkocyla1343
@paulkocyla1343 5 жыл бұрын
The niche videos are the coolest. This is where the magic happens ;)
@AlexanderKurtz
@AlexanderKurtz 5 жыл бұрын
Again a great entertaining and educationl video - thanks for that... keep going on.
@fitfogey
@fitfogey 5 жыл бұрын
This is my favorite youtube channel.
@8_Bit
@8_Bit 5 жыл бұрын
Thanks, I really appreciate it :)
@furroy
@furroy 5 жыл бұрын
i love the niche videos! in fact if you could do one on reading the joystick and keyboard at the same time from assembly that would be awesome!
@8_Bit
@8_Bit 5 жыл бұрын
That's a good idea!
@madcommodore
@madcommodore 2 жыл бұрын
I think the original SIDplay is born from the work of the Amiga demo called "100 most remembered C64 games" which came before the standalone SID player for Amiga...which I think predates all others.
@econtrerasd
@econtrerasd 4 жыл бұрын
Boy!, many years ago I did c64 programing and I had absolutely no idea on how to add music (I mean decent music) to my programs, this is one more mystery unraveled for me.. well now I need to solve another mystery which is how to create decent sid music!! ha ha!!
@Chriva
@Chriva 5 жыл бұрын
Hearing a foreigner trying to pronounce Swedish names is always fun. :)
@retrogamer33
@retrogamer33 5 жыл бұрын
Hearing a foreigner (YOU) trying to pronounce English names is always fun. :)
@8_Bit
@8_Bit 5 жыл бұрын
Was it how I said Mikael? I've got a friend from the USA named the same and that's how he says it! :)
@bennylloyd-willner9667
@bennylloyd-willner9667 5 жыл бұрын
@@8_Bit no worries. Michael, Mikael, Michel and more, lots of different pronunciation in different languages. I'm sure we in Sweden not always pronounce names "correctly" either ("correct" depends on country and accent)
@JesusisJesus
@JesusisJesus 2 жыл бұрын
Although I am borrowing SID’s username and icon, I have to admit I know very little about the SID chip and pretty much everything explained in this video, but I am slowly learning from these videos and one day I’ll understand it enough to get 2 or more SIDs cranking along.
@TaramiBedona
@TaramiBedona 5 жыл бұрын
I, too, like these "niche" videos. As a software developer with long hours already, I try to have hobbies other than sitting even more at the computer, but it's really refreshing being walked through older computer architectures like this. I'm always amazed with how much was done with so little. :) I'd love a video on hardware (is there really any other kind?) sprites on the C64!
@8_Bit
@8_Bit 5 жыл бұрын
I'm working on a video about controlling sprites by joystick right now!
@wayneandrews1738
@wayneandrews1738 11 ай бұрын
Excellent Demo!
@MiccaPhone
@MiccaPhone 3 жыл бұрын
Very inspiring video!!
@pb7379-j2k
@pb7379-j2k 4 жыл бұрын
Great episode
@shieladixon
@shieladixon 4 жыл бұрын
I discovered by accident recently that VLC for Mac plays .sid files, you can just drag and drop them onto VLC. I assumed that a .sid just contained the music data in a standard format, so it's fascinating to see that there's a lot more to it than that.
@stunthumb
@stunthumb 5 жыл бұрын
Makes me miss coding on the ST - I did some stuff on the C64 but SID stuff was a bit beyond me. Nowadays when I think, I want to play tracker style music, and trying to get a native code tracker player working nicely is a pain in the butt. I miss the reliability of IRQ interrupts, the cool tricks we could pull with them made us feel bad ass :)
@MMSZoli
@MMSZoli 3 жыл бұрын
Very nice video! My main platform is Plus/4, so as we have SID card too(with the same or different base address as the original SID) I try to utilize it in my programs too. The two system has a lot of similarities, except instead of the lot of special chips the TED IC does them all (gfx, sound, raster interrupts, keyboard and joy handling, RAM refresh, etc), it was JAck's idea, but I think he got the idea from the ZX Spectrum ULA. I am not a super programmer, but can do few things in BASIC. It will be great to play SID music in the background of my Plus/4 BASIC program. One further issue is that $1000 is the usual BASIC start address on 264 platform, so I think it could be better to relocate the SID music and rewrite the code with the new addresses to eg. $A000 from $1000. (though when we switch on GRAPHIC command, it automatically redefineds the BASIC start address to $4000, so a memory area between $1000-1800 is free on this machine for the music. I have to choose a short one :-) ) Only one question: why not play the music at the border area? there is no VIC activity, so the CPU has a little more time to run the code, means will influence less the speed of BASIC (if I well understand how it works). On the 264 platform the CPU is 2x faster on the border, I am not fully confident what is the case in C64.
@axemanracing6222
@axemanracing6222 5 жыл бұрын
Most music files that are found on old disks need a SYS command to start the sound from BASIC. SYS49152 and SYS40912 are the most common jumps.
@AureliusR
@AureliusR 4 жыл бұрын
49152 is $C000 and 40912 is... $9FD0 ? that seems like a weird place to jump to start playing SID music, isn't that in IO space? Or am I still in VIC-20 mode.
@raulrrojas
@raulrrojas 5 жыл бұрын
How did you do to learn all this? Its amazing how in deep you understand this computer, yet amazing as well seing this series of videos to realize that a computer we tend to percieve as simple and basic is in fact very complex to understand! Thank you!
@8_Bit
@8_Bit 5 жыл бұрын
It's funny, I've just been curious since even before I got my C64 (that was in 1984) and there just always seems to be something new and interesting to learn about it. I'm still learning something almost every time I make a video, especially during those C128 videos I made last month. I just keep reading old books and magazines, and reading modern articles on the web and forum posts.
@appenginenode
@appenginenode 5 жыл бұрын
Brilliant video - I used to know about raster interrupts and such, started coding again a couple of years ago, then let it by the way side, and found this, now i KNOW what I was typing in actually did!! Love it! Niche yes. What was the music right at the end? I know it! But can't remember it!
@8_Bit
@8_Bit 5 жыл бұрын
It's a cover of Video Killed The Radio Star :)
@williamsquires3070
@williamsquires3070 5 жыл бұрын
Hey, waiddaminnit! 0x0800 was the beginning of memory for AppleSoft BASIC on the Apple ][+, too... 🤣
@8_Bit
@8_Bit 5 жыл бұрын
They do seem to have some similarities in the memory map! I was surprised when I was adapting the 2-Player Karateka patches from the Apple 2 version to C64 how the code was in almost exactly the same place. Offset by 16 bytes, iirc.
@thamessinclair2010
@thamessinclair2010 5 жыл бұрын
Worth mentioning might be that the vector at $0314 is already jumped to by the KERNAL. If you do a game or demo completely in machine language and don't care about BASIC running alongside, but want to completely own the interrupt handling, you need to utilize the vector at $FFFE, which is where the CPU's program counter directly is set to once an interrupt occurs. It returns to its previous state (the location where it was interrupted from) with the RTI command, which is the actual _ReTurn from Interrupt_. This is important to know to fully understand how interrupts are handled. Usually the memory setup in the register mapped into memory at $0001 switches the HIRAM area to ROM, so $FFFE contains the ROM content pointing to the KERNAL's own early interrupt handler which only later in the process does a JMP ($0314). If you change Bit 1 of $0001 to 0, the CPU sees the RAM bank at $FFFE, where you can setup your own vector. You have to take care then to put the current CPU register's content onto stack first, before you use them for anything else, so you can restore them before returning from interrupt (just as the KERNAL routine does).
@8_Bit
@8_Bit 5 жыл бұрын
Yes, thanks, I expect I'll eventually do an episode with a deeper look at interrupts.
@saganandroid4175
@saganandroid4175 Жыл бұрын
8:32 after watching this many many times, I really think this explanation works for those who already know. You never state why SEI, and then it kind of goes astray from there. it's possible to be so into something that you forget how to explain it to a person new to it.
@8_Bit
@8_Bit Жыл бұрын
It's difficult to know how in-depth to go with these things, while still covering several examples, and keeping the flow going. This video is more of a "how to" and less of an explainer, I guess. In this case, the reason to use SEI (which stops all IRQ-level interrupts) is to guarantee an interrupt doesn't occur while we're polling $D012. Otherwise an interrupt could happen shortly before scanline $64, and finish afterwards, and we would miss one or more frames of playback, potentially causing the music to stutter or otherwise not sound right.
@saganandroid4175
@saganandroid4175 Жыл бұрын
@@8_Bit True. FWIW, Carl Sagan advocated more details rather than fewer.
@8-bit-dust
@8-bit-dust 4 жыл бұрын
On vacation having a look at the code on c64c. You mention in the video when setting up raster line for the interrupt that one might get away with not setting the most significant bit for the raster in $d011. I found if this is not done the interrupt seems entered just once and then you get a hang. Maybe in earlier c64 models you can get away with it but better do it right.
@tabsoft7045
@tabsoft7045 5 жыл бұрын
Awesome. Thanks. 2nd too!
@tomhekker
@tomhekker 5 жыл бұрын
Thanks for these vids! Really brings me back to the good old days of 6502 ASM hacking ;)
@StevenWalter
@StevenWalter 5 жыл бұрын
A video on the kernel ROM's interrupt handling would be very cool!
@MrThomashorst
@MrThomashorst 5 жыл бұрын
You could do the supreme discipline ... Paralax Softscroller with 4 switching Charsets :-) ... that was the aha moment for me in the old days
@timrichter1980
@timrichter1980 5 жыл бұрын
The Super Snapshot cartridge seems to be good. I wish my Final Cartridge was a bit better, the menu system was cool in the 80s but it is more standing in the way than helping
@8_Bit
@8_Bit 5 жыл бұрын
I've seen the Final Cartridge a few times. It seems pretty good but yeah, the menu seems to be more of a gimmick that didn't age so well. Even the Super Snapshot menus are a bit annoying now, as they have a little animation you have to wait (a second) for and somewhat strange numbering, but not too bad. I plan to do a video exploring more of the Super Snapshot features.
@timrichter1980
@timrichter1980 5 жыл бұрын
@@8_Bit My Final Cartridge also seems to dislike my C128, therefore I am looking for alternatives. Yes, a video about the Super Snapshot features would be nice! Generally I like niche videos as well as videos for a broader audience. Perhaps even a video with your friend who likes forth and can show or tell some interesting bits about forth?
@dietalkaa
@dietalkaa 3 жыл бұрын
Heh, the basic sid player was quite fun :D
@bloodmapedit
@bloodmapedit 3 жыл бұрын
"Video killed the Complex Interface Adapter star" when it comes to timing that is....
@JaySmith-cd1ln
@JaySmith-cd1ln 4 жыл бұрын
Awesome!
@steiniapproved
@steiniapproved 5 жыл бұрын
Thank you so much for this kind of videos! This video helped me a lot to understand the internals of the C64, usage of assembler, and SID playback. Before, I wondered if the SID plays back music by itself or if there is an active loop to do so; question answered. :-) But does it mean, every SID musician back then had to provide his own (or code from another musician) player for the use in a certain game? Were SID musicians masters of coding and fine tuning the player code too, in addition to create awesome music?
@8_Bit
@8_Bit 5 жыл бұрын
Yes, many of the great SID musicians also wrote and tweaked their own music players. In a way it was their secret weapon, as not only were they bringing their composing skills, but also the tricks and features they had included in their players. I think there have been articles and interviews that go fairly in-depth on this subject, but a good video about it would be fascinating.
@whisk0r
@whisk0r 5 жыл бұрын
I still write SID related code for music production :)
@breadbaker
@breadbaker 4 жыл бұрын
The game boxes are a great inspiration. Always worth to fire up the games you got laying around.
@mcflapper7591
@mcflapper7591 3 жыл бұрын
thank you!
@rev.davemoorman3883
@rev.davemoorman3883 5 жыл бұрын
I'm taking note - because I might get back into the fray! One thing - I made it a point to copy the original vector, tuck it away, and set a flag (switch). When the execute is called a second time (the switch is set), it is good to put the IRQ vector back where it is supposed to be. BTW, do these SID files work with Chamberlain's SIDPlayer?
@8_Bit
@8_Bit 5 жыл бұрын
It's definitely a good idea to clean up after one's self. Most of the C64 world ignored that, but Loadstar did an excellent job of maintaining that higher standard. These SID files don't work with Craig Chamberlain's SIDPlayer - SIDPlayer files just contain the music data, while these other .sid files contain both the player code and the music data. Kind of inefficient, but it also allowed a wide variety of special features (such as mixed waveforms, squeezing drums and bass into a single track, digital sound effects, and more) that SIDPlayer couldn't do. SIDPlayer has its own unique place in C64 history though, especially in the USA.
@rev.davemoorman3883
@rev.davemoorman3883 5 жыл бұрын
@@8_Bit Loadstar did that because it was an environment - docs, program, everything had to return to the main menu. Sometimes it didn't (demos required a hard reset), but for the most part, the user was warned.
@-Jakob-
@-Jakob- 3 жыл бұрын
Yeah, and I would go one step further, I would also call the stored IRQ vector at the end of my IRQ routine instead of calling that hardcoded $ea31.
@PhilWaller
@PhilWaller 3 жыл бұрын
Thanks again Robin, very informative. Can you recommend a native C64 app to create music for use in a game?
@8_Bit
@8_Bit 3 жыл бұрын
Here's a very informative chart comparing many different C64 music editors. Most of them are native: chordian.net/c64editors.htm I used JCH way back when but haven't touched it in 20 years so I don't know if I should recommend it :) I've heard good things about SID Wizard and NinjaTracker.
@cgraefe
@cgraefe 4 жыл бұрын
I would just like to say thanks and please do keep up this high quality content. I wish there was a way for me to give this more than just one "like".
@8_Bit
@8_Bit 4 жыл бұрын
You're welcome! I'm happy to find an audience for my nerdery :)
@cgraefe
@cgraefe 4 жыл бұрын
@@8_Bit There is a related topic that I would find very interesting, too: How would you go about composing/coding a song for the SID in the first place? Do you use a specialized tool for that or an assembler? Or a combination of both? But I don't know if that could fit into a 30 minutes video.
@8_Bit
@8_Bit 4 жыл бұрын
That's a good video idea, though I was barely competent at it 20 years ago and haven't tried since. If I tackle this subject I'll have to see if one of my friends with some skills would help. To quickly answer your question though, back in the '80s the leading game music composers had their own custom players they had written and tweaked themselves in assembly language, and would punch the instrument and note data in by hand to the assembler or even just a machine language monitor. Eventually more elaborate tools were made called "trackers" that simplified the process. I used one by "JCH".
@cgraefe
@cgraefe 4 жыл бұрын
@@8_Bit That's what I thought, thanks for the quick reply. I would love to see that video if you get the chance to make it!
@tiikoni8742
@tiikoni8742 4 жыл бұрын
Great video, but completely unrelated question: At 17:55 basic program drawing the maze makes screen scroll one row at the time when reaching bottom. Until after screen is full, it starts scrolling screen two rows each time it reaches the bottom of screen. Why is that, why it doesn't just keep going one row at the time?
@8_Bit
@8_Bit 4 жыл бұрын
Good question! This is my current understanding, I'd have to dig into the KERNAL/BASIC disassemblies further to be 100% sure. The C64 has "physical" screen lines that are 40 characters long, but it also tracks logical lines that can be either 40 or 80 characters long - two physical lines linked together using a "link table" that's stored starting at $D9 in memory. When we type RUN, the screen is full of 40 character logical lines. As the 10 PRINT program prints each line, the logical lines are extended to 80 characters each. I'm not entirely sure why this happens, it seems kind of arbitrary, but maybe there's a good reason. Anyway, each time the bottom of the screen is reached, the screen is scrolled up according to the length of the logical line at the TOP of the screen - either one or two rows. Once those 80 character logical lines reach the top of the screen, then it scrolls two rows at a time.
@josugambee3701
@josugambee3701 5 жыл бұрын
When I play with my dad's old C128, I always love to turn the sound volume all the way up. There's a lot of digital noise that gets onto the audio output, and it's interesting to hear activity from the processor. A distinct component of that noise is a 60-cycle buzz that seems to change depending on what mode the computer is in, and I've always wondered why. It must have something to do with that interrupt, and the processor running code about 60 times a second.
@8_Bit
@8_Bit 5 жыл бұрын
Do you hear the 60-cycle buzz in C64 mode? If so, try: POKE 56325,29 which will roughly double the frequency of the interrupt, and you'll see the cursor flashing faster. I'm curious if it makes an audible difference.
@josugambee3701
@josugambee3701 5 жыл бұрын
@@8_Bit I would try that but it's in the attic. :-( I can't remember if it does that in C64 mode, but I do know that when you do a FAST in C128 mode it changes from a high pitched sort of "ringing" to a more normal buzz that sounds more like power supply noise. It probably has something to to with the VIC being turned off in FAST mode.
@winfr34k
@winfr34k 5 жыл бұрын
Another great video! +1 for the more niche stuff from me. Your videos are always very enjoyable to watch. I have a small question about the whole raster interrupt thing though: You’ve now opted for the screen update speed, is that correct? (That’s why the color bars stay where they are) - Doesn’t this mean that the speed will be wrong on a PAL device? If so, is there a compatible way of doing this or is the first IRQ based Version you showed the one to use in this case?
@Mr_ToR
@Mr_ToR 5 жыл бұрын
That was one of my questions from my original post leading to this episode. There is a way to detect PAL/NTSC and compensate for the speed in the ISR. However, you can play a PAL SID on an NTSC C64 by adding some bogus cycles to slow down SID play routine triggering but not the other way around meaning you can not play a SID made for NTSC play properly on a PAL C64 with the VIC Interrupt because of the slower ISR on a PAL C64 compared to an NTSC C64.
@winfr34k
@winfr34k 5 жыл бұрын
Yep just gave it a try @desertfish74 and @Tonguç - The CIA interrupt that was shown in the video worked for this piece on PAL hardware. The CIA should have the same ~60Hz when calling the interrupt routine regardless of PAL or NTSC-serving machines, so if music was designed for that then this seems to be the trick. However, as Tonguç already mentioned, the other way around is not so simple.
@Mr_ToR
@Mr_ToR 5 жыл бұрын
@@desertfish74 then the solution would be to detect NTSC/PAL and set CIA timer accordingly. 👍
@winfr34k
@winfr34k 5 жыл бұрын
@@desertfish74 Do you have a small example on how to do that?
@8_Bit
@8_Bit 5 жыл бұрын
Lots of good answers here already, but you basically have two options. By the way, you can check $2A6 (678): 0 if you're NTSC, and 1 if PAL. You can adjust the number of cycles between CIA interrupts with $DC04/$DC05 (low/high byte). Take your clock speed of approx. 1,000,000 Hz, divide by 50 or 60 Hz depending on what speed you want, and that's the number of cycles to STA in there. So 1000000/50 = 20000 which is $4E20, so that's #$20 in $DC04 and #$4E in $DC05. If you need to use the raster interrupt to call the music player (some games/demos require it due to timing) then an okay hack is to skip the music player call every 6th frame (so JSR $1003 for 5 frames in a row, then nothing the 6th) to play 50 Hz music on NTSC, or to play 60 Hz music on PAL, JSR $1003 twice every 5th frame. A lot of games and demos simply didn't care and would play the music at the "wrong" speed across the ocean, but as game players we didn't know any better in the '80s and just got used to it.
@aqualung2000
@aqualung2000 5 жыл бұрын
Thanks for your videos. I'd love to see you go more in-depth on driving multiple systems from one or more IRQs...much as an OS would have to do. Could the C64 be rigged to run a completely event-driven "OS"? (or game?)
@8_Bit
@8_Bit 5 жыл бұрын
Yes, a more advanced interrupt system could be created; I'm pretty sure Contiki (a surprisingly advanced C64 OS that was in development 10 or 15 years ago) had a good system although it's been years since I looked into it. GEOS surely had a more elaborate system too.
@CarlosdaCunhaeSilva
@CarlosdaCunhaeSilva 2 жыл бұрын
Hi Robin, thanks for these excellent series of videos. I'm replaying them one by one and redoing these exercises on a Vice emulator together with a cross compiler. I hit a snag, I downloaded the SID file "Hey Sister" from hvsc but the start address has changed. I tried to get it to work under basic and changed the SYS addresses accordingly but it doesn't work. The memory area it's in gets overwritten. As a second step I disassembled the prg file, took out the SID data and put it back at address $1000 but it yields the same result. Any hint to what can be the cause ?
@CarlosdaCunhaeSilva
@CarlosdaCunhaeSilva 2 жыл бұрын
I found the issue since I'm using an emulator. I have to use LOAD"*",8,1 to read the PRG file containing the SID. Anything typed into a basic listing would automatically overwrite the memory locations where the sid data was stored. If you type the command NEW before entering any BASIC listing you don't have the issue
@pegu06
@pegu06 5 жыл бұрын
sidplay64 has an integrated file browser and sid player. No need to convert your sids to prgs
@8_Bit
@8_Bit 5 жыл бұрын
Does sidplay64 have an export feature like PSID64? That was the main reason I used it, as I wanted to be able to play the songs from my own programs, not just listen to the songs.
@garymetheringham4990
@garymetheringham4990 5 жыл бұрын
is this how tape loaders work that play music? do they load the sid file start it playing, then load the screen intro picture hence the scrolling load then the game part last. if so could a tape game load a lot faster if it wasn't for the loader? could you do a video on how they work?
@Gameboygenius
@Gameboygenius 5 жыл бұрын
They could be made a little faster, yes. But the assumption is of course that loading the game will take long enough that the little time lost loading the music/intro screen is worth it to keep the user entertained during the rest of the load process.
@eightsprites
@eightsprites 5 жыл бұрын
The loader often replaced the default load rutine with a faster one. Many hacks was used to get the game to load faster.
@8_Bit
@8_Bit 5 жыл бұрын
I'll have to study more tape loader code to fully understand it, but my understanding is that it's basically the opposite of what I've shown here: interrupts handle the loading from tape, as they need the higher priority to make sure they don't miss any bits, while the main program plays the music and whatever else. Pretty neat, I'll make sure it's on my list of episode ideas and hopefully I'll get to it.
@garymetheringham4990
@garymetheringham4990 5 жыл бұрын
@@eightsprites i wasn't refering to fast loaders as in how they work but more how the music and intro picture were incorporated into the loading process and if it wasted much time loading the music/picture, some game you can see the time taken to load the picture as it draws the picture as it's loading the data, ocean, activision springs to mind.
@whisk0r
@whisk0r 5 жыл бұрын
About designing content for views: in the long run, I think it better for humanity to leave general audience content production to other people if you happen to have esoteric knowledge to share / teach. This works particularly well if you also encourage folks who may not have super technical skills to go ahead and produce the stuff you've found to be popular. Now that ads don't pay out, there really isn't much motivation to water down good content with popular content. That era feels like it's day is about done. But also, just make what ever you're having fun making. After 12 years and 750 videos, I never made things just for views. I never got a million subs. But, I did learn a lot, shared a lot, met 1000s of amazingly awesome people, and landed tons of great opportunities I would have never thought possible. Thanks for doing your thing, I absolutely learned stuff watching this one :) @whixr
@8_Bit
@8_Bit 5 жыл бұрын
750 videos, amazing! Thanks for your insights. I definitely agree with your philosophy. Even that Super Mario Bros. video I mentioned was about the brand-new C64 port of the game, and I was able to bring my own perspective on what made this port so amazing, and show it running on some rare hardware that most people don't have access to. And I was genuinely interested in it all. It's just weird how that video was viewed so many more times than videos that I put 10x the work into. But that's the nature of KZfaq.
@whisk0r
@whisk0r 5 жыл бұрын
@@8_Bit KZfaq is funny. I posted a 4 minute random video of fixing a stuck lens on an old cheap camera and it got 40K views, and it still gets thank you comments years later, hah. I gave up guessing what will have legs after that :)
@0fend0
@0fend0 5 жыл бұрын
Thoroughly enjoyed this, Robin. In 1996, were you Shroom or Macbeth? 😊
@8_Bit
@8_Bit 5 жыл бұрын
Darren = Shroom and Robin = Macbeth :)
C64 Joystick-Controlled Sprites in Assembly and BASIC
33:46
8-Bit Show And Tell
Рет қаралды 42 М.
C128 BASIC Hack: Playing Digital Samples
17:38
8-Bit Show And Tell
Рет қаралды 26 М.
Slow motion boy #shorts by Tsuriki Show
00:14
Tsuriki Show
Рет қаралды 10 МЛН
Викторина от МАМЫ 🆘 | WICSUR #shorts
00:58
Бискас
Рет қаралды 5 МЛН
Amazing weight loss transformation !! 😱😱
00:24
Tibo InShape
Рет қаралды 67 МЛН
ПОМОГЛА НАЗЫВАЕТСЯ😂
00:20
Chapitosiki
Рет қаралды 3,5 МЛН
8-Bit Book Club: Mapping the Commodore 64
45:34
8-Bit Show And Tell
Рет қаралды 21 М.
Fixing a Bug in Rodnay Zaks' "Programming the 6502"
43:38
8-Bit Show And Tell
Рет қаралды 22 М.
Adding Hex Support To C64 BASIC
28:29
8-Bit Show And Tell
Рет қаралды 21 М.
Optimizing With Integers in Commodore 64 BASIC?
22:10
8-Bit Show And Tell
Рет қаралды 22 М.
Book Club: Commodore 64 Programmer's Reference Guide
40:16
8-Bit Show And Tell
Рет қаралды 18 М.
Machine Language 10 PRINT Size-Optimized for Commodore 64
27:41
8-Bit Show And Tell
Рет қаралды 31 М.
10 Rarely Used Commodore 64 BASIC Features
31:20
8-Bit Show And Tell
Рет қаралды 74 М.
JRPG-Style Menu in C64 BASIC with LOADSTAR's Toolbox 181
48:19
8-Bit Show And Tell
Рет қаралды 29 М.
Speed Cart 64: Slow Down Your Commodore 64, Sometimes
27:25
8-Bit Show And Tell
Рет қаралды 19 М.
iPhone 15 Pro в реальной жизни
24:07
HUDAKOV
Рет қаралды 505 М.
Ba Travel Smart Phone Charger
0:42
Tech Official
Рет қаралды 1,2 МЛН
Какой ноутбук взять для учёбы? #msi #rtx4090 #laptop #юмор #игровой #apple #shorts
0:18
Это - iPhone 16!
16:29
Rozetked
Рет қаралды 450 М.
Tag him😳💕 #miniphone #iphone #samsung #smartphone #fy
0:11
Pockify™
Рет қаралды 4,8 МЛН