I am using MASM 8.0 with Visual Studio 2005 and when I compile the simplest program like the example here it is sooooo big, but when I program for NASM and program for MS-DOS (.com files) they can be as small as like 10Bytes and such....


.386
.model flat

.code
main PROC
mov ax, 4Ch
int  21h
main ENDP
END main
Posted on 2008-01-09 12:09:09 by ExtremeCoder
There a couple of things to consider:


      [*] 32-bit version of 8086 instructions like MOV REG32, REG32 are usually bigger than their equivalent 16-bit or 8-bit versions. So while an instruction that uses REG8, REG8 could be 2 or even 1 byte, its equivalent for REG32, REG32 could be 5 bytes (these are just examples).
      [*] When writing .com files, your assembler will simple translate your opcodes to machine code and write them in a linear way in your destination executable file. Win32 API uses the PE format (Portable Executable). With having this format, you usually can't have PE (EXE/DLL/...) files smaller than 512 bytes. I remember somebody was hacking the PE format to get it smaller but I don't know if that worked. Again the sizes are just examples.
Posted on 2008-01-09 13:11:47 by XCHG
thanks
Posted on 2008-01-09 13:45:45 by ExtremeCoder