Many months ago, one listless Sunday afternoon, I crafted a stupidly inefficient program using the already long-winded assembly language
. This is quite possibly the dumbest way to print "Hello world!" to the DOS
standard output using NASM
..start mov ax,0B800h
rep stosw ;Clear the screen (just to be safe!)
int 10h ;Reset cursor to 0,0
findchar mov cl,0 ;Search every ASCII character from 0...
cmp byte cl,[ds:_message+bx]
jmp findchar ;Until required letter is found
print mov ah,7
mov byte al,cl
stosw ;Get char and store character in stdout...
cmp bx,12 ;Check for end of string...
jmp findchar ;Then do it all over again!
end mov ax,4C00h
_message db "Hello world!"
A similar effect could probably be achieved in less than ten lines, although saying that, the above program would probably still be more efficient than cout << "Hello world!" (at least with my POS compiler)