Sinisterly
C,C++, What are languages? - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: C, C++, & Obj-C (https://sinister.ly/Forum-C-C-Obj-C)
+--- Thread: C,C++, What are languages? (/Thread-C-C-What-are-languages)

Pages: 1 2


RE: C,C++, What are languages? - whitewolf - 08-27-2011

thanks Frooxius,im new to the languages..


RE: C,C++, What are languages? - Skipperdoo32 - 09-03-2011

Hey, Frooxius, I have a question. If I want to do a simple mathematical equation (somewhat like the one from your CPU tutorial), how would I go about doing that? Without using a compiler, I mean; what language would I use, and where would I enter the codes?


RE: C,C++, What are languages? - Frooxius - 09-03-2011

Skipperdoo32: Well if you want to write it in assembly, then you simply enter the instructions (with syntax following a convention) in some plain-text file (as with most programming language) and then give the file to assembler, which will produce appropriate machine code. That of course depends on what processor architecture you want to program, because they differ. There are several assemblers for x86 (what PC's usually use), for example MASM32 or NASM. You need to check their documentation for syntax details.

If you don't want to use even assembler, then you'll have to get instruction table for given processor and find the opcodes yourself, although this is very tedious and usually pointless. You can use some hex-editor (HxD for example) to write raw binary data into some file, than you can then load in the memory and let the processor execute it, that of course depends on architecture you want to program - in some (usually MCU's) you usually just flash the machine code into ROM, but on Windows for example, you would have to add header and other additional info to form a PE executable (tautology I know).

However! To make it somewhat simple, you can actually write assembly code in C/C++ using the asm statement. It's quite advanced feature, since it requires a knowledge of what's going on in the language and processor. However, you still don't need to handle other needed stuff, because C/C++ compiler sets up the wrapping code and data for you. You can do it like this:

Code:
// C/C++ code asm { // assembly code here } // C/C++ code

If this doesn't work with some compilers, add double underscores before the asm keyword:

Code:
// C/C++ code __asm { // assembly code here } // C/C++ code



RE: C,C++, What are languages? - Skipperdoo32 - 09-05-2011

1) Just purchased "C++ for Dummies". Excellent book! I have already written my first program (very primitive and pathetic, but still a program), and now I'm learning about different kinds of variables.

2) Frooxius: How do you give the text file to assembler?


RE: C,C++, What are languages? - Frooxius - 09-05-2011

Skiperdoo32: Well if you don't have any IDE, then you probably call the assembler from the command-line with the source file as an parameter.
Like:
Code:
assembler filename.asm
There might be additional flags and it depends on what platform you're targeting and what assembler are you using.


RE: C,C++, What are languages? - ArcaneFx - 09-05-2011

Since Frooxius answered all the questions, I'll just add that if you are interested in advancing in the field of 'hacking' and want to code your own injectors and tools, learn C++


RE: C,C++, What are languages? - Frooxius - 09-05-2011

Arcane: That has already been told to him and if you read his post, you'll see that he's already learning C++


RE: C,C++, What are languages? - ArcaneFx - 09-05-2011

(09-05-2011, 07:28 AM)Frooxius Wrote: Arcane: That has already been told to him and if you read his post, you'll see that he's already learning C++

Oh, I'm sorry. I did not read all the way down.
My apologies.


RE: C,C++, What are languages? - Skipperdoo32 - 09-09-2011

(09-05-2011, 07:09 AM)Frooxius Wrote: Skiperdoo32: Well if you don't have any IDE, then you probably call the assembler from the command-line with the source file as an parameter.
Like:
Code:
assembler filename.asm
There might be additional flags and it depends on what platform you're targeting and what assembler are you using.

Hrm. I didn't understand most of that, so maybe I should come back to this later after I've mastered C++. Would that be better? (Sorry for all the questions, lol. Just trying to find my way)


RE: C,C++, What are languages? - Frooxius - 09-09-2011

Skiperdoo32: Definitely! Assembly programming is nothing for beginners, I don't recommend starting with that. It's almost like teaching children how to solve complex integrals before even teaching them how to add two numbers together.