![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Tile AreasIt is always worth planning the various tile areas out in advance before you start a project. If you plan the tiles out properly, you should only need to make minor, if any, alterations during the course of the project. To help you plan the areas out, I have provided a convenient reference sheet in the source section of this site. The file is tilenum.doc and it is in Word for Windows version 2 format. If you need it in a different format (that can support tables) let me know and I will send you a version. In expedition, we will be using both banks, and both tile areas of each bank. The first tile area will be used for the sprites, the second area will be used for the background and window. Where these two areas cross over, we will be placing objects that will be displayed on the background/window and also used as sprites.
CodeTo set up our code to reflect this, open up your exped.asm file and go to the following section of the file: Start: ; Do some initialisation stuff here, setup data, etc. loop:Now, after the start comment and before the loop: line, place the following commands (the ones in bold text): Start: ; Do some initialisation stuff here, setup data, etc. ld sp,$FFFE ld a,0 ldh [$FF],a ldh [$41],a ldh [$42],a ldh [$43],a ld a,%01000011 ldh [$40],a loop:What this section of code does is to do some simple initialisation stuff. The ldh command is basically the same as the ld command except that it automatically adds $FF00 to the address given. This was incorporated by Nintendo to allow quick data transfer to the registers. Obviously ldh is quicker than ld, and takes less memory.
Loading the stack pointer (SP) with $FFFE is always a good idea. It
means that the stack is in a decent place.
The data loaded into $FF40 is the important bit here, it sets the following information:
Bit 7 : 0=Turn the LCD off
Area PlanningThe following section shows which tiles of which tile areas are being used for what. Obviously this section will be expanded as the project develops. As each new part of the project is written, this section will reflect the new tiles needed. As a result, please check this section when you get to a new part of the project.
Bank One - First Tile AreaThis section will be used for the sprites. The crossover with the second tile area will be used when a tile will be used for both sprites and background/window. Tiles None assigned yet
Bank One - Second Tile AreaThis section will be used for the background and window. The crossover with the first tile area will be used when a tile will be used for both background/window and sprites.
Tiles
Bank Two - First Tile AreaThis section will be used for the sprites. The crossover with the second tile area will be used when a tile will be used for both sprites and background/window. Tiles None assigned yet
Bank Two - Second Tile AreaThis section will be used for the background and window. The crossover with the first tile area will be used when a tile will be used for both background/window and sprites. Tiles None assigned yet
|