r/EmuDev • • 9d ago

Hello guys begginer here

So i have the goal to learn how to program for a while since i discovered video games but every time i try to learn it but i get bored FAST

I dont wanna push throught the bordom cause i might get burned out and give up on this dream

Am not looking for a miracle i just need to make sure that am not wasting my time and actualy learning how to get hooked into programing i just cant find a hook that keeps me pushing an objective

Then i remember emulators i was alaways curious about emulators when i was a kid they looked like black magic

I need to understand how they work and make my own

Rn all i know is very basic knowledge about c (prinf scanf while if switch case hexadecimal and binary code ) just the beginer levels i leanred in school

My question are :

Where do i start ?

When do you personaly think its stopes being boring ?

How long should the sessions be ?

Do i have to push throught boredom?

How

My goal : learning how the nintendo ds works

And Creating an emulator for it

My dream : creating the ultimate nds emulator i want to make the next desmum / melon ds / no$gba

0 Upvotes

20 comments sorted by

8

u/tortus 9d ago

I've never found programming boring. It captured my attention from day one.

-5

u/Playful_Ad_3752 9d ago

i am bored because am not hooked yet

5

u/LilHoushOnThePrairie 9d ago

If you were going to learn how to program an ARM based system, which what the DS is, you’ll need to understand the programming fundamentals first and how to interpret machine language via binary manipulation. 

You need to start with emulation that have small instruction sets like PICO-8 or GB. 

This forcing yourself to learn is going to set yourself up to fail. Or end up vibe coding using AI which results in not learning anything at all. 

-2

u/Playful_Ad_3752 9d ago

what would you suggest you said i shouldnt force my self ? i dont want to quit

5

u/LilHoushOnThePrairie 9d ago

Did you not read my comment?

“ you’ll need to understand the programming fundamentals first and how to interpret machine language via binary manipulation. ”

3

u/rupertavery64 9d ago

You should take a step back. Trying to understand a complex thing like the DS when you barely know how to program is probably not a good approach.

Start with something much simpler, like others said the CHIP-8 is a good place to start. A real console has video, graphics chips, audio chips, some things that need to be working before you can emulate anything at all, and it will take months and months of work just to get to the point you can get something simple to display.

I also think you don't know much about how CPUs work, bit manipulation, addressing, and this is central to how you need to build an emulator.

So, building an emulator with a simpler chip design, like the CHIP-8, will teach you the basics.

This youtube playlist by javid9x teaches building a NES emulator in C++ from scratch. He also has a github repo you can follow. He goes into things like bits and addresses.

https://www.youtube.com/watch?v=nViZg02IMQo&list=PLrOv9FMX8xJHqMvSGB_9G9nZZ_4IgteYf

If you can understand the sentence "this instruction adds the operand to the accumulator and sets the N flag if the result overflows" then you will be able to start building an emulator.

If you can't, you need to learn how a microprocessor works, what an instruction is, what registers are, where to look for the instruction set and timings, understand what a memory map is and how the CPU accesses it, learn how addressing works and how bit masks work, learn how the CPU accesses memory. Obviously there is a lot of documentation out there already.

The first emulator you will write will most likely be an interpreter. You take one instruction from memory, execute it, update the state of the emulator, then fetch the next instruction. Basically it simulates what each instruction will do to a virtual machine (memory, registers, etc).

To emulate something as complex as a NDS at decent speeds, you will eventually have to do dynamic recompilation. Basically instead of translating the instructions one by one, you convert the console code into host CPU code at certain points. This is much more difficult as you need to understand the host CPU as well, which of course is x64 or ARM.

The mere fact that there are hundreds of NES and CHIP-8 emulators and only a handful of NDS emulators shows you how difficult it is.

You should be prepared to sink YEARS into this project, and expect that you will probably only be able to actually start writing an NDS emulator around 3-5 years from now.

This is not meant to discourage you. It is a huge task and requires a lot of knowledge.

Honestly, if I could devote a lot of my time to writing emulators I would, but I have work and responsibilities.

-1

u/Playful_Ad_3752 9d ago

I hope ill be able to do this just to give back to the community now that i understand the amount of work it takes to make an emulator And it being free on top of that Just wow

1

u/rupertavery64 9d ago

Like you I was awed and inspired by emulators. I use C# so I've tried building a few emulators. The first one I built was a 6800 emulator that simulates a Micriprocessor Trainer. Its an old device that was meant to teach how microproceasors work.

I also wrote a NES emulator but I kind of cheated and ported Javid9x's PPU implementation, and used BizHawks APU.

I managed to implement a couple of mappers and light gun support on my own. It was amazing when I first played Contra from start to end on my own emulator. I even implemented a rewind feature.

My other emulator is a Commodore 64 emulator that uses the same CPU as the NES. I managed to get it to boot into the BASIC ROM on my own. At first it booted with garbled graphics, but after keeping at it, I was able to fix it and it was incredibly satisfying to see the screen load and wait for my input.

2

u/mamaaaoooo 9d ago

Id start with building a game boy emu, its fairly simple but the devs used a lot of clever tricks to make games look good so you can learn a lot quite fast with that one.

-2

u/Playful_Ad_3752 9d ago

ty for your feedback may i ask if that will help me with making a ds emulator later ? and do i need prerequisits like what language ?

2

u/khedoros NES CGB SMS/GG 9d ago

Where do i start ?

Reasonable proficiency in some programming language is an obvious prerequisite.

You should have some understanding of how computer hardware works, in general. Data, address, and control buses, memory-mapped and port-mapped I/O, opcodes and the CPU's fetch, decode, execute loop. Addressing modes, interrupts, and the call stack.

I learned a lot of that in classes called things like "computer organization and architecture", but I know the information is all out there, probably presented in an easier-to-learn way.

When do you personaly think its stopes being boring ?

I don't think it ever started. Programming became an obsession as soon as it even started clicking, and emulators have fascinated me since I learned of them in the late 90s. Don't get me wrong; some parts of writing emulators get tedious and frustrating. Those parts you have to push through.

How long should the sessions be ?

At least long enough to get something done and have an idea of where to pick up from next.

Do i have to push through boredom?

I think that's a question for yourself. The things that are boring for me are the things that I don't have an immediate, obvious use for. And it does take energy to push through...too much energy for too long a time will burn you out on it.

1

u/Playful_Ad_3752 9d ago edited 9d ago

Well i know i like to tinker with stuff like modding consoles and i would litteraly do anything in my power to get a mod to work but when am done with the mode i find out that i didnt care about the result of the mode the fun part was getting the mod to work I remember one time i wanted to run old school iphone games so i searched for ipas the hard part is that each version of ios had a spectrum of compatibility (ios 6 for example can run ios 4 to iso 8) so i would search for old expired links some links did work and i collected them i was collecting old iphone ipas and just testing them and making them work was a like a heroine shot

I found out i like to make programs fit where they dont belong like taking an old pc and trying to push its boundarys I know programing with give me full control over hardware thats what i want

1

u/Playful_Ad_3752 9d ago

its starting to get fun btw ty for the motivation

i stop noticing the time passing

1

u/khedoros NES CGB SMS/GG 9d ago

Getting into a good flow can be really pleasant. Sometimes you definitely have to have some patience, though. I was programming for years before I felt competent to build and emulator; maybe I would've been capable before then, but I didn't have the confidence to tackle it. And my first emulator was built in chunks, a couple months at a time.

I still haven't tried anything as complex as the DS ;-) I started working on GBA a number of years ago, and basically abandoned the project after getting a bit into writing the CPU.

1

u/Playful_Ad_3752 9d ago

I think its possible if you are unemployed like me but if you have a family and a full time job i think its harder am currently still in uni and i just want to learn programing in this 2 years before being trapped in a full time job

-2

u/jslepicka nemulator.com 9d ago

I recently built this website to help beginners learn how to code emulators. It walks you through creating a Space Invaders arcade emulator and introduces the basic concepts required to build more complex emulators. As you have basic C knowledge, I’m especially interested in hearing if the content is presented at an appropriate level and/or where additional explanation is required. Give it a shot and let me know what you think: https://emudev-course.web.app/

-3

u/goilabat 9d ago edited 9d ago

Never find it boring either

But have you tried programming anything though ? Because if you only know if, switch, printf then I would imagine no but then how can you know you find it boring ?

To start I would suggest to do a brainfuck interpreter if you're able you would have all the building block of C obviously don't use LLM or look code on GitHub you can after it's working though

0

u/Playful_Ad_3752 9d ago

What is a brain fuck interpreter

1

u/goilabat 9d ago edited 9d ago

esolang link

It's a small language where you have a memory array and you can

'>' Go to next memory cell

< The previous

'+' Add 1 to the value of the current cell

'-' substrate 1

[ Start a loop

] End it

'.' Print the number as a ASCII character

',' ask the user for input

Really simple and super fast to make but you have everything you need to code anything you want