From 6b8751037ea056377adf3809e8ebdf61dce12b38 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@b08762b0-b915-fc4b-9d8c-17b2551a87ff> Date: Wed, 27 Aug 2008 06:38:40 +0000 Subject: [PATCH] =?UTF-8?q?(=E6=9B=B4=E6=96=B0=EF=BC=9AAkabane=20Jumpei)?= =?UTF-8?q?=E6=B4=BB=E6=88=A6=E6=8C=BF=E6=8A=9C=E3=83=87=E3=83=90=E3=83=83?= =?UTF-8?q?=E3=82=B0=E7=94=A8=E3=83=97=E3=83=AD=E3=82=B0=E3=83=A9=E3=83=A0?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= 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@2285 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- build/tests/CheckCardAccess/Makefile | 32 + build/tests/CheckCardAccess/Makefile.game | 47 ++ build/tests/CheckCardAccess/Makefile.normal | 47 ++ build/tests/CheckCardAccess/Makefile.off | 47 ++ build/tests/CheckCardAccess/game_mode.rsf | 243 ++++++ build/tests/CheckCardAccess/normal_mode.rsf | 243 ++++++ .../tests/CheckCardAccess/slot_power_off.rsf | 243 ++++++ build/tests/CheckCardAccess/src/font.c | 579 +++++++++++++ build/tests/CheckCardAccess/src/font.h | 36 + build/tests/CheckCardAccess/src/hotswTypes.h | 134 +++ build/tests/CheckCardAccess/src/main.c | 768 ++++++++++++++++++ build/tests/CheckCardAccess/src/romSpec.h | 152 ++++ build/tests/CheckCardMode/Makefile | 37 + build/tests/CheckCardMode/src/font.c | 579 +++++++++++++ build/tests/CheckCardMode/src/font.h | 36 + build/tests/CheckCardMode/src/hotswTypes.h | 134 +++ build/tests/CheckCardMode/src/main.c | 535 ++++++++++++ build/tests/CheckCardMode/src/romSpec.h | 152 ++++ 18 files changed, 4044 insertions(+) create mode 100644 build/tests/CheckCardAccess/Makefile create mode 100644 build/tests/CheckCardAccess/Makefile.game create mode 100644 build/tests/CheckCardAccess/Makefile.normal create mode 100644 build/tests/CheckCardAccess/Makefile.off create mode 100644 build/tests/CheckCardAccess/game_mode.rsf create mode 100644 build/tests/CheckCardAccess/normal_mode.rsf create mode 100644 build/tests/CheckCardAccess/slot_power_off.rsf create mode 100644 build/tests/CheckCardAccess/src/font.c create mode 100644 build/tests/CheckCardAccess/src/font.h create mode 100644 build/tests/CheckCardAccess/src/hotswTypes.h create mode 100644 build/tests/CheckCardAccess/src/main.c create mode 100644 build/tests/CheckCardAccess/src/romSpec.h create mode 100644 build/tests/CheckCardMode/Makefile create mode 100644 build/tests/CheckCardMode/src/font.c create mode 100644 build/tests/CheckCardMode/src/font.h create mode 100644 build/tests/CheckCardMode/src/hotswTypes.h create mode 100644 build/tests/CheckCardMode/src/main.c create mode 100644 build/tests/CheckCardMode/src/romSpec.h diff --git a/build/tests/CheckCardAccess/Makefile b/build/tests/CheckCardAccess/Makefile new file mode 100644 index 00000000..a9bcdf87 --- /dev/null +++ b/build/tests/CheckCardAccess/Makefile @@ -0,0 +1,32 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CheckCardAccess +# 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 = +SUBMAKES = Makefile.off Makefile.normal Makefile.game + +include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/CheckCardAccess/Makefile.game b/build/tests/CheckCardAccess/Makefile.game new file mode 100644 index 00000000..336eafb1 --- /dev/null +++ b/build/tests/CheckCardAccess/Makefile.game @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CheckCardAccess +# File: Makefile.game +# +# 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$ +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +#---------------------------------------------------------------------------- +TARGET_PLATFORM := TWL + +TARGET_NAME = finalize_check_game +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TARGET_BIN = $(TARGET_NAME).tad + +SRCS = ./src/main.c ./src/font.c + +MACRO_FLAGS += -DMY_TARGET_NAME=\"$(basename $(TARGET_BIN))\" + +#------------------------- + +ROM_SPEC = game_mode.rsf + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +#---------------------------------------------------------------------------- + +.PHONY: build_time + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/CheckCardAccess/Makefile.normal b/build/tests/CheckCardAccess/Makefile.normal new file mode 100644 index 00000000..267b70f0 --- /dev/null +++ b/build/tests/CheckCardAccess/Makefile.normal @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CheckCardAccess +# File: Makefile.normal +# +# 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$ +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +#---------------------------------------------------------------------------- +TARGET_PLATFORM := TWL + +TARGET_NAME = finalize_check_normal +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TARGET_BIN = $(TARGET_NAME).tad + +SRCS = ./src/main.c ./src/font.c + +MACRO_FLAGS += -DMY_TARGET_NAME=\"$(basename $(TARGET_BIN))\" + +#------------------------- + +ROM_SPEC = normal_mode.rsf + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +#---------------------------------------------------------------------------- + +.PHONY: build_time + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/CheckCardAccess/Makefile.off b/build/tests/CheckCardAccess/Makefile.off new file mode 100644 index 00000000..4585c909 --- /dev/null +++ b/build/tests/CheckCardAccess/Makefile.off @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CheckCardAccess +# File: Makefile.off +# +# 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$ +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +#---------------------------------------------------------------------------- +TARGET_PLATFORM := TWL + +TARGET_NAME = finalize_check_slotpoweroff +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TARGET_BIN = $(TARGET_NAME).tad + +SRCS = ./src/main.c ./src/font.c + +MACRO_FLAGS += -DMY_TARGET_NAME=\"$(basename $(TARGET_BIN))\" + +#------------------------- + +ROM_SPEC = slot_power_off.rsf + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +#---------------------------------------------------------------------------- + +.PHONY: build_time + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/CheckCardAccess/game_mode.rsf b/build/tests/CheckCardAccess/game_mode.rsf new file mode 100644 index 00000000..f8d2dba8 --- /dev/null +++ b/build/tests/CheckCardAccess/game_mode.rsf @@ -0,0 +1,243 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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 ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "MY APP NAME" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + # RomHeaderTemplate ../rh/0C5A/rom_header_0c5a.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + # BannerFile "banner_LTD/banner.bnr" + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode 4CDA + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + GameCardNitroMode TRUE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/tests/CheckCardAccess/normal_mode.rsf b/build/tests/CheckCardAccess/normal_mode.rsf new file mode 100644 index 00000000..888fbd4d --- /dev/null +++ b/build/tests/CheckCardAccess/normal_mode.rsf @@ -0,0 +1,243 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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 ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "MY APP NAME" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + # RomHeaderTemplate ../rh/0C4A/rom_header_0c4a.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + # BannerFile "banner_LTD/banner.bnr" + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode 4CDA + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + GameCardOn TRUE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/tests/CheckCardAccess/slot_power_off.rsf b/build/tests/CheckCardAccess/slot_power_off.rsf new file mode 100644 index 00000000..b0013f6f --- /dev/null +++ b/build/tests/CheckCardAccess/slot_power_off.rsf @@ -0,0 +1,243 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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 ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "MY APP NAME" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + # RomHeaderTemplate ../rh/0C3A/rom_header_0c3a.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + # BannerFile "banner_LTD/banner.bnr" + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode 4CDA + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/tests/CheckCardAccess/src/font.c b/build/tests/CheckCardAccess/src/font.c new file mode 100644 index 00000000..9500697a --- /dev/null +++ b/build/tests/CheckCardAccess/src/font.c @@ -0,0 +1,579 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos.TWL - snd - extraFunc + File: font.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. + + $Date:: $ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#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/tests/CheckCardAccess/src/font.h b/build/tests/CheckCardAccess/src/font.h new file mode 100644 index 00000000..b4a94093 --- /dev/null +++ b/build/tests/CheckCardAccess/src/font.h @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos.TWL - snd - extraFunc + File: font.h + + 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$ + *---------------------------------------------------------------------------*/ + +#ifndef FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif +/*===========================================================================*/ + +#include + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // FONT_H_ diff --git a/build/tests/CheckCardAccess/src/hotswTypes.h b/build/tests/CheckCardAccess/src/hotswTypes.h new file mode 100644 index 00000000..02d0843e --- /dev/null +++ b/build/tests/CheckCardAccess/src/hotswTypes.h @@ -0,0 +1,134 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - HOTSW - include + File: type.h + + Copyright 2007-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. + *---------------------------------------------------------------------------*/ +#ifndef __HOTSW_TYPES_H__ +#define __HOTSW_TYPES_H__ + +#include +#include +#include "romSpec.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +static inline void HOTSW_WaitCardCtrl(void) +{ + while( reg_MI_MCCNT1_A & REG_MI_MCCNT1_START_MASK ){} +} + +// Define ------------------------------------------------------------------- +// --- Boot Segment +#define BOOT_SEGMENT_SIZE 0x1000 + +// --- Secure Segment +#define SECURE_SEGMENT_START 0x4000 +#define SECURE_SEGMENT_SIZE 0x4000 +#define SECURE_SEGMENT_END (SECURE_SEGMENT_START + SECURE_SEGMENT_SIZE) + +// --- TWL Card +#define TWLCARD_BORDER_OFFSET 0x80000 + +// --- Page / Segment (Byte) +#define PAGE_SIZE 0x200 +#define ONE_SEGMENT_SIZE 0x1000 + +// --- Page / Segment (Word) +#define PAGE_WORD_SIZE 0x80 +#define ONE_SEGMENT_WORD_SIZE 0x400 + +// --- Rom Emulation +#define ROM_EMULATION_DATA_SIZE 0x20 + +// --- Thread +#define HOTSW_THREAD_STACK_SIZE (1024 * 2) +#define HOTSW_DMA_MSG_NUM 8 +#define HOTSW_INSERT_MSG_NUM 16 +#define HOTSW_PULLED_MSG_NUM 16 +#define HOTSW_CTRL_MSG_NUM 8 +#define HOTSW_MSG_BUFFER_NUM (HOTSW_INSERT_MSG_NUM + HOTSW_PULLED_MSG_NUM + HOTSW_CTRL_MSG_NUM) +#define HOTSW_POLLING_CTRL_BUFFER_NUM 4 + +// --- Card Control Reg 0 +#define HOTSW_E2PROM_CTRL_MASK 0x00ff + +// --- Card Control Reg 1 +#define START_FLG_MASK 0x80000000 +#define READY_FLG_MASK 0x00800000 + +#define LATENCY1_SHIFT 0 +#define LATENCY1_MASK 0x00001fff + +#define DS_SHIFT 13 +#define DS_MASK 0x00002000 + +#define SE_SHIFT 14 +#define SE_MASK 0x00004000 + +#define SCR_SHIFT 15 +#define SCR_MASK 0x00008000 + +#define LATENCY2_SHIFT 16 +#define LATENCY2_MASK 0x003f0000 + +#define CS_SHIFT 22 +#define CS_MASK 0x00400000 + +#define RDY_SHIFT 23 +#define RDY_MASK 0x00800000 + +#define PC_SHIFT 24 +#define PC_MASK 0x07000000 + +#define CT_SHIFT 27 +#define CT_MASK 0x08000000 + +#define TRM_SHIFT 28 +#define TRM_MASK 0x10000000 + +#define RESB_SHIFT 29 +#define RESB_MASK 0x20000000 + +#define WR_SHIFT 30 +#define WR_MASK 0x40000000 + +#define START_SHIFT 31 +#define START_MASK 0x80000000 + +#define SCRAMBLE_MASK 0x1040e000 // スクランブル関係のフラグマスク +#define SECURE_COMMAND_SCRAMBLE_MASK 0x00406000 // CS SE DSのマスク + +// --- Page Count +#define PAGE_0 0x0UL << PC_SHIFT +#define PAGE_1 0x1UL << PC_SHIFT +#define PAGE_2 0x2UL << PC_SHIFT +#define PAGE_4 0x3UL << PC_SHIFT +#define PAGE_8 0x4UL << PC_SHIFT +#define PAGE_16 0x5UL << PC_SHIFT +#define PAGE_32 0x6UL << PC_SHIFT +#define PAGE_STAT 0x7UL << PC_SHIFT + + +// union --------------------------------------------------------------------- +typedef union +{ + u64 dw; + u8 b[8]; +} Cmd64; + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // __HOTSW_TYPES_H__ \ No newline at end of file diff --git a/build/tests/CheckCardAccess/src/main.c b/build/tests/CheckCardAccess/src/main.c new file mode 100644 index 00000000..a449884a --- /dev/null +++ b/build/tests/CheckCardAccess/src/main.c @@ -0,0 +1,768 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - CARD - hotswDebug + File: main_finalize.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. + *---------------------------------------------------------------------------*/ + +#include +#include +#include "DEMO.h" +#include "hotswTypes.h" +#include "font.h" + +#define SDK_MAKERCODE '10' +#define DIGEST_HASH_BLOCK_SIZE_SHA1 (512/8) + +#define MY_TEMP_BUFFER_SIZE 0x80000 +#define GAME_FIELD_START_ADDRESS 0x8000 + +#define ONE_SEGMENT_PAGE_NUM 8 + +#define READY_MASK 0x00800000 +#define CARD_COMMAND_MASK 0x07000000 + +#define MY_ROMHEADER_TWL ((ROM_Header_Short *)HW_TWL_CARD_ROM_HEADER_BUF) +#define MY_ROMHEADER_NTR ((ROM_Header_Short *)HW_CARD_ROM_HEADER) +#define MY_ROMHEADER_NAND ((ROM_Header_Short *)HW_TWL_ROM_HEADER_BUF) + +// --------------------------------------------------------------- +// HMACSHA1の鍵 +static u8 s_digestDefaultKey[ DIGEST_HASH_BLOCK_SIZE_SHA1 ] = { + 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 +}; + +static u32 rhBuf[BOOT_SEGMENT_SIZE/sizeof(u32)]; +static u32 checkBuf[MY_TEMP_BUFFER_SIZE/sizeof(u32)]; + +static u16 card_lock_id; +static BOOL error, flxhash, ltdhash, romheader; +static BOOL isTwlApplication; +static BOOL isTwlCard; +static ROM_Header_Short *rh; + +static u16 screen[32 * 32] ATTRIBUTE_ALIGN(HW_CACHE_LINE_SIZE); + +// --------------------------------------------------------------- +static void CheckMirrorImage(void); +static int CompRomHeaderForNTR(void* buf); +static void CheckRomHeader(void); +static BOOL CheckHashValue(void* buf, u32 size, void* digest); +static void MY_LoadCard_arm7Static(void); +static void MY_LoadCard_arm7LtdStatic(void); +static void CheckBackupDevice(void); +static void ShowResult(void); +static void debugMessage(void); + +static void ReadBootSegNormal(void* buf); +static void SetCommand(Cmd64 *cndLE); +static void ReadPageGame(u32 start_addr, void* buf, u32 size); +static void ReadCardData(void* dest, s32 offset, s32 length); + +static void VBlankIntr (void); +static void PrintString (s16 x, s16 y, u8 palette, char *text, ...); +static void VolumeSwitchCallback(SNDEXResult result, void* arg); + +/*---------------------------------------------------------------------------* + Name: NitroMain + + Description: メイン エントリポイント. + *---------------------------------------------------------------------------*/ +void NitroMain(void) +{ + CARDRomHeader *card_header = (void*)CARD_GetRomHeader(); + + OS_Init(); + OS_InitTick(); + CARD_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + if ( card_header->maker_code == SDK_MAKERCODE ) + { + CARD_Enable(TRUE); + } + + /* 表示設定初期化 */ + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + MI_CpuFillFast((void*)HW_OAM, GX_LCD_SIZE_Y, HW_OAM_SIZE); + MI_CpuClearFast((void*)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void*)HW_DB_OAM, GX_LCD_SIZE_Y, HW_DB_OAM_SIZE); + MI_CpuClearFast((void*)HW_DB_PLTT, HW_DB_PLTT_SIZE); + GX_SetBankForBG(GX_VRAM_BG_128_A); + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, // SCR ベースブロック 31 + GX_BG_CHARBASE_0x00000, // CHR ベースブロック 0 + GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + 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)); + MI_CpuClearFast((void*)screen, sizeof(screen)); + DC_FlushRange(screen, sizeof(screen)); + GX_LoadBG0Scr(screen, 0, sizeof(screen)); + + /* 割込み設定 */ + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + /* LCD 表示開始 */ + GX_DispOn(); + GXS_DispOn(); + + PrintString(0, 0, 0xc, "+++ Card Access Check +++"); + + // NANDアプリがHYBの場合 + if(MY_ROMHEADER_NAND->platform_code == 0x02){ + PrintString(0, 2, 0x5, ""); + } + else if(MY_ROMHEADER_NAND->platform_code == 0x03){ + PrintString(0, 2, 0x6, ""); + } + + // カードアプリタイプを判別。使うRom Header Buffer を切替える + if(MY_ROMHEADER_NTR->platform_code & PLATFORM_CODE_FLAG_TWL){ + PrintString(0, 5, 0xf, "- TWL Application -"); + isTwlApplication = TRUE; + rh = MY_ROMHEADER_TWL; + } + else{ + PrintString(0, 5, 0xf, "- NTR Application -"); + isTwlApplication = FALSE; + rh = MY_ROMHEADER_NTR; + } + + // カードタイプの判別 + isTwlCard = (*(vu32 *)(HW_BOOT_CHECK_INFO_BUF) & HOTSW_ROMID_TWLROM_MASK) ? TRUE : FALSE; + + // 注:rhの初期化が終わってから呼び出す +// debugMessage(); + + // フラグの初期化 + error = FALSE; + flxhash = TRUE; + ltdhash = TRUE; + romheader = TRUE; + + // ロックIDを取得しておく + card_lock_id = (u16)OS_GetLockID(); + + if(isTwlApplication){ + MY_LoadCard_arm7Static(); + MY_LoadCard_arm7LtdStatic(); + } + else{ + CheckMirrorImage(); + } + + CheckRomHeader(); + CheckBackupDevice(); + + ShowResult(); + + while(1){ +// DEMO_DrawFlip(); + OS_WaitVBlankIntr(); + } +} + + +/*---------------------------------------------------------------------------* + Name: CheckMirrorImage + + Description: + + Gameモード時 → Gameコマンド OK + Normalコマンド All 1 + + Normalモード時 → Gameコマンド All 1 + Normalコマンド OK + + SlotPowerOff時 → Gameコマンド All 0 + Normalコマンド All 0 + *---------------------------------------------------------------------------*/ +static void CheckMirrorImage(void) +{ + u32 buf1[PAGE_SIZE/sizeof(u32)]; + u32 buf2[PAGE_SIZE/sizeof(u32)]; + u32 buf_ff[PAGE_SIZE/sizeof(u32)]; + u32 buf_00[PAGE_SIZE/sizeof(u32)]; + + MI_CpuFill8( buf_ff, 0xff, sizeof(buf_ff) ); + MI_CpuFill8( buf_00, 0x0, sizeof(buf_00) ); + + CARD_LockRom(card_lock_id); + + // GameモードのコマンドでKey Table領域とGame領域読む + ReadCardData(buf1, (s32)0x1000, (s32)PAGE_SIZE); + ReadCardData(buf2, (s32)0x8000, (s32)PAGE_SIZE); + + CARD_UnlockRom(card_lock_id); + + // GameモードでKey Table領域からGame領域のイメージが読めてなかったら、不明なモード + if(MI_CpuComp8( buf1, buf2, PAGE_SIZE )){ + error = TRUE; + PrintString(0, 7, 0x1, "Unknown Mode"); + } + else{ + // 同じデータでも ALL 1(GameMode時) or ALL 0(SlotPowerOff時)ならちゃんと読めてないので、Normalモード + if(!MI_CpuComp8( buf_ff, buf2, PAGE_SIZE ) || !MI_CpuComp8( buf_00, buf2, PAGE_SIZE )){ + flxhash = FALSE; + ltdhash = FALSE; + PrintString(0, 7, 0x1, "Flx Area : Not Accessible"); + } + // Key Table領域読んで、Game領域のイメージが出てたらGameモード + else{ + flxhash = TRUE; + ltdhash = FALSE; + PrintString(0, 7, 0x8, "Flx Area : Accessible"); + } + } +} + + +/*---------------------------------------------------------------------------* + Name: CheckRomHeader + + Description: + *---------------------------------------------------------------------------*/ +static void CheckRomHeader(void) +{ + int result; + u8* pBuf = (u8 *)rhBuf; + u8* romHeader = (u8 *)rh; + + CARD_LockRom(card_lock_id); + + ReadBootSegNormal(pBuf); + + CARD_UnlockRom(card_lock_id); + + // 実際に読んだRom HeaderとIPLで読んだRom Headerを比較 + if(isTwlApplication){ + result = MI_CpuComp8( pBuf, romHeader, HW_TWL_CARD_ROM_HEADER_BUF_SIZE ); + } + else{ + result = CompRomHeaderForNTR(pBuf); + } + + // 結果 + if(result){ + romheader = FALSE; + PrintString(0, 11, 0x1, "Boot Segment : Not Accessible"); + } + else{ + romheader = TRUE; + PrintString(0, 11, 0x8, "Boot Segment : Accessible"); + } + +// DEMO_DrawFlip(); + OS_WaitVBlankIntr(); +} + + +static int CompRomHeaderForNTR(void* buf){ + u8* pBuf = (u8 *)buf; + u8* romHeader = (u8 *)rh; + u32 remainSize = HW_CARD_ROM_HEADER_SIZE; + + while(remainSize){ + // マスクRomコントロール情報が変わってるので、そこは飛ばす。 + if((HW_CARD_ROM_HEADER_SIZE - remainSize) == 0x60){ + pBuf += 4; + romHeader += 4; + remainSize -= 4; + } + if(*pBuf == *romHeader){ + remainSize--; + } + else{ +// OS_TPrintf("Error (adr:0x%08x)\n", HW_CARD_ROM_HEADER_SIZE - remainSize); +// OS_TPrintf("read : 0x%02x real : 0x%02x\n", *pBuf, *romHeader); + break; + } + pBuf++; + romHeader++; + } + + return (int)remainSize; +} + + +/*---------------------------------------------------------------------------* + Name: CheckHashValue + + Description: モジュールハッシュチェック + *---------------------------------------------------------------------------*/ +static BOOL CheckHashValue(void* buf, u32 size, void* digest) +{ + u8 sha1data[DIGEST_SIZE_SHA1]; + BOOL retval = TRUE; + + // クリア + MI_CpuClear8(sha1data, sizeof(sha1data)); + + // ARM7常駐モジュールのHash値照合 + SVC_CalcHMACSHA1( sha1data, + buf, + size, + s_digestDefaultKey, + sizeof(s_digestDefaultKey) ); + + return SVC_CompareSHA1( sha1data, digest ); +} + + +/*---------------------------------------------------------------------------* + Name: MY_LoadCard_arm7Static + + Description: ARM7常駐モジュール 読み出し・ハッシュチェック + *---------------------------------------------------------------------------*/ +static void MY_LoadCard_arm7Static(void) +{ + BOOL result; + u32* pBuf = checkBuf; + + CARD_LockRom(card_lock_id); + + ReadCardData(pBuf, (s32)rh->sub_rom_offset, (s32)rh->sub_size); + + CARD_UnlockRom(card_lock_id); + + result = CheckHashValue(checkBuf, rh->sub_size, (void *)rh->sub_static_digest); + + if(result){ + flxhash = TRUE; + PrintString(0, 7, 0x8, "Flx Area : Accessible"); + } + else{ + flxhash = FALSE; + PrintString(0, 7, 0x1, "Flx Area : Not Accessible"); + } + +// DEMO_DrawFlip(); + OS_WaitVBlankIntr(); +} + + +/*---------------------------------------------------------------------------* + Name: MY_LoadCard_arm7LtdStatic + + Description: ARM7拡張常駐モジュール 読み出し・ハッシュチェック + *---------------------------------------------------------------------------*/ +static void MY_LoadCard_arm7LtdStatic(void) +{ + BOOL result; + u32* pBuf = checkBuf; + + CARD_LockRom(card_lock_id); + + ReadCardData(pBuf, (s32)rh->sub_ltd_rom_offset, (s32)rh->sub_ltd_size); + + CARD_UnlockRom(card_lock_id); + + result = CheckHashValue(checkBuf, rh->sub_ltd_size, (void *)rh->sub_ltd_static_digest); + + if(result){ + ltdhash = TRUE; + PrintString(0, 9, 0x8, "Ltd Area : Accessible"); + } + else{ + ltdhash = FALSE; + PrintString(0, 9, 0x1, "Ltd Area : Not Accessible"); + } + +// DEMO_DrawFlip(); + OS_WaitVBlankIntr(); +} + + +/*---------------------------------------------------------------------------* + Name: CheckBackupDevice + + Description: Backup Device へのアクセスチェック + + 注:EEPROM 512 kbのサブ基盤と使って検査する + *---------------------------------------------------------------------------*/ +static void CheckBackupDevice(void) +{ + BOOL identify; + static CARDResult last_result = CARD_RESULT_SUCCESS; + + CARD_LockBackup(card_lock_id); + + identify = CARD_IdentifyBackup(CARD_BACKUP_TYPE_EEPROM_512KBITS); + if (!identify) + { + PrintString(0, 13, 0x1, "Backup Device Identify Error..."); + error = TRUE; + CARD_UnlockBackup(card_lock_id); + return; + } + + { + u32 pos = 0; + static u8 tmp_buf[65536]; + int i; + const u32 page_size = CARD_GetBackupPageSize(); + const u32 total_size = CARD_GetBackupTotalSize(); + + for (i = 0; i < page_size; ++i) + { + tmp_buf[i] = (u8)(pos * 3 + i); + } + + if (!CARD_IsBackupEeprom()){ + PrintString(0, 13, 0x1, "Please Use EEPROM..."); + error = TRUE; + return; + } + + PrintString(0, 13, 0xf, "Backup Device Check Start..."); +// DEMO_DrawFlip(); + + while(pos < total_size){ + CARD_WriteAndVerifyEepromAsync(pos, tmp_buf, page_size, NULL, NULL); + + (void)CARD_WaitBackupAsync(); + last_result = CARD_GetResultCode(); + + pos += page_size; + + if (last_result != CARD_RESULT_SUCCESS){ + break; + } + } + + if (last_result != CARD_RESULT_SUCCESS){ + PrintString(0, 14, 0x1, "Backup Device : Not Accessible"); + error = TRUE; + } + else{ + PrintString(0, 14, 0x8, "Backup Device : Accessible"); + } + } + + CARD_UnlockBackup(card_lock_id); + +// DEMO_DrawFlip(); + OS_WaitVBlankIntr(); +} + + +/*---------------------------------------------------------------------------* + Name: ReadBootSegNormal + + Description: ノーマルモードのBoot Segment読み込み + *---------------------------------------------------------------------------*/ +#define TIME_OUT 1000 + +static void ReadBootSegNormal(void* buf) +{ + u32 i, loop, pc, size, counter; + u64 page = 0; + Cmd64 cndLE; + BOOL isType1; + + OSTick start; + + isType1 = (*(vu32 *)(HW_BOOT_CHECK_INFO_BUF) & HOTSW_ROMID_1TROM_MASK) ? FALSE : TRUE; + + if(isType1){ + loop = 0x1UL; + pc = 0x4UL; + size = BOOT_SEGMENT_SIZE; + } + else{ + loop = ONE_SEGMENT_PAGE_NUM; + pc = 0x1UL; + size = PAGE_SIZE; + } + + counter = 0; + + HOTSW_WaitCardCtrl(); + + for(i=0; i TIME_OUT){ + return; + } + } + *((u32 *)buf + counter++) = reg_MI_MCD1_A; + } + + page++; + + OS_SpinWait( 100 ); + } +} + + +/*---------------------------------------------------------------------------* + Name: HOTSWi_SetCommand + + Description: 引数で与えられたコマンドのエンディアンを変えてレジスタにセットする + *---------------------------------------------------------------------------*/ +static void SetCommand(Cmd64 *cndLE) +{ + Cmd64 cndBE; + + // ビッグエンディアンに直す + cndBE.b[7] = cndLE->b[0]; + cndBE.b[6] = cndLE->b[1]; + cndBE.b[5] = cndLE->b[2]; + cndBE.b[4] = cndLE->b[3]; + cndBE.b[3] = cndLE->b[4]; + cndBE.b[2] = cndLE->b[5]; + cndBE.b[1] = cndLE->b[6]; + cndBE.b[0] = cndLE->b[7]; + + // MCCMD レジスタ設定 + reg_MI_MCCMD0_A = *(u32*)cndBE.b; + reg_MI_MCCMD1_A = *(u32*)&cndBE.b[4]; +} + + +/*---------------------------------------------------------------------------* + Name: ReadPageGame + + Description: ゲームモードで、指定されたページを指定バッファに指定サイズ分を読み込む + *---------------------------------------------------------------------------*/ +static void ReadPageGame(u32 start_addr, void* buf, u32 size) +{ + u32 loop, counter=0; + u64 i, page; + Cmd64 cndLE; + u32 rom_ctrl = *(vu32 *)(HW_CARD_ROM_HEADER + 0x60); + + OSTick start; + + rom_ctrl = rom_ctrl & ~CARD_COMMAND_MASK; + page = (u32)(start_addr / PAGE_SIZE); + loop = (u32)(size / PAGE_SIZE); + loop = (size % PAGE_SIZE) ? loop + 1 : loop; + + HOTSW_WaitCardCtrl(); + + for(i=0; i TIME_OUT){ + return; + } + } + *((u32 *)buf + counter++) = reg_MI_MCD1_A; + } + } + + OS_SpinWait( 100 ); +} + + +/*---------------------------------------------------------------------------* + Name: ReadCardData + + Description: カードから中途半端なサイズ(page途中)のデータを読み出す関数 + エラーコードを返す + *---------------------------------------------------------------------------*/ +static void ReadCardData(void* dest, s32 offset, s32 length) +{ + static u8 page_buffer[512]; + u32 page_offset = (u32)(offset & -512); + u32 buffer_offset = (u32)(offset % 512); + u32 valid_length = 512 - buffer_offset; + u32 remain_length; + + // 開始アドレスがページの途中 + if ( offset % 512 ) + { + ReadPageGame(page_offset, page_buffer, 512); + + MI_CpuCopy8(page_buffer + buffer_offset, dest, (length < valid_length ? length : valid_length)); + + dest = (u8*)dest + valid_length; + offset += valid_length; + length -= valid_length; + if ( length < 0) + { + return; + } + } + + remain_length = (u32)(length % 512); + ReadPageGame((u32)offset, dest, (u32)(length - remain_length)); + + // ケツがページ途中 + if( remain_length ){ + dest = (u8*)dest + (length - remain_length); + offset += length - remain_length; + + ReadPageGame((u32)offset, page_buffer, 512); + + MI_CpuCopy8(page_buffer, dest, remain_length); + } +} + + +/*---------------------------------------------------------------------------* + Name: ShowResult + + Description: Result表示 + *---------------------------------------------------------------------------*/ +static void ShowResult(void) +{ + PrintString(0, 16, 0xf, "-- Result --"); + + if(romheader && !flxhash && !ltdhash){ + PrintString(0, 18, 0x4, "Normal Mode"); + } + else if((!romheader && flxhash && !ltdhash) || + (!romheader && flxhash && ltdhash && !isTwlCard)){ + PrintString(0, 18, 0x5, "Game Mode"); + } + else if(!romheader && !flxhash && !ltdhash){ + PrintString(0, 18, 0x6, "Slot Power Off"); + } + else{ + PrintString(0, 18, 0x1, "Unknown Mode"); + } + + if(error){ + PrintString(0, 20, 0x1, "Backup Device Error"); + } + +// DEMO_DrawFlip(); +// OS_WaitVBlankIntr(); +} + + +/*---------------------------------------------------------------------------* + Name: debugMessage + + Description: + *---------------------------------------------------------------------------*/ +static void debugMessage(void) +{ + PrintString(0, 4, 0xf, "amr7 NmlRomOfs : 0x%08x", rh->sub_rom_offset); + PrintString(0, 5, 0xf, "amr7 LtdRomOfs : 0x%08x", rh->sub_ltd_rom_offset); + + OS_TPrintf("amr7 NmlRomOfs : 0x%08x\n", rh->sub_rom_offset); + OS_TPrintf("amr7 NmlSize : 0x%08x\n", rh->sub_size); + OS_TPrintf("amr7 LtdRomOfs : 0x%08x\n", rh->sub_ltd_rom_offset); + OS_TPrintf("amr7 LtdSize : 0x%08x\n", rh->sub_ltd_size); +} + + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: Vブランク割込みベクトル。 + *---------------------------------------------------------------------------*/ +static void VBlankIntr (void) +{ + /* 仮想スクリーンを VRAM に反映 */ + DC_FlushRange(screen, sizeof(screen)); + GX_LoadBG0Scr(screen, 0, sizeof(screen)); + + /* IRQ チェックフラグをセット */ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + + +/*---------------------------------------------------------------------------* + Name: PrintString + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + palette - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +static void PrintString (s16 x, s16 y, u8 palette, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *((u16*)(&temp[32])) = 0x0000; + for (i = 0; ; i++) + { + if (temp[i] == 0x00) + { + break; + } + screen[((y * 32) + x + i) % (32 * 32)] = (u16)((palette << 12) | temp[i]); + } +} \ No newline at end of file diff --git a/build/tests/CheckCardAccess/src/romSpec.h b/build/tests/CheckCardAccess/src/romSpec.h new file mode 100644 index 00000000..cb96f899 --- /dev/null +++ b/build/tests/CheckCardAccess/src/romSpec.h @@ -0,0 +1,152 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - HOTSW - include + File: romSpec.h + + 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$ + *---------------------------------------------------------------------------*/ +#ifndef __HOTSW_ROMSPEC_H__ +#define __HOTSW_ROMSPEC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +// ROM memory map + +#define HOTSW_PAGE_SIZE 0x200 // 512B +#define HOTSW_BOOT_SEG_SIZE 0x1000 // 4KB +#define HOTSW_LOAD_TABLE_SIZE 0x2000 // 8KB +#define HOTSW_KEYTABLE_AREA_SIZE 0x3000 // 12KB +#define HOTSW_KEYTABLE2_AREA_SIZE 0x3000 // 12KB +#define HOTSW_SECURE_AREA_SIZE 0x4000 // 16KB +#define HOTSW_SECURE2_AREA_SIZE 0x4000 // 16KB +#define HOTSW_ROMEMU_INFO_SIZE 0x20 + +#define HOTSW_BOOTSEGMENT_AREA_OFS 0x0000 // 0KB +#define HOTSW_KEYTABLE_AREA_OFS 0x1000 // 4KB +#define HOTSW_SECURE_AREA_OFS 0x4000 // 16KB +#define HOTSW_GAME_AREA_OFS 0x8000 // 32KB +#define HOTSW_SECURE2_AREA_OFS 0x3000 // 12KB +#define HOTSW_GAME2_AREA_OFS 0x7000 // 28KB +#define HOTSW_ROMEMU_INFO_OFS (HOTSW_SECURE_AREA_OFS - HOTSW_PAGE_SIZE + 0x160) + + +// ROM ID + +#define HOTSW_ROMID_1TROM_MASK 0x80000000UL +#define HOTSW_ROMID_TWLROM_MASK 0x40000000UL +#define HOTSW_ROMID_RFSSUP_MASK 0x20000000UL +#define HOTSW_ROMID_SIZE_MASK 0x0000ff00UL + +// ROM STATUS + +#define HOTSW_ROMST_RFS_WARN_L1_MASK 0x00000004UL +#define HOTSW_ROMST_RFS_WARN_L2_MASK 0x00000008UL +#define HOTSW_ROMST_RFS_READY_MASK 0x00000020UL + + +// NORMAL command + +#define HSWOP_N_OP_MASK 0xff00000000000000ULL +#define HSWOP_N_OP_SIZE 8 + +#define HSWOP_N_OP_RD_ID 0x9000000000000000ULL +#define HSWOP_N_OP_RD_PAGE 0x0000000000000000ULL +#define HSWOP_N_OP_WR_PAGE 0x8000000000000000ULL +#define HSWOP_N_OP_LD_TABLE 0x9f00000000000000ULL +#define HSWOP_N_OP_RD_CACHE_START 0x5800000000000000ULL +#define HSWOP_N_OP_RD_CACHE 0x6000000000000000ULL +#define HSWOP_N_OP_RD_CACHE_LAST 0x6800000000000000ULL +#define HSWOP_N_OP_RD_STAT 0xd600000000000000ULL +#define HSWOP_N_OP_RFS_BLK 0xb500000000000000ULL +#define HSWOP_N_OP_CHG_MODE 0x3c00000000000000ULL +#define HSWOP_N_OP_CHG2_MODE 0x3d00000000000000ULL + +#define HSWOP_N_RD_ID_PAD 0x00ffffffffffffffULL +#define HSWOP_N_RD_PAGE_PAD 0x00fffffeff00ffffULL +#define HSWOP_N_CHG_MODE_PAD 0x00000000f00000ffULL +#define HSWOP_N_CHG2_MODE_PAD HSWOP_N_CHG_MODE_PAD + +#define HSWOP_N_RD_PAGE_ADDR_SHIFT 33 +#define HSWOP_N_RD_PAGE_ADDR_SIZE 23 +#define HSWOP_N_RD_PAGE_ADDR_MASK 0x00fffffe00000000ULL + +#define HSWOP_N_VAE_SHIFT 32 +#define HSWOP_N_VAE_SIZE 24 +#define HSWOP_N_VAE_MASK 0x00ffffff00000000ULL + +#define HSWOP_N_VBI_SHIFT 8 +#define HSWOP_N_VBI_SIZE 20 +#define HSWOP_N_VBI_MASK 0x000000000fffff00ULL + + +// SECURE command + +#define HSWOP_S_OP_MASK 0xf000000000000000ULL +#define HSWOP_S_OP_SIZE 4 + +#define HSWOP_S_OP_RD_ID 0x1000000000000000ULL +#define HSWOP_S_OP_RD_SEG 0x2000000000000000ULL +#define HSWOP_S_OP_PNG_ON 0x4000000000000000ULL +#define HSWOP_S_OP_PNG_OFF 0x6000000000000000ULL +#define HSWOP_S_OP_CHG_MODE 0xa000000000000000ULL + +#define HSWOP_S_VA_SHIFT HSWOP_S_VB_SIZE +#define HSWOP_S_VA_SIZE 24 +#define HSWOP_S_VA_MASK 0x00000ffffff00000ULL + +#define HSWOP_S_VB_SHIFT 0 +#define HSWOP_S_VB_SIZE 20 +#define HSWOP_S_VB_MASK 0x00000000000fffffULL + +#define HSWOP_S_VC_SHIFT (HSWOP_S_VA_SIZE + HSWOP_S_VB_SIZE) +#define HSWOP_S_VC_SIZE 16 +#define HSWOP_S_VC_MASK 0x0ffff00000000000ULL + +#define HSWOP_S_VD_SHIFT HSWOP_S_VA_SHIFT +#define HSWOP_S_VD_SIZE HSWOP_S_VA_SIZE +#define HSWOP_S_VD_MASK HSWOP_S_VA_MASK + + +// GAME command + +#define HSWOP_G_OP_MASK 0xff00000000000000ULL +#define HSWOP_G_OP_SIZE 8 + +#define HSWOP_G_OP_RD_ID 0xb800000000000000ULL +#define HSWOP_G_OP_RD_UID 0xb900000000000000ULL +#define HSWOP_G_OP_RD_PAGE 0xb700000000000000ULL +#define HSWOP_G_OP_WR_PAGE 0x8000000000000000ULL +#define HSWOP_G_OP_RD_CACHE_START HSWOP_N_OP_RD_CACHE_START +#define HSWOP_G_OP_RD_CACHE HSWOP_N_OP_RD_CACHE +#define HSWOP_G_OP_RD_CACHE_LAST HSWOP_N_OP_RD_CACHE_LAST +#define HSWOP_G_OP_RD_STAT HSWOP_N_OP_RD_STAT +#define HSWOP_G_OP_RFS_BLK HSWOP_N_OP_RFS_BLK + +#define HSWOP_G_RD_ID_PAD 0x00ffffffffffffffULL +#define HSWOP_G_RD_UID_PAD 0x00ffffffffffffffULL +#define HSWOP_G_RD_PAGE_PAD 0x00f0000000ffffffULL + +#define HSWOP_G_RD_PAGE_ADDR_SHIFT 33 +#define HSWOP_G_RD_PAGE_ADDR_SIZE 23 +#define HSWOP_G_RD_PAGE_ADDR_MASK 0x000ffffe00000000ULL + + +#ifdef __cplusplus +} /* extern "C" */ + +#endif + +/* __HOTSW_ROMSPEC_H__ */ +#endif diff --git a/build/tests/CheckCardMode/Makefile b/build/tests/CheckCardMode/Makefile new file mode 100644 index 00000000..f63e8dc8 --- /dev/null +++ b/build/tests/CheckCardMode/Makefile @@ -0,0 +1,37 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CheckCardMode +# 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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM := TWL + +SRCS = ./src/main.c ./src/font.c + +TARGET_BIN = card_mode_check.srl + +MACRO_FLAGS += -DMY_TARGET_NAME=\"$(basename $(TARGET_BIN))\" + +#------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/CheckCardMode/src/font.c b/build/tests/CheckCardMode/src/font.c new file mode 100644 index 00000000..9500697a --- /dev/null +++ b/build/tests/CheckCardMode/src/font.c @@ -0,0 +1,579 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos.TWL - snd - extraFunc + File: font.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. + + $Date:: $ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#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/tests/CheckCardMode/src/font.h b/build/tests/CheckCardMode/src/font.h new file mode 100644 index 00000000..b4a94093 --- /dev/null +++ b/build/tests/CheckCardMode/src/font.h @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos.TWL - snd - extraFunc + File: font.h + + 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$ + *---------------------------------------------------------------------------*/ + +#ifndef FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif +/*===========================================================================*/ + +#include + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // FONT_H_ diff --git a/build/tests/CheckCardMode/src/hotswTypes.h b/build/tests/CheckCardMode/src/hotswTypes.h new file mode 100644 index 00000000..02d0843e --- /dev/null +++ b/build/tests/CheckCardMode/src/hotswTypes.h @@ -0,0 +1,134 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - HOTSW - include + File: type.h + + Copyright 2007-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. + *---------------------------------------------------------------------------*/ +#ifndef __HOTSW_TYPES_H__ +#define __HOTSW_TYPES_H__ + +#include +#include +#include "romSpec.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +static inline void HOTSW_WaitCardCtrl(void) +{ + while( reg_MI_MCCNT1_A & REG_MI_MCCNT1_START_MASK ){} +} + +// Define ------------------------------------------------------------------- +// --- Boot Segment +#define BOOT_SEGMENT_SIZE 0x1000 + +// --- Secure Segment +#define SECURE_SEGMENT_START 0x4000 +#define SECURE_SEGMENT_SIZE 0x4000 +#define SECURE_SEGMENT_END (SECURE_SEGMENT_START + SECURE_SEGMENT_SIZE) + +// --- TWL Card +#define TWLCARD_BORDER_OFFSET 0x80000 + +// --- Page / Segment (Byte) +#define PAGE_SIZE 0x200 +#define ONE_SEGMENT_SIZE 0x1000 + +// --- Page / Segment (Word) +#define PAGE_WORD_SIZE 0x80 +#define ONE_SEGMENT_WORD_SIZE 0x400 + +// --- Rom Emulation +#define ROM_EMULATION_DATA_SIZE 0x20 + +// --- Thread +#define HOTSW_THREAD_STACK_SIZE (1024 * 2) +#define HOTSW_DMA_MSG_NUM 8 +#define HOTSW_INSERT_MSG_NUM 16 +#define HOTSW_PULLED_MSG_NUM 16 +#define HOTSW_CTRL_MSG_NUM 8 +#define HOTSW_MSG_BUFFER_NUM (HOTSW_INSERT_MSG_NUM + HOTSW_PULLED_MSG_NUM + HOTSW_CTRL_MSG_NUM) +#define HOTSW_POLLING_CTRL_BUFFER_NUM 4 + +// --- Card Control Reg 0 +#define HOTSW_E2PROM_CTRL_MASK 0x00ff + +// --- Card Control Reg 1 +#define START_FLG_MASK 0x80000000 +#define READY_FLG_MASK 0x00800000 + +#define LATENCY1_SHIFT 0 +#define LATENCY1_MASK 0x00001fff + +#define DS_SHIFT 13 +#define DS_MASK 0x00002000 + +#define SE_SHIFT 14 +#define SE_MASK 0x00004000 + +#define SCR_SHIFT 15 +#define SCR_MASK 0x00008000 + +#define LATENCY2_SHIFT 16 +#define LATENCY2_MASK 0x003f0000 + +#define CS_SHIFT 22 +#define CS_MASK 0x00400000 + +#define RDY_SHIFT 23 +#define RDY_MASK 0x00800000 + +#define PC_SHIFT 24 +#define PC_MASK 0x07000000 + +#define CT_SHIFT 27 +#define CT_MASK 0x08000000 + +#define TRM_SHIFT 28 +#define TRM_MASK 0x10000000 + +#define RESB_SHIFT 29 +#define RESB_MASK 0x20000000 + +#define WR_SHIFT 30 +#define WR_MASK 0x40000000 + +#define START_SHIFT 31 +#define START_MASK 0x80000000 + +#define SCRAMBLE_MASK 0x1040e000 // スクランブル関係のフラグマスク +#define SECURE_COMMAND_SCRAMBLE_MASK 0x00406000 // CS SE DSのマスク + +// --- Page Count +#define PAGE_0 0x0UL << PC_SHIFT +#define PAGE_1 0x1UL << PC_SHIFT +#define PAGE_2 0x2UL << PC_SHIFT +#define PAGE_4 0x3UL << PC_SHIFT +#define PAGE_8 0x4UL << PC_SHIFT +#define PAGE_16 0x5UL << PC_SHIFT +#define PAGE_32 0x6UL << PC_SHIFT +#define PAGE_STAT 0x7UL << PC_SHIFT + + +// union --------------------------------------------------------------------- +typedef union +{ + u64 dw; + u8 b[8]; +} Cmd64; + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // __HOTSW_TYPES_H__ \ No newline at end of file diff --git a/build/tests/CheckCardMode/src/main.c b/build/tests/CheckCardMode/src/main.c new file mode 100644 index 00000000..4bd9f8d9 --- /dev/null +++ b/build/tests/CheckCardMode/src/main.c @@ -0,0 +1,535 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - CARD - hotswDebug + 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. + *---------------------------------------------------------------------------*/ + +#include +#include +#include "DEMO.h" +#include "hotswTypes.h" +#include "font.h" + +#define SDK_MAKERCODE '10' +#define DIGEST_HASH_BLOCK_SIZE_SHA1 (512/8) + +#define MY_TEMP_BUFFER_SIZE 0x80000 +#define GAME_FIELD_START_ADDRESS 0x8000 + +#define READY_MASK 0x00800000 +#define CARD_COMMAND_MASK 0x07000000 + +#define MY_ROMHEADER_TWL ((ROM_Header_Short *)HW_TWL_CARD_ROM_HEADER_BUF) +#define MY_ROMHEADER_NTR ((ROM_Header_Short *)HW_CARD_ROM_HEADER) + +// --------------------------------------------------------------- +// HMACSHA1の鍵 +static u8 s_digestDefaultKey[ DIGEST_HASH_BLOCK_SIZE_SHA1 ] = { + 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 +}; + +static u32 checkBuf[MY_TEMP_BUFFER_SIZE/sizeof(u32)] ATTRIBUTE_ALIGN(16); + +static ROM_Header_Short *rh; +static BOOL isTwlApplication; +static BOOL isTwlCard; +static BOOL flxhash, ltdhash, mirrorimage; +static u16 card_lock_id; + +static u16 screen[32 * 32] ATTRIBUTE_ALIGN(HW_CACHE_LINE_SIZE); + +// --------------------------------------------------------------- +static BOOL CheckHashValue(void* buf, u32 size, void* digest); +static void MY_LoadCard_arm7Static(void); +static void MY_LoadCard_arm7LtdStatic(void); +static void debugMessage(void); +static void ShowResult(void); + +static void SetCommand(Cmd64 *cndLE); +static void ReadIDGame(void); +static void ReadPageGame(u32 start_addr, void* buf, u32 size); +static void ReadCardData(void* dest, s32 offset, s32 length); +static void isGameModeForNTR(void); + +static void VBlankIntr (void); +static void PrintString (s16 x, s16 y, u8 palette, char *text, ...); +static void VolumeSwitchCallback(SNDEXResult result, void* arg); + +/*---------------------------------------------------------------------------* + Name: NitroMain + + Description: メイン エントリポイント. + *---------------------------------------------------------------------------*/ +void NitroMain(void) +{ + CARDRomHeader *card_header = (void*)CARD_GetRomHeader(); + + OS_Init(); + OS_InitTick(); + CARD_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + if ( card_header->maker_code == SDK_MAKERCODE ) + { + CARD_Enable(TRUE); + } + + /* 表示設定初期化 */ + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + MI_CpuFillFast((void*)HW_OAM, GX_LCD_SIZE_Y, HW_OAM_SIZE); + MI_CpuClearFast((void*)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void*)HW_DB_OAM, GX_LCD_SIZE_Y, HW_DB_OAM_SIZE); + MI_CpuClearFast((void*)HW_DB_PLTT, HW_DB_PLTT_SIZE); + GX_SetBankForBG(GX_VRAM_BG_128_A); + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, // SCR ベースブロック 31 + GX_BG_CHARBASE_0x00000, // CHR ベースブロック 0 + GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + 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)); + MI_CpuClearFast((void*)screen, sizeof(screen)); + DC_FlushRange(screen, sizeof(screen)); + GX_LoadBG0Scr(screen, 0, sizeof(screen)); + + /* 割込み設定 */ + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + /* LCD 表示開始 */ + GX_DispOn(); + GXS_DispOn(); + + PrintString(0, 0, 0xa, "***** Card Mode Check *****"); + + // カードアプリタイプを判別。使うRom Header Buffer を切替える + if(MY_ROMHEADER_NTR->platform_code & PLATFORM_CODE_FLAG_TWL){ + PrintString(0, 2, 0xf, "- TWL Application -"); + isTwlApplication = TRUE; + rh = MY_ROMHEADER_TWL; + } + else{ + PrintString(0, 2, 0xf, "- NTR Application -"); + isTwlApplication = FALSE; + rh = MY_ROMHEADER_NTR; + } + + OS_Printf("Buf Adr : 0x%08x\n", checkBuf); + + // カードタイプの判別 + isTwlCard = (*(vu32 *)(HW_BOOT_CHECK_INFO_BUF) & HOTSW_ROMID_TWLROM_MASK) ? TRUE : FALSE; + + // 注:rhの初期化が終わってから呼び出す + debugMessage(); + + // フラグの初期化 + flxhash = FALSE; + ltdhash = FALSE; + mirrorimage = FALSE; + + // ロックIDを取得しておく + card_lock_id = (u16)OS_GetLockID(); + + if(isTwlApplication){ + MY_LoadCard_arm7Static(); + MY_LoadCard_arm7LtdStatic(); + } + else{ + isGameModeForNTR(); + } + + ShowResult(); + + while(1){ + DEMO_DrawFlip(); + OS_WaitVBlankIntr(); + } +} + + +/*---------------------------------------------------------------------------* + Name: ShowResult + + Description: + *---------------------------------------------------------------------------*/ +static void ShowResult(void) +{ + PrintString(0, 13, 0xf, "-- Result --"); + + if(flxhash && ltdhash){ + if(isTwlCard){ + PrintString(0, 15, 0x6, "Game2 Mode"); + } + else{ + PrintString(0, 15, 0x5, "Game Mode"); + } + } + else if(mirrorimage){ + PrintString(0, 15, 0x5, "Game Mode"); + } + else{ + PrintString(0, 15, 0x1, "Unknown Mode"); + } +} + + +/*---------------------------------------------------------------------------* + Name: debugMessage + + Description: + *---------------------------------------------------------------------------*/ +static void debugMessage(void) +{ + PrintString(0, 4, 0xf, "amr7 NmlRomOfs : 0x%08x", rh->sub_rom_offset); + PrintString(0, 5, 0xf, "amr7 LtdRomOfs : 0x%08x", rh->sub_ltd_rom_offset); + + OS_TPrintf("amr7 NmlRomOfs : 0x%08x\n", rh->sub_rom_offset); + OS_TPrintf("amr7 NmlSize : 0x%08x\n", rh->sub_size); + OS_TPrintf("amr7 LtdRomOfs : 0x%08x\n", rh->sub_ltd_rom_offset); + OS_TPrintf("amr7 LtdSize : 0x%08x\n", rh->sub_ltd_size); +} + + +/*---------------------------------------------------------------------------* + Name: CheckHashValue + + Description: モジュールハッシュチェック + *---------------------------------------------------------------------------*/ +static BOOL CheckHashValue(void* buf, u32 size, void* digest) +{ + u8 sha1data[DIGEST_SIZE_SHA1]; + BOOL retval = TRUE; + + // クリア + MI_CpuClear8(sha1data, sizeof(sha1data)); + + // ARM7常駐モジュールのHash値照合 + SVC_CalcHMACSHA1( sha1data, + buf, + size, + s_digestDefaultKey, + sizeof(s_digestDefaultKey) ); + + return SVC_CompareSHA1( sha1data, digest ); +} + + +/*---------------------------------------------------------------------------* + Name: MY_LoadCard_arm7Static + + Description: ARM7常駐モジュール 読み出し・ハッシュチェック + *---------------------------------------------------------------------------*/ +static void MY_LoadCard_arm7Static(void) +{ + BOOL result; + u32* pBuf = checkBuf; + + CARD_LockRom(card_lock_id); + + ReadCardData(pBuf, (s32)rh->sub_rom_offset, (s32)rh->sub_size); + + CARD_UnlockRom(card_lock_id); + + result = CheckHashValue(pBuf, rh->sub_size, (void *)rh->sub_static_digest); + + if(result){ + flxhash = TRUE; + PrintString(0, 7, 0x8, "Flx Area : Accessible"); + } + else{ + flxhash = FALSE; + PrintString(0, 7, 0x1, "Flx Area : Not Accessible"); + } +} + + +/*---------------------------------------------------------------------------* + Name: MY_LoadCard_arm7LtdStatic + + Description: ARM7拡張常駐モジュール 読み出し・ハッシュチェック + *---------------------------------------------------------------------------*/ +static void MY_LoadCard_arm7LtdStatic(void) +{ + BOOL result; + u32* pBuf = checkBuf; + + CARD_LockRom(card_lock_id); + + ReadCardData(pBuf, (s32)rh->sub_ltd_rom_offset, (s32)rh->sub_ltd_size); + + CARD_UnlockRom(card_lock_id); + + result = CheckHashValue(pBuf, rh->sub_ltd_size, (void *)rh->sub_ltd_static_digest); + + if(result){ + ltdhash = TRUE; + PrintString(0, 9, 0x8, "Ltd Area : Accessible"); + } + else{ + ltdhash = FALSE; + PrintString(0, 9, 0x1, "Ltd Area : Not Accessible"); + } +} + + +/*---------------------------------------------------------------------------* + Name: isGameModeForNTR + + Description: Gameモードかどうか判定する + *---------------------------------------------------------------------------*/ +static void isGameModeForNTR(void) +{ + u32 buf1[PAGE_SIZE/sizeof(u32)]; + u32 buf2[PAGE_SIZE/sizeof(u32)]; + int result; + + /* Rom Header領域を読んで、Game領域のイメージが出てたらGameモード */ + ReadCardData(buf1, (s32)0, (s32)PAGE_SIZE); + ReadCardData(buf2, (s32)GAME_FIELD_START_ADDRESS, (s32)PAGE_SIZE); + + result = MI_CpuComp8( buf1, buf2, PAGE_SIZE ); + + if(result){ + mirrorimage = FALSE; + PrintString(0, 7, 0x1, "Flx Area : Not Accessible"); + } + else{ + mirrorimage = TRUE; + PrintString(0, 7, 0x8, "Flx Area : Accessible"); + } +} + + +/*---------------------------------------------------------------------------* + Name: HOTSWi_SetCommand + + Description: 引数で与えられたコマンドのエンディアンを変えてレジスタにセットする + *---------------------------------------------------------------------------*/ +static void SetCommand(Cmd64 *cndLE) +{ + Cmd64 cndBE; + + // ビッグエンディアンに直す + cndBE.b[7] = cndLE->b[0]; + cndBE.b[6] = cndLE->b[1]; + cndBE.b[5] = cndLE->b[2]; + cndBE.b[4] = cndLE->b[3]; + cndBE.b[3] = cndLE->b[4]; + cndBE.b[2] = cndLE->b[5]; + cndBE.b[1] = cndLE->b[6]; + cndBE.b[0] = cndLE->b[7]; + + // MCCMD レジスタ設定 + reg_MI_MCCMD0_A = *(u32*)cndBE.b; + reg_MI_MCCMD1_A = *(u32*)&cndBE.b[4]; +} + + +/*---------------------------------------------------------------------------* + Name: ReadIDGame + + Description: ゲームモードでIDを読み込む + *---------------------------------------------------------------------------*/ +static void ReadIDGame(void) +{ + u32 id; + Cmd64 cndLE; + u32 rom_ctrl = *(vu32 *)(HW_CARD_ROM_HEADER + 0x60); + + rom_ctrl = rom_ctrl & ~CARD_COMMAND_MASK; + + // リトルエンディアンで作って + cndLE.dw = HSWOP_G_OP_RD_ID; + + // MCCMD レジスタ設定 + SetCommand(&cndLE); + + // MCCNT0 レジスタ設定 + reg_MI_MCCNT0_A = (u16)((reg_MI_MCCNT0_A & 0x00ff) | REG_MI_MCCNT0_E_MASK); + + // MCCNT1 レジスタ設定 + reg_MI_MCCNT1_A = rom_ctrl | START_MASK | PAGE_1; + + while(reg_MI_MCCNT1_A & START_MASK){ + while(!(reg_MI_MCCNT1_A & READY_MASK)){} + id = reg_MI_MCD1_A; + } + + OS_Printf("Card ID : 0x%08x\n", id); + + OS_SpinWait( 100 ); +} + + +/*---------------------------------------------------------------------------* + Name: ReadPageGame + + Description: ゲームモードで、指定されたページを指定バッファに指定サイズ分を読み込む + + CT=150ns Pagecount=1page Latency=RomHeaderで指定の値 + *---------------------------------------------------------------------------*/ +static void ReadPageGame(u32 start_addr, void* buf, u32 size) +{ + u32 loop, counter=0; + u64 i, page; + Cmd64 cndLE; + u32 rom_ctrl = *(vu32 *)(HW_CARD_ROM_HEADER + 0x60); + + rom_ctrl = rom_ctrl & ~CARD_COMMAND_MASK; + page = (u32)(start_addr / PAGE_SIZE); + loop = (u32)(size / PAGE_SIZE); + loop = (size % PAGE_SIZE) ? loop + 1 : loop; + + for(i=0; i