Which DMA channel do we use and why do we use it?
Channel 3 for general purpose tasks
What is the main difference between Mode 0 and Mode 4?
Mode 0 is a tiled mode and Mode 4 is a bitmapped mode
How many backgrounds does the GBA have?
4
What is a sprite and how does it differ from an object in the background? Which charblocks are reserved for sprites?
An object that "floats" on top of the background and acts independently of it. Charblocks 4 and 5 reserved for sprites.
How large is a Charblock? How large is a Screenblock?
Charblock --> 16 kib
Screenblock --> 8 kib
How does DMA actually work (i.e. how does it interact with the CPU)
Halts the CPU and accesses memory directly for transfers
How many charblocks does the GBA provide for background tiles?
4
How does background priority work? Does this affect anything when we enable multiple backgrounds?
Background 0 is the highest priority, meaning it will be seen at the front even if multiple background are enabled.
How large is a spritesheet in 4bpp? 8bpp?
4bpp --> 256 x 256
8bpp --> 128 x 256
Describe the bit layout of an IEEE-754 floating point number.
(IEEE-754 is just the "official" name - this is the one we've talked about)
1 signed bit, 8 bit exponent, 23 bit significand
How many bytes does DMA treat as a "chunk" by default on the GBA?
2 bytes
What is the main difference between screenblocks and charblocks? Can they be used at the same time?
Charblocks hold background tiles in memory and Screenblocks hold tilemaps and display backgrounds. Each charblock has 8 screenblocks associated with its region of memory, so if a charblock is selected to hold tiles, a screenblock associated with another charblock must be selected.
What is the GBA background palette? Which modes is it used in and what happens if we used the default one?
The background palette is an array of 256 colors, used in mode 0 and mode 4. The default palette is all black, so there would be no colors other than black.
(this is why we load our tile palettes into the background palette)
How many attributes do sprites have THAT ARE RELEVANT TO US (no affine)? What do they do?
Sprites have 3 attributes relevant to regular sprites.
Attr0 --> y position, show/hide, shape, 4bpp/8bpp
Attr1 --> x position, size, vflip/hflip
Attr2 --> tileID, palette row (only used in 4bpp), priority
What is the difference between fixed point and floating point numbers on the GBA?
Fixed point numbers encode decimal values in powers of 2 - GBA has hardware implementation.
Floating point numbers are inefficient, requiring many CPU cycles - no hardware implementation on GBA.
What is the key difference between using DMA to draw a rectangle vs using DMA to draw an image?
When we draw a rectangle, its source is a solid color that doesn't change, while with an image we need to configure DMA to increment the source through the image's bitmap.
How is parallax set up on the GBA?
We need to enable 2 backgrounds and load in their tilemaps and tilesets. Then we need to set use the hOff and vOff surrogate variables to set their backgrounds' respective control registers to make the screen "scroll."
(multiple backgrounds moving @ different speeds)
If we have a wide background that is scrolling as we move, how do we account for wrap around?
Once the end of the map is reached, we can reset the hOff surrogate variable and the associated background control register back to the beginning of the map, which will make it blend well.
What is cornerface and how do we fix it? What if we wanted to fix it without hiding all of our sprites?
Cornerface is when the top left corner of the spritesheet (0,0) is drawn before sprites are hidden. This can be fixed by hiding all sprites before we draw them. If we didn't want to hide them, we can move our sprites on our spritesheet so that tile (0,0) draws a transparent tile.
What is the OAM and how do we use it? Why can't we just put all of our data for sprites into it directly, what do we need to do instead?
OAM (Object attribute memory) is an array that holds all the sprites in our program. It can only be written to during the vBlank period, so we can make a surrogate array called the shadowOAM that we can edit at any time and then DMA into the regular OAM during the vBlank.
DrawRect4 go!
ill just pull up an image
(This is technically a sprite question i know)
Write some code to add a sprite onto a pre-loaded background in Mode 0. You can assume that your spritesheet and relevant tiles have been correctly exported from usenti. Make sure the sprite moves directionally when a button is pressed (it does not have to animate right now), and that the shadowOAM is updated with attributes correctly set.
(look at sprites demo)
Write all the necessary code to set up a moving Mode 0 background exported from Usenti as background.c at 4 bpp. You may use whichever GBA background you would like. This should be a full program that has the screen move 1 pixel to the right every 4 seconds, and should run forever.
(You can assume all gba.c/h, macros, typical functions we have used before are filled out correctly, they just need to be included!)
(good god i am evil)
(look at sprite animation demo)
What is the analog sound channel for "noise"?
What shape does a "pure tone" have in analog sound? What about DMG sound channel 2? (draw these shapes)
The analog channel for "noise" is channel 4.
Pure tone --> sine wave
DMG sound channel 2 --> square wave