The Commodore 64's cassette port pins (P0, P1, P2) are actually part of the 6510 CPU's 8-bit GPIO port, where bits 0-2 control memory banking through the PLA and bits 3-5 drive the cassette port; by removing the cassette circuitry and modifying the kernel to remove tape-related code, these pins can be repurposed as general-purpose I/O for custom hardware modifications like memory expansion or additional functionality.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Death to the C64 cassette port... And giving life to a new kernal. CPU direct GPIO! Wozmon too!Added:
Hello again, YouTube. It's been a while.
I've been a bit tied up, but getting back to the ATX 64 project a little bit.
And we're going to title this video something. I think we're going to call it death to the cassette. That might trigger some people. I know people have a lot of love for the cassette, but I honestly haven't used it since like 1985 when I got off the Vic 20 and got onto a 64. So, all that to say, there's some cool stuff that that lets us do, not just omitting crap from the board that I'm never going to use, but the the cassette review for probably a lot of you, but the cassette is driven by these three pins directly off of the CPU. And P 012, 3, 4, and 5 is basically a a GPIO parallel port, kind of like a a 6522 or 6526 would have. It's behaves a little differently, but that's basically what it is. And the first three pins go to the PLA and basically work as a poor man's MMU. That's how you bank in the ROM. So, you can, you know, turn off basic and use the memory that's actually at that space cuz you only have 64K of address space. And if you have 64K of RAM, but then you have ROMs and IO and blah, you know, you got to bank that stuff in and out. So, that's what these three pins do. Well, these three pins are used to control the cassette port, which in my opinion is is basically useless these days. So, what I want to do is do something cooler with these pins in the ATX 64. You know, you could just break them out as GPIO and do something very basic with it, but you could probably do something really powerful with it if you want to bank in more stuff. I mean, basically expanding, you know, three extra bits onto these memory IO lines or or you know, memory banking lines, I think is probably the better way to call them. I think we can do something really fun with it. So, first things first, we have to free them up so we can do something. There's a software component and a hardware component. So, we'll we'll talk about the software later. I've I've done a bunch of work there, but let's start with the hardware. These three pins go to this whole ball of stuff here. And we'll zoom in a little more, but it's a few transistors. There's a diode there, a couple of resistors, some ferite beads. If we just pull all this junk out of the board and more or less replace it with just some pull-ups. I thought the processor had internal pull-ups on these. Maybe I'm wrong on that, but uh Commodore did put external pull-ups.
These 3.3Ks, right? There's one there.
Here's the ones for going to the PLA.
They're also 3.3Ks. They're all coming out of the little resistor packs that are on the board. So, really, if we abandon this junk and make sure we can still have pull-ups on these guys somewhere, we got some cool stuff to to work with. So, let's get started on that. Let's uh we'll we'll go to the bench. We'll get some visual aids going. and and I actually did some of these mods on a board already, but I kind of recorded it. It turned into a [ __ ] show to be honest.
So, we'll we'll just do a quicky little recap and move on from there. So, anyway, let's uh let's move out to the workbench. See what we can figure out until I guess.
Um, all right. So, this is actually a 425 board here. Uh yeah, that guy which for most of the cassette circuit is the same thing. There's a couple of fite beads that were omitted, but the circuit is pretty much the same except for that. So here's one, two, thought there was a third transistor somewhere.
No, maybe not. Maybe it's just that diode. But at any rate, this is all the stuff that takes the lines from the CPU right here on those pins down there, goes through all this junk, and then comes out the cassette port. So, this is all the junk we can get rid of, and it's really as simple as that. So, if you really wanted to do this mod on a machine, it's not terribly intrusive.
You know, you have to remove the components, but they're all through hole. They can all be replaced easily.
You don't have to cut anything to do it.
you can easily remove these and put them back in if you really wanted to. I do not recommend doing this to a real 64 board. Um, you know, let's try to preserve or something. So, um, I just wanted to show what it looks like in its unaltered state. So, here, let's get that out of the way and let's alter our state some.
This is, let's zoom out a bit. a very brutally hacked up 25407 clone board. All right, this is a Melius, the one that has been on the channel more than once before that I do all my evil experimentation on and also has a JCPU in it. So, I'm not blowing up a real 6510 if something goes really bad with all of this. But this board a long time ago, I abandoned all that crap in there. I have this gallon there now that's doing my uh EPROM switching and whatever else. So, you can ignore all that [ __ ] All that matters is that we pulled all the cassette stuff out of there. And I found a few VAS.
Let's see if we can focus and move junk out of the way. But these two here I put a pin header in.
Can we get that out of there? There we go. So, yeah, those there's two VAS there. They probably exist on a real 407 as well. And that's just where we're tapping the pins cuz I can't get at the other footprints for this because it's under here. And then the third one was here. So this is uh you know P 01 and two go over the PLA. And then this would be 3, four, and five. I forget what order they're in.
We'll figure that out later. But all we've done is just exposed these pins.
It's basically just like talking to the pin on the side of the CPU itself, right? There's nothing else on the circuit at this point. And then on the bottom of this thing, we can flip this over without breaking anything too badly on the CPU socket. I went and put some pull-up resistors over here. So, this is just coming off the 5V rail. It's 5 volt over here. And that's our three pins coming out of the chip. And that's it.
Right. So, you just pull out some stuff, pop in three resistors and a couple of pin headers, and you've got access to three more IO lines coming right out of the damn CPU. So, the fun part came with kernel mods, and I spent a good few months on that. Uh, well, probably a good month, but it was a few months ago now, and I can go back and show you around some of that stuff. So, uh, let's go back to the computer. All right. All right. Now, it's time to talk software and we have to start with the kernel.
So, this wonderful person here, Miss 64, Michael Steel, thank you so much for putting this out there. This is complete source code for the the ROMs in the C64 kernel and basic anyway. Um, we don't care so much about the character generator here. So, if we go into the kernel there, there's a lot of stuff happening and this is I'm well rehearsed this time. I've been through all of this and we'll get to some of the other mods I had to do to the kernel later, but we got to start at the beginning and that's the initialization.
So, in the init this is, you know, what it's going to do as soon as it it jumps, you know, the reset register and starts executing, you know, kernel code. So, it does all this stuff. It allocates memory and uh sets up CAS here. And here's the important one. So the 6510 lines it's talking about here is that that that six pin GPIO port that's on the CPU. And yes, it's six pin, but it really is an 8bit register. And I think there's technically an 8bit port in there, but two of the pins aren't exposed. You know, there's only six pins that are actually brought to the outside of the CPU. So these first two bits we never really care about. They can be zeros or ones. It's not going to affect anything.
It's the last six we care about. And oh crap, what' I do?
I zigged when I should have zagged. Here we go. So, we can see here it's um motor on, high RAM, low RAM. Right? So, this is going to be our motor on line right there. And then, you know, bits zero, one, and two.
Remember, we're little Indians, so we count backwards, right? So 0, one, and two. This is pulling P 0, P1, and P2 pins on the chip high, and that's sending signals out to the PLA. These next three are how it's setting up the the uh three pins that go to the cassette port. So there's, you know, R6510 and D6510 that it refers it to in the kernel. One of them is the actual pin. The other one's the actual, you know, the second one here is the direction register. So this is saying is it an input or an output? And this is saying, you know, what's on there? Is it high or low? So these two obviously have to change, you know, at least these three bits in the middle of here. And we have to make sure we don't screw at the behavior of these three or the computer stops working. You know, the the uh banking for the ROMs in and out. If we break that, the whole computer's going to crash if you, you know, turn that stuff on and off at the wrong time. So that's the one place you have to be very careful with this. If you miscode any of the calls we're going to be doing to this register, the machine's just going to crash. It's going to hang on you. So all that to say, this stuff has to be edited.
Um, we'll get into the edits in a moment. But I did go down this road and I just edited these two and I booted up in an emulator and it kind of worked but not right. Like one or two of them worked correctly. I think one of them worked correctly and the other ones were like you could poke a register or you could poke a value into that register and it would work for a cycle of the machine or a couple of cycles I guess and then when code ran from you know say tape file or tape control these other parts of the kernel it would reset that register back because there's calls to that register all over the kernel. So, at the end of the day, I had to yank all of tape out of the kernel, and that was a gigantic rabbit hole I went down because I went and did all kinds of crazy stuff. So, that's kind of the the pretext here. Let me go find my copy of the kernel that I did terrible things to and we'll uh we'll continue on from there.
Okay, let's let's talk about the layout of the kernel first. It's almost like the the table of contents here. So on the right hand side is the original kernel from Michael Steel's repo. And on the left side is whatever the hell I did. And you can see there's a lot more going on in there now. Right? So in the original kernel you had everything broke out into all these very nice clean sections. um you know serial is like IEC serial RS232 is the serial port you know the RS232 implementation that's on the on the user port. Um it's everything is is laid out in a particular way where it knows where to compile at what memory register. So that way when a piece of software makes a kernel call it knows exactly where to call it at. Um there is a jump table but at the end of the day the entire C64 kernel is like a modern-day API. You know any of the software that was made all the decades was making calls into you know specific you know memory locations where the kernel live to execute a bit of code. It didn't just use the jump table. People wrote code that jumped directly to all kinds of parts of the kernel. So if you just go and rip all the junk out of tape and recompile the kernel, everything after it is going to get squished up and now it's at a different address location. So when I went and ripped everything out, I had to go about the task of putting everything back in the right place. So, you know, within um channel, there was a lot of stuff inside of channel, I do believe, that uh had a lot of the the calls for disk access, right, for talking to a 1541 drive. So, I had to go and pull each of those functions out into its own file.
So all the functions you know like you know get in you know bass in uh BS out uh open and close you know like when you're open and closing you know devices not just the 1541 that's typically what people have plugged in. I had to go and remap all of these things into its own you know so it would compile into the correct space and I really went down the rabbit hole.
I went and ripped out all of RS232. You can see it's here in the original, but it's gone now, right? So, all RS232 code is gone. All the tape code is gone. And then I did take some uh artistic liberties, if you want to call it that, with uh some of the uh uh error handling and stuff because I don't know that there's a whole lot of people. Oh, wait.
No, error was not one of them. Error is still at F6ED. Um Oh, is messages. Um, I don't know that any software out there was directly calling uh a file not found message that was typically called by something else in the kernel. When you recompile it, you know, the kernel will know where messages wound up, but you know, third party software wouldn't. So, I don't think third party software is going to care too much about that. Um, but the the jump table absolutely had to be in the same place. You know, the the reset vectors had to be in the exact same place. a lot of the stuff did. So, after I ripped everything out, I had to go and remap all this stuff into the right place and I learned a whole lot.
But now we have a kernel with no tape support, no RS232 support, and a bunch of free space in it. So, if you've, you know, actually looked at this and been keen eyed, I put WASmon directly into the kernel. So, now we have a a, you know, a monitor program that we can go and just, you know, poke around at RAM with. Um, you know, a lot like the C128 had, the C16 had. I think the PET even had one built in. Most models of PET had it. 64 never had a built-in monitor. So, um, I ported somebody's port of WMON.
Somebody did port WMON to the C64. I made additional mods to it to just whack it right into the kernel at that location. So after doing all this, I now have a brand new kernel that should be for the the ATX64 that has a bunch of free space in it and a few extra features or two. So we can add more to it as well. So let's I guess uh we can take a look at the hex dump of this. You can see the big chunks of free space and we can get this thing burnt to a ROM and running on a box.
All right, somebody may find this bit interesting, but here is the resulting kernel binary that gets built out of my newly modified pile of whatever here.
And here it's [snorts] bunch of machine code, right? But let's get to the the fun stuff, the free space, right? So I use different fill values um like D2, C2, F2, right? These are illegal op codes. And the reason I did that instead of just filling it with zeros or fs or whatever is when I was running this in the emulator, if one of these op codes was executed, you know, errantly because jump tables were wrong or whatever, the machine would just crash immediately. These op codes do not work. You know, it's not like one of the, you know, illegal op codes that, you know, the, you know, demo scene uses to do cool stuff or whatever. These are illegal op codes that actually don't work. they they crash the the processor immediately. So if one of these illegal op codes got executed, it would crash the emulator immediately and tell me what memory address it crashed at. And that way I could go and trace things down and figure out what should have been there and and fix things. So at any rate, um here's, you know, a bunch of D2s that is essentially free space now that we could reuse. This is such a small block. I don't really care so much about it. these AAS, that's the fill that's used in the kernel patch here.
So, I'm leaving that for additional patches. And then everything else I I reshuffled in here, trying to get the most contiguous free space as I could.
So, there's a little more fill here, some more D2s and whatever. Um, but if we go down, this is all good code. Good code. Good code. Um, I forget where these zeros come from, but it's fill from one of these guys.
Um, and then here, here's a huge block of free space. I believe this is where I parked Wmon, right? So, WMON starts at EEB8, right? So, yeah. Where's is that what that says? I can't read. I need my glasses. Yeah. Won starts at E.
So this would be zero. You know, this is the offset when it's actually running where it's mapped in the in the C64. So we're looking for zero EB8.
So 0 EB8.
So WMON starts in here and runs and runs and runs. This is the end of WMON. And then this is all additional space that we could use to expand WMON into. Now, if I changed the size here and then put in another file starting at what FB nine or whatever this is. I don't like this hex editor. It doesn't have anything across the top. But, um, at any rate, I I could just turn this into another block of space that we can compile something completely independent into. But, I'm just leaving it attached to WMON for now. Um, that I I want to add stuff to Wmon. maybe load and save or something we could use this space for. And then here's some more fill space D2 which is probably after uh I don't know and get in orbass in or something like that. Uh there's a little more free space. Here's a little more free space. So I I can I can crunch these out into additional files if I want to. Um I'm not going there yet. If I really want this space for something, I will. But it's such a small amount of space, I don't know what I'm going to do with it yet, so I'm not bothering. Uh, but here's another big chunk of free space. Um, here's another chunk of free space. Here's another chunk of free space. So, we can go and and start adding things either to the tail of each of these sections or like I said, whack it into its own section. And then this is probably the one I called crap.
Yeah. So this will be 17 2C in here, right? Yeah. So this is this big section called crap. There's absolutely nothing in there right now.
This is, you know, just a a, you know, a blank file I have in there. And yeah, we have tons and tons and tons of space here. And then after crap, we have, you know, the important stuff again. ANIT, NMI, messages, all the stuff needs to stay there. So we have lots of free space in here to add things to this kernel now. So, goodbye tape, goodbye RS232, and hello new bastardized code that I will put in here. And I'm not a programmer. I don't know what the hell I'm doing. So, when I start putting stuff in here, it's going to be dangerous. But anyway, I thought I'd just take a few minutes to kind of show you through this kernel. So, we can now cook this thing onto a chip. I did test this in an emulator. It worked. So, I can now cook it onto the ROM for that ugly hacked up Melius board. And we'll see what it does.
All right, let's take our kernel for a test drive on real hardware here. So, if we turn it on, does it boot? All right, that's a start. If we shift run, we get into Wmon. So I think Wmon you could do like an address or whatever and yeah we can look at stuff. So if we stop restore it bails out. Okay so the default value is 63. I have a cheat sheet up on the screen and that's all on. So if we poke seven into register number one, you know, the the data register for that that parallel port, they should all go off. So we poke one, seven, and they all go off. It works. So if we poke one, 15, we should get one light and then 23 gets the next one and 39 gets the next one. So I put one comma 23 or let's go in order so I don't get confused. Yeah, we get one light. So one comma 23 should turn that one off and go to the next. Oh, if I know how to type.
Yep.
I didn't wire them in order, but whatever. And then poke one, 39.
Sweet. And then I'm sure they're all going to work at this point, but one comma 31 gets us two lights.
One comma 55 should get a different combination.
One comma 47.
I'm sure it's going to work. But yeah, there we go. All right. So, we have working pins we could do stuff with and a kernel that'll let us do it. So, what are we going to do with it? I don't even know at this point. One thought I had, it'd be a real easy proof of concept kind of thing to wire up an additional 64K of RAM and, you know, bank it out completely. You know, toggle back and forth like super poor man's MMU style.
Um, but with a little bit of logic in the middle, we could probably do something a little more creative. Maybe, you know, bank in certain bits here and there, like what was it? C thousand's a common place to play around with, right?
Maybe we bank a little block in and out of somewhere, you know, with a few logic chips or even a a gal or a little CLD or something. We could do a MMUish kind of thing. Or maybe we get really stupid and steal an MMU out of a 128 and wire some of that in here. I don't know. So, let me know what you think. What should we wire up to all of this? And uh yeah, we'll do something fun with it. So anyway, I think that's enough rambling for one video. I'm pretty happy I was able to compile a kernel from source with all my hacky mods and it works. I played with it in the emulator a bunch, loaded different software and stuff like that, and I seem to fix all the crashiness with, you know, disios being at the right offsets and all that other junk. So, I think we're good there. Um, I think I'll put this on GitHub, maybe.
Um, maybe other people want to take a peek at this and play around with it or, you know, just use it as a base for your own custom kernel. That could be cool.
So, uh, yeah, maybe I'll do that and and, uh, pop a link in the comments or something or in the description. So, anyway, all right, enough rambling.
Peace out. We'll see you next time.
Related Videos
U.S. Military Just Flexed The Most Dangerous Aircraft Ever Built The F-47
MaxAfterburnerusa
11K views•2026-05-29
Heating Staying On On The Hottest Day Of The Year
PlumbLikeTom
507 views•2026-05-29
발전 효율을 높이는 태양광 추적 시스템의 기술적 원리 #공학 #공정 #태양광 #알고리즘 #재생에너지
찐현장기술
2K views•2026-05-29
Peterborough to Newark Northgate Driver's Eye View aboard an InterCity 225 - East Coast Main Line
TrainsTrainsTrains
822 views•2026-05-31
AI turbine design: hypersonic cooling leap #shorts #ai #hypersonic
bobbby_rn
671 views•2026-05-31
직관 및 곡관 배관 결합 고정 작업 #worker #process #fabrication #pipework #clamp
월드촌촌
2K views•2026-05-30
How Far Can A Tomahawk Missile Actually Travel?
WarCurious
13K views•2026-05-28
Wire To Wire Connection Trick | Strong And Secure Electrical Joint #shortvideo #wireworks
ElectricianTips-b1h
5K views•2026-06-02











