Hello Everyone :)

Hope everyone is in good health.

Now a days, I am designing a 16-bit RISC Microprocessor. I want to write an assembler for it. Can anyone here tell me how to write an assembler.

Please send me any eBook/links or any otherthing.

Waiting for kind response.

Best Regards ;)

Muhammad Ammar
Posted on 2007-04-05 07:39:27 by Ammar
you might want just add support for your processor to already existing assembler. You will save lot of work that way
Posted on 2007-04-05 08:14:08 by vid
Hello!
:idea:
First, you should know how the instructions are encoded.
e.g
binary format of instructions:
16bit >>> (15..13)prefix-(12..10)oprator-(9..5)oprand_1-(4..0)oprand_2
oprators encoding:
mov -> 000
add -> 001
sub -> 010
cmp -> 011
....

2nd, write an assembler in C(one another language is OK) on your computer.
ASMReader -> Translator -> binary code

3rd, rewrite the code of the assembler with your instructions.

4th, put the new code into your assembler on your computer
and it will product a file with binary code of this assembler for your 16-bit RISC Microprocessor.

5th, burn the binary code to a ROM for your Microprocessor.
:oops:

There's an assembler in OllyDBG's source code:
http://www.pediy.com/sourcecode/disassemblers/disasm/disasm.zip
assembl.c
asmserv.c
Posted on 2009-08-07 10:21:25 by asmdna
You want to design a CPU and you don't know how to write an assembler? IMHO, it's supposed to be the other way around. How do you want to encode instruction retirement/execution stage?
Posted on 2009-08-07 17:47:28 by ti_mo_n