Page 2 of 2

Me starting out with scrolling tiles

Posted: Fri Jul 08, 2022 11:35 pm
by ZeroByte


On 7/8/2022 at 6:28 PM, Ed Minchau said:




To load into bank 1 of VERA, 



VLOAD"LANDTILES.BIN",8,3,$1000



should work better. 8,1,$1000 would load it into low RAM at address $1000.



I think you're getting LOAD and VLOAD's behavior mixed up. VLOAD implies VRAM and passes 2 or 3 into Kernal LOAD based on 0,1 from command line.

 


Me starting out with scrolling tiles

Posted: Sat Jul 09, 2022 12:58 am
by Ed Minchau

Yup, you're right,  I'm too used to the kernal LOAD.


Me starting out with scrolling tiles

Posted: Mon Sep 12, 2022 7:23 pm
by rje

I'm thinking C will actually be easier than BASIC, even with a simple case.

 

 


Me starting out with scrolling tiles

Posted: Mon Sep 12, 2022 7:57 pm
by rje

Alright, I'll start from first principles.

TILE MODE ON THE X16

The Tile

A tile is a graphical object that is 8x8, 8x16, 16x8, or 16x16 pixels.  All your tiles are stored in a contiguous block of memory in VRAM. 

Each pixel in a tile requires 2, 4, or 8 bits in the tile data, based on the color depth of the tile map. The memory required for each tile depends on the color depth and tile size:


  • 2 color, 8x8 = 16 bytes per tile


  • 16 color, 8x8 = 32 bytes "


  • 256 color, 8x8 = 64 bytes "

     


  • 2 color, 8x16 = 32 bytes per tile


  • 16 color, 8x16 = 64 bytes "


  • 256 color, 8x16 = 128 bytes "


16x8 has the same memory requirements as 8x16


  • 2 color, 16x16 = 64 bytes per tile


  • 16 color, 16x16 = 128 bytes "


  • 256 color, 16x16 = 256 bytes "


In this respect, tiles are just like small sprites.

Set the Tile Base Address to point to the start of your tile data.

The Tile Map

A tile map is a list of tile entries. A tile entry has a one-byte tile index, a palette offset, and "flip" bits. Note that this means you can have up to 256 unique tiles in a map.

Note that the color index in each tile is modified by the palette offset in the tile entry using the following logic:


  • Color index 0 (transparent) and 16-255 are unmodified.


  • Color index 1-15 is modified by adding 16 x palette offset.


Set the Tile Map Address to point to the start of your tile map list.


Me starting out with scrolling tiles

Posted: Mon Sep 12, 2022 8:01 pm
by rje

Is there a performance benefit to using 8x8 tiles over 16x16 tiles, if the same viewport size is used?  It would seem more efficient to blit one 16x16 tile than to blit four 8x8 tiles, but I don't know -- blasting sprites around certainly didn't feel performant.

In other words, is it better to have an 8x8 view of 16x16 tiles, or a 16x16 view of 8x8 tiles?

 


Me starting out with scrolling tiles

Posted: Mon Sep 12, 2022 10:40 pm
by Fenner Machine


8×8 tiles need more memory for the tile base than 16×16 tiles.


Using vertical and horizontal flipping and palette offset 8×8 can be more memory efficient.


There is a trade-off depending on exactly what you need video memory for – tiles or sprites.


And you need time to use the efficiency potential.