This document contains confidential and proprietary information
of Nintendo and is also protected under the copyright laws of
the United States and other countries. No part of this document
may be released, distributed, transmitted or reproduced in any
form or by any electronic or mechanical means, including
information storage and retrieval systems, without permission in
writing from Nintendo.
Game Boy Advanced (AGB) stresses portability and focuses on 2D rather than 3D image
processing functions, resulting in a cutting-edge portable game device with revolutionary
capabilities.
It provides window-like functions, rotation, scaling, α blending, and fade-in/fade-out
features that can be combined to produce exactly the image representations desired.
Additionally, the bitmap image-rendering function, with its two modes (double buffering
mode for rewriting full-screen images in real time and single buffering mode for stills), can
be used to handle realistic images that are indistinguishable from actual photographs.
The 2.9-inch-wide reflective TFT color LCD screen provides a clear display with little
afterimage.
In addition to Game Boy Color compatible sound, AGB has a PCM stereo sound generator.
Multiple tracks can be played simultaneously by overlapping them using the CPU. L and R
buttons have been added to the Controller. The broader range of control provided also
expands the breadth of game designs possible.
Although AGB uses a 32-bit RISC CPU whose computing performance and data processing
capabilities far surpass those of Game Boy Color, it consumes little power, allowing
approximately 15 hours of continuous play. This is made possible by the inclusion of the various
types of RAM on a single custom chip.
Furthermore, software for AGB can be developed using the C language, minimizing the
cost of development equipment. This favorable development environment and the high
level of freedom of the system configuration allow one to build a profound world of play in
which anyone can become absorbed.
With its extremely high-performance computational and data processing capabilities as a
foundation, AGB provides greater image and sound representation capabilities, making the
pursuit of fun its essential aim.
The purpose of this high level of performance is to bring unique game ideas fully to life.
AGB is an innovation born from experience. While providing backwards compatibility with
the enormous software resources available for the 100 million Game Boy units in use
worldwide, it also breaks new ground for portable game devices.
0.3.6.212/21/1999-Minor modification. ( Numbering for items: P81,P82,P149),
(Reference to chapter removed)
-Deleted 14.3
0.3.6.301/05/2000-Minor modification.
-Corrected BG Offset Registers diagrams
-Corrected the diagrams of Registers for Setting the Direction
Parameters of BG data.
-Corrected diagram of the Sound 1 Duty Cycle.
-Corrected the name of d05 bit for the DISPCNT Register.
-Added the description of Bit map BG mode.
-Corrected the SIO Timing Chart of Normal Serial Communication.
-Changed the diagrams and descriptions of the Sound Control
Registers.
-Added the formula for calculating the number of OBJs that can
be displayed on 1 line.
0.4.001/25/2000
-Changed specifications.
*Changed CPU internal working RAM memory capacity, and
created CPU external working RAM.
*Changed the bit structures of DMA control registers.
*Deleted Infrared Communication functions.
*Created the interrupt IME register, and changed the bit
structures of IE and IF registers.
*Changed the number of colors that can be displayed to 32,768.
*Changed the specifications of Normal Serial Communication
(Bit width, communication speed)
*Changed the specifications of Multi SIO Communication (UART
system).
*Changed the center coordinate of OBJ Rotation to dot
boundary.
*Added UART system communication function.
02/09/2000
0.4.102/22/2000
-Added the Complete Block Diagram.
-Modified the description of Direct Sounds, and corrected
register
02/24/2000
02/25/2000
R bit structure.
-Added the PWM sampling cycle control function.
-Changed the method to specify OBJ size.
-Corrected misprints in the communication control register.
0.4.1.103/08/2000
03/10/2000
-Added the description of ROM registration data.
-Improved the description of interrupt and multiple interrupt
process.
03/10/2000
-Improved the description of system call and multiple system call
process.
0.4.1.204/06/2000-Added the description of UART system communication.
1.012/01/2000-Deleted the checksum of ROM registration data and revised the
diagram.
-Revised the diagram for "AGB Game Link Cable" in the "Communication
Function".
-Revised the number of DMG sold from tens of millions to a hundred
million in the introduction of AGB.
-Revised the hours you can play continuously from "about 20 hours" to
"about 15 hours".
-Revised the illustrations of the AGB hardware and the Multi Player AGB
Game Link cable in the multi play communication diagram.
-Added the description of the timing chart for normal SIO communication.
-Added a caution in the DMA valid flag of all the DMA control registers.
-Added a caution in the master start bit of the multi-play control register.
-Revised the multi-play timing chart.
-Revised the memory map for system reserve area in the work RAM.
-Added a caution to "Communication Function".
-Revised the first sentence in "UART Communication". Added "Relation
between Data register, FIFO and Shift register".
-Revised the expression of [Cautions] to a more specific expression
[Cautions for ~~].
-Added a description of X coordinate and Y coordinate for OAM. Added
the diagram to Y coordinate.
-Revised the description of the pre-fetch buffer flag in the Game Pak
memory wait control register.
-Added cautions to the description of the input/output select flag in the R
register of general communication.
1.012/01/2001-Modified the description of pin 31 in the Game Pak bus.
-Revised the cancel conditions for the Stop function in the power-down
mode.
-Added additional descriptions and cautions for the initialization flag of
Sound 1.
1.022/13/2001-Modified the description of "8-Bit/32-Bit Normal Communication Function"
summary in "Communication" chapter.
-Added a paragraph to "Selecting Communication Function" in
"Communication" chapter.
1.043/1/2001-Specified the method to control the OBJ display individually in
the description of the double size flag and the rotation/scaling
flag for OAM attribute 0.
-Added the description of display synchronization DMA to DMA3.
-Added the description of the DMA problem and how to avoid it at the end
of the chapter on DMA.
*Added the restrictions to the description of the repeat flag in DMA3.
*Updated the timing chart and the cable connection diagram for the multiplay communication.
*Revised the description of the normal serial communication cautions.
AGB is a portable game device that maintains downward compatibility with Game Boy
Color (CGB) and provides higher performance.
AGB’s 2.9-inch-wide reflective TFT color LCD and 32-bit RISC CPU enable production
of games that match or surpass the Super Nintendo Entertainment System (Super
NES) in performance.
AGB CPU
32-bit RISC CPU (ARM7TDMI)/16.78 MHz
Downward Compatibility with CGB
Integral 8-bit CISC CPU for compatibility
(However, it cannot operate at the same time as the AGB CPU.)
Memory
System ROM16 Kbytes (and 2 Kbytes for CGB System ROM)
Working RAM32 Kbytes + CPU External 256 Kbytes (2 wait)
VRAM96 Kbytes
OAM64 bits x 128
Palette RAM16 bits x 512 (256 colors for OBJ ;
256 colors for BG)
Game Pak
memory
Up to 32 MB: mask ROM or flash memory
(&EEPROM)
+
Up to 512 Kbits: SRAM or flash memory
Display
240 x 160 x RGB dots
32,768 colors simultaneously displayable
Special effects features (rotation/scaling, α blending, fade-in/fade-out, and mosaic)
4 image system modes
Operation
Operating keys (A, B, L, R, START, SELECT, and Control Pad)
Sound
4 sounds (corresponding to CGB sounds) + 2 CPU direct sounds (PCM format)
Communication
Serial communication (8 bit/32 bit, UART, Multi-player, General-purpose, JOY Bus)
Like DMG and CGB, AGB is equipped with a 32-pin connector for Game Pak
connection. When a Game Pak is inserted, AGB automatically detects its type and
switches to either CGB or AGB mode.
The following Game Paks operate on the AGB system.
1.DMG Game Paks, DMG/CGB dual mode Game Paks, and CGB dedicated Game
Paks
2.AGB dedicated Game Paks(Game Paks that only function with AGB)
OAM3216/3216/3216/3216/32
Palette RAM1616/3216/3216/3216/32
VRAM1616/3216/3216/3216/32
CPU Internal Working RAM3216/3216/328/16/328/16/32
CPU External Working RAM1616/3216/328/16/328/16/32
Internal registers3216/3216/328/16/328/16/32
Game Pak ROM
1616/3216/328/16/3216/32
(Mask ROM, Flash Memory)
Game Pak RAM
8----88
(SRAM, Flash Memory)
Good execution efficiency is obtained when programs that operate from the Game Pak
use 16-bit instructions (16-bit compiler), and those that operate from CPU Internal
Working RAM use 32-bit instructions (32-bit compiler).
2.4 Little- Endian
In the AGB CPU, memory addresses are allocated in 8-bit increments, and littleendian format is used in implementing the 8-, 16-, and 32-bit access widths.
Three 32 MB Game Pak ROM spaces are allocated to the area beginning
from 08000000h.
The access speed of each of these spaces can be set individually. Thus,
they are named Wait State 0, Wait State 1, and Wait State 2.
This specification enables memory of varying access speeds in Game Pak
ROM to be accessed optimally.
The base addresses of the 3 spaces are 08000000h for Wait State 0,
0A000000h for Wait State 1, and 0C000000h for Wait State 2.
In addition, the upper 1 Mbit of each space is allocated as flash memory.
This area is used primarily for saving data.
2) Game Pak RAM
The area beginning from 0E000000h is the Game Pak RAM area. Up to
512 Kbits of SRAM or Flash Memory can be stored here. However, it is an
8 bit data bus. Due to the specifications, any Game Pak device other than
ROM must be accessed using Nintendo's library.
Although the 32 MB Game Pak memory space is mapped to the area from 08000000h
onward, the 32 MB spaces beginning from 0A000000h and 0C000000h are images of
the 32 MB space that starts at 08000000h.
These images enable memory to be used according to the access speed of the Game
Pak memory (1-4 wait cycles).
AddressRegisterAttributes
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
WAITCNT204h0000hR/W
Game Pak RAM
Wait Control
Wait State 0
Wait Control
Wait State 1
Wait Control
Wait State 2
Wait Control
PHI Terminal Output Control
00: No Output
01: 4.19 MHz clock
10: 8.38 MHz clock
11: 16.76 MHZ clock
Prefetch Buffer Flag
0: Disabled
1: Enabled
Game Pak Type Flag
Value
WAITCNT [d15] Game Pak Type Flag
The System ROM uses this.
WAITCNT [d14] Prefetch Buffer Flag
When the Prefetch Buffer Flag is enabled and there is some free space,
the Prefetch Buffer takes control of the Game Pak Bus during the time
when the CPU is not using it, and reads Game Pak ROM data repeatedly.
When the CPU tries to read instructions from the Game Pak and if it hits
the Prefetch Buffer, the fetch is completed with no wait in respect to the
CPU. If there is no hit, the fetch is done from the Game Pak ROM and
there is a wait based on the set wait state.
If the Prefetch Buffer Flag is disabled, the fetch is done from the Game Pak
ROM. There is a wait based on the wait state associated with the fetch
instruction to the Game Pak ROM in respect to the CPU.
WAITCNT [d12 - 11] PHI Terminal Output Control
Controls the output from the PHI terminal. This should always be set to
00(No Output).
WAITCNT [d10 - 08],[d07 - 05],[d04 - 02] Wait State Wait Control
Individual wait cycles for each of the three areas(Wait States 0-2) that
occur in Game Pak ROM can be set. The relation between the wait control
settings and wait cycles is as follows. Use the appropriate settings for the
device you are using.
After executing the System ROM (when the User Program is started) the Wait
Control Value is 000. In the Game Pak Mask ROM used with the actual
manufactured product, the specifications are 1st Access/3 Wait, 2nd Access/1 Wait.
In this case, set the Wait Control Value to 101.
WAITCNT [d01 - 00] Game Pak RAM Wait Control
Wait cycles for the Game Pak RAM can be set. The relation between the
wait control settings and wait cycles is as follows. Use the appropriate
settings for the device you are using.
General LCD status information can be read from bits 0-5 of the
DISPSTAT register.
In addition, 3 types of interrupt requests can be generated by the LCD
controller.
AddressRegister
004h
DISPSTAT
DISPSTAT [d15-08] V Count Setting
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
V-Blank Status
V count setting
0-227
V-Blank Interrupt Request Enable Flag
0: Disable
1: Enable
H-Blank Interrupt Request Enable Flag
0: Disable
1: Enable
V Counter Match Interrupt Request Enable Flag
0: Disable
1: Enable
0: Outside V-blank interval
1: During V-blank interval
H-Blank Status
0: Outside H-blank interval
1: During H-blank interval
V Counter Evaluation
0: V counter non-match
1: V counter match
Attributes
R/W
Initial Value
0000h
Can be used to set the value used for V counter evaluation and V counter
match interrupts. The range for this setting is 0-227.
DISPSTAT [d05] V Counter Match Interrupt Request Enable Flag
Allows an interrupt request to be generated when the value of the V counter
setting and the value of the line actually rendered (VCOUNT register value)
agree.
DISPSTAT [d04] H-Blank Interrupt Request Enable Flag
Allows an interrupt request to be generated during horizontal blanking.
DISPSTAT [d03] V-Blank Interrupt Request Enable Flag
Allows an interrupt request to be generated during vertical blanking.
Flag indicating whether the V count setting and the V count register value
match. It is set while they match and automatically reset when they no
longer match.
DISPSTAT [d01] H-Blank Status
Can check whether a horizontal blanking interval is currently in effect.
DISPSTAT [d00] V-Blank Status
Can check whether a vertical blanking interval is currently in effect.
AGB can use different image systems depending on the purpose of the software.
These display-related items are changed mainly using the DISPCNT register.
Setting this bit causes the CPU to forcibly halt operation of the image
processing circuit, allowing access to VRAM, color palette RAM, OAM, and
the internal registers. The LCD screen displays white during a forced
blank. However, the internal HV synchronous counter continues to operate
even during a forced blank. When the internal HV synchronous counter
cancels a forced blank during a display period, the display begins from the
beginning, following the display of three vertical lines.
DISPCNT [d06] OBJ Character VRAM Mapping Format
Specifies the VRAM mapping format for an OBJ character.
A setting of 0 causes the OBJ character to be handled in memory mapped
2-dimensional. A setting of 1 causes the OBJ character to be handled in
memory mapped 1-dimensional.
For information on OBJ character VRAM mapping formats, see section
6.3.2, Character Data Mapping.
DISPCNT [d05] H-Blank Interval OBJ Processing Flag
A setting of 0 executes OBJ Render Processing with all H-Line
intervals(including H-Blank intervals).
A setting of 1 executes OBJ Render Processing with the display intervals
only and not for H-Blank intervals. Thus, when the user accesses OAM or
OBJ VRAM during an H-Blank interval, this bit needs to be set. However,
also in this situation, maximum OBJ display performance cannot be
obtained.
DISPCNT [d04] Display Frame Selection
When rendering in bitmap format in a mode in which there are 2 frame
buffers (BG modes 4 and 5), this bit allows selection of one of the frame
buffers for rendering. A setting of 0 selects the contents of frame buffer 0
for rendering; a setting of 1 selects the contents of frame buffer 1 for
rendering.
DISPCNT [d03] (CGB Mode)
AGB is equipped with 2 CPUs. In AGB mode, a 32-bit RISC CPU starts,
and in CGB mode, an 8-bit CISC CPU starts. Because this bit is
controlled by the system, it cannot be accessed by the user.
DISPCNT [d02-00] BG Mode
Selects the BG mode from a range of 0-5.
For more information on BG modes, see the following section.
[Note]
In mode 3, one frame memory is available that can display 32,768 colors, which is suitable for
rendering still images. Modes 4 and 5 allow double buffering using two frame memories, and are
thus suitable for rendering animated video.
The method of controlling text BG scrolling is different from that of BG rotation/scaling and
bitmap BG scrolling. (See “6.1.8 BG Scrolling” and “6.1.7 BG Rotation and Scaling Features”.)
The VRAM (96 Kbyte) memory maps in the BG modes are as shown in the
following figure.
BG Modes 0, 1, and 2BG Mode 3BG Modes 4 and 5
06017FFFh
06010000h
OBJ
Character Data
32 Kbytes
06014000h
OBJ
Character Data
16 Kbytes
06014000h
OBJ
Character Data
16 Kbytes
Frame Buffer 1
40 Kbytes
06000000h
BG0-BG3
Screen Data
Maximum 32 Kbytes
and
BG0-BG3 Shared
Character Data
Minimum 32 Kbytes
Frame Buffer 0
80 Kbytes
0600A000h
Frame Buffer 0
40 Kbytes
Users can map the screen and character data areas in the 64 Kbyte BG
area in BG modes 0, 1, and 2. For more information, see section 6.1.3,
VRAM Address Mapping of BG Data.
In addition, see the descriptions below for more information on the memory
areas and the data formats for each area.
When the display screen overflows the boundaries of the virtual screen
due to a rotation/scaling operation, this bit can be used to choose whether
the area of the screen into which the overflow occurs is displayed as
transparent or wraps around the display screen.
For information on scaling, see “6.1.7 BG Rotation and Scaling Features”.
BG*CNT [d12-08] Screen Base Block Specification
Specifies the starting block in VRAM where screen data are stored.
(32 steps: 0-31; 2-Kbyte increments).
See section 6.1.3, VRAM Address Mapping of BG Data.
BG*CNT [d07] Color Mode
Specifies whether to reference BG character data in 16 color x 16 palette
format or 256 color x 1 palette format.
BG*CNT [d06] Mosaic
Turns mosaic processing for BG on and off.
BG*CNT [d03-02] Character Base Block Specification
Specifies the starting block in VRAM where the character data to be
displayed in the BG is stored.
(4 steps: 0-3; 16-Kbyte increments)
See section 6.1.3, VRAM Address Mapping of BG Data.
BG*CNT [d01-00] Priority Among BGs
With the default value (same priority value specified for all), the order of
priority is BG0, BG1, BG2, and BG3. However, this order can be changed
to any desired.
Values of 0 (highest priority) to 3 can be specified.
When the BG priority has been changed, care should be taken in
specifying the pixels used for color special effects.
Mosaic size is set in the MOSAIC register.
Turning mosaic on/off for each BG is accomplished by the mosaic flag of
the BG control register.
For information on the mosaic flag, see the previous section, BG Control.
AddressRegister
MOSAIC04Ch0000hW
The mosaic value specifies how many dots of a normal display should
comprise each large dot displayed.
Counting from the upper left-most dot on the screen, the number of dots
equal to the mosaic size are used in the mosaic display. The other dots
are overwritten by the mosaic. Please refer to the figure below.
If the mosaic size value is 0, a normal display is seen even if mosaic is
turned on.
BG data (BG character and screen data) are stored in the 64-Kbyte BG
area of VRAM.
1) BG Character Data
The starting address for referencing BG character data can be specified
using the character base block specification of the BG control register.
The amount of data depends on the number of character data items stored
and the data format (color formats: 256 colors x 1 palette or 16 colors x 16
palettes).
2) BG Screening Data
The starting address for referencing BG screen data can be set using the
screen base block specification of the BG control register.
The amount of data depends on the type of BG screen (text or
rotation/scaling) and the screen size. These can be set by the BG control
register.
Base Block 31
Base Block 30
Base Block 29
Base Block 28
Base Block 27
Base Block 26
Base Block 25
Base Block 24
Base Block 23
Base Block 22
Base Block 21
Base Block 20
Base Block 19
Base Block 18
Base Block 17
Base Block 16
Base Block 15
Base Block 14
Base Block 13
Base Block 12
Base Block 11
Base Block 10
Base Block 9
Base Block 8
Base Block 7
Base Block 6
Base Block 5
Base Block 4
Base Block 3
Base Block 2
Base Block 1
Base Block 0
A BG screen is considered to be the 8 x 8 dot unit that represents the size
of the basic character, and the BG screen data specifies the characters
that are arranged.
BG screen data should be stored, beginning from the starting address of
the BG screen base block specified in the BG control register. The
number of screen data items specified per BG depends on the screen size
setting in the BG control register.
BG screen data for text and rotation/scaling screens are specified in the
following formats.
1) Text BG Screen
A text BG screen consists of 2 bytes of screen data per basic character;
1,024 character types can be specified.
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
Character name
Horizontal flip flag
Vertical flip flag
Color Palette
With 16 colors x 16 palettes: 0-15
With 256 colors x 1 palette: disabled
[d15-12] Color Palette
If the color mode specification in the BG control register is 16 colors x 16
palettes, these bits specify palette 0-15 as the palette to be applied to the
character.
This is disabled when the color mode specification is 256 x 1 palette.
[d11] Vertical Flip Flag
Enables the BG character to be flipped vertically.
A setting of 1 produces the vertical-flip display.
[d10] Horizontal Flip Flag
Enables the BG character to be flipped horizontally.
A setting of 1 produces the horizontal-flip display.
Specify the number of the character that has character base block starting
address specified in the BG control register as its starting point.
2) Rotation/Scaling BG Screen
The rotation/scaling BG screen consists of 1 byte of screen data per basic
character; 256 character types can be specified.
The character data must be classified as 256 colors x 1 palette.
The color mode specification in the BG control register is disabled for a
rotation/scaling screen.
07 06 05 04 03 02 01 00
Character Name
[Cautions for VRAM]
AGB provides a high degree of freedom in using the BG area of VRAM.
Consequently, in managing VRAM, the following points deserve particular
attention.
1. There are 2 formats for BG character data (defined by 16 and 256
colors), and these can be used together.
2. The BG character data base block can be selected from among 4
blocks (BG control register).
3. The BG screen data base block can be selected from among 32
blocks (BG control register).
4. The screen size (amount of VRAM used) can be set for each BG (BG
control register).
5. Text and rotation/scaling BGs can be present and used together in a
BG screen.
In managing VRAM, particular care is required in BG mode 1, because text
BG screens (which can handle BG character data in both 256 colors x 1
palette and 16 colors x 16 palettes) and rotation/scaling BG screens
(which can handle only 256 colors x 1 palette) may be used together.
Therefore, the VRAM mapping status should be sufficiently understood
when programming.
Rotation and scaling of the BG as a whole can be performed in a
rotation/scaling BG screen.
With rotation, BG data is referenced as shown in the following figure.
Origin
y-axis
)0,0(
Rotation center
coordinate
Coordinate
before rotation
θ
),(00yx
θ
dmy
θ
dmx
dx
),(11yx
Coordinate after
rotation
dy
BG display
screen
∗
),(22yx
BG data reference area
dx (distance moved in direction x, same line) = (1 /
dy (distance moved in direction y, same line) = - (1 /
dmx (distance moved in direction x, next line) = ( 1 /
dmy (distance moved in direction y, next line) = ( 1 /
Horizontal line before
rotation
Horizontal line after
rotation
α
: Magnification along x-axis
β
: Magnification along y-axis
α
α
β
x-axis
) cos θ
β
) sin θ
) sin θ
) cos θ
BG rotation and scaling are implemented in AGB using the following arithmetic
expressions.
Parameters used in rotation and scaling operations are specified for BG2
and BG3 in the following registers. Registers for Starting Point of BG Data
Reference are also used when Scaling/Rotation BG and Bitmap Mode BG
are offset displayed (scrolled). (There is also an offset register for Text
BG.)
Registers for Setting the Starting Point of BG Data
AddressRegister
028h
038h
AddressRegisterAttributes
02Ah
03Ah
AddressRegister
02Ch
03Ch
AddressRegister
02Eh
03Eh
BG2X_L
BG3X_L
BG2X_H
BG3X_H
BG2Y_L
BG3Y_L
BG2Y_H
BG3Y_H
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
X-coordinate of reference starting point (rotation/scaling results)
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
X-coordinate of reference starting point
(rotation/scaling results)
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
Y-coordinate of reference starting point (rotation/scaling results)
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
Y-coordinate of reference starting point
(rotation/scaling results)
AttributesInitial Value
W
Attributes Initial Value
AttributesInitial Value
Registers for Setting the Direction Parameters of BG Data
AddressRegister
020h
030h
AddressRegister
022h
032h
AddressRegister
024h
034h
AddressRegister
026h
036h
BG2PA
BG3PA
BG2PB
BG3PB
BG2PC
BG3PC
BG2PD
BG3PD
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
dx: distance of movement in x direction along same line
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
dmx: distance of movement in x direction along next line
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
dy: distance of movement in y direction along same line
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
dmy: distance of movement in y direction along next line
1. Using software, the user determines the results of the rotation/scaling
operation for the left-upper coordinate of the display screen and sets
this as the starting point of the BG data reference in registers BG2X_L,
BG2X_H, BG2Y_L, BG2Y_H, BG3X_L, BG3X_H, BG3Y_L, and
BG3Y_H. The set value is a signed fixed-point number (8 bits for
fractional portion, 19 bits for integer portion, and 1 bit for sign, for a total
of 28 bits).
The BG data reference direction is set in BG2PA, BG2PB, BG2PC,
BG2PD, BG3PA, BG3PB, BG3PC, and BG3PD. The set value is a
signed fixed-point number (8 bits for fractional portion, 7 bits for integer
portion, and 1 bit for sign, for a total of 16 bits).
2. The image processing circuit sums the increases in the x direction (dx,
dy) in relation to the BG data reference starting point set in the above
registers, and calculates the x-coordinate.
3. When the line is advanced, the increases in the y direction (dmx, dmy)
are summed in relation to the reference starting point, and the
coordinate of the rendering starting point for the next line is calculated.
The processing in step 2) is then performed.
4. However, if a register for the BG data reference starting point is
rewritten during an H-blanking interval, the y-direction summation for
that register is not calculated. The CPU uses this mode to change the
center coordinate and the rotation/scaling parameters for each line.
Area Overflow Processing
When the display screen overflows the boundaries of the virtual screen
due to a rotation/scaling operation, this BG control register can be used to
select whether the area of the screen into which the overflow occurs is
transparent or wraps around the display screen.
For information on BG control, see “6.1.1 BG Control”.
For each text BG screen, the offset on the display screen can be specified
in 1-dot increments. Offset register is only valid for Text BG. In order to
offset display Scaling/Rotation BG and Bitmap Mode BG set the BG
Reference Starting Point. See “6.1.7, BG Rotation and Scaling Features”.
In the bitmap modes, the components of the BG screen are handled in pixel units, and
the contents of VRAM (frame buffer) are displayed as color data for each dot on the
screen.
6.2.1 BG Control
The bitmap BG will be treated as BG2. Therefore, in order to display the
content of the frame buffer on the LCD screen, you need to set the BG2
display flag to ON in the DISPCNT Register. For BG Control the BG2CNT
Register is used.
This controls the ON/OFF of mosaic processing for BG2. When ON, the
settings for the Mosaic Size Register, MOSAIC, are referenced. For
information on Mosaic, see “6.1.2 Mosaic Size”.
BG2CNT [d01-00] Priority Among BGs
Due to the fact that in Bitmap Mode there is only one BG plane(other than
the backdrop plane), there is no priority relationship among BGs, but you
can set up priorities with OBJ. For information on this, see “6.4 Display
Priority of OBJ and BG”.
The parameters for Bitmap BG Rotation/Scaling use BG2 related
registers(BG2X_L, BG2X_H, BG2Y_L, BG2Y_H, BG2PA, BG2PB, BG2PC,
and BG2PD).
For information on rotation/scaling parameters, see “6.1.7 BG
Rotation and Scaling Features”.
With Bitmap BG, if the displayed portion exceeds the edges of the screen
due to the rotation/scaling operation, that area becomes transparent.
6.2.3 Pixel Data
In the bitmap modes, only the amount of pixel data corresponding to the
size of the display screen can be stored in VRAM. Available bitmap modes
allow the simultaneous display of 32,768 colors (BG modes 3 and 5) and
the display of 256 of the 32,768 colors (BG mode 4). The format of the
data in the frame buffer differs between the modes as described below.
1. 32,768-Color Simultaneous Display Format (BG Modes 3 and 5)
Palette RAM is not referenced.
Each pixel uses a half-word.
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
B4 B3 B2 B1 B0 G4 G3 G2 G1 G0 R4 R3 R2 R1 R0
RedGreenBlue
2. 256-Color (of 32,768) Display Format (BG Mode 4)
Palette RAM color data (256 of the 32,768 colors storable) are
Because there is a single frame buffer, this mode is used mainly for still
images. However, it enables 32,768 colors to be displayed simultaneously
over the full screen.
Two frame buffers are allocated in VRAM, making this mode suitable for
full-motion video. Of the total of 32,768 colors, 256 can be displayed
simultaneously over the full screen.
Objects are in character format regardless of the BG mode. However, the
number of basic characters that can be defined varies depending on the
BG mode.
ItemFunction
Number of display colors 16 colors/16 palettes or 256 colors/1 palette (mixed display possible)
Number of characters
(8x8 dots)
Character size 8x8 - 64x64 dots (12 types)
Max. number per screen 128 (64x64 dot conversion)
Max. number per line 128 (8x8 dot conversion)
Color special effects HV flip, semi-transparency, mosaic, priority specification, OBJ windows
1,024 (16 colors x 16 palettes) : in BG modes 0-2
512 (256 colors x 1 palette) :"
512 (16 colors x 16 palettes) : in BG modes 3-5
256 (256 colors x 1 palette) : "
OBJ Display Capability on a Single Line
The single-line OBJ display capability shown in the table above, is the
capability at maximum efficiency.
When the displayed OBJ are arranged continuously from the start of OAM,
you can calculate the OBJ display capability on a single line using the
following formula:
(Number of H Dots × 4 - 6) / Number of Rendering Cycles =
The “Number of H Dots” is usually 308 dots, but when the H-Blank Interval
OBJ Processing Flag for Register DISPCNT is set to 1, there are 240
dots(Refer to “4 LCD”).
“×4” expresses the number of cycles that the OBJ Rendering Circuit can
use per one dot. “-6” represents the number of cycles needed for
processing before OBJ rendering at the start of the H Line.
The “Number of Rendering Cycles” and the corresponding number of OBJ
displayable for a single line is expressed in the table below.
Number of Rendering CyclesNumber of OBJ displayable on single line
OBJ H Size
882612847
1616427629
3232743816
6464138198
128 (double the
size of 64)
Normal OBJ
X266X4
Rotation/Scaling
OBJ
Normal OBJ
Rotation/Scaling
OBJ
If the number for non-displayed (outside of the screen) OBJ in the OAM is
lower than that for displayed OBJ, the bigger the non-displayed OBJ's size
is, the less efficient the rendering will be. Please be aware of this problem.
With OBJ character data, the basic character is 8 x 8 dots, and characters
between 8 x 8 and 64 x 64 dots can be handled (total of 12 types). The
base address of OBJ character data is a fixed VRAM base address. The
OBJ character data capacity allocated is either 32 Kbytes or 16 Kbytes,
depending on the BG mode (see 5.1.2 "VRAM Memory Map").
There are 2 types of mapping to the character area, and they can be
specified in bit [d06] of the DISPCNT register.
OBJ is managed by character numbers that are divided by 32 bytes
starting with OBJ character database address. 32 bytes is the required
capacity to define 1 basic character of 16 colors x 16 palettes. 64 bytes is
the required capacity to define 1 basic character of 256 colors x 1 palette.
1) VRAM 2-Dimensional Mapping for OBJ Characters
Setting the DISPCNT register bit [d06] to 0 results in the 2-dimensional
mapping mode shown in the following figure.
Basic Character
8x8 dots
(16 colors/16 palettes)
32x32 dots
(16 colors/16 palettes)
64x64 dots
(16 colors/16 palettes)
000H 001H 002H 003H
020H 021H 022H
060H 061H 062H 063H
080H 081H 082H
0C0H 0C1H 0C2H 0C3H
0E0H 0E1H 0E2H
120H 121H 122H 123H
140H 141H 142H
023H
083H
0E3H
143H
Character mapping area (character no.in hexadecimal notation)
Character name
When a character of 256 colors x 1 palette is displayed during 2
dimensional mapping mode, specifying a character name is limited to even
numbers (see OBJ attribute 2 of OAM). So, in most cases when defining a
character of 256 colors x 1 palette during 2 dimensional mapping mode,
you define it so that a character name is an even number.
2) VRAM 1-Dimensional Mapping for OBJ Characters
Setting DISPCNT register bit [d06] to 1 results in the 1-dimensional
mapping mode shown in the following figure.
The data that comprise a character are stored in contiguous addresses.
Example: 64x64 dot OBJ field → 128x128 dot field displayed with rotation
processing. Note, however, that the OBJ display position is shifted.
With the double-size flag set to 0, display of the portion protruding from the
edges is cut off.
Please refer to the following figure.
Normal Display
Magnified (x2) Display
(Double-Size object field)
Rotation Display
Rotation Display
(Double-Size object field)
Individual Control of OBJ display
It is possible to control the ON and OFF functions of the OBJ display individually by setting
in the combination of this double size flag and the rotation/scaling flag of [d08].
In case of (double size flag, rotation/scaling flag) = (1, 0), OBJ is not displayed, but is
displayed in other cases.
[d08] Rotation/Scaling Flag
Allows rotation processing for the OBJ to be enabled and disabled.
With the OBJ rotation/scaling feature enabled by setting this bit to 1, the
maximum number of OBJs displayed per line is decreased. Please refer to the
description in Section 6.3.1 on OBJ Display Capability on a Single Line.
Individual Control of OBJ display
It is possible to control the ON and OFF functions of the OBJ display individually by setting
in the combination of the double size flag for [d09] and this rotation/scaling flag.
In case of (double size flag, rotation/scaling flag) = (1, 0), OBJ is not displayed, but is
displayed in other cases.
[d07-00] Y-Coordinate
Allows the y-coordinate of the OBJ in the display screen to be specified.
[Cautions]
160 dots in total (0 - 159) are inside the display screen, and 96 dots in total (160-
255) are outside the display screen (virtual screen).
When the vertical size displays a 64 dot OBJ by a double size of character, the
size is 128 dots, exceeding the vertical 96 dots for the virtual screen.
Therefore, in the range of Y coordinate values of 129 - 159, the lower part of OBJ
that is pushed out upwards is displayed. The upper part of OBJ in the lower
screen is not displayed (see below).
Linked to the specification of the OBJ size for Attribute 0, the size for the
OBJ Character is also specified. For each of the three OBJ shapes, you
can set four sizes.
OBJ
Shape
00
SquareHorizontal RectangleVertical Rectangle
01
10
OBJ Size
00011011
A8x816x1632x32
16x832 x832x16
EFGH64 x32
8x168x3216x3232 x64
IJKL
BCD
64 x64
11Prohibited Code
[d13] [d12] Vertical and Horizontal Flip Flags
Allows the OBJ to be flipped horizontally and vertically.
A normal display is produced by a setting of 0 and a flip display by a setting
of 1.
When the rotation/scaling flag ([d08] of OBJ Attribute 0) is enabled, these
bits also can be used as the high-order bits of the rotation/scaling
parameter selection.
[d13-09] Rotation/Scaling Parameter Selection
The parameters used in OBJ rotation/scaling processing are selected from
the 32 parameters registered in OAM.
The rotation and scaling feature for OBJ is essentially the same as that for
BG.
OBJ Character Data Referenced with Rotation
x-axis
OBJ Character Data
*
Double-Size Object Field
*
Object Field
*
y-axis
θ
dmx
dmy
OBJ Center
dx (distance moved in x direction, same line) = ( 1 /
dx
θ
dy
dy (distance moved in y direction, same line) = - ( 1 /
dmx (distance moved in x direction, next line) = ( 1 /
dmy (distance moved in y direction, next line) = ( 1 /
Horizontal Line
Before Rotation
α
) cos θ
β
) sin θ
α
) sin θ
) cos θ
β
α
: Magnification along x-axis
β
: Magnification along y-axis
When an OBJ is displayed, the OBJ character data are referenced
horizontally, beginning from the left-uppermost position. Rotation display
can be achieved by adding an angle to the reference direction. The center
of rotation is fixed at the center of the OBJ field. If a reference point
surpasses the specified OBJ size, it becomes transparent.
Operations Used in OBJ Rotation/Scaling Processing
1. Specify the rotation/scaling parameter number to be applied in OBJ
Attribute 1 of the OAM.
2. The image-processing circuit sums the increases in the x direction (dx,
dy) in relation to the center of rotation (OBJ field center), which serves
as reference point, to calculate the x-direction coordinates.
3. When the line is advanced, the increases in the y-direction (dmx, dmy)
in relation to the reference point, are summed to calculate the
coordinate of the starting point for rendering the next line. The
processing in step 2) above, is then performed.
Rotation/Scaling Parameters
Specifies the direction of character data reference in OBJ rotation/scaling
processing.
The values set for PA, PB, PC, and PD are signed, fixed-point numbers
(8-bit fractional portion, 7-bit integer portion, 1-bit sign, for a total of 16 bits).
These 4 parameters are used together as a single group, which can be
placed in any of 32 areas in OAM.
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
PA
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
PB
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
PC
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
PD
dx: distance moved in x direction along same line
dmx: distance moved in x direction along next line
dy: distance moved in y direction along same line
dmy: distance moved in y direction along next line
Priority among BGs can be set to any of 4 levels.
When BGs have the same priority setting, the BG with the lowest BG number is given
priority.
2) Priority Among OBJs
Priority among OBJs can be set to any of 4 levels.
When OBJs have the same priority setting, the OBJ with the lowest OBJ number is
given priority.
3) Priority Among BGs and OBJs
The priority of each OBJ in relation to the BG can be set to 4 levels. Please refer to
the following figure.
Backdrop
The backdrop screen
is fixed at the lowest
priority.
[Cautions for priority]
When orders of OBJ number and OBJ priority are reversed, the display is
not right if BG is between the OBJs. Please be cautious not to let this
situation occur.
The LCD unit of AGB can display 32 levels of red, 32 levels of green, and 32 levels of
blue, for a total of 32,768 colors.
The number of colors that can be displayed at once varies with the BG mode. See
“5.1.1 Details of BG Modes”. Color palettes are used in defining character-format BGs
and OBJs.
[Note]
Bitmap-format BG modes 3 and 5 are not palette formats.
See “6.2 Bitmap Mode BGs (BG Modes 3-5)”.
Color palettes come in the following two forms.
1) 16 Colors x 16 Palettes
This mode provides 16 color palettes, each consisting of 16 colors.
Color 0 for OBJ and BG palettes is forcibly allocated to transparent (color
specification disabled).
2) 256 Colors x 1 Palette
This mode allocates all 256 of its colors to 1 palette.
Color data are represented by 15 bits (5 for Red, 5 for Green, and 5 for
Blue). Colors can be selected from the total of 32,768.
OBJ color 0 and BG color 0 are forcibly allocated to transparent (color
specification disabled).
3) Color 0 Transparency
Color 0 transparency is used to render the pixels of low-priority OBJs or
BGs as transparent.
The color specified for color 0 of BG palette 0 is applied to the backdrop,
which has the lowest priority.
Either of 2 modes (16 colors x 16 palette and 256 colors x 1 palette) can
be selected for OBJ and BG. Palette RAM for these modes is referenced
as shown in the following figure.
The AGB system can display 2 windows simultaneously.
Display of the areas inside and outside the windows can be separately turned on and off.
In addition, scrolling and color special effects such as rotation, α blending, and fade-in/fade-out
can be performed for each window.
8.1 Window Position Setting
The Window Position Setting specifies the upper-left and lower-right coordinates of a
rectangular area.
These settings specify the window's position and size.
When a non-rectangular window is displayed, the values of these registers are
updated during H-blanking intervals.
AddressRegister
040h
042h
AddressRegister
044h
046h
WIN0H
WIN1H
WIN0V
WIN1V
Window Display Example
Window 0 has a higher display priority than Window 1.
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
Left-upper x-coordinate of windowRight-lower x-coordinate of window
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
Left-upper y-coordinate of windowRight-lower y-coordinate of window
The window control registers control operations such as turning window display on
and off.
However, the master window display flag of the DISPCNT register has a higher priority
than the WININ and WINOUT registers. For information concerning the DISPCNT
register, see “5 Image System".
1) Control of Inside of Window
The WININ register controls display of the area inside windows 0 and 1.
The high-order bits (d13-8) control Window 1, while the low-order bits (d5-
0) control Window 0.
Window 1Window 0
AddressRegisterAttributes Initial Value
WININ048h0000hR/W
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
OBJ BG3BG2BG1BG0OBJ BG3BG2BG1BG0
Display Flag
0: No display
1: Display
Color Special Effects Flag
0: Disable color special effects
1: Enable color special effects
Color Special Effects Flag
0: Disable color special effects
1: Enable color special effects
The AGB provides the following color special effects. The area where these effects are applied
can be limited using a window.
1) α α Blending
Performs arithmetic operations on 2 selected surfaces and implements processing for
16 levels of semi-transparency.
2) Fade-in/Fade-out
Performs arithmetic operations on 1 selected surface and implements processing
for 16 levels of brightness.
9.1 Selection of Color Special Effects
The types of color special effects and the target pixels, are determined by the
BLDCNT register.
AddressRegister
BLDCNT050h0000hR/W
Although color special effects are specified by the BLDCNT register, for α blending,
which involves processing between surfaces, the 2 target surfaces must have suitable
priorities.
In addition, semi-transparent OBJs are individually specified in OAM, and color special
effects for the OBJ as a whole, are specified in the BLDCNT register. These
specifications are summarized in the following table.
BLDCNT
d07d06
00No special effectsNormally, color special effects processing is not performed.
01α blending
(Semi-transparency
10Brightness Increase Gradually increases brightness for 1st target screen.
11Brightness
TypeColor Special Effects Processing
16-level semi-transparency processing (α blending) is performed only
when a semi-transparent OBJ is present and is followed immediately
by a 2nd target screen.
If the 1st target screen is followed immediately by a 2nd target screen,
16-level semi-transparency processing (α blending) is performed.
processing)
Decrease
The bits of the backdrop of the 1st target screen should be turned off
([d05]=0).
When OBJ = 1 for the 1st target pixel, processing is executed for all
OBJs regardless of the OBJ type.
When OBJ=0, processing is executed only if the OBJ is semitransparent.
The entire screen can gradually be made whiter by setting all bits of
the specification for the 1st target screen to 1.
When OBJ=1 for the 1st target screen, processing for increased
brightness is executed only for normal objects.
If a semi-transparent OBJ is the 1st target screen, α blending
processing is always executed.
Brightness is gradually decreased for the 1st target screen.
The entire screen can gradually be made blacker by setting all bits of
the specification for the 1st target screen to 1.
When OBJ=1 for the 1st target screen, processing for decreased
brightness is performed only for normal objects. If a semi-transparent
OBJ is the 1st target screen, α blending processing is always
executed.
The color special effects arithmetic expressions that use the coefficients are shown
below.
1. αα Blending (16 levels of semi-transparency) Operations
Display color (R) = 1st pixel color (R) ×EVA + 2nd pixel color (R)×EVB
Display color (G) = 1st pixel color (G) ×EVA + 2nd pixel color (G) ×EVB
Display color (B) = 1st pixel color (B) ×EVA + 2nd pixel color (B) ×EVB
Direct sounds have 2 channels, A and B. Linear 8-bit audio data can be played back.
The audio data are set to a bias level of 00h and are 8-bit data (+127 to -128), obtained
by 2’s complement.
Audio data are transferred sequentially to the sound FIFO (8-word capacity), using the
sound FIFO transfer mode of DMA 1 and 2.
The sampling rate can be set to an arbitrary value using timers 0 and 1.
Sound FIFO Input Register
AddressRegisterAttributesInitial Value
0A0h
0A4h
AddressRegister
0A2h
0A6h
FIFO_A_L
FIFO_B_L
FIFO_A_H
FIFO_B_H
15141312111009080706050403020100
Sound Data 1Sound Data 0
15141312111009080706050403020100
Sound Data 3Sound Data 2
W
AttributesInitial Value
W
-
-
Sound Data
All sounds are PWM modulated (refer to 10.8 “Sound PWM Control”) at the final
portion of the Sound Circuit. Therefore, if you match the 8 bit audio data sampling
frequency and the timer settings with the PWM modulation sampling frequency, a
clean sound can be produced.
The following operations are repeated for direct sound.
Preparing to Use Direct Sound
1.Using sound control register SOUNDCNT_H (refer to 10.7 “Sound Control”),
select the timer channel to be used (0 or 1).
2.Using sound control register SOUNDCNT_H, do a 0 clear with FIFO A and FIFO
B, and initialize the sequencer.
3.In cases of producing a sound immediately after starting the direct sound, write
the first 8 bits of linear audio data to the FIFO with a CPU write.
4.Specify the transfer mode for DMA 1 or 2 (see 12.2 “DMA 1 and 2”).
5.Specify the direct sound outputs settings in the sound control register.
Specifies the number of sweeps.
The frequency data with a single shift are determined according to the
following formula, with f
signifying the frequency after a shift and f
(t)
(t-1)
the
frequency before the shift.
f
)1(
−
t
±=
ff
)1()(
−
tt
=
f
)0(
n
2
datafrequency Initial
If the addition according to this formula produces a value consisting of
more than 11 bits, sound output is stopped and the Sound 1 ON flag (bit 0)
of NR52 is reset.
With subtraction, if the subtrahend is less than 0, the pre-subtraction value
is used. However, if the specified setting is 0, shifting does not occur and
the frequency is unchanged.
A setting of 1 causes Sound 1 to restart.
When the sweep function is used, set the initialization flag again after an
interval of 8 clock s or more.
SOUND1CNT_X [d14] Sound Length Flag
When 0, sound is continuously output.
When 1, sound is output for only the length of time specified for the sound
length in NR11.
When sound output ends, the Sound 1 ON flag of NR52 is reset.
SOUND1CNT_X [d10 - 00] Frequency Data
With fdat signifying the frequency, the output frequency (f) is determined by
the following formula.
Value
=
4194304
3
−××
Hz
fdatf)2048(24
Thus, the specifiable range of frequencies is 64 to 131.1 KHz.
[Sound 1 Usage Notes]
1.When the sweep function is not used, the sweep time should be set to 0 and the
sweep increase/decrease flag should be set to 1.
2.If sweep increase/decrease flag of NR10 is set to 0, the number of sweep shifts
set to a non-zero value, and sweep OFF mode is set, sound production may be
stopped.
3.When a value is written to the envelope register, sound output becomes unstable
before the initialization flag is set. Therefore, set initialization flag immediately
after writing a value to the envelope register.
4. For sound 1, if you change the frequency when selecting a consecutive operation
mode (sound length flag of NR14 is 0), always set 0 for the data of sound length
(lower 6 bits of NR11) after setting the frequency data. If 0 is not set, sound may
stop prematurely.
5. If the Sound 1 initialization flag is set when the sweep function is used, always set
the initialization flag again after an interval of 8 clock s or more. Unless the
initialization flag is set twice with an interval of 8 clock s or more, the sound may
not be heard.
Sound 2 is a circuit that generates rectangular waveforms with envelope functions.
The contents of NR21, NR22, NR23, NR24 for Sound 2, conform with those of CGB.
With st signifying the sound length data, the length of the output sound is
determined by the following formula.
timest=−×()(sec)64
AddressRegister
06Ch0000hR/W
SOUND2
CNT_H
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
Sound Length
0: Continuous
1: Counter
Initialization Flag
1
Attributes
NR23NR24
Frequency Data
SOUND2CNT_H [d15] Initialization Flag
A setting of 1 causes Sound 2 to be restarted.
SOUND2CNT_H [d14] Sound Length
Continuous sound output with 0; with 1, sound output only for the time
specified in the sound length data of NR21.
When sound output ends, the Sound 2 ON flag of NR52 is reset.
Value
SOUND2CNT_H [d10 - 00] Frequency Data
With fdat signifying the frequency data, the output frequency is determined
by the following formula.
f
422048
4194304
3
××−
()
fdat
Hz=
()
Thus, the frequency range that can be specified is 64 to 131.1 KHz.
[Sound 2 Usage Note]
1.When a value is written to the envelope register, sound output
becomes unstable before the initialization flag is set. Therefore, set
initialization flag immediately after writing a value to the envelope
register.
2.For sound 2, if you change the frequency when selecting a
consecutive operation mode (Reset sound length flag of NR24),
always set 0 for data of sound length (lower 6 bits of NR21) after
setting frequency data. If 0 is not set, sound may stop prematurely.
The Sound 3 circuit outputs arbitrary waveforms and can automatically read waveform
patterns (1 cycle) in waveform RAM and output them while modifying their length,
frequency, and level.
The capacity of the waveform RAM of Sound 3 in AGB (total of 64 steps) is twice that
in CGB, and can be used as 2 banks of 32 steps or as 64 steps.
In addition, a new output level of 3/4 output can now be selected.
The contents of NR30, NR31, NR32, NR33, NR34 for Sound 3, add the functionalities
listed above to those of CGB.
15141312111009080706050403020100
070h0000hR/W
SOUND3
CNT_L
Sound Output Flag
0: Stop Output
1: Output
NR30
Waveform RAM Data Association Spec.
0: 32 Steps
1: 64 Steps
Waveform RAM Bank Specification
0: Bank 0
1: Bank 1
Attributes Initial ValueAddressRegister
SOUND3CNT_L [d07] Sound Output Flag
Sound output stops when 0; sound output occurs when 1.
SOUND3CNT_L [d06] Waveform RAM Bank Specification
Two banks of waveform RAM are provided, banks 0 and 1. The Sound 3
circuit plays the waveform data in the specified bank.
When waveform RAM is accessed by the user, the bank not specified is
accessed.
SOUND3CNT_L [d05] Waveform RAM Data Association Specification
When 0 is specified, 32-step waveform pattern is constructed under
normal operation.
With a setting of 1, the data in the bank specified by NR30 [d06] (waveform
RAM bank specification) is played, followed immediately by the data in the
back bank.
The front bank 32 steps and the back bank 32 steps combine to form a
waveform pattern with a total of 64 steps.
When 0, sound is continuously output.
When 1, sound is output for only the length of time specified for the sound
length in NR31.
When sound output ends, the Sound 2 ON flag of NR52 is reset.
SOUND3CNT_X [d10 - 00] Frequency Data
With fdat signifying the frequency, the output frequency (f) is determined by
the following formula.
=
4194304
3
−××
Hz
fdatf)2048(24
Thus, the specifiable range of frequencies is 64 to 131.1 KHz.
[Sound 3 Usage Note]
1.When changing the frequency during Sound 3 output, do not set the initialization
flag. The contents of waveform RAM may be corrupted. With sounds 1, 2 , and 4,
the initialization flag can be set without problems.
2.For sound 3, if you change the frequency when selecting a consecutive
operation mode (Reset the sound length flag of NR34), always set 0 for the
data of sound length (NR31) after setting the frequency data. If 0 is not set,
sound may stop prematurely.
Waveform RAM consists of a 4-bit x 32-step waveform pattern. It has 2
banks, with [d06] of SOUND3CNT_L used for bank specification.
The Sound 3 circuit plays the waveform data specified by the bank setting,
while the waveform RAM not specified is the waveform RAM accessed by
the user.
Sound 4 is a circuit that generates white noise with the envelope function.
The contents of NR41, NR42, NR43, and NR44 for Sound 4 conform with those of
When a value is written to the envelope register, sound output becomes
unstable before the initialization flag is set. Therefore, set initialization flag
immediately after writing a value to the envelope register.
The output ratio for direct sound and sound can be set using the SOUNDCNT_H
register. Final sound control can be achieved with the SOUNDCNT_L register.
NR50 and NR51 are each based on their counterparts in CGB.
AddressRegister
080h0000hR/W
SOUND
CNT_L
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
NR50NR51
L Output Level
0-7
Sound 1 R Output Flag
Sound 2 R Output Flag
Sound 3 R Output Flag
Sound 4 R Output Flag
Sound 1 L Output Flag
Sound 2 L Output Flag
Sound 3 L Output Flag
Sound 4 L Output Flag
R Output Level
0-7
Attributes Initial Value
SOUNDCNT_L [d15 - 12] L Output Flag for each Sound
No output of that sound to L when 0.
Output of that sound to L when 1.
SOUNDCNT_L [d11 - 08] R Output Flag for each Sound
No output of that sound to R when 0.
Output of that sound to R when 1.
SOUNDCNT_L [d06 - 04] L Output Level
L output level can be set to any of 8 levels.
However, there is no effect on direct sound.
SOUNDCNT_L [d02 - 00] R Output Level
R output level can be set to any of 8 levels.
However, there is no effect on direct sound.