NES Emulator Part #7: More About Mappers

Ғылым және технология

In this video, I look at how I've implemented NES Mappers 0, 1, 2, 3, 4 & 66 as part of my NES emulator. Given this is part #7 its presented in a different style, and assumes you have watched the previous episodes.
Source: github.com/OneLoneCoder/olcNE...
Patreon: / javidx9
KZread: / javidx9
/ javidx9extra
Discord: / discord
Twitter: / javidx9
Twitch: / javidx9
GitHub: www.github.com/onelonecoder
Homepage: www.onelonecoder.com
Community Blog: community.onelonecoder.com

Пікірлер: 98

  • @gabrieljosereyesacosta7007
    @gabrieljosereyesacosta70074 жыл бұрын

    I nominate this as one of the best programming class/ lesson of the year

  • @somerandomchannel382

    @somerandomchannel382

    Жыл бұрын

    was the sound sorted out? SMB3 in demonic tunes was an.... experience :)

  • @zerobyte802
    @zerobyte8024 жыл бұрын

    Part 8 - I need it!

  • @johnforde7735
    @johnforde77352 жыл бұрын

    For other viewers, at 32:19, there is an error in line 201 on the screen. I believe that should be 0x1000 rather than 0x2000. I got Zelda 2 working with this change.

  • @oracleoftroy

    @oracleoftroy

    Жыл бұрын

    Thank you! Now my towns aren't invaded by monsters! Alternatively, you can left shift the bank by 1 (or divide it by 2) to put it in an 8k range. I'm thinking of scrapping my current version (or at least doing a third refactoring of this mapper), but I currently have it treat the 4k banks as 4k and 8k banks as 8k instead of treating 8k banks as two 4k banks.

  • @thomasmurphy8749
    @thomasmurphy87494 жыл бұрын

    Great! I was beginning to fear that you had abandoned this series. Excited to keep learning more while I develop my emulator in parallel :) This is one of the best resources on the NES that I've seen.

  • @javidx9

    @javidx9

    4 жыл бұрын

    Thanks Thomas, certainly not abandoned, but I (and most of my audience XD) needed a short break from NES for a bit. I definitely have at least one more left, finishing up the sound, but it will be mixed in with normal videos. I'm unsure after that, I may do a quick one about save states, and user interfaces.

  • @GeneralAtrox1

    @GeneralAtrox1

    4 жыл бұрын

    @@javidx9 perhaps a video on theory crafting improvements you could consider adding to the NES emulator to improve the experience? Whether its adding post process effects like scanlines, texture filtering, Super Eagle, netplay, or... how did those devs make the NES 3D? (Vid for ref: kzread.info/dash/bejne/Zmqf2sVpY7qZZ9o.html)

  • @Nob1ej0n
    @Nob1ej0n3 жыл бұрын

    It's taken me ages, but I've finally caught up with this series. Not just in terms of watching it, but I've also got my own emulator now with everything but sound working! Thank you so much for this series. It was a great resource and a fantastic barometer for how far my understanding had come. More than once I had to stop a video halfway through and take a few weeks to catch up before I understood enough to finish the video. It was so much fun each time to feel like the information that used to be Greek to me suddenly seem simple! This has been a wild and enjoyable ride. Thank you so much for doing this series, and a ton of other interesting programming projects! I love your channel, not just this one series. Haha

  • @javidx9

    @javidx9

    3 жыл бұрын

    Lol thanks Jon, it's fun building an emulator huh?

  • @Nob1ej0n

    @Nob1ej0n

    3 жыл бұрын

    @@javidx9 Haven't had this much fun in years! And dev is my day job. Haha

  • @figloalds
    @figloalds4 жыл бұрын

    Awesome, such high quality and deep knowledge shared 👏

  • @javidx9

    @javidx9

    4 жыл бұрын

    Cheers Felype!

  • @tunit6458

    @tunit6458

    2 жыл бұрын

    +

  • @mrflamewars
    @mrflamewars4 жыл бұрын

    One of the neatest MMC3 tricks is switching frames of animation out in real time in games like Super Mario Bros 3, the animated tiles on the world maps and the scrolling question mark blocks are all using the MMC to page the blocks of animation without involving the CPU doing it directly.

  • @speedyc88
    @speedyc884 жыл бұрын

    Hello! Javidx9, I just watched part 7 of your NES Emulator series. With great Interest, this series is an epic just like a good book it leaves me wanting more, or anyone else who has been watching this great series. Javidx9, I hope this video series never ends, or you may decide to create NES Emulator 2.0 one day LOL. All the best from ‘Speedy C’

  • @tzisorey
    @tzisorey3 жыл бұрын

    I like how you can tell from the reflection in the door behind him, that he's "talking with his hands", but you don't actually have them in-shot.

  • @gmaz6687
    @gmaz66874 жыл бұрын

    With these videos you are making real not only your dream but also the dream of thousands of people like you. Thank you a lot, this is the best nes emulator series tutorial.

  • @gertjohansen4849
    @gertjohansen48498 ай бұрын

    I know this is an older series, but I have just watched it (repeatedly) and I'm very impressed. Very good explanations. With the information given in this series, I managed to create my own emulator in C# and WPF using the NAudio library for sound. I made it more modular, so I have a library with just the bus and CPU and some baseclasses for devices. Then I made the emulator, by adding the Cartridge, PPU, Apu and Controller as classes inheriting from DeviceBase. This way I should be able to create a C64 emulator, based on the same framework, if I ever feel confident enough to take it on ;) I did end up copy/pasting some of your code and rewriting it in C#, because some of the more technical details were too complicated for me. But I gain more and more understanding of it, the more I mess around with the code. For me, the PPU was the hardest to understand. The sound gave me some problems as well, but once I could see, that my sample-value was the same as yours, I could focus on NAudio and figure out how to output it correctly. If I understand correctly, your sound implementation gets 1 sample at the time? NAudio wants 6615 samples at a time (with the default samplerate and 1 channel), so I just needed to keep clocking until I had all the samples and not only 1. So all-in-all... Awesome job. I really enjoyed the very detailed explanations and drawings.

  • @ConfusedNDazed
    @ConfusedNDazed2 жыл бұрын

    Getting back to my Emulator after leaving it for a couple of years, abandoned after not being able to fix a colour issue in Super Mario Bros and scrolling. Still haven’t fixed it, but am moving on to mappers so I can test some different side scrolling games to see if that helps locate the bug. This video is so clear in how to translate those nesdev mapper pages to code that i think i can probably complete the same mappers in a weekend. Just taking your explanations and not the code, like to work out the code side myself. Also I really like the way your code uses a bus, seems so obvious to me now to use a bus class, but it didn’t when I started.

  • @irene1307
    @irene13074 жыл бұрын

    New video - insta-like. Great content always

  • @valeyard93
    @valeyard934 жыл бұрын

    Great info. I'd implemented an Atari 2600 emulator last year and it uses bankswitching as well. I started working on a NES emulator when you came out with your series. I have a few mappers working there as well.

  • @ConfusedNDazed

    @ConfusedNDazed

    4 жыл бұрын

    Jordan Hargrave I’m wanting to do a 2600 emulator next but haven’t found much information, do you have any good resources ?

  • @valeyard93

    @valeyard93

    4 жыл бұрын

    @@ConfusedNDazed Stella programmer's guide (atariage.com/forums/applications/core/interface/file/attachment.php?id=594256) gives detail of the register and I/O ports. Also the Atari 2600 programming for Newbies has some sample kernels with very basic code to make sure you get the display working. www.randomterrain.com/atari-2600-memories-tutorial-andrew-davie-08.html

  • @esabaliauskas
    @esabaliauskas3 жыл бұрын

    wow, this is amazing!

  • @mohammednihad6755
    @mohammednihad67554 жыл бұрын

    Thanks a lot for all the effort you put in your tutorials, God bless you 💙 But where is the source of part #6? ☹️

  • @ultraman6950
    @ultraman69502 жыл бұрын

    Looking forward to the Switch one.

  • @johnforde7735
    @johnforde77352 жыл бұрын

    Great series. I have followed along and built a NES emulator in Swift for iOS and Mac. I did the sound quite differently to use Cocoa audio libraries, (however, it's not sounding that great). It was an effort to get the performance. Swift uses reference counting (like smart pointers) to manage your memory, which can cost if you aren't careful.

  • @ConfusedNDazed

    @ConfusedNDazed

    2 жыл бұрын

    I am also doing a NES emulator in Swift. I did a synthesizer in Swift a few years back and found that both AVAudioEngine and Swifts ARC (as you mention) really mess with Audio Programming. I was hoping to hook up the synth to the Emulator in a similar way to Javidx9, but I don’t think that is going work unless I drop down to Audio Units and C++ for the APU. Swift performance has been a big disappointment when working with both Audio and Emulators, and when you combine them 😭

  • @johnforde7735

    @johnforde7735

    2 жыл бұрын

    @@ConfusedNDazed For a start, you need to compile in release mode to get anything going with any performance and you should use the time profiler performance to see where you are getting performance hits. I found that using a protocol for the mappers was a big hit, so I removed that. I used classes for everything and put some time in writing an efficient loopy register, which is a struct. I get 60 fps on my 8 year old 4 core Mac and 75 - 80 fps on my new iPhone (before I lock it to 60fps). I got audio sounding a lot better now. I use AVAudioEngine as well and circular sample buffers.

  • @ConfusedNDazed

    @ConfusedNDazed

    2 жыл бұрын

    Yes I'm in Release mode, my day job for past 10 years is as an iOS App developer. I must admit that I find Xcode's Profilers quite difficult to use, compared to the old command line prof tools I used 20 years ago on unix platforms. I recently got a big speed boost by doing two things. I added @inline(always) to all of of my frequently called functions in the CPU and PPU, and I found a place where I was allocating 8 bytes of memory for the Sprites each frame (rookie mistake). I did try converting from reference types to value types for the CPU and PPU, but go change in performance. My main complaint is around my Synth which seems to struggle using AVAudioEngine, I get noticeable static when more than one note is playing, which I believe is due to Swift performance issues, Apple advises not to use Swift in the real time buffer generation code. I have done things like caching AVPlayerNodes and using Neon commands in my loops. I ended up just buying a Behringer synth in the end and putting the Swift one away. But I will get back to it soon when I start the APU, hopefully it will be a case of fresh eyes finding an obvious bug and not have to drop down to C++ or lower level Audio frameworks.

  • @johnforde7735

    @johnforde7735

    2 жыл бұрын

    @@ConfusedNDazed Well, I did get quite a bit of static with audio, but it is a lot better now. This is my buffer code, which I stole from some article online: final class AudioGenerator { private var length: UInt32 var sourceNode: AVAudioSourceNode! var sampleBuffer: ApuSampleBuffer init(length: UInt32) { self.length = length sampleBuffer = ApuSampleBuffer(audioLengthSamples: length) sourceNode = AVAudioSourceNode { _, _, frameCount, audioBufferList -> OSStatus in let ablPointer = UnsafeMutableAudioBufferListPointer(audioBufferList) for frame in 0..

  • @ConfusedNDazed

    @ConfusedNDazed

    2 жыл бұрын

    @@johnforde7735 I really really appreciate you posting your code. I think I can see why this works better than my code, the use of

  • @mrflamewars
    @mrflamewars4 жыл бұрын

    The bank switching hardware inside NES/Famicom carts really saved the system from being a historical footnote. The original Super Mario Bros was supposed to be the biggest possible cart game and would have been had it not been for the "Multi Memory Controller" or "Memory Management Controller" or whatever it's supposed to be. I always wondered as a kid why Super Mario Bros. 3 was so much more sophisticated than Mario 1. The answer is it had an MMC3 and Extra RAM in the cartridge.

  • @jaysistar2711
    @jaysistar27118 ай бұрын

    At the beginning, the dog that's probably staring at him can be seen in the reflection. Interestingly, the Turbo Grafix 16 (PC Engine) carts are small, and more like cards, and I haven't seen any of them use mappers at all. The NES and Famicom used them quite a bit, but the Famicom Disk System, like the HuCard of the TG16, couldn't add any hardware beyond the Nintendo RAM cart, which did add another sound channel, and because you had the disk, you could read contents into the extra RAM to use them like banks, although that couldn't be done very quickly. There also was nothing like the SMB3 virtual vertical space with mapper made horizontal scrolling.

  • @Niko-ex3bn
    @Niko-ex3bn4 жыл бұрын

    You got a sub from me. I have concidered working on an NES emulator as my next project after I finish up adding features to my gameboy emulator and fixing bugs. I shall likely use these videos as a reference point and in case i have difficulty understanding some concepts.

  • @demolitionist42

    @demolitionist42

    3 жыл бұрын

    What should I start emulating if I am new to this? I'm comfortable with C++

  • @Niko-ex3bn

    @Niko-ex3bn

    3 жыл бұрын

    @@demolitionist42 Mmm, Chip-8 is a very good start. Its fairly simple to get started with and gives a good foundation on how to emulate more complex systems.

  • @supersquare
    @supersquare4 жыл бұрын

    The legend returns!!

  • @arthurvin2937
    @arthurvin29372 жыл бұрын

    This reminds me how far from the roots I have drifted, being a Java EE developer for 10 years. The lack of understanding of low level machinery hits you hard later in career. Considering that Java is relatively low level compared to some Python or PHP - RIP Python and PHP developers.

  • @johneygd
    @johneygd4 жыл бұрын

    Am curious if the mmc3 chip could also optionally hijack the nes cpu to allow multi scrolling backgrounds via tile updates on the fly trough the extra added video ram ,because multi scrolling overlaping backgrounds are seen in games such as metal storm,buki o hare, i know that games such as ninja gaiden 3 and batman rtoftj uses line scrolling for paralax scrolling effects, THX alot.

  • @yokrysty
    @yokrysty3 жыл бұрын

    Love this series, best content so far. Will you continue the series?

  • @javidx9

    @javidx9

    3 жыл бұрын

    Thanks! I have put together material for a sort of "finishing off" video, but the core emulation is verbosely described by this point.

  • @jdunlap1974

    @jdunlap1974

    3 жыл бұрын

    @@javidx9 I actually wish that you would finish off the APU portion. You had said there was going to be another part to put it all together, but we haven't seen that yet.

  • @bobapplemac

    @bobapplemac

    11 ай бұрын

    ⁠@@javidx9 I would also love to see the 2nd APU video!

  • @wadimajason
    @wadimajason4 жыл бұрын

    good serie, your house looks like Resident evil house hehe

  • @razcodes
    @razcodes4 жыл бұрын

    Are you using a graphics tablet for One Note? If so, which model? Thanks!

  • @aliusa6327
    @aliusa63274 жыл бұрын

    thanks 👍 you are awsome

  • @vcokltfre
    @vcokltfre4 жыл бұрын

    This seems to happen to me all the time, just yesterday I found the NES Emulator series and a few months after the last part within a couple of days there is a new video... It happens all the time to me... Well, I'm sure it will be good

  • @Omnituens
    @Omnituens4 жыл бұрын

    In the Game Boy the lower half of the address space is ROM, and usually bank 0 is fixed into the lo half of that. The NES and Game Boy share quite a lot of features, but it seems mapping was flipped on its head for the Game Boy, maybe because of the Z80-esque chip in it? Or because the zero page/stack of the 6502 in the NES warrented the need to use the upper part of the address space for ROM, and for the Game Boy they thought it was better the have lo be ROM?

  • @sakealex
    @sakealex4 жыл бұрын

    bless you sir

  • @zilidavid373
    @zilidavid3732 жыл бұрын

    Hello!I've been trying to follow your video to code my own Emulator. It seems that Mapper66 is incorrect? The game, DragonPower, is loading the wrong background tiles. But according to Nesdev I don't think you got it wrong, so what could be the problem?

  • @benjaminentertainment5526
    @benjaminentertainment55264 жыл бұрын

    This is so cool! Its like making an nes classic all by yourself! Just wondering, is it possible to make an emulator for ps1 as well? What's the difference between nes and ps1 emulators?

  • @NethTech

    @NethTech

    3 жыл бұрын

    Difference between nes and ps1 emulators is literally the difference between a nes and a ps1. Entirely different, Albeit the same methodology for development

  • @KevinMcgaw1988
    @KevinMcgaw19884 жыл бұрын

    Would be awesome to see a nice nes emulator for ps vita and support touch feature and can play games like duck hunt

  • @libb3n
    @libb3n4 жыл бұрын

    Finally!

  • @pedrolopez3830
    @pedrolopez38304 жыл бұрын

    You always make me to abandon de couch and go straight to programming, for that huge thank you ♥️

  • @javidx9

    @javidx9

    4 жыл бұрын

    Sorry XD its also late on a Sunday night too!

  • @qwerasdfhjkio

    @qwerasdfhjkio

    4 жыл бұрын

    @@javidx9 I mean... Time zones exist xD

  • @pedrolopez3830

    @pedrolopez3830

    4 жыл бұрын

    @@javidx9 don't worry, I'm from Chile so here it's really early, about 7 pm now, and the sun sets at 10pm so I still have some time ahaha

  • @ConfusedNDazed
    @ConfusedNDazed4 жыл бұрын

    I’m going to be that guy. Are you going to do part 2 of the APU ? It was so interesting, almost as good as the PPU video.

  • @javidx9

    @javidx9

    4 жыл бұрын

    I will be yes. Barely covered the APU in that video, it was more about integrating sound into a real time application.

  • @ConfusedNDazed

    @ConfusedNDazed

    4 жыл бұрын

    javidx9 awesome, looking forward to it. I quite liked this one too as there isn’t a whole lot of good info on how to implement mappers available.

  • @timbodyne
    @timbodyne3 жыл бұрын

    Just curious as to whether or not you're planning on publishing the next episode in this series?

  • @javidx9

    @javidx9

    3 жыл бұрын

    There's not much left to show? Other than a GUI to load roms, noise channel is just noise. The triangle channel is interesting but not enough for a specific video. I'm happy you've enjoyed it so far, but it's finished isn't it? Maybe it does need a conclusion of sorts 🤔

  • @timbodyne

    @timbodyne

    3 жыл бұрын

    @@javidx9 I guess in a way it is, although I was hoping to see more in the way of the "finished product". I have to say that your project has shown me that the NES was a far better product for delivering console software than I originally thought! And my complements to you and your engineering prowess as well. You demonstrate an ease and facility with problem decomposition and refactoring that is just, well, fun to watch. All the best!

  • @javidx9

    @javidx9

    3 жыл бұрын

    Hey thanks man, that's very kind. I will seriously consider a conclusion for the series. It would be good to bookend it!

  • @vaendryl
    @vaendryl4 жыл бұрын

    cool to see you created the whole vid just the day before lol. was hoping the 7th episode was going to continue on the subject of sound. oh well

  • @ConfusedNDazed

    @ConfusedNDazed

    4 жыл бұрын

    vaen dryl me too, was hoping for sound part 2

  • @aqmf2424
    @aqmf24244 жыл бұрын

    Aw yiss

  • @philtoa334
    @philtoa3344 жыл бұрын

    NiCE , nice .

  • @gabochoa553
    @gabochoa553 Жыл бұрын

    I need some help bro , I want to change the Mapper of master fighter vi in order to make run this game on everdrive n8, can you help me?

  • @ZomB1986
    @ZomB19864 жыл бұрын

    48:17 Bug found: Line 93, 95, 100, and 102: you must use inclusive-OR instead of addition to prevent corruption of the bank registers in the same spirit as the masking in the lines directly above. Github link: github.com/OneLoneCoder/olcNES/blob/1db7fcad56591d22de36300b53da603a7c996125/Part%20%237%20-%20Mappers%20%26%20Basic%20Sounds/Mapper_004.cpp#L147

  • @narekhovsepian4552
    @narekhovsepian45524 жыл бұрын

    Hello, how can I run the games, please tell me!

  • @racheljacobson1993
    @racheljacobson19934 жыл бұрын

    This is cool, would be great to build an emulator for DOS games, I think there's only 1

  • @_polpon

    @_polpon

    4 жыл бұрын

    We have DOSbox which is damn near perfect! I guess that it's very hard to build a emulator for DOS games since there's so many peripherals (sound cards, graphic cards, multitude of controllers which have different specs), the DOS era was just....very bad when it comes to standard configurations, you could have many graphics cards that each had to be configured and treated differently, it's just a mess and much harder than emulating any more specific-purpose system like the NES. I know that I'm a bit pessimistic, but I remember how hard it was just to get things working those days, and that's with a fully functional perfect DOS which was DOS itself :), don't let that get you down though, if you are really in to it, then you might succeed. If you do it better than DOSbox I will be the first to applaud you :)

  • @hayefahayefa4874
    @hayefahayefa48744 жыл бұрын

    greeeaat

  • @asas-dz4uf
    @asas-dz4uf2 жыл бұрын

    i get error compiling olc2C02.cpp error: use of deleted function 'olc::Sprite::Sprite(const olc::Sprite&)' after part 3

  • @mqxim630
    @mqxim6304 жыл бұрын

    Лайк однозначно

  • @josephwoodrell9922
    @josephwoodrell99224 жыл бұрын

    your cats reflection in the window behind you ;)

  • @lusiaa_
    @lusiaa_4 жыл бұрын

    I wanted to go to sleep in order to wake up easily for school tomorrow... but eh, that can wait

  • @Whateverworksism

    @Whateverworksism

    4 жыл бұрын

    I feel the same but for me it's work instead of school. The scenario is practically the same though, we can't stay away from another Javid video! Why sleep when we can learn? :D

  • @lusiaa_

    @lusiaa_

    4 жыл бұрын

    @@Whateverworksism Exactly!

  • @jimmymartinez1676
    @jimmymartinez1676 Жыл бұрын

    thank you, awesome, but olcNes #8 :(

  • @code-dredd
    @code-dredd4 жыл бұрын

    @14:55: The destructor in the pure virtual class (i.e. interface) should be virtual.

  • @diederickfloor4261
    @diederickfloor42614 жыл бұрын

    Can you talk about hyperoperations and how you would design such a algorithm. en.wikipedia.org/wiki/Hyperoperation

  • @Bluresco
    @Bluresco2 жыл бұрын

    I have a big problem, I want to record a nes hack with mapper 90, super mario world, but it is impossible for me, due to the mapper, is there any way to modify the mapper 90? any advice?

  • @RoyalOats23
    @RoyalOats234 жыл бұрын

    Second/Third

  • @goshisanniichi
    @goshisanniichi4 жыл бұрын

    Gamepads and joysticks etc. are a pain in the butt, but it would be cool if you eventually added support for modern controllers.

  • @javidx9

    @javidx9

    4 жыл бұрын

    The controller extension for PixelGameEngine supports ps4 and xbox controllers. Adding modern controller support is the easy bit, but the console only cares about the buttons it expects to see in hardware.

  • @belstar1128
    @belstar11284 жыл бұрын

    Hey what is nes radio?

  • @neefofway8746
    @neefofway87464 жыл бұрын

    8th lol

  • @Blonder_Studio
    @Blonder_Studio Жыл бұрын

    Nintendo: im about to end this man's whole career

  • @SuperTyroneGaming
    @SuperTyroneGaming4 ай бұрын

    Try To Code A Wii u Emulator For Android

  • @SuperTyroneGaming

    @SuperTyroneGaming

    4 ай бұрын

    And make That You Don't have to get any roms

  • @Vincent_007
    @Vincent_0074 жыл бұрын

    I watch your vidoes but i don't know what you do

Келесі