Hi.
I am (for learning reasons) trying to develop a very small programming language. My language compiler works by compiling the code written, to x86 assembly, and then "compiling" the assembly to machine code.
The problem is that I don't know how to do the last step. I have heard that each assembly instruction must be compiled to 8-bits that the CPU can understand. So compiling the following assembly code, would generate 2X8bits, like seen below.
mov ax, 1234h 00101000 //these 8bit strings are just guesses
mov bx, ax 10011010
Is my theory correct that all assembly instructions must be compiled to an 8bit code that the CPU can understand? If yes, does anyone know where to get a list of these 8bit codes for each x86 assembly instruction?
If I am completely wrong about everything, please write how assembly is really converted into machine code.
Thanks.
Generating executable machine code
Started by steffanp, Jan 30 2008 07:26 AM
5 replies to this topic
#1
Posted 30 January 2008 - 07:26 AM
|
|
|
#2
Posted 30 January 2008 - 08:51 AM
Usually, you would use an appropriate assembly compiler for your last step. I know Intel provides one.
#3
Posted 31 January 2008 - 06:44 AM
sorry, no links alowed, first post
avr and microchip (2 brands of IC's often used by hobbyists) also use ic architectures based on intel's cpu's. And the communities around it might proof useful for getting technical information about it.
avr and microchip (2 brands of IC's often used by hobbyists) also use ic architectures based on intel's cpu's. And the communities around it might proof useful for getting technical information about it.
#4
Posted 31 January 2008 - 11:05 AM
Basically you usually use the assembler, linker and loader provided by the platform. Assemblers are quite simple, there are basically direct translations between mnemonics and binary opcodes, just pick up the Intel developers manual from their site (they will probably send you a hard copy for free if you ask) and then write something that translates between them. You have to pick a binary output format (elf, coff, etc) as a target. Naturally pick a binary format that can be linked by your linker.
#5
Posted 03 February 2008 - 07:44 AM
But he stated he wanted a list of the actual binairy code.
The reference pdf's I've seen in the AVR and MicroChip communiies had these.
The reference pdf's I've seen in the AVR and MicroChip communiies had these.
#6
Posted 03 February 2008 - 08:01 AM
vernes said:
But he stated he wanted a list of the actual binairy code.
The reference pdf's I've seen in the AVR and MicroChip communiies had these.
The reference pdf's I've seen in the AVR and MicroChip communiies had these.
The Intel manuals have the opcodes and the mnemonics.


Sign In
Create Account

Back to top









