The MASM Forum Archive 2004 to 2012
Welcome, Guest. Please login or register.
March 23, 2023, 08:38:07 AM

Login with username, password and session length
Search:     Advanced search
128553 Posts in 15254 Topics by 684 Members
Latest Member: mottt
* Home Help Search Login Register
+  The MASM Forum Archive 2004 to 2012
|-+  Miscellaneous Forums
| |-+  16 bit DOS Programming
| | |-+  Smallest Executable to write "Hello World" to the screen
« previous next »
Pages: 1 2 [3] 4 Print
Author Topic: Smallest Executable to write "Hello World" to the screen  (Read 36506 times)
oex
Futurist EDIT: In Training
Member
*****
Gender: Male
Posts: 2008


Everything = Maths * Community2


Re: Smallest Executable to write "Hello World" to the screen
« Reply #30 on: November 20, 2010, 01:47:10 AM »

It actually prints "Hello,World" for me, not space but comma, is that legal? lol

(I tried it with space and that worked also lol)

PS. Does that mean I technically win lol
Logged

We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv
Antariy
Member
*****
Gender: Male
Posts: 1041


Re: Smallest Executable to write "Hello World" to the screen
« Reply #31 on: November 20, 2010, 01:49:24 AM »

It actually prints "Hello,World" for me, not space but comma, is that legal? lol

(I tried it with space and that worked also lol)

This is correct - I used not space.

For pure historical DOS, there is one more update  lol



Alex

* 2byteHelloWorld.zip (0.26 KB - downloaded 340 times.)
Logged
jj2007
Member
*****
Gender: Male
Posts: 6011



Re: Smallest Executable to write "Hello World" to the screen
« Reply #32 on: November 20, 2010, 01:55:52 AM »

Any idea why jmp word ptr ss:[82h] does not work?
Logged

Antariy
Member
*****
Gender: Male
Posts: 1041


Re: Smallest Executable to write "Hello World" to the screen
« Reply #33 on: November 20, 2010, 01:57:51 AM »

Any idea why jmp word ptr ss:[82h] does not work?

Because this is level of inderection - you jump not to address 82, but to address, which is specified in WORD placed at address 82.
I guess my English not help...
Logged
Antariy
Member
*****
Gender: Male
Posts: 1041


Re: Smallest Executable to write "Hello World" to the screen
« Reply #34 on: November 20, 2010, 02:02:11 AM »

It actually prints "Hello,World" for me, not space but comma, is that legal? lol

By the way, you can enter very very very long (up to ~110 chars) string for printing - and this will have no influence for program size  BigGrin

P.S. you can edit .BAT file because it contain only printable chars.
Logged
GregL
Member
*****
Gender: Male
Posts: 1897



Re: Smallest Executable to write "Hello World" to the screen
« Reply #35 on: November 20, 2010, 02:16:00 AM »

Alex,

Your program + .bat file works on Vista (32-bit) too.
Logged
Antariy
Member
*****
Gender: Male
Posts: 1041


Re: Smallest Executable to write "Hello World" to the screen
« Reply #36 on: November 20, 2010, 02:18:35 AM »

Alex,

Your program + .bat file works on Vista (32-bit) too.

Thank you, Greg!
Logged
japheth
Guest


Email
Re: Smallest Executable to write "Hello World" to the screen
« Reply #37 on: November 20, 2010, 07:53:22 AM »

This "EB 80" 2-byte program was also discussed in the FASM forum:

http://board.flatassembler.net/topic.php?t=10847

here's the clean Masm version, without tricks like "JMP $-7Eh":

Code:
CGROUP group PSP, _TEXT

PSP segment at 0
db 82h dup (?)
cmdl:
db 7eh dup (?)
PSP ends

_TEXT segment 'CODE'
start:
jmp short cmdl
_TEXT ends

end start

to be linked with "link16 /tiny ..."
Logged
dedndave
Member
*****
Posts: 12523


Re: Smallest Executable to write "Hello World" to the screen
« Reply #38 on: November 20, 2010, 11:32:55 AM »

there is nothing wrong with this method, either...
Code:
        .MODEL  TINY

_TEXT   SEGMENT WORD PUBLIC 'CODE'

        ORG     82h
Branch:

        ORG     100h
_main   PROC    NEAR

        jmp     Branch

_main   ENDP

_TEXT   ENDS

        END     _main
of course, you can use a Start: label instead of a _main proc, if you prefer

thing is - if you need a batch file to get the results, i say you have defeated the purpose of the contest   Tongue
Logged
jj2007
Member
*****
Gender: Male
Posts: 6011



Re: Smallest Executable to write "Hello World" to the screen
« Reply #39 on: November 20, 2010, 11:58:47 AM »

thing is - if you need a batch file to get the results, i say you have defeated the purpose of the contest   Tongue

You don't need a batch file, actually. But you should know how to use Alt nnn at the DOS prompt BigGrin
Logged

dedndave
Member
*****
Posts: 12523


Re: Smallest Executable to write "Hello World" to the screen
« Reply #40 on: November 20, 2010, 12:06:44 PM »

i know how to do it   Tongue
but, who can remember the sequences   lol
it reminds me of booting a tape drive on a PDP11 with the front panel switches
a sequence which i, at one time, had memorized - now happily forgotten

at any rate, the point of the post: you don't need to open a segment at 0 for the PSP
the code segment naturally encompasses the PSP in a .COM program
Logged
japheth
Guest


Email
Re: Smallest Executable to write "Hello World" to the screen
« Reply #41 on: November 20, 2010, 04:25:51 PM »

at any rate, the point of the post: you don't need to open a segment at 0 for the PSP
the code segment naturally encompasses the PSP in a .COM program

You're right. I had the idea that with the AT segment there is no risk that a linker adds 256 null- bytes to "fill" the gap, but this isn't necessary. Also, some linkers won't accept an AT segment in a group.
Logged
Antariy
Member
*****
Gender: Male
Posts: 1041


Re: Smallest Executable to write "Hello World" to the screen
« Reply #42 on: November 20, 2010, 09:18:37 PM »

thing is - if you need a batch file to get the results, i say you have defeated the purpose of the contest   Tongue

Well, since I saw that other programs uses passed string as Message, that why I cannot use passed string for code?
The program itself is just vulnerable application, which allow execution of arbitrary code, code in shell-style. Tongue

So, my version is just from model line of: "http://www.masm32.com/board/index.php?topic=10252.msg125593#msg125593wink



Alex
Logged
Antariy
Member
*****
Gender: Male
Posts: 1041


Re: Smallest Executable to write "Hello World" to the screen
« Reply #43 on: November 20, 2010, 09:31:00 PM »

This "EB 80" 2-byte program was also discussed in the FASM forum:

I'm have nothing to say contrary. For 30 years of DOS existence, I'm sure - thousands of peoples reinvent the same many times.



Alex
Logged
japheth
Guest


Email
Re: Smallest Executable to write "Hello World" to the screen
« Reply #44 on: November 21, 2010, 09:07:16 AM »

I'm have nothing to say contrary. For 30 years of DOS existence, I'm sure - thousands of peoples reinvent the same many times.
My post was merely informational.
Logged
Pages: 1 2 [3] 4 Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP The MASM Forum Archive 2004 to 2012 | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!