MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Pages: 1

tommygamer
MAME Fan
Reged: 05/06/23
Posts: 6
Send PM


emulation code: where to start?
#396205 - 05/09/23 04:08 AM


Hi

I wrote a CHIP-8 emulator in Python, just because of the ease of use of this language.

I understand how CHIP-8 works and understand the very basics of emulation.

Now I want to take a small step further.

I have several questions:

- what system or arcade game should I look at?
Some say you can try to implement a game boy emulator but when looking at it, it was much more complex. Is there something which is closer to CHIP-8 in terms of number of opcodes and small complexity?

- what is the most easy to understand arcade game in MAME in terms of emulation? I mean the most easy to understand hardware and its code translation. What source files I should look at.

- do you know guides online on how to learn the hardware of the example I ask above? And specific how to translate a pcb schematic into code (I'm complete hardware beginner)

- is it recommended to use a non-object oriented code (as MAME's C in the start of the project) or immediately start object oriented code, when learning to write emulation code?
So in other words: does it HELP to write object oriented code for the emulation specific learning process?

(I know C/C++/C#)

Edited by tommygamer (05/09/23 04:20 AM)



AJR Hacker
MAME Developer
Reged: 02/01/16
Posts: 144
Send PM


Re: emulation code: where to start? new [Re: tommygamer]
#396229 - 05/11/23 06:18 AM


> Hi
>
> I wrote a CHIP-8 emulator in Python, just because of the ease of use of this
> language.
>
> I understand how CHIP-8 works and understand the very basics of emulation.
>
> Now I want to take a small step further.
>
> I have several questions:

...

> - do you know guides online on how to learn the hardware of the example I ask above?

CHIP-8 is an example of a virtual machine. While virtual machines are great for learning how to program in low-level languages, virtual machines are abstractions that tend to obscure the hardware of the actual machines they run on. The more popular virtual machines have been reimplemented on many host architectures, and implementation details often leak through and cause incompatibilities on different host systems. See this comment in particular: https://github.com/mamedev/mame/issues/9246#issuecomment-1028161396

MAME generally does not emulate virtual machines themselves. However, emulating any actual piece of hardware that runs a virtual machine is entirely within scope, even if that hardware was custom-designed for that purpose and no other.



tommygamer
MAME Fan
Reged: 05/06/23
Posts: 6
Send PM


Re: emulation code: where to start? new [Re: AJR Hacker]
#396234 - 05/11/23 07:19 PM


I understand what you mean!
However I had chosen CHIP-8 because generally they recommend online this as the most easy starting point to learn emulation: you learn to make a cpu, registers, opcodes, ... and it's the most simplest form of any "emulation" (since it's a virtual machine)

So I learned this basic knowledge there. No problems there.

I see you don't reply to all my other questions.
Can I ask if you could have a look at them too?


  • Basically I'm now asking: what do I need to look at now?
    Online they say game boy is the next step up since it also shares a lot of the same features of the Z80 CPU that many MAME games use. They also say Z80 is an 'easy' CPU.

  • Would you recommend trying to make a game boy emulator too or would you point me to an arcade MAME game and what one specificly? What CPU or driver(s)?

  • Also I'm trying to find out how to learn converting PCB schematics into C/C++ (or other language code).
    What knowledge you need for this or is it better not even to START at this without having deep electronics knowledge (which I don't have at all).



Those 3 things I can't figure out myself so that's why I ask so somebody with experience can give me a "plan" to do to study all this and hopefully succeed in writing a full emulator (for just 1 arcade game or for a game boy or ...)


Thank you!

Edited by tommygamer (05/11/23 07:19 PM)



anikom15
Instigator/Local CRT Guru
Reged: 04/11/16
Posts: 287
Send PM


Re: emulation code: where to start? new [Re: tommygamer]
#396236 - 05/11/23 10:43 PM


I actually would start with the 6502. It’s such a slow processor that it’s very forgiving when it comes to timing, and it was about as ubiquitous as the Z80 was.



tommygamer
MAME Fan
Reged: 05/06/23
Posts: 6
Send PM


Re: emulation code: where to start? new [Re: anikom15]
#396242 - 05/12/23 07:31 PM


> I actually would start with the 6502. It’s such a slow processor that it’s very
> forgiving when it comes to timing, and it was about as ubiquitous as the Z80 was.

useless reply, as anything here on this noob infested forum...



anikom15
Instigator/Local CRT Guru
Reged: 04/11/16
Posts: 287
Send PM


Re: emulation code: where to start? new [Re: tommygamer]
#396244 - 05/12/23 08:00 PM


What kind of answer are you expecting? You asked what you should work on next. I gave you an answer. Do you want me to hold your hand and tell you exactly how to do it?

There are tons of open source Z80, 6502, 68K, x86 emulators available. All these processors are extensively documented. All of them are available for purchase, new or used, in some form today. Just pick one and do it. The first thing I would do is make a debugger. In my opinion, the 6502 and 68K are easier to work with than the Intel-based processors (Z80 is essentially an Intel 8080).

Let me give you some advice: don’t write people off in this scene. It’s a small community and if you make a fool of yourself people won’t want to help you. Give back more than you take, if you can.


Pages: 1

MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Robbbert, Tafoid 
0 registered and 288 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 425