Lost Password?

Go Back   CodeCall Programming Forum > Software Development > General Programming

General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-30-2008, 09:26 AM
steffanp steffanp is offline
Newbie
 
Join Date: Jan 2008
Posts: 1
Rep Power: 0
steffanp is on a distinguished road
Default Generating executable machine code

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 01-30-2008, 10:51 AM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Mod
 
Join Date: Jul 2006
Age: 35
Posts: 1,751
Last Blog:
Game software (GURPS)
Rep Power: 24
WingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to all
Default

Usually, you would use an appropriate assembly compiler for your last step. I know Intel provides one.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-31-2008, 08:44 AM
vernes vernes is offline
Newbie
 
Join Date: Jan 2008
Posts: 4
Rep Power: 0
vernes is on a distinguished road
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-31-2008, 01:05 PM
G_Morgan G_Morgan is offline
Guru
 
Join Date: Oct 2007
Age: 24
Posts: 388
Rep Power: 10
G_Morgan is a name known to allG_Morgan is a name known to allG_Morgan is a name known to allG_Morgan is a name known to allG_Morgan is a name known to allG_Morgan is a name known to all
Default

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.
__________________
Currently bemused by: LLVM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-03-2008, 09:44 AM
vernes vernes is offline
Newbie
 
Join Date: Jan 2008
Posts: 4
Rep Power: 0
vernes is on a distinguished road
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 02-03-2008, 10:01 AM
G_Morgan G_Morgan is offline
Guru
 
Join Date: Oct 2007
Age: 24
Posts: 388
Rep Power: 10
G_Morgan is a name known to allG_Morgan is a name known to allG_Morgan is a name known to allG_Morgan is a name known to allG_Morgan is a name known to allG_Morgan is a name known to all
Default

Quote:
Originally Posted by vernes View Post
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 Intel manuals have the opcodes and the mnemonics.
__________________
Currently bemused by: LLVM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic Calculator AfTriX VB Tutorials 3 02-29-2008 08:53 AM
assembly code help emaney General Programming 0 06-16-2007 04:27 AM
Please Help With A C Program!! siren C and C++ 7 04-17-2007 08:45 AM
Where to Put PHP Code clookid PHP Tutorials 1 01-11-2007 08:44 PM


All times are GMT -5. The time now is 03:10 PM.

Contest Stats

John ........ 87.50000
dargueta ........ 75.00000
Xav ........ 50.00000
MeTh0Dz ........ 20.00000
gaylo565 ........ 18.00000
Johnnyboy ........ 3.00000

Contest Rules

Ads