there is something about megadriv.c that current versions of GCC seem to hate, it's so random I assume it's just causing some internal memory corruption. Too many people have reported issues with this specific driver for it to simply be bad ram.

I feel so proud ;-)