TUTORIAL #19 – MAPADR “Is used as a pointer to the World Map data points for all the graphic tile reference values”.
All the graphic-tiles/shapes in Ultima 1 are predefined within a database. These values consist of the type of shape used such as TREES, PLAINS, MOUNTAINS, OCEAN, etc… plus the amount of each type of shape within the world map. The world map is made up of 82 horizontal lines of graphic tiles; these tiles are drawn on the screen one at a time, line by line and byte by byte. The data has to be read from the MAP data file statement and uncompressed to a form that states the type and amount and then draws just a portion of the world map that is 20 tiles wide by 10 tiles deep.
I will be going through the subroutine MAPADR line-by-line and explaining what each line of code is doing
and how it affects the outcome of the program.
553 **********************************
This is just a comment line to separate each subroutine and
helps to define the start of the subroutine.
554 * LOAD MAP ADDRESS D
This comment line tells the user what type of data will be
referenced.
555 MAPADR DFB >MAP1
Line 555 is used to “[D]e[F]ine [B]ype” of MAP1
data location from the LOW byte side.
Each MAP location is defined by a HIGH and LOW byte, which in this case
is the > character representing the LOW byte location for the map addresses
in MAP1. An example of a memory region
address from the HIGH and LOW byte reference could be HEX $8000 or 32768. The HIGH side would be the 80 and the LOW
side would be the 00 of the HEX value $8000.
Also, line 555 has a header titled MAPADR, which allows it to be
called as a separate subroutine from the main subroutine.
556 DFB <MAP1
Line 556 is used to “[D]e[F]ine [B]ype” of MAP1
data location from the HIGH byte side.
Each MAP location is defined by a HIGH and LOW byte, which in this case
is the < character representing the HIGH byte location for the map addresses
in MAP1. MAP1 will call to a database
that will hold all the graphic tile types and amounts for the first horizontal
line of the world map. By using a HIGH
and LOW byte reference the map address is location in a memory region based on
the byte reference and can be called to reference the necessary data of that
map line.
557 DFB >MAP2
THRU
718 DFB <MAP82
Line 557 THRU 718 are all reference the same way with “[D]e[F]ine [B]ype” of MAP# data location. Each MAP location is defined by a HIGH and
LOW byte will be referenced the exact same way and hold all the world map data
information to help draw out the entire Ultima World map.
No comments:
Post a Comment