Hi, folks!
Just finished (i.e. ran out of ideas for improvement) my chess demo - Win32, OpenGL, 1.5 KB (!).
Some stats: 843 lines of asm; sizeof(data) = 755; 2.25 bytes / instruction on average.
Grab it at http://www.stud.uni-karlsruhe.de/~urkt/ (bottom of page).
While I'm at it :) - anyone interested in an article about / exchanging tips on optimizing for size?
Jan
Just finished (i.e. ran out of ideas for improvement) my chess demo - Win32, OpenGL, 1.5 KB (!).
Some stats: 843 lines of asm; sizeof(data) = 755; 2.25 bytes / instruction on average.
Grab it at http://www.stud.uni-karlsruhe.de/~urkt/ (bottom of page).
While I'm at it :) - anyone interested in an article about / exchanging tips on optimizing for size?
Jan
Nice chess set!:alright:
Keep going on!
Regards,
Vortex
Keep going on!
Regards,
Vortex
Well, it brought down Windows XP to the blue screen - haven't seen it in a long time. :) The code looks impressive - wish I had more time to spend on it. Good to see byte shaving still in style. :)
Doh :(
Could you send me (Jan.Wassenberg@stud.uni-karlsruhe.de) or post your imports.inc?
The demo used to run on XP; I've changed "just a few things" since then :rolleyes:
Could you send me (Jan.Wassenberg@stud.uni-karlsruhe.de) or post your imports.inc?
The demo used to run on XP; I've changed "just a few things" since then :rolleyes:
worked fine for me on winxp.... maybe i didnt' play long enough?
; System info:
; Win XP Service Pack 1 (Build 2600)
; NVIDIA Corporation GeForce3/PCI/3DNOW! 1.4.0
opengl32 equ 0x5ed00000
GetProcAddress equ 0x77e7b332
CreateWindowExA equ 0x77d4bc2f
GetMessageA equ 0x77d45aaf
GetDC equ 0x77d8a1bc
SetPixelFormat equ 0x77c9e963
TickCount equ 0x7ffe0000
%assign last_ord 1
; System info:
; Win XP Service Pack 1 (Build 2600)
; NVIDIA Corporation GeForce3/PCI/3DNOW! 1.4.0
opengl32 equ 0x5ed00000
GetProcAddress equ 0x77e7b332
CreateWindowExA equ 0x77d4bc2f
GetMessageA equ 0x77d45aaf
GetDC equ 0x77d8a1bc
SetPixelFormat equ 0x77c9e963
TickCount equ 0x7ffe0000
%assign last_ord 1
Scanning the memory of the system dlls is better than using fixed values 8)
See: http://www.programmingjournal.com/issue4/art3/index.htm
While I'm at it :) - anyone interested in an article about / exchanging tips on optimizing for size?
bitRAKE: Thanks.
I don't see anything suspicious; why should it work on BubbaFate's system and not yours? :confused: Usual question: do you have the latest drivers? BTW, anyone know how to detect this a) without too much effort b) in a somewhat portable fashion?
Hey bazik, good link!
First a note on the article: "There is another problem for WinNT/Win2K (at least proven for Win2K and guessed for WinNT) [...] that those operating systems don't run EXE files that have no import table". This is because thread startup code is in kernel32 => kernel32 needs to be loaded (pretty much any import will do, since they all reference kernel32).
What the guy is doing is basically GetProcAddress; in my case, regular imports would probably be smaller (there was a bit of space left in the header for the DLL strings).
Another alternative (from a couple versions back :)): grab the necessary functions from opengl32's IAT.
In case anyone's interested, here it is:
I switched to fixed offsets when I realized that this method is no less system dependent ;)
Anyway, I need the 'make' step to fixup the opengl32 ordinals (WinXP opengl32 lacks DllInitialize).
natas - Thanks! :) Added to my rather lengthy to-do list...
I don't see anything suspicious; why should it work on BubbaFate's system and not yours? :confused: Usual question: do you have the latest drivers? BTW, anyone know how to detect this a) without too much effort b) in a somewhat portable fashion?
Hey bazik, good link!
First a note on the article: "There is another problem for WinNT/Win2K (at least proven for Win2K and guessed for WinNT) [...] that those operating systems don't run EXE files that have no import table". This is because thread startup code is in kernel32 => kernel32 needs to be loaded (pretty much any import will do, since they all reference kernel32).
What the guy is doing is basically GetProcAddress; in my case, regular imports would probably be smaller (there was a bit of space left in the header for the DLL strings).
Another alternative (from a couple versions back :)): grab the necessary functions from opengl32's IAT.
In case anyone's interested, here it is:
; copy glu32 imports to API table
mov esi, data ; esi -> import from glu32
mov edi, bss
mov ebp, edi
lodsd ; eax -> glu32 func
stosd
movsd
; copy funcs from opengl32 import table
mov ax, 0x1080 ; eax -> glu32 import tbl + 0x80
mov edx, [eax] ; edx -> ogl32 func
mov dx, 0x1000 ; edx -> ogl32 import tbl
lodsd ; eax = 0
mov cl, num_funcs
.1: lodsb ; offset/4 of desired func in IAT
mov eax, [edx+eax*4]
stosd
xor eax, eax
loop .1
mov dh, 0 ; edx -> ogl32 dll
I switched to fixed offsets when I realized that this method is no less system dependent ;)
Anyway, I need the 'make' step to fixup the opengl32 ordinals (WinXP opengl32 lacks DllInitialize).
natas - Thanks! :) Added to my rather lengthy to-do list...
"See: http://www.programmingjournal.com/issue4/art3/index.htm"
Very slow example, stolen from viral writers
"Scanning the memory of the system dlls is better than using fixed values"
Wrong
The best way is to patch your .exe file using fixed values
The patcher is your setup.exe
If you change OS, you must start your setup.exe again to repatch it.
Regards,
Lingo
Very slow example, stolen from viral writers
"Scanning the memory of the system dlls is better than using fixed values"
Wrong
The best way is to patch your .exe file using fixed values
The patcher is your setup.exe
If you change OS, you must start your setup.exe again to repatch it.
Regards,
Lingo
"See: http://www.programmingjournal.com/issue4/art3/index.htm"
Very slow example, stolen from viral writers
"Scanning the memory of the system dlls is better than using fixed values"
Wrong
The best way is to patch your .exe file using fixed values
The patcher is your setup.exe
If you change OS, you must start your setup.exe again to repatch it.
Where do you get this information from? your knowledge doesnt come from
just reading plain assembly tutorials/books? I would be interested in some
links to any reading material you may know of. ( ;) )
Where do you get this information from? your knowledge doesnt come from
just reading plain assembly tutorials/books? I would be interested in some
links to any reading material you may know of. ( ;) )
I think I read different ezines than lingo :grin:
... Me dont care about the rules, and decided to write stuff that could potentially shut the board down...
Thanks Jan Wassenberg! ... me know the rulez too but decided take advantage of the presented content. Me know mods will remove it so me feel smart that i got it anyways. Who cares if the board shuts down, i got what i want.
oh yeah *sigh*
Me realize this is against the rulez and still add more forbidden content, and chuckle with natas.
Me realize this is against the rulez and still add more forbidden content, and chuckle with natas.
Posted on 2003-01-12 22:01:19 by NaN
Thanks Jan Wassenberg! ... me know the rulez too but decided take advantage of the presented content. Me know mods will remove it so me feel smart that i got it anyways. Who cares if the board shuts down, i got what i want.
Ofcourse I took advantage of the presented content! Why shouldnt I?
I knew the links were illegal on this board. However, I didnt post them!!!
I DID NOT ASK FOR ANYTHING THAT WOULD VIOLATE THE RULES OF THIS BOARD! :mad:
When other people post things wich are not allowed on this board I usually tell
them(like I did in this case too).What they do when I remind them is upto them.
Other people on this board usually edites and removes the "illegal" text after they
are reminded. So calm down!
Sorry NaN for editing your post, but I hate that Steve Gibson'ing :rolleyes:
who in the hell cares about what you hate... editing posts of others could
be seriosly more dangerous to this board than posting code to get api's from
memory ( or whatever jan posted... i didn't had the chance to read it ).
what is this all about, write code that's better than gibsons and THEN start
the whining.
be seriosly more dangerous to this board than posting code to get api's from
memory ( or whatever jan posted... i didn't had the chance to read it ).
what is this all about, write code that's better than gibsons and THEN start
the whining.
>who in the hell cares about what you hate... editing posts of others could
>be seriosly more dangerous to this board than posting code to get api's from
>memory ( or whatever jan posted... i didn't had the chance to read it ).
First, I just made the font size smaller, mob so stop f*cking me off.
>what is this all about, write code that's better than gibsons and THEN start
>the whining.
Second, I never sayed I could write better code as he does. I simply hate this colorfull, big letter writing.
>be seriosly more dangerous to this board than posting code to get api's from
>memory ( or whatever jan posted... i didn't had the chance to read it ).
First, I just made the font size smaller, mob so stop f*cking me off.
>what is this all about, write code that's better than gibsons and THEN start
>the whining.
Second, I never sayed I could write better code as he does. I simply hate this colorfull, big letter writing.