Guide - VRAM Allocation.

JustinBaldock

New Member
Jan 2, 2020
13
7
3
I've been looking at VERA VRAM and figuring out where I can put my sprites.
 

SlithyMatt

New Member
Sep 14, 2019
9
9
3
I've been looking at VERA VRAM and figuring out where I can put my sprites.
You appear to be excluding the reason why your allocation calculations were incorrect. It's because of the tilemap restrictions. There is no setting on VERA for 80x60, for instance, so the text layer needs to overscan the display with a 128x64 tilemap and have scroll position at 0,0 so that only the upper-left 80x60 tiles are visible. The tiles beyond the visible frame are still there in VRAM and completely addressable. And, if you adjust the scroll position, they can be seen on the display as well.

You don't see this with bitmap layers because they don't have the same overscan capability. A bitmap layer can only be 320 or 640 pixels wide and cannot scroll. That's why there is no VRAM space between each raster line.

Breaking down the differences between these layer modes would be a good idea, if you want to have a more useful document.

Just my two cents!
 
  • Like
Reactions: JustinBaldock

JustinBaldock

New Member
Jan 2, 2020
13
7
3
You appear to be excluding the reason why your allocation calculations were incorrect. It's because of the tilemap restrictions. There is no setting on VERA for 80x60, for instance, so the text layer needs to overscan the display with a 128x64 tilemap and have scroll position at 0,0 so that only the upper-left 80x60 tiles are visible. The tiles beyond the visible frame are still there in VRAM and completely addressable. And, if you adjust the scroll position, they can be seen on the display as well.

You don't see this with bitmap layers because they don't have the same overscan capability. A bitmap layer can only be 320 or 640 pixels wide and cannot scroll. That's why there is no VRAM space between each raster line.

Breaking down the differences between these layer modes would be a good idea, if you want to have a more useful document.

Just my two cents!
Thanks! I thought I had read someplace about overscan but I was going around in circles. I will update it over the next day or so.

I have updated it with credit to you. I'm still scratching my head for 40x30 since it should be 64x32 tiles x 2 for colour data. That should be 4096 bytes but If I put my sprite at $1000 I still get data on screen.
 
Last edited:
  • Like
Reactions: SlithyMatt

Arkia

New Member
Oct 13, 2019
1
0
1
While the 40x30 mode should only need a 64x32 tilemap by inspecting the layer settings it seems that it still uses a 128x64 tilemap in both modes.
 

JustinBaldock

New Member
Jan 2, 2020
13
7
3
While the 40x30 mode should only need a 64x32 tilemap by inspecting the layer settings it seems that it still uses a 128x64 tilemap in both modes.
I went for a walk scratching my head and when I got back I realized this, tested it and then updated my blog post again :)
 

SlithyMatt

New Member
Sep 14, 2019
9
9
3
While the 40x30 mode should only need a 64x32 tilemap by inspecting the layer settings it seems that it still uses a 128x64 tilemap in both modes.
That's because it's only doing display scaling. That way, if you scale it back to 80x60, the characters/tiles will be in the same place, but in the upper left corner. Going the other way, it's the same, except 3/4 of the screen is just being hidden. It's still there in VRAM, you just have to scroll the layer to see it.
 

StephenH

New Member
Feb 4, 2020
6
7
3
That's because it's only doing display scaling. That way, if you scale it back to 80x60, the characters/tiles will be in the same place, but in the upper left corner. Going the other way, it's the same, except 3/4 of the screen is just being hidden. It's still there in VRAM, you just have to scroll the layer to see it.
That seems to be a pretty common misconception -- the "display resolution" is not a layer setting like the sizes of the tilemaps. It's part of the composer, which is a different module of behavior from the layer settings.

I'm not sure whether the kernal resizes the layer settings if prompted to switch between different displays (either through the SCREEN statement or by storing a value in register A and then doing `jsr $FF5F` (screen set mode)).
 
Last edited:

SlithyMatt

New Member
Sep 14, 2019
9
9
3
That seems to be a pretty common misconception -- the "display resolution" is not a layer setting like the sizes of the tilemaps. It's part of the composer, which is a different module of behavior from the layer settings.

I'm not sure whether the kernal resizes the layer settings if prompted to switch between different displays (either through the SCREEN statement or by storing a value in register A and then doing `jsr $FF5F` (screen set mode)).
I don't think the Kernal does anything. The SCREEN instruction just sets the value in the composer and VERA does the rest in terms of scaling the graphics to the display.
 

StephenH

New Member
Feb 4, 2020
6
7
3
I don't think the Kernal does anything. The SCREEN instruction just sets the value in the composer and VERA does the rest in terms of scaling the graphics to the display.
Fair enough, I guess I'd have just meant the SCREEN statement then. "screen set mode" is exposed as a kernal function, though, and is documented to take the same parameters as SCREEN. I assume BASIC is literally calling it to perform SCREEN, after setting up registers. That why I referred to "the kernal".
 
  • Like
Reactions: JustinBaldock