Own emulator project, need alot of help!

AngelBass

New Member
Hi!

Im using emulator for quite a bit now and i would like to start one of my own, for sure as it is my first project i want to try on an old system like the master system,game gear or maybe even the atari or coleco, all i want to know is what tool do i need to start and where do i get the information i need. Im new to programming but i dont care putting alot of time working on this. If someone is already in the emulator scene and want to give me a hand it would be very appreciated, just post any information, link that could help me. anything will be very appreciated!
 

ExCyber

Staff member
Im using emulator for quite a bit now and i would like to start one of my own, for sure as it is my first project i want to try on an old system like the master system,game gear or maybe even the atari or coleco
You do not want to try to tackle the Atari (assuming you mean the 2600). It's hard enough just to program anything for it, let alone emulate it properly. In fact, the rest of those systems are all pretty similar. SMS and Game Gear are almost identical aside from how the palette is handled, and Colecovision uses the same CPU and a similar VDP. If you want a game that's really easy to emulate, Phoenix and Space Invaders seem to be best.

Im new to programming but i dont care putting alot of time working on this.
It's been said that you can't do an emu as your first programming project, but that's not true. If you've been into emulators long enough to remember ESNES, the author's page mentioned that it was his first real programming project.


That doesn't mean it will be easy, though. You've got a lot of stuff to learn:

1) General programming concepts: Programming is not intrinsically difficult, but it's difficult to really get things done without a good understanding of the methods available and strong problem-solving skills. A basic knowledge of algebra concepts (e.g. what you'd get from a decent pre-algebra class) would probably help too. You will have to learn at least one programming language. I suggest learning C, as it is relatively portable, still enjoys popular use, and provides suitable mechanisms for writing emulators and similar low-level applications. In order to learn C, you'll also need a C compiler, or else you'll be stuck once you want to test any code.

2) Digital logic: This is the basis for all digital computers. You don't necessarily need to know much about it to be a programmer, but it's nice to know when writing an emulator. You don't necessarily need to go through all the stuff about the complex constructs like latches/flip-flops, but it's important to be familiar with all the logic operations.

3) Assembly language programming and computer architecture: How computers are built and the programs that they actually run. Without an understanding of this information, you probably won't be writing an emulator, since an emulator has to reproduce the behavior of a computer. The book I've linked to is about the Intel 80x86 family specifically, but the basic concepts will translate to other processors. Specifically, Volumes 1 and 2 contain most of the general information that will be useful.

I'd like to provide you with some better resources, but I learned this stuff rather haphazardly over the course of some years, mostly running into bad texts. If you have any "stupid" questions, feel free to PM me.
 

AngelBass

New Member
Yeah, C language was already my first choice, what program should i use to write it, i mean what is the most common program, cause i want to be sure that if i need help with it, alot of people would be aware of what to do..and by the way, what is the difference between C, C+ and C++?
 

ToMaTo

New Member
you had better start off with basics..don't get too far ahead of yourself..try to write a program that says your name and work your way up..it is MUCH harder then you might think..your chances of getting anywhere with an emulator are ZERO..start reading some books
 

ramirez60

New Member
I had a brilliant idea. Why don't we port an emu from DC to saturn? I mean we'd only have to rewrite the display functions right? I tried but it scared me so I stopped. (too many files) I then started looking at the Stardust source code. I got it compiling, and booting on satourne, but it does absolutely nothing on a real saturn. So I gave up on that to. Yes your right I do need a project to work on...
 

AngelBass

New Member
well, i already made some little program using basic a long time ago, dont think i remember anything of it but anyway, i know learning and using C language must be very hard to understand at first, but its where i wanna start, all i need is a great C witer and compiler, ive found alot of Guides for the beginner on the net and im very enthousiast to start. So someone know the name of the programs i need to write and compile C language???
 

ExCyber

Staff member
You can use any plain text editor (such as Notepad) to write C. There are some nicer ones floating around that can do fancy things like auto-indent and syntax highlighting/checking, but it's mostly up to you to decide what editor to use. As for compiling, that's why I linked the phraser "C compiler" to MinGW. There are a few others that are available for free, such as Borland C++ (registration required) and LCC-Win32, but I suggested MinGW because I know it works and because it's more or less guaranteed to remain free.
 

AngelBass

New Member
ok thx for the tips! ill use that compiler!so any text program and that compiler and i should be able to start writing?
 

ExCyber

Staff member
so any text program and that compiler and i should be able to start writing?
Pretty much. I also just recalled that Colin Peters has an introduction to programming Win32 with GNU tools (MinGW uses these), so you might want to check that out.
 

AngelBass

New Member
ok ive written the first examples and i have named it test1.c

how do i use gcc.exe so it will take that file and make the .exe with it? have in mind that i use win ME with no dos prompt
 

ExCyber

Staff member
WinME does have a DOS prompt, but it likes to hide it from you. At install it's normally stuffed in Start->Programs->Accessories, but even if it's not anywhere in your Start menu you can use Start->Run (or Win+R) and run "command", or just create a shortcut to c:\windows\command.com.

Before you can use GCC/binutils, though, you'll need to add them to your path. This used to be in autoexec.bat, but the best way to do this in ME is to run "msconfig", go to the "Environment" tab, and edit the PATH variable there. You need to add the mingw/bin directory (or wherever gcc.exe ended up). To test the setup, fire up a prompt and run "gcc -v". This should make gcc spit out its version number. Then to compile test1.c you would use a commandline such as

Code:
gcc -o test1.exe test1.c
If it's a full Windows GUI app, you might need to do something like

Code:
gcc -o test1.exe test1.c -mwindows
If you're using Colin Peters' example code, you'd probably be best following his instructions, of course.
 

AngelBass

New Member
thx for the help, ive already compiled a couple of really small and useless program, but i had alot of fun! The docs you gave me are very well done! And by the way, the problem i had with the compiler is that i was naming the file like "hello.c"

but the notepad was adding the .txt extension and i wasnt aware, now its ok.
 

ExCyber

Staff member
I guess I missed a question:

what is the difference between C, C+ and C++?
C is a platform-independent programming language that was invented at Bell Labs and later tweaked to create the first portable version of Unix. There are two major versions: K&R and ANSI. The differences between these are relatively minor, but can affect compatibility.

C++ is an "enhanced C" that's designed for object-oriented programming (a philosophy of programming that emphasizes bundling code and data into packages called "objects" that interact with each other). It's fairly popular, but it's a bit less standardized since it hasn't been around as long as C has.

C+ is C++ with a dying "+" key on its keyboard. :
:

Writing an emulator using the advanced features of C++ would probably not be the greatest idea, since they often sacrifice speed for convenience.
 

Cynnamin

New Member
*sigh*

I am greatly afraid of what happens when this person figures out exactly what structured programming is and what programming logic is.

Of course, highly doubtful that they will but... of course I'm being nice again. I should stop that.
 

Cynnamin

New Member
You can't just say "Woo! I'm gonna code an emulator!" and do it unless you have the programming background to DO it.

It amazes me that so many people think they can read a book and ask questions and BOOM! they can churn out an emulator like it's nothing. Most of the emulators out there have been under development for YEARS and there are none that are COMPLETE (correct me if I'm wrong?). It involves a whole lot more work than "hello world!". It's a very slow process and barely rewarding at all since it'll be forever before you even have anything that could be considered 'usable.'

Knowing how to code is only 1/3 of making an emulator. You also need to know how the system you are focusing on works and the technical specs. You also need to know how your pc and operating system work and how to interface the console onto a pc since you can't write an emulator and toss it on a cart and stick that into a machine. (Dreamcast Emus still require knowledge of a tiny bit of WinCE)

More power to you if you think you can do it.

However, chances are in a week you'll be frustrated and bored and eventually lose interest alltogether seeing as you won't have an emulator for at least a few months seeing as you know almost NOTHING about programming.

Amaze me and prove me wrong.
 

ExCyber

Staff member
You can't just say "Woo! I'm gonna code an emulator!" and do it unless you have the programming background to DO it.
Right, but it's not particularly useful to just say "you can't do it, it's too complicated". All I'm doing is trying to give AngelBass a glimpse of the actual complexity of it; whether or not it's too complicated to pursue is a matter of opinion, and there's only one person whose opinion really counts.

Most of the emulators out there have been under development for YEARS and there are none that are COMPLETE (correct me if I'm wrong?).
There are varying definitions of "complete". There are reasonably playable emulators that were knocked together in a matter of months (and Icer Addis/Smegma/Sardu said that the original NESticle was "essentially the product of 2 weeks of boredom and a smattering of effort", though whether or not he was joking is anyone's guess).

It's a very slow process and barely rewarding at all since it'll be forever before you even have anything that could be considered 'usable.'
That's only true if you're doing all of the reverse engineering on a complex system yourself. Coding an emulator for a well-documented system does not take all that long. The long development history of most emus is due to minor incompatibilities that crop up as more and more people try running more and more games on the emulator.

Dreamcast Emus still require knowledge of a tiny bit of WinCE
This is a myth. Windows CE is not in any way an integral part of the Dreamcast platform (aside from the logo being printed on the case :
, it was merely an alternative toolchain and library set ("alternative" because Sega encouraged the use of Katana and largely considered Dragon/WinCE to be a necessary evil). Most Dreamcast emus use libdream or KallistiOS, which are freeware DC libraries developed by Dan Potter and Jordan DeLong (a.k.a. Cryptic Allusion).

Knowing how to code is only 1/3 of making an emulator. You also need to know how the system you are focusing on works and the technical specs.
There are a number of well-documented systems out there, but it's not worth worrying about until the basis is there to understand the documentation.

More power to you if you think you can do it.

However, chances are in a week you'll be frustrated and bored and eventually lose interest alltogether seeing as you won't have an emulator for at least a few months seeing as you know almost NOTHING about programming.
Entirely possible (likely even, from a purely statistical standpoint), but there's only one way to find out. If AngelBass sees the information out there and decides to quit, that's what happens - no way around it. But that's no reason to encourage a defeatist attitude.
 

vbt

Staff member
Nothing is impossible ExCyber, he could learn C in one or two month but for making an emulator, he'll had to understand everything on a console hardware. The best thing to do is to search for existing emulator source code and try to understand how it works before making some wrong code.
 
Top