flat assembler
Message board for the users of flat assembler.

Index > Heap > Write smaller than this in asm

Author
Thread Post new topic Reply to topic
0.1



Joined: 24 Jul 2007
Posts: 474
Location: India
0.1
Sorry for being a spoilsport.
Many guys seem to take pride in writing programs that are smallest
possible in executable size, although their source file sizes are far
from being small.
So, can you write a program which is small in executable size,
and in source file size also.
Quote:

# This is perl script, it prints 7 random 2-digit spaced numbers.
@m='01'..'42';print$m[rand@m-1].' ',for 1..7;

Can you write smaller than this in asm?

_________________
Code:
 o__=-
 )
(\
 /\  
    
Post 24 Jul 2007, 13:21
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2466
Location: Bucharest, Romania
Borsuc
With a macro? Sure:

Code:
Apply    


however I know you'll also ask for the body of the macro which is part of source. But Perl comes with the "print" function as well Wink
Post 24 Jul 2007, 13:26
View user's profile Send private message Reply with quote
0.1



Joined: 24 Jul 2007
Posts: 474
Location: India
0.1
No I will not ask for the source of macro, just make sure the source compiles
on my system as well, and it's a complete source.

I would do this:
Code:
include 'm'
R
    

13 bytes of code and ? bytes of excutable Wink

PS:
If done in that cunning way, in Perl it will be like:
Quote:

use R

5 bytes of source.
Post 24 Jul 2007, 13:32
View user's profile Send private message Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio
the ethernal flame war betwen HLL <-> ASM Smile
Quote:
Can you write smaller than this in asm?

does it means something?
Code:
;this instruction rotates bits in eax
rol eax,1
    

can you write small than this in perl?
i also have a Operative system wich fits on a floppy including sources
can you do something similar in perl?
Most (or all) assembly programmers know also some high level languages
and we have our reasons to stay with assembly.
I do not mean that assembly is good for everything but is far from being
died or useless.
Post 24 Jul 2007, 14:00
View user's profile Send private message Visit poster's website Reply with quote
0.1



Joined: 24 Jul 2007
Posts: 474
Location: India
0.1
Well Octavio you're absolutely right.
My post was meant to be fun, I myself admire the power of assembly.
But then, looks like you misunderstood me ...
And as for your question (I'm not serious yet, ok, it's just leisurely, right?)
I can assume a function built in or user defined and can do this:
Quote:

ror num, 1;
ror str, 1;
ror arr, 1;
ror file, 1;
ror database, 1;

Wink
Post 24 Jul 2007, 14:08
View user's profile Send private message Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio
0.1 wrote:

But then, looks like you misunderstood me ...

Yes it looks like i misunderstood you, sorry.
if this interest to you, there are assembler languages with a shorter syntax like octasm and terse.
and there is also forth.
But i think that the most important is not the language but the programmer.
Post 24 Jul 2007, 15:38
View user's profile Send private message Visit poster's website Reply with quote
0.1



Joined: 24 Jul 2007
Posts: 474
Location: India
0.1
Yeah. It all depends on the programmer.
See my asm solution (above, 2nd reply), can you write smaller than that in fasm?
Post 25 Jul 2007, 04:04
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
Don't forget API calls. If your programs are API happy, your exe will be small, and you don't have to do much calulating since that's what the API does for you.

And for small code, big file...

Code:
db 1024*1024*1024 dup 0    


Small source, big bin... 23 byte source, 1 gig program, which is all nop.
Post 25 Jul 2007, 04:30
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
0.1



Joined: 24 Jul 2007
Posts: 474
Location: India
0.1
Ok. You too are tight err ... right Wink
Post 25 Jul 2007, 04:45
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
m?
Post 25 Jul 2007, 04:46
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
0.1



Joined: 24 Jul 2007
Posts: 474
Location: India
0.1
Shocked Question

_________________
Code:
 o__=-
 )
(\
 /\  
    
Post 25 Jul 2007, 04:58
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
I'm asking what you ment by "tight."
Post 25 Jul 2007, 05:31
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
0.1



Joined: 24 Jul 2007
Posts: 474
Location: India
0.1
kohlrak wrote:
I'm asking what you ment by "tight."

That was a typo and I just left it in Cool

_________________
Code:
 o__=-
 )
(\
 /\  
    
Post 25 Jul 2007, 06:03
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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 can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.