USAGE:My personal preference is, when I write this;
Code:
@@: mov ah, [edi - 1]
mov al, ' '
push edi
rep stosw
mov cl, dl
inc ch
pop edi
pop esi
I see this disassembly
Code:
00000040 8A67FF mov ah,[edi-0x1]
00000043 B020 mov al,0x20
00000045 57 push edi
00000046 F366AB rep stosw
00000049 88D1 mov cl,dl
0000004B FEC5 inc ch
0000004D 5F pop edi
0000004E 5E pop esi
So there is a one to one correlation between source and object. WYSIWYG in essence. As my project is focused strictly on X86 and BIOS, tools like FASM & NASM are sufficient and my project is not dependant file systems or shared libraries.
MODULARIZATION:I don't concern myself too much with size, but keep subject matter contained. As an example, currently I'm working on a comprehensive algo to display text on an 80 x 25 (16 color) display that uses characters (1 - 31) for special functions and formatting in one file. Then there will be another for conversion routines Binary -> ASCIIZ and vise versa.
REGISTERSAs I've done quite a bit of Win32 programming, I've adopted M$ preserve everything except EAX, ECX & EDX. This is predicated entirely on specifics of routine, but it is a general rule of thumb I use. Because of this, I've also adopted CDECL calling convention. LEAVE or MOV ESP, EBP at epilogue is a convenient means by which to make sure stack doesn't get out of control.
I never use macros or any higher level constructs, but amply document my code although previous example doesn't show it.