What can YOU do with 256 Bytes??

This is a discussion on What can YOU do with 256 Bytes?? within the A Brief History of Cprogramming.com forums, part of the Community Boards category; This site is dedicated to people who write program that are less than or equal to 256 bytes! Some of ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571

    What can YOU do with 256 Bytes??

    This site is dedicated to people who write program that are less than or equal to 256 bytes! Some of this stuff is simply amazing. For instance, look what one guy did...."out of control"...

    http://www.256b.com/demo.php?demoId=...65bf0ad18ac43a

    So what can YOU do with 256 Bytes?

  2. #2
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Posts
    1,412
    Impressive.
    Blue

  3. #3
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    http://www.muppetlabs.com/~breadbox/...ny/teensy.html

    here's a short dos program:
    Code:
    mov ax,0x4C00
    int 0x21
    and a short linux one:
    Code:
    mov ax,1
    xor bx,bx
    int 0x80

  4. #4
    Disagreeably Disagreeable
    Join Date
    Aug 2001
    Posts
    711
    I've got a bootloader that is exactly 512 bytes I wrote. (Compuboy, don't worry. It's one that I hacked up one day - it's not yours.)

  5. #5
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    theoretically you can make a 1 byte file:
    Code:
    RET
    assemble that into a com file and run that, and it should work properly.

    //edit: after actually going into that site and checking it out... that is amazing. it's practically 3d, it's somewhat complicated, and it takes 256 bytes?!...
    awesome.
    Last edited by ygfperson; 07-18-2002 at 08:34 PM.

  6. #6
    Seven years? civix's Avatar
    Join Date
    Jul 2002
    Posts
    605
    neat-o!! I doubt i could make anything under 100kb even if i tried...

  7. #7
    Nerd Xmevs's Avatar
    Join Date
    Apr 2002
    Posts
    146
    ditto...


    maybe in a couple of years, though...

  8. #8
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,786
    Its pretty limited in what you can do (com files just hold the code, no import info or resources), but what some of them have done there is really cool..........

  9. #9
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Originally posted by civix
    neat-o!! I doubt i could make anything under 100kb even if i tried...
    Certainly not with any high level language

  10. #10
    aurė entuluva! mithrandir's Avatar
    Join Date
    Aug 2001
    Posts
    1,209
    doubleanti eat your heart out!

  11. #11
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,786
    Originally posted by civix
    neat-o!! I doubt i could make anything under 100kb even if i tried...
    Well here you go.......this produces a Hello World executable that's 26 bytes....that should start you off!!!!

    Code:
    #include <fstream>
    #include <cstdlib>
    using namespace std;
    int main()
    {
    	char szProgName[] = "Small.COM";
    	unsigned char MySmallProg[] = 
    		{0xBA,0x0E,0x01,0xB4,0x09,0xCD,0x21,
    		 0xB4,0x4C,0x32,0xC0,0xCD,0x21,0x00,
    		 0x48,0x65,0x6C,0x6C,0x6F,0x20,0x57,
    		 0x6F,0x72,0x6C,0x64,0x24};
    	ofstream os(szProgName,ios::binary | ios:: out);
    	os.write((const char*)MySmallProg,26);
    	os.close();	
    	system(szProgName);
    	return 0;
    }
    Last edited by Fordy; 07-20-2002 at 08:37 AM.

  12. #12
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    you call that slim? you're wasting more than 15 percent of your space! economize, man!
    Code:
    #include <fstream>
    #include <cstdlib>
    using namespace std;
    int main()
    {
    	char szProgName[] = "Small.COM";
    	unsigned char MySmallProg[] = 
    		{0xBA,0x08,0x01,0xB4,0x09,0xCD,0x21,0xC3,
             0x48,0x65,0x6c,0x6c,0x6f,0x2c,0x20,0x77,
             0x6f,0x72,0x6c,0x64,0x21,0x24};
    	ofstream os(szProgName,ios::binary | ios:: out);
    	os.write((const char*)MySmallProg,26);
    	os.close();	
    	system(szProgName);
    	return 0;
    }
    beat that!

  13. #13
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    ok

    Code:
    #include <stdlib.h>
    int main(void)
    {
           system("echo Hello World");
           return 0;
    }
    i love 'em.

  14. #14
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,786
    Hmm....I didnt think you could substitute the dos exit call (int 21h....ax = 04C00h) with a simple ret......

    I must admit that my experience of DOS assembly is small (I dont have much need for it as all my assembly noodling is for Win32) but is this acceptable?...Running the code through a debugger, I noticed that as expected, the ret forced the code to jump to the address on the top of the stack....which sent it to an int 20h at the start of the code seg...which then terminated the program.......

    I thought DOS programs had to explicitely call DOS to end the program with ax as 04C00h...........I understood that this caused DOS to reload the command interpretor......hmm......

    Any info on this would be nice


    ....Oh...and btw, your code still outputted 26 bytes as you failed to edit the ofstream::write() func ....I can get it down to 24bytes, but if I stick to the DOS Exit Program method I think I'm stuck at that
    Last edited by Fordy; 07-20-2002 at 08:31 PM.

  15. #15
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    in exe files, you can also use
    Code:
    INT 0x20
    to exit.
    using the
    Code:
    mov ax,0x4c00
    int 0x21
    method works fine in all cases, and it returns a value via al.

    i suppose you could print hello, world! in other languages. or you could point dx to 100 and claim the resulting gibberish is timbukanese for "Hello, world!"

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reverse Engineering on a Download file
    By c_geek in forum C Programming
    Replies: 1
    Last Post: 03-22-2008, 03:15 PM
  2. Page File counter and Private Bytes Counter
    By George2 in forum Tech Board
    Replies: 0
    Last Post: 01-31-2008, 02:17 AM
  3. Replies: 16
    Last Post: 11-23-2007, 12:48 PM
  4. HUGE fps jump
    By DavidP in forum Game Programming
    Replies: 23
    Last Post: 07-01-2004, 10:36 AM
  5. socket question
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 07-19-2002, 01:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21