pouët.net

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
added on the 2015-01-11 20:17:02 by codz codz
@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...)
added on the 2015-01-12 01:15:49 by Charlie Charlie
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 :)
added on the 2015-01-12 10:40:56 by gloom gloom
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..
added on the 2015-01-12 11:07:50 by axxxon axxxon
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
added on the 2015-01-12 15:21:37 by codz codz
@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'
added on the 2015-01-27 14:47:49 by axxxon axxxon
i'am using fpc from trunk , i think its 3.1.1 , but 2.6.4 should work as well , i try it myself
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
added on the 2015-01-27 17:48:14 by codz codz
after installing version 3.0.1 (which i found here), everything worked!

thanks!
added on the 2015-01-27 19:48:36 by axxxon axxxon
do-nothing exe (just calls ExitProcess), pure pascal, compressed with crinkler.. 443 bytes..
added on the 2015-02-02 23:49:32 by axxxon axxxon
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.
added on the 2015-02-03 05:01:48 by scamp scamp
tweaked some fpc/crinkler arguments..
noop exe = 419 bytes..
currently converting this from c to pascal:
https://www.youtube.com/watch?v=5vMJU5YMknk
added on the 2015-02-03 11:01:15 by axxxon axxxon
added on the 2015-02-03 21:07:48 by rudi rudi
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?
added on the 2015-02-03 23:06:36 by yzi yzi
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
added on the 2015-02-03 23:50:34 by axxxon axxxon
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:

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?
added on the 2015-02-04 11:29:51 by axxxon axxxon
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:
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...
added on the 2015-02-06 12:45:04 by Charlie Charlie
thanks for the suggestion!
i'll experiment a bit with that during the weekend..
added on the 2015-02-06 13:25:11 by axxxon axxxon
Fixmebeautiful:

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.
added on the 2015-02-06 14:33:01 by Charlie Charlie
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.
added on the 2015-02-06 17:10:15 by yzi yzi
@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 .
added on the 2015-02-06 20:59:52 by codz codz
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.
added on the 2015-02-08 12:39:13 by Charlie Charlie
awesome!
i will try that, for sure!
added on the 2015-02-08 12:47:22 by axxxon axxxon
And Florian went for even more, forwarding from IRC:
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.
added on the 2015-02-08 14:00:47 by Charlie Charlie

login