Strider (Genesis)/Notes: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
Line 9: Line 9:


Palettes are uncompressed. Most of them are stored from 0x22f08 to 0x23988.
Palettes are uncompressed. Most of them are stored from 0x22f08 to 0x23988.
Palette data is loaded in RAM by routine at 0x22edc. They are often by groups of 4 by routine at 0x22ec0.


== Levels Maps ==
== Levels Maps ==

Revision as of 16:54, 21 June 2022

These are notes about gfx ressources. Work in progress...

The vocabulary used in these notes follows Charles McDonalds' document genvdp.txt, easily available. Offsets refer to american version.

A table is an array of values starting with an offset list. For example, if a table is starting at 0x1000, the address of table[5] is obtained by looking at the 10-th offsets (they are 16 bits words) and adding it to 0x1000.

Palettes

Palettes are uncompressed. Most of them are stored from 0x22f08 to 0x23988.

Palette data is loaded in RAM by routine at 0x22edc. They are often by groups of 4 by routine at 0x22ec0.

Levels Maps

Levels maps are split in 256x256 submaps. Each submap is made of 16x16 tiles. Each tile is made of 2x2 patterns (a pattern is a 8x8 pixels stored in VRAM).

Due to the size of the map, there's always 2 set of submaps in RAM, one at 0xff0000, the other at 0xff3000. When the submap at 0xff3000 is displayed, the next submap is loaded at 0xff000, and vice-versa. The submap stored in 0xff3000 is refered by tiles id >= 0x80.

For example, the 1st level map is (ignoring 00 and 80's, that are blank submaps) :


                                                                 02 03                         
                                                           86 88 01 04 05 06                   
                                      85 86 88 8a 8c    83 85 87 89 05 01 81 83 85 87          
                                   82 84 87 89 8b 8d    82 84    04 06 02 82 84 86 88          
              01 02 03 04 05 06 07 81 83       8e 01 04 06                                     
                                                  02 03 05                                    

is actually made of 8 sets of submaps, denoted by letters below :


                                                                                 E02 E03                         
                                                                         D86 D88 E01 E04 E05 E06                   
                                              B85 B86 B88 B8a B8c    D83 D85 D87 D89 G05 G01 H81 H83 H85 H87          
                                          B82 B84 B87 B89 B8b B8d    D82 D84     G04 G06 G02 H82 H84 H86 H88          
              A01 A02 A03 A04 A05 A06 A07 B81 B83         B8e C01 C04 C06                                     
                                                              C02 C03 C05                                    

(the F set is loaded in the same location as G when entering a dome).

Patterns

Patterns are compressed for the most part, using the well-known nemesis compression scheme, documented here for example.

Some of them are stored in a list of 8 bytes entries at 0x2e25a, the 4 first bytes are DMA command (see gendvdp.txt §7)

Others of them are stored in a table starting at 0x2e364. Each entry is of the form :

  • N (1 byte) : counter
  • repeat N + 1 times:
    • source address in ROM (4 bytes)
    • dest address in VRAM (2 bytes)

Tiles

The list of 5 addresses (one per level) is stored at 0x249a.

Each entry is a 4 words sequence (a word is pattern id with its attributes, see genvdp.txt §13), successively top-left, top-right, bottom-keft, bottom-right of the tile.

Tilemaps

The 256x256 pixels tilemaps blocks are compressed. The decompression routine is located at 0x2074a, and the compression format is as follows :

  • The 6 first bytes are init values of different constants and variables used later :
    • size (1 byte)
    • mask (1 byte, only 5 bits used)
    • incremental_value (1 word), which is added to a base_value (given as a parameter of the decompression routine ; for tilemaps used in levels, base_value = 0)
    • fixed_value (1 word), added to the base_value
  • Then data are read bit per bit :
    • 00cccc : the incremental_value is written (p + 1) times in the output field, and is incremented each time it's written.
    • 01cccc : the fixed_value is written (p + 1) times
    • 100 cccc x...x v...v :
      • take the base_value,
      • mask its 5 first bits with the value of the mask,
      • replace the bits masked with the bits x
      • read (size) bits (1 to 16) v, and add the obtained value to the previous one
      • then write this value (c + 1) times
    • 101 cccc x...x v...v : the value to be written is computed the same way than previously, but this times, the value is incremented each time it's written
    • 110 cccc x...x v...v : the value to be written is computed the same way than previously, but this times, the value is decremented each time it's written
    • 111 cccc x...x v...v x...x v...v ... : (p + 1) values are written, each computed as previously, except if cccc = 1111, in chich case :
    • 1111111 : end of data

Maps

The maps are stored in a table starting at 0x28d7a.