Making SNES ROMS with C# and Matthew Shapiro's DotnetSnes
Read full transcript 25 segments
-
Hi, I'm Scott Hansselman. This is Hi, I'm Scott Hansselman. This is another episode of Hansel Minutes. Today another episode of Hansel Minutes. Today another episode of Hansel Minutes. Today I'm chatting with Matthew Shapiro. In I'm chatting with Matthew Shapiro. In I'm chatting with Matthew Shapiro. In his day job, he's a staff video his day job, he's a staff video his day job, he's a staff video architect at Game Changer, but at night architect at Game Changer, but at night architect at Game Changer, but at night he's making insane things on GitHub, he's making insane things on GitHub, he's making insane things on GitHub, which is why I'm having him here today. which is why I'm having him here today. which is why I'm having him here today. How are you, sir? I am great. Thanks for How are you, sir? I am great. Thanks for How are you, sir? I am great. Thanks for hanging out. So, you had a great week hanging out. So, you had a great week hanging out. So, you had a great week last week, didn't you? I've Yeah. The last week, didn't you? I've Yeah. The last week, didn't you? I've Yeah. The the amount of excitement I've seen from the amount of excitement I've seen from the amount of excitement I've seen from this from that Reddit post that I posted this from that Reddit post that I posted this from that Reddit post that I posted of uh the Mario platform has been of uh the Mario platform has been of uh the Mario platform has been incredible. Yeah. So, you went and you incredible. Yeah. So, you went and you incredible. Yeah. So, you went and you threw out something on Reddit and you threw out something on Reddit and you threw out something on Reddit and you say, "Hey everybody, you know, in my in say, "Hey everybody, you know, in my in say, "Hey everybody, you know, in my in my copious spare time while working and my copious spare time while working and my copious spare time while working and raising kids, I was messing around and I raising kids, I was messing around and I raising kids, I was messing around and I put together a library that pulled some put together a library that pulled some put together a library that pulled some other libraries together and you have a other libraries together and you have a other libraries together and you have a thing that lets you use C to make ROMs thing that lets you use C to make ROMs thing that lets you use C to make ROMs for the Super Nintendo." And then you for the Super Nintendo." And then you for the Super Nintendo." And then you also run HackerNoose for a time uh at also run HackerNoose for a time uh at also run HackerNoose for a time uh at the top spot. I Yeah, for for the for a the top spot. I Yeah, for for the for a the top spot. I Yeah, for for the for a day I was pretty on the front page, day I was pretty on the front page, day I was pretty on the front page, which was incredible. I didn't even post which was incredible. I didn't even post which was incredible. I didn't even post it there. somebody else did and I found it there. somebody else did and I found it there. somebody else did and I found it by accident. Yeah. So now suddenly uh it by accident. Yeah. So now suddenly uh it by accident. Yeah. So now suddenly uh this is one of those things that happens this is one of those things that happens this is one of those things that happens when you uh kind of go uh tiny tiny when you uh kind of go uh tiny tiny when you uh kind of go uh tiny tiny viral is that some project you did in viral is that some project you did in viral is that some project you did in your spare time is now being watched and your spare time is now being watched and your spare time is now being watched and people want more and now you have to people want more and now you have to people want more and now you have to quit your job and work full-time on quit your job and work full-time on quit your job and work full-time on Super Nintendo ROMs. Right. I would love Super Nintendo ROMs. Right. I would love Super Nintendo ROMs. Right. I would love that. But well, it's it's funny because that. But well, it's it's funny because that. But well, it's it's funny because like I do a lot of random stuff like I do a lot of random stuff like I do a lot of random stuff throughout the years and every it's throughout the years and every it's throughout the years and every it's always I have a small group of engineers always I have a small group of engineers always I have a small group of engineers that are friends and I always get that are friends and I always get that are friends and I always get comments of, "Huh, that's neat." And comments of, "Huh, that's neat." And comments of, "Huh, that's neat." And sometimes I'll post something and I'll
-
sometimes I'll post something and I'll sometimes I'll post something and I'll get some, "Huh, that's neat." And that's get some, "Huh, that's neat." And that's get some, "Huh, that's neat." And that's about it. And like this is the first about it. And like this is the first about it. And like this is the first time I actually got somebody. So I time I actually got somebody. So I time I actually got somebody. So I actually got one person who's so excited actually got one person who's so excited actually got one person who's so excited that he started contributing to the to that he started contributing to the to that he started contributing to the to the main project and I was like, "Whoa, the main project and I was like, "Whoa, the main project and I was like, "Whoa, this is a weird feeling." That's cool. this is a weird feeling." That's cool. this is a weird feeling." That's cool. So you've got a contributor now, which So you've got a contributor now, which So you've got a contributor now, which is great. This is how open source is great. This is how open source is great. This is how open source starts, right? You you do things, you starts, right? You you do things, you starts, right? You you do things, you throw spaghetti against the wall, and throw spaghetti against the wall, and throw spaghetti against the wall, and then one day it sticks, and then you then one day it sticks, and then you then one day it sticks, and then you have a little community of people who have a little community of people who have a little community of people who are excited about the thing you're are excited about the thing you're are excited about the thing you're excited about. And then you have freak excited about. And then you have freak excited about. And then you have freak out about people looking at code that out about people looking at code that out about people looking at code that you wrote in your hobby time. That's you wrote in your hobby time. That's you wrote in your hobby time. That's that that is the that is the real the that that is the that is the real the that that is the that is the real the real crisis. So let me help me real crisis. So let me help me real crisis. So let me help me understand though how this started understand though how this started understand though how this started because, you know, we know that there's because, you know, we know that there's because, you know, we know that there's a bunch of enthusiasts even now in 2025 a bunch of enthusiasts even now in 2025 a bunch of enthusiasts even now in 2025 excited about Nintendo and Super excited about Nintendo and Super excited about Nintendo and Super Nintendo. We've got tons of Nintendo. We've got tons of Nintendo. We've got tons of documentation like it has never been a documentation like it has never been a documentation like it has never been a better time I would say to be doing better time I would say to be doing better time I would say to be doing retro gaming and retro games than it is retro gaming and retro games than it is retro gaming and retro games than it is now. Right. Right. So it didn't this now. Right. Right. So it didn't this now. Right. Right. So it didn't this actually didn't start for specifically actually didn't start for specifically actually didn't start for specifically with the goal of Super Nintendo in mind with the goal of Super Nintendo in mind with the goal of Super Nintendo in mind or any console gaming at all. The very or any console gaming at all. The very or any console gaming at all. The very short story is that one of my good short story is that one of my good short story is that one of my good friends Justin Johnson at Mojang was friends Justin Johnson at Mojang was friends Justin Johnson at Mojang was uh knew that I was going on parental uh knew that I was going on parental uh knew that I was going on parental leave because my daughter was about to leave because my daughter was about to leave because my daughter was about to be born and he's like, "Hey, I have this be born and he's like, "Hey, I have this be born and he's like, "Hey, I have this I have a I have a a meadow, a Wilderness I have a I have a a meadow, a Wilderness I have a I have a a meadow, a Wilderness Labs meadow. I have a little game engine Labs meadow. I have a little game engine Labs meadow. I have a little game engine retro game engine on it and I've and I retro game engine on it and I've and I retro game engine on it and I've and I need help optimizing it." And he's like, need help optimizing it." And he's like, need help optimizing it." And he's like, "You got a lot of free time coming up "You got a lot of free time coming up "You got a lot of free time coming up because of your printer leave. How about because of your printer leave. How about because of your printer leave. How about we uh what if you do it. And so he got we uh what if you do it. And so he got we uh what if you do it. And so he got me a bunch of the equipment and I just
-
me a bunch of the equipment and I just me a bunch of the equipment and I just became enthralled with uh mostly became enthralled with uh mostly became enthralled with uh mostly embedded development. And so I did a lot embedded development. And so I did a lot embedded development. And so I did a lot of optimizations and um I got that to a of optimizations and um I got that to a of optimizations and um I got that to a good place and then I started working on good place and then I started working on good place and then I started working on I got it as far as I could go where the I got it as far as I could go where the I got it as far as I could go where the well I IO constraints was what was well I IO constraints was what was well I IO constraints was what was bottlenecking me. And so a long story bottlenecking me. And so a long story bottlenecking me. And so a long story short is I wrote a GPU, a small little short is I wrote a GPU, a small little short is I wrote a GPU, a small little GPU for microprocessors that runs on a GPU for microprocessors that runs on a GPU for microprocessors that runs on a uh uh uh ESP32, but that's all CC code. And I ESP32, but that's all CC code. And I ESP32, but that's all CC code. And I came into a fork of the load of like I came into a fork of the load of like I came into a fork of the load of like I want to be able to write more C#. I can want to be able to write more C#. I can want to be able to write more C#. I can do any I can do most languages, but I do any I can do most languages, but I do any I can do most languages, but I love C. And so I started theory crafting love C. And so I started theory crafting love C. And so I started theory crafting on well, what actually would it take to on well, what actually would it take to on well, what actually would it take to run C on other devices? run C on other devices? run C on other devices? And it's not feasible for the .NET team And it's not feasible for the .NET team And it's not feasible for the .NET team to create AOT for all the different to create AOT for all the different to create AOT for all the different platforms that nobody's going to use. platforms that nobody's going to use. platforms that nobody's going to use. Um, it's also not feasible for me in my Um, it's also not feasible for me in my Um, it's also not feasible for me in my free time to learn assembly for every free time to learn assembly for every free time to learn assembly for every single platform and start doing it single platform and start doing it single platform and start doing it myself. And so I started realizing I myself. And so I started realizing I myself. And so I started realizing I have you ever heard of a programming have you ever heard of a programming have you ever heard of a programming language called Nim? Nim. Yeah, sure.
-
language called Nim? Nim. Yeah, sure. language called Nim? Nim. Yeah, sure. Yeah. Well, one I thought about it and I Yeah. Well, one I thought about it and I Yeah. Well, one I thought about it and I played with it before and one of the played with it before and one of the played with it before and one of the things that it does is it compile it things that it does is it compile it things that it does is it compile it doesn't compile down to LLVM. it doesn't compile down to LLVM. it doesn't compile down to LLVM. it compiles down to uh C and so that allows compiles down to uh C and so that allows compiles down to uh C and so that allows it to run anywhere. And so as long as it to run anywhere. And so as long as it to run anywhere. And so as long as you have a as long as you have a C you have a as long as you have a C you have a as long as you have a C compiler then you can run your code any compiler then you can run your code any compiler then you can run your code any run your NIM code run your NIM code run your NIM code anyways. And then I started thinking anyways. And then I started thinking anyways. And then I started thinking well what if you actually take MSIL and well what if you actually take MSIL and well what if you actually take MSIL and start start start um and and actually translate that to C. um and and actually translate that to C. um and and actually translate that to C. And I started playing around with the And I started playing around with the And I started playing around with the idea and it started working and so it idea and it started working and so it idea and it started working and so it just took off. just took off. just took off. one of the uh so I started so I started one of the uh so I started so I started one of the uh so I started so I started off without an actual goal in mind of off without an actual goal in mind of off without an actual goal in mind of like let me see if I can do this just as like let me see if I can do this just as like let me see if I can do this just as like a um just an idea in my head just like a um just an idea in my head just like a um just an idea in my head just as a challenge and then the whole crowd as a challenge and then the whole crowd as a challenge and then the whole crowd strike issue thing appear the whole strike issue thing appear the whole strike issue thing appear the whole crowd strike issue appeared well um it crowd strike issue appeared well um it crowd strike issue appeared well um it was crashing all the machines and one of was crashing all the machines and one of was crashing all the machines and one of the reasons that that doesn't the reasons that that doesn't the reasons that that doesn't necessarily happen as badly on the Linux necessarily happen as badly on the Linux necessarily happen as badly on the Linux side and soon to be on the Windows side side and soon to be on the Windows side side and soon to be on the Windows side is because of eBPF. Have you heard of is because of eBPF. Have you heard of is because of eBPF. Have you heard of that? Okay. This is uh keeping keeping that? Okay. This is uh keeping keeping that? Okay. This is uh keeping keeping the kernel separated, right? Yeah. So, the kernel separated, right? Yeah. So, the kernel separated, right? Yeah. So, it allows you to So, eBPF works it allows you to So, eBPF works it allows you to So, eBPF works by you create you compile special by you create you compile special by you create you compile special programs down into a special bite code programs down into a special bite code programs down into a special bite code that the konel can verify that it can't that the konel can verify that it can't that the konel can verify that it can't crash, it can't allocate memory, it it crash, it can't allocate memory, it it crash, it can't allocate memory, it it can't stall, and has various checks and
-
can't stall, and has various checks and can't stall, and has various checks and balances in it. Right? This is a balances in it. Right? This is a balances in it. Right? This is a basically it's called the extended basically it's called the extended basically it's called the extended Berkeley packet filter and it's a way of Berkeley packet filter and it's a way of Berkeley packet filter and it's a way of running sandboxed programs without running sandboxed programs without running sandboxed programs without modifying the kernel source code. It's modifying the kernel source code. It's modifying the kernel source code. It's making little cages for your code to run making little cages for your code to run making little cages for your code to run inside the kernel. Right. Exactly. And inside the kernel. Right. Exactly. And inside the kernel. Right. Exactly. And that was a perfect and it's it's great that was a perfect and it's it's great that was a perfect and it's it's great because you can add a lot of because you can add a lot of because you can add a lot of observability into Linux kernels without observability into Linux kernels without observability into Linux kernels without actually actually actually um without risking nuking anything or um without risking nuking anything or um without risking nuking anything or doing anything poorly. And then you have doing anything poorly. And then you have doing anything poorly. And then you have a user space component that talks back a user space component that talks back a user space component that talks back and forth of it and does the user space and forth of it and does the user space and forth of it and does the user space act. It's a clean separation of act. It's a clean separation of act. It's a clean separation of concerns. Exactly. And that's why concerns. Exactly. And that's why concerns. Exactly. And that's why Windows I think is moving towards that Windows I think is moving towards that Windows I think is moving towards that model now especially after the cloud model now especially after the cloud model now especially after the cloud strike. And I was just thinking eB has strike. And I was just thinking eB has strike. And I was just thinking eB has no at this point no at this point no at this point eBPF applications do not have eBPF applications do not have eBPF applications do not have um memory allocation. So it's a perfect um memory allocation. So it's a perfect um memory allocation. So it's a perfect use case for where the trans my use case for where the trans my use case for where the trans my transpiler was at at that time. transpiler was at at that time. transpiler was at at that time. And so I was able to and if if you can And so I was able to and if if you can And so I was able to and if if you can imagine having C running both the user imagine having C running both the user imagine having C running both the user space and the konel space at the same space and the konel space at the same space and the konel space at the same time that got really time that got really time that got really compelling and so I got a I got proof of compelling and so I got a I got proof of compelling and so I got a I got proof of sample proof of concepts going and that sample proof of concepts going and that sample proof of concepts going and that actually works. Um so I actually you can actually works. Um so I actually you can actually works. Um so I actually you can actually write Linux ebpf programs in C actually write Linux ebpf programs in C actually write Linux ebpf programs in C and have them uh run inside the Linux and have them uh run inside the Linux and have them uh run inside the Linux kono.
-
kono. kono. That's cool. I think the .NET team will That's cool. I think the .NET team will That's cool. I think the .NET team will be excited about that because there's be excited about that because there's be excited about that because there's all this talk about using Rust to run all this talk about using Rust to run all this talk about using Rust to run things in the Linux kernel, right? And things in the Linux kernel, right? And things in the Linux kernel, right? And yeah, and because we're going down the yeah, and because we're going down the yeah, and because we're going down the C, we can just reuse all this rent the C, we can just reuse all this rent the C, we can just reuse all this rent the normal C cheat this normal C tool chains normal C cheat this normal C tool chains normal C cheat this normal C tool chains that um everything relies on. So, I got that um everything relies on. So, I got that um everything relies on. So, I got that working and it was actually like I that working and it was actually like I that working and it was actually like I did a Reddit post for that and I got did a Reddit post for that and I got did a Reddit post for that and I got some that was some of the neat um some that was some of the neat um some that was some of the neat um responses I got, but wasn't nearly as responses I got, but wasn't nearly as responses I got, but wasn't nearly as much as this. And so because this is all much as this. And so because this is all much as this. And so because this is all my hobby, I was trying to figure out my hobby, I was trying to figure out my hobby, I was trying to figure out what to do next to move it forward. And what to do next to move it forward. And what to do next to move it forward. And one of my friends, Lawrence Welton, who one of my friends, Lawrence Welton, who one of my friends, Lawrence Welton, who works at works at works at Microsoft, mentioned that he had a he's Microsoft, mentioned that he had a he's Microsoft, mentioned that he had a he's like, "What about making SNES games?" like, "What about making SNES games?" like, "What about making SNES games?" And I was like, "No." I was like, "No, And I was like, "No." I was like, "No, And I was like, "No." I was like, "No, that's I don't know if that's going to that's I don't know if that's going to that's I don't know if that's going to be possible." Cuz I didn't think that be possible." Cuz I didn't think that be possible." Cuz I didn't think that there was a seed tool chain for it. I there was a seed tool chain for it. I there was a seed tool chain for it. I thought most of those game most of those thought most of those game most of those thought most of those game most of those most S NES games and Super Nintendo most S NES games and Super Nintendo most S NES games and Super Nintendo games were written in pure assembly, games were written in pure assembly, games were written in pure assembly, right? right? right? But it turns out that there's a C But it turns out that there's a C But it turns out that there's a C library, an SDK for making Super library, an SDK for making Super library, an SDK for making Super Nintendo games in um C and it's actually Nintendo games in um C and it's actually Nintendo games in um C and it's actually fairly active. And once I saw that fairly active. And once I saw that fairly active. And once I saw that there's it fit the bill perfectly there's it fit the bill perfectly there's it fit the bill perfectly because there's no memory allocate, because there's no memory allocate, because there's no memory allocate, there's no dynamic memory allocation.
-
there's no dynamic memory allocation. there's no dynamic memory allocation. And so I just went to town uh trying to And so I just went to town uh trying to And so I just went to town uh trying to get that to work. And it makes you get that to work. And it makes you get that to work. And it makes you really appreciate modern debugging tools really appreciate modern debugging tools really appreciate modern debugging tools when things don't go right. Yeah, it when things don't go right. Yeah, it when things don't go right. Yeah, it makes you wonder like like there's still makes you wonder like like there's still makes you wonder like like there's still people now even in modern times that are people now even in modern times that are people now even in modern times that are very famous people like Brendan Burns very famous people like Brendan Burns very famous people like Brendan Burns who works on Kubernetes like famously who works on Kubernetes like famously who works on Kubernetes like famously doesn't like debuggers. He's just all doesn't like debuggers. He's just all doesn't like debuggers. He's just all about got here debugging. Yeah. And the about got here debugging. Yeah. And the about got here debugging. Yeah. And the kinds of debugging that we would do 30 kinds of debugging that we would do 30 kinds of debugging that we would do 30 years ago with like soft ice or whatever years ago with like soft ice or whatever years ago with like soft ice or whatever it was basically like stop and stare at it was basically like stop and stare at it was basically like stop and stare at a bunch of registers and hope for the a bunch of registers and hope for the a bunch of registers and hope for the best, you know, or a bunch of console. best, you know, or a bunch of console. best, you know, or a bunch of console. Lines. Yeah, there was some points where Lines. Yeah, there was some points where Lines. Yeah, there was some points where I was in a emulator that's very much I was in a emulator that's very much I was in a emulator that's very much designed for debugging SNES games and designed for debugging SNES games and designed for debugging SNES games and going through assembly that I had I was going through assembly that I had I was going through assembly that I had I was looking up ad hoc on demand to try and looking up ad hoc on demand to try and looking up ad hoc on demand to try and figure out why uh some examples weren't figure out why uh some examples weren't figure out why uh some examples weren't working and it turned out I just working and it turned out I just working and it turned out I just mistyped some things but like but that mistyped some things but like but that mistyped some things but like but that takes that ends up costing you like takes that ends up costing you like takes that ends up costing you like hours.
-
hours. hours. Mhm. Okay. So help me understand the Mhm. Okay. So help me understand the Mhm. Okay. So help me understand the stack because we know that a Super stack because we know that a Super stack because we know that a Super Nintendo is uh is everyone writes Nintendo is uh is everyone writes Nintendo is uh is everyone writes everyone wrote those games in assembler everyone wrote those games in assembler everyone wrote those games in assembler correct at at the correct at at the correct at at the time. And with these what was the time. And with these what was the time. And with these what was the processor in in a in a Super Nintendo? processor in in a in a Super Nintendo? processor in in a in a Super Nintendo? Was it a 6502 or was it a 68000? I think Was it a 6502 or was it a 68000? I think Was it a 6502 or was it a 68000? I think it's a modified 6502. I think it had it's a modified 6502. I think it had it's a modified 6502. I think it had some changes um to it. Let me think some changes um to it. Let me think some changes um to it. Let me think here. Oh, here we go. It's a here. Oh, here we go. It's a here. Oh, here we go. It's a 65816 which is a 16bit CPU a fully fled 65816 which is a 16bit CPU a fully fled 65816 which is a 16bit CPU a fully fled it's it's not a fullyfled 68000 but it it's it's not a fullyfled 68000 but it it's it's not a fullyfled 68000 but it has a 6502 compatibility mode so you can has a 6502 compatibility mode so you can has a 6502 compatibility mode so you can do both and that's that was the magic it do both and that's that was the magic it do both and that's that was the magic it was a bridge to the future right so was a bridge to the future right so was a bridge to the future right so you've got you've got you've got 65C816 for 6502 developers 65C816 for 6502 developers 65C816 for 6502 developers interesting okay so these ROMs are well interesting okay so these ROMs are well interesting okay so these ROMs are well understood the emulators are well understood the emulators are well understood the emulators are well understood um and you you wanted to go understood um and you you wanted to go understood um and you you wanted to go from C all the way into targeting the from C all the way into targeting the from C all the way into targeting the specific processor and you didn't go specific processor and you didn't go specific processor and you didn't go straight there. You bounced you bounced straight there. You bounced you bounced straight there. You bounced you bounced around. You went msil to C and then from around. You went msil to C and then from around. You went msil to C and then from C to assembly and then assembly like C to assembly and then assembly like C to assembly and then assembly like walk me through the hello world. Yeah.
-
walk me through the hello world. Yeah. walk me through the hello world. Yeah. So the Yeah. So the hello world is So the Yeah. So the hello world is So the Yeah. So the hello world is essentially creating a a C# program and essentially creating a a C# program and essentially creating a a C# program and you u it's creating a C# program that's you u it's creating a C# program that's you u it's creating a C# program that's fairly standard, right? Um there's some fairly standard, right? Um there's some fairly standard, right? Um there's some caveats like right now I don't support caveats like right now I don't support caveats like right now I don't support reference types reference types reference types because I haven't implemented GC garbage because I haven't implemented GC garbage because I haven't implemented GC garbage collection yet and um that's kind of on collection yet and um that's kind of on collection yet and um that's kind of on my next task. Although you wouldn't use my next task. Although you wouldn't use my next task. Although you wouldn't use garbage collection or reference type garbage collection or reference type garbage collection or reference type reference counting or really any of that reference counting or really any of that reference counting or really any of that style of programming for an SNES because style of programming for an SNES because style of programming for an SNES because uh too much overhead um and there's no uh too much overhead um and there's no uh too much overhead um and there's no dynamic memory allocation on a SNES dynamic memory allocation on a SNES dynamic memory allocation on a SNES really. Um, so you start with a C# really. Um, so you start with a C# really. Um, so you start with a C# program and you run it through a program program and you run it through a program program and you run it through a program that I call DNTC, which is my .NET TOC that I call DNTC, which is my .NET TOC that I call DNTC, which is my .NET TOC transpiler. Mhm. And that actually goes transpiler. Mhm. And that actually goes transpiler. Mhm. And that actually goes through and it you you give it a root through and it you you give it a root through and it you you give it a root function of what function you want to function of what function you want to function of what function you want to start the transpol transpilation process start the transpol transpilation process start the transpol transpilation process at and it sort of creates a dependency at and it sort of creates a dependency at and it sort of creates a dependency graph of your whole uh all the types graph of your whole uh all the types graph of your whole uh all the types involved all the functions that get involved all the functions that get involved all the functions that get called everything that it needs and it called everything that it needs and it called everything that it needs and it makes sure everything's include makes sure everything's include makes sure everything's include everything that's in that that gets everything that's in that that gets everything that's in that that gets called it has a solution for and then called it has a solution for and then called it has a solution for and then one by one it starts um taking the the one by one it starts um taking the the one by one it starts um taking the the IL and converting it into a syntax tree IL and converting it into a syntax tree IL and converting it into a syntax tree that it then uh converts into C that it then uh converts into C that it then uh converts into C statements um as it goes as it reads the statements um as it goes as it reads the statements um as it goes as it reads the IL one bit at a time.
-
IL one bit at a time. IL one bit at a time. Um it's a fairly interesting process Um it's a fairly interesting process Um it's a fairly interesting process because the net uh bite code is very because the net uh bite code is very because the net uh bite code is very much based on it's very much made much based on it's very much made much based on it's very much made specifically for as a stack machine that specifically for as a stack machine that specifically for as a stack machine that it's eval and it's designed it's a stack it's eval and it's designed it's a stack it's eval and it's designed it's a stack machine that it's evaluating at machine that it's evaluating at machine that it's evaluating at runtime and I got I have a huge runtime and I got I have a huge runtime and I got I have a huge appreciation for the netjit team now appreciation for the netjit team now appreciation for the netjit team now because trying to take that stack because trying to take that stack because trying to take that stack machine and figuring out optimizations machine and figuring out optimizations machine and figuring out optimizations of how to do that ahead of time is of how to do that ahead of time is of how to do that ahead of time is really fascinating. Yeah, it's hard. really fascinating. Yeah, it's hard. really fascinating. Yeah, it's hard. There's a lot going on and I think that There's a lot going on and I think that There's a lot going on and I think that people who are even in the regular net people who are even in the regular net people who are even in the regular net community who aren't building things for community who aren't building things for community who aren't building things for a Super Nintendo don't really understand a Super Nintendo don't really understand a Super Nintendo don't really understand how deep the possibilities are. The how deep the possibilities are. The how deep the possibilities are. The combinatorics because the jitter right combinatorics because the jitter right combinatorics because the jitter right now says, "Oh, you're on x86. Oh, you're now says, "Oh, you're on x86. Oh, you're now says, "Oh, you're on x86. Oh, you're on x64. Oh, you're on ARM." And then on x64. Oh, you're on ARM." And then on x64. Oh, you're on ARM." And then looks at specific processor instructions looks at specific processor instructions looks at specific processor instructions and says, "Oh, you're on x64, but you're and says, "Oh, you're on x64, but you're and says, "Oh, you're on x64, but you're on an older Intel or you're on a newer on an older Intel or you're on a newer on an older Intel or you're on a newer Intel." makes all kinds of decisions at Intel." makes all kinds of decisions at Intel." makes all kinds of decisions at the jitter level. So then you have this the jitter level. So then you have this the jitter level. So then you have this this uh cartisian product of all the this uh cartisian product of all the this uh cartisian product of all the different operating systems, all the different operating systems, all the different operating systems, all the different uh processors, all the different uh processors, all the different uh processors, all the different flavors within sub, you know, different flavors within sub, you know, different flavors within sub, you know, sub flavors and subversions of sub flavors and subversions of sub flavors and subversions of processors, it gets complicated. And processors, it gets complicated. And processors, it gets complicated. And then if you wanted to apply AOT to that, then if you wanted to apply AOT to that, then if you wanted to apply AOT to that, things get really, really hairy. Well, things get really, really hairy. Well, things get really, really hairy. Well, especially if you think about some especially if you think about some especially if you think about some optimizations that the C compiler itself optimizations that the C compiler itself optimizations that the C compiler itself does. So if you're just doing a simple does. So if you're just doing a simple does. So if you're just doing a simple swap of two variables, you have A, you swap of two variables, you have A, you swap of two variables, you have A, you have B, and you want to you want to swap have B, and you want to you want to swap have B, and you want to you want to swap the their values, even if you use
-
the their values, even if you use the their values, even if you use temporary V variables, the C compiler temporary V variables, the C compiler temporary V variables, the C compiler will will optimize it into just put A's will will optimize it into just put A's will will optimize it into just put A's value on the stack, put B's value on the value on the stack, put B's value on the value on the stack, put B's value on the stack, and then just pop them in the stack, and then just pop them in the stack, and then just pop them in the opposite order into the into the opposite order into the into the opposite order into the into the alternate variables. But you can't do alternate variables. But you can't do alternate variables. But you can't do that that that on at ahead of time. You can't do that. on at ahead of time. You can't do that. on at ahead of time. You can't do that. Like that doesn't work ahead of time. Like that doesn't work ahead of time. Like that doesn't work ahead of time. And especially with the transpiler, I And especially with the transpiler, I And especially with the transpiler, I have to know exactly what it's have to know exactly what it's have to know exactly what it's targeting. And so you actually have to targeting. And so you actually have to targeting. And so you actually have to jump through some hoops to be able to jump through some hoops to be able to jump through some hoops to be able to resolve that, recognize that that resolve that, recognize that that resolve that, recognize that that situation is going to occur and then situation is going to occur and then situation is going to occur and then resolve it into assembly language or see resolve it into assembly language or see resolve it into assembly language or see or see that actually does the correct or see that actually does the correct or see that actually does the correct behavior that you're expecting. My behavior that you're expecting. My behavior that you're expecting. My goodness. So you're taking uh any goodness. So you're taking uh any goodness. So you're taking uh any language that can compile to MSIL, the language that can compile to MSIL, the language that can compile to MSIL, the intermediate intermediate intermediate language, presumably C# primarily, and language, presumably C# primarily, and language, presumably C# primarily, and you compile it into into C source code, you compile it into into C source code, you compile it into into C source code, specifically C99, the that flavor of C. specifically C99, the that flavor of C. specifically C99, the that flavor of C. Is that correct? Yeah. So the intention Is that correct? Yeah. So the intention Is that correct? Yeah. So the intention was C99, but there's a lot of over was C99, but there's a lot of over was C99, but there's a lot of over there's a lot of there's a lot of there's a lot of um so when when you when you the idea um so when when you when you the idea um so when when you when you the idea was the idea right now is that you take was the idea right now is that you take was the idea right now is that you take a uh you build a transpiler you can a uh you build a transpiler you can a uh you build a transpiler you can build transpiler plugin to to change build transpiler plugin to to change build transpiler plugin to to change things up a bit and that's needed things up a bit and that's needed things up a bit and that's needed because the C library that targets SNES because the C library that targets SNES because the C library that targets SNES doesn't actually isn't C99 compliant and doesn't actually isn't C99 compliant and doesn't actually isn't C99 compliant and so there are some features like um so there are some features like um so there are some features like um zeroing out globals that are not zeroing out globals that are not zeroing out globals that are not actually supported that you then have to actually supported that you then have to actually supported that you then have to like customize the transpilation like customize the transpilation like customize the transpilation operations to handle.
-
operations to handle. operations to handle. Um so um it's it tries to be C99 Um so um it's it tries to be C99 Um so um it's it tries to be C99 compliant but there's there's the custom compliant but there's there's the custom compliant but there's there's the custom there's a customization and flexibility there's a customization and flexibility there's a customization and flexibility to be able to target anything any C to be able to target anything any C to be able to target anything any C compiler really. Mhm. And one of the compiler really. Mhm. And one of the compiler really. Mhm. And one of the things I think you do really cool and I things I think you do really cool and I things I think you do really cool and I want to understand if it's part of your want to understand if it's part of your want to understand if it's part of your uh this DNTC the net toc transpiler is uh this DNTC the net toc transpiler is uh this DNTC the net toc transpiler is you have these attributes like native you have these attributes like native you have these attributes like native function call or native global or custom function call or native global or custom function call or native global or custom function name because you're basically function name because you're basically function name because you're basically kind of taking extern to the next level kind of taking extern to the next level kind of taking extern to the next level and basically letting car and this and basically letting car and this and basically letting car and this transpiler almost work in both transpiler almost work in both transpiler almost work in both directions. is you're really giving directions. is you're really giving directions. is you're really giving hints on how the C code should end up hints on how the C code should end up hints on how the C code should end up and what the results are. And it feels and what the results are. And it feels and what the results are. And it feels like like this is an oversimplification, like like this is an oversimplification, like like this is an oversimplification, but P invoke, right? Platform invoke is but P invoke, right? Platform invoke is but P invoke, right? Platform invoke is the ability of C to go and call into the ability of C to go and call into the ability of C to go and call into extern C's into C's that are sitting extern C's into C's that are sitting extern C's into C's that are sitting around in random libraries, whether it around in random libraries, whether it around in random libraries, whether it be a shared object in Linux or a DL in be a shared object in Linux or a DL in be a shared object in Linux or a DL in in Windows. But if you're on the way in Windows. But if you're on the way in Windows. But if you're on the way downstairs anyway, right, you apply downstairs anyway, right, you apply downstairs anyway, right, you apply these attributes and then they find these attributes and then they find these attributes and then they find their their way all the way down and you their their way all the way down and you their their way all the way down and you basically set up your calling basically set up your calling basically set up your calling conventions for success, right, with conventions for success, right, with conventions for success, right, with these with these attributes. Yeah. the these with these attributes. Yeah. the these with these attributes. Yeah. the the so one of the core thing one of the the so one of the core thing one of the the so one of the core thing one of the core princip I guess pillars that I core princip I guess pillars that I core princip I guess pillars that I built this transpiler on is that it built this transpiler on is that it built this transpiler on is that it should be easy not only to create a C# should be easy not only to create a C# should be easy not only to create a C# application that references C code like application that references C code like application that references C code like the SNES example is you can kind of the SNES example is you can kind of the SNES example is you can kind of think of it as a C as a C program that's think of it as a C as a C program that's think of it as a C as a C program that's calling into native C functions for the
-
calling into native C functions for the calling into native C functions for the SDK SDK SDK um but there's also the reverse that I um but there's also the reverse that I um but there's also the reverse that I wanted to make sure was a first class wanted to make sure was a first class wanted to make sure was a first class citizen of you can take C code and citizen of you can take C code and citizen of you can take C code and integrate it into your existing C integrate it into your existing C integrate it into your existing C application or um as long as you have C application or um as long as you have C application or um as long as you have C headers. And so there's a lot of these headers. And so there's a lot of these headers. And so there's a lot of these uh customizations and attributes that uh customizations and attributes that uh customizations and attributes that you can add to really customize how you can add to really customize how you can add to really customize how things are done. Like for the SNES ROM, things are done. Like for the SNES ROM, things are done. Like for the SNES ROM, the it's specifically looking for a the it's specifically looking for a the it's specifically looking for a function called main with a lowercase M function called main with a lowercase M function called main with a lowercase M and all those things. And so you need to and all those things. And so you need to and all those things. And so you need to be able to twe tell the transpiler, hey, be able to twe tell the transpiler, hey, be able to twe tell the transpiler, hey, tweak this name a bit so that it fits. tweak this name a bit so that it fits. tweak this name a bit so that it fits. Um and with the SNAS ROMs, you actually Um and with the SNAS ROMs, you actually Um and with the SNAS ROMs, you actually have have have mock. you have labels in the assembly mock. you have labels in the assembly mock. you have labels in the assembly um you have you have you have you have um you have you have you have you have um you have you have you have you have you have labels in the assembly files you have labels in the assembly files you have labels in the assembly files that actually target memory locations that actually target memory locations that actually target memory locations and so you need to be able to call those and so you need to be able to call those and so you need to be able to call those with the same with the exact names or with the same with the exact names or with the same with the exact names or and um so there's a lot of examples of and um so there's a lot of examples of and um so there's a lot of examples of that will well I can look at an example that will well I can look at an example that will well I can look at an example here I'm looking at your game public here I'm looking at your game public here I'm looking at your game public static class game yeah and you've got a static class game yeah and you've got a static class game yeah and you've got a main public static int main and then you main public static int main and then you main public static int main and then you made sure that it's main you said custom made sure that it's main you said custom made sure that it's main you said custom function name lowercase main and then function name lowercase main and then function name lowercase main and then you've got some things like tile font or you've got some things like tile font or you've got some things like tile font or PAL font and these are little static PAL font and these are little static PAL font and these are little static bytes where things need to show up right bytes where things need to show up right bytes where things need to show up right and then if you go over into like data and then if you go over into like data and then if you go over into like data which is the assembly language kind of which is the assembly language kind of which is the assembly language kind of like resource that's along for the ride like resource that's along for the ride like resource that's along for the ride there it is tile font PAL font so it's there it is tile font PAL font so it's there it is tile font PAL font so it's this um you're creating this chain of this um you're creating this chain of this um you're creating this chain of responsibility to make sure that
-
responsibility to make sure that responsibility to make sure that everything lines up when when it all everything lines up when when it all everything lines up when when it all happens at the last minute yeah and and happens at the last minute yeah and and happens at the last minute yeah and and it makes sure everything. It makes sure it makes sure everything. It makes sure it makes sure everything. It makes sure there's no there's no there's no disconnections when you are actually disconnections when you are actually disconnections when you are actually calling a native function. Um like you calling a native function. Um like you calling a native function. Um like you said the like a native P invoke and it said the like a native P invoke and it said the like a native P invoke and it and it makes it like it makes it zero and it makes it like it makes it zero and it makes it like it makes it zero cost to actually convert all your to cost to actually convert all your to cost to actually convert all your to actually call native functions because actually call native functions because actually call native functions because there's no actual it it's all linked there's no actual it it's all linked there's no actual it it's all linked together in the final binary. It's not together in the final binary. It's not together in the final binary. It's not actually doing a shared library. Now actually doing a shared library. Now actually doing a shared library. Now this is not idiomatic. I'm looking at this is not idiomatic. I'm looking at this is not idiomatic. I'm looking at this and I see using .NET SNES core and this and I see using .NET SNES core and this and I see using .NET SNES core and namespace and that all feels good. I see namespace and that all feels good. I see namespace and that all feels good. I see some attributes and that's cool. And some attributes and that's cool. And some attributes and that's cool. And then it's it looks like it's mostly then it's it looks like it's mostly then it's it looks like it's mostly static functions hanging off of helpers static functions hanging off of helpers static functions hanging off of helpers like SNST console, you know, set the like SNST console, you know, set the like SNST console, you know, set the text or background set graphics pointer. text or background set graphics pointer. text or background set graphics pointer. Yeah. But it still also feels high Yeah. But it still also feels high Yeah. But it still also feels high level. So it's it's funny. You feel high level. So it's it's funny. You feel high level. So it's it's funny. You feel high level but you really aren't. So the mo level but you really aren't. So the mo level but you really aren't. So the mo the Mario platformer example was very the Mario platformer example was very the Mario platformer example was very much a almost line by line conversion much a almost line by line conversion much a almost line by line conversion that I did from the C example to it. Um that I did from the C example to it. Um that I did from the C example to it. Um there are ways that I want to that I there are ways that I want to that I there are ways that I want to that I have there are ideas that I have to make have there are ideas that I have to make have there are ideas that I have to make it a bit more idiomatic C. Um like so it a bit more idiomatic C. Um like so it a bit more idiomatic C. Um like so for example one part of that one one for example one part of that one one for example one part of that one one part of that code passes around function part of that code passes around function part of that code passes around function pointers uh or it passes on delegates pointers uh or it passes on delegates pointers uh or it passes on delegates which gets transpired down to function which gets transpired down to function which gets transpired down to function pointers.
-
pointers. pointers. But I want to be able to say use uh But I want to be able to say use uh But I want to be able to say use uh static interface members to replace that static interface members to replace that static interface members to replace that for example. for example. for example. There's a lot of opportunities. The There's a lot of opportunities. The There's a lot of opportunities. The breakout example is a better example of breakout example is a better example of breakout example is a better example of where there's a bit more idiomat where where there's a bit more idiomat where where there's a bit more idiomat where I've taken a bit more time to make the I've taken a bit more time to make the I've taken a bit more time to make the example a bit more idiomatic. Um the example a bit more idiomatic. Um the example a bit more idiomatic. Um the Mario one was mostly just a let me make Mario one was mostly just a let me make Mario one was mostly just a let me make sure that everything works end to end sure that everything works end to end sure that everything works end to end before I start messing. before I start messing. before I start messing. Right. There's something new from our Right. There's something new from our Right. There's something new from our sponsor, Text Control. For decades, TXT sponsor, Text Control. For decades, TXT sponsor, Text Control. For decades, TXT Controls rendering was tied to Windows Controls rendering was tied to Windows Controls rendering was tied to Windows functionality, but now it's a new era. functionality, but now it's a new era. functionality, but now it's a new era. TXT text control is platform TXT text control is platform TXT text control is platform independent. You can run your .NET independent. You can run your .NET independent. You can run your .NET applications on Windows or Linux. Deploy applications on Windows or Linux. Deploy applications on Windows or Linux. Deploy with Docker containers, Kubernetes, or with Docker containers, Kubernetes, or with Docker containers, Kubernetes, or host directly in Azure App Services. host directly in Azure App Services. host directly in Azure App Services. Seamlessly integrate document editing, Seamlessly integrate document editing, Seamlessly integrate document editing, signing, collaboration, and PDF signing, collaboration, and PDF signing, collaboration, and PDF processing into your ASP.NET Core and processing into your ASP.NET Core and processing into your ASP.NET Core and Angular applications. Are you ready to Angular applications. Are you ready to Angular applications. Are you ready to see it in action? Check out the live see it in action? Check out the live see it in action? Check out the live demo at demos.extcontrol.com. That's demos.extcontrol.com. That's demos.extcontrol.com.
-
Now, this is all sitting on top of a Now, this is all sitting on top of a thing called PVS nees or pvnestlive, thing called PVS nees or pvnestlive, thing called PVS nees or pvnestlive, right? Made by a gentleman named Alec right? Made by a gentleman named Alec right? Made by a gentleman named Alec out of France. That's uh a library out of France. That's uh a library out of France. That's uh a library that's been around for three or four that's been around for three or four that's been around for three or four years that I think that they started years that I think that they started years that I think that they started from an SDK called the SNES SDK over on from an SDK called the SNES SDK over on from an SDK called the SNES SDK over on Google code by a gentleman named Ulrich Google code by a gentleman named Ulrich Google code by a gentleman named Ulrich Hec. So this is 10 or 15 years of people Hec. So this is 10 or 15 years of people Hec. So this is 10 or 15 years of people trying to get C right programming trying to get C right programming trying to get C right programming available for Super Nintendo. So this available for Super Nintendo. So this available for Super Nintendo. So this gentleman Alec is sitting on top of the gentleman Alec is sitting on top of the gentleman Alec is sitting on top of the shoulders of this other gentleman uh shoulders of this other gentleman uh shoulders of this other gentleman uh named Murick and on and as well as a named Murick and on and as well as a named Murick and on and as well as a community and lots of different things. community and lots of different things. community and lots of different things. How did you know this would all line up How did you know this would all line up How did you know this would all line up though? How do you pick a library and though? How do you pick a library and though? How do you pick a library and you say, "Yeah, I'm going to stand on you say, "Yeah, I'm going to stand on you say, "Yeah, I'm going to stand on that and I think it'll be supported me. that and I think it'll be supported me. that and I think it'll be supported me. It'll support me." It's that's the whole It'll support me." It's that's the whole It'll support me." It's that's the whole thing of like everything I do thing of like everything I do thing of like everything I do um I'm just standing on the shoulder of um I'm just standing on the shoulder of um I'm just standing on the shoulder of pe what people have done before. So even pe what people have done before. So even pe what people have done before. So even just like the IL functionality just like the IL functionality just like the IL functionality um like I wouldn't be able to do any um like I wouldn't be able to do any um like I wouldn't be able to do any this would be hard. This would be hard this would be hard. This would be hard this would be hard. This would be hard in if I if I targeted C# for the in if I if I targeted C# for the in if I if I targeted C# for the transpilation that would be I could use transpilation that would be I could use transpilation that would be I could use a Roslin but that would be hard because a Roslin but that would be hard because a Roslin but that would be hard because C#'s kind of a moving target and I'd C#'s kind of a moving target and I'd C#'s kind of a moving target and I'd have to keep that updated but the MSIL have to keep that updated but the MSIL have to keep that updated but the MSIL is a good base but I wouldn't but but I is a good base but I wouldn't but but I is a good base but I wouldn't but but I wouldn't want to write the whole library wouldn't want to write the whole library wouldn't want to write the whole library to actually interpret all the MSI code to actually interpret all the MSI code to actually interpret all the MSI code itself. But the Mono project I I think itself. But the Mono project I I think itself. But the Mono project I I think mono.ca is a I don't know if mono.ca is mono.ca is a I don't know if mono.ca is mono.ca is a I don't know if mono.ca is a official project or not. I think it a official project or not. I think it a official project or not. I think it is. I mean certainly the world is is. I mean certainly the world is is. I mean certainly the world is sitting on top of Cecil. So yeah I think
-
sitting on top of Cecil. So yeah I think sitting on top of Cecil. So yeah I think it's pretty important. Yeah. So like it's pretty important. Yeah. So like it's pretty important. Yeah. So like without Cecil without PVS NES um I without Cecil without PVS NES um I without Cecil without PVS NES um I wouldn't have been able to do it and wouldn't have been able to do it and wouldn't have been able to do it and really the only reason I was even able really the only reason I was even able really the only reason I was even able to do the EPF stuff u functionality is to do the EPF stuff u functionality is to do the EPF stuff u functionality is because all of the work that went into because all of the work that went into because all of the work that went into the C the C the C libraries to uh unlock all of that libraries to uh unlock all of that libraries to uh unlock all of that capabilities. Mhm. So it's really it's capabilities. Mhm. So it's really it's capabilities. Mhm. So it's really it's it's always fascinating when I take a it's always fascinating when I take a it's always fascinating when I take a step back and look at like everything step back and look at like everything step back and look at like everything that I'm like what made everything I'm that I'm like what made everything I'm that I'm like what made everything I'm doing possible. Yeah. Yeah. It's doing possible. Yeah. Yeah. It's doing possible. Yeah. Yeah. It's overwhelming. The stack is so deep now. overwhelming. The stack is so deep now. overwhelming. The stack is so deep now. I think it's funny when people call I think it's funny when people call I think it's funny when people call themselves full stack developers, but themselves full stack developers, but themselves full stack developers, but they don't realize how many shoulders they don't realize how many shoulders they don't realize how many shoulders they're standing on top of over so much they're standing on top of over so much they're standing on top of over so much time because this is about the most time because this is about the most time because this is about the most documented piece of hardware on the documented piece of hardware on the documented piece of hardware on the planet at this point, you know. And planet at this point, you know. And planet at this point, you know. And watching the emulators, I think, is watching the emulators, I think, is watching the emulators, I think, is super fun because it's not just super fun because it's not just super fun because it's not just emulating a ROM. You can actually have emulating a ROM. You can actually have emulating a ROM. You can actually have emulators that will show what's emulators that will show what's emulators that will show what's happening in real time in the memory of happening in real time in the memory of happening in real time in the memory of the Super Nintendo. So, it's a really the Super Nintendo. So, it's a really the Super Nintendo. So, it's a really great way to learn computer science. great way to learn computer science. great way to learn computer science. Yeah, there was there were there were Yeah, there was there were there were Yeah, there was there were there were several bugs that I was going through in several bugs that I was going through in several bugs that I was going through in during the the SNES process where I was during the the SNES process where I was during the the SNES process where I was trying to trying to trying to uh like I was I was I was eval I was uh like I was I was I was eval I was uh like I was I was I was eval I was looking at all the stack registers on looking at all the stack registers on looking at all the stack registers on the SNES. I was looking at memory the SNES. I was looking at memory the SNES. I was looking at memory locations. I was looking at tile sets locations. I was looking at tile sets locations. I was looking at tile sets trying to figure out why something trying to figure out why something trying to figure out why something wasn't appearing on the screen when I wasn't appearing on the screen when I wasn't appearing on the screen when I figured it should. Um, and it's it's figured it should. Um, and it's it's figured it should. Um, and it's it's fascinating to go down. Like this whole fascinating to go down. Like this whole fascinating to go down. Like this whole trip has made me really want to I I trip has made me really want to I I trip has made me really want to I I actually bought an actually bought an actually bought an assembly book just to start like assembly book just to start like assembly book just to start like understanding that part of the stack a understanding that part of the stack a understanding that part of the stack a bit more. Um, just how everything works.
-
bit more. Um, just how everything works. bit more. Um, just how everything works. And this has also made me want to go to And this has also made me want to go to And this has also made me want to go to start work playing with start work playing with start work playing with FPGAAS and um, playing around with a lot FPGAAS and um, playing around with a lot FPGAAS and um, playing around with a lot of the digital logic that that entails. of the digital logic that that entails. of the digital logic that that entails. Yeah, I I bought recently, where is it Yeah, I I bought recently, where is it Yeah, I I bought recently, where is it here? I think it was called an ice stick here? I think it was called an ice stick here? I think it was called an ice stick FPGA and it just plugs directly into FPGA and it just plugs directly into FPGA and it just plugs directly into your USB and it's you know I don't know your USB and it's you know I don't know your USB and it's you know I don't know if it would be big enough to do if it would be big enough to do if it would be big enough to do something like that but if you think something like that but if you think something like that but if you think about some of the really cool work about some of the really cool work about some of the really cool work that's happening on these uh that's happening on these uh that's happening on these uh programmable gated arrays these FPGA programmable gated arrays these FPGA programmable gated arrays these FPGA systems like the analog pocket which I systems like the analog pocket which I systems like the analog pocket which I think is truly one of the most think is truly one of the most think is truly one of the most extraordinary pieces of hardware that's extraordinary pieces of hardware that's extraordinary pieces of hardware that's just happened along with the mister m i just happened along with the mister m i just happened along with the mister m i s t e r uh to allow someone to s t e r uh to allow someone to s t e r uh to allow someone to effectively transform a dynamically a effectively transform a dynamically a effectively transform a dynamically a piece of hardware into another piece of piece of hardware into another piece of piece of hardware into another piece of hardware and then run the original code hardware and then run the original code hardware and then run the original code on it with these cores is amazing. Yeah. on it with these cores is amazing. Yeah. on it with these cores is amazing. Yeah. Yeah. And once you start learning, once Yeah. And once you start learning, once Yeah. And once you start learning, once you start doing um once you start you start doing um once you start you start doing um once you start playing with those and you start playing with those and you start playing with those and you start realizing what those are doing and you realizing what those are doing and you realizing what those are doing and you start learning cuz I started going start learning cuz I started going start learning cuz I started going through naname a website called through naname a website called through naname a website called naname which um takes you all the way naname which um takes you all the way naname which um takes you all the way from a nan gate all the way to a very from a nan gate all the way to a very from a nan gate all the way to a very basic pot CPU uh and memory unit a very basic pot CPU uh and memory unit a very basic pot CPU uh and memory unit a very basic computer essentially. Well there's basic computer essentially. Well there's basic computer essentially. Well there's also NAND 2 Tetris. Yeah that there's also NAND 2 Tetris. Yeah that there's also NAND 2 Tetris. Yeah that there's NAND two Tetris. There's also a game, NAND two Tetris. There's also a game, NAND two Tetris. There's also a game, I'm blanking on the name, on Steam.
-
I'm blanking on the name, on Steam. I'm blanking on the name, on Steam. There's also a couple of things on Steam There's also a couple of things on Steam There's also a couple of things on Steam that do that. And it's when you start that do that. And it's when you start that do that. And it's when you start realizing how I really want to put a realizing how I really want to put a realizing how I really want to put a presentation together at one point for presentation together at one point for presentation together at one point for walk, but like the abstractions that walk, but like the abstractions that walk, but like the abstractions that make up a CPU is just fascinating. It's make up a CPU is just fascinating. It's make up a CPU is just fascinating. It's not even just like the implementation not even just like the implementation not even just like the implementation details of how each step, it's how all details of how each step, it's how all details of how each step, it's how all the abstractions work together. Yeah. the abstractions work together. Yeah. the abstractions work together. Yeah. Yeah. To get to that point, I feel like Yeah. To get to that point, I feel like Yeah. To get to that point, I feel like at some point I need to quit my job just at some point I need to quit my job just at some point I need to quit my job just to do these projects in my spare time. to do these projects in my spare time. to do these projects in my spare time. Yeah. Oh, yeah. It's especially now that Yeah. Oh, yeah. It's especially now that Yeah. Oh, yeah. It's especially now that I have kids, it's uh Yeah. extremely I have kids, it's uh Yeah. extremely I have kids, it's uh Yeah. extremely difficult with my 1 hour of free time at difficult with my 1 hour of free time at difficult with my 1 hour of free time at night. There's a there's a buddy of mine night. There's a there's a buddy of mine night. There's a there's a buddy of mine who's got a website called Picuma. P I K who's got a website called Picuma. P I K who's got a website called Picuma. P I K U M A. You love that guy. So, I love U M A. You love that guy. So, I love U M A. You love that guy. So, I love that guy. And so the next step for my that guy. And so the next step for my that guy. And so the next step for my project is I actually bought his project is I actually bought his project is I actually bought his PlayStation one course. And I actually PlayStation one course. And I actually PlayStation one course. And I actually want to get reference types working and want to get reference types working and want to get reference types working and start working on a very basic PS1 C start working on a very basic PS1 C start working on a very basic PS1 C engine. Yeah, I had uh that's Gustavo engine. Yeah, I had uh that's Gustavo engine. Yeah, I had uh that's Gustavo Petsy. He is uh fantastic. He was on the Petsy. He is uh fantastic. He was on the Petsy. He is uh fantastic. He was on the show a while back and he for folks that show a while back and he for folks that show a while back and he for folks that are listening has uh Nintendo are listening has uh Nintendo are listening has uh Nintendo programming with Assembly course, Atari programming with Assembly course, Atari programming with Assembly course, Atari programming with Assembly. He's even got programming with Assembly. He's even got programming with Assembly. He's even got a really great course which I think is a really great course which I think is a really great course which I think is really the the the best one he's got really the the the best one he's got really the the the best one he's got which is his ray casting engine with C.
-
which is his ray casting engine with C. which is his ray casting engine with C. So he basically like you basically write So he basically like you basically write So he basically like you basically write Castle Wolfenstein from C from scratch. Castle Wolfenstein from C from scratch. Castle Wolfenstein from C from scratch. I found his course from the 3D graphics I found his course from the 3D graphics I found his course from the 3D graphics from scratch 3D rendering uh from from scratch 3D rendering uh from from scratch 3D rendering uh from scratch course. Um that's how I started scratch course. Um that's how I started scratch course. Um that's how I started with him. Yeah. Yeah. So I was able to with him. Yeah. Yeah. So I was able to with him. Yeah. Yeah. So I was able to get this working really easily. I just get this working really easily. I just get this working really easily. I just went to your GitHub uh which is K A L D went to your GitHub uh which is K A L D went to your GitHub uh which is K A L D R E X. We'll have a link in the show R E X. We'll have a link in the show R E X. We'll have a link in the show notes. And I just did a uh git clone. notes. And I just did a uh git clone. notes. And I just did a uh git clone. Although you do need two things. You Although you do need two things. You Although you do need two things. You have to do a get subm module update init have to do a get subm module update init have to do a get subm module update init recursive because you pull in two recursive because you pull in two recursive because you pull in two specific you've actually pinned down to specific you've actually pinned down to specific you've actually pinned down to a commit two specific subm modules. Uh a commit two specific subm modules. Uh a commit two specific subm modules. Uh one is the PS PVS SNES and then one is one is the PS PVS SNES and then one is one is the PS PVS SNES and then one is your own DMTC. And then you have to use your own DMTC. And then you have to use your own DMTC. And then you have to use uh SSH keys. You can't do this with the uh SSH keys. You can't do this with the uh SSH keys. You can't do this with the standard way of logging in. So if if standard way of logging in. So if if standard way of logging in. So if if folks are listening and they're not folks are listening and they're not folks are listening and they're not super familiar with how to do this, the super familiar with how to do this, the super familiar with how to do this, the easiest way is to get the GitHub CLI and easiest way is to get the GitHub CLI and easiest way is to get the GitHub CLI and then you say gh login and it'll actually then you say gh login and it'll actually then you say gh login and it'll actually create the SSH keys for you. And I was create the SSH keys for you. And I was create the SSH keys for you. And I was able to get this running inside of WSL, able to get this running inside of WSL, able to get this running inside of WSL, the Windows Subsystem for Linux in just the Windows Subsystem for Linux in just the Windows Subsystem for Linux in just about 10 minutes. And then I picked up a about 10 minutes. And then I picked up a about 10 minutes. And then I picked up a free uh Super Nintendo uh emulator and free uh Super Nintendo uh emulator and free uh Super Nintendo uh emulator and then just ran make. It was amazing. It then just ran make. It was amazing. It then just ran make. It was amazing. It just worked. It was just 10 minutes end just worked. It was just 10 minutes end just worked. It was just 10 minutes end to end. Yeah, it took a it was I've to end. Yeah, it took a it was I've to end. Yeah, it took a it was I've never done a lot of make file stuff never done a lot of make file stuff never done a lot of make file stuff before this project and that was you're before this project and that was you're before this project and that was you're kidding. I was going to compliment you kidding. I was going to compliment you kidding. I was going to compliment you on your use of make files and I thought on your use of make files and I thought on your use of make files and I thought I said this person's a make file expert
-
I said this person's a make file expert I said this person's a make file expert because you had make file defaults, make because you had make file defaults, make because you had make file defaults, make file base and I was actually running file base and I was actually running file base and I was actually running around relearning how make files do around relearning how make files do around relearning how make files do their dependency ch uh tree. No, I uh I their dependency ch uh tree. No, I uh I their dependency ch uh tree. No, I uh I set I I had a very basic one set up and set I I had a very basic one set up and set I I had a very basic one set up and I'm like this is going to be a pain for I'm like this is going to be a pain for I'm like this is going to be a pain for anyone who wants to make a start a new anyone who wants to make a start a new anyone who wants to make a start a new project or based off of and so I just project or based off of and so I just project or based off of and so I just tried to figure out how to actually tried to figure out how to actually tried to figure out how to actually I just brute forced my way until I came I just brute forced my way until I came I just brute forced my way until I came up with something somewhat sane. up with something somewhat sane. up with something somewhat sane. Well, I thought it worked out really Well, I thought it worked out really Well, I thought it worked out really great because you didn't try to make it great because you didn't try to make it great because you didn't try to make it fight with net build, right? you cleaned fight with net build, right? you cleaned fight with net build, right? you cleaned it up nice and simple because you have a it up nice and simple because you have a it up nice and simple because you have a lot of other things that people don't lot of other things that people don't lot of other things that people don't realize when you're putting together a realize when you're putting together a realize when you're putting together a Super Nintendo and that's assets, Super Nintendo and that's assets, Super Nintendo and that's assets, tiles, bit maps, fonts or bit maps, tiles, bit maps, fonts or bit maps, tiles, bit maps, fonts or bit maps, sprites, it kind of goes on and on and sprites, it kind of goes on and on and sprites, it kind of goes on and on and on. As we get towards the the end here, on. As we get towards the the end here, on. As we get towards the the end here, uh I know that people will go and check uh I know that people will go and check uh I know that people will go and check out all of these samples, hello world, out all of these samples, hello world, out all of these samples, hello world, uh the Mario one, and then the more uh the Mario one, and then the more uh the Mario one, and then the more advanced one, which you want to check advanced one, which you want to check advanced one, which you want to check out, which is the breakout one. But just out, which is the breakout one. But just out, which is the breakout one. But just understanding the Mario one for a understanding the Mario one for a understanding the Mario one for a second, there's the Mario like long PNG second, there's the Mario like long PNG second, there's the Mario like long PNG that represents his first level. How that represents his first level. How that represents his first level. How does he know what to jump on versus like does he know what to jump on versus like does he know what to jump on versus like what what's a pixel versus what's he what what's a pixel versus what's he what what's a pixel versus what's he allowed to touch? Well, what's allowed to touch? Well, what's allowed to touch? Well, what's interesting it's the PVS the PV SNES lib interesting it's the PVS the PV SNES lib interesting it's the PVS the PV SNES lib SDK is kind of interesting in that SDK is kind of interesting in that SDK is kind of interesting in that regard in that it um it uses tiled to regard in that it um it uses tiled to regard in that it um it uses tiled to create the tile map. So, it allows you create the tile map. So, it allows you create the tile map. So, it allows you to use a modern tool to make your C to to use a modern tool to make your C to to use a modern tool to make your C to to make your uh your maps. And so, to make your uh your maps. And so, to make your uh your maps. And so, um it has you you can actually set
-
um it has you you can actually set um it has you you can actually set collisions based on the tile types that collisions based on the tile types that collisions based on the tile types that you're mapping out in the tiled program you're mapping out in the tiled program you're mapping out in the tiled program and the SDK is automatically set up to and the SDK is automatically set up to and the SDK is automatically set up to convert those. And um so it's not the convert those. And um so it's not the convert those. And um so it's not the the PVSNES lib isn't necessarily a SNES the PVSNES lib isn't necessarily a SNES the PVSNES lib isn't necessarily a SNES generic SDK. It's very to it has it has generic SDK. It's very to it has it has generic SDK. It's very to it has it has some opinions about how objects should some opinions about how objects should some opinions about how objects should react, how sprites should react, how react, how sprites should react, how react, how sprites should react, how maps react and so it has built-in maps react and so it has built-in maps react and so it has built-in collision detection and built-in collision detection and built-in collision detection and built-in entities um for that functionality. Um entities um for that functionality. Um entities um for that functionality. Um so it makes it really easy to actually so it makes it really easy to actually so it makes it really easy to actually do that with somewhat modern tools. If do that with somewhat modern tools. If do that with somewhat modern tools. If you look if you ever watch those you look if you ever watch those you look if you ever watch those interview that's a really nice way to interview that's a really nice way to interview that's a really nice way to think about it. If you ever watch those think about it. If you ever watch those think about it. If you ever watch those interviews like those old things with interviews like those old things with interviews like those old things with Myiamoto where he uh they'll show how Myiamoto where he uh they'll show how Myiamoto where he uh they'll show how they how they actually made Super Mario they how they actually made Super Mario they how they actually made Super Mario Brothers. they actually had like grid Brothers. they actually had like grid Brothers. they actually had like grid paper and they're actually mocking out paper and they're actually mocking out paper and they're actually mocking out different blocks and how to do it and different blocks and how to do it and different blocks and how to do it and then the programmer would have to go in then the programmer would have to go in then the programmer would have to go in and manually enter all those bytes in. and manually enter all those bytes in. and manually enter all those bytes in. That's funny that you mentioned that That's funny that you mentioned that That's funny that you mentioned that because if you poke around inside of because if you poke around inside of because if you poke around inside of your Mario example, you know, you've got your Mario example, you know, you've got your Mario example, you know, you've got a couple of uh, you know, ASMx files and a couple of uh, you know, ASMx files and a couple of uh, you know, ASMx files and then I just dropped into one of the map then I just dropped into one of the map then I just dropped into one of the map files which was a TMJ and it's just a files which was a TMJ and it's just a files which was a TMJ and it's just a big old JSON filled with bytes uh that big old JSON filled with bytes uh that big old JSON filled with bytes uh that go on for forever and ever and ever and go on for forever and ever and ever and go on for forever and ever and ever and ever. But it's also cool that we've got ever. But it's also cool that we've got ever. But it's also cool that we've got PGs in there, which is a modern graphics PGs in there, which is a modern graphics PGs in there, which is a modern graphics format, and we've got Mario's jump sound format, and we've got Mario's jump sound format, and we've got Mario's jump sound is a modern wave file. So, it is this is a modern wave file. So, it is this is a modern wave file. So, it is this wonderful amalgamation of things that wonderful amalgamation of things that wonderful amalgamation of things that didn't exist at the time that the NES didn't exist at the time that the NES didn't exist at the time that the NES the SS SNES was created and things that the SS SNES was created and things that the SS SNES was created and things that exist now. Why why not take advantage of
-
exist now. Why why not take advantage of exist now. Why why not take advantage of those modern bits of comfort? Yeah. and those modern bits of comfort? Yeah. and those modern bits of comfort? Yeah. and some of the things that the uh the the some of the things that the uh the the some of the things that the uh the the modern community there is actually doing modern community there is actually doing modern community there is actually doing the the games that they're actually the the games that they're actually the the games that they're actually making at the P PVS SNES lib uh Discord making at the P PVS SNES lib uh Discord making at the P PVS SNES lib uh Discord is pretty incredible. Yeah, this is a is pretty incredible. Yeah, this is a is pretty incredible. Yeah, this is a great way to jump into the community. Uh great way to jump into the community. Uh great way to jump into the community. Uh the the you're standing on top of them the the you're standing on top of them the the you're standing on top of them and they're sitting on top of others and and they're sitting on top of others and and they're sitting on top of others and everyone is just having fun uh putting everyone is just having fun uh putting everyone is just having fun uh putting these things together. You can get all these things together. You can get all these things together. You can get all of this running really really easily. I of this running really really easily. I of this running really really easily. I think it's worth taking, you know, 20 think it's worth taking, you know, 20 think it's worth taking, you know, 20 minutes. It's also a testament to minutes. It's also a testament to minutes. It's also a testament to Windows and the WSL on how easy it was. Windows and the WSL on how easy it was. Windows and the WSL on how easy it was. Uh I dropped into WSL. I did the make Uh I dropped into WSL. I did the make Uh I dropped into WSL. I did the make once I had done a couple of uh apt once I had done a couple of uh apt once I had done a couple of uh apt updates and installed some basic make updates and installed some basic make updates and installed some basic make file things and then I typed file things and then I typed file things and then I typed Explorer.exe which then opened explorer Explorer.exe which then opened explorer Explorer.exe which then opened explorer inside of WSL and I dragged the newly inside of WSL and I dragged the newly inside of WSL and I dragged the newly created Mario game directly into my the created Mario game directly into my the created Mario game directly into my the surface of my Windows emulator. And uh surface of my Windows emulator. And uh surface of my Windows emulator. And uh and now I'm going to go and check out and now I'm going to go and check out and now I'm going to go and check out the Breakout game as well that you've the Breakout game as well that you've the Breakout game as well that you've got working.
-
got working. got working. And we actually have I actually uh the And we actually have I actually uh the And we actually have I actually uh the video I have a video on my LinkedIn. video I have a video on my LinkedIn. video I have a video on my LinkedIn. Somebody actually took the uh the Somebody actually took the uh the Somebody actually took the uh the Breakout game and actually it was Breakout game and actually it was Breakout game and actually it was running on real SNES hardware. Oh wow. running on real SNES hardware. Oh wow. running on real SNES hardware. Oh wow. So they dumped it somehow into the uh So they dumped it somehow into the uh So they dumped it somehow into the uh Yeah, they put it on a flat they were Yeah, they put it on a flat they were Yeah, they put it on a flat they were able to put on a flash call and run it able to put on a flash call and run it able to put on a flash call and run it on a real super a real Super Nintendo. on a real super a real Super Nintendo. on a real super a real Super Nintendo. Oh man, that's so cool. I'll include a Oh man, that's so cool. I'll include a Oh man, that's so cool. I'll include a link to that in the in the show notes. link to that in the in the show notes. link to that in the in the show notes. So uh we'll be able to see that. I see So uh we'll be able to see that. I see So uh we'll be able to see that. I see on your that on your LinkedIn right now. on your that on your LinkedIn right now. on your that on your LinkedIn right now. Fantastic. What fun you're having in Fantastic. What fun you're having in Fantastic. What fun you're having in your hour of free time each night, Matt. your hour of free time each night, Matt. your hour of free time each night, Matt. It's, you know, I I I This is so good. I It's, you know, I I I This is so good. I It's, you know, I I I This is so good. I can't actually have small projects. My can't actually have small projects. My can't actually have small projects. My brain doesn't let me do small projects. brain doesn't let me do small projects. brain doesn't let me do small projects. It's always big projects that nag me for It's always big projects that nag me for It's always big projects that nag me for months on end. There's nothing wrong months on end. There's nothing wrong months on end. There's nothing wrong with that. Not if those if those small with that. Not if those if those small with that. Not if those if those small projects allow me to write C on uh in projects allow me to write C on uh in projects allow me to write C on uh in modern day C on a on a Super Nintendo, I modern day C on a on a Super Nintendo, I modern day C on a on a Super Nintendo, I think that's that's worth it. So, I think that's that's worth it. So, I think that's that's worth it. So, I appreciate your service and certainly appreciate your service and certainly appreciate your service and certainly those that uh whose shoulders we stand those that uh whose shoulders we stand those that uh whose shoulders we stand on top of. Thank you so much, Matthew on top of. Thank you so much, Matthew on top of. Thank you so much, Matthew Shapiro, for hanging out with me today.
-
Shapiro, for hanging out with me today. Shapiro, for hanging out with me today. Thank you for having me. It's been a Thank you for having me. It's been a Thank you for having me. It's been a pleasure. This has been another episode pleasure. This has been another episode pleasure. This has been another episode of Hansel Minutes and we'll see you of Hansel Minutes and we'll see you of Hansel Minutes and we'll see you again next week. again next week. again next week. [Music]
Summary
This episode of Hansel Minutes features Matthew Shapiro discussing his passion project of creating a C library to build Super Nintendo ROMs, which unexpectedly gained significant traction online. The discussion highlights how hobbyist coding can spark unexpected community engagement and even lead to open-source contributions. The takeaway is that sharing your work, even casually, can lead to surprising outcomes and the formation of enthusiastic communities around your projects.