What's new

I want to learn some programming

xneoangel

Persona User
As the title says "I want to learn some programming", but well i don't know nothing about it, so i'd like you guys to tell me with which programming language i should start and if you can tell me of some sites that have some documentation on that language so i can get started.

My goal is to make emulators, i should start with a Chip8 one but well i have to learn a programming language first so i should stop daydreaming for now :p
 

Toasty

Sony battery
C and C++ are good languages for writing emulators, but depending on how your brain works, you may or may not want to start out with one of them. I struggled for a long time trying to learn C and C++ when I first wanted to learn how to program, but I just didn't get it. At the time I already knew HTML and JavaScript (I knew how to script, but not program), so I stuck with those for a while. Eventually I finally took it upon myself to learn Java, and after a few months of confusion, the whole object-oriented concept clicked. I got to where I was comfortable writing in Java and then moved on to C#. After learning those two, I came back to C and C++ and they were very natural to me, since they shared many syntactic and conceptual similarities with my previously learned languages.

On the other hand, there are many people who pick up on C/C++ very quickly with no previous programming experience. Download a C++ compiler and IDE (Dev-C++ is free and easy to set up) and try one of the beginner C++ tutorials (Google for it). If you are having a hard time understanding what's going on you might want to try something different and then come back to C++ later.
 
Last edited:

aprentice

Moderator
I started out with a DOS programming book for C. I didn't have to focus on windows specific code so I was able to pick up C quicker. I'd recommend a C programming book for DOS first if thats the language your interested in learning, it seemed a lot easier for me at least.
 
OP
xneoangel

xneoangel

Persona User
Ok i downloaded Dev-C++ and found a tutorialtutorial which seems nice but well iom already having problems :( , there are some words which i don't understand like preprocessor and iostream, is there any site where i can find definitions of words like these i mentioned?

Hmmm i'd prefer to learn it on a windows environment since i only have basic knowledge of DOS, im 16 and i really never used it much so well that would mean to learn DOS as well which would be troublesome IMO, anyway thanks for your support.

EDIT: I found this definition of preprocessor.
In computer science, a preprocessor is a program that processes its input data to produce output that is used as input to another program.

So lets see if i got it right.

#include <iostream>
So iostream would be the preprocessor right? so iostream will use its input data to produce an output which will be used as input data by the compiled program right?

So basically im telling the program to include iostream data in it right?
 
Last edited:

Toasty

Sony battery
#include<iostream> basically incorporates the header file, iostream into your program. iostream is part of the C++ standard library, and by including its contents in your program, you are able to use functions, definitions and classes in that file. All the lines that start with a # are preprocessor directives. The preprocessor makes intermediate changes to your code that you never have to see, but that the final compiler will see. #include basically means copy all the code from this file (in this case, iostream) into my file.

Suppose we have a header file of our own that looks like this (we'll name it "MyHeader.h"):
Code:
int MyAddFunction(int a, int b) {
  return a + b;
}

And then we include it in your hello world program like so:
Code:
#include<iostream>
#include "MyHeader.h"

using namespace std;

int main() {
  
  cout << "Hello World!" << endl;
  
  return 0;
  
}

Basically, this tells the preprocessor to copy all the code from our header into this file. After the preprocessor does its work, the final compiler sees this:
Code:
/*The contents of iostream goes here, but it's way too long to post*/

int MyAddFunction(int a, int b) {
  return a + b;
}

using namespace std;

int main() {
  
  cout << "Hello World!" << endl;
  
  return 0;
  
}
In essence, it's a way to virtually copy code into our source file without making the source file huge in the process, which makes code a lot more manageable. It's also handy when you want to use the same code in many different source files, which will be important in bigger programs. The reason the tutorial told you to include that file is because it contains the definition for cout (short for "console out", BTW), which you will use to print text to the console.
 
Last edited:

Garstyciuks

New member
aprentice said:
I started out with a DOS programming book for C. I didn't have to focus on windows specific code so I was able to pick up C quicker. I'd recommend a C programming book for DOS first if thats the language your interested in learning, it seemed a lot easier for me at least.
Hmm, I learned C++ after messing a lot with OpenGL at NeHe site :p The windows programming part came while programming my Chip8 emulator. I did some DOS programming, but in assembly.
 
OP
xneoangel

xneoangel

Persona User
Toasty said:
In essence, it's a way to virtually copy code into our source file without making the source file huge in the process, which makes code a lot more manageable. It's also handy when you want to use the same code in many different source files, which will be important in bigger programs. The reason the tutorial told you to include that file is because it contains the definition for cout (short for "console out", BTW), which you will use to print text to the console.

Thanks now i got it. :D
 

Doomulation

?????????????????????????
C and C++ is very low level, thus it is generally not a good idea to start with a high level language like VB IMO, because you'll be all confused later.
Anyway, preprocessor is a co-compiler you might say that parses your source files before the compiler and does its work. There are a lot of preprocessor commands available, arguably the most used is the #include which, as explained, includes the contents of a file into the position where that is.

A good way would be to get a small taste for the language through console-based programs. Then, you would logically move up to Windows-based apps. Howver, Windows inner workings and its API is not easy. But it important to understand it even if you are using Frameworks such as MFC, ATL or WTL.

Use a tutorial, do it. Find another one, do it. And when you get stuck--ask. That is the way to learn. Now good luck.
 
OP
xneoangel

xneoangel

Persona User
Thanks now i understand what is a preprocessor. :D
I'll take your advice i'm gonna do the tutorials and ask if i get stuck...
The nice people here at emutalk are always great help.
 
Last edited:

Iconoclast

New member
Yes! For once, I can learn this language because I can finally install the thing. Hard to install on a limited account until you gave me that link.

I'm new to C, as well, but I DO know ActionScript, up to Flash Player 6 in scripting complexity and some AS 2.0. I know a little HTML and even more DOS. I use DOS batch files to instantly start N64 games in Project64 and stuff, and I also use DOS when my PC shuts down at bedtime (a feature my parents installed), as I can't use Windows after 10 PM, but I can still use DOS even on Windows XP in a bootable floppy disk. That is why I like DOS emulators.

I also know FEN, but that's a chess setup 'programming' (not quite) language, so screw that.
 

Doomulation

?????????????????????????
While coding HTML, javascript & using DOS commands may give you a "Core User" title, you'll be surprised to find how little they can help or have in common with a real programming language of the scale of C/C++.
You may know a little about the whole art of programming, but you will find a lot of surprises about C/C++. It is not merely the language - but the way it works. You'll find that a lot of things go wrong and unlike javascript, the debugger won't tell you what is wrong, but what WENT wrong (ie, access violation at address 0xXXXXXXXX). The debugger will tell you WHAT went wrong but not WHERE or HOW. And often furthermore, you will find that it is not easy to figure out WHY either, because an access violation can mean many things.
 

Iconoclast

New member
I see. In fact, I got an error right now. I figured, eh, I'll look into the tutorial of Dev-C++ later. I took a break, and decided to download the sourcecode for zilmar's No Sound plugin. What I REALLY wanted was the source for his Basic Input Plugin, but for some reason, NGEmu.com said it came with the sourcecode, but it didn't.

Anyway, I tried using Dev to open the file Audio.c of his sourcecode, and I try the Execute/Compile command to try to compile it (or how do I get this thing into a DLL?). Then I get this error, "dsound.h: No such file or directory." I saw the "#include <dsound.h>" paramater in the sourcecode, so I looked for the file in the Include subfolder of Dev-Cpp. I saw the other files needed, stdio.h and windows.h, but no dsound.h. Is this some sort of corrupt installation here, or am I missing something (most likely)? I even tried Googling about the error and trying to get the file using LimeWire, but none of the versions worked.

So, how do I successfully compile zilmar's sourcecode to the No Sound plugin?
 

Poobah

New member
'dsound' is short for DirectSound. You'll need the DirectX SDK, but it just happens to be filled with about 400MB of extra stuff that you probably won't be wanting, so you should just download this one. Extract it into the Dev directory that contains "bin", "include", etc.. You'll also have to include some libraries, but I don't do any DirectX programming, so someone else will have to tell you.

Does the source that you are trying to compile come with any DSP, DSW or VCPROJ files? Those are MSVC project-related files. I'm not sure if Dev-C++ can open those or not, but it would be preferable to compile using one of them.

Regarding C/C++ programming, I recommend that you start with C and then move on to C++. It's useful to learn C first because you'll get an understanding of some essential things such as how strings are stored and pointers. (You'll love pointers, by the way.)

I'm not sure if these will help you or not, but the following are the best C/C++ guides I've happened across:
http://lib.daemon.am/Books/C/
http://lib.daemon.am/Books/C++/

I could never get my head around C until I first got used to interrupts and other DOS stuff in QBASIC. The most off-putting thing for me was that there just isn't a nice and easy way to do graphics-related stuff unless you're writing DOS programs.
 

Iconoclast

New member
Alright, I'll be looking at those links.

The zip you uploaded gives me a Page Cannot Be Displayed error.

Yes, it comes with No Sound.dps, dsw, ncb, and opt.
 

Doomulation

?????????????????????????
I figure you could start with either C or C++. You don't have to delve into anything advaced and C++ is C with some extensions so basically you can do either and start learning.
Dsound.h is part of the DirectX SDK, which you should consider getting if you want to create DirectX-based games. Oh and sorry to burst your bubble, but the sound plugin is way beyond your understanding as of still, I bet.
 

Iconoclast

New member
Doomulation said:
I figure you could start with either C or C++. You don't have to delve into anything advaced and C++ is C with some extensions so basically you can do either and start learning.
Dsound.h is part of the DirectX SDK, which you should consider getting if you want to create DirectX-based games. Oh and sorry to burst your bubble, but the sound plugin is way beyond your understanding as of still, I bet.
Yeah, I know it is. But I plan on learning as much as I can with my time, and I have the source for his No Sound plugin, and I just want the file Dsound.h, the whole DirectX SDK if it has other files I will also need for compiling them.

Still, even though I may never learn enough C or C++ to fully understand the sourcecodes of the plugins and emulators and make my own, maybe never get even near that, I still want the file. See, what I used to do, was I could use the MS-DOS Editor in Edit Binary mode to change the title bar and properties of N64 DLL plugins. Obviously, I can't really fully edit binary, but I could edit the parts that I could understand, such as the title/name of the plugin and About info, not to make it say I made it or anything so copyright-infringing.

Now I just wanted to get into seeing if I could learn how to better change these plugins, by downloading a compiler to try to see if I can edit some of what I want using their sourcecodes. So, I would still like the file (complete DirectX SDK in entirity, if necessary for other sourcecodes).

Also, where is the sourcecode for zilmar's Basic Input Plugin? Everywhere I go, it says "Open source" or "includes sourcecode," but when I open the archive, I only see the DLL.:ranting:

And I'll start out with C, but thanks for the info.
 

Poobah

New member
Try out this link again. Sourceforge sometimes has problems, but the 400KB SDK is quicker to download than the bloated 400-500MB Microsoft one.

Is dev-C++ able to open any of those project files such as the dsp/dsw ones? If not, you should give another IDE such as Code::Blocks a go, because it can open most MSVC projects, so compiling other people's MSVC projects should be almost trivial. The site's currently down, but I'll post a link to today's build once it's up again.

I don't think Zilmar's Plug-in is open-source, despite what some are saying. You could take a look at the sources of other plug-ins.
 

Doomulation

?????????????????????????
I don't think Microsoft's SDKs are bloated. They may be big, but they contain documentation, libraries, header files and examples on how to create and compile DX apps.
 

Iconoclast

New member
Damn. I really wanted zilmar's sourcecode (he didn't make it open source?!?) for that Basic Input Plugin. Even the user aprentice posted that it was open source. You really sure he didn't release a sourcecode for it? It's probably the most crappiest input plugin out there, but I like its simplicity, and since the keys are predefined, that could be useful for some things I have in mind. I just want it for its simplicity. Not that I will know enough C to learn how to modify which keys do what, but possible....

And, thanks for your help. I got the files, now. I'll look at those tutorials you linked to, assuming you'd say they're better for learning C than the Help option that comes with Dev-Cpp.

*Edit: Your tutorial link didn't work.

Forbidden
You don't have permission to access /Books/C/index.html on this server.
 
Last edited:

ShizZy

Emulator Developer
I believe Sculleatr wrote a step by step tutorial on how to write an input plugin for N64. Can't seem to find it though.
 

Top