Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - porting GB/GBC to SMS/GG?

Reply to topic
Author Message
  • Joined: 22 Oct 2017
  • Posts: 16
Reply with quote
porting GB/GBC to SMS/GG?
Post Posted: Sat Dec 31, 2022 4:36 pm
seeing as the DMG and CGB use that Sharp Z80 variant, how feasible would code reuse be?

how different are the video systems?
  View user's profile Send private message
  • Joined: 06 Mar 2022
  • Posts: 598
  • Location: London, UK
Reply with quote
Post Posted: Sat Dec 31, 2022 4:56 pm
The LR35902 is not binary compatible with the Z80 so straight away there's a potential snag. At least it should be easier than a totally unrelated processor.

But yes, the difference between the PPU and the VDP would be the biggest challenge. At least there are less colours on the gameboy...

I'm hopefully planning to build a "real" gameboy PPU at some point in 2023 so will one day be more of an expert, but for now must defer to other more knowledgeable folks here!
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3763
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Sat Dec 31, 2022 5:11 pm
Wainstop wrote
seeing as the DMG and CGB use that Sharp Z80 variant, how feasible would code reuse be?


I suppose some asm sources could be recompiled to Z80 with some macros to take care of the additional instructions that are not present in the Z80, but as @willbritton said, the biggest hurdle is the different graphic chip

if the source code is C (GBDK) there's this interesting project to compile that for the Game Gear with devkitSMS. Check this topic.
  View user's profile Send private message Visit poster's website
  • Joined: 23 Jan 2010
  • Posts: 417
Reply with quote
Post Posted: Sat Dec 31, 2022 6:13 pm
The GB processor variant that completely omitted the I/O ports. Thus, it had to fit everything in the memory map.
I think that not would be easy port game without source code but the best member here with knowledge is @sverx because he already ported a GB homebrew game for SMS.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14690
  • Location: London
Reply with quote
Post Posted: Sat Dec 31, 2022 6:16 pm
Some original games were coded for both GG and GB with substantial source sharing.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3763
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Sat Dec 31, 2022 7:43 pm
segarule wrote
... the best member here with knowledge is @sverx because he already ported a GB homebrew game for SMS.


Me? I never did that!
  View user's profile Send private message Visit poster's website
  • Joined: 23 Jan 2010
  • Posts: 417
Reply with quote
Post Posted: Sat Dec 31, 2022 8:01 pm
Sorry! Was a GBA homebrew:

https://www.smspower.org/Homebrew/AngunaThePrisonDungeon-SMS

But have "Game Boy" in name. LOL
  View user's profile Send private message
  • Joined: 14 Oct 2008
  • Posts: 508
Reply with quote
Post Posted: Sat Dec 31, 2022 9:48 pm
Maxim wrote
Some original games were coded for both GG and GB with substantial source sharing.

The GB Z80 even remaps some of the opcodes that were shared with a standard Z80, so while the source code could be shared with both consoles, the resulting binary code would not be compatible.

The GB Z80 also omits the shadow and index registers (though that wouldn't be a problem converting TO GG).

However, some of the opcodes added were to ld to and from the $FFxx page (where the I/O registers were memory-mapped), so those were basically analogous to the in/out instructions.

The video and audio would be the biggest challenge to convert, but even the button input I/O was more complicated than it should've been (why did the buttons and direction pad need to be read separately?).
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!