Updates February 2020:
Updates April 2020:
Did a lot of optimizing this week. Check it out:
Super Mario Land 2
https://www.youtube.com/watch?v=9LapSf3XRrI
Pokemone Green
https://www.youtube.com/watch?v=jCwoNOc8kro
It's still not quite full speed and bug free, but it's getting there!
Spoiler
Hey y'all, It's been a while. I've mostly been busy with school and the likes. I have some good news, and perhaps some bad news. The good news is that I have been working on SmileBOY (my GameBoy emulator that I hyped up but never finished) and I'm already pretty far into developing it. The bad new is that I'm developing it for SmileBASIC 4 on Switch, which is Japan exclusive for now. Although I am thinking of porting it to the 3DS, since it's running at quite an acceptable speed, and I think with some frame skipping and speed hacks, it might run pretty decently on 3DS as well. I wasn't too happy with how I structured my code, so I restarted the project over and over again. That's why I was never really happy with it and I didn't want to show it off or share the source code. Not only that, but a traditional GameBoy emulator just doesn't run very well in the slow (but awesome!) interpreted language that is SmileBASIC. I have found solutions for this by analyzing the source code of programs by clever Japanese developers. (In fact, I'm using the PC88 emulator's Z80 CPU code as a base for the GameBoy's CPU in SmileBOY, heavilly modified of course.) To achieve better speed, I'm using lookup tables for simple math operations that would normally cause a lot of overhead. It's the reason why SmileBOY has been unbearably slow up until recently. Simple things like adding two numbers together doesn't sound like it'd slow down the emulator. But if you do this a few thousand times every frame, it adds up quickly. By using a lookup table, the emulator can run significantly faster. So instead of doing something like:'simple add instruction using DEF-block RESULT = ADD(&H7F, &H4C) DEF ADD(in0, in1) RETURN (in0 + in1)AND 255 ENDI take the value from a two-dimentional array with the values pre-calculated:
'simple add instruction using lookup table RESULT = ADD[&H7F, &H4C] @init_ADD VAR in0,in1 DIM ADD[256,256] FOR in0 = 0 TO 255 FOR in1 = 0 TO 255 ADD[in0,in1] = (in0 + in1)AND 255 NEXT in1 NEXT in0(these examples are over-simplified, but with other things like flags to worry about, lookup tables are very convenient and fast) I think with a lot of clever tricks like this, I can achieve full speed on Switch and acceptable speed on 3DS. Here is a picture of the GameBoy's boot screen, rendered as a tileset: It might not look like much, but I was surprised at how fast it rendered the Nintendo-logo. It's still not lightning-fast, but that's just a matter of further optimizing. I'll keep you guys up to date! ~Raichu