PL

VS 2010 and 2013 side by side

I recently attempted to upgrade my aging install of VS 2010 to the latest 2013 (mostly because of an STL-heavy project that could really benefit from some C++11 range-based for). Visual Studio 2012 changed the basic locations of include/library paths, and as a result solution properties need to be updated to point to these new paths. There is a chain of property files determining which include/library paths are loaded, and the SDK paths are contained in the systemwide %APPDATA%\Microsoft\MSBuild\v4.
Read more

Microoptimisation

In a function prologue it’s considered polite (and/or required by ABI) to stash registers and then restore them in the epilogue, so that callers don’t need to do that themselves. The alternative is that all callers stash the registers, and presumably (if each function is called one or more times) then there are many more function calls than function definitions, so having the function do this work is the correct approach to minimise binary size.
Read more

Functional programming in C

/* Functional programming in C --------------------------- This is an example of how to use executable memory to get partial function application (i.e. bind1st()) in C. (Well, this actually only compiles as C++ since i'm using a varargs typedef, but there's no classes or templates.) To proceed, we need to be comfortable with the cdecl and stdcall calling conventions on x86, and just a little assembly. In cdecl, function arguments are pushed onto the x86 stack from right to left, and then control passes to the callee.
Read more

Boilerplate for NASM

Brief introduction to x86 using the _cdecl calling convention and linking with a CRT: Every function builds and breaks down its own stack frame. Caller pushes arguments onto the stack, calls the function, and then removes the arguments from the stack. Function arguments are pushed right-to-left. The return value of a function goes in eax. The x86 stack grows downwards. Example global _main extern _printf section .text ; non-writable, executable ; function putstr( const char* ) putstr: push ebp ; set up a stack frame mov ebp,esp ; this function is small enough + we're not using any local variables, so we could probably omit the frame pointer ; our arguments are [ebp+8], [ebp+12], .
Read more

PSP Homebrew

PSPSDK provides psp-gcc. There’s also LuaPlayer, which has some issues being run as a signed binary on OFW. In this situation it’s best to either sign a HEN, install CFW or just stick with MinPSPW’s psp-gcc (which is actually really easy to use, especially with oslib_mod) Development Tools PSPSDK (c.f. MinPSPW) provides psp-gcc. LuaPlayer and derivatives (built with PSPSDK) Loading Homebrew CFW Manual signing for EBOOTs using leaked private key allows running on OFW.
Read more