PDA

View Full Version : Need help.. Need complete retard giude to C or C++


Sephiroth
05-16-2005, 03:45 PM
Hey guys, I was wondering if anyone has a good C/C++ guide, I am trying to make a game, now I have half of the game done in assembly but my friends are bugging me to port it other cpu's other then the x86_64 this is where C/C++ comes in, I don't know anything at all about the way C or C++ works at all, I know the use flags, but I can't code a single line of C/C++ I can't understand why you need all these symbols everywhere, I know what they are for (control flow of a program) but i donno how or when to use them.

Can anyone help me?
Also what would be the best free compile that has an IDE?

DudeMiester
05-16-2005, 05:24 PM
well my reference is msdn.microsoft.com in their C++ reference section. It's a bit hidden afaik, so you may have to search for it.

DirkStarscream
05-16-2005, 06:02 PM
Out of curiosity, which processors were you thinking of porting to? If its other processors in the x86 family a simple co rewrite is all you require. If its powerpc, then apart from following a few simple rules related to architectural differences, you can still port pretty easily. It took me a couple of hours to figure out the basics after reading the ibm powerpc programming environments manual, and a tutorial or two. I'm converting my assembler to powerpc at the moment!

Sephiroth
05-17-2005, 01:44 AM
PPC and RISC (PS2 and PSP)

So Assembly is not going to cut it here...lol if it where just for x86_64 then I'd keep it in assembly, not because I am to lazy to port it, it's because I don't feel that there is any gain for me to port it to C/C++ in fact I think I my port would suffer from it.

Also I can't just "port" my assembly code to another arch, my program is written a speical way, I use pipes whenever I can, and that alone is the reason why if I my program will need to be converted into C/C++ for those archs.

Piping is a speaical way of coding assembly if you (people don't already know). it's only allows for some regesters and some instructions to processed at once giving me a 2:1 ratio instead of a 1:1 so my programs are almost twice as fast.

Night Hacker
05-20-2005, 10:25 PM
I highly recommend "C++ For Dummies" (ISBN 0-7645-0389-8) it's very well written.

For a free compiler with IDE, I recommend grabbing Dev-C++ 5 (http://www.bloodshed.net/dev/devcpp.html) (not 4!). Dev-C++ is the IDE, it uses the MinGW (Minimalist GNU for Windows) compiler.

Night Hacker
05-22-2005, 12:41 PM
Here's a website I found with an introduction to C programming that may help you as well.

http://www.eskimo.com/~scs/cclass/notes/top.html

Destroyer
07-14-2005, 01:28 AM
google "complete retard giude to C or C+"

SippyCup
07-19-2005, 01:14 PM
You're programming a game in Assembly? Man, you are really brave. Check out my post in Game Programming Question.

http://forums.3drealms.com/ubbthreads/sh...p;page=0#872345 (http://forums.3drealms.com/ubbthreads/showflat.php?Cat=0&Number=872345&an=0&page=0#872345)

It has a few good links, including a free IDE.

Assembly... Ugh! I had to make a calculator program in Assembly. That was so annoying.

Sephiroth
07-27-2005, 03:06 AM
Well assembly program is not hard it just takes time, and the knowhow to write readible code, once you can debug your own code it's simple. for instance for me copying or reading data from the 18th bit of memory is quite easy (I use this example alot)

MOV BX, 1
; moves the value of 1 (16) in to regster bx

MOV DS, BX
;moves the contains of regester bx into regster ds
; what this really does is set the segment since
; every segment has a value if 16 (because we
; are using 16bit regesters) so we want the first
;segment of memory.

MOV SI, 2
;Now we move the value of 2 into regester SI
; what this does is actually add an offset of 2
; so now we have 18 bits instead of 16.

MOV AX, [SI]
; this moves or copys our 18th bit back into
; a general perpoius regester, doing this
; allows us to read the data stored there.


In C you can use something like this (i donno if this is right since I am still learning C but here goes.

byte b=(BYTE *)&0x01020304;


I find assembler easyer, I am sure there are millions of people on here that would scream that its a waste of time blah blah blah, but i prefer quility over queontity, the time it takes to make a program means nothing if the program itself is not fast enough or is not written properly, I see no point in developing a program that can't run on almost everything, do you know what got me into ASM? i was sick and tried of companys writtening bloated apps, just because you have the memory doesnt mean the developer has the right to make a huge gaping memory foot print, its a waste of resources. So I had to prove to myself it's qutie possible to create programs with very very very tiny memory foot prints and ever since I knew it was possible I have pushed myself further into assembler.

DudeMiester
07-27-2005, 03:01 PM
lol, you seem to misspell every word that starts with Q. Also I really don't understand why you use 16-bit ASM, because you can't access the extended instruction sets and 16-bit programs don't play nice with OSes. In fact 16-bit programs in Longhorn will become entirely emulated, and thus many times slower then 32 and 64 bit code. Not to mention for anything that uses parallel (aka SIMD) operations it will always be slower, since you don't get the extra instructions like SSE. Lastly, while it may be easy to access memory in ASM, it's still easier in a HLL. That's because in a HLL you rarely ever even have to think about it at all, it just happens. Examples like yours are virtually never done in an HLL, rather something more lke this "byte b;", the allocation on the stack and the creation of an address is handled transparently, and that is way simpler then the ASM method.

Sephiroth
07-27-2005, 05:20 PM
Well if you wanted to read the 18 bit in 32bits or 64 bits all ya would have to do is instead of moving 1 in to ebx move 0 in it to and mov 18 into esi for 64 bits all I need to do is mov 0 into rbx and chnage rsi to 18 either way this works I use 16 because 16bit ASM was how I learnt ASM. I could also do this with 8bit regs too but I only use 16bits as an example.

As for the spelling, yea my spelling is really bad.

I am not too worryed about Vista taking away 16bit mode, because I dont fall back on predefined functions such as int21 etc I only use code that goes fast...lol ints arent very fast at all, and even if it was emulated I can get around that, thats the beauity of assembler even before memory is actully setup I can exicute instructions via stick, so it really doesnt matter what emulation they have, if that CPU has a 16bit instruction set I will and can have full access to it http://forums.3drealms.com/ubbthreads/images/graemlins/smile.gif

It may be simple but for me its easy to point to a certain bit, byte, word or dword in memory and that would help me out greatly if I wanted to chnage data as it was in memory because since I know its exact posittiion and such thinks like memory (apprently which is why most people hate assembler in the frist play is soo freaking easy) yes it takes way way way longer, but there is an old saying.. the longer something takes you to do the better the out come, like I said the speed of actully coding the app or game means nothing to me

Night Hacker
08-03-2005, 05:33 PM
I prefer programming in C, but I found some tutorials on programming in assembly for Windows and it seemed very nice. I still might try my hand at it.

Like C, in assembly you can create your own library of functions to do certain tasks for you, after a while it would become quicker as you built up your library. You certain have more power and smaller executables.

Edit: here's a good website I found with downloads (compilers etc) and tutorials on programming in assembler for windows (and dos I believe). Iczelion's Win32 Assembly Homepage (http://win32asm.cjb.net)

Zero
08-04-2005, 01:59 PM
Well today is a cold day in hell, it seems that fate is agsint me, I went to update windows because I have a provlem with "vsmon" taking huge chucks of my CPU so I went to go to windows update and now you need to download a vailidater to vailidate your copy of windows, so i did that because i easly got around the first SP1 vaildation cheak with ease, well it turns now it know what edition you have, and it knows I have 3 or less computers so it tells me my copy is illegal because its corprate and I dont have a valid corprate license, so until I fully learn C/C++ I wont be making anything , because I am hosing my Windows box and using it as a backup server.

So until I learn how to code in C/C++ for linux/freebsd I wont be in coding anything for a while, because I can't justify buying winxp pro when its $250, yet Vista is right around the corner, well if thats how M$ wants to play it, well it's not my problem anymore.



I'm signing off his windows box for the final time
-CryptDragoon

DudeMiester
08-04-2005, 06:28 PM
That's not a big deal. there are lots of easy workarounds, or you can get a corperate/OEM key. They work wonders. http://forums.3drealms.com/ubbthreads/images/graemlins/tongue.gif

Zero
08-04-2005, 07:08 PM
I have many, they dont work, I got around all others before, but this like 2 days ago this check wasnt there, but now it is, so its somehting new.

DudeMiester
08-04-2005, 07:46 PM
Here:

javascript:void(window.g_sDisableWGACheck='all')

Before clicking on "Custom" or "Express" paste that into the address bar, press enter and it'll work fine.

Myself, I validated np, lol. However, I do have a legit copy of Windows XP Pro at home, and I can get a copy from wy University if I wanted to. Same with MSVS 2003. I get basically free copies of MS Office as my mom works in a school board too. I have never paid a cent to MS, and still have all legit software. Although, I have never bothered to install them, as the warez versions I'm using now work fine, but I do have a proper licensce either way.

boondocksaint
08-10-2005, 06:45 PM
Well, I suggest you begin looking for a complete retard GUIDE to C and C++.

That seems like a pretty good start. 3dbuzz.com (http://3dbuzz.com) has some videos (although you have to pay a membership fee for them).

JimboC
08-13-2005, 07:27 PM
*post deleted*