I only use the best: assembly language!
More than 25 years ago I wrote several small programs as auxiliary commands for Batch files. They were really small files, less than 400 bytes the majority. For example, below is my GetKey program that read a key from keyboard and return its Ascii code via ERRORLEVEL. This is the MS-DOS 16-bits version:
Code: Select all
mov ah,8 ;DOS function: Keyboard input without echo
int 21H ;AL = Ascii code of key pressed
mov ah,4CH ;DOS function: Terminate program
int 21H ;Return Ascii code via ERRORLEVEL
This program generate a .COM file 8 (eight) bytes long! This program requires several modifications to make it Windows 32-bits compatible, so the resulting .EXE file is 1,536 bytes long! (although many of these are zero-filled bytes required in .EXE file format).
In fairness, 16-bit DOS had no notion of character codes wider than 8-bit, no ANSI vs. OEM codepage concerns, no ALT+### keyboard input etc.
As for assembly, it is indeed what every other language translates down to, eventually. But as they say, one can write bad (or good) code in any language. I still have a skeleton C console-mode program somewhere, in perfectly valid 32b PE format, which parses and echoes back its arguments, compiled to an .exe of just 1,024 bytes. Only "hackish" part of it was to trim down the 16b stub - the one which prints "This program cannot be run in DOS mode" if you really tried to run it under 16b DOS - mine simply beeps, instead
The rest was a combination of "libctiny" and frugal compiler/linker switches.