Pages: 1 [2] 3 4
|
 |
|
Author
|
Topic: Smallest Executable to write "Hello World" to the screen (Read 37109 times)
|
dedndave
|
i think you need the 8th byte... mov ah,9 mov dx,82h int 21h ret as for relying on DH=0, not sure that is a valid assumption under NTVDM
|
|
|
Logged
|
|
|
|
xandaz
http://morethangeeks.orgfree.com
Member
    
Gender: 
Posts: 543
I'm me again.
|
yeah,... well lets not forget that int 21h is a far call. So there's code beneath the instruction... Is it smaller? Don't know.... bye
|
|
|
Logged
|
|
|
|
dedndave
|
that is true however, .COM programs are executed similar to a NEAR CALL the reason a RETN instruction exits is that an INT 20h instruction is at CS:0000 and a 0000 pushed on the stack at program entry (CS = PSP)
|
|
|
Logged
|
|
|
|
xandaz
http://morethangeeks.orgfree.com
Member
    
Gender: 
Posts: 543
I'm me again.
|
ok ... i'm not sure we're understanding each other. If i do this... call PrintHelloWorldAndExit ...is everyone going to disregard the code parts in this procedure call? No? Yay, ive won!!! LMAO :)
|
|
|
Logged
|
|
|
|
Antariy
|
Did you talk about 16 programs only, or for Win32, too?
|
|
|
Logged
|
|
|
|
xandaz
http://morethangeeks.orgfree.com
Member
    
Gender: 
Posts: 543
I'm me again.
|
i think its DOS only antariy
|
|
|
Logged
|
|
|
|
Antariy
|
i think its DOS only antariy
Well, if it been Win32, then I can suggest a candidate...
|
|
|
Logged
|
|
|
|
jj2007
|
It's .com, actually... and it's 8 bytes short: .model tiny
.code org 100h start: mov ah, 09h ; write string to STDOUT mov dx, 82h ; get command line int 21h ; show it... ;-) ret end start
If that looks too complex, try this: .model tiny .code dq 0C321CD0082BA09B4h end
Batch file for testing: @ECHO OFF HelloWorldDOS.com Hellooo... world of Masm!$ echo. echo. echo. echo. pause
Well, if it been Win32, then I can suggest a candidate... Which one?
|
|
|
Logged
|
|
|
|
Antariy
|
Well, if it been Win32, then I can suggest a candidate... Which one? You are know  But it not only print HelloWorld 
|
|
|
Logged
|
|
|
|
Antariy
|
It's .com, actually... and it's 8 bytes short:
I can suggest to put code into command line specification, and at start of the program put the 2 byte jump to the command line  So, you just needed to avoid binary null in the code (this is easy), and enter the code as command line for the 2 bytes program, which just jump to command line. But I must warn that under Windows this is a bit tricky due to encodings difference. So, this is reliablest from DOS.
|
|
|
Logged
|
|
|
|
Antariy
|
Command line is something like (in hex, convert it to dec and enter it with Alt codes): B4 09 31 D2 B2 8B CD 21 C3 48 65 6C 6C 6F 2C 57 6F 72 6C 64 24
The program is: jmp 82
|
|
|
Logged
|
|
|
|
jj2007
|
jmp 82 h but...: error A2076: jump destination must specify a label
|
|
|
Logged
|
|
|
|
Antariy
|
There is a test with 2 byte program which print HelloWorld. To simplify things with different encodings, is written an .BAT file. On my system it works.
Alex
|
|
|
Logged
|
|
|
|
jj2007
|
Thanks, Alex - works like a charm on Win XP SP2... .model tiny .code dw 080EBh end
|
|
|
Logged
|
|
|
|
Antariy
|
Update in .BAT file - pause>nul
|
|
|
Logged
|
|
|
|
|
Pages: 1 [2] 3 4
|
|
|
 |