GBAモード

「GBAモード」の編集履歴(バックアップ)一覧に戻る

GBAモード - (2007/07/13 (金) 21:06:44) のソース

GBA カートリッジから起動された場合、GBAモードでの動作となり、DSの機能は使用不可になります。

GBA のワイヤレスアダプタは、DS の WiFi機能とは互換性が無いようです。

***GBA独自の機能はDSのGBAモードでは使えません。
-8bit DMG/CGB カートリッジはDSではサポートされていません。
-0x40000800 の、未公開内部レジスタは使用できません。
-GBAの通信端子はDSには付いていないので通信機能は使えません。



DSモードの 0x04000000 ~ 0x04000900 のレジスタは GBAモードでは使えません。
X/YボタンとタッチスクリーンはGBAモードでは使用できません。
GBA用のFlashカートリッジは動くようですが、サイズ的に合わないものがあるようです。
無理やり挿さないでください。

GBAのBIOSは未使用領域の最後の1ビットを除き、ほぼオリジナルと同じみたいです。
この、最後の1ビットを使って、DSのGBAモードで動いているか、オリジナルのGBAで動いているか、プログラム的に検出可能なようです。
やり方:
 uint32 getChecksum(void) { 
  // Figure out what we're running on 
  uint32 result; 
  asm volatile("swi 0x0D\n" 
               "mov r0, %0\n" 
               : "=r"(result) : : "r1", "r2", "r3" 
      ); 
  return result; 
 } 

... 

  value = getChecksum(); 
  if (value == 0xBAAE1880) 
    drawString(0, 19, "DS の GBA モードで動いている"); 
  else if (value == 0xBAAE187F) 
    drawString(0, 19, "GBA で動いている"); 
  else 
    drawString(0, 19, "エミュレータ上で動いている"); 

上記のコードはDS、GBAともに動きます。
1ビット違う場所というのは、0x3F0c です。この場所は、普通の起動プロセスでは全く使用されません。BIOSダンプか、チェックサム呼び出しでのみ発見できます。


DSの、0x04000136 から始まるレジスタ REG_KEYXY と、IR レジスタは、GBAモード時に限って常に0を返します。


DSモードから GBA モードに移行させるためのコード :
    .arm
    mov    r2, #0x40
    swi    0x1F0000

GBAモードに移行する前に、ファームウェアの GBAモード時スクリーン表示設定を確認してください。
もし上画面に設定されている場合、ARM9から POWER_CR レジスタのLCDスワップビットをセットするようにしてください。
使わない方の画面はARM7のSPIを使ってオフにしておいてください。


GBA screen borders

It is possible to place a border in the unused portion of the screen before switching to GBA mode, to give a similar effect to the Super Game Boy. This must be done before switching to GBA mode, since no NDS features are available after the switch.

Steps for a border:

   1. Set the display mode to a 2D, non frame buffered mode. It is important to not use a direct frame buffer mode, as this will limit the GBA display to 30 fps.
   2. Set VRAM banks A and B to the main display. Both banks are needed. (See 2D Core
   3. Copy the border to both VRAM bank A (at address 0x06800000) and B (at address 0x06820000). The border is a 256 * 192 pixel, 16 BPP bitmap, with the outer edges used as the visible in GBA mode. It must be copied to both banks, otherwise the screen will flicker due to the page flipping used by the hardware.
   4. Swap the LCD screens appropriate to the firmware settings, and turn off the unused screen.
   5. Restart in GBA mode. 






----
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。