File: gba.inc - Tab length: 1 2 4 8 - Lines: on off - No wrap: on off

001: @@@@@@@@@ CONTENTS @@@@@@@@@
002: @ 1. Key pad defines
003: @ 2. Display
004: @ 3. Sprites
005: @ 4. Background
006: @ 5. Sound
007: 
008: @@@@@@@@@ 1. KEY PAD DEFINES @@@@@@@@@
009: KEY_A       = 1
010: KEY_B       = 2
011: KEY_SELECT  = 4
012: KEY_START   = 8
013: KEY_RIGHT   = 16
014: KEY_LEFT    = 32
015: KEY_UP      = 64
016: KEY_DOWN    = 128
017: KEY_R       = 256
018: KEY_L       = 512
019: KEYS        = 0x04000130
020: KEYS_HIGH   = 0x04000000
021: KEYS_LOW    = 0x00000130
022: 
023: @@@@@@@@@ 2. Display @@@@@@@@@
024: MODE_0 = 0x00
025: MODE_1 = 0x01
026: MODE_2 = 0x02
027: MODE_3 = 0x03
028: MODE_4 = 0x04
029: MODE_5 = 0x05
030: 
031: BACKBUFFER = 0x010
032: H_BLANK_OAM = 0x020
033: 
034: OBJ_MAP_2D = 0x000
035: OBJ_MAP_1D = 0x040
036: 
037: FORCE_BLANK = 0x080
038: 
039: BG0_ENABLE = 0x0100
040: BG1_ENABLE = 0x0200
041: BG2_ENABLE = 0x0400
042: BG3_ENABLE = 0x0800
043: OBJ_ENABLE = 0x01000        @ = SPRITES_ENABLE: enable sprites
044: WIN1_ENABLE = 0x02000
045: WIN2_ENABLE = 0x04000
046: WINOBJ_ENABLE = 0x08000
047: VRAM = 0x06000000
048: VPAL = 0x05000000
049: REG_DISPCNT = 0x04000000    @
050: 
051: @@@@@@@@@ 3. SPRITES @@@@@@@@@
052: 
053: @*** Attribute 0 ***
054: @ F E D C  B A 9 8  7 6 5 4  3 2 1 0
055: @ S S A M  T T D R  J J J J  J J J J
056: @ 0-7   (J) = Y coordinate of the sprite (pixels)
057: @ 8     (R) = Rotation/Scaling on/off
058: @ 9     (D) = 0 - sprite is single sized;
059: @             1 - sprite is virtually double sized
060: @ A-B   (T) = 00 - normal
061: @             01 - semi-transparent
062: @             10 - obj window
063: @ C     (M) = enables mosaic for this sprite.
064: @ D     (A) = 256 color if on, 16 color if off
065: @ E-F   (S) = Size, MSB in attribute 0, LSB in attribute 1
066: 
067: @ Byte 1 = Y coordinate of the sprite, in pixels
068: @ Byte 2
069: ROTATION_FLAG   =  0x100
070: SIZE_DOUBLE     =  0x200
071: MODE_NORMAL     =  0x000
072: MODE_TRANSPERANT=  0x400
073: MODE_WINDOWED   =  0x800
074: MOSAIC          = 0x1000
075: COLOR_16        = 0x0000
076: COLOR_256       = 0x2000
077: SIZE_8          = 0x0000 @ Only valid for SQUARE
078: SIZE_16         = 0x4000
079: SIZE_32         = 0x8000
080: SIZE_64         = 0xC000
081: 
082: @*** Atribute 1 ***
083: @ FEDC BA98 7654 3210
084: @ SSVH XXXI IIII IIII   (standard sprites)
085: @ SSFF FFFI IIII IIII   (rotation/scaling on)
086: @ 0-8 (I) = X coordinate of the sprite (pixels)
087: @ C   (H) = flip horizinal bit
088: @ D   (V) = flip vertical bit
089: @ 9-D (F) = rotation index (0-31). rotation/scaling data in OAM attribute 3
090: @ E-F (S) = Size of the sprite (LSB)
091: @           4-bit value which sets the size of the sprite in the following way:
092: @           00 00: 8  x 8       10 00: 8  x 16
093: @           00 01: 16 x 16      10 01: 8  x 32
094: @           00 10: 32 x 32      10 10: 16 x 32
095: @           00 11: 64 x 64      10 11: 32 x 64
096: @           01 00: 16 x 8       11 00: Not used
097: @           01 01: 32 x 8       11 01: Not used
098: @           01 10: 32 x 16      11 10: Not used
099: @           01 11: 64 x 32      11 11: Not used
100: 
101: @ Byte 3+1 bit = X coordinate of the sprite, in pixels (9-bit value)
102: @ Byte 4
103: SQUARE          = 0x0000
104: WIDE            = 0x4000
105: TALL            = 0x8000
106: HORIZONTAL_FLIP = 0x1000
107: VERTICAL_FLIP   = 0x2000
108: OAM             = 0x07000000
109: OBJPAL          = 0x5000200
110: CHARMEM         = 0x6010000
111: CHARMEM_MODE3   = 0x6012BFD
112: 
113: @@@@@@@@@ 4. Background @@@@@@@@@
114: 
115: REG_BG0CNT  = 0x4000008
116: REG_BG1CNT  = 0x400000A
117: REG_BG2CNT  = 0x400000C
118: REG_BG3CNT  = 0x400000E
119: REG_BG0HOFS = 0x4000010
120: REG_BG0VOFS = 0x4000012
121: REG_BG1HOFS = 0x4000014
122: REG_BG1VOFS = 0x4000016
123: REG_BG2HOFS = 0x4000018
124: REG_BG2VOFS = 0x400001A
125: REG_BG3HOFS = 0x400001C
126: REG_BG3VOFS = 0x400001E
127: REG_BG2PA   = 0x4000020
128: REG_BG2PB   = 0x4000022
129: REG_BG2PC   = 0x4000024
130: REG_BG2PD   = 0x4000026
131: REG_BG2X    = 0x4000028
132: REG_BG2X_L  = 0x4000028
133: REG_BG2X_H  = 0x400002A
134: REG_BG2Y    = 0x400002C
135: REG_BG2Y_L  = 0x400002C
136: REG_BG2Y_H  = 0x400002E
137: REG_BG3PA   = 0x4000030
138: REG_BG3PB   = 0x4000032
139: REG_BG3PC   = 0x4000034
140: REG_BG3PD   = 0x4000036
141: REG_BG3X    = 0x4000038
142: REG_BG3X_L  = 0x4000038
143: REG_BG3X_H  = 0x400003A
144: REG_BG3Y    = 0x400003C
145: REG_BG3Y_L  = 0x400003C
146: REG_BG3Y_H  = 0x400003E
147: 
148: BG_MOSAIC_ENABLE = 0x40
149: BG_COLOR_256 = 0x80
150: BG_COLOR_16 = 0x0
151: 
152: TEXTBG_SIZE_256x256 = 0x0
153: TEXTBG_SIZE_256x512 = 0x8000
154: TEXTBG_SIZE_512x256 = 0x4000
155: TEXTBG_SIZE_512x512 = 0xC000
156: 
157: ROTBG_SIZE_128x128 = 0x0
158: ROTBG_SIZE_256x256 = 0x4000
159: ROTBG_SIZE_512x512 = 0x8000
160: ROTBG_SIZE_1024x1024 = 0xC000
161: 
162: WRAPAROUND = 0x2000
163: 
164: CHAR_SHIFT = 2 @ Used to shift the number over to the right place in REG_BGxCNT
165: SCREEN_SHIFT = 8
166: 
167: @ Defines for all 32 screen (map data) blocks and 4 character (bitmap data) blocks
168: @ Some of this might not be correct
169: CHAR_BLOCK_0 = 0x6000000
170: CHAR_BLOCK_1 = 0x6004000
171: CHAR_BLOCK_2 = 0x6008000
172: CHAR_BLOCK_3 = 0x600C000
173: SCREEN_BLOCK_0 = 0x6000000
174: SCREEN_BLOCK_1 = 0x6000800
175: SCREEN_BLOCK_2 = 0x6001000
176: SCREEN_BLOCK_3 = 0x6001800
177: SCREEN_BLOCK_4 = 0x6002000
178: SCREEN_BLOCK_5 = 0x6002800
179: SCREEN_BLOCK_6 = 0x6003000
180: SCREEN_BLOCK_7 = 0x6003800
181: SCREEN_BLOCK_8 = 0x6004000
182: SCREEN_BLOCK_9 = 0x6004800
183: SCREEN_BLOCK_10 = 0x6005000
184: SCREEN_BLOCK_11 = 0x6005800
185: SCREEN_BLOCK_12 = 0x6006000
186: SCREEN_BLOCK_13 = 0x6006800
187: SCREEN_BLOCK_14 = 0x6007000
188: SCREEN_BLOCK_15 = 0x6007800
189: SCREEN_BLOCK_16 = 0x6008000
190: SCREEN_BLOCK_17 = 0x6008800
191: SCREEN_BLOCK_18 = 0x6009000
192: SCREEN_BLOCK_19 = 0x6009800
193: SCREEN_BLOCK_20 = 0x600A000
194: SCREEN_BLOCK_21 = 0x600A800
195: SCREEN_BLOCK_22 = 0x600B000
196: SCREEN_BLOCK_23 = 0x600B800
197: SCREEN_BLOCK_24 = 0x600C000
198: SCREEN_BLOCK_25 = 0x600C800
199: SCREEN_BLOCK_26 = 0x600D000
200: SCREEN_BLOCK_27 = 0x600D800
201: SCREEN_BLOCK_28 = 0x600E000
202: SCREEN_BLOCK_29 = 0x600E800
203: SCREEN_BLOCK_30 = 0x600F000
204: SCREEN_BLOCK_31 = 0x600F800
205: 
206: @@@@@@@@@ 5. Sound @@@@@@@@@
207: @ To turn sound on:
208: @   ldr r1,=REG_SOUNDCNT_X
209: @   ldr r0,=0x0081
210: @   str r0,[r1]
211: 
212: REG_SOUND1CNT_L = 0x04000060 @ Sound 1 Sweep control
213: REG_SOUND1CNT_H = 0x04000062 @ Sound 1 Length, wave duty and envelope control
214: REG_SOUND1CNT_X = 0x04000064 @ Sound 1 Frequency, reset and loop control
215: REG_SOUND2CNT_L = 0x04000068 @ Sound 2 Length, wave duty and envelope control
216: REG_SOUND2CNT_H = 0x0400006C @ Sound 2 Frequency, reset and loop control
217: REG_SOUND3CNT_L = 0x04000070 @ Sound 3 Enable and wave ram bank control
218: REG_SOUND3CNT_H = 0x04000072 @ Sound 3 Sound Length and output level control
219: REG_SOUND3CNT_X = 0x04000074 @ Sound 3 Frequency, reset and loop control
220: REG_SOUND4CNT_L = 0x04000078 @ Sound 4 Length, output level and envelope control
221: REG_SOUND4CNT_H = 0x0400007C @ Sound 4 Noise parameters, reset and loop control
222: REG_SOUNDCNT_L  = 0x04000080 @ Sound 1-4 Output level and Stereo control
223: REG_SOUNDCNT_H  = 0x04000082 @ Direct Sound control and Sound 1-4 output ratio
224: REG_SOUNDCNT_X  = 0x04000084 @ Master sound enable and Sound 1-4 play status
225: REG_SOUNDBIAS   = 0x04000088 @ Sound bias and Amplitude resolution control
226: REG_WAVE_RAM0_L = 0x04000090 @ Sound 3 samples 0-3
227: REG_WAVE_RAM0_H = 0x04000092 @ Sound 3 samples 4-7
228: REG_WAVE_RAM1_L = 0x04000094 @ Sound 3 samples 8-11
229: REG_WAVE_RAM1_H = 0x04000096 @ Sound 3 samples 12-15
230: REG_WAVE_RAM2_L = 0x04000098 @ Sound 3 samples 16-19
231: REG_WAVE_RAM2_H = 0x0400009A @ Sound 3 samples 20-23
232: REG_WAVE_RAM3_L = 0x0400009C @ Sound 3 samples 23-27
233: REG_WAVE_RAM3_H = 0x0400009E @ Sound 3 samples 28-31
234: REG_FIFO_A_L    = 0x040000A0 @ Direct Sound channel A samples 0-1
235: REG_FIFO_A_H    = 0x040000A2 @ Direct Sound channel A samples 2-3
236: REG_FIFO_B_L    = 0x040000A4 @ Direct Sound channel B samples 0-1
237: REG_FIFO_B_H    = 0x040000A6 @ Direct Sound channel B samples 2-3