Smallest Executable to write "Hello World" to the screen

Started by Prince Wotoshi, November 01, 2008, 08:09:19 PM

Previous topic - Next topic

oex

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
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

Antariy

Quote from: oex 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)

This is correct - I used not space.

For pure historical DOS, there is one more update  :lol



Alex

jj2007


Antariy

Quote from: jj2007 on November 20, 2010, 01:55:52 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...

Antariy

Quote from: oex on November 20, 2010, 01:47:10 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  :bg

P.S. you can edit .BAT file because it contain only printable chars.

GregL

Alex,

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

Antariy


japheth

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":


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 ..."

dedndave

there is nothing wrong with this method, either...
        .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   :P

jj2007

Quote from: dedndave on November 20, 2010, 11:32:55 AM
thing is - if you need a batch file to get the results, i say you have defeated the purpose of the contest   :P

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

dedndave

i know how to do it   :P
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

japheth

Quote from: dedndave on November 20, 2010, 12:06:44 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.

Antariy

Quote from: dedndave on November 20, 2010, 11:32:55 AM
thing is - if you need a batch file to get the results, i say you have defeated the purpose of the contest   :P

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. :P

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



Alex

Antariy

Quote from: japheth on November 20, 2010, 07:53:22 AM
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

japheth

Quote from: Antariy on November 20, 2010, 09:31:00 PM
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.