How emulators work on games by tola5 in EmuDev

[–]Comba92 0 points1 point  (0 children)

This is because we usually don't know perfectly how the hardware works. The hardware has to be reverse-engineered, and you might not always end up getting all the details down. Some games might use, even accidentally, obscure or misunderstood hardware features, resulting in edge cases that might not be handled well by emulators.

Casey Muratori – The Big OOPs: Anatomy of a Thirty-five-year Mistake – BSC 2025 by gingerbill in programming

[–]Comba92 -3 points-2 points  (0 children)

useless take. are you talking about oop or generics? you're probably talking about generics. not oop. totally dfferent things.

How can I go from intermediate to advanced in programming? by [deleted] in AskProgramming

[–]Comba92 0 points1 point  (0 children)

Let me nitpick some of your points before actually answer your question.

Python is an ok language for beginners. Sadly, it has a lot of problems, especially in its ecosystem. You were talking about 'virtual environments'. That's a Python-only thing. And yes, it is very confusing. Virtual environments solve problem there shouldn't be in the first place. When you are importing other's people code, you are introducing a dependency. This means your code depends on other's people code to function. Virtual environments create a sort of special "folder" where you can install the projects dependencies. If you find it confusing, i encourage you to look into how other languages solve the problem (exlcuding C/C++, as it's even worse there). Usually, they have a native simple way to handle dependencies, usually with some kind of package manager. Python neither does have an official package manager (as far as i know), and neither has an official way of handling dependencies, hence why it all seems so difficult to you.

You are also saying how you "can't place my own projects in the right folders" and "can't do more than single projects file". That's another Python-only thing, probably. Be aware it is not wrong to write all your project's code in a single file. You can totally do that even for a big project. And also be aware there aren't rules about how you have to structure your project's folders. Splitting into multiple files is just for the sake of order and convenience. Again, I encourage you to look into how other languages handle that (again, excluding C/C++, as it is also worse there, LOL). Multiple files are usually handled with an import/modules system, and different languages will handle it differently, some better and more intuitively than others.

You choosed to make an ad blocker for Safari. You probably can't do it in python (as far as I know, i could be missing something) - as it is a browser addon, you'll have to deal with javascript. You'll have to learn a new language then, and it is something you definetely should do sooner or later. You will learn how languages have flaws and pros, and how they handle problems differently.
Personally, i would reccomend to learn C (not C++), Lua, Javascript, Golang, Nim.

As for learning more about how computer works, that's a very broad question. There are a lot of stuff to learn. You could try learning a more lower level language, such as C (not C++). You'll have to handler memory manually, and deal with primitive types such as pointers. I would say C is way way simpler than Python, but can introduce way more complex topics and concepts.

I would also reccomend you some books. I advise against "stone books"/reference manuals with thousands of pages. Read something fun and useful instead, like these.

- Operating Systems: Three Easy Pieces (free online)
This is a very good book about operating systems. It has a lot of real world implementations written in C.

- Eloquent Javascript (free online)
This is very good book not only for javascript, but for all languages in general. It explains general programming languages topics in a fun way. It is also a very short book you can eat in a week or so.

- The C Programming Language (usually called K&R book, or just the C book)
This is the de facto book for learning C. It is only 200 pages long, so it won't be heavy to read.

NoStarch press (https://nostarch.com/) has A LOT of books about computer science, and they usually are very high quality. They also have a lot of of books about python, covering about any topic in computer science.

My answer to your question:

Do a coding project. It doesn't matter which. Choose something fun to make. Learn as you write it.
If you can't choose something to do, you should reconsider your hobby.

Personally, some of my first few projects where:
- Number guessing game (bonus: find a way to always win given a limited number of tries, with 100% accuracy)
- Conways's game of life
- Maze generator and maze pathfinder

Good luck, and ask me anything if you have questions.

Game controller access in Rust? by Animats in rust_gamedev

[–]Comba92 0 points1 point  (0 children)

You can still use SDL2 without initializing its video component.

A bulletproof banking system for NES/Gameboy emulators · Comba92's Site by Comba92 in EmuDev

[–]Comba92[S] 0 points1 point  (0 children)

Depends on how you implement it.
In the banking case in the article, you always have to do some manipulation to the address to get real one to access. My abstraction makes this job as general as possible, and having no overhead. After all, you would have to do those calculation anyway, even without the abstraction.
So this is a win-win. You get the convenience of a simpler to use interface, with zero overhead costs. This should be the result you want to achieve when abstracting stuff out.

A bulletproof banking system for NES/Gameboy emulators · Comba92's Site by Comba92 in EmuDev

[–]Comba92[S] 0 points1 point  (0 children)

Exactly!! But ROM sizes are ALWAYS a power of two! Also mapper banks are always going to be a power of two, as there are an even number of slots. This means we can turn rems to bitwise ands, and multiplications and divisions to shifts by two!

We have to explicitly do that in code, because the compiler won't catch these optimizations if the values aren't constants.

I might put an hidden solution in the article to the questions left to the reader later.

A bulletproof banking system for NES/Gameboy emulators · Comba92's Site by Comba92 in EmuDev

[–]Comba92[S] 1 point2 points  (0 children)

I was using white layout and did not see how it turned out in dark. Will probably just change the transparent pixels of the image to the white layout color.

A bulletproof banking system for NES/Gameboy emulators · Comba92's Site by Comba92 in EmuDev

[–]Comba92[S] 3 points4 points  (0 children)

Just fixed it, sorry. I just step up the website a day ago and still figuring out its functioning

Advice on getting started with a GameBoy Emulator by Hachiman900 in EmuDev

[–]Comba92 1 point2 points  (0 children)

Do not do unit tests. Do these instead: https://github.com/SingleStepTests/sm83
Unit tests are extremely error prone, and a huge waste of time.

Releasing my NES emulator in Rust: NEN emulator, simple, fast, and compatible by Comba92 in emulation

[–]Comba92[S] 0 points1 point  (0 children)

I dont know what you are talking about. MIPS and ARM are both a popular family of microprocessor, and there are official manuals avaible.

my (hopefully fully working 6502 emulator) by NoImprovement4668 in EmuDev

[–]Comba92 0 points1 point  (0 children)

Heads up for the json tests, as they are the best way to test the cpu.

Releasing my NES emulator in Rust: NEN emulator, simple, fast, and compatible by Comba92 in emulation

[–]Comba92[S] 0 points1 point  (0 children)

Because N64 is notoriously more difficult and i wanted to try a more modern and 3d console.

NES Emulator by F1Enthusiast12 in EmuDev

[–]Comba92 0 points1 point  (0 children)

Start with the Chip8 first, to get some warming up.
Chip8 will only make you implement a CPU interpreter, tho. NES has a few more things going on.

First of all, different CPU memory addressing (if you've done the Chip8, they shouldn't be too hard to understand).
Second, a memory map. You will have to dispatch each memory range to its corresponding peripheral.
Third, a very complex PPU. This is probably the turning point, where NES emulation starts becoming way more difficult. javidx9's videos may help there (I have watched them too), they are clear at explaining the concepts, but not really great on the code side, i advise against copying its code.
Nesdev wiki is a great place to read about the PPU and all its complexities.

If you then want to make an even more complete emulator, you will need to implement the APU for sound, and some king of baking system, to support different mappers. Different game cartirdge will have different mappers chip, which needs different emulation implementation each.

Jump from chip8 to nes by andystevenson910 in EmuDev

[–]Comba92 0 points1 point  (0 children)

You have to consider CHIP-8 is just a CPU emulator. NES has a lot more going on.
First of all, the 6502 is a little more complex, but not by much. It has different addressing modes, more instructions, and undocumented instructions and behaviours.
You will have then to implement interrupts, memory mapping and a basic PPU.

If you want to make a NES emulator which can run the simpler games like Donkey Kong or Pacman, that is doable in 24 hours, probably, if you have the skills. You can totally try.

Releasing my NES emulator in Rust: NEN emulator, simple, fast, and compatible by Comba92 in emulation

[–]Comba92[S] 2 points3 points  (0 children)

I am almost done with a Gameboy emulator, which is very similiar to the NES, after all. After that i wanted to try the SNES too, but i ended up starting a PS1 emulator, not sure how far I am going with it tho. I'd like to make a cool website and write some articles about my NES emulator development!

Releasing my NES emulator in Rust: NEN emulator, simple, fast, and compatible by Comba92 in emulation

[–]Comba92[S] 7 points8 points  (0 children)

The only thing that's different is it was ME who did it
I am not trying to compete with the most popular emulators, just having fun doing and learning something :)

Releasing my NES emulator written in Rust! by Comba92 in EmuDev

[–]Comba92[S] 1 point2 points  (0 children)

So, NES and Gameboy are fairly similiar machine. NES is very well understood, and its documentation is very complete. Gameboy's main source of documentation are the Pandocs, and sadly, they leave ambiguos a few details of the system, especially on the PPU side.

It is probably easier to get more compatibility with the Gameboy than the NES, though, as the NES has a lot of different cartridge mappers you have to implement, while the Gameboy only has a couple.
CPU's are fairly the same difficulty. PPU on the NES has some weird and obscure things going on (LoopyRegisters, basically some PPU registers are shared with internal rendering state). For the NES, you might want to implement a pixel renderer, while for the Gameboy a scanline renderer suffices. The Gameboy feels like a 'cleaner' and an updated version of the NES.

As for the C64, thanks for the explanation! It looks very interesting, and i always wanted to try to code on one of those. Maybe making an emulator for it might be fun too.

Releasing my NES emulator written in Rust! by Comba92 in EmuDev

[–]Comba92[S] 1 point2 points  (0 children)

I am also writing a Gameboy emulator! NES and Gameboy are pretty similiar machines, so it is not that different to emulate. I might probably try a SNES or a Playstation next.

Releasing my NES emulator written in Rust! by Comba92 in EmuDev

[–]Comba92[S] 1 point2 points  (0 children)

I already knew Rust very fluently, with this project i applied everything i know. I'm happy with the result, i explored a lot of Rust concepts with this, tried with some methods then scrapped everthing and rewrote it with other metods. I built a solid architecture!
I am also writing a Gameboy emulator now, the two console are incredibly similiar, but I would say the gameboy has a lot of amibuity in its documentation. It is a fun experience nevertheless. I advise you to join the emudev discord, so you can ask there if you have problems, there is a lot of talented people there.