<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.3dbrew.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Owowhatsthis</id>
	<title>3dbrew - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.3dbrew.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Owowhatsthis"/>
	<link rel="alternate" type="text/html" href="https://www.3dbrew.org/wiki/Special:Contributions/Owowhatsthis"/>
	<updated>2026-04-15T22:31:58Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=21253</id>
		<title>3DS Virtual Console</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=21253"/>
		<updated>2020-05-24T21:40:23Z</updated>

		<summary type="html">&lt;p&gt;Owowhatsthis: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several types of VC titles: NES/GB/GBC VC titles, SNES VC titles, GameGear VC titles and GBA VC titles.&lt;br /&gt;
Except for GBA VC, the games are ran using emulators.&lt;br /&gt;
&lt;br /&gt;
=NES/GB/GBC VC=&lt;br /&gt;
An emulator application + VC ROM in the NCCH [[RomFS]] (among other things in the RomFS).&lt;br /&gt;
&lt;br /&gt;
The original emulator builds include support for all these three platforms, not specific to just the included ROM platform. However, releases intended for NES games have a red menu, optional switching between the two controllers, a different X button mapping (B instead of menu), optional [[Download Play]] support, and [http://s27.postimg.org/60v4yuw8z/IMG_20140921_001103.jpg a never used multi-rom support]; while Game Boy versions have a green theme and optional 3D border.&lt;br /&gt;
&lt;br /&gt;
Early builds (of Ambassador NES games at least) did not support savestates.&lt;br /&gt;
&lt;br /&gt;
The emulator officially used for Pokemon games removes savestate support in favor of a Link Cable &amp;quot;implementation&amp;quot; involving hooking the games&#039; network functions according to the patch files. ([https://gbatemp.net/attachments/vc-wireless-link-patch-documentation-txt.72966/ Partial documentation of the patch format])&lt;br /&gt;
&lt;br /&gt;
This emulator includes GBA support, however the GBA emulation for this this is somewhat slow. This was presumably implemented before AGB_FIRM was.&lt;br /&gt;
&lt;br /&gt;
Unlike Wii VC, the 3DS VC ROMs for NES use [http://pastebin.com/KLeWt2W3 the &amp;quot;TNES&amp;quot; header].&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/rom/&amp;quot; This directory contains the ROM file(s). Filenames used under here don&#039;t matter: the filename is determined by the emulator app by doing a directory read.&lt;br /&gt;
* &amp;quot;rom:/shaders/&amp;quot; This directory contains GPU shaders used by the emulator app: .shbin, .csdr, and .obj.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains graphics, audio, and text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/agb.bin&amp;quot; GBA BIOS.&lt;br /&gt;
* &amp;quot;rom:/buildtime.txt&amp;quot; Emulator app build timestamp.&lt;br /&gt;
* &amp;quot;rom:/config.ini&amp;quot; Emulator configuration .ini, contains sections for all supported 3DS VC platforms.&lt;br /&gt;
* &amp;quot;rom:/&amp;lt;rom_name&amp;gt;.patch&amp;quot; rom_name = filename from the rom directory. This .ini contains patches for the ROM.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;rsm1.dat&amp;quot;: Same format as the below rsm2.dat. Probably used for the &amp;quot;restore-point&amp;quot;.&lt;br /&gt;
* &amp;quot;rsm2.dat&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;sav.dat&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
* &amp;quot;SecureValue&amp;quot;: The random number used by [[Anti Savegame Restore]]. No known version of the emulator implements both savestates and secure value.&lt;br /&gt;
Overwriting sav.dat with 0xFF-bytes doesn&#039;t have any affect on the actual emulator. Doing that with most of the rsm*.dat data doesn&#039;t crash anything.&lt;br /&gt;
&lt;br /&gt;
=SNES VC=&lt;br /&gt;
An emulator application + VC ROM in the NCCH [[RomFS]] (among other things in the RomFS).&lt;br /&gt;
SNES VC titles are New 3DS exclusive.&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/ErrorMessage/&amp;quot; This directory contains text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/shader/&amp;quot; This directory contains .shbin GPU shaders used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/caravel.bcsar&amp;quot; This file contains audio used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/ctrl_change.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/data.bin&amp;quot; This file contains the ROM and other data. See below for documentation.&lt;br /&gt;
* &amp;quot;rom:/ErrorMessage.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/KTR-XXXX.icn&amp;quot; Copy of the SMDH of the game.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
* &amp;quot;rom:/nnfont_RectDrawerShader.shbin&amp;quot; GPU shader.&lt;br /&gt;
* &amp;quot;rom:/VCM.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
&lt;br /&gt;
===data.bin structure===&lt;br /&gt;
The file begins with a header (all values are little-endian):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000100&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000030&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000050&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of the ROM (always 0x00000060 in official VC)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| End of the ROM&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of the footer region (presumably an index for the PCM audio samples). Matches end of file/file size if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of decompressed SDD-1 graphics data region. Matches end of file/file size if no SDD-1 chip is present&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x8&lt;br /&gt;
| Product ID (KTR-XXXX), determines filenames in savedata&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Emulation speed in FPS (always 0x3C in official VC)&lt;br /&gt;
|-&lt;br /&gt;
| 0x31&lt;br /&gt;
| 0x3&lt;br /&gt;
| ROM size&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x35&lt;br /&gt;
| 0x3&lt;br /&gt;
| Size of the converted PCM audio samples region (starting after ROM). 0 if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x39&lt;br /&gt;
| 0x2&lt;br /&gt;
| Footer region size. 0 if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x3B&lt;br /&gt;
| 0x2&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x3D&lt;br /&gt;
| 0x2&lt;br /&gt;
| Preset ID (varies for each game). A full list of know Preset IDs (shared by WiiU/SNESC/Switch SNES emulators) can be found [https://docs.google.com/spreadsheets/d/1PbIPVA4NpFEXs1zk249aR3FSuBTY3r-ajpTq3dP3GnQ here]&lt;br /&gt;
|-&lt;br /&gt;
| 0x3F&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0x2&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x1&lt;br /&gt;
| Sound volume&lt;br /&gt;
|-&lt;br /&gt;
| 0x41&lt;br /&gt;
| 0x1&lt;br /&gt;
| ROM type (0x15 == HiROM/0x14 == LoROM)&lt;br /&gt;
|-&lt;br /&gt;
| 0x42&lt;br /&gt;
| 0xE&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000003&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000001&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The 0x60 header is followed by the SNES ROM, often altered to replace audio samples with pointers to external PCM audio files converted from the game, presumably to speed up emulation (these pointers can be found by looking for &amp;quot;PCMF&amp;quot; in the ROM, as seen on [https://github.com/Plombo/vcromclaim/blob/master/snesrestore.py Wii VC]).&lt;br /&gt;
The ROM is then optionally followed by the PCM audio files, by the SDD-1 decompressed graphics data (the emulator doesn&#039;t properly emulate the chip, presumably because of hardware constraints) and by a footer which appears to be an index for the PCM audio data.&lt;br /&gt;
There are no setting fields for specific cart features, with the exception of Special Chip, and it appears that the emulator has &amp;quot;game presets&amp;quot; stored in its own code, which determines more game-specific settings. The Special Chip can also be enabled by the game Preset ID. Each official VC release has [https://docs.google.com/spreadsheets/d/1PbIPVA4NpFEXs1zk249aR3FSuBTY3r-ajpTq3dP3GnQ/edit#gid=490971147 a different preset ID] in the header. The supported Special Chips are: DSP1, C4 and DSP2.  &lt;br /&gt;
&lt;br /&gt;
A similar structure can be found on Wii U, SNES Classic and Switch Mini emulator [https://gist.github.com/anpage/c1085055db0242ea3c7558dab56712a5]&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata contains:&lt;br /&gt;
* &amp;quot;KTR-XXXX.cfg&amp;quot;: Appears to contain the &amp;quot;preset ID&amp;quot; and possibly more game/save information.&lt;br /&gt;
* &amp;quot;KTR-XXXX.vea&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;KTR-XXXX.ves&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
&lt;br /&gt;
Filenames are determined in the ROM header.&lt;br /&gt;
&lt;br /&gt;
=GBA VC=&lt;br /&gt;
GBA VC is run by [[FIRM|AGB_FIRM]]. RomFS isn&#039;t used for GBA VC titles, but can be found empty within GBA VC titles. The NCCH [[ExeFS]] contains the same files as a normal application. The [[ExeFS]]:/.code contains the GBA VC ROM followed by a 0x360 byte long footer.&lt;br /&gt;
&lt;br /&gt;
===Footer===&lt;br /&gt;
All values in the GBA VC footer and related structures are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &#039;.CAA&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| 0x4&lt;br /&gt;
| Must be 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to array of config descriptors&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of config descriptors &amp;lt;&amp;lt; 4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Config descriptor====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| If 1, then this config descriptor is used. If 0, and the following value is not 0, then the GBA VC load fails outright (causes result 0xC900464F). Otherwise, this config descriptor is skipped.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to config&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Size of config (unused by the function that parses this, which hardcodes the config size (0x324) to memcpy)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Padding&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Config====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  0x4&lt;br /&gt;
|  GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x008&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save type (see below for supported values and [[ARM7_Registers#ARM7_SAVE_MODE|here]] for details)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00E&lt;br /&gt;
| 0x2&lt;br /&gt;
| Sleep mode button combo (utilizes the same bit masks as the [[HID_Registers#HID_PAD|HID_PAD register]], with flipped bits).&amp;lt;br/&amp;gt;If the GBA title supports a button-combo based sleep mode and it&#039;s set here, Agbbg spoofs this combo when closing the 3DS&#039; lid to enter proper sleep mode.&lt;br /&gt;
|-&lt;br /&gt;
| 0x010&lt;br /&gt;
| 0x10&lt;br /&gt;
| Flash and EEPROM configuration (see the target registers [[ARM7_Registers|here]])&lt;br /&gt;
|-&lt;br /&gt;
| 0x020&lt;br /&gt;
| 0x4&lt;br /&gt;
| LCD ghosting (01-FF, lower values equal more ghosting)&lt;br /&gt;
|-&lt;br /&gt;
| 0x024&lt;br /&gt;
| 0x300&lt;br /&gt;
| Video LUT (black to full, rgbrgbrgb...)?,&amp;lt;br/&amp;gt;three different types of this data have been observed.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Save types:&lt;br /&gt;
* 0x0: EEPROM 8k for &amp;lt; 256 Mbit titles&lt;br /&gt;
* 0x1: EEPROM 8k for 256 Mbit titles&lt;br /&gt;
* 0x2: EEPROM 64k for &amp;lt; 256 Mbit titles&lt;br /&gt;
* 0x3: EEPROM 64k for 256 Mbit titles&lt;br /&gt;
* 0x4: Flash 512k (Atmel, ID: 0x3D1F) + RTC&lt;br /&gt;
* 0x5: Flash 512k (Atmel, ID: 0x3D1F)&lt;br /&gt;
* 0x6: Flash 512k (SST, ID: 0xD4BF) + RTC&lt;br /&gt;
* 0x7: Flash 512k (SST, ID: 0xD4BF)&lt;br /&gt;
* 0x8: Flash 512k (Panasonic, ID: 0x1B32) + RTC&lt;br /&gt;
* 0x9: Flash 512k (Panasonic, ID: 0x1B32)&lt;br /&gt;
* 0xA: Flash 1Mbit (Macronix, ID: 0x09C2) + RTC&lt;br /&gt;
* 0xB: Flash 1Mbit (Macronix, ID: 0x09C2)&lt;br /&gt;
* 0xC: Flash 1Mbit (Sanyo, ID: 0x1362) + RTC&lt;br /&gt;
* 0xD: Flash 1Mbit (Sanyo, ID: 0x1362)&lt;br /&gt;
* 0xE: SRAM/FRAM 256k&lt;br /&gt;
&lt;br /&gt;
Everything above 0xE results in no save chip and nothing being saved to NAND.&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame===&lt;br /&gt;
AGB_FIRM saves its active save memory to NAND on exit, this is then immediately picked up by NATIVE_FIRM on reboot by checking [[CONFIG_Registers#CFG_BOOTENV|CFG_BOOTENV]]. From there, this is verified and copied out to SD (also see below). The savegame format is as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic (&#039;.SAV&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| AES-CMAC of the SHA256 hash of 0x30..0x200 + the entire save itself, keyslot 0x24, keyY from process9 .rodata&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of times saved (unused?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| AGB TitleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x10&lt;br /&gt;
| SD card CID from the console the save was made on (verified on load)&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save start addr (always 0x200)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save size&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0xFF (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x64&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 0x198&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame on SD===&lt;br /&gt;
A NAND savegame copied to the SD by process9 is identical to its counterpart on the NAND partition, save for the CMAC. For SD copies on retail units, the CMAC is recalculated as the AES-CMAC of the (SHA256 hash of (&amp;quot;CTR-SIGN&amp;quot; + AGB TitleID (little endian) + SHA256 hash of (&amp;quot;CTR-SAV0&amp;quot; + SHA256 hash of (0x30..0x200 + the entire save itself)))), using keyslot 0x30 set up with the keyY from movable.sed. For SD copies on devkit units, the CMAC is recalculated using the SHA256 hash of 0x30..0x200 + the entire save itself, using a different key from process9 .rodata.&lt;/div&gt;</summary>
		<author><name>Owowhatsthis</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=21252</id>
		<title>3DS Virtual Console</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=21252"/>
		<updated>2020-05-24T20:17:26Z</updated>

		<summary type="html">&lt;p&gt;Owowhatsthis: Fix GBA VC savedata info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several types of VC titles: NES/GB/GBC VC titles, SNES VC titles, GameGear VC titles and GBA VC titles.&lt;br /&gt;
Except for GBA VC, the games are ran using emulators.&lt;br /&gt;
&lt;br /&gt;
=NES/GB/GBC VC=&lt;br /&gt;
An emulator application + VC ROM in the NCCH [[RomFS]] (among other things in the RomFS).&lt;br /&gt;
&lt;br /&gt;
The original emulator builds include support for all these three platforms, not specific to just the included ROM platform. However, releases intended for NES games have a red menu, optional switching between the two controllers, a different X button mapping (B instead of menu), optional [[Download Play]] support, and [http://s27.postimg.org/60v4yuw8z/IMG_20140921_001103.jpg a never used multi-rom support]; while Game Boy versions have a green theme and optional 3D border.&lt;br /&gt;
&lt;br /&gt;
Early builds (of Ambassador NES games at least) did not support savestates.&lt;br /&gt;
&lt;br /&gt;
The emulator officially used for Pokemon games removes savestate support in favor of a Link Cable &amp;quot;implementation&amp;quot; involving hooking the games&#039; network functions according to the patch files. ([https://gbatemp.net/attachments/vc-wireless-link-patch-documentation-txt.72966/ Partial documentation of the patch format])&lt;br /&gt;
&lt;br /&gt;
This emulator includes GBA support, however the GBA emulation for this this is somewhat slow. This was presumably implemented before AGB_FIRM was.&lt;br /&gt;
&lt;br /&gt;
Unlike Wii VC, the 3DS VC ROMs for NES use [http://pastebin.com/KLeWt2W3 the &amp;quot;TNES&amp;quot; header].&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/rom/&amp;quot; This directory contains the ROM file(s). Filenames used under here don&#039;t matter: the filename is determined by the emulator app by doing a directory read.&lt;br /&gt;
* &amp;quot;rom:/shaders/&amp;quot; This directory contains GPU shaders used by the emulator app: .shbin, .csdr, and .obj.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains graphics, audio, and text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/agb.bin&amp;quot; GBA BIOS.&lt;br /&gt;
* &amp;quot;rom:/buildtime.txt&amp;quot; Emulator app build timestamp.&lt;br /&gt;
* &amp;quot;rom:/config.ini&amp;quot; Emulator configuration .ini, contains sections for all supported 3DS VC platforms.&lt;br /&gt;
* &amp;quot;rom:/&amp;lt;rom_name&amp;gt;.patch&amp;quot; rom_name = filename from the rom directory. This .ini contains patches for the ROM.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;rsm1.dat&amp;quot;: Same format as the below rsm2.dat. Probably used for the &amp;quot;restore-point&amp;quot;.&lt;br /&gt;
* &amp;quot;rsm2.dat&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;sav.dat&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
* &amp;quot;SecureValue&amp;quot;: The random number used by [[Anti Savegame Restore]]. No known version of the emulator implements both savestates and secure value.&lt;br /&gt;
Overwriting sav.dat with 0xFF-bytes doesn&#039;t have any affect on the actual emulator. Doing that with most of the rsm*.dat data doesn&#039;t crash anything.&lt;br /&gt;
&lt;br /&gt;
=SNES VC=&lt;br /&gt;
An emulator application + VC ROM in the NCCH [[RomFS]] (among other things in the RomFS).&lt;br /&gt;
SNES VC titles are New 3DS exclusive.&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/ErrorMessage/&amp;quot; This directory contains text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/shader/&amp;quot; This directory contains .shbin GPU shaders used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/caravel.bcsar&amp;quot; This file contains audio used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/ctrl_change.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/data.bin&amp;quot; This file contains the ROM and other data. See below for documentation.&lt;br /&gt;
* &amp;quot;rom:/ErrorMessage.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/KTR-XXXX.icn&amp;quot; Copy of the SMDH of the game.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
* &amp;quot;rom:/nnfont_RectDrawerShader.shbin&amp;quot; GPU shader.&lt;br /&gt;
* &amp;quot;rom:/VCM.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
&lt;br /&gt;
===data.bin structure===&lt;br /&gt;
The file begins with a header (all values are little-endian):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000100&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000030&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000050&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of the ROM (always 0x00000060 in official VC)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| End of the ROM&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of the footer region (presumably an index for the PCM audio samples). Matches end of file/file size if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of decompressed SDD-1 graphics data region. Matches end of file/file size if no SDD-1 chip is present&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x8&lt;br /&gt;
| Product ID (KTR-XXXX), determines filenames in savedata&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Emulation speed in FPS (always 0x3C in official VC)&lt;br /&gt;
|-&lt;br /&gt;
| 0x31&lt;br /&gt;
| 0x3&lt;br /&gt;
| ROM size&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x35&lt;br /&gt;
| 0x3&lt;br /&gt;
| Size of the converted PCM audio samples region (starting after ROM). 0 if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x39&lt;br /&gt;
| 0x2&lt;br /&gt;
| Footer region size. 0 if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x3B&lt;br /&gt;
| 0x2&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x3D&lt;br /&gt;
| 0x2&lt;br /&gt;
| Preset ID (varies for each game). A full list of know Preset IDs (shared by WiiU/SNESC/Switch SNES emulators) can be found [https://docs.google.com/spreadsheets/d/1PbIPVA4NpFEXs1zk249aR3FSuBTY3r-ajpTq3dP3GnQ here]&lt;br /&gt;
|-&lt;br /&gt;
| 0x3F&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0x2&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x1&lt;br /&gt;
| Sound volume&lt;br /&gt;
|-&lt;br /&gt;
| 0x41&lt;br /&gt;
| 0x1&lt;br /&gt;
| ROM type (0x15 == HiROM/0x14 == LoROM)&lt;br /&gt;
|-&lt;br /&gt;
| 0x42&lt;br /&gt;
| 0xE&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000003&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000001&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The 0x60 header is followed by the SNES ROM, often altered to replace audio samples with pointers to external PCM audio files converted from the game, presumably to speed up emulation (these pointers can be found by looking for &amp;quot;PCMF&amp;quot; in the ROM, as seen on [https://github.com/Plombo/vcromclaim/blob/master/snesrestore.py Wii VC]).&lt;br /&gt;
The ROM is then optionally followed by the PCM audio files, by the SDD-1 decompressed graphics data (the emulator doesn&#039;t properly emulate the chip, presumably because of hardware constraints) and by a footer which appears to be an index for the PCM audio data.&lt;br /&gt;
There are no setting fields for specific cart features, with the exception of Special Chip, and it appears that the emulator has &amp;quot;game presets&amp;quot; stored in its own code, which determines more game-specific settings. The Special Chip can also be enabled by the game Preset ID. Each official VC release has [https://docs.google.com/spreadsheets/d/1PbIPVA4NpFEXs1zk249aR3FSuBTY3r-ajpTq3dP3GnQ/edit#gid=490971147 a different preset ID] in the header. The supported Special Chips are: DSP1, C4 and DSP2.  &lt;br /&gt;
&lt;br /&gt;
A similar structure can be found on Wii U, SNES Classic and Switch Mini emulator [https://gist.github.com/anpage/c1085055db0242ea3c7558dab56712a5]&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata contains:&lt;br /&gt;
* &amp;quot;KTR-XXXX.cfg&amp;quot;: Appears to contain the &amp;quot;preset ID&amp;quot; and possibly more game/save information.&lt;br /&gt;
* &amp;quot;KTR-XXXX.vea&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;KTR-XXXX.ves&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
&lt;br /&gt;
Filenames are determined in the ROM header.&lt;br /&gt;
&lt;br /&gt;
=GBA VC=&lt;br /&gt;
GBA VC is run by [[FIRM|AGB_FIRM]]. RomFS isn&#039;t used for GBA VC titles, but can be found empty within GBA VC titles. The NCCH [[ExeFS]] contains the same files as a normal application. The [[ExeFS]]:/.code contains the GBA VC ROM followed by a 0x360 byte long footer.&lt;br /&gt;
&lt;br /&gt;
===Footer===&lt;br /&gt;
All values in the GBA VC footer and related structures are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &#039;.CAA&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| 0x4&lt;br /&gt;
| Must be 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to array of config descriptors&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of config descriptors &amp;lt;&amp;lt; 4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Config descriptor====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| If 1, then this config descriptor is used. If 0, and the following value is not 0, then the GBA VC load fails outright (causes result 0xC900464F). Otherwise, this config descriptor is skipped.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to config&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Size of config (unused by the function that parses this, which hardcodes the config size (0x324) to memcpy)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Padding&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Config====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  0x4&lt;br /&gt;
|  GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x008&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x020&lt;br /&gt;
| 0x4&lt;br /&gt;
| LCD ghosting (01-FF, lower values equal more ghosting)&lt;br /&gt;
|-&lt;br /&gt;
| 0x024&lt;br /&gt;
| 0x300&lt;br /&gt;
| Video LUT (black to full, rgbrgbrgb...)?,&amp;lt;br/&amp;gt;three different types of this data have been observed.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Save types:&lt;br /&gt;
* 0x0: EEPROM 8k for &amp;lt; 256 Mbit games&lt;br /&gt;
* 0x1: EEPROM 8k for 256 Mbit games&lt;br /&gt;
* 0x2: EEPROM 64k for &amp;lt; 256 Mbit games&lt;br /&gt;
* 0x3: EEPROM 64k for 256 Mbit games&lt;br /&gt;
* 0x4: Flash 512k (Atmel, ID: 0x3D1F) + RTC&lt;br /&gt;
* 0x5: Flash 512k (Atmel, ID: 0x3D1F)&lt;br /&gt;
* 0x6: Flash 512k (SST, ID: 0xD4BF) + RTC&lt;br /&gt;
* 0x7: Flash 512k (SST, ID: 0xD4BF)&lt;br /&gt;
* 0x8: Flash 512k (Panasonic, ID: 0x1B32) + RTC&lt;br /&gt;
* 0x9: Flash 512k (Panasonic, ID: 0x1B32)&lt;br /&gt;
* 0xA: Flash 1Mbit (Macronix, ID: 0x09C2) + RTC&lt;br /&gt;
* 0xB: Flash 1Mbit (Macronix, ID: 0x09C2)&lt;br /&gt;
* 0xC: Flash 1Mbit (Sanyo, ID: 0x1362) + RTC&lt;br /&gt;
* 0xD: Flash 1Mbit (Sanyo, ID: 0x1362)&lt;br /&gt;
* 0xE: SRAM/FRAM 256k&lt;br /&gt;
&lt;br /&gt;
Everything above 0xE results in no save chip and nothing being saved to NAND.&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame===&lt;br /&gt;
AGB_FIRM saves its active save memory to NAND on exit, this is then immediately picked up by NATIVE_FIRM on reboot by checking [[CONFIG_Registers#CFG_BOOTENV|CFG_BOOTENV]]. From there, this is verified and copied out to SD (also see below). The savegame format is as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic (&#039;.SAV&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| AES-CMAC of the SHA256 hash of 0x30..0x200 + the entire save itself, keyslot 0x24, keyY from process9 .rodata&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of times saved (unused?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| AGB TitleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x10&lt;br /&gt;
| SD card CID from the console the save was made on (verified on load)&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save start addr (always 0x200)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save size&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0xFF (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x64&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 0x198&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame on SD===&lt;br /&gt;
A NAND savegame copied to the SD by process9 is identical to its counterpart on the NAND partition, save for the CMAC. For SD copies on retail units, the CMAC is recalculated as the AES-CMAC of the (SHA256 hash of (&amp;quot;CTR-SIGN&amp;quot; + AGB TitleID (little endian) + SHA256 hash of (&amp;quot;CTR-SAV0&amp;quot; + SHA256 hash of (0x30..0x200 + the entire save itself)))), using keyslot 0x30 set up with the keyY from movable.sed. For SD copies on devkit units, the CMAC is recalculated using the SHA256 hash of 0x30..0x200 + the entire save itself, using a different key from process9 .rodata.&lt;/div&gt;</summary>
		<author><name>Owowhatsthis</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=ARM7_Registers&amp;diff=21251</id>
		<title>ARM7 Registers</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=ARM7_Registers&amp;diff=21251"/>
		<updated>2020-05-24T19:59:11Z</updated>

		<summary type="html">&lt;p&gt;Owowhatsthis: Fix ARM7 AGB-related info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The 3DS utilizes an onboard ARM7 core to handle &amp;lt;code&amp;gt;TWL_FIRM&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;AGB_FIRM&amp;lt;/code&amp;gt;&#039;s ARM7 requirements. This is due to the fact that much of the hardware used by both ARM7 and ARM9 is (evidently) not physically hooked up to ARM11. Thus, ARM11 cannot simply emulate ARM7.&lt;br /&gt;
&lt;br /&gt;
ARM7 has the GBA BIOS implemented in hardware. The BIOS is completely identical to the original GBA BIOS. The system is booted silently by calling &amp;lt;code&amp;gt;SWI 0x1&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;RegisterRamReset&amp;lt;/code&amp;gt;), followed by jumping to the code that does &amp;lt;code&amp;gt;SWI 0x0&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;SoftReset&amp;lt;/code&amp;gt;) to finish booting. The boot splash is still in BIOS, however, and can be seen by calling or replacing one of the previous interrupts with &amp;lt;code&amp;gt;SWI 0x26&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;HardReset&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==Registers==&lt;br /&gt;
ARM9 interfaces with the ARM7 through the following registers:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Type&lt;br /&gt;
! Address&lt;br /&gt;
! Name&lt;br /&gt;
! Size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u8&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018000&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 1 &lt;br /&gt;
|-&lt;br /&gt;
| Code&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018080&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_CODE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 32&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018100&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_MODE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018104&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_MEMORY_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018108&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018110&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_VAL_DATE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018114&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_VAL_TIME&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018118&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_VAL_SETTINGS&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x1001811C&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_VAL_ADJUST&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018120&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_FLASH_CHIP_ERASE_CYCLES&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018124&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_FLASH_SECTOR_ERASE_CYCLES&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018128&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_FLASH_PROGRAM_CYCLES&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x1001812C&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_EEPROM_WRITE_CYCLES&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===ARM7_CNT===&lt;br /&gt;
This seems to control the mode of the ARM7. 1 = TWL, 2 = GBA.&lt;br /&gt;
&lt;br /&gt;
===ARM7_CODE===&lt;br /&gt;
This region is an arm7 bootrom overlay, over the vector table at address 0. Once the ARM7 is taken out of reset by &amp;lt;code&amp;gt;TwlProcess9&amp;lt;/code&amp;gt;, the reset vector will be jumped to, beginning execution. &amp;lt;code&amp;gt;TwlProcess9&amp;lt;/code&amp;gt; uses this to put ARM7 in a loop (TWL), and to set the &amp;lt;code&amp;gt;POSTFLG&amp;lt;/code&amp;gt; and branch to more copied code (GBA). Execution is started by writing &amp;lt;code&amp;gt;0x8001&amp;lt;/code&amp;gt; to [[CONFIG11_Registers#CFG11_TWLMODE_0|CFG11_TWLMODE_0]] after setting the mode via &amp;lt;code&amp;gt;ARM7_CNT&amp;lt;/code&amp;gt;. Later, this overlay is disabled by the ARM7 via the &amp;quot;biosprot&amp;quot; register (0x04000308).&lt;br /&gt;
&lt;br /&gt;
Reading uninitialized data in this 32-byte region leads to both screens displaying solid green (exception), and the CPU locking up.&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_MODE===&lt;br /&gt;
This tells the save storage emulation hardware which device type to emulate (64k EEPROM, a 512k Flash chip model, and SRAM are all that have been used officially; several other 512k Flash chip models, two 1 Mbit Flash chip models and 4k EEPROM are also supported). This comes directly from the [[3DS_Virtual_Console#Footer|ROM footer]].&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_MEMORY_CNT===&lt;br /&gt;
This register controls whether the GBA save memory region located at &amp;lt;code&amp;gt;0x08080000&amp;lt;/code&amp;gt; is accessible to ARM9 or to the ARM7 (via the emulated save chip). When it&#039;s set to 0x0 ARM7 has access, while ARM9 has access when it&#039;s set to 0x1.&lt;br /&gt;
&lt;br /&gt;
===ARM7_RTC_CNT===&lt;br /&gt;
This register controls the emulated RTC hardware and access to some of its registers.&lt;br /&gt;
To set or read the data from ARM7_RTC_VAL_SETTINGS or ARM7_RTC_VAL_ADJUST, first &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;&#039;s bit 15 is waited on. Next &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt; is set to zero. &lt;br /&gt;
&lt;br /&gt;
For a write: the two registers are written, a 1 is written to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, and it is waited on the same as before. Afterwards if bit 14 is not set in &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, the value was set successfully. This also starts the emulated RTC.&lt;br /&gt;
&lt;br /&gt;
For a read: a 2 is written to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, it&#039;s waited on again. Afterwards, if bit 14 is not set, the aforementioned registers can be read. Presumably the hardware can be re-enabled by writing a zero to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt; at this point, but &amp;lt;code&amp;gt;AGB_FIRM&amp;lt;/code&amp;gt; does not.&lt;br /&gt;
&lt;br /&gt;
===ARM7_RTC_VAL_DATE / ARM7_RTC_VAL_TIME===&lt;br /&gt;
These registers are set to the current LgyP9 date+time before the other RTC-related registers are used.&lt;br /&gt;
They contain the following structure, set up on the stack then both u32 registers are written one after the other:&lt;br /&gt;
&lt;br /&gt;
 s8 year_since_2000_bcd;&lt;br /&gt;
 s8 month_bcd;&lt;br /&gt;
 s8 day_bcd;&lt;br /&gt;
 s8 day_of_week;&lt;br /&gt;
 s8 hour_bcd;&lt;br /&gt;
 s8 minute_bcd;&lt;br /&gt;
 s8 second_bcd;&lt;br /&gt;
&lt;br /&gt;
===ARM7_RTC_VAL_SETTINGS===&lt;br /&gt;
This register appears to contain the emulated RTC chip&#039;s configuration (accessible via the &amp;quot;control&amp;quot; register on real hardware), containing settings like 12/24-hour mode. Access is controlled by &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt; (see above).&lt;br /&gt;
&lt;br /&gt;
===ARM7_RTC_VAL_ADJUST===&lt;br /&gt;
This register appears to contain the emulated RTC chip&#039;s time difference, relative to &amp;lt;code&amp;gt;ARM7_RTC_VAL_DATE&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;ARM7_RTC_VAL TIME&amp;lt;/code&amp;gt;, in seconds. Access is controlled by &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt; (see above).&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_FLASH_CHIP_ERASE_CYCLES===&lt;br /&gt;
This register seems to configure the emulated Flash chip to take a specified amount of time to complete a chip erase operation (relative to the DS&#039; ARM7/bus speed). Two variations exist in officially released games, one meant for 512k Flash chips and one for 1 Mbit Flash chips. It is copied from from rom footer + &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_FLASH_SECTOR_ERASE_CYCLES===&lt;br /&gt;
This register seems to configure the emulated Flash chip to take a specified amount of time to complete a sector erase operation (relative to the DS&#039; ARM7/bus speed). Two variations exist in officially released games, one meant for 512k Flash chips and one for 1 Mbit Flash chips. It is copied from from rom footer + &amp;lt;code&amp;gt;0x14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_FLASH_PROGRAM_CYCLES===&lt;br /&gt;
This register seems to configure the emulated Flash chip to take a specified amount of time to complete a program operation (relative to the DS&#039; ARM7/bus speed). Two variations exist in officially released games, one meant for 512k Flash chips and one for 1 Mbit Flash chips. It is copied from from rom footer + &amp;lt;code&amp;gt;0x18&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_EEPROM_WRITE_CYCLES===&lt;br /&gt;
This register seems to configure the emulated EEPROM chip to take a specified amount of time to complete a write operation (relative to the DS&#039; ARM7/bus speed). Two variations exist in officially released games, one meant for 64k EEPROM chips and one for 4k EEPROM chips. It is copied from from rom footer + &amp;lt;code&amp;gt;0x1C&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Memory map==&lt;br /&gt;
The virtual memory mapping for the ARM7 is the same as for the [[Memory_layout#TWL_FIRM_Userland_Memory|other core]]. However, it has additional internal memory mapped to it. Interestingly enough, much of this memory seems to lie within ARM9&#039;s own internal memory.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;0x08060000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x03800000&amp;lt;/code&amp;gt;, ARM7 WRAM (64KiB)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x080B0000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x03000000&amp;lt;/code&amp;gt;, GBA IWRAM (32KiB)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x08080000&amp;lt;/code&amp;gt; → EEPROM/SRAM/Flash 512k/Flash 1Mbit (the 2 512k banks are contiguous in memory). Access is controlled by &amp;lt;code&amp;gt;ARM7_SAVE_MEMORY_CNT&amp;lt;/code&amp;gt; (see above). &amp;lt;code&amp;gt;0x080C0000&amp;lt;/code&amp;gt; holds a mirror which is used by LgyP9 on boot to read the SD savedata before the mode switch, the data is then copied.&lt;br /&gt;
* &amp;lt;code&amp;gt;0x01FFC000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x01000000&amp;lt;/code&amp;gt;, ARM9 ITCM under TWL (16KiB)&lt;/div&gt;</summary>
		<author><name>Owowhatsthis</name></author>
	</entry>
</feed>