📄 nds specifications.htm
字号:
5-15 Not used
</PRE></TD></TR></TBODY></TABLE>For each pixel each R, G, B intensities are
calculated separately:<BR>
<TABLE>
<TBODY>
<TR>
<TD><PRE> I = I1st + (31-I1st)*EVY ;For Brightness Increase
I = I1st - (I1st)*EVY ;For Brightness Decrease
</PRE></TD></TR></TBODY></TABLE>The color intensities of any selected 1st target
surface(s) are increased or decreased by using the parameter in BLDY
register.<BR><BR><B>Semi-Transparent OBJs</B><BR>OBJs that are defined as
'Semi-Transparent' in OAM memory are always selected as 1st Target (regardless
of BLDCNT Bit 4), and are always using Alpha Blending mode (regardless of BLDCNT
Bit 6-7).<BR>The BLDCNT register may be used to perform Brightness effects on
the OBJ (and/or other BG/BD layers). However, if a semi-transparent OBJ pixel
does overlap a 2nd target pixel, then semi-transparency becomes priority, and
the brightness effect will not take place (neither on 1st, nor 2nd
target).<BR><BR><B>The OBJ Layer</B><BR>Before special effects are applied, the
display controller computes the OBJ priority ordering, and isolates the top-most
OBJ pixel. In result, only the top-most OBJ pixel is recursed at the time when
processing special effects. Ie. alpha blending and semi-transparency can be used
for OBJ-to-BG or BG-to-OBJ , but not for OBJ-to-OBJ.<BR><BR><BR>
<TABLE width="100%">
<TBODY>
<TR bgColor=#cccccc>
<TD><A name=lcdvramoverview></A><FONT size=+2> LCD VRAM
Overview</FONT></TD></TR></TBODY></TABLE><BR>The GBA contains 96 Kbytes VRAM
built-in, located at address 06000000-06017FFF, depending on the BG Mode used as
follows:<BR><BR><B>BG Mode 0,1,2 (Tile/Map based Modes)</B><BR>
<TABLE>
<TBODY>
<TR>
<TD><PRE> 06000000-0600FFFF 64 KBytes shared for BG Map and Tiles
06010000-06017FFF 32 KBytes OBJ Tiles
</PRE></TD></TR></TBODY></TABLE>The shared 64K area can be split into BG Map
area(s), and BG Tiles area(s), the respective addresses for Map and Tile areas
are set up by BG0CNT-BG3CNT registers. The Map address may be specified in units
of 2K (steps of 800h), the Tile address in units of 16K (steps of
4000h).<BR><BR><B>BG Mode 0,1 (Tile/Map based Text mode)</B><BR>The tiles may
have 4bit or 8bit color depth, minimum map size is 32x32 tiles, maximum is 64x64
tiles, up to 1024 tiles can be used per map.<BR>
<TABLE>
<TBODY>
<TR>
<TD><PRE> Item Depth Required Memory
One Tile 4bit 20h bytes
One Tile 8bit 40h bytes
1024 Tiles 4bit 8000h (32K)
1024 Tiles 8bit 10000h (64K) - excluding some bytes for BG map
BG Map 32x32 800h (2K)
BG Map 64x64 2000h (8K)
</PRE></TD></TR></TBODY></TABLE><BR><B>BG Mode 1,2 (Tile/Map based
Rotation/Scaling mode)</B><BR>The tiles may have 8bit color depth only, minimum
map size is 16x16 tiles, maximum is 128x128 tiles, up to 256 tiles can be used
per map.<BR>
<TABLE>
<TBODY>
<TR>
<TD><PRE> Item Depth Required Memory
One Tile 8bit 40h bytes
256 Tiles 8bit 4000h (16K)
BG Map 16x16 100h bytes
BG Map 128x128 4000h (16K)
</PRE></TD></TR></TBODY></TABLE><BR><B>BG Mode 3 (Bitmap based Mode for still
images)</B><BR>
<TABLE>
<TBODY>
<TR>
<TD><PRE> 06000000-06013FFF 80 KBytes Frame 0 buffer (only 75K actually used)
06014000-06017FFF 16 KBytes OBJ Tiles
</PRE></TD></TR></TBODY></TABLE><BR><B>BG Mode 4,5 (Bitmap based Modes)</B><BR>
<TABLE>
<TBODY>
<TR>
<TD><PRE> 06000000-06009FFF 40 KBytes Frame 0 buffer (only 37.5K used in Mode 4)
0600A000-06013FFF 40 KBytes Frame 1 buffer (only 37.5K used in Mode 4)
06014000-06017FFF 16 KBytes OBJ Tiles
</PRE></TD></TR></TBODY></TABLE><BR><B>Note</B><BR>Additionally to the above
VRAM, the GBA also contains 1 KByte Palette RAM (at 05000000h) and 1 KByte OAM
(at 07000000h) which are both used by the display controller as
well.<BR><BR><BR>
<TABLE width="100%">
<TBODY>
<TR bgColor=#cccccc>
<TD><A name=lcdvramcharacterdata></A><FONT size=+2> LCD VRAM
Character Data</FONT></TD></TR></TBODY></TABLE><BR>Each character (tile)
consists of 8x8 dots (64 dots in total). The color depth may be either 4bit or
8bit (see BG0CNT-BG3CNT).<BR><BR><B>4bit depth (16 colors, 16
palettes)</B><BR>Each tile occupies 32 bytes of memory, the first 4 bytes for
the topmost row of the tile, and so on. Each byte representing two dots, the
lower 4 bits define the color for the left (!) dot, the upper 4 bits the color
for the right dot.<BR><BR><B>8bit depth (256 colors, 1 palette)</B><BR>Each tile
occupies 64 bytes of memory, the first 8 bytes for the topmost row of the tile,
and so on. Each byte selects the palette entry for each dot.<BR><BR><BR>
<TABLE width="100%">
<TBODY>
<TR bgColor=#cccccc>
<TD><A name=lcdvrambgscreendataformatbgmap></A><FONT size=+2> LCD
VRAM BG Screen Data Format (BG Map)</FONT></TD></TR></TBODY></TABLE><BR>The
display background consists of 8x8 dot tiles, the arrangement of these tiles is
specified by the BG Screen Data (BG Map). The separate entries in this map are
as follows:<BR><BR><B>Text BG Screen (2 bytes per entry)</B><BR>Specifies the
tile number and attributes. Note that BG tile numbers are always specified in
steps of 1 (unlike OBJ tile numbers which are using steps of two in 256 color/1
palette mode).<BR>
<TABLE>
<TBODY>
<TR>
<TD><PRE> Bit Expl.
0-9 Tile Number (0-1023) (a bit less in 256 color mode, because
there'd be otherwise no room for the bg map)
10 Horizontal Flip (0=Normal, 1=Mirrored)
11 Vertical Flip (0=Normal, 1=Mirrored)
12-15 Palette Number (0-15) (Not used in 256 color/1 palette mode)
</PRE></TD></TR></TBODY></TABLE>A Text BG Map always consists of 32x32 entries
(256x256 pixels), 400h entries = 800h bytes. However, depending on the BG Size,
one, two, or four of these Maps may be used together, allowing to create
backgrounds of 256x256, 512x256, 256x512, or 512x512 pixels, if so, the first
map (SC0) is located at base+0, the next map (SC1) at base+800h, and so
on.<BR><BR><B>Rotation/Scaling BG Screen (1 byte per entry)</B><BR>In this mode,
only 256 tiles can be used. There are no x/y-flip attributes, the color depth is
always 256 colors/1 palette.<BR>
<TABLE>
<TBODY>
<TR>
<TD><PRE> Bit Expl.
0-7 Tile Number (0-255)
</PRE></TD></TR></TBODY></TABLE>The dimensions of Rotation/Scaling BG Maps
depend on the BG size. For size 0-3 that are: 16x16 tiles (128x128 pixels),
32x32 tiles (256x256 pixels), 64x64 tiles (512x512 pixels), or 128x128 tiles
(1024x1024 pixels).<BR><BR>The size and VRAM base address of the separate BG
maps for BG0-3 are set up by BG0CNT-BG3CNT registers.<BR><BR><BR>
<TABLE width="100%">
<TBODY>
<TR bgColor=#cccccc>
<TD><A name=lcdvrambitmapbgmodes></A><FONT size=+2> LCD VRAM Bitmap
BG Modes</FONT></TD></TR></TBODY></TABLE><BR>In BG Modes 3-5 the background is
defined in form of a bitmap (unlike as for Tile/Map based BG modes). Bitmaps are
implemented as BG2, with Rotation/Scaling support. As bitmap modes are occupying
80KBytes of BG memory, only 16KBytes of VRAM can be used for OBJ
tiles.<BR><BR><B>BG Mode 3 - 240x160 pixels, 32768 colors</B><BR>Two bytes are
associated to each pixel, directly defining one of the 32768 colors (without
using palette data, and thus not supporting a 'transparent' BG color).<BR>
<TABLE>
<TBODY>
<TR>
<TD><PRE> Bit Expl.
0-4 Red Intensity (0-31)
5-9 Green Intensity (0-31)
10-14 Blue Intensity (0-31)
15 Not used
</PRE></TD></TR></TBODY></TABLE>The first 480 bytes define the topmost line, the
next 480 the next line, and so on. The background occupies 75 KBytes
(06000000-06012BFF), most of the 80 Kbytes BG area, not allowing to redraw an
invisible second frame in background, so this mode is mostly recommended for
still images only.<BR><BR><B>BG Mode 4 - 240x160 pixels, 256 colors (out of
32768 colors)</B><BR>One byte is associated to each pixel, selecting one of the
256 palette entries. Color 0 (backdrop) is transparent, and OBJs may be
displayed behind the bitmap.<BR>The first 240 bytes define the topmost line, the
next 240 the next line, and so on. The background occupies 37.5 KBytes, allowing
two frames to be used (06000000-060095FF for Frame 0, and 0600A000-060135FF for
Frame 1).<BR><BR><B>BG Mode 5 - 160x128 pixels, 32768 colors</B><BR>Colors are
defined as for Mode 3 (see above), but horizontal and vertical size are cut down
to 160x128 pixels only - smaller than the physical dimensions of the LCD
screen.<BR>The background occupies exactly 40 KBytes, so that BG VRAM may be
split into two frames (06000000-06009FFF for Frame 0, and 0600A000-06013FFF for
Frame 1).<BR><BR>In BG modes 4,5, one Frame may be displayed (selected by
DISPCNT Bit 4), the other Frame is invisible and may be redrawn in
background.<BR><BR><BR>
<TABLE width="100%">
<TBODY>
<TR bgColor=#cccccc>
<TD><A name=lcdobjoverview></A><FONT size=+2> LCD OBJ -
Overview</FONT></TD></TR></TBODY></TABLE><BR><B>General</B><BR>Objects (OBJs)
are moveable sprites. Up to 128 OBJs (of any size, up to 64x64 dots each) can be
displayed per screen, and under best circumstances up to 128 OBJs (of small 8x8
dots size) can be displayed per horizontal display line.<BR><BR><B>Maximum
Number of Sprites per Line</B><BR>The total available OBJ rendering cycles per
line are<BR>
<TABLE>
<TBODY>
<TR>
<TD><PRE> 1210 (=304*4-6) If "H-Blank Interval Free" bit in DISPCNT register is 0
954 (=240*4-6) If "H-Blank Interval Free" bit in DISPCNT register is 1
</PRE></TD></TR></TBODY></TABLE>The required rendering cycles are (depending on
horizontal OBJ size)<BR>
<TABLE>
<TBODY>
<TR>
<TD><PRE> Cycles per <n> Pixels OBJ Type OBJ Type Screen Pixel Range
n*1 cycles Normal OBJs 8..64 pixels
10+n*2 cycles Rotation/Scaling OBJs 8..64 pixels (area clipped)
10+n*2 cycles Rotation/Scaling OBJs 16..128 pixels (double size)
</PRE></TD></TR></TBODY></TABLE>Caution:<BR>The maximum number of OBJs per line
is also affected by undisplayed (offscreen) OBJs which are having higher
priority than displayed OBJs.<BR>To avoid this, move displayed OBJs to the begin
of OAM memory (ie. OBJ0 has highest priority, OBJ127 lowest).<BR>Otherwise (in
case that the program logic expects OBJs at fixed positions in OAM) at least
take care to set the OBJ size of undisplayed OBJs to 8x8 with Rotation/Scaling
disabled (this reduces the overload).<BR>Does the above also apply for
VERTICALLY OFFSCREEN (or VERTICALLY not on CURRENT LINE) sprites
???<BR><BR><B>VRAM - Character Data</B><BR>OBJs are always combined of one or
more 8x8 pixel Tiles (much like BG Tiles in BG Modes 0-2). However, OBJ Tiles
are stored in a separate area in VRAM: 06010000-06017FFF (32 KBytes) in BG Mode
0-2, or 06014000-06017FFF (16 KBytes) in BG Mode 3-5.<BR>Depending on the size
of the above area (16K or 32K), and on the OBJ color depth (4bit or 8bit),
256-1024 8x8 dots OBJ Tiles can be defined.<BR><BR><B>OAM - Object Attribute
Memory</B><BR>This memory area contains Attributes which specify position, size,
color depth, etc. appearance for each of the 128 OBJs. Additionally, it contains
32 OBJ Rotation/Scaling Parameter groups. OAM is located at 07000000-070003FF
(sized 1 KByte).<BR><BR><BR>
<TABLE width="100%">
<TBODY>
<TR bgColor=#cccccc>
<TD><A name=lcdobjoamattributes></A><FONT size=+2> LCD OBJ - OAM
Attributes</FONT></TD></TR></TBODY></TABLE><BR><B>OBJ Attributes</B><BR>There
are 128 entries in OAM for each OBJ0-OBJ127. Each entry consists of 6 bytes
(three 16bit Attributes). Attributes for OBJ0 are located at 07000000, for OBJ1
at 07000008, OBJ2 at 07000010, and so on.<BR><BR>As you can see, there are blank
spaces at 07000006, 0700000E, 07000016, etc. - these 16bit values are used for
OBJ Rotation/Scaling (as described in the next chapter) - they are not directly
related to the separate OBJs.<BR><BR><B>OBJ Attribute 0 (R/W)</B><BR>
<TABLE>
<TBODY>
<TR>
<TD><PRE> Bit Expl.
0-7 Y-Coordinate (0-255)
8 Rotation/Scaling Flag (0=Off, 1=On)
When Rotation/Scaling used (Attribute 0, bit 8 set):
9 Double-Size Flag (0=Normal, 1=Double)
When Rotation/Scaling not used (Attribute 0, bit 8 cleared):
9 OBJ Disable (0=Normal, 1=Not displayed)
10-11 OBJ Mode (0=Normal, 1=Semi-Transparent, 2=OBJ Window, 3=Prohibited)
12 OBJ Mosaic (0=Off, 1=On)
13 Colors/Palettes (0=16/16, 1=256/1)
14-15 OBJ Shape (0=Square,1=Horizontal,2=Vertical,3=Prohibited)
</PRE></TD></TR></TBODY></TABLE>Caution: A very large OBJ (of 128 pixels
vertically, ie. a 64 pixels OBJ in a Double Size area) located at Y>128 will
be treated as at Y>-128, the OBJ is then displayed parts offscreen at the TOP
of the display, it is then NOT displayed at the bottom.<BR><BR><B>OBJ Attribute
1 (R/W)</B><BR>
<TABLE>
<TBODY>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -