All Projects → AntonioND → gba-switch-to-gbc

AntonioND / gba-switch-to-gbc

Licence: GPL-3.0 license
Routine to switch a GBA into GBC mode by software!

Programming Languages

c
50402 projects - #5 most used programming language
assembly
5116 projects
Makefile
30231 projects

Projects that are alternatives of or similar to gba-switch-to-gbc

gba-pong
Classic pong game on the GameBoy Advance.
Stars: ✭ 23 (-64.06%)
Mutual labels:  gameboy-advance
trick
Library for GBA/NDS image conversion, and more!
Stars: ✭ 23 (-64.06%)
Mutual labels:  gameboy-advance
smaghetti
A web based level editor for Super Mario Advance 4, the GBA port of Super Mario Bros 3
Stars: ✭ 31 (-51.56%)
Mutual labels:  gameboy-advance
skyland
Realtime strategy game for Gameboy Advance
Stars: ✭ 27 (-57.81%)
Mutual labels:  gameboy-advance
gba-sprite-engine
An object-oriented Game Boy Advance sprite engine concept
Stars: ✭ 68 (+6.25%)
Mutual labels:  gameboy-advance
GBASnake
Snake Game for Gameboy Advance
Stars: ✭ 58 (-9.37%)
Mutual labels:  gameboy-advance
UnkrawerterGBA
A tool to rip music from Gameboy Advance games that use the Krawall sound engine.
Stars: ✭ 26 (-59.37%)
Mutual labels:  gameboy-advance
react-gbajs
🕹 GBA emulator on your React project - easy and powerful to use!
Stars: ✭ 35 (-45.31%)
Mutual labels:  gameboy-advance
magia
magia is a toy GBA emulator written in golang.
Stars: ✭ 432 (+575%)
Mutual labels:  gameboy-advance
tilemap-studio
A tilemap editor for Game Boy, Color, Advance, DS, and SNES projects. Written in C++ with FLTK.
Stars: ✭ 247 (+285.94%)
Mutual labels:  gameboy-advance
Mgba
mGBA Game Boy Advance Emulator
Stars: ✭ 3,355 (+5142.19%)
Mutual labels:  gameboy-advance
Hades
🔥 A Nintendo Game Boy Advance emulator
Stars: ✭ 44 (-31.25%)
Mutual labels:  gameboy-advance
SkyEmu
Game Boy, Game Boy Color, and Game Boy Advanced Emulator
Stars: ✭ 59 (-7.81%)
Mutual labels:  gameboy-advance
awesome-emu-resources
A curated list of emulator development resources
Stars: ✭ 26 (-59.37%)
Mutual labels:  gameboy-advance

gba-switch-to-gbc

Routine to switch a GBA into GBC mode by software!

The source code can be found here:

https://github.com/AntonioND/gba-switch-to-gbc

A video that demonstrates the code is here:

https://www.youtube.com/watch?v=pcIQQPOkBGI

I dissasembled the GBA BIOS and looked for the instruction that checks DISPCNT bit 15 (at address 0x00001958). If a GBC cart is detected ( impossible in real hardware) a subroutine is called. Most of it is just a screen fade in, but there is some information about the registers configuration needed to switch to GBC mode.

It can even modify some other registers to change the GBC screen! It can apply an affine transformation, or apply mossaic effect... There are some things to test in the code.

Note that the "stretch screen" mode you enable by pressing L seems to bypass all the transformation registers, but effects like mosaic and greenswap are still applied in stretch mode.

Note that, as soon as a GBC cartridge is inserted in the GBA, EWRAM can't be used. This means the function that switches to GBC mode (and any function that is used to wait before switching) need to be placed in IWRAM, as well as any variable used by the functions.

It should work in GBA, GBA SP, GB Micro, but NOT in DS. If I remember correctly, the ARM7 is different in NDS. GBA mode in DS is just a compatibility mode, but in GBA, GBA SP and GB Micro the SoC includes the GBC CPU as well.

The results are:

  • GBA: It works.
  • GBA SP: It works.
  • GB Micro: Correct boot ROM animation, with sound. Nintendo logo is white, which means the GBC CPU is reading zeroes from the cart instead of data.
  • DS: It doesn't work at all. Black screen. I suppose it hangs in the infinite loop at the end of the code.
  • GB Player: It works.

It seems that the GB Micro in GBC mode can't read anything from the cart. I have to do more tests, but I've tried a cartridge that runs at 3.3V and the GB Micro doesn't load garbage in the Nintendo logo like the real GBC or MGB.

To build it, you need devkitPro.

My website: www.skylyrac.net/

Thanks to:

GBATEK information

Taken from here: https://problemkaputt.de/gbatek.htm#auxgbagamepakbus

8bit-Gamepak-Switch (GBA, GBA SP only) (not DS)

A small switch is located inside of the cartridge slot, the switch is pushed down when an 8bit cartridge is inserted, it is released when a GBA cartridge is inserted (or if no cartridge is inserted).

The switch mechanically controls whether VDD3 or VDD5 are output at VDD35; ie. in GBA mode 3V power supply/signals are used for the cartridge slot and link port, while in 8bit mode 5V are used.

The switch additionally drags IN35 to 3V when an 8bit cart is inserted, the current state of IN35 can be determined in GBA mode via Port 4000204h (WAITCNT), if the switch is pushed, then CGB mode can be activated via Port 4000000h (DISPCNT.3), this bit can be set ONLY by opcodes in BIOS region (eg. via CpuSet SWI function).

In 8bit mode, the cartridge bus works much like for GBA SRAM, however, the 8bit /CS signal is expected at Pin 5, while GBA SRAM /CS2 at Pin 30 is interpreted as /RESET signal by the 8bit MBC chip (if any). In practice, this appears to result in 00h being received as data when attempting to read-out 8bit cartridges from inside of GBA mode.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].