Quite a bit general tip, but
PE EXE has a few flaws making the format pretty much useless in code-golf. First one is the image aligning (Windows won't run the EXE file if it's not aligned properly), and the second one is the header size. There are a few factors that aren't this important (dividing the executable into sections).
Advantages of using COM file format (that is pretty much equivalent to flat binary) are:
- Zero header code, file isn't divided into sections
- No image aligning (so the image size might not be divisible by a strictly defined power of two, but it has to be smaller than 65K. It doesn't change much though, because if your submission is larger than 65K, you're doing something wrong).
- You can't use external libraries - this is actually a plus, because you without doubt have other way to perform I/O. That's where BIOS interrupts come handy.
- You have direct control over the memory and devices linked up to the system, therefore there is no paging, no access violations, no memory protection, no concurrency, so on and so forth. These features make it easier to golf really creative programs.
I've revised your code to work as flat binary. It's dead simple:
ORG 100H
MOV DX, P
MOV AH, 9
L:
INT 21H
INT 21H
INT 21H
INT 21H
INC BYTE [P]
CMP BYTE [P], 'Z'
JLE L
MOV AX, 4C00h
INT 21h
P DB "A", 10, "$"
The output binary is just 32 bytes big. I believe, it's possible to reduce the size even further, but this is just a starting point.
Assemble with nasm -fbin file.asm -o file.com
. Note, this example has been made for NASM, but you can translate it freely to FASM, and it will work flawlessly.