Since we are talking about compiler and linker here, actually I have a goal that is to create my own Win32 compiler in its most primitive form, i.e. supports only limited set of commands, and there is no conditional evaluation, no iterative construct, no user-defined variable etc.
I am not sure if any of you heard LTA compiler(my DOS compiler) which generates .COM binary executable supporting 47-commands.
But DOS is DOS, I want to port it to Win32 supporting PE file format.
I am planning to use Free Pascal to write this simple Win32 compiler, and I would expect some hard-coded Assembly instructions.
This going-to-be Win32 compiler of mine is not meant to compete with FPC in any way by any means. No, it is far inferior than FPC. My goal is to learn portable executable format while having a sense of achievement.
Currently, it would support three functions:
WAITKEY (ReadConsoleA, kernel32.dll)
PRINT (WriteConsoleA, GetStdHandle, kernel32.dll)
MSGBOX (MessageBoxA & wsprintfA, user32.dll)
and EXIT (ExitProcess, kernel32.dll)
I know some basic structure of PE file format like Code / Data section and Import Table. RVA, VA and RAW. Also header setting like File Alignment (512 bytes at least).
But I need motivation. Will anyone of you support my idea?
Questions:
-Is there any PE file format spec in Pascal typed record? (winnt.h is in C)
(I know there is one member here who wrote PEDump)
- Is it okay to talk about creating a compiler as hobby project on this forum?
(Look, my proposed 'compiler' is not even near a compiler by standard definition)
