copying RAM->VRAM tilemap

Pagina 2/2
1 |

Van norakomi

Paragon (1102)

afbeelding van norakomi

30-10-2021, 11:36

ARTRAG wrote:

Why don't you change the ram address to the next tile?
You can precompute the 16 addresses in a ram array and use them for the first line of tiles

interesting...
So I would copy the first 8 lines of tile 1, then the first 8 lines of tile 2 and repeat until the last tile (32).
Then repeat the whole process starting at the 2nd line....
Didn't think about that. That would save time indeed !! I will try that.

Van ARTRAG

Enlighted (6689)

afbeelding van ARTRAG

30-10-2021, 15:15

If you keep the addresses of the tiles in ram (16 words) you can reuse them for the next pixel lines
In this case you will skip other computations till the next line of tiles

Van ARTRAG

Enlighted (6689)

afbeelding van ARTRAG

30-10-2021, 19:19

It could look like something like this (in pseudo code)

j = address of you screen map in ram (16x12 bytes)

set vram pointer to 0

for yy=0 to 12  ' loop on rows in the screen map

' compute the addresses of data of the first line of data
for xx=0 to 15
 ramaddr(xx) = address of pixels of tile (j)
 j = j+1
next

' plot all tiles in the image 16x12
for y=0 to 15 ' loop in the number of lines of a tile
' plot a line of pixels of the screen (256 pixels)
for i=0 to 15 ' loop on the number of tiles in a raw
  ' plot a line in a tile
   hl = ramaddr(i)
   outi;outi;outi;outi;outi;outi;outi;outi 
   ramaddr(i) = hl
next
next

next

Van Grauw

Ascended (10306)

afbeelding van Grauw

30-10-2021, 19:43

Something that can be useful for optimisation; if the tile data is aligned in memory, so their address is aligned to either 128 bytes (screen 5) or 256 bytes (screen 8), the lower 7 bits or 8 bits can be determined from the X / Y position. (Assuming 16x16 tiles here.)

In the case of screen 5, if you don’t want to deal with masking that 8th bit in and out of the LSB, just be wasteful and pad the tile data to make it align to 256 bytes anyway. To be less wasteful, find some useful data to place in that padding, for example could have tile data there that’s pre-rotated for faster vertical output.

Pagina 2/2
1 |