Name Start Address Stop Address Size Wait State
Main 0x02000000 0x023FFFFF 4MB ?
ITCM 0x00000000 0x00007FFF 32KB ?
DTCM 0x0B000000 0x0B003FFF 16KB ?
Shared WRAM Bank 0 0x03000000 0x03003FFF 16KB ?
Shared WRAM Bank 1 0x03004000 0x03007FFF 16KB ?
Main 0x02000000 0x023FFFFF 4MB ?
BIOS 0x00000000 0x00003FFF 16KB ?
IWRAM 0x03800000 0x0380FFFF 64KB ?
Shared WRAM Bank 0 0x03000000 0x03003FFF 16KB ?
Shared WRAM Bank 1 0x03004000 0x03007FFF 16KB ?
Video RAM
Main OAM 0x07000000 0x070003FF 1KB ?
Sub OAM 0x07000400 0x070007FF 1KB ?
Main Palette 0x05000000 0x050003FF 1KB ?
Sub Palette 0x05000400 0x050007FF 1KB ?
Bank A 0x06800000 0x0681FFFF 128KB ?
Bank B 0x06820000 0x0683FFFF 128KB ?
Bank C 0x06840000 0x0685FFFF 128KB ?
Bank D 0x06860000 0x0687FFFF 128KB ?
Bank E 0x06880000 0x0688FFFF 64KB ?
Bank F 0x06890000 0x06983FFF 16KB ?
Bank G 0x06894000 0x06897FFF 16KB ?
Bank H 0x06898000 0x0689FFFF 32KB ?
Bank I 0x068A0000 0x068A3FFF 16KB ?
Virtual Video RAM
Main Background 0x06000000 0x0607FFFF 512KB ?
Sub Background 0x06200000 0x0621FFFF 128KB
Main Sprite 0x06400000 0x0643FFFF 256KB ?
Sub Sprite 0x06600000 0x0661FFFF 128KB ?

Main Memory

Start Address : 0x0200:0000 
End Address :   0x023F:FFFF 
Mirror :        0x0240:0000

ARM7跟ARM9在任何時候都可以去存取這塊記憶體.ARM7在預設的優先權比較高,但是可以透過Control register去改變。
既使可以同時從這裡面執行ARM7跟ARM9的程式,但是為了效率,devkitPro預設是把ARM7的程式放在ARM7 FAST Ram(IWRAM)裡.官方正版的遊戲通常都是把ARM7跟ARM9放在Main Memory中,然後再把ARM7的程式拷貝到IWRAM裡面。

ARM 7 Fast Ram (IWRAM)

Start Address : 0x03800000 
End Address :  0x0380FFFF

ARM7專用的64KB來放fast 32bit wide memory用的。這個區域包含了ARM7的執行檔跟資料。設計的ARM7代碼時,要注意讓binary小一點。

ARM 9 Caches

ARM9包含了一個資料快取跟一個指令快取。 Although the operation of these caches is a bit complex and really out of scope for this document a few things are worth noting.

Main memory is cacheable by default. This means all data and code being accessed from main memory will be stored temporarily in the cache. Because the DMA circuitry and the ARM7 do not have access to the cache often you will get unexpected results if you attempt to DMA from main memory or share data between ARM7 and ARM9 via main memory.

To help utilize the cache effectively the mirror of main memory that begins above 0x02400000 is not cacheable. There are also several functions provided by the library which allow you to flush the data cache and ensure main memory is in sync.

Although the cache adds a certain level of complexity its boost to performance is well worth this small inconvenience.

Fast Shared Ram

There are two small 16KB banks of fast 32 bit ram that can be assigned to the ARM7 or ARM9. Access to either block by both CPUs at the same time is prohibited. Commonly, both banks will be mapped to the ARM7 as they form a continuous block with ARM7 IWRAM effectively giving the ARM7 96KB of ram.

Video Ram

The Nintendo DS has nine banks of video memory which may be put to a variety of uses. They can hold the graphics for your sprites, the textures for your 3D space ships, the tiles for your 2D platformer, or a direct map of pixels to render to the screen. Figuring out how to effectively utilize this flexible but limited amount of memory will be one the most challenging endeavors you will face in your first few days of homebrew.

Below is a table of the banks along with a description as to what uses they can be put. You should not worry about understanding this at the moment but it might be handy to bookmark or print out for later use.

View large intimidating table

Virtual Video Ram

In order for the 2D systems to function they need RAM. One of the major differences between the 2D graphics engine on the Gameboy Advanced and those on the DS is the DS has almost no memory dedicated to the 2D system. Instead of setting aside a given amount of video memory for the 2D system it allows you to map the video RAM banks into 2D engine memory space.

This might be a bit difficult to grasp at first. An example might be helpful.

Scenario: You want to render a tile based map to the screen using the main 2D graphics engine.

Because you are an uber Nintendo DS programmer you already know two things:

  1. Where the 2D graphics engine expects the map and tile data to be
  2. What video RAM banks can be mapped to this “virtual” 2D graphics memory to hold your tiles and map.

Solution: Tell the Nintendo DS to map a video RAM bank to the right place…in this case we might map video RAM bank A (VRAM_A) to 0x6000000 for use as 2D background memory but we could have chosen another bank (turns out almost all vram banks can be mapped to main background memory).


We will revisit this topic when we create our first few 2D demos.




WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 / 變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 / 變更 )


您的留言將使用 Facebook 帳號。 登出 / 變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 / 變更 )

連結到 %s