![]() ![]() You might think those programmers back in the days are code wizards that are doing these things to simply show off their programming chops. If such pacing are not emulated, programs might not work correctly, when they expect certain order of events when running in real hardware. įor APU, it means output square waves using values set from registers, etc.įor PPU, it means drawing background and sprites based on PPU RAM. ![]() They communicate to each other in real time, run at their own pace that is proportional to a “master clock”, and go about doing its work:įor CPU, it means executing instructions. There is one more thing that isn’t obvious if you haven’t thought about it before - all the hardware (CPU, APU, PPU) runs in parallel. Player interaction with the system is also through the controller which only CPU can interact and read its value. Even though other components also does its own function - they are fundamentally driven by interaction with the CPU. But it’s easy to see that CPU is really the main one that drives the execution. Once you press start, game loads more data into PPU, run the main game loop, and respond to your inputs accordingly Ĭode waits for your input to make selection and start in the title screen.Ĭode starts to read its ROM data and writes to APU registers - this gets you the wonderful 8-bit sound.Ĭode starts to read its CHR ROM and write data into PPU to show you a title screen.Let’s take a look at what happens when you insert a cartridge into the system:Ĭartridge maps its ROM contents into RAM / 16-bit address space Basically, given the input, you’ll need to implement the middle blackbox that gives the exact output. The more common approach is to replicate only the behavior that is observable to the software (the games) and the player. Such people are rare these days (I’m certainly not one of them). Just imagine - you are no longer debugging code, but actually debugging your table to find the ‘missing/incorrect wire’, making this impractical for most emulation authors, other than the electronic hacker/software engineer wizard. And writing such code and debugging such tables is going to be extremely hard. However, it is probably not too hard to imagine such approach might not have desirable performance. ![]() One can imagine once you have the entire hardware mapped out to transistors as a table, the entire simulation can be completely table driven. For example, has javascript based simulation that simulates 6502 CPU in this manner. In theory, one can build a simulator that exactly replicates the hardware behavior on transistor level. Now it’s time to dive a bit deeper to see how we write the main loop to drive the emulation.įundamentally, a emulator is a software that attempts to replicate the behavior of hardware. In last post I’ve talked how one would start writing a emulator. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |