Something that has always bothered me is how many registers you need to write to in order to get DMA to working.
Not only do you have to touch $4300-$4306 and $420b, but if you need to touch other registers depending on what you're trying to do:
$2115 to $2117 for VRAM
$2102 and $2103 for OAM
$2121 for CGRAM
$2181 to $2183 for WRAM
I remember somebody saying "but you only need to make a routine that writes to these registers ONCE" but how do I make a routine that writes to a bunch of registers without having to pass a ton of variables, which would require as much code as I would need to write to said registers in the first place?
I know there are some commonly used arrangements such as:
-Writing bytes to $2104
-Writing bytes to $2122
-Writing bytes to $2180
-Writing words to $2118, incrementing by 1 when $2119 is written
-Writing bytes to $2118, incrementing by 1 when $2118 is written
-Writing bytes to $2119, incrementing by 1 when $2119 is written
-Writing words to $2118, incrementing by 32 when $2119 is written
Actually there are a TON of commonly used arrangements, and even more potentially useful arrangements, but I know for fact that most combinations don't make any sense, so there must be a way of pre-baking in patterns that make sense.
There's also a dilema of immediate parameters vs variable parameters. Immediate parameters you can store in an array, but variable parameters you have to either hardcode or use some kind of parameter passing method.
Not only do you have to touch $4300-$4306 and $420b, but if you need to touch other registers depending on what you're trying to do:
$2115 to $2117 for VRAM
$2102 and $2103 for OAM
$2121 for CGRAM
$2181 to $2183 for WRAM
I remember somebody saying "but you only need to make a routine that writes to these registers ONCE" but how do I make a routine that writes to a bunch of registers without having to pass a ton of variables, which would require as much code as I would need to write to said registers in the first place?
I know there are some commonly used arrangements such as:
-Writing bytes to $2104
-Writing bytes to $2122
-Writing bytes to $2180
-Writing words to $2118, incrementing by 1 when $2119 is written
-Writing bytes to $2118, incrementing by 1 when $2118 is written
-Writing bytes to $2119, incrementing by 1 when $2119 is written
-Writing words to $2118, incrementing by 32 when $2119 is written
Actually there are a TON of commonly used arrangements, and even more potentially useful arrangements, but I know for fact that most combinations don't make any sense, so there must be a way of pre-baking in patterns that make sense.
There's also a dilema of immediate parameters vs variable parameters. Immediate parameters you can store in an array, but variable parameters you have to either hardcode or use some kind of parameter passing method.