freepascal
category: code [glöplog]
here you go , window in 758b , maybe you can shrink it more
https://app.box.com/s/8ybvsjeqiy4aiaz3ep7y
you don't need to create system units , just compile with -Acoff switch then use crinkler
https://app.box.com/s/8ybvsjeqiy4aiaz3ep7y
you don't need to create system units , just compile with -Acoff switch then use crinkler
@codz:
Actually, this is very cool, I like it. Seems I can really only think from the compiler PoV. :) Spending too much time with it. (BTW, that FillChar() function seems a bit weird...)
Actually, this is very cool, I like it. Seems I can really only think from the compiler PoV. :) Spending too much time with it. (BTW, that FillChar() function seems a bit weird...)
axon: woah! Blast from the past! Hit me up at gloom@scene.org and let's see what we can do about getting your handle back :)
wow! this got more responses than i anticipated! i'm very busy this week (working on a new lethe album).. but next week i'll dive deep into this, and get back to all of you..
@gloom.. long time no see :-) email is coming..
@gloom.. long time no see :-) email is coming..
Well, if a SceneID is taken, you can't do much about it, but you can still change your display name on pouet...
and this is 968b shader demo
https://app.box.com/s/3w1m8vvpfggwgfj1vvtr
https://app.box.com/s/3w1m8vvpfggwgfj1vvtr
@codz: what fpc version are you using? (i'm using v2.6.4).. when i tried to run build-bat, fpc complaints about the -Acoff argument:
Warning: Assembler output selected "COFF" is not compatible with "Win32 for i386"
and also, a bunch of undefined symbols, like:
Error: Undefined symbol: _PostQuitMessage@4
etc..
and crinkler doesn't find main, it seems (probably because the compilation went wrong).
Error LNK: annot find entry point 'P$MINIFPC_$$_MAIN'
Warning: Assembler output selected "COFF" is not compatible with "Win32 for i386"
and also, a bunch of undefined symbols, like:
Error: Undefined symbol: _PostQuitMessage@4
etc..
and crinkler doesn't find main, it seems (probably because the compilation went wrong).
Error LNK: annot find entry point 'P$MINIFPC_$$_MAIN'
i'am using fpc from trunk , i think its 3.1.1 , but 2.6.4 should work as well , i try it myself
front of procedure Main(); add ( alias : 'mymain'; ) , now your entry point is mymain replace P$MINIFPC_$$_MAIN in build.bat with mymain .
btw , iam using the 32bits version
Quote:
Error LNK: annot find entry point 'P$MINIFPC_$$_MAIN'
front of procedure Main(); add ( alias : 'mymain'; ) , now your entry point is mymain replace P$MINIFPC_$$_MAIN in build.bat with mymain .
btw , iam using the 32bits version
do-nothing exe (just calls ExitProcess), pure pascal, compressed with crinkler.. 443 bytes..
Let me quickly abuse this thread for a job advertisement (sorry, but it's not like the number of sceners still using pascal would be high ;)
Viprinet does insane stuff with Pascal, and two of the sceners working at Viprinet are also part of the FPC development team. If you love Object Pascal and doing hardcore stuff in it, and are ever looking for a job, meet us at any demo party.
Viprinet does insane stuff with Pascal, and two of the sceners working at Viprinet are also part of the FPC development team. If you love Object Pascal and doing hardcore stuff in it, and are ever looking for a job, meet us at any demo party.
tweaked some fpc/crinkler arguments..
noop exe = 419 bytes..
currently converting this from c to pascal:
https://www.youtube.com/watch?v=5vMJU5YMknk
noop exe = 419 bytes..
currently converting this from c to pascal:
https://www.youtube.com/watch?v=5vMJU5YMknk
import functions by hash.
http://www.pouet.net/prod.php?which=60743
http://www.pouet.net/prod.php?which=60743
With an asm main, i.e. zero lines of C code, ExitProcess only in Visual C++ 2008 and Crinkler 1.4 seems to be 405 bytes, so 419 feels pretty OK if it is actually pure Pascal.
Btw, is it possible to get P$RID_OF_THE_$$_HIDEOUS_NAME_MANGLING somehow?
Btw, is it possible to get P$RID_OF_THE_$$_HIDEOUS_NAME_MANGLING somehow?
yeah, it's pure pascal, one pas file only.. and it's 416 bytes now..
https://dl.dropboxusercontent.com/u/41070669/kode.pas/k4.zip
https://dl.dropboxusercontent.com/u/41070669/kode.pas/k4.zip
it's me again :-)
forgot to say thanks to everybody that has given comments, suggestions, ideas, etc.. i'm grateful for all of it, even if it don't answer each and every one of you individually!
but i have another question.. in the crinkler docs, in the 'recommendations' section, i read:
in msvc, i could do something like this:
is there something similar for freepascal, or do i have to dive into assembly for these kind of things?
forgot to say thanks to everybody that has given comments, suggestions, ideas, etc.. i'm grateful for all of it, even if it don't answer each and every one of you individually!
but i have another question.. in the crinkler docs, in the 'recommendations' section, i read:
Quote:
"Since much of the effectiveness of Crinkler comes from separating code and data into different parts of the file and compressing each part individually, it is important that this separation is possible. Mark your code and data sections as containing code and data, respectively, and do not put both code and data into the same section. See your assembler manual for information about how to do this. For instance, in Nasm, you can write the keyword "text" or "data" after the section name and give sections different names to prevent them from being merged by the assembler."
Quote:
"Split both your code and your data into as many sections as possible. This gives Crinkler more opportunities to select the ordering of the sections to optimize the compression ratio."
in msvc, i could do something like this:
Code:
#pragma code_seg( ".my_main")
#pragma data_seg( ".my_main.data")
#pragma bss_seg( ".my_main.bss")
#pragma const_seg(".my_main.const")
is there something similar for freepascal, or do i have to dive into assembly for these kind of things?
There are no such pragmas in FPC (AFAIK) but what if you enable smartlinking? That should compile every single procedure, global variable, etc, into a separate .o file (and to separate sections), and pack it to an .a file, which you can feed into your linker, or extract the .o files from.
Try it with:
Compile as:
This should create libphello.a, which contains the object files. The optional "-a" argument also keeps the separate assembler files, in a directory called hello.sl. Using the argument as "-al" will even put Pascal source lines into the assembly (as comments) for easier debugging/optimization. The assembly files are possible to compile using GNU as. It seems every single assembly file there contains at least one separate section. Additionally, you should also get a reference script file for compiling and linking the assembler or object files.
Oh, and to extract the object files from the .a file use:
Hope this was helpful a bit at least...
Try it with:
Code:
procedure x;
begin
end;
procedure y;
begin
end;
begin
x;
y;
end;
Compile as:
Code:
fpc -XX -CX -st -a hello.pas
This should create libphello.a, which contains the object files. The optional "-a" argument also keeps the separate assembler files, in a directory called hello.sl. Using the argument as "-al" will even put Pascal source lines into the assembly (as comments) for easier debugging/optimization. The assembly files are possible to compile using GNU as. It seems every single assembly file there contains at least one separate section. Additionally, you should also get a reference script file for compiling and linking the assembler or object files.
Oh, and to extract the object files from the .a file use:
Code:
ar -xc libphello.a
Hope this was helpful a bit at least...
thanks for the suggestion!
i'll experiment a bit with that during the weekend..
i'll experiment a bit with that during the weekend..
Fixmebeautiful:
This:
Should be:
And actually I was wrong, -st doesn't create the .a file, but a linker script which should create it. Without the -st option, the .a file is created (apart from the normal executable). Anyway, play with these options, you might find some more modifiers in the help which are related and might be useful.
This:
Code:
ar -xc libphello.a
Should be:
Code:
ar -xv libphello.a
And actually I was wrong, -st doesn't create the .a file, but a linker script which should create it. Without the -st option, the .a file is created (apart from the normal executable). Anyway, play with these options, you might find some more modifiers in the help which are related and might be useful.
Maybe not the most helpful comment, but if you're doing a 1k, then you have to do the final hand-tuning in asm, or otherwise you're deliberately wasting dozens of bytes for no good reason. Unless you've written your own 1k intro specific optimizer for FPC, there is no way to get a high-level language compiler to find out the code that gives the best compressed result. It's an iterative trial and error process.
@axxxon
good work , you got a working shader app in 895b , thats awesome :D
i think thats better than what MSVC can do , gcc (tfm-gcc 4.7.1) gives me 906b for the same app with the same crinkler options .
good work , you got a working shader app in 895b , thats awesome :D
i think thats better than what MSVC can do , gcc (tfm-gcc 4.7.1) gives me 906b for the same app with the same crinkler options .
Anyone brave enough to try and compile a trunk FPC (3.1.1 development version) for himself, may enjoy a 891 bytes version of the same stuff. :)
Florian Klaempfl, the founder of FPC was looking into this thread recently and he did some alignment fixes with -Os and some other optimizations which are available in the SVN trunk.
Florian Klaempfl, the founder of FPC was looking into this thread recently and he did some alignment fixes with -Os and some other optimizations which are available in the SVN trunk.
awesome!
i will try that, for sure!
i will try that, for sure!
And Florian went for even more, forwarding from IRC:
Trunk FPC of course.
Quote:
fpk | Chain|Q: (...) with -O4s -XXs -CXn -al k4.pas -Anasmwin32 I am now at 886 :)
fpk | Chain|Q: and I didn't add any cheating optimization :)
Trunk FPC of course.