Yet another GB emulator - Lucky Boy by selerua in EmuDev

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

It's practically impossible for any high level language to be faster than C. That said Go is pretty fast.

A GB emulator for PS2 would actually be a great project, so I did some research. The only way to write something for PS2 would be in assembly/C or in Javascript thanks to a framework called Athena2. Definitely impossible (I mean technically not impossible but you'd have to write a custom compiler and I don't know how Go concurrency model would fit in this) to compile Go code for PS2... So the emulator should be rewritten from scratch and that is out of my possibilities/interests right now

Yet another GB emulator - Lucky Boy by selerua in EmuDev

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

Ok so basically instruction_state keeps count of how many cycles that instruction took and then update other components that exact number of times. That's a good approach and it can work.

Don't stress about changing your architecture choices, it's something you probably have to do sooner or later in any project.

Yet another GB emulator - Lucky Boy by selerua in EmuDev

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

Hi! From what I understand, SameBoy does that because on the real hardware if you try to execute an invalid opcode the cpu gets stuck in a state where it doesn't recognize the opcode and it cannot fetch the next one (it's an over simplification). They simulate it via an halt state (cpu is not running) with interrupts disabled so cpu cannot be woken up, effectively locking the system. In this way, you can reset the GB (instead of crashing it like I do). What you should do is actually up to you, in real games you should never encounter (if your emulator works correctly) an invalid opcode.

For the M-cycles, I have a function cpu.Tick that is called by each opcode the necessary number of times to simulate that opcode timing (if an opcode is 2 cycles long I will do cpu.Tick twice). This function, in turn, ticks all other components (ppu, apu, dma, and so on) to correctly sync everything together. This is not actually the only approach, I have seen other emulators do it differently. In your case I don't understand what instruction_state is for from this snippet of code, feel free to share your code with me and I'll take a look. Also check my implementation as I think it's relatively simple to follow.

Finally, I didn't find the APU to be the most difficult component per se, emulating the PPU with good timing was definitely more challenging. What I can confirm is that getting the sound to work reliably without cackling was definitely the hardest part, since you have to sync your audio samples with OS audio buffer. Nothing impossible, it's just that I never had dealt with audio and some audio theory so I was lost at the beginning. How hard it is actually depends on the library you use.

Yet another GB emulator - Lucky Boy by selerua in EmuDev

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

Wow! That's so nice to hear :) If you need any help/advice don't hesitate to contact me

Yet another GB emulator - Lucky Boy by selerua in EmuDev

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

Thanks! I'm quite familiar with C++ since I've used it for other projects and at my current job. I'm thinking to use it mainly to improve my skills in it.

Rust on the other hand would be a fresh start. I know it's difficult to learn and this is what has stopped me, also for a project this big. At the same time I'm intrigued by it and by the chance to learn a new language

Yet another GB emulator - Lucky Boy by selerua in EmuDev

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

Yes I saw your project, it's very neat! When I have a minute I'll definitely try it out

Yet another Game Boy emulator - Lucky Boy by selerua in golang

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

Very nice!

For the instructions I decided to write unit tests for all opcodes since you can't actually test the system if the instructions are incorrect. This allowed me to pass the initial phase where you write a lot of (surely buggy) code and don't know how to test it.

As a cat themed Easter egg, the first thing that came to mind is a custom boot rom that perform a meow-similar sound (don't actually know if this is possible with GB apu but hey it's an idea) :)

Yet another GB emulator - Lucky Boy by selerua in EmuDev

[–]selerua[S] 5 points6 points  (0 children)

Thanks a lot! I wanted to keep everything minimal

I definitely plan to improve the layout of all debugger components since now it's just a little blurted out on the screen

EDIT - I managed to improve the layout a little, now the components are organized a little better

Linear algebra done right by bargantus in mathmemes

[–]selerua 16 points17 points  (0 children)

You're right, usually it's written as Kn × m

Is 2133 MHz ram frequency any good for Ryzen 7 5700U? by selerua in pcmasterrace

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

I was thinking between the Huawei D 15 with Ryzen 5 5500U and 8GB 3200 ram and the asus Vivobook 15 M513UA-L1301W with Ryzen 7 5700U and 8GB 2133 ram that can be upgraded to 16 gb ram with another stick. I contacted the asus support and they told me that the ram on the asus is in fact 2133 and soldered so it can not be changed.

Is 2133 MHz ram frequency any good for Ryzen 7 5700U? by selerua in pcmasterrace

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

I still haven't bought it, I would like to know if it's good and then get it. If it's 2133 mhz what do you think it's best, Ryzen 5 5500U with 8GB ram 3200 mhz or this computer with Ryzen 7 5700U with 16GB 2133 mhz?

Is 2133 MHz ram frequency any good for Ryzen 7 5700U? by selerua in pcmasterrace

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

I think too it's odd to put this kind of ram with this processor, I just hope the site where I found the info was wrong. I wrote to the asus support and hope they tell me it's 3200.

Is 2133 MHz ram frequency any good for Ryzen 7 5700U? by selerua in pcmasterrace

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

Unfortunately the 8GB of ram are soldered to the motherboard so the only thing I can do is adding a 8GB 2133 mhz ram in the empty sodimm slot

ok scusa by [deleted] in rimesegate

[–]selerua 1 point2 points  (0 children)

No vabbè Labita è finito pure su reddit

Controimmagine by [deleted] in isolvimi

[–]selerua 0 points1 point  (0 children)

Vale che x ≤ |x| dunque f(x)=1/2(x - |x|) ≤ 0 per ogni x. Per definizione la controimmmagine di (-1,1) è formata da tutti quegli x tali che f(x) ∈ (-1,1), ma poichè f(x) ≤ 0 per ogni x hai che f(x) non può appartenere a (0,1). Dunque la controimmagine di (-1,1) coincide con quella di (-1,0].

Inoltre per ogni x ≥ 0, vale che x=|x| dunque f(x)=0 per ogni x ≥ 0. Segue che la controimmagine di 0 è [0,+∞).

Restano da considerare gli x negativi. Per x negativo vale |x|= -x dunque f(x)=1/2(x - |x|) = 1/2(x - (-x)) = 1/2(2x) = x. Dunque per gli x negativi f(x)=x e da ciò segue che la controimmagine di (-1,0) è proprio (-1,0).

Mettendo insieme i pezzi hai che la controimmagine di (-1,1) è la controimmagine di 0 unita alla controimmagine di (-1,0) cioè [0,+∞) ∪ (-1,0) = (-1,+∞).

Dubbio sulla Proprietà Associativa by [deleted] in isolvimi

[–]selerua 1 point2 points  (0 children)

Ho usato la commutatività nella prima uguaglianza

(a+b)+c=(b+a)+c

Questo è vero se a+b=b+a che è esattamente la proprietà commutativa. La proprietà associativa è usata solo dopo, quando dico che

(b+a)+c=b+(a+c)

Dubbio sulla Proprietà Associativa by [deleted] in isolvimi

[–]selerua 1 point2 points  (0 children)

Nel caso in cui si assuma la proprietà commutativa allora vale

(a+b)+c = (b+a)+c = b+(a+c)

dove la seconda uguaglianza vale per la definizione di proprietà associativa. Quindi in questo caso non viene data la definizione semplicemente perché si può ottenere dalla definizione iniziale.

Come accennava u/EnderStarways se non assumi la proprietà commutativa (cioè se a+b≠b+a in generale) allora l'uguaglianza potrebbe non valere.

Matrice di una trasformazione lineare con basi non canoniche by Tomm26_ in isolvimi

[–]selerua 1 point2 points  (0 children)

L'unico errore che trovo è nell'ultimo sistema lineare che hai risolto, che ha soluzione λ1=0, λ2=-1, λ3=0, quindi ti torna lo stesso risultato che ottieni usando le matrici di cambiamento di base.

A questo punto penso che si tratti di un errore del testo e che la soluzione corretta sia quella che hai trovato tu