Tilemap: Difference between revisions

From SpecNext Wiki
Jump to: navigation, search
Julian S (talk | contribs)
mNo edit summary
Ped7g (talk | contribs)
cross-linking with particular Next-register articles, fixing range value in Y-offset description
Line 3: Line 3:
A screen mode similar to hardware text linked to the ULA modes which allows for either 40x32 or 80x32 16-colour 8x8 tiles.
A screen mode similar to hardware text linked to the ULA modes which allows for either 40x32 or 80x32 16-colour 8x8 tiles.


The tilemap is enabled using Nextreg $6B (107) Tilemap Control
The tilemap is enabled using {{NextRegNo|$6B}} (107)


   bit 7: 0=disable tilemap, 1=enable tilemap
   bit 7: 0=disable tilemap, 1=enable tilemap
Line 17: Line 17:
=== Tile Description ===
=== Tile Description ===


The tile description area is a contiguous list of tile descriptions starting at the location indicated by bits 5-0 of the value in Nextreg $6F (111) Tile Definitions Base Address.
The tile description area is a contiguous list of tile descriptions starting at the location indicated by bits 5-0 of the value in {{NextRegNo|$6F}} (111).


Each tile description is a 32 byte block of 4-bit values describing the indices of each pixel of a tile in row major order.
Each tile description is a 32 byte block of 4-bit values describing the indices of each pixel of a tile in row major order.
Line 23: Line 23:
=== Tilemap ===
=== Tilemap ===


The tilemap begins at the location stored in bits 5-0 of Nextreg $6E (110) Tilemap Base Address.
The tilemap begins at the location stored in bits 5-0 of {{NextRegNo|$6E}} (110).


This map either consists of either pairs of tile numbers and tile attributes, or a list of tile numbers. If no attributes are present (bit 5 of Nextreg $6B=1) then the attributes for all tiles come from Nextreg $6C (108) Default Tilemap Attribute.
This map either consists of either pairs of tile numbers and tile attributes, or a list of tile numbers. If no attributes are present (bit 5 of Nextreg $6B=1) then the attributes for all tiles come from {{NextRegNo|$6C}} (108).


==== Tile Attribute ====
==== Tile Attribute ====
Line 37: Line 37:
=== Additional Registers ===
=== Additional Registers ===


Nextreg $1B (27) Clip Window Tilemap
{{NextRegNo|$1B}} (27)
   bits 7-0: Coord. of the clip window
   bits 7-0: Coord. of the clip window
   1st write = X1 position
   1st write = X1 position
Line 46: Line 46:
   Reads do not advance the clip position
   Reads do not advance the clip position


Nextreg $2F (47) Tilemap Offset X MSB
{{NextRegNo|$2F}} (47)
   bits 7-2: Reserved (0)
   bits 7-2: Reserved (0)
   bits 1-0: MSB X Offset
   bits 1-0: MSB X Offset
   Meaningful Range is 0-319 in 40 char mode, 0-639 in 80 char mode
   Meaningful Range is 0-319 in 40 char mode, 0-639 in 80 char mode


Nextreg $30 (48) Tilemap Offset X LSB
{{NextRegNo|$30}} (48)
   bits 7-0: LSB X Offset
   bits 7-0: LSB X Offset
   Meaningful range is 0-319 in 40 char mode, 0-639 in 80 char mode
   Meaningful range is 0-319 in 40 char mode, 0-639 in 80 char mode


Nextreg $31 (49) Tilemap Offset Y
{{NextRegNo|$31}} (49)
   bits 7-0: Y Offset (0-191)
   bits 7-0: Y Offset (0-255)


Nextreg 43 (67) Palette Control
{{NextRegNo|$43}} (67)
   bit 7: '1' to disable palette write auto-increment.
   bit 7: '1' to disable palette write auto-increment.
   bits 6-4: Select palette for reading or writing:
   bits 6-4: Select palette for reading or writing:
Line 74: Line 74:
   bit 0: Enable Enhanced ULA mode if 1 (0 after a reset)
   bit 0: Enable Enhanced ULA mode if 1 (0 after a reset)


Nextreg $68 (104) ULA Control
{{NextRegNo|$68}} (104)
   bit 7: 1 to disable ULA output
   bit 7: 1 to disable ULA output
   bit 6: 0=select the ULA colour for blending in SLU modes 6 & 7
   bit 6: 0=select the ULA colour for blending in SLU modes 6 & 7

Revision as of 06:46, 23 May 2019

Tilemap

A screen mode similar to hardware text linked to the ULA modes which allows for either 40x32 or 80x32 16-colour 8x8 tiles.

The tilemap is enabled using {{#ask: TBRegisterNumber::$6B }} ($6B) (107)

 bit 7: 0=disable tilemap, 1=enable tilemap
 bit 6: 0=40x32, 1=80x32
 bit 5: 0=attributes in tilemap, 1=no attributes in tilemap
 bit 4: 0=primary palette, 1=secondary palette
 bits 3-2: reserved (0)
 bit 1: 0=256 tile mode, 1=512 tile mode
 bit 0: 1=tilemap over ULA

The tilemap consists of two data areas: tile descriptions and an actual tilemap; both of which are located in 16k page 5

Tile Description

The tile description area is a contiguous list of tile descriptions starting at the location indicated by bits 5-0 of the value in {{#ask: TBRegisterNumber::$6F }} ($6F) (111).

Each tile description is a 32 byte block of 4-bit values describing the indices of each pixel of a tile in row major order.

Tilemap

The tilemap begins at the location stored in bits 5-0 of {{#ask: TBRegisterNumber::$6E }} ($6E) (110).

This map either consists of either pairs of tile numbers and tile attributes, or a list of tile numbers. If no attributes are present (bit 5 of Nextreg $6B=1) then the attributes for all tiles come from {{#ask: TBRegisterNumber::$6C }} ($6C) (108).

Tile Attribute

 bits 7-4: palette offset
 bit 3: mirror X
 bit 2: mirror Y
 bit 1: Rotate
 bit 0: In 256-tile mode ULA over tilemap, in 512-tile mode bit 8 of tile number

Additional Registers

{{#ask: TBRegisterNumber::$1B }} ($1B) (27)

 bits 7-0: Coord. of the clip window
 1st write = X1 position
 2nd write = X2 position
 3rd write = Y1 position
 4rd write = Y2 position
 The values are 0,159,0,255 after a Reset
 Reads do not advance the clip position

{{#ask: TBRegisterNumber::$2F }} ($2F) (47)

 bits 7-2: Reserved (0)
 bits 1-0: MSB X Offset
 Meaningful Range is 0-319 in 40 char mode, 0-639 in 80 char mode

{{#ask: TBRegisterNumber::$30 }} ($30) (48)

 bits 7-0: LSB X Offset
 Meaningful range is 0-319 in 40 char mode, 0-639 in 80 char mode

{{#ask: TBRegisterNumber::$31 }} ($31) (49)

 bits 7-0: Y Offset (0-255)

{{#ask: TBRegisterNumber::$43 }} ($43) (67)

 bit 7: '1' to disable palette write auto-increment.
 bits 6-4: Select palette for reading or writing:
    000 = ULA first palette
    100 = ULA second palette
    001 = Layer 2 first palette
    101 = Layer 2 second palette
    010 = Sprites first palette 
    110 = Sprites second palette
    011 = Tilemap first palette
    111 = Tilemap second palette
 bit 3: Select Sprites palette (0 = first palette, 1 = second palette)
 bit 2: Select Layer 2 palette (0 = first palette, 1 = second palette)
 bit 1: Select ULA palette (0 = first palette, 1 = second palette)
 bit 0: Enable Enhanced ULA mode if 1 (0 after a reset)

{{#ask: TBRegisterNumber::$68 }} ($68) (104)

 bit 7: 1 to disable ULA output
 bit 6: 0=select the ULA colour for blending in SLU modes 6 & 7
        1=select the ULA/tilemap mix for blending in SLU modes 6 & 7
 bits 5-1: Reserved (0)
 bit 0: 1=enable stencil mode when both the ULA and tilemap are enabled
           (if either are transparent the result is transparent otherwise the
            result is a logical AND of both colours)