Gameboy on 32X
Moderator: Mask of Destiny
Gameboy on 32X
Here's something I've been tinkering with a bit lately:
It's dog slow right now, because the code is all plain C that hasn't been optimized or tweaked for the 32X. There's also some weird bug that seems to corrupt the ROM if I add a .gb file larger than 128kB (this doesn't happen with the PC version).
It's dog slow right now, because the code is all plain C that hasn't been optimized or tweaked for the 32X. There's also some weird bug that seems to corrupt the ROM if I add a .gb file larger than 128kB (this doesn't happen with the PC version).
-
- Very interested
- Posts: 2442
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
wow, this is awesome Ö
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
-
- Very interested
- Posts: 374
- Joined: Mon Jun 11, 2007 3:09 am
- Location: Azeitão, PT
-
- Very interested
- Posts: 374
- Joined: Mon Jun 11, 2007 3:09 am
- Location: Azeitão, PT
I've looked at the SH2 assembly that gcc generates (I'm compiling with -O2) for my emulator, and it's a real piece of crap compared to what even an SH novice like me could accomplish. To achieve any kind of decent speed - especially for the CPU emulation - it'd probably be necessary to write the whole thing from scratch in assembly.
Just as an example; a function that contains only "return 0;" gets compiled into:
Plain awesomeness.. That could be reduced by 67%. And it just goes on like that.
Code: Select all
mov.l r14,@-r15
mov #0,r0
mov r15,r14
mov r14,r15
rts
mov.l @r15+,r14
GCC is creating a stack frame. You need to use -fomit-frame-pointer to disable this.mic_ wrote:Just as an example; a function that contains only "return 0;" gets compiled into:
Plain awesomeness.. That could be reduced by 67%. And it just goes on like that.Code: Select all
mov.l r14,@-r15 mov #0,r0 mov r15,r14 mov r14,r15 rts mov.l @r15+,r14
Toshi
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
Except that IS quality code... for code with a stack frame. It's not gcc's fault you made no use of the stack frame when you told it to make one. I'm not saying a compiler can beat hand-done assembly, but the code produced is much better than you're saying.mic_ wrote:Yes, I know, it's the same on most processors. That was just an example of the overall (lack of) quality of the code.GCC is creating a stack frame.
-
- Very interested
- Posts: 256
- Joined: Tue Sep 11, 2007 9:10 pm
Code: Select all
Let's hope you can get GBC cpu core running full speed as well.