@Medo3337, you should really go look at the source code for actual compilers. GCC collection is available here: http://gcc.gnu.org/ There are many others available as open source.
I am writing something like a programmer language, so I will need to parse then compile, so I need two methods, one method to set the assembly code and another to create the EXE file from the assembly code.
Hugh McCurdy
I didn't get e-mail that you posted, for some reason.
I still think that you should write the code to produce the assembly code and then use a pre-existing assembler to convert the assembly code to machine code and make the exe file.
The only good reason I can think of for not doing it that way is because this is an academic project and you are required to write all the code. In that case, I would study the source code of open source assemblers and read any accompanying documentation you can find.
I propose you take an assembler and learn how to use it. You then simply generate the proper code for this assembler and use it to generate an executable form this assembler.
Masm is one Assembler you can use. Because there is a nice book about it I propose
you have a look at HLA Or the book The art of assembly langauge.
http://www.bloodshed.net/faq.html#16
16. How to use assembly with Dev-C++ ?
The assembler uses AT&T (not Intel). Here's an example of such a syntax :
// 2 global variables
int AdrIO ;
static char ValIO ;
void MyFunction(..........)
{
__asm("mov %dx,_AdrIO") ; // loading 16 bits register
__asm("mov %al,_ValIO") ; // loading 8 bits register
/*
Don't forget the underscore _ before each global variable names !
*/
__asm("mov %dx,%ax") ; // AX --> DX
}