From ebb127c87291970db9d2e518c6702074240bfcb6 Mon Sep 17 00:00:00 2001 From: yutaka Date: Fri, 7 Nov 2008 11:13:14 +0000 Subject: [PATCH] =?UTF-8?q?gcd=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=81=ABsrl=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=83=80=E3=82=A4=E3=83=AC=E3=82=AF=E3=83=88=E3=83=96=E3=83=BC?= =?UTF-8?q?=E3=83=88=E3=81=A7=E5=AE=9F=E8=A1=8C=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E3=83=84=E3=83=BC=E3=83=AB=E3=81=AE=E8=BF=BD=E5=8A=A0=20?= =?UTF-8?q?=E3=83=BBFS=20rom=20archive=20=E5=88=A9=E7=94=A8=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=20(=E5=AE=9F=E8=B3=AA=E3=83=A1=E3=83=A2=E3=83=AA?= =?UTF-8?q?=E3=83=96=E3=83=BC=E3=83=88=E3=81=AA=E3=81=AE=E3=81=A7)=20?= =?UTF-8?q?=E3=83=BBsrl=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=AFwriter?= =?UTF-8?q?=E3=81=AEMakefile=E3=81=A7=E6=8C=87=E5=AE=9A=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=81=93=E3=81=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2665 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- build/gcdfirm/Makefile | 1 + .../memory-launcher-writer/ARM7/Makefile | 55 ++ .../memory-launcher-writer/ARM7/main.c | 468 ++++++++++++++ .../memory-launcher-writer/ARM9/Makefile | 53 ++ .../memory-launcher-writer/ARM9/font.c | 588 ++++++++++++++++++ .../ARM9/include/font.h | 60 ++ .../ARM9/include/screen.h | 52 ++ .../memory-launcher-writer/ARM9/main.c | 246 ++++++++ .../memory-launcher-writer/ARM9/screen.c | 120 ++++ build/gcdfirm/memory-launcher-writer/Makefile | 65 ++ .../memory-launcher-writer/gcdfirm.gcdsf | 23 + .../memory-launcher-writer/wram_regs/Makefile | 57 ++ .../wram_regs/wram_regs.c | 98 +++ build/nandfirm/Makefile | 1 + build/nandfirm/memory-launcher/ARM7/Makefile | 51 ++ build/nandfirm/memory-launcher/ARM7/main.c | 343 ++++++++++ build/nandfirm/memory-launcher/ARM9/Makefile | 53 ++ build/nandfirm/memory-launcher/ARM9/font.c | 588 ++++++++++++++++++ .../memory-launcher/ARM9/include/font.h | 60 ++ .../memory-launcher/ARM9/include/screen.h | 52 ++ build/nandfirm/memory-launcher/ARM9/main.c | 500 +++++++++++++++ build/nandfirm/memory-launcher/ARM9/screen.c | 120 ++++ build/nandfirm/memory-launcher/Makefile | 48 ++ .../nandfirm/memory-launcher/nandfirm.nandsf | 24 + build/nandfirm/memory-launcher/readme.txt | 5 + .../memory-launcher/wram_regs/Makefile | 57 ++ .../memory-launcher/wram_regs/wram_regs.c | 98 +++ 27 files changed, 3886 insertions(+) create mode 100644 build/gcdfirm/memory-launcher-writer/ARM7/Makefile create mode 100644 build/gcdfirm/memory-launcher-writer/ARM7/main.c create mode 100644 build/gcdfirm/memory-launcher-writer/ARM9/Makefile create mode 100644 build/gcdfirm/memory-launcher-writer/ARM9/font.c create mode 100644 build/gcdfirm/memory-launcher-writer/ARM9/include/font.h create mode 100644 build/gcdfirm/memory-launcher-writer/ARM9/include/screen.h create mode 100644 build/gcdfirm/memory-launcher-writer/ARM9/main.c create mode 100644 build/gcdfirm/memory-launcher-writer/ARM9/screen.c create mode 100644 build/gcdfirm/memory-launcher-writer/Makefile create mode 100644 build/gcdfirm/memory-launcher-writer/gcdfirm.gcdsf create mode 100644 build/gcdfirm/memory-launcher-writer/wram_regs/Makefile create mode 100644 build/gcdfirm/memory-launcher-writer/wram_regs/wram_regs.c create mode 100644 build/nandfirm/memory-launcher/ARM7/Makefile create mode 100644 build/nandfirm/memory-launcher/ARM7/main.c create mode 100644 build/nandfirm/memory-launcher/ARM9/Makefile create mode 100644 build/nandfirm/memory-launcher/ARM9/font.c create mode 100644 build/nandfirm/memory-launcher/ARM9/include/font.h create mode 100644 build/nandfirm/memory-launcher/ARM9/include/screen.h create mode 100644 build/nandfirm/memory-launcher/ARM9/main.c create mode 100644 build/nandfirm/memory-launcher/ARM9/screen.c create mode 100644 build/nandfirm/memory-launcher/Makefile create mode 100644 build/nandfirm/memory-launcher/nandfirm.nandsf create mode 100644 build/nandfirm/memory-launcher/readme.txt create mode 100644 build/nandfirm/memory-launcher/wram_regs/Makefile create mode 100644 build/nandfirm/memory-launcher/wram_regs/wram_regs.c diff --git a/build/gcdfirm/Makefile b/build/gcdfirm/Makefile index a13d738f..a763bb3a 100644 --- a/build/gcdfirm/Makefile +++ b/build/gcdfirm/Makefile @@ -26,6 +26,7 @@ SUBDIRS = \ gcdfirm-print \ sdmc-launcher \ sdmc-launcher-writer \ + memory-launcher-writer \ #---------------------------------------------------------------------------- diff --git a/build/gcdfirm/memory-launcher-writer/ARM7/Makefile b/build/gcdfirm/memory-launcher-writer/ARM7/Makefile new file mode 100644 index 00000000..18fc996d --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/ARM7/Makefile @@ -0,0 +1,55 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - tools - memory-launcher +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- + +TWL_PROC = ARM7 + +SUBDIRS = + +LINCLUDES = ../include + +#---------------------------------------------------------------------------- + +TARGET_BIN = memory_launcher_writer7.tef + +SRCS = main.c + +CRT0_O = crt0_firm.o + +ADDRESS_STATIC = 0x037b8000 + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +#SRCDIR = # using default +#LCFILE = # using default + +LINCLUDES = $(ROOT)/build/libraries/fatfs/ARM7.TWL/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/fatfs \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/twl/fatfs/ARM7 + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037c0000' + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/gcdfirm/memory-launcher-writer/ARM7/main.c b/build/gcdfirm/memory-launcher-writer/ARM7/main.c new file mode 100644 index 00000000..202cf760 --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/ARM7/main.c @@ -0,0 +1,468 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - gcdfirm - sdmc-launcher-writer + File: main.c + + Copyright 2008 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include + +#include +#include + +#define PRINT_DEBUG + +#ifndef PRINT_DEBUG +#undef OS_TPrintf +#undef OS_PutChar +#define OS_TPrintf(...) ((void)0) +#define OS_PutChar(...) ((void)0) +#endif // PRINT_DEBUG + +/* + デバッグLEDをFINALROMとは別にOn/Offできます。 +*/ +#define USE_DEBUG_LED + +#ifdef USE_DEBUG_LED +static u8 step = 0x00; +#define InitDebugLED() I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x03, 0x00) +#define SetDebugLED(pattern) I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x01, (pattern)); +#else +#define InitDebugLED() ((void)0) +#define SetDebugLED(pattern) ((void)0) +#endif + +#define THREAD_PRIO_FATFS 8 +#define DMA_FATFS_1 0 +#define DMA_FATFS_2 1 +#define DMA_CARD 2 + +static u8* const nor = (u8*)HW_TWL_MAIN_MEM; +static u8* const nand = (u8*)HW_TWL_MAIN_MEM + offsetof(NANDHeader,l); + +/*************************************************************** + PreInit + + FromBootの対応&メインメモリの初期化 + OS_Init前なので注意 (ARM9によるメインメモリ初期化で消されないように注意) +***************************************************************/ +static void PreInit(void) +{ + // GCDヘッダコピー + MI_CpuCopyFast( OSi_GetFromBromAddr(), (void*)HW_CARD_ROM_HEADER, HW_CARD_ROM_HEADER_SIZE ); + // NANDコンテキストコピー + MI_CpuCopyFast( &OSi_GetFromBromAddr()->SDNandContext, (void*)HW_SD_NAND_CONTEXT_BUF, sizeof(SDPortContextData) ); + // FromBrom全消去 + MIi_CpuClearFast( 0, (void*)OSi_GetFromBromAddr(), sizeof(OSFromBromBuf) ); +} + +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + MCUi_WriteRegister( MCU_REG_BL_ADDR, MCU_REG_BL_BRIGHTNESS_MASK ); + PM_BackLightOn( TRUE ); + // XYボタン通知 + PAD_InitXYButton(); + + /* + バッテリー残量チェック + */ + MCUi_WriteRegister( MCU_REG_MODE_ADDR, MCU_SYSTEMMODE_TWL ); // TWL mode for ES library + if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 ) + { +#ifndef SDK_FINALROM + OS_TPanic("Battery is empty.\n"); +#else + PM_Shutdown(); +#endif + } +} + +/*************************************************************** + EraseAll + + 不正終了しました + いろいろ消してください + DSモードにして終わるのがよいか? +***************************************************************/ +static void EraseAll(void) +{ + GCDHeader* const gh = (GCDHeader*)HW_ROM_HEADER_BUF; + AESi_ResetAesKeyA(); + AESi_ResetAesKeyB(); + AESi_ResetAesKeyC(); + MI_CpuClearFast( nor, (gh->l.nandfirm_size + 512) * 2 ); +} + +/* + 独自CARDライブラリ +*/ + +#define CARD_COMMAND_PAGE 0x01000000 +#define CARD_COMMAND_MASK 0x07000000 +#define CARD_RESET_HI 0x20000000 +#define CARD_COMMAND_OP_G_READPAGE 0xB7 + +static u32 cache_page; +static u8 CARDi_cache_buf[CARD_ROM_PAGE_SIZE] ATTRIBUTE_ALIGN(32); + +/*---------------------------------------------------------------------------* + Name: CARDi_SetRomOp + + Description: カードコマンド設定 + + Arguments: command コマンド + offset 転送ページ数 + + Returns: None. + *---------------------------------------------------------------------------*/ +static void CARDi_SetRomOp(u32 command, u32 offset) +{ + u32 cmd1 = (u32)((offset >> 8) | (command << 24)); + u32 cmd2 = (u32)((offset << 24)); + // 念のため前回のROMコマンドの完了待ち。 + while ((reg_MI_MCCNT1 & REG_MI_MCCNT1_START_MASK) != 0) + { + } + // マスターイネーブル。 + reg_MI_MCCNT0 = (u16)(REG_MI_MCCNT0_E_MASK | REG_MI_MCCNT0_I_MASK | + (reg_MI_MCCNT0 & ~REG_MI_MCCNT0_SEL_MASK)); + // コマンド設定。 + reg_MI_MCCMD0 = MI_HToBE32(cmd1); + reg_MI_MCCMD1 = MI_HToBE32(cmd2); +} + +/*---------------------------------------------------------------------------* + Name: CARDi_GetRomFlag + + Description: カードコマンドコントロールパラメータを取得 + + Arguments: flag カードデバイスへ発行するコマンドのタイプ + (CARD_COMMAND_PAGE / CARD_COMMAND_ID / + CARD_COMMAND_STAT / CARD_COMMAND_REFRESH) + + Returns: カードコマンドコントロールパラメータ + *---------------------------------------------------------------------------*/ +SDK_INLINE u32 CARDi_GetRomFlag(u32 flag) +{ + u32 rom_ctrl = *(vu32 *)(HW_CARD_ROM_HEADER + 0x60); + return (u32)(flag | REG_MI_MCCNT1_START_MASK | CARD_RESET_HI | (rom_ctrl & ~CARD_COMMAND_MASK)); +} + +/*---------------------------------------------------------------------------* + Name: CARDi_StartRomPageTransfer + + Description: ROMページ転送を開始。 + + Arguments: offset 転送元のROMオフセット + + Returns: None. + *---------------------------------------------------------------------------*/ +static void CARDi_StartRomPageTransfer(u32 offset) +{ + u8 op = CARD_COMMAND_OP_G_READPAGE; + CARDi_SetRomOp(op, offset); + reg_MI_MCCNT1 = CARDi_GetRomFlag(CARD_COMMAND_PAGE); +} + +/*---------------------------------------------------------------------------* + Name: CARDi_ReadRomWithCPU + + Description: CPUを使用してROM転送。 + キャッシュやページ単位の制限を考慮する必要は無いが + 転送完了まで関数がブロッキングする点に注意。 + + Arguments: userdata (他のコールバックとして使用するためのダミー) + buffer 転送先バッファ + offset 転送元ROMオフセット + length 転送サイズ + + Returns: None. + *---------------------------------------------------------------------------*/ +static int CARDi_ReadRomWithCPU(void *userdata, void *buffer, u32 offset, u32 length) +{ + int retval = (int)length; + // 頻繁に使用するグローバル変数をローカル変数へキャッシュ。 + u32 cachedPage = cache_page; + u8 * const cacheBuffer = CARDi_cache_buf; + while (length > 0) + { + // ROM転送は常にページ単位。 + u8 *ptr = (u8 *)buffer; + u32 n = CARD_ROM_PAGE_SIZE; + u32 pos = MATH_ROUNDDOWN(offset, CARD_ROM_PAGE_SIZE); + // 以前のページと同じならばキャッシュを使用。 + if (pos == cachedPage) + { + ptr = cacheBuffer; + } + else + { + // バッファへ直接転送できないならキャッシュへ転送。 + if(((pos != offset) || (((u32)buffer & 3) != 0) || (length < n))) + { + cachedPage = pos; + ptr = cacheBuffer; + } + // 4バイト整合の保証されたバッファへCPUで直接リード。 + CARDi_StartRomPageTransfer(pos); + { + u32 word = 0; + for (;;) + { + // 1ワード転送完了を待つ。 + u32 ctrl = reg_MI_MCCNT1; + if ((ctrl & REG_MI_MCCNT1_RDY_MASK) != 0) + { + // データを読み出し、必要ならバッファへ格納。 + u32 data = reg_MI_MCD1; + if (word < (CARD_ROM_PAGE_SIZE / sizeof(u32))) + { + ((u32 *)ptr)[word++] = data; + } + } + // 1ページ転送完了なら終了。 + if ((ctrl & REG_MI_MCCNT1_START_MASK) == 0) + { + break; + } + } + } + } + // キャッシュ経由ならキャッシュから転送。 + if (ptr == cacheBuffer) + { + u32 mod = offset - pos; + n = MATH_MIN(length, CARD_ROM_PAGE_SIZE - mod); + MI_CpuCopy8(cacheBuffer + mod, buffer, n); + } + buffer = (u8 *)buffer + n; + offset += n; + length -= n; + } + // ローカル変数からグローバル変数へ反映。 + cache_page = cachedPage; + (void)userdata; + return retval; +} + + +/* + GCD_LoadStatic関連 +*/ +//static ROM_Header* const rh= (ROM_Header*)HW_TWL_ROM_HEADER_BUF; +static ROM_Header* const rh= (ROM_Header*)HW_TWL_MAIN_MEM; + +#define MODULE_ALIGNMENT 0x20 // 16*2バイト単位で読み込む +//#define MODULE_ALIGNMENT 0x200 // 512バイト単位で読み込む +#define RoundUpModuleSize(value) (((value) + MODULE_ALIGNMENT - 1) & -MODULE_ALIGNMENT) + +/* + start point + main static + sub static + main ltd + sub ltd + end point +*/ +#define ROM_HEADER_RAM_OFFSET 0xe00 + +static void GCD_LoadStatic( u32 offset ) +{ + u8** ram_offset = (u8**)((u32)rh + ROM_HEADER_RAM_OFFSET); + u8* dest = (u8*)rh + HW_TWL_ROM_HEADER_BUF_SIZE; + ram_offset[0] = dest; // start point + if ( rh->s.main_size > 0 ) + { + CARDi_ReadRomWithCPU( NULL, dest, offset + rh->s.main_rom_offset, RoundUpModuleSize(rh->s.main_size) ); + ram_offset[1] = dest; + dest += RoundUpModuleSize(rh->s.main_size); + } + if ( rh->s.sub_size > 0 ) + { + CARDi_ReadRomWithCPU( NULL, dest, offset + rh->s.sub_rom_offset, RoundUpModuleSize(rh->s.sub_size) ); + ram_offset[2] = dest; + dest += RoundUpModuleSize(rh->s.sub_size); + } + if ( rh->s.main_ltd_size > 0 ) + { + CARDi_ReadRomWithCPU( NULL, dest, offset + rh->s.main_ltd_rom_offset, RoundUpModuleSize(rh->s.main_ltd_size) ); + ram_offset[3] = dest; + dest += RoundUpModuleSize(rh->s.main_ltd_size); + } + if ( rh->s.sub_ltd_size > 0 ) + { + CARDi_ReadRomWithCPU( NULL, dest, offset + rh->s.sub_ltd_rom_offset, RoundUpModuleSize(rh->s.sub_ltd_size) ); + ram_offset[4] = dest; + dest += RoundUpModuleSize(rh->s.sub_ltd_size); + } + ram_offset[5] = dest; // end point +} + +static void GCD_LoadHeader( u32 offset ) +{ + CARDi_ReadRomWithCPU( NULL, rh, offset, HW_TWL_ROM_HEADER_BUF_SIZE ); +} + +extern SDMC_ERR_CODE FATFSi_sdmcGoIdle(u16 ports, void (*func1)(),void (*func2)()); + +void TwlSpMain( void ) +{ + GCDHeader* const gh = &OSi_GetFromBromAddr()->header.gcd; + u32 offset = gh->l.nandfirm_offset; + u32 size = gh->l.nandfirm_size; + u32 append_offset = gh->l.append_offset; + u32 nsize = size - offsetof(NANDHeader,l); // size to write to nand + u32 sectors = (nsize + 511)/512; + u8* nor2 = nor + size; // buffer to verify + u8* nand2 = nand + size; // buffer to verify + + SdmcResultInfo sdResult; + + InitDebugLED(); + SetDebugLED(++step); // 0x01 + + PreInit(); + SetDebugLED(++step); // 0x02 + + OS_InitFIRM(); + OS_EnableIrq(); + OS_EnableInterrupts(); + SetDebugLED(++step); // 0x03 + + PostInit(); + SetDebugLED(++step); // 0x04 + + // NAND初期化 + if (SDMC_NORMAL != FATFSi_sdmcInit( (SDMC_DMA_NO)DMA_FATFS_1, (SDMC_DMA_NO)DMA_FATFS_2 )) + { + OS_TPrintf("Failed to call FATFSi_sdmcInit().\n"); + goto err; + } + FATFSi_sdmcGoIdle( 2, NULL, NULL ); + SetDebugLED(++step); // 0x05 + + // CARD初期化 + SetDebugLED(++step); // 0x06 + + PXI_SendStream(&size, sizeof(size)); + + if ( size < sizeof(NANDHeader) ) + { + OS_TPrintf("No NAND firm is there.\n"); + goto err; + } + SetDebugLED(++step); // 0x07 + + // read all + *(u32*)nor = 0; + CARDi_ReadRomWithCPU( NULL, nor, offset, size ); + SetDebugLED(++step); // 0x08 + + PXI_NotifyID( FIRM_PXI_ID_NULL ); + + // write NOR + NVRAMi_Write( 0, nor, sizeof(NORHeaderDS)); + SetDebugLED(++step); // 0x09 + + { // write boot_nandfirm flag + s32 tmp = -1; + NVRAMi_Write( 0x2ff, &tmp, 1 ); + } + SetDebugLED(++step); // 0x0a + + // write NAND + if (SDMC_NORMAL != FATFSi_sdmcWriteFifo( nand, sectors, 1, SDMC_PORT_NAND, &sdResult )) + { + OS_TPrintf("Failed to call FATFSi_sdmcWriteFifo() to write header.\n"); + goto err; + } + + SetDebugLED(++step); // 0x0b + + PXI_NotifyID( FIRM_PXI_ID_NULL ); + + // verify NOR + NVRAMi_Read( 0, nor2, sizeof(NORHeaderDS) ); + if ( MI_CpuComp8( nor, nor2, sizeof(NORHeaderDS) ) ) + { + OS_TPrintf("Failed to verify firm data in NOR.\n"); + goto err; + } + SetDebugLED(++step); // 0x0c + + // verify NAND + if ( FATFSi_sdmcReadFifo( nand2, sectors, 1, SDMC_PORT_NAND, &sdResult ) ) + { + OS_TPrintf("Failed to call FATFSi_sdmcReadFifo() to write header.\n"); + goto err; + } + SetDebugLED(++step); // 0x0d + if ( MI_CpuComp8( nand, nand2, nsize ) ) + { + OS_TPrintf("Failed to verify firm data in NAND.\n"); + goto err; + } + SetDebugLED(++step); // 0x0e + + PXI_NotifyID( FIRM_PXI_ID_NULL ); + + /* + 追加SRL読み込み + */ + + /* + GCD_LoadHeader + */ + GCD_LoadHeader( append_offset ); + + SetDebugLED(++step); // 0x0f + + PXI_NotifyID( FIRM_PXI_ID_NULL ); + + // 9: after AESi_InitSeed + SetDebugLED(++step); // 0x10 + + /* + GCD_LoadStatic + */ + GCD_LoadStatic( append_offset ); + + SetDebugLED(0); // 0x00 + + PXI_NotifyID( FIRM_PXI_ID_NULL ); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + goto err; + } + + OS_TPrintf("Success all.\n"); + MCUi_WriteRegister( MCU_REG_COMMAND_ADDR, MCU_REG_COMMAND_RESET_MASK ); + OS_Terminate(); + +err: + SetDebugLED((u8)(step|0xF0)); + EraseAll(); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + OS_Terminate(); +} + + diff --git a/build/gcdfirm/memory-launcher-writer/ARM9/Makefile b/build/gcdfirm/memory-launcher-writer/ARM9/Makefile new file mode 100644 index 00000000..43683c97 --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/ARM9/Makefile @@ -0,0 +1,53 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - memory-launcher +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#LINCLUDES = ../include + +#---------------------------------------------------------------------------- + +TARGET_BIN = memory_launcher_writer9.srl + +SRCS = main.c \ + screen.c \ + font.c + +CRT0_O = crt0_firm.o + +ADDRESS_STATIC = 0x037c0000 + +MAKEROM_ARM7 = ../ARM7/bin/$(TWL_BUILDTYPE_ARM7)/memory_launcher_writer7.tef +MAKEROM_ARM7_BASE = $(basename $(MAKEROM_ARM7)) + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +#SRCDIR = # using default +#LCFILE = # using default + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/gcdfirm/memory-launcher-writer/ARM9/font.c b/build/gcdfirm/memory-launcher-writer/ARM9/font.c new file mode 100644 index 00000000..ee49f50b --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/ARM9/font.c @@ -0,0 +1,588 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: font.c + + Copyright 2003-2005 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: font.c,v $ + Revision 1.3 2005/02/28 05:26:11 yosizaki + do-indent. + + Revision 1.2 2004/11/02 07:19:52 terui + コメント内スペルミスを修正。 + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#include "font.h" + + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/gcdfirm/memory-launcher-writer/ARM9/include/font.h b/build/gcdfirm/memory-launcher-writer/ARM9/include/font.h new file mode 100644 index 00000000..30d49e95 --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/ARM9/include/font.h @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: font.h + + Copyright 2003-2005 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: font.h,v $ + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +typedef enum +{ + FONT_BLOCK = 0, + FONT_RED = 1, + FONT_GREEN = 2, + FONT_BLUE = 3, + FONT_YELLOW = 4, + FONT_PURPLE = 5, + FONT_CYAAN = 6, + FONT_WHITE = 15 +} +MYFontColor; + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/gcdfirm/memory-launcher-writer/ARM9/include/screen.h b/build/gcdfirm/memory-launcher-writer/ARM9/include/screen.h new file mode 100644 index 00000000..81ed6790 --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/ARM9/include/screen.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: screen.h + + Copyright 2003-2006 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: screen.h,v $ + Revision 1.3 2006/01/18 02:12:28 kitase_hirotake + do-indent + + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern u16 gScreen[32 * 32]; + +void ClearScreen(void); +void PrintString(s16 x, s16 y, u8 palette, char *text, ...); +void ColorString(s16 x, s16 y, s16 length, u8 palette); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/gcdfirm/memory-launcher-writer/ARM9/main.c b/build/gcdfirm/memory-launcher-writer/ARM9/main.c new file mode 100644 index 00000000..37ef06e4 --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/ARM9/main.c @@ -0,0 +1,246 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - ts_dev9 + File: main.c + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include "font.h" +#include "screen.h" + +//#define PRINT_DEBUG + +#ifndef PRINT_DEBUG +#undef OS_TPrintf +#define OS_TPrintf(...) ((void)0) +#endif // PRINT_DEBUG + +static void myInit(void); +static void myVBlankIntr(void); + +/*************************************************************** + PreInit + + FromBootの対応&OS_Init前に必要なメインメモリの初期化 +***************************************************************/ +static void PreInit(void) +{ + /* + メインメモリ関連 + */ + // SHARED領域クリア + MI_CpuClearFast((void*)HW_WRAM_EX_LOCK_BUF, (HW_WRAM_EX_LOCK_BUF_END - HW_WRAM_EX_LOCK_BUF)); + MI_CpuClearFast((void*)HW_BIOS_EXCP_STACK_MAIN, (HW_REAL_TIME_CLOCK_BUF - HW_BIOS_EXCP_STACK_MAIN)); + MI_CpuClearFast((void*)HW_PXI_SIGNAL_PARAM_ARM9, (HW_MMEMCHECKER_MAIN - HW_PXI_SIGNAL_PARAM_ARM9)); + MI_CpuClearFast((void*)HW_ROM_HEADER_BUF, (HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF)); + + // FromBrom全消去 + MIi_CpuClearFast( 0, (void*)OSi_GetFromBromAddr(), sizeof(OSFromBromBuf) ); + + // ブートタイプの変更 + ( (OSBootInfo *)OS_GetBootInfo() )->boot_type = OS_BOOTTYPE_NAND; +} + +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ +} + +/*************************************************************** + EraseAll + + 不正終了しました + いろいろ消してください + DSモードにして終わるのがよいか? +***************************************************************/ +static void EraseAll(void) +{ +} + +void TwlMain( void ) +{ + u32 len; +#define X_OFF 2 + s16 y = 2; + + PreInit(); + myInit(); + PostInit(); + + //---- clear screen buffer + ClearScreen(); + + PrintString( X_OFF, y, FONT_CYAAN, "NAND Firm Writer" ); + PrintString( X_OFF+18, y++, FONT_YELLOW, "%s", __DATE__ ); + PrintString( X_OFF+21, y++, FONT_YELLOW, "%s", __TIME__ ); + OS_WaitVBlankIntr(); + y++; + + PXI_RecvStream(&len, sizeof(len)); + PrintString( X_OFF, y++, FONT_WHITE, "Firm length: %d bytes", len ); + OS_WaitVBlankIntr(); + y++; + + PrintString( X_OFF, y++, FONT_WHITE, "Load NAND Firm..." ); + OS_WaitVBlankIntr(); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + goto err; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + PrintString( X_OFF, y++, FONT_WHITE, "Write NAND Firm..." ); + OS_WaitVBlankIntr(); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + goto err; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + PrintString( X_OFF, y++, FONT_WHITE, "Verify NAND Firm..." ); + OS_WaitVBlankIntr(); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + goto err; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + PrintString( X_OFF, y++, FONT_WHITE, "Load SRL Header..." ); + OS_WaitVBlankIntr(); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + goto err; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + + PrintString( X_OFF, y++, FONT_WHITE, "Load SRL Static Data..." ); + OS_WaitVBlankIntr(); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + goto err; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + + PrintString( X_OFF, 20, FONT_GREEN, "SUCCESS ALL!" ); + do + { + OS_WaitVBlankIntr(); + } + while ( PAD_DetectFold() && (PAD_Read() & PAD_ALL_MASK) == (PAD_BUTTON_START|PAD_BUTTON_SELECT|PAD_BUTTON_X)); + + PXI_NotifyID( FIRM_PXI_ID_NULL ); + OS_Terminate(); + +err: + PrintString( X_OFF+20, y++, FONT_RED, "Failed." ); + OS_WaitVBlankIntr(); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + OS_Terminate(); +} + +//---------------------------------------------------------------- +// myInit +// +void myInit(void) +{ + //---- init + OS_InitFIRM(); + OS_InitTick(); + OS_InitAlarm(); + FX_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + //---- init displaying + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- setting 2D for top screen + GX_SetBankForBG(GX_VRAM_BG_128_A); + + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + G2_BG0Mosaic(FALSE); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + + //---- setting 2D for bottom screen + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + G2S_BG0Mosaic(FALSE); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + //---- screen + MI_CpuFillFast((void *)gScreen, 0, sizeof(gScreen)); + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + //---- init interrupt + OS_SetIrqFunction(OS_IE_V_BLANK, myVBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + //---- start displaying + GX_DispOn(); + GXS_DispOn(); +} + +//---------------------------------------------------------------- +// myVBlankIntr +// vblank interrupt handler +// +static void myVBlankIntr(void) +{ + //---- upload pseudo screen to VRAM + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + diff --git a/build/gcdfirm/memory-launcher-writer/ARM9/screen.c b/build/gcdfirm/memory-launcher-writer/ARM9/screen.c new file mode 100644 index 00000000..8e20145a --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/ARM9/screen.c @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: screen.c + + Copyright 2003-2006 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: screen.c,v $ + Revision 1.3 2006/01/18 02:12:28 kitase_hirotake + do-indent + + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include "screen.h" + +u16 gScreen[32 * 32]; +//u16 gScreen2[ 32 * 32 ]; + +// ** these code are refer to rtc sample. thanks. +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: clear screen buffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast((void *)gScreen, sizeof(gScreen)); +} + +/*---------------------------------------------------------------------------* + Name: PrintString + + Description: enter string into screen buffer + string must be within 32 chars + + Arguments: x : x + y : y + palette : color (0-15) + text : string. end mark is NULL + + Returns: None. + *---------------------------------------------------------------------------*/ +void PrintString(s16 x, s16 y, u8 palette, char *text, ...) +{ + va_list vlist; + char temp[32 + 2], *tempPtr; + s32 i; + u16 *p, *pLimit; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0; + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + tempPtr = &temp[0]; + + for (i = 0; *tempPtr; i++, tempPtr++) + { + *p = (u16)((palette << 12) | *tempPtr); + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} + +/*---------------------------------------------------------------------------* + Name: ColorString + + Description: change string color which is put in screen buffer + + Arguments: x : x + y : y + length : number of characters to change color + palette : color (0-15) + + Returns: None. + *---------------------------------------------------------------------------*/ +void ColorString(s16 x, s16 y, s16 length, u8 palette) +{ + s32 i; + u16 *p, *pLimit; + + if (length < 0) + return; + + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + + for (i = 0; i < length; i++) + { + u16 temp = *p; + temp &= 0x0fff; + temp |= (palette << 12); + *p = temp; + + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} diff --git a/build/gcdfirm/memory-launcher-writer/Makefile b/build/gcdfirm/memory-launcher-writer/Makefile new file mode 100644 index 00000000..7786d8de --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/Makefile @@ -0,0 +1,65 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - gcdfirm - memory-launcher-writer +# File: Makefile +# +# Copyright 2008 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + wram_regs \ + ARM7 \ + ARM9 \ + +ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),) + +TARGET_FIRM_BIN = memory_launcher_writer-$(TWL_BUILD_TYPE)$(CODEGEN_ARCH).gcd + +NANDFIRM_BIN = ../../nandfirm/memory-launcher/memory_launcher-$(TWL_BUILD_TYPE)$(CODEGEN_ARCH).nand + +APPEND_SRL = $(TWLSDK_ROOT)/bin/ARM9-TS/Release/nand2sd.srl +#APPEND_SRL = ../../systemMenu_tools/NandInitializerRed/ARM9.TWL/bin/ARM9-TS.LTD.thumb/Release/NandInitializerRed.srl + +BINDIR = . +MAKEFIRM_ARM9 = ARM9/bin/$(TWL_BUILDTYPE_ARM9)/memory_launcher_writer9.tef +MAKEFIRM_ARM7 = ARM7/bin/$(TWL_BUILDTYPE_ARM7)/memory_launcher_writer7.tef +MAKEFIRM_RSA_PRVKEY = $(TWL_KEYSDIR)/rsa/private_gcd.der +LDEPENDS_BIN += wram_regs/wram_regs.rbin + +#MAKEFIRM_FLAGS += -p +FIRM_SPEC = gcdfirm.gcdsf + +MAKEFIRM_DEFS += -DNANDFIRM_BIN=$(NANDFIRM_BIN) -DAPPEND_SRL=$(APPEND_SRL) + +LDIRT_CLEAN += $(wildcard *.gcd) \ + rsa_public.sbin \ + +LDEPENDS_BIN += $(NANDFIRM_BIN) + +endif + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGET_BIN) + +$(NANDFIRM_BIN): + $(REMAKE) -C $(dir $(NANDFIRM_BIN)) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/gcdfirm/memory-launcher-writer/gcdfirm.gcdsf b/build/gcdfirm/memory-launcher-writer/gcdfirm.gcdsf new file mode 100644 index 00000000..80d6aac8 --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/gcdfirm.gcdsf @@ -0,0 +1,23 @@ +#GCDSF --- Gcdfirm Spec File + +VERSION : 0x0 # GENERATE + +RSA_KEY : $(MAKEFIRM_RSA_PRVKEY) +OUT_KEY : rsa_public.sbin + +WRAM_RBIN : ./wram_regs/wram_regs.rbin + +ARM9_COMP : FALSE # TRUE or FALSE, should be before ARM9_SBIN +ARM9_SBIN : $(MAKEFIRM_ARM9).TWL.FLX.sbin +ARM9_ELF : $(MAKEFIRM_ARM9).tef + +ARM7_COMP : FALSE # TRUE or FALSE, should be before ARM7_SBIN +ARM7_SBIN : $(MAKEFIRM_ARM7).TWL.FLX.sbin +ARM7_ELF : $(MAKEFIRM_ARM7).tef + +ARM9_X2 : TRUE # TRUE or FALSE + +#NORFIRM : $(NORFIRM_BIN) +NANDFIRM : $(NANDFIRM_BIN) + +APPEND : $(APPEND_SRL) diff --git a/build/gcdfirm/memory-launcher-writer/wram_regs/Makefile b/build/gcdfirm/memory-launcher-writer/wram_regs/Makefile new file mode 100644 index 00000000..1c1afc6d --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/wram_regs/Makefile @@ -0,0 +1,57 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - menu-launcher +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL +override TARGET_CODEGEN := ARM +override TWL_ARCHGEN := LIMITED + +override TARGET_FINALROM := TRUE +override TARGET_RELEASE := +override TARGET_DEBUG := + +SUBDIRS = + +LINCLUDES = ../include + + +#---------------------------------------------------------------------------- + +TARGET_BIN = wram_regs.rbin + +SRCS = \ + wram_regs.c \ + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_DIR = . +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/gcdfirm/memory-launcher-writer/wram_regs/wram_regs.c b/build/gcdfirm/memory-launcher-writer/wram_regs/wram_regs.c new file mode 100644 index 00000000..aaa4dc33 --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/wram_regs/wram_regs.c @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - gcdfirm + File: wram_regs.c + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Date:: $ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#include +#include + +MIHeader_WramRegs wram_regs_init = +{ + // ARM9 + { + REG_MI_MBK_A0_FIELD( 1, MI_WRAM_A_OFFSET_0KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A1_FIELD( 1, MI_WRAM_A_OFFSET_64KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A2_FIELD( 1, MI_WRAM_A_OFFSET_128KB, MI_WRAM_ARM9 ), + REG_MI_MBK_A3_FIELD( 1, MI_WRAM_A_OFFSET_192KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_B0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), +// REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_C0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + }, + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, HW_WRAM_AREA_HALF ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ) + ), +/* + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), +*/ + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ), // joint to WRAM-A + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, MI_WRAM_MAP_NULL ) + ), + + // ARM7 + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE - HW_WRAM_C_SIZE ) + ), + + // WRAM Lock + { + 0, + 0, + 0, + }, + + // WRAM-0/1 + 3, + + // VRAM-C + 7, + // VRAM-D + 7, +}; + diff --git a/build/nandfirm/Makefile b/build/nandfirm/Makefile index dcf55520..913959b8 100644 --- a/build/nandfirm/Makefile +++ b/build/nandfirm/Makefile @@ -24,6 +24,7 @@ include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs SUBDIRS_P = \ nandfirm-print \ sdmc-launcher \ + memory-launcher \ menu-launcher \ #---------------------------------------------------------------------------- diff --git a/build/nandfirm/memory-launcher/ARM7/Makefile b/build/nandfirm/memory-launcher/ARM7/Makefile new file mode 100644 index 00000000..8b028eb0 --- /dev/null +++ b/build/nandfirm/memory-launcher/ARM7/Makefile @@ -0,0 +1,51 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - memory-launcher +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- + +TWL_PROC = ARM7 + +SUBDIRS = + +LINCLUDES = + +#---------------------------------------------------------------------------- + +TARGET_BIN = memory_launcher7.tef + +SRCS = main.c + +CRT0_O = crt0_firm.o + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +#SRCDIR = # using default +#LCFILE = # using default + +LLIBRARIES += libsysmenu_sp.TWL$(ARCHGEN_TYPE).a + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037c0000' + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/nandfirm/memory-launcher/ARM7/main.c b/build/nandfirm/memory-launcher/ARM7/main.c new file mode 100644 index 00000000..b118dda6 --- /dev/null +++ b/build/nandfirm/memory-launcher/ARM7/main.c @@ -0,0 +1,343 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - nandfirm - sdmc-launcher + File: main.c + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Date:: $ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#include +#include + +/* + デバッグLEDをFINALROMとは別にOn/Offできます。 +*/ +#define USE_DEBUG_LED + +/* + PRINT_MEMORY_ADDR を定義すると、そのアドレスからSPrintfを行います(このファイルのみ) + FINALROM版でもコードが残るので注意してください。 +*/ +//#define PRINT_MEMORY_ADDR 0x02FFC800 + +/* + AES鍵設定API +*/ +extern void SYSMi_SetAESKeysForAccessControl( BOOL isNtrMode, ROM_Header *pROMH ); + +#ifdef USE_DEBUG_LED +static u8 step = 0x80; +#define InitDebugLED() I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x03, 0x00) +#define SetDebugLED(pattern) I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x01, (pattern)); +#else +#define InitDebugLED() ((void)0) +#define SetDebugLED(pattern) ((void)0) +#endif + +#ifdef PRINT_MEMORY_ADDR +static char* debugPtr = (char*)PRINT_MEMORY_ADDR; +#undef OS_TPrintf +//#define OS_TPrintf(...) (debugPtr = (char*)((u32)(debugPtr + STD_TSPrintf(debugPtr, __VA_ARGS__) + 0xf) & ~0xf)) +#define OS_TPrintf(...) (debugPtr += STD_TSPrintf(debugPtr, __VA_ARGS__)) +#endif + +#define THREAD_PRIO_AES 12 +#define THREAD_PRIO_FATFS 8 +#define DMA_FATFS_1 0 +#define DMA_FATFS_2 1 + +/*************************************************************** + PreInit + + FromBootの対応&メインメモリの初期化 + OS_Init前なので注意 (ARM9によるメインメモリ初期化で消されないように注意) +***************************************************************/ +static void PreInit(void) +{ + /* + FromBrom関連 + */ + if ( !OSi_FromBromToMenu() ) + { + OS_Terminate(); + } + /* + リセットパラメータ(1バイト)を共有領域(1バイト)にコピー + */ +#define HOTSTART_FLAG_ENABLE 0x80 + *(u8 *)HW_NAND_FIRM_HOTSTART_FLAG = (u8)(MCUi_ReadRegister( (u16)(MCU_REG_TEMP_ADDR + OS_MCU_RESET_VALUE_OFS) ) | HOTSTART_FLAG_ENABLE); +} + +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + PM_BackLightOn( TRUE ); // ARM9側画面表示のため + + /* + AES関連 (NAND暗号化の鍵変更を含む) + */ + if ( OSi_GetFromFirmAddr()->aes_key[2][0] ) + { + AESi_PreInitKeys(); + } + // AESの初期化 + AES_Init(THREAD_PRIO_AES); // for encrypted NAND + /* + バッテリー残量チェック + */ + MCUi_WriteRegister( MCU_REG_MODE_ADDR, MCU_SYSTEMMODE_TWL ); + SetDebugLED(++step); // 0x84 + if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 ) + { +#ifndef SDK_FINALROM + OS_TPanic("Battery is empty.\n"); +#else + PM_Shutdown(); +#endif + } +} + +/*************************************************************** + EraseAll + + 不正終了しました + いろいろ消してください + DSモードにして終わるのがよいか? +***************************************************************/ +static void EraseAll(void) +{ + AESi_ResetAesKeyA(); + AESi_ResetAesKeyB(); + AESi_ResetAesKeyC(); + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); +#ifdef SDK_FINALROM + MI_CpuClearFast( (void*)HW_TWL_ROM_HEADER_BUF, HW_TWL_ROM_HEADER_BUF_SIZE ); + OS_BootFromFIRM(); +#endif +} + +/* + MI_LoadStatic関連 +*/ +static ROM_Header* const rh= (ROM_Header*)HW_TWL_ROM_HEADER_BUF; + +#define MODULE_ALIGNMENT 0x20 // 16*2バイト単位で読み込む +//#define MODULE_ALIGNMENT 0x200 // 512バイト単位で読み込む +#define RoundUpModuleSize(value) (((value) + MODULE_ALIGNMENT - 1) & -MODULE_ALIGNMENT) + +/* + start point + main static + sub static + main ltd + sub ltd + end point +*/ +#define ROM_HEADER_RAM_OFFSET 0xe00 +#define TEMP_OFFSET 0x800000 // 一時待避場所 + +static BOOL aesFlag; +static AESCounter aesCounter; + +#define DMA_SEND 2 +#define DMA_RECV 3 +static void MI_DmaCopyWithAes( void* src, void* dest, u32 size ) +{ + AES_Lock(); + AES_Reset(); + AES_Reset(); + AES_WaitKey(); + AES_LoadKey( AES_KEY_SLOT_A ); + AES_WaitKey(); + AES_DmaSend( DMA_SEND, src, size, NULL, NULL ); + AES_DmaRecv( DMA_RECV, dest, size, NULL, NULL ); + AES_SetCounter( &aesCounter ); + AES_Run( AES_MODE_CTR, 0, size / AES_BLOCK_SIZE, NULL, NULL ); + AES_AddToCounter( &aesCounter, size / AES_BLOCK_SIZE ); + MI_WaitNDma( DMA_RECV ); + AES_Unlock(); +} + +static void EnableAes( u32 offset ) +{ + aesFlag = TRUE; + MI_CpuCopy8( rh->s.main_static_digest, &aesCounter, AES_BLOCK_SIZE ); + AES_AddToCounter( &aesCounter, (offset - rh->s.aes_target_rom_offset) / AES_BLOCK_SIZE ); +} +static void EnableAes2( u32 offset ) +{ + aesFlag = TRUE; + MI_CpuCopy8( rh->s.sub_static_digest, &aesCounter, AES_BLOCK_SIZE ); + AES_AddToCounter( &aesCounter, (offset - rh->s.aes_target2_rom_offset) / AES_BLOCK_SIZE ); +} +static void DisableAes( void ) +{ + aesFlag = FALSE; +} + +static u32 GetTransferSize( u32 offset, u32 size ) +{ + if ( rh->s.enable_aes ) + { + u32 end = offset + RoundUpModuleSize(size); + u32 aes_offset = rh->s.aes_target_rom_offset; + u32 aes_end = aes_offset + RoundUpModuleSize(rh->s.aes_target_size); + u32 aes_offset2 = rh->s.aes_target2_rom_offset; + u32 aes_end2 = aes_offset2 + RoundUpModuleSize(rh->s.aes_target2_size); + + if ( offset >= aes_offset && offset < aes_end ) + { + if ( end > aes_end ) + { + size = aes_end - offset; + } + EnableAes( offset ); + } + else if ( offset >= aes_offset2 && offset < aes_end2 ) + { + if ( end > aes_end2 ) + { + size = aes_end2 - offset; + } + EnableAes2( offset ); + } + else + { + if ( offset < aes_offset && offset + size > aes_offset ) + { + size = aes_offset - offset; + } + if ( offset < aes_offset2 && offset + size > aes_offset2 ) + { + size = aes_offset2 - offset; + } + DisableAes(); + } + } + else + { + DisableAes(); + } + return size; +} +static void MI_LoadModule( u8* src, u8* dest, u32 offset, u32 size ) +{ + size = RoundUpModuleSize( size ); + while ( size > 0 ) + { + u32 unit = GetTransferSize( offset, size ); + if ( aesFlag ) + { + MI_DmaCopyWithAes( src, dest, unit ); + } + else + { + MI_CpuCopyFast( src, dest, unit ); + } + dest += unit; + src += unit; + offset += unit; + size -= unit; + } +} + +static void MI_LoadStatic( void ) +{ + u8** ram_offset = (u8**)((u32)rh + ROM_HEADER_RAM_OFFSET); + if ( ram_offset[5] + TEMP_OFFSET > (void*)HW_TWL_MAIN_MEM_SHARED ) + { + return; // overflow + } + /* 一旦移動させる */ + MI_CpuCopyFast( ram_offset[0], ram_offset[0] + TEMP_OFFSET, (u32)RoundUpModuleSize(ram_offset[5] - ram_offset[0])); + if ( rh->s.main_size > 0 ) + { + MI_LoadModule( ram_offset[1] + TEMP_OFFSET, rh->s.main_ram_address, rh->s.main_rom_offset, rh->s.main_size ); + } + if ( rh->s.sub_size > 0 ) + { + MI_LoadModule( ram_offset[2] + TEMP_OFFSET, rh->s.sub_ram_address, rh->s.sub_rom_offset, rh->s.sub_size ); + } + if ( rh->s.main_ltd_size > 0 ) + { + MI_LoadModule( ram_offset[3] + TEMP_OFFSET, rh->s.main_ltd_ram_address, rh->s.main_ltd_rom_offset, rh->s.main_ltd_size ); + } + if ( rh->s.sub_ltd_size > 0 ) + { + MI_LoadModule( ram_offset[4] + TEMP_OFFSET, rh->s.sub_ltd_ram_address, rh->s.sub_ltd_rom_offset, rh->s.sub_ltd_size ); + } +} + +void TwlSpMain( void ) +{ + InitDebugLED(); + SetDebugLED(++step); // 0x81 + + PreInit(); + SetDebugLED(++step); // 0x82 + + OS_InitFIRM(); + OS_EnableIrq(); + OS_EnableInterrupts(); + // 2: after OS_InitFIRM + SetDebugLED(++step); // 0x83 + + PostInit(); + // 3: after PostInit + SetDebugLED(++step); // 0x85 + + if ( PXI_RecvID() != FIRM_PXI_ID_DONE_HEADER ) + { + OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_DONE_HEADER).\n"); + goto end; + } + // 4: after PXI + SetDebugLED(++step); // 0x87 + + AESi_InitKeysFIRM(); + AESi_InitSeed(); + // 5: after AESi_InitSeed + SetDebugLED(++step); // 0x88 + + MI_LoadStatic(); + PXI_NotifyID( FIRM_PXI_ID_NULL ); + + if ( PXI_RecvID() != FIRM_PXI_ID_DONE_STATIC ) + { + OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_DONE_STATIC).\n"); + goto end; + } + // 6: after PXI + SetDebugLED( 0 ); + + SYSMi_SetAESKeysForAccessControl(FALSE, rh); + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); + FS_SetMountInfoForSrl(); + OS_BootFromFIRM(); + +end: + SetDebugLED( (u8)(0xF0 | step)); + + MCUi_WriteRegister( MCU_REG_MODE_ADDR, MCU_SYSTEMMODE_NITRO ); + EraseAll(); + + // failed + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + OS_Terminate(); +} + diff --git a/build/nandfirm/memory-launcher/ARM9/Makefile b/build/nandfirm/memory-launcher/ARM9/Makefile new file mode 100644 index 00000000..393496fd --- /dev/null +++ b/build/nandfirm/memory-launcher/ARM9/Makefile @@ -0,0 +1,53 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - memory-launcher +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +LINCLUDES = + +#---------------------------------------------------------------------------- + +TARGET_BIN = memory_launcher9.srl + +SRCS = main.c font.c screen.c + +CRT0_O = crt0_firm.o + +MAKEROM_ARM7 = ../ARM7/bin/$(TWL_BUILDTYPE_ARM7)/memory_launcher7.tef +MAKEROM_ARM7_BASE = $(basename $(MAKEROM_ARM7)) + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +LINCLUDES = ./include + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/nandfirm/memory-launcher/ARM9/font.c b/build/nandfirm/memory-launcher/ARM9/font.c new file mode 100644 index 00000000..ee49f50b --- /dev/null +++ b/build/nandfirm/memory-launcher/ARM9/font.c @@ -0,0 +1,588 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: font.c + + Copyright 2003-2005 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: font.c,v $ + Revision 1.3 2005/02/28 05:26:11 yosizaki + do-indent. + + Revision 1.2 2004/11/02 07:19:52 terui + コメント内スペルミスを修正。 + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#include "font.h" + + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/nandfirm/memory-launcher/ARM9/include/font.h b/build/nandfirm/memory-launcher/ARM9/include/font.h new file mode 100644 index 00000000..30d49e95 --- /dev/null +++ b/build/nandfirm/memory-launcher/ARM9/include/font.h @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: font.h + + Copyright 2003-2005 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: font.h,v $ + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +typedef enum +{ + FONT_BLOCK = 0, + FONT_RED = 1, + FONT_GREEN = 2, + FONT_BLUE = 3, + FONT_YELLOW = 4, + FONT_PURPLE = 5, + FONT_CYAAN = 6, + FONT_WHITE = 15 +} +MYFontColor; + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/nandfirm/memory-launcher/ARM9/include/screen.h b/build/nandfirm/memory-launcher/ARM9/include/screen.h new file mode 100644 index 00000000..81ed6790 --- /dev/null +++ b/build/nandfirm/memory-launcher/ARM9/include/screen.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: screen.h + + Copyright 2003-2006 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: screen.h,v $ + Revision 1.3 2006/01/18 02:12:28 kitase_hirotake + do-indent + + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern u16 gScreen[32 * 32]; + +void ClearScreen(void); +void PrintString(s16 x, s16 y, u8 palette, char *text, ...); +void ColorString(s16 x, s16 y, s16 length, u8 palette); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/nandfirm/memory-launcher/ARM9/main.c b/build/nandfirm/memory-launcher/ARM9/main.c new file mode 100644 index 00000000..ce4c389b --- /dev/null +++ b/build/nandfirm/memory-launcher/ARM9/main.c @@ -0,0 +1,500 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - nandfirm - sdmc-launcher + File: main.c + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Date:: $ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#include +#include "font.h" +#include "screen.h" + +#ifdef FIRM_USE_PRODUCT_KEYS +static const u8* const rsa_key_user = NULL; // not acceptable +static const u8* const rsa_key_sys = NULL; // not acceptable +static const u8 rsa_key_secure[128] = +{ + 0xC7, 0x94, 0x50, 0x00, 0x3A, 0xE1, 0x0E, 0x6C, 0xA8, 0xD1, 0xC0, 0x2D, 0x77, 0xB7, 0x6D, 0xBC, + 0x31, 0xDB, 0x12, 0x08, 0x09, 0x0D, 0x2A, 0xE8, 0xC9, 0x1A, 0x2B, 0x6E, 0x6C, 0x85, 0x78, 0xD7, + 0x46, 0x50, 0x05, 0xB5, 0xCC, 0x3B, 0xEC, 0xBA, 0xF4, 0xDE, 0xC2, 0x13, 0x13, 0xBE, 0x67, 0xEE, + 0x85, 0x19, 0xEB, 0x62, 0xB3, 0x5C, 0x09, 0xA8, 0x54, 0x44, 0x26, 0x85, 0x25, 0xEA, 0xE5, 0x85, + 0xD1, 0xB5, 0xCE, 0xA0, 0xFF, 0x6B, 0x61, 0xCA, 0x94, 0xC1, 0x67, 0xBE, 0xC0, 0x7E, 0x3B, 0xFF, + 0x12, 0x9B, 0x79, 0xDB, 0xAC, 0xD3, 0x5A, 0x3F, 0x14, 0x37, 0x49, 0xA8, 0x7C, 0x2F, 0x07, 0xF4, + 0x8B, 0xA9, 0x8B, 0x8D, 0xB2, 0x60, 0xA5, 0xD5, 0x64, 0xEE, 0xCF, 0x3F, 0x32, 0xEE, 0x77, 0xAC, + 0x27, 0x75, 0x2B, 0x04, 0xD7, 0x26, 0xA8, 0x8A, 0x55, 0x2A, 0x76, 0xE5, 0x68, 0x80, 0x57, 0x85 +}; +#else +#if 0 +static const u8 rsa_key_user[128] = +{ + 0xAC, 0x93, 0xBB, + 0x3C, 0x15, 0x5C, 0x5F, 0x25, 0xB0, 0x4C, 0x37, 0xA4, 0x2D, 0x85, 0x29, 0x1D, 0x7A, 0x9D, 0x2D, + 0xD5, 0x79, 0xB5, 0x5D, 0xB1, 0x08, 0x20, 0x9C, 0xF0, 0x4C, 0x56, 0x27, 0x97, 0xF8, 0x7E, 0x3E, + 0xCB, 0x94, 0x06, 0x05, 0x94, 0x00, 0x92, 0x9B, 0xB0, 0x5B, 0x06, 0xF6, 0xAF, 0xAA, 0x9C, 0xA5, + 0xF0, 0x11, 0xA7, 0x8A, 0xCB, 0x0C, 0x11, 0xD6, 0x0C, 0x3D, 0x30, 0xAC, 0x51, 0x79, 0x5A, 0xB5, + 0x7F, 0x11, 0x92, 0x74, 0x48, 0x82, 0x81, 0xBF, 0x3B, 0xFA, 0x93, 0xBF, 0x6B, 0x5B, 0x3F, 0x86, + 0x96, 0x4F, 0xCC, 0x90, 0x12, 0xB2, 0x39, 0x8D, 0x68, 0x16, 0x7B, 0xC6, 0x87, 0xF1, 0xF5, 0x60, + 0x62, 0x39, 0xFB, 0x10, 0x7E, 0x48, 0x7F, 0xDD, 0x82, 0x38, 0x38, 0x76, 0xB5, 0xCE, 0x21, 0x4B, + 0xC9, 0x6F, 0x31, 0x8D, 0x23, 0x57, 0x3D, 0xB6, 0x6C, 0xEE, 0xC2, 0x0D, 0x11 +}; +#else +static const u8* const rsa_key_user = NULL; // not acceptable +#endif +static const u8 rsa_key_sys[128] = +{ + 0xe9, 0x9e, 0xa7, 0x9f, 0x59, 0x4d, 0xf4, 0xa7, 0x60, 0x04, 0xbd, 0x47, 0xf2, 0xb3, 0x64, 0xcd, + 0x16, 0x79, 0xc1, 0x47, 0x39, 0xf6, 0xa9, 0xf8, 0xee, 0x1a, 0xd0, 0x72, 0xcf, 0x43, 0x97, 0x0c, + 0x93, 0xa1, 0x38, 0x4e, 0x13, 0x40, 0x6c, 0x10, 0x59, 0x43, 0xe2, 0x71, 0x29, 0x54, 0x14, 0x2c, + 0xc5, 0xda, 0x59, 0x4d, 0xb4, 0x6a, 0xef, 0x85, 0x61, 0x6f, 0x7f, 0x1c, 0x59, 0x34, 0x2c, 0xc6, + 0x24, 0xf3, 0x7b, 0xc3, 0xb7, 0x40, 0xd1, 0x46, 0xf8, 0x90, 0xb7, 0xc2, 0x98, 0x50, 0xaf, 0x95, + 0x52, 0x42, 0xdb, 0xac, 0xd6, 0x7e, 0xa9, 0xc3, 0x3d, 0x1b, 0x51, 0x56, 0x07, 0x06, 0xd0, 0x0b, + 0x01, 0xbb, 0x58, 0x93, 0xea, 0xa0, 0x2c, 0xc7, 0x7d, 0x6a, 0x31, 0x7e, 0xc9, 0xe2, 0xda, 0xfe, + 0x1f, 0x2e, 0x9d, 0xa7, 0x54, 0x84, 0xdc, 0x28, 0xb9, 0x18, 0xea, 0x16, 0xf2, 0x95, 0x55, 0x6d, +}; +static const u8 rsa_key_secure[128] = +{ + 0xa7, 0x9f, 0x54, 0xa0, 0xc7, 0x45, 0xae, 0xf6, 0x63, 0xa7, 0x53, 0xb7, 0x0a, 0xcc, 0x0b, 0xcb, + 0x65, 0xe1, 0x11, 0xc6, 0x05, 0x15, 0xb5, 0x6e, 0xbd, 0xac, 0x0c, 0xca, 0xf4, 0x7c, 0x68, 0x7a, + 0xf9, 0x0e, 0x5d, 0x98, 0x5b, 0xc8, 0x4d, 0x22, 0x3b, 0xa3, 0xbe, 0x8b, 0x5b, 0x7f, 0x26, 0x44, + 0x9f, 0xc4, 0x48, 0x44, 0xb1, 0x32, 0xb7, 0xbe, 0x63, 0xba, 0xd6, 0xc1, 0x10, 0xce, 0xf6, 0xed, + 0x47, 0x8f, 0xe1, 0xff, 0x7f, 0x5a, 0xd5, 0x5d, 0x94, 0x38, 0x2f, 0xa1, 0xd4, 0xef, 0x82, 0xb1, + 0x0d, 0xc4, 0x43, 0xec, 0xbe, 0x77, 0xb6, 0x82, 0x9c, 0xfa, 0x17, 0x87, 0x84, 0x82, 0x25, 0x46, + 0xfb, 0xd6, 0x05, 0xc8, 0x9a, 0x7e, 0xad, 0x44, 0x40, 0x0d, 0x35, 0x9c, 0x45, 0x44, 0x64, 0x36, + 0x61, 0x4b, 0xf7, 0xe6, 0x31, 0x5c, 0x7d, 0x96, 0x73, 0xe8, 0xac, 0xb4, 0xe3, 0x5e, 0xd1, 0x9d, +}; +#endif + +static SVCSignHeapContext acPool; + +static const u8 defaultKey[ SVC_SHA1_BLOCK_SIZE ] = +{ + 0x21, 0x06, 0xc0, 0xde, + 0xba, 0x98, 0xce, 0x3f, + 0xa6, 0x92, 0xe3, 0x9d, + 0x46, 0xf2, 0xed, 0x01, + + 0x76, 0xe3, 0xcc, 0x08, + 0x56, 0x23, 0x63, 0xfa, + 0xca, 0xd4, 0xec, 0xdf, + 0x9a, 0x62, 0x78, 0x34, + + 0x8f, 0x6d, 0x63, 0x3c, + 0xfe, 0x22, 0xca, 0x92, + 0x20, 0x88, 0x97, 0x23, + 0xd2, 0xcf, 0xae, 0xc2, + + 0x32, 0x67, 0x8d, 0xfe, + 0xca, 0x83, 0x64, 0x98, + 0xac, 0xfd, 0x3e, 0x37, + 0x87, 0x46, 0x58, 0x24, +}; + + +/* + PRINT_MEMORY_ADDR を定義すると、そのアドレスからSPrintfを行います(このファイルのみ) + FINALROM版でもコードが残るので注意してください。 +*/ +//#define PRINT_MEMORY_ADDR 0x02FFC000 + +#ifdef PRINT_MEMORY_ADDR +static char* debugPtr = (char*)PRINT_MEMORY_ADDR; +#undef OS_TPrintf +//#define OS_TPrintf(...) (debugPtr = (char*)((u32)(debugPtr + STD_TSPrintf(debugPtr, __VA_ARGS__) + 0xf) & ~0xf)) +#define OS_TPrintf(...) (debugPtr += STD_TSPrintf(debugPtr, __VA_ARGS__)) +#endif + +static ROM_Header* const rh= (ROM_Header*)HW_TWL_ROM_HEADER_BUF; + +/*************************************************************** + PreInit + + FromBootの対応&OS_Init前に必要なメインメモリの初期化 +***************************************************************/ +static void PreInit(void) +{ + /* + メインメモリ関連 + */ + // SHARED領域クリア + MI_CpuClearFast((void *)HW_WRAM_EX_LOCK_BUF, (HW_WRAM_EX_LOCK_BUF_END - HW_WRAM_EX_LOCK_BUF)); + MI_CpuClearFast((void *)HW_BIOS_EXCP_STACK_MAIN, (HW_REAL_TIME_CLOCK_BUF - HW_BIOS_EXCP_STACK_MAIN)); + MI_CpuClearFast((void *)HW_PXI_SIGNAL_PARAM_ARM9, (HW_MMEMCHECKER_MAIN - HW_PXI_SIGNAL_PARAM_ARM9)); +// MI_CpuClearFast((void*)HW_ROM_HEADER_BUF, (HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF)); + + /* + FromBrom関連 + */ + if ( !OSi_FromBromToMenu() ) + { + OS_Terminate(); + } + + // ブートタイプの変更 + ( (OSBootInfo *)OS_GetBootInfo() )->boot_type = OS_BOOTTYPE_NAND; +} + +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + // アリーナ設定 + { + static u32 arena[ 0x400 / sizeof(u32) ]; + OS_SetMainArenaLo( arena ); + OS_SetMainArenaHi( &arena[ 0x400 / sizeof(u32) ] ); + } + // RSA用ヒープ設定 + SVC_InitSignHeap( &acPool, (void*)HW_FIRM_RSA_BUF, HW_FIRM_RSA_BUF_SIZE ); +} + +/*************************************************************** + CheckHeader + + ヘッダがシステムメニューとして問題ないかチェック +***************************************************************/ +static BOOL CheckHeader(void) +{ + ROM_Header_Short* const rhs = (ROM_Header_Short*)HW_TWL_ROM_HEADER_BUF; + // イニシャルコードなど + OS_TPrintf("Initial Code : %08X (%.4s)\n", *(u32*)rhs->game_code, rhs->game_code); + OS_TPrintf("Platform Code : %02X\n", rhs->platform_code); + OS_TPrintf("Codec Mode : %s\n", rhs->exFlags.codec_mode ? "TWL" : "NITRO"); + OS_TPrintf("Sigunature : %s\n", rhs->enable_signature ? "AVAILABLE" : "NOT AVAILABLE"); + OS_TPrintf("AES Encryption : %s\n", rhs->enable_aes ? "AVAILABLE" : "NOT AVAILABLE"); + if ( rhs->enable_aes ) + { + OS_TPrintf("AES Key Type : %s\n", ( rhs->developer_encrypt_old || rhs->exFlags.developer_encrypt ) ? "FOR DEVELOPMENT" : "FOR PRODUCT"); + } + // エントリポイント + OS_TPrintf("ARM9 Entry point : %08X\n", rhs->main_entry_address); + OS_TPrintf("ARM7 Entry point : %08X\n", rhs->sub_entry_address); + // ロード範囲 + OS_TPrintf("ARM9 ROM address : %08X\n", rhs->main_rom_offset); + OS_TPrintf("ARM9 RAM address : %08X\n", rhs->main_ram_address); + OS_TPrintf("ARM9 size : %08X\n", rhs->main_size); + OS_TPrintf("ARM7 ROM address : %08X\n", rhs->sub_rom_offset); + OS_TPrintf("ARM7 RAM address : %08X\n", rhs->sub_ram_address); + OS_TPrintf("ARM7 size : %08X\n", rhs->sub_size); + OS_TPrintf("ARM9 LTD ROM address: %08X\n", rhs->main_ltd_rom_offset); + OS_TPrintf("ARM9 LTD RAM address: %08X\n", rhs->main_ltd_ram_address); + OS_TPrintf("ARM9 LTD size : %08X\n", rhs->main_ltd_size); + OS_TPrintf("ARM7 LTD ROM address: %08X\n", rhs->sub_ltd_rom_offset); + OS_TPrintf("ARM7 LTD RAM address: %08X\n", rhs->sub_ltd_ram_address); + OS_TPrintf("ARM7 LTD size : %08X\n", rhs->sub_ltd_size); + // 順序ほぼ最適化済み +#ifdef FIRM_USE_PRODUCT_KEYS + if ( rhs->platform_code != PLATFORM_CODE_TWL_LIMITED || // TWL Limited only + !rhs->enable_signature || // Should be use ROM header signature +#else + if ( // no check +#endif + !rhs->exFlags.codec_mode || // TWL mode only + // should be in main memory + HW_TWL_MAIN_MEM > (u32)rhs->main_ram_address || + HW_TWL_MAIN_MEM > (u32)rhs->sub_ram_address || + HW_TWL_MAIN_MEM > (u32)rhs->main_ltd_ram_address || + HW_TWL_MAIN_MEM > (u32)rhs->sub_ltd_ram_address || + // should be in static area without Limited region + (u32)rhs->main_ram_address > (u32)rhs->main_entry_address || + (u32)rhs->sub_ram_address > (u32)rhs->sub_entry_address || + // should be in main memory (end address) + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->main_ram_address + rhs->main_size || + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->sub_ram_address + rhs->sub_size || + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->main_ltd_ram_address + rhs->main_ltd_size || + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->sub_ltd_ram_address + rhs->sub_ltd_size || + // should be in static area without Limited region (end address) + (u32)rhs->main_ram_address + rhs->main_size <= (u32)rhs->main_entry_address || + (u32)rhs->sub_ram_address + rhs->sub_size <= (u32)rhs->sub_entry_address || + 0 ) + { + OS_TPrintf("Invalid ROM header for SDMC Launcher!\n"); + return FALSE; + } + return TRUE; +} + +/*************************************************************** + EraseAll + + 不正終了しました + いろいろ消してください + DSモードにして終わるのがよいか? +***************************************************************/ +static void EraseAll(void) +{ + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); +#ifdef SDK_FINALROM + MI_CpuClearFast( (void*)HW_TWL_ROM_HEADER_BUF, HW_TWL_ROM_HEADER_BUF_SIZE ); + MI_CpuClearFast( (void*)HW_ROM_HEADER_BUF, HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF ); + OS_BootFromFIRM(); +#endif +} + +static inline BOOL CheckDigest( u8* a, u8* b, BOOL aClr, BOOL bClr ) +{ + BOOL result = TRUE; + int i; + for ( i = 0; i < SVC_SHA1_DIGEST_SIZE; i++ ) + { + if ( a[i] != b[i] ) + { + result = FALSE; + } + } + if ( aClr ) MI_CpuClear8(a, SVC_SHA1_DIGEST_SIZE); + if ( bClr ) MI_CpuClear8(b, SVC_SHA1_DIGEST_SIZE); + return result; +} + +static void myInit(void); +static void myVBlankIntr(void); + +void TwlMain( void ) +{ +#define X_OFF 2 + s16 y = 2; + + PreInit(); + myInit(); + PostInit(); + + //---- clear screen buffer + ClearScreen(); + PrintString( X_OFF, y, FONT_CYAAN, "Mem Launcher (N)" ); + PrintString( X_OFF+18, y++, FONT_YELLOW, "%s", __DATE__ ); + PrintString( X_OFF+21, y++, FONT_YELLOW, "%s", __TIME__ ); + OS_WaitVBlankIntr(); + y++; + + PrintString( X_OFF, y++, FONT_WHITE, "Initialized." ); + y++; + + PrintString( X_OFF, y++, FONT_WHITE, "Checking header..." ); + OS_WaitVBlankIntr(); + + /* + ヘッダチェック (再配置付き) + */ + MI_CpuCopyFast( (void*)HW_TWL_MAIN_MEM, rh, HW_TWL_ROM_HEADER_BUF_SIZE ); + DC_StoreRange( rh, HW_TWL_ROM_HEADER_BUF_SIZE ); + +#define HEADER_AUTH_SIZE 0xe00 + { + const void* rsa_key; + u8 md[SVC_SHA1_DIGEST_SIZE]; + SignatureData sd; + + // ハッシュ計算 + SVC_CalcSHA1( md, rh, HEADER_AUTH_SIZE ); + // 鍵の確定 + rsa_key = (rh->s.titleID_Hi & TITLE_ID_HI_SECURE_FLAG_MASK) + ? rsa_key_secure + : ( (rh->s.titleID_Hi & TITLE_ID_HI_APP_TYPE_MASK) ? rsa_key_sys : rsa_key_user ); + // 署名の復号化 + SVC_DecryptSign( &acPool, &sd, rh->signature, rsa_key ); + if ( !CheckDigest( md, sd.digest, TRUE, FALSE ) ) + { + MI_CpuClear8( &sd, sizeof(sd) ); // 残り削除 (他に必要なものはない?) + OS_TPrintf("Failed to call FS_LoadHeader().\n"); + goto end; + } + MI_CpuClear8( &sd, sizeof(sd) ); // 残り削除 (他に必要なものはない?) + // ROMヘッダのコピー + MI_CpuCopyFast( rh, (void*)HW_ROM_HEADER_BUF, HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF ); + } + if ( !CheckHeader() ) + { + OS_TPrintf("Failed to call CheckHeader().\n"); + goto end; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + DC_FlushAll(); + // 8: after to load header + PXI_NotifyID( FIRM_PXI_ID_DONE_HEADER ); + + /* + Static再配置待ち + */ + PrintString( X_OFF, y++, FONT_WHITE, "Replacing static data..." ); + OS_WaitVBlankIntr(); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + OS_TPrintf("Failed to decrypt static data.\n"); + goto end; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + + // 7: after PXI + PrintString( X_OFF, y++, FONT_WHITE, "Checking static data..." ); + OS_WaitVBlankIntr(); + /* + Staticチェック + */ + { + u8 md[SVC_SHA1_DIGEST_SIZE]; + if ( rh->s.main_size > 0 ) + { + SVC_CalcHMACSHA1( md, rh->s.main_ram_address, rh->s.main_size, defaultKey, SVC_SHA1_BLOCK_SIZE ); + if ( !CheckDigest( md, rh->s.main_static_digest, TRUE, FALSE ) ) + { + OS_TPrintf("Failed to check main_static_digest.\n"); + goto end; + } + } + if ( rh->s.sub_size > 0 ) + { + SVC_CalcHMACSHA1( md, rh->s.sub_ram_address, rh->s.sub_size, defaultKey, SVC_SHA1_BLOCK_SIZE ); + if ( !CheckDigest( md, rh->s.sub_static_digest, TRUE, FALSE ) ) + { + OS_TPrintf("Failed to check sub_static_digest.\n"); + goto end; + } + } + if ( rh->s.main_ltd_size > 0 ) + { + SVC_CalcHMACSHA1( md, rh->s.main_ltd_ram_address, rh->s.main_ltd_size, defaultKey, SVC_SHA1_BLOCK_SIZE ); + if ( !CheckDigest( md, rh->s.main_ltd_static_digest, TRUE, FALSE ) ) + { + OS_TPrintf("Failed to check main_ltd_static_digest.\n"); + goto end; + } + } + if ( rh->s.sub_ltd_size > 0 ) + { + SVC_CalcHMACSHA1( md, rh->s.sub_ltd_ram_address, rh->s.sub_ltd_size, defaultKey, SVC_SHA1_BLOCK_SIZE ); + if ( !CheckDigest( md, rh->s.sub_ltd_static_digest, TRUE, FALSE ) ) + { + OS_TPrintf("Failed to check sub_ltd_static_digest.\n"); + goto end; + } + } + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + // 8: after FS_LoadStatic + PXI_NotifyID( FIRM_PXI_ID_DONE_STATIC ); + // 9: after PXI + OS_WaitVBlankIntr(); + + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); + PrintString( X_OFF, y++, FONT_WHITE, "Booting..." ); + OS_WaitVBlankIntr(); + OS_BootFromFIRM(); + +end: + PrintString( X_OFF+20, y, FONT_RED, "Failed." ); + OS_WaitVBlankIntr(); + EraseAll(); + + // failed + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + OS_Terminate(); +} + + +//---------------------------------------------------------------- +// myInit +// +void myInit(void) +{ + //---- init + OS_InitFIRM(); + OS_InitTick(); + OS_InitAlarm(); + FX_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + //---- init displaying + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- setting 2D for top screen + GX_SetBankForBG(GX_VRAM_BG_128_A); + + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + G2_BG0Mosaic(FALSE); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + //---- setting 2D for bottom screen + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + G2S_BG0Mosaic(FALSE); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + //---- screen + MI_CpuFillFast((void *)gScreen, 0, sizeof(gScreen)); + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + //---- backdrop + *(u16*)HW_PLTT = GX_RGB(8,0,0); + *(u16*)HW_DB_PLTT = GX_RGB(8,0,0); + + //---- init interrupt + OS_SetIrqFunction(OS_IE_V_BLANK, myVBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + //---- start displaying + GX_DispOn(); + GXS_DispOn(); +} + +//---------------------------------------------------------------- +// myVBlankIntr +// vblank interrupt handler +// +static void myVBlankIntr(void) +{ + //---- upload pseudo screen to VRAM + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} diff --git a/build/nandfirm/memory-launcher/ARM9/screen.c b/build/nandfirm/memory-launcher/ARM9/screen.c new file mode 100644 index 00000000..8e20145a --- /dev/null +++ b/build/nandfirm/memory-launcher/ARM9/screen.c @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: screen.c + + Copyright 2003-2006 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: screen.c,v $ + Revision 1.3 2006/01/18 02:12:28 kitase_hirotake + do-indent + + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include "screen.h" + +u16 gScreen[32 * 32]; +//u16 gScreen2[ 32 * 32 ]; + +// ** these code are refer to rtc sample. thanks. +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: clear screen buffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast((void *)gScreen, sizeof(gScreen)); +} + +/*---------------------------------------------------------------------------* + Name: PrintString + + Description: enter string into screen buffer + string must be within 32 chars + + Arguments: x : x + y : y + palette : color (0-15) + text : string. end mark is NULL + + Returns: None. + *---------------------------------------------------------------------------*/ +void PrintString(s16 x, s16 y, u8 palette, char *text, ...) +{ + va_list vlist; + char temp[32 + 2], *tempPtr; + s32 i; + u16 *p, *pLimit; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0; + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + tempPtr = &temp[0]; + + for (i = 0; *tempPtr; i++, tempPtr++) + { + *p = (u16)((palette << 12) | *tempPtr); + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} + +/*---------------------------------------------------------------------------* + Name: ColorString + + Description: change string color which is put in screen buffer + + Arguments: x : x + y : y + length : number of characters to change color + palette : color (0-15) + + Returns: None. + *---------------------------------------------------------------------------*/ +void ColorString(s16 x, s16 y, s16 length, u8 palette) +{ + s32 i; + u16 *p, *pLimit; + + if (length < 0) + return; + + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + + for (i = 0; i < length; i++) + { + u16 temp = *p; + temp &= 0x0fff; + temp |= (palette << 12); + *p = temp; + + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} diff --git a/build/nandfirm/memory-launcher/Makefile b/build/nandfirm/memory-launcher/Makefile new file mode 100644 index 00000000..aefebc5c --- /dev/null +++ b/build/nandfirm/memory-launcher/Makefile @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - nandfirm - memory-launcher +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + wram_regs \ + ARM7 \ + ARM9 \ + +TARGET_FIRM_BIN = memory_launcher-$(TWL_BUILD_TYPE)$(CODEGEN_ARCH).nand +BINDIR = . +MAKEFIRM_ARM9 = ARM9/bin/$(TWL_BUILDTYPE_ARM9)/memory_launcher9.tef +MAKEFIRM_ARM7 = ARM7/bin/$(TWL_BUILDTYPE_ARM7)/memory_launcher7.tef +MAKEFIRM_RSA_PRVKEY = $(TWL_KEYSDIR)/rsa/private_nand.der +LDEPENDS_BIN += wram_regs/wram_regs.rbin + +#MAKEFIRM_FLAGS += -p +FIRM_SPEC = nandfirm.nandsf + +LDIRT_CLEAN += $(wildcard *.nand) \ + rsa_public.sbin \ + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGET_BIN) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/nandfirm/memory-launcher/nandfirm.nandsf b/build/nandfirm/memory-launcher/nandfirm.nandsf new file mode 100644 index 00000000..0cb73cd2 --- /dev/null +++ b/build/nandfirm/memory-launcher/nandfirm.nandsf @@ -0,0 +1,24 @@ +#NANDSF --- Nandfirm Spec File + +VERSION : 0xffff570000000000 # GENERATE + +RSA_KEY : $(MAKEFIRM_RSA_PRVKEY) +OUT_KEY : rsa_public.sbin + +WRAM_RBIN: ./wram_regs/wram_regs.rbin + +MIRROR_OFS: 0x80000 + +DECOMP_PROC : ARM9 # ARM9 or ARM7 + +ARM9_COMP : FALSE # TRUE or FALSE, should be before ARM9_SBIN +ARM9_SBIN : $(MAKEFIRM_ARM9).TWL.FLX.sbin +ARM9_ELF : $(MAKEFIRM_ARM9).tef + +ARM7_COMP : FALSE # TRUE or FALSE, should be before ARM7_SBIN +ARM7_SBIN : $(MAKEFIRM_ARM7).TWL.FLX.sbin +ARM7_ELF : $(MAKEFIRM_ARM7).tef + +ARM9_X2 : TRUE # TRUE or FALSE + +NCD_ROMOFS : 0x01fe00 diff --git a/build/nandfirm/memory-launcher/readme.txt b/build/nandfirm/memory-launcher/readme.txt new file mode 100644 index 00000000..b1b1973e --- /dev/null +++ b/build/nandfirm/memory-launcher/readme.txt @@ -0,0 +1,5 @@ +注意事項 + +起動するアプリがromアーカイブを使用する場合、 +NAライブラリをリンクしておく必要があります。 +(単純にリンクするライブラリに追加するだけです) diff --git a/build/nandfirm/memory-launcher/wram_regs/Makefile b/build/nandfirm/memory-launcher/wram_regs/Makefile new file mode 100644 index 00000000..8de72ccf --- /dev/null +++ b/build/nandfirm/memory-launcher/wram_regs/Makefile @@ -0,0 +1,57 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - sdmc-launcher +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL +override TARGET_CODEGEN := ARM +override TWL_ARCHGEN := LIMITED + +override TARGET_FINALROM := TRUE +override TARGET_RELEASE := +override TARGET_DEBUG := + +SUBDIRS = + +LINCLUDES = + + +#---------------------------------------------------------------------------- + +TARGET_BIN = wram_regs.rbin + +SRCS = \ + wram_regs.c \ + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_DIR = . +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/nandfirm/memory-launcher/wram_regs/wram_regs.c b/build/nandfirm/memory-launcher/wram_regs/wram_regs.c new file mode 100644 index 00000000..7e727571 --- /dev/null +++ b/build/nandfirm/memory-launcher/wram_regs/wram_regs.c @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - nandfirm + File: wram_regs.c + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Date:: $ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#include +#include + +MIHeader_WramRegs wram_regs_init = +{ + // ARM9 + { + REG_MI_MBK_A0_FIELD( 1, MI_WRAM_A_OFFSET_0KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A1_FIELD( 1, MI_WRAM_A_OFFSET_64KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A2_FIELD( 1, MI_WRAM_A_OFFSET_128KB, MI_WRAM_ARM9 ), + REG_MI_MBK_A3_FIELD( 1, MI_WRAM_A_OFFSET_192KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_B0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), +// REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_C0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + }, + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, HW_WRAM_AREA_HALF ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ) + ), +/* + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), +*/ + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ), // joint to WRAM-A + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, MI_WRAM_MAP_NULL ) + ), + + // ARM7 + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE - HW_WRAM_C_SIZE ) + ), + + // WRAM Lock + { + 0, + 0, + 0, + }, + + // WRAM-0/1 + 3, + + // VRAM-C + 7, + // VRAM-D + 7, +}; +