'M-HT' said:
It's not portable to other processor architectures.
X86 linux version exists as part of the development, but there's no point in releasing it, because on PC X-COM is perfectly playable in DOSBox (or DOSEMU in linux).
The only reason for statically recompiling it for GP2X is, that it's not playable otherwise (too slow in dosbox).
Edit:
To elaborate, I'm recompiling directly from X86 instruction set to ARM instruction set. So it is possible to rewrite the recompiler to recompile the X86 instructions into another instruction set, but I wouldn't call it portable.
I see..well, like I said before I was pretty impressed by the smoothness of it all. With dosbox it is ok, but your version in many ways 'feels' better. Secondly I would imagine that a 'native' version would lend its self better to hacking to improve gameplay (like some guy did/ is doing for the XP version), or graphics etc.
Anyway, I hope you don't think I am complaining or anything - It is great work!!
BTW, how did you implement mouse&keyboard inputs and sound and graphics? Did you implement SDL equivalents of calls made by the program or is does it work on the basis of hardware emulation?
Most of the code is assembler code generated by the recompiler, so that's not much help to the hacking.
Mouse:
X-Com is polling the mouse coordinates and mouse buttons status (via int 0x33), so I'm just supplying SDL mouse coordinates and buttons status.
Keyboard:
X-Com is querying and reading keys via c functions kbhit and getch, so I'm emulating keyboard buffer with SDL keys and I replaced the c functions with my functions.
Graphics:
X-Com is writing graphics data to frame buffer at address 0xa0000. I redirected the writes to my buffer and I'm periodically (60 times/ses) writing it to SDL video buffer.
Sound:
X-Com is using DigPak for sound and music, so I replaced the interface with my implementation (using SDL_mixer).
'hlide' said:
is you recompiler just a translation from x86 to arm per instruction (like a dynarec except for it is generated offline) ? or has a good analysis for block and register usage so it can perform more global optimization ?
or do you produce a C file to compile ?
I'm producing arm assembler code.
I'm using static register allocation (that's one reason why my recompiler works only on 32bit code with flat memory access) - 10 x86 registers (eax, ebx, ecx, edx, esi, edi, ebp, esp, eip, eflags) + 1 temporary register for memory addresses + 5 temporary registers for calculations and other usage = 16 arm registers.
I'm doing some analysis for flags calculations - I'm only calculating them when necessary and I'm using arm flags whenever possible - 6 x86 flags (sign, zero, carry, overflow, parity, adjust) vs 4 arm flags (sign, zero, carry, overflow).
Complication is, that some instructions give inverted carry flag than the same instructions on x86 and some instructions are reading it inverted than x86 instructions. So I'm also inverting it only when necessary.
This part requires some manual input. Sometimes the recompiler can't decide (when an instruction at the start of the block needs some flag) and sometimes it's impossible (when one instruction reads original carry flag (but doesn't change it) and the next instruction reads the inverted carry flag).