Demo contest?
Anyone up for a demo contest? Just create something really visually appealing.
But wait, there's more! Let's have a size restriction, just for the heck of it, and make it something that's really restrictive. Anyone up for it?
But wait, there's more! Let's have a size restriction, just for the heck of it, and make it something that's really restrictive. Anyone up for it?
It's not magic, it's Ruby.
How about a UB in less than 24KiB, uncompressed
OneSadCookie Wrote:How about a UB in less than 24KiB, uncompressed
*commits seppuku*
My web site - Games, music, Python stuff
well hell, I know I'm entering a text app, so I'm not even linking to anything I don't think.
Ok, how about we have a size limit OVER the universal binary base?
Ok, how about we have a size limit OVER the universal binary base?
It's not magic, it's Ruby.
I believe that the 24KiB UB binary is achievable, but my ASM-fu is weak and has so far thwarted my attempts so far to get there...
OK, I've done it, even if I don't understand why the x86 half has to look like this...
hello.x86.s:
hello.ppc.s:
to build:
The results:
Most of the executables is zeroes (for padding) so they compress really well:
hello.x86.s:
Code:
.cstring
L_HELLO:
.ascii "Hello, world!\n\0"
.text
.globl start
start:
pushl $14
pushl $L_HELLO
pushl $1
movl $4, %eax
call L_syscall
addl $12, %esp
pushl $0
movl $1, %eax
call L_syscall
L_syscall:
int $0x80
rethello.ppc.s:
Code:
.cstring
L_HELLO:
.ascii "Hello, world!\n\0"
.text
.globl start
start:
li r0, 4
li r3, 1
lis r4, ha16(L_HELLO)
addi r4, r4, lo16(L_HELLO)
li r5, 14
sc
li r3, 0
li r0, 1
scto build:
Code:
as -arch ppc hello.ppc.s -o hello.ppc.o
as -arch i386 hello.x86.s -o hello.x86.o
ld -arch ppc hello.ppc.o -o a.out.ppc
ld -arch i386 hello.x86.o -o a.out.x86
lipo a.out.ppc a.out.x86 -create -output a.outThe results:
Code:
CookieJar:Desktop keith$ ls -l a.out*
-rwxr-xr-x 1 keith staff 16436 19 Oct 14:57 a.out
-rwxr-xr-x 1 keith staff 4148 19 Oct 14:57 a.out.ppc
-rwxr-xr-x 1 keith staff 4148 19 Oct 14:57 a.out.x86
CookieJar:Desktop keith$ ./a.out
Hello, world!
CookieJar:Desktop keith$ /usr/libexec/oah/translate a.out
Hello, world!Most of the executables is zeroes (for padding) so they compress really well:
Code:
CookieJar:Desktop keith$ gzip a.out*
CookieJar:Desktop keith$ ls -l *.gz
-rwxr-xr-x 1 keith staff 544 19 Oct 14:57 a.out.gz
-rwxr-xr-x 1 keith staff 324 19 Oct 14:57 a.out.ppc.gz
-rwxr-xr-x 1 keith staff 328 19 Oct 14:57 a.out.x86.gz
yea, I easily got a universal, nonlinked 4120 byte file.
By the way, I believe that if you compile and run the ppc version, you'll find it's returning 4 and NOT 1.
I think I can use c, but the inline assembly doesn't work correctly (for ppc); it complains of an undefined r2 when I attempt to reference c symbols from the assembly blocks.
By the way, I believe that if you compile and run the ppc version, you'll find it's returning 4 and NOT 1.
I think I can use c, but the inline assembly doesn't work correctly (for ppc); it complains of an undefined r2 when I attempt to reference c symbols from the assembly blocks.
It's not magic, it's Ruby.
Nayr Wrote:yea, I easily got a universal, nonlinked 4120 byte file.
Don't know what you mean by that. If you mean your .o file was that large, that's completely not the point; it's the linking step that adds the bloat. Coincidentally, my nonuniversal apps are 4120 bytes on Tiger.
Quote:By the way, I believe that if you compile and run the ppc version, you'll find it's returning 4 and NOT 1.
Don't know what you mean by that... it should exit with status 0. Unfortunately for me, on Tiger, it crashes when run in Rosetta. Don't know what's up with that.
Quote:I think I can use c, but the inline assembly doesn't work correctly (for ppc); it complains of an undefined r2 when I attempt to reference c symbols from the assembly blocks.
Well, I don't know what that issue would be... AFAIK, inline assembly works fine for plenty of people... but if you can convince GCC to produce a universal binary below 28KB you're doing better than I did.
excuse me, I meant a 4120 universal binary.
And, on ppc at the very least, the next instruction after a 'sc' is ignored; usually you use a 'nop,' but you could use any instruction if you truly want to confuse the reader of your code.
And, on ppc at the very least, the next instruction after a 'sc' is ignored; usually you use a 'nop,' but you could use any instruction if you truly want to confuse the reader of your code.
It's not magic, it's Ruby.
Nayr Wrote:excuse me, I meant a 4120 universal binary.
Given that the single-architecture executables are 4120 bytes each, I don't believe you

Quote:And, on ppc at the very least, the next instruction after a 'sc' is ignored; usually you use a 'nop,' but you could use any instruction if you truly want to confuse the reader of your code.
Ah, that explains that. I guess Rosetta on Leopard is buggy
Heh, this is my first time creating a universal binary, and I misused lipo. (I created a universal object file, but for some reason it only linked the ppc file :/)
the universal is now 16408 bytes... Why does it quadruple in size? surely it still uses two segments, making it 8192 bytes plus some...
the universal is now 16408 bytes... Why does it quadruple in size? surely it still uses two segments, making it 8192 bytes plus some...
It's not magic, it's Ruby.
Sir, e^iπ + 1 = 0, hence God exists; reply!
Awesome, unknown. But it's 3.1MB, that's not < 24KiB
Oooh. Lisajous curves. I threw something together a couple of weeks ago using some of those.
Lissajous worms
Not really a demo, but hey.
Lissajous worms
Not really a demo, but hey.
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Nice stuff Fax
©h€ck øut µy stuƒƒ åt ragdollsoft.com
New game in development Rubber Ninjas - Mac Games Downloads

