6 Replies - 4341 Views - Last Post: 05 September 2009 - 11:23 AM Rate Topic: -----

#1 phatakg  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-March 09

assembly language to machine language

Post icon  Posted 05 September 2009 - 10:28 AM

heyy....i just need startup help with my work....I am new to visual C++ .......I need to write a program to convert assembly language to machine language in visual C++....can anyone tell me which application to use in C++ for that and how to startup the program......
Is This A Good Question/Topic? 0
  • +

Replies To: assembly language to machine language

#2 Guest_Neumann*


Reputation:

Re: assembly language to machine language

Posted 05 September 2009 - 10:38 AM

View Postphatakg, on 5 Sep, 2009 - 09:28 AM, said:

I need to write a program

Quote

which application to use


That doesn't make sense. Do you have to write the application yourself or do you have to use the application written by somebody else? In the former case, you use C++'s I/O functions to read the assembly file as a text, and output the resulting binary to another file in binary mode. In the latter case, you use the Assembler.
Was This Post Helpful? 0

#3 trixt.er  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 52
  • View blog
  • Posts: 428
  • Joined: 28-September 08

Re: assembly language to machine language

Posted 05 September 2009 - 10:39 AM

This is very simple. Use the GNU compiler to convert to object code. I believe Visual Studios C++ has a GNU feature.
If not try using Linux. B)
For example...
gcc -c file.c


This will assemble and convert the assembly to object code but exclude the linking.
-o does it all.
-s just assembles.
Was This Post Helpful? 0
  • +
  • -

#4 horace  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 291
  • View blog
  • Posts: 1,900
  • Joined: 25-October 06

Re: assembly language to machine language

Posted 05 September 2009 - 10:59 AM

View Postphatakg, on 5 Sep, 2009 - 04:28 PM, said:

heyy....i just need startup help with my work....I am new to visual C++ .......I need to write a program to convert assembly language to machine language in visual C++....can anyone tell me which application to use in C++ for that and how to startup the program......

are you writing an assembler? if so you need to know how each instruction and its operands maps into the machine code.
Was This Post Helpful? 0
  • +
  • -

#5 Aphex19  Icon User is offline

  • Born again Pastafarian.
  • member icon

Reputation: 615
  • View blog
  • Posts: 1,873
  • Joined: 02-August 09

Re: assembly language to machine language

Posted 05 September 2009 - 11:07 AM

View Postphatakg, on 5 Sep, 2009 - 09:28 AM, said:

heyy....i just need startup help with my work....I am new to visual C++ .......I need to write a program to convert assembly language to machine language in visual C++....can anyone tell me which application to use in C++ for that and how to startup the program......


Quote

I need to write a program to convert assembly language to machine language


You want to write an Assembler? Im afraid i cant help you there, beyond me.
Was This Post Helpful? 0
  • +
  • -

#6 DustyD  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 75
  • Joined: 19-August 09

Re: assembly language to machine language

Posted 05 September 2009 - 11:08 AM

Your work sound's like you have to reimplement an assembler... That's a mission, so you can use "as" in unix to assemble, which is basically converting assembler into machine-code.

If you've already made some c++ or c programs, you can view them in machine code in VC++ I think, If you turn on the debugger..

Are you new to C++ or VC++??


If not, you could use fstream for I/O file operations such as reading or writing (read from assembly file), and then you could have another file that lists all assembler commands as strings, and then make a part that recognises the commands and changes them to their equivalent machine instruction...

This post has been edited by DustyD: 05 September 2009 - 11:14 AM

Was This Post Helpful? 0
  • +
  • -

#7 debjit625  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 51
  • View blog
  • Posts: 446
  • Joined: 06-September 08

Re: assembly language to machine language

Posted 05 September 2009 - 11:23 AM

I think you want to make a program which converts a assembly source code to object code file like COFF,ECOFF,XCOFF,ELF for that you have to research on object files
like COFF (Common Object File Format) .You can start with unix's "a.out" file format its very simple .I think you have understanding of assembly?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1