ARM programming for the Nintendo DS

The Nintendo DS is the sucessor to the Gameboy advance, based on the ARM - the NDS uses an ARM9 as it's main processor - with an ARM7 secondary processor - which is used for backwards compatibility with the Gameboy Advance.

Tech Specs
CPU 66 MHZ ARM9 + 33 MHZ ARM7TDMI
Memory 4MB - 656k VRAM
Resolution 256x192 x 2 screens - 32K colors
3D 1x 3D screen 1x 2D screen
Sound 16 channel
The 3 generations of the GBA

If you want to learn ARM get the Cheatsheet! it has all the ARM7 commands, it covers the commands, and options like Bitshifts and conditions as well as the bytecode structure of the commands!

ARM Hello World Series

Hello World on the Nintendo DS - ARM Assembly Lesson H3

ARM Platform Specific Lessons

Lesson P4 - Bitmap graphics and Palette definitions on the Nintendo DS (16 bit - 32768 colors) [NDS]
Lesson P5 - Joypad & Pen on the GBA / NDS ... Key reading on Risc OS [NDS] [GBA] [ROS]
Lesson P7 - Sound on the Nintendo DS [NDS]
Lesson P8 - 16 color Tilemap on the Gameboy Advance and Nintendo DS! [GBA] [NDS]
Lesson P9 - Hardware Sprites on the Gameboy Advance and Nintendo DS! [GBA] [NDS]
Graphics hardware
The Nintendo DS has two screens, and two 'Graphics engines'... each Graphics engine can drive either screen, but only one screen at a time.

Graphics Engine A is the most powerful... it can do GBA style 2D, 3D or directly show RAM to screen.... it can also do screen capture.
Graphics Engine B is more limited, it can only do GBA style 2D*

In these tutorials, we'll use Graphics Engine A for the top screen, showing Direct Ram.... we'll use Graphics Engine B in Apline (Rotate & Scale) mode, showing an area of memory onscreen with Background Layer 2...

Despite the different setup, the result is both screens are memory mapped in -bABBBBBGGGGGRRRRR - with 1 bit of Alpha, and 5 bits of Red,Green and Blue (The Alpha is unused for the top screen - as it's showing direct ram)

* it's not possible to do 3D on both screens - however Engine A can capture 3D, and show that as an image on Engine B - halving the framerate, but giving apparent 3D on both screens!

Technical Resources
GBATEK - complete documentation on the GBA and NDS - this tutorial would not be possible without the content on their site!

Memory Map
Address Purpose
0x00000000
Instruction TCM (32KB) (not moveable) (mirror-able to 1000000h)
0x00????000 Data TCM (16KB) (moveable)
0x02000000 Main Memory (4MB)
0x03000000 Shared WRAM (0KB, 16KB, or 32KB can be allocated to ARM9)
0x04000000 ARM9-I/O Ports
0x05000000 Engine A Standard BG Palette (512 bytes)
0x05000200 Engine A Standard OBJ Palette (512 bytes)
0x05000400 Engine B Standard BG Palette (512 bytes)
0x05000600 Engine B Standard OBJ Palette (512 bytes)
0x06000000 VRAM - Engine A, BG VRAM (max 512KB)
0x06200000 VRAM - Engine B, BG VRAM (max 128KB)
0x06400000 VRAM - Engine A, OBJ VRAM (max 256KB)
0x06600000 VRAM - Engine B, OBJ VRAM (max 128KB)
0x06800000 VRAM - "LCDC"-allocated (max 656KB)
0x07000000 Engine A OAM (1024 bytes)
0x07000400 
Engine B OAM (1024 bytes)
0x08000000 GBA Slot ROM (max 32MB)
0x0A000000 GBA Slot RAM (max 64KB)
0xFFFF0000 ARM9-BIOS (32KB) (only 3K used)

Ports (ARM9 side)
Category Address Name Description
DispA 0x4000000 DISPCNT LCD Control (RW)
DispA 0x4000004
2D Engine A+B - DISPSTAT - General LCD Status (RW) (Bit 0=VBlank)
DispA 0x4000006
2D Engine A+B - VCOUNT - Vertical Counter (Read only)
DispA 0x4000008
2D Engine A (same registers as GBA, some changed bits)
DispA 0x4000008 BG0CNT BG0 Control
DispA 0x400000A BG1CNT BG1 Control
DispA 0x400000C BG2CNT BG2 Control
DispA 0x400000E BG3CNT BG3 Control
DispA 0x4000010 BG0HOFS BG0 X-Offset
DispA 0x4000012 BG0VOFS BG0 Y-Offset
DispA 0x4000014 BG1HOFS BG1 X-Offset
DispA 0x4000016 BG1VOFS BG1 Y-Offset
DispA 0x4000018 BG2HOFS BG2 X-Offset
DispA 0x400001A BG2VOFS BG2 Y-Offset
DispA 0x400001C BG3HOFS BG3 X-Offset
DispA 0x400001E BG3VOFS BG3 Y-Offset
DispA 0x4000020 BG2PA BG2 Rotation/Scaling Parameter A (dx)
DispA 0x4000022 BG2PB BG2 Rotation/Scaling Parameter B (dmx)
DispA 0x4000024 BG2PC BG2 Rotation/Scaling Parameter C (dy)
DispA 0x4000026 BG2PD BG2 Rotation/Scaling Parameter D (dmy)
DispA 0x4000028 BG2X BG2 Reference Point X-Coordinate
DispA 0x400002C BG2Y BG2 Reference Point Y-Coordinate
DispA 0x4000030 BG3PA BG3 Rotation/Scaling Parameter A (dx)
DispA 0x4000032 BG3PB BG3 Rotation/Scaling Parameter B (dmx)
DispA 0x4000034 BG3PC BG3 Rotation/Scaling Parameter C (dy)
DispA 0x4000036 BG3PD BG3 Rotation/Scaling Parameter D (dmy)
DispA 0x4000038 BG3X BG3 Reference Point X-Coordinate
DispA 0x400003C BG3Y BG3 Reference Point Y-Coordinate
DispA 0x4000040 WIN0H Window 0 Horizontal Dimensions
DispA 0x4000042 WIN1H Window 1 Horizontal Dimensions
DispA 0x4000044 WIN0V Window 0 Vertical Dimensions
DispA 0x4000046 WIN1V Window 1 Vertical Dimensions
DispA 0x4000048 WININ Inside of Window 0 and 1
DispA 0x400004A WINOUT Inside of OBJ Window & Outside of Windows
DispA 0x400004C MOSAIC Mosaic Size
DispA 0x400004E - Not used
DispA 0x4000050 BLDCNT Color Special Effects Selection
DispA 0x4000052 BLDALPHA Alpha Blending Coefficients
DispA 0x4000054 BLDY Brightness (Fade-In/Out) Coefficient
DispA 0x4000056 - Not used
DispA 0x4000060
DISP3DCNT - 3D Display Control Register (R/W)
DispA 0x4000064
DISPCAPCNT - Display Capture Control Register (R/W)
DispA 0x4000068
DISP_MMEM_FIFO - Main Memory Display FIFO (R?/W)
DispA 0x400006C
2D Engine A - MASTER_BRIGHT - Master Brightness Up/Down
DMA/Key 0x40000B0
DMA Channel 0..3
DMA/Key 0x40000E0
DMA FILL Registers for Channel 0..3
DMA/Key 0x4000100
Timers 0..3
DMA/Key 0x4000130
KEYINPUT (Gameboy Advance Type Keys UDLR AB Sel Start)
DMA/Key 0x4000132
KEYCNT
IPC/Rom 0x4000180
IPCSYNC - IPC Synchronize Register (R/W)
IPC/Rom 0x4000184
IPCFIFOCNT - IPC Fifo Control Register (R/W)
IPC/Rom 0x4000188
IPCFIFOSEND - IPC Send Fifo (W)
IPC/Rom 0x40001A0
AUXSPICNT - Gamecard ROM and SPI Control
IPC/Rom 0x40001A2
AUXSPIDATA - Gamecard SPI Bus Data/Strobe
IPC/Rom 0x40001A4
Gamecard bus timing/control
IPC/Rom 0x40001A8
Gamecard bus 8-byte command out
IPC/Rom 0x40001B0
Gamecard Encryption Seed 0 Lower 32bit
IPC/Rom 0x40001B4
Gamecard Encryption Seed 1 Lower 32bit
IPC/Rom 0x40001B8
Gamecard Encryption Seed 0 Upper 7bit (bit7-15 unused)
IPC/Rom 0x40001BA
Gamecard Encryption Seed 1 Upper 7bit (bit7-15 unused)
Ram/IRQ 0x4000204
EXMEMCNT - External Memory Control (R/W)
Ram/IRQ 0x4000208
IME - Interrupt Master Enable (R/W)
Ram/IRQ 0x4000210
IE
Ram/IRQ 0x4000214
IF
Ram/IRQ 0x4000240
VRAMCNT_A - VRAM-A (128K) Bank Control (W)
Ram/IRQ 0x4000241
VRAMCNT_B - VRAM-B (128K) Bank Control (W)
Ram/IRQ 0x4000242
VRAMCNT_C - VRAM-C (128K) Bank Control (W)
Ram/IRQ 0x4000243
VRAMCNT_D - VRAM-D (128K) Bank Control (W)
Ram/IRQ 0x4000244
VRAMCNT_E - VRAM-E (64K) Bank Control (W)
Ram/IRQ 0x4000245
VRAMCNT_F - VRAM-F (16K) Bank Control (W)
Ram/IRQ 0x4000246
VRAMCNT_G - VRAM-G (16K) Bank Control (W)
Ram/IRQ 0x4000247
WRAMCNT
Ram/IRQ 0x4000248
VRAMCNT_H - VRAM-H (32K) Bank Control (W)
Ram/IRQ 0x4000249
VRAMCNT_I - VRAM-I (16K) Bank Control (W)
Maths 0x4000280
DIVCNT - Division Control (R/W)
Maths 0x4000290
DIV_NUMER - Division Numerator (R/W)
Maths 0x4000298
DIV_DENOM - Division Denominator (R/W)
Maths 0x40002A0
DIV_RESULT - Division Quotient (=Numer/Denom) (R)
Maths 0x40002A8
DIVREM_RESULT - Division Remainder (=Numer MOD Denom) (R)
Maths 0x40002B0
SQRTCNT - Square Root Control (R/W)
Maths 0x40002B4
SQRT_RESULT - Square Root Result (R)
Maths 0x40002B8
SQRT_PARAM - Square Root Parameter Input (R/W)
Maths 0x4000300
POSTFLG - Undoc
Maths 0x4000304
POWCNT1 - Graphics Power Control Register (R/W)
Disp3D 0x4000320..6A3

2D Engine B 0x4001000 DISPCNT LCD Control (RW)
2D Engine B 0x4001008
(same registers as GBA, some changed bits)
2D Engine B 0x4001008 BG0CNT BG0 Control
2D Engine B 0x400100A BG1CNT BG1 Control
2D Engine B 0x400100C BG2CNT BG2 Control
2D Engine B 0x400100E BG3CNT BG3 Control
2D Engine B 0x4001010 BG0HOFS BG0 X-Offset
2D Engine B 0x4001012 BG0VOFS BG0 Y-Offset
2D Engine B 0x4001014 BG1HOFS BG1 X-Offset
2D Engine B 0x4001016 BG1VOFS BG1 Y-Offset
2D Engine B 0x4001018 BG2HOFS BG2 X-Offset
2D Engine B 0x400101A BG2VOFS BG2 Y-Offset
2D Engine B 0x400101C BG3HOFS BG3 X-Offset
2D Engine B 0x400101E BG3VOFS BG3 Y-Offset
2D Engine B 0x4001020 BG2PA BG2 Rotation/Scaling Parameter A (dx)
2D Engine B 0x4001022 BG2PB BG2 Rotation/Scaling Parameter B (dmx)
2D Engine B 0x4001024 BG2PC BG2 Rotation/Scaling Parameter C (dy)
2D Engine B 0x4001026 BG2PD BG2 Rotation/Scaling Parameter D (dmy)
2D Engine B 0x4001028 BG2X BG2 Reference Point X-Coordinate
2D Engine B 0x400102C BG2Y BG2 Reference Point Y-Coordinate
2D Engine B 0x4001030 BG3PA BG3 Rotation/Scaling Parameter A (dx)
2D Engine B 0x4001032 BG3PB BG3 Rotation/Scaling Parameter B (dmx)
2D Engine B 0x4001034 BG3PC BG3 Rotation/Scaling Parameter C (dy)
2D Engine B 0x4001036 BG3PD BG3 Rotation/Scaling Parameter D (dmy)
2D Engine B 0x4001038 BG3X BG3 Reference Point X-Coordinate
2D Engine B 0x400103C BG3Y BG3 Reference Point Y-Coordinate
2D Engine B 0x4001040 WIN0H Window 0 Horizontal Dimensions
2D Engine B 0x4001042 WIN1H Window 1 Horizontal Dimensions
2D Engine B 0x4001044 WIN0V Window 0 Vertical Dimensions
2D Engine B 0x4001046 WIN1V Window 1 Vertical Dimensions
2D Engine B 0x4001048 WININ Inside of Window 0 and 1
2D Engine B 0x400104A WINOUT Inside of OBJ Window & Outside of Windows
2D Engine B 0x400104C MOSAIC Mosaic Size
2D Engine B 0x400104E - Not used
2D Engine B 0x4001050 BLDCNT Color Special Effects Selection
2D Engine B 0x4001052 BLDALPHA Alpha Blending Coefficients
2D Engine B 0x4001054 BLDY Brightness (Fade-In/Out) Coefficient
2D Engine B 0x4001056 - Not used
2D Engine B 0x400106C MASTER_BRIGHT 16bit - Brightness Up/Down
DSI 0x40021Ax
DSi Registers
DSI 0x4004xxx
DSi Registers
IPC/Rom 0x4100000
IPCFIFORECV - IPC Receive Fifo (R)
IPC/Rom 0x4100010
Gamecard bus 4-byte data in, for manual or dma read
Debug 0x4FFF0xx
Ensata Emulator Debug Registers
Debug 0x4FFFAxx
No$gba Emulator Debug Registers
Exception 0x27FFD9C
NDS9 Debug Stacktop / Debug Vector (0=None)
Exception DTCM+3FF8 4

Exception DTCM+3FFC 4

RamCtrl 0x27FFFFE
Main Memory Control

NDS Header

Offset  
Bytes  
Purpose Notes Sample
000h 12 Game Title (Uppercase ASCII, padded with 00h) .ascii "LEARNASM.NET"
00Ch 4 Gamecode (Uppercase ASCII, NTR-<code>)(0=homebrew) .ascii "0000"
010h 2 Makercode (Uppercase ASCII, eg. "01"=Nintendo) (0=homebrew) .ascii "00"
012h 1 Unitcode (00h=NDS, 02h=NDS+DSi, 03h=DSi) (bit1=DSi) .byte 0x00
013h 1 Encryption Seed Select (00..07h, usually 00h) .byte 0x00
014h 1 Devicecapacity (Chipsize = 128KB SHL nn) (eg. 7 = 16MB) .byte 0x00
015h 7 Reserved (zero filled) .space 7
01Ch 1 Reserved (zero)(except, used on DSi) .byte 0
01Dh 1 NDS Region (00h=Normal, 80h=China, 40h=Korea) (other on DSi) .byte 0
01Eh 1 ROM Version (usually 00h) .byte 0
01Fh 1 Autostart (Bit2: Skip "Press Button" after Health and Safety) .byte 4
020h 4 ARM9 rom_offset (0x4000h and up, align 1000h) .long Arm9_Start-HeaderStart
024h 4 ARM9 entry_address (2000000h..23BFE00h) .long 0x02000000
028h 4 ARM9 ram_address (2000000h..23BFE00h) .long 0x02000000
02Ch 4 ARM9 size (max 3BFE00h) (3839.5KB) .long Arm9_End-Arm9_Start
030h 4 ARM7 rom_offset (8000h and up) .long Arm7_Start-HeaderStart
034h 4 ARM7 entry_address (2000000h..23BFE00h, or 37F8000h..3807E00h) .long 0x03800000
038h 4 ARM7 ram_address (2000000h..23BFE00h, or 37F8000h..3807E00h) .long 0x03800000
03Ch 4 ARM7 size (max 3BFE00h, or FE00h) (3839.5KB, 63.5KB) .long Arm7_End-Arm7_Start
040h 4 File Name Table (FNT) offset
.long 0
044h 4 File Name Table (FNT) size
.long 0
048h 4 File Allocation Table (FAT) offset
.long 0
04Ch 4 File Allocation Table (FAT) size
.long 0
050h 4 File ARM9 overlay_offset
.long 0
054h 4 File ARM9 overlay_size
.long 0
058h 4 File ARM7 overlay_offset
.long 0
05Ch 4 File ARM7 overlay_size
.long 0
060h 4 Port 0x40001A4h setting for normal cmd (usually 00586000h) .long 0x00586000
064h 4 Port 0x40001A4h setting for KEY1 cmd (usually 001808F8h) .long 0x001808F8
068h 4 Icon/Title offset (0=None) (8000h and up) .long 0
06Ch 2 Secure Area Checksum CRC-16 of [[020h]..00007FFFh] .word 0
06Eh 2 Secure Area Delay (in 131kHz units) (051Eh=10ms or 0D7Eh=26ms) .word 0
070h 4 ARM9 Auto Load List Hook RAM Addr. \endaddr of auto-load .long 0
074h 4 ARM7 Auto Load List Hook RAM Addr. /functions .long 0
078h 8 Secure Area Disable (by encrypted "NmMdOnly") (usually zero) .space 8
080h 4 Total Used ROM size (remaining/unused bytes usually FFh-padded) .long 0
084h 4 ROM Header Size (0x4000h) .long 0x0x4000
088h 28h Reserved (zero filled except, [88h..93h] used on DSi) .space 0x28
0B0h 10h Reserved (zero filled or "DoNotZeroFillMem"=unlaunch fastboot) .space 0x10
0C0h 9Ch Nintendo Logo (compressed bitmap, same as in GBA Headers) .space 0x9C
15Ch 2 Nintendo Logo Checksum CRC-16 of [0C0h-15Bh], fixed CF56h .word 0
15Eh 2 Header Checksum CRC-16 of [000h-15Dh] .word 0
160h 4 Debug rom_offset (0=none) (8000h and up) only if debug .long 0
164h 4 Debug size (0=none) (max 3BFE00h) .long 0
168h 4 Debug ram_address (0=none) (20x400000h..27BFE00h) SIO and 8MB .long 0
16Ch 4 Reserved (zero filled) (transferred, and stored, but not used) .long 0
170h 90h Reserved (zero filled) (transferred, and stored, but not used) .space 0x90



Bare Metal ARM Assembly Hello World Example
There is a working 'single asm' bare metal sample in the sources.7z

the JOY of NDS
The Nintendo DS joypad buttons are split into two addresses...

The first is the classic GBA keys - these can be read from either the ARM9 or ARM7
0x0x4000130 - Joypad Keys (GBA Type)    ------LRDULRSsBA

The second is the new NDS keys... these can ONLY be read from the ARM7
0x0x4000136 - Extra Key Input    --------HP--D-YX

a PEN in the BUS
Accessing the PEN pos can only be done from the ARM7 - and its not entirely easy!
the X and Y pos use 12 bits each, but we can only load them 8 bits at a time, via a serial bus....

0x0x40001C0 - SPICNT - SPI Bus Control/Status Register
0x0x40001C2 - SPIDATA - SPI Bus Data/Strobe Register

Here is the sequence for reading an axis...

#0b1000101000000001 -> SPICNT  (Select Touchscreen)
#0b11010100 -> SPIDATA (Xpos) ... OR .... #0b10010100 -> SPIDATA (Ypos)
SPICNT -> Wait for Bit 7 of SPICNT to become 0
#0 -> SPIDATA
SPICNT -> Wait for Bit 7 of SPICNT to become 0
SPIDATA-> top 8 bits of axis HHHHHHHH
#0b1000001000000001 ->SPICNT (Get 2nd byte)
#0 -> SPIDATA
SPICNT -> Wait for Bit 7 of SPICNT to become 0
SPIDATA-> bottom 4 bits of axis LLLL0000

Sound Registers (ARM7)
The NDS has 16 sound channels (x nibble 0-F) which play digital sound samples

Address Bytes Name Description Bits Notes
0x4000304h 2 POWCNT2 Sound/Wifi Power Control Register (R/W) ------WS S=Sound on W=Wifi on
0x40004x0h 4 SOUNDxCNT Sound Channel X Control Register (R/W) SFFRRWWW-PPPPPPPH-----DD-VVVVVVV S=Start F=Format R=Repeat W=Wave duty P=Panning H=Hold D=volume Div V=Volume
0x40004x4h 4 SOUNDxSAD Sound Channel X Data Source Register (W) -----AAAAAAAAAAAAAAAAAAAAAAAA00 A=Address of sample
0x40004x8h 2 SOUNDxTMR Sound Channel X Timer Register (W) FFFFFFFFFFFFFFFF F=Frequency
0x40004xAh 2 SOUNDxPNT Sound Channel X Loopstart Register (W) LLLLLLLLLLLLLLLL L=Loop Start
0x40004xCh 4 SOUNDxLEN Sound Channel X Length Register (W) ----------LLLLLLLLLLLLLLLLLLLLL L=Length
0x4000500h 2 SOUNDCNT Sound Control Register (R/W) M-31RRLL-VVVVVVV M=Master on 31=output 31 to mixer RRLL=output from V=master Volume
0x4000504h 2 SOUNDBIAS Sound Bias Register (R/W) -------BBBBBBBBBB B=Sound Bias
0x4000508h 1 SNDCAP0CNT Sound Capture 0 Control Register (R/W) S---FEsC S=Start F=Format R=Repeat s=source C=Control
0x4000509h 1 SNDCAP1CNT Sound Capture 1 Control Register (R/W) S---FEsC
0x4000510h 4 SNDCAP0DAD Sound Capture 0 Destination Address (R/W) -----AAAAAAAAAAAAAAAAAAAAAAAA00 A=Address of Capture
0x4000514h 2 SNDCAP0LEN Sound Capture 0 Length (W) LLLLLLLLLLLLLLLL L=Length
0x4000518h 4 SNDCAP1DAD Sound Capture 1 Destination Address (R/W) -----AAAAAAAAAAAAAAAAAAAAAAAA00
0x400051Ch 2 SNDCAP1LEN Sound Capture 1 Length (W) LLLLLLLLLLLLLLLL L=Length


Sprites

Sprite patterns are defined by by VRAM addresses 0x060x400000+
Sprites use the 256 colors in the OBJ palette from address 0x05000200+

Sprites are made up of 8x8 patterns with either 16 colors (4bpp) or 256 colors (8bpp) defined by the color bit in the first parameter.


H Byte L Byte
VRAM Address F E D C B A 9 8 7 6 5 4 3 2 1 0 Details
7000000h S S C M T T D R Y Y Y Y Y Y Y Y Y=Ypos S=Shape (Square /HRect / Vrect) C=Colors(16/256) M=Mosiac
T=Transparent D=Disable/Doublesize R=Rotation
7000002h S S V H R R R X X X X X X X X X X=Xpos S=Obj Size (8x8,16x16,32x32,64x64) VH=V/HFlip
R=Rotation parameter
7000004h C C C C P P T T T T T T T T T T T=Tile Number
C=Color palette (16 color mode) P=Priority
7000006h Unused by sprite

Rotation and Scaling

On the GBA and NDS In some modes, Layers BG2 and BG3 can be rotated and scaled. The control of this is performed by registers 0x4001020h-0x400103Ch

For the mathematically challenged (Like me) I've created a spreadsheet which helps calculate the correct values for the effect you want... get it Here

NDS Example:

Bit Meanings: S=Sign I=Integer F=Float

Address Function 
Name Bits Default
0x0x4001020 
BG2PA BG2 Rotation/Scaling Parameter A (dx) SIIIIIIIFFFFFFFF 0x0100
0x0x4001022 BG2PB BG2 Rotation/Scaling Parameter B (dmx) SIIIIIIIFFFFFFFF 0x0000
0x0x4001024 BG2PC BG2 Rotation/Scaling Parameter C (dy) SIIIIIIIFFFFFFFF 0x0000
0x0x4001026 BG2PD BG2 Rotation/Scaling Parameter D (dmy) SIIIIIIIFFFFFFFF 0x0100
0x0x4001028 BG2X BG2 Reference Point X-Coordinate ----SIIIIIIIIIIIIIIIIIIIFFFFFFFF  0x00000000
0x0x400102C BG2Y BG2 Reference Point Y-Coordinate ----SIIIIIIIIIIIIIIIIIIIFFFFFFFF 0x00000000
0x0x4001030 BG3PA BG3 Rotation/Scaling Parameter A (dx) SIIIIIIIFFFFFFFF 0x0100
0x0x4001032 BG3PB BG3 Rotation/Scaling Parameter B (dmx) SIIIIIIIFFFFFFFF 0x0000
0x0x4001034 BG3PC BG3 Rotation/Scaling Parameter C (dy) SIIIIIIIFFFFFFFF 0x0000
0x0x4001036 BG3PD BG3 Rotation/Scaling Parameter D (dmy) SIIIIIIIFFFFFFFF 0x0100
0x0x4001038 BG3X BG3 Reference Point X-Coordinate ----SIIIIIIIIIIIIIIIIIIIFFFFFFFF 0x00000000
0x0x400103C BG3Y BG3 Reference Point Y-Coordinate ----SIIIIIIIIIIIIIIIIIIIFFFFFFFF 0x00000000