hmm...im desperate for a project i can devote my time to :D

sumtime back i decided i was gonna create my own resource editor...but i decided to can the project cos i found that vc++ already did everything i had planned for it

so these past few days i've been reading up on the PE tutorials and while i think i have most of it down i figure the best way to learn would be if i could make my own linker + assembler...this way i'll also get practise with opcodes and also learn alot abt the PE format...and i'll be doing it just for the fun of it...its not meant as a freeware project or anything...it mite not even have a GUI...just create the source in a text file and use the commandline to parse+assemble+link it...i mite use a regex package or maybe even PERL/PYTHON for it...because speed of assembling the source isnt my aim here, its just to get the assembly+linking rite ;)

but how tuff is it...like, yrs.? cos that would be a lil too much :cool:

im just thinking abt this and havent commited to it yet...

oh if i do decide to do its gonna be for intel x86 asm...
Posted on 2003-08-11 23:00:39 by AnotherWay83
I was kinda thinking of the same idea. My target would be obj files however and compatibility with MS link.

This I guess is a good time to as is the PE section made by the assembler or the linker?

FASM will do straight exe or obj files. Looking into its source might be good.

I would want COFF compatible object files since I use VSNet as my IDE and MS link makes PDB files for debugging info.
Posted on 2003-08-12 02:49:58 by ThoughtCriminal
I do not think it is tough, but I think it is time consuming. ;)

Actually if you are going to code an assembler, I think you should also read up on opcodes and understand how opcodes are encoded. I think the hardest part of coding an assembler would be coding the parser and the pre-parser.
Posted on 2003-08-12 09:20:57 by roticv
Time will be related to complexity. Some people have been already working for years on their new assemblers and still have not yet reached their final goal.

If you keep it to its simplest form (i.e. no macros, no libraries, etc.) you may be able to complete it within a few thousand man-hours.

Have fun

Raymond
Posted on 2003-08-12 10:17:44 by Raymond
It's fun writing your own assembler. The output must be 100% accurate of course which requires a lot of discipline, testing and hard work. The fun part is deciding on the syntax which you like best, but this is best done by consulting as widely and as thoroughly as you can with other assembler programmers, because everyone has different ways of doing things.
Posted on 2003-08-12 17:00:01 by jorgon
im gonna go as closely with the intel instruction manuals as i can i guess...it'll prolly be a barebones assembler, i'll only provide support for defines, equates and macros in addition to the basic stuff

i've already read up on opcodes and stuff and while it seemed a bit tuff at first with a bit of practise i have the basics down

if i do decide on actually going ahead with it, what i think ill have to do is maintain a list sumwhere of the basic instruction mnemonic-to-opcode conversion, like a table or sumthing, common to all the intel processors (say, from 386 on up), then one list for each of the processors which has instructions that the others doesnt and so on...there are many things i still dont know abt assemblers of course...so im gonna need help from u guys quite often i guess ;)
Posted on 2003-08-12 17:35:27 by AnotherWay83
I wish you all the luck then. I think your project sounds interseting. :)
Posted on 2003-08-13 08:04:09 by roticv
you can acces the CVS of nasm like this commands...

cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/nasm login

cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/nasm co modulename

or download tortoise or other tool if are in win...., also can acces in this way http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/nasm


if you want to see how many time and code can take you make a compiler, a very large compiler!!!!, with very complex structs and suchs things ;) (is for C, C++), or can make other language...., you can acces here...

cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/mingw login

cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/mingw co modulename

or here: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/mingw


for the fasm sources like I see, you can acces only if you download the package of fasm that are include the source files there.


Nice day.
Posted on 2003-08-13 09:45:43 by rea
From what I have seen, translating mnemonic to opcode is not easy but certainly not the hardest task you will face. A robust parser and a symbol table strategy that is both fast and open to expansion as you add features is the hardest part. For starting I would suggest Jorgon's strategy for macros (see the GoAsm manual), then if you like enhance them later if there is a need, generally GoAsm's macros are the simplest and least powerful but 99% of the time they will do everything you need. As a template for how an assembler should look, with built in Unicode and library support as well as a syntactical structure that is not somewhere out in left field the best thing you can check is GoAsm.
Posted on 2003-08-13 10:52:39 by donkey
I dont know much about this assembler, but is free too, and you can see the code, you can read a little in his page http://www.tortall.net/projects/yasm/ there you can acces too the cvs repository (for see the source code), or only download it and see how it work, is nasm based sintaxis is the only things that i know :D, for be near to the output formats that have now nasm, is far (i think.. dont sure!!!!), have some for elf and win, ok, aparently other good source where you can learn a little more ;).

>>edited

You can find another one diferent point of view :), and you can see the autor for this forum too ;), the diference is that is JIT (just in time), you need real a little about this if you want ;).
http://sourceforge.net/projects/softwire/

Also for the last thing, you can see that diferent people do in diferent way, here you have sources, and like yuou will see, you can only translate the opcodes, but that will be maybe only for a raw output.. bin format i think, also you need suport the labels, offsets, sections and such things if you whant a little more flexibility.

You can see how a project grow, think in mingw i remember that have like 23-28 members working, and i dont know if all they code or other make test, in C writed style, and you get suport for C++ "like a front end"?? :D, also not is only the compiler, have tools like make and others that you find in a *nix enviroment. You need read the docs for compile itself the last version(only if you whant to compile it).

nasm have less oficial developers 12 and is ansi C is portable for this thing, you can run on macOS, lin,win, and others OS's that have suport for a ansi C compiler in your plataform.

fasm is asm writed and like i know only one member working, also other people some time help, 3 developers, it can compile itself or assemble.

yasm is open too, and is ansi C with a little view of OO, see that is not OOP or C++, is C, with design of OO, is like i understand of some autor note, i dont know how many developers do this.

Respect to goasm is not open source?, i dont use it ;), but like i see, is not only a assembler, have a complete set of tools, by this way is a very more large than the major part of the other assemblers (maybe exept masm) that have too a specific linker and resource compiler, but for the free assemblers, aparently is the most large project, not only covering the asembly time ;). question: is work of only the autor???, i say only one developer??


Woo, a lot of resource for see for free ;), maybe you dont need all, but you can read a little fast over all (not mingw is very large... lol, but you can read the internals a little for see a little abstraction), and get diferent ideas if you want of the diferent projects out there, gl && hf.

Nice day.
Posted on 2003-08-14 12:24:37 by rea