flat assembler
Message board for the users of flat assembler.

Index > Main > Interesting task

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
jorom



Joined: 12 Dec 2004
Posts: 8
Location: Russia
jorom 17 Dec 2004, 21:29
In institute have set such task: to make the program "Hello world!" in the size no more than 16 bytes! It is real?

_________________
sorry for my english
Post 17 Dec 2004, 21:29
View user's profile Send private message Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld 18 Dec 2004, 00:50
Code:
mov ah,9
mov dx,$82
int $21
ret    

compile to hello.com and use as hello Hello, World!$
Post 18 Dec 2004, 00:50
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
jorom



Joined: 12 Dec 2004
Posts: 8
Location: Russia
jorom 18 Dec 2004, 20:41
no command line use!

opcodes?
Post 18 Dec 2004, 20:41
View user's profile Send private message Reply with quote
beppe85



Joined: 23 Oct 2004
Posts: 181
beppe85 18 Dec 2004, 22:33
Hello world! by its own have 16 bytes...
Post 18 Dec 2004, 22:33
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 18 Dec 2004, 22:49
beppe85 wrote:
Hello world! by its own have 16 bytes...


only 12. Wink
Post 18 Dec 2004, 22:49
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
beppe85



Joined: 23 Oct 2004
Posts: 181
beppe85 18 Dec 2004, 23:04
JohnFound wrote:
beppe85 wrote:
Hello world! by its own have 16 bytes...


only 12. Wink


Laughing out loud. Laughing

I don't know how I passed the Math class this semester... Embarassed

So, there's a way, you have four bytes, jorom(iicc - if i conted correctly) Very Happy
Post 18 Dec 2004, 23:04
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 18 Dec 2004, 23:33
maybe use some bytes of string as instructions?
Post 18 Dec 2004, 23:33
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
jorom



Joined: 12 Dec 2004
Posts: 8
Location: Russia
jorom 19 Dec 2004, 00:25
It is necessary to code each symbol in several bits
....
????
Post 19 Dec 2004, 00:25
View user's profile Send private message Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv 19 Dec 2004, 08:22
vid, not possible I think
Post 19 Dec 2004, 08:22
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 19 Dec 2004, 08:59
if we make all chars lower case and sub $60 from every one, the most of them will become 4bit. Wink decompression in 10 bytes...
Post 19 Dec 2004, 08:59
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 19 Dec 2004, 12:23
isn't there something in dos that exits and displays string? such call could fit into 4 bytes.

Maybe you COULD use "$" or "d$" as some instruction, too bad i am now under linux with which i am unfamiliar and where i don't have HIEW to try...

JohnFound: decompression would take too much place then.

One trick that will save one byte - instead of "$" you could pass CTRL-C character, so retn wouldn't be needed
Post 19 Dec 2004, 12:23
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 21 Dec 2004, 22:23
Well, asmdaemon fit pallette in 32bytes and it was beautiful:)
Post 21 Dec 2004, 22:23
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
fasm9



Joined: 19 Jun 2003
Posts: 439
fasm9 22 Dec 2004, 22:01
hello.exe written in c(dev-cpp 4.9.9.1) with upx is 3kb, which is less than 4kb.

so what's different 12byte and 4kb??

--
Post 22 Dec 2004, 22:01
View user's profile Send private message Reply with quote
polygon7



Joined: 14 Aug 2003
Posts: 62
Location: Poznan, Poland
polygon7 23 Dec 2004, 11:51
fasm9 wrote:
hello.exe written in c(dev-cpp 4.9.9.1) with upx is 3kb, which is less than 4kb.

so what's different 12byte and 4kb??


For simple "hello world" 4kb is too large.

With MSVC 6.0 you can make it in 1kb (without exe compression,
src in attachement). I think that is possible to make 1kb "Hello World"
in Dev-cpp too. For compresion such small files best compressor is FSG 2.0


Description: Simple "Hello World" in 1kb
Download
Filename: 1kb_Hello_world.rar
Filesize: 6.9 KB
Downloaded: 452 Time(s)


_________________
best regards
p7
Post 23 Dec 2004, 11:51
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 23 Dec 2004, 13:41
AFAIR, the task was for 16 bytes DOS .com file "Hello world"... Wink
I have a feeling that it is possible.
Jorom, what exactly is the string that have to printed?
"Hello world!" or "Hello world" or even "hello world"?

Regards
Post 23 Dec 2004, 13:41
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 23 Dec 2004, 14:17
Yes, that's right - if you can ignore the case you might pack those ll.....l-s and o..o-s with only h, e, w, r and d in singular Wink

someone suggested packing them in 4 bits - so printing with (char+65) in not much of an overhead thinking of unpacking in mind...
What do you guys think. Haven't dealt with com programming much - just a theory.
Post 23 Dec 2004, 14:17
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
iklin



Joined: 20 Mar 2004
Posts: 120
Location: Russia, Siberia
iklin 24 Dec 2004, 16:56
FSG doesn't do the trick for fasm. Sad or Smile
Post 24 Dec 2004, 16:56
View user's profile Send private message ICQ Number Reply with quote
Nikolay Petrov



Joined: 22 Apr 2004
Posts: 101
Location: Bulgaria
Nikolay Petrov 27 Dec 2004, 22:30
jorom wrote:
In institute have set such task: to make the program "Hello world!" in the size no more than 16 bytes! It is real?

Very Happy it's possible if computer name is "Hello World!", or you did something else before start the programe (for example batch "programe" writing "He.." is a 17 bytes)
Post 27 Dec 2004, 22:30
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 28 Dec 2004, 11:10
FASMW->Options->Appearance
is EXACTLY 16bytes (with listing)
Code:
org 256
txt db "HELLO!$"   ;48 45 4C 4C 4F 21 24
    Trasl:         ;DEC AX
                   ;INC BP
                   ;DEC SP
                   ;DEC SP
                   ;AND [SI],SP
mov ah,9           ;B4 09
mov dx,txt         ;BA 09 01
int 33             ;CD 21
int 32             ;CD 20

;"HELLO WORLD!$"
;db 48 45 4C 4C 4F 20 57 4F 52 4C 44 21 24
    Trasl2:        ;DEC  AX
                   ;INC  BP
                   ;DEC  SP
                   ;DEC  SP
                   ;DEC  DI
                   ;AND  [BX+4Fh],DL
                   ;PUSH DX
                   ;DEC  SP
                   ;INC  SP
                   ;AND  [SI],SP
;"TERE,MAAILM!$" Maybe in Estonian (rules state that there must be a comma)
;db 54 45 52 45 2C 4D 41 41 49 4C 4D 21 24
    Trasl3:        ;PUSH SP
                   ;INC  BP
                   ;PUSH DX
                   ;INC  BP
                   ;SUB  AL,4Dh
                   ;INC  CX
                   ;INC  CX
                   ;DEC  CX
                   ;DEC  SP
                   ;DEC  BP
                   ;AND  [SI],SP    

but you can't have more than 6 characters Sad
but if you remove that "$", then you'll have a bunch of other unwanted
characters and a fifteen-byte-program Wink

_________________
My updated idol Very Happy http://www.agner.org/optimize/


Last edited by Madis731 on 28 Dec 2004, 12:18; edited 1 time in total
Post 28 Dec 2004, 11:10
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
bubach



Joined: 17 Sep 2004
Posts: 341
Location: Trollhättan, Sweden
bubach 28 Dec 2004, 12:16
do the program need to exit?
Post 28 Dec 2004, 12:16
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.