Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How make a program transfer asm to hex

Status
Not open for further replies.
So you want to write a compiler?

First write a disassembler.

Then write an assembler.

Then write a linker. Better yet, save yourself the trouble and learn to use an existing one.

Then write a parser and a lexer. Learn to make them work together. (Look into flex and bison: The LEX & YACC Page )

Then, use the parser and lexer to interpret the source code, write a compiler to compile their output into assembly, run it through the assembler to generate your object code, and then run it through the linker to link any libraries or other dependencies.

Compiler writing is not simple. Learn to use compilers first (gcc is a good one to use for this; Visual <whatever> hides too much of what's going on for you to get a grasp of the actual usage).


Torben
 
Last edited:
Two points, one I never said writing a compiler was easy (I said writing a disassembler was easy), two, you've never mentioned a compiler before - do you mean an assembler? (a compiler is a high level language, not assembler).

Read through the code and it should become fairly clear, see which commands have which command type.

Sorry l mean assembler
but let me understand how disassambler work

So you want to write a compiler?

First write a disassembler.

Then write an assembler.

Then write a linker. Better yet, save yourself the trouble and learn to use an existing one.
Torben

We have an existing disassembler which Nigel Goodwin gave it to me
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top