There may be βdirectβ and βusefulβ answers to your question, and they are probably incompatible.
The direct answer is that you must combine the architecture reference (see the link in the previous answer) with the details of the specific assembler that you have chosen for this - for example. gas, nasm, yasm, fasm, masm [32], tasm, etc .; they all have links to the syntax of instructions, pseudo-instructions (like segmentation, memory allocation, etc.), implementation details, object file format ...
The helpful answer (jIMHO) is that duplicating the results of industry leaders, such as the GNU compiler compilation, Microsoft Developer Studio, etc., takes thousands of person-years, so this is a rather strange way; instead, you should use existing measures as much as possible. For example, to check the concept of your language, you can implement a converter for C code and a support library for this. Or write for a famous virtual machine and its language like Java or C #. At an advanced level, you can replace the compiler external interface with your own (like GCC and LLVM), and reuse your code generators that are well written and tuned for several purposes.
I doubt very much that you are developing something that cannot be converted to C and support library calls. Intermediate code should not look beautiful, it should work.
If you still want to make the sunset manually, please edit the question with detailed information about the target platform (Windows / Linux / etc., 16- 32- or 64-bit ...)
Netch source share