I have just recently rediscovered the source code of a text editor application I wrote … long time ago as a university project (possibly in 1999 or even before). It is sort of the resemblance of my favourite then editor, Borlands’ Turbo Pascals’ IDE. Just a hint to see how it looks:
I was thinking that vow, today I’d really like to have it in my Linux console, since it’s basically a … text mode application. So I tried to read its’ source code… and that’s when it struck me that this application will never make on Linux, since … it uses direct memory addressing, such as:
type scrtype=array[1..2000] of word; var screen:scrtype absolute $B800:0;
and it’s full with assembly instructions and direct memory access, in the form of:
procedure flip;ASSEMBLER; asm push ds mov ax, 0b800h mov es, ax mov ax, Tseg mov ds, ax xor si, si xor di, di mov cx, 1000 db 0F3h, 066h, 0A5h pop ds end;
Down even to the level of hardcoding the rep movs WORD PTR es:[edi],WORD PTR ds:[esi] instruction into hexa bytes since the builtin assembler of Turbo Pascal was choking on this instructions and did not compile it.
Little did I know in those days, about writing portable applications … what the heck, we didn’t even had a Linux computer at our university.
Today the times have changed a bit. I write all my applications in standard compliant C++, and test it on multiple systems, on various compilers and OS’s. That is the only way that ensures maximum portability and maintainability.