Page 2 of 6

Re: Where to find current VRAM layout?

Posted: Thu Mar 21, 2024 11:42 pm
by ahenry3068
Slevin wrote: Thu Mar 21, 2024 11:37 pm
Graphics Layer starts at 0:0 Text starts at 1:B000
So consequently this would mean that in a symmetric layout I would set the graphics layer for L0 to start at 0:0, while the graphics layer for L1 should start at 0:D800.

And all this will be done through the VERA control register $9F2E for L0 and $9F35 for L1.

Please tell me that I'm correct, so I can go to bed relieved, being able dreaming of unicorns and cotton candy... :D
Not quite. There is a Graphics Layer and a Text Layer. L0 is the Graphics Layer. L1 is the Text Layer (Though Z order can be switched). There is not enough VRAM for more than one 320x240x 256 color graphics layer.

Re: Where to find current VRAM layout?

Posted: Thu Mar 21, 2024 11:59 pm
by Slevin
Ah, so that's the first time I read this, that Layer 0 is the graphics layer and Layer 1 is dedicated for displaying text. I thought both of these layer could be used to display graphic maps as described by SlithyMatt here: https://youtu.be/Wn8-unoaWSc?list=PLPSr ... RI_&t=1420

Matt explicitly describes the benefit of having two independent layers to get easy parallax effect for example. To be honest, I'm now a bit confused, but that could also come from just getting old ;)

Thanks a lot, each little piece helps to clarify a bit more.

Re: Where to find current VRAM layout?

Posted: Fri Mar 22, 2024 12:08 am
by ahenry3068
Slevin wrote: Thu Mar 21, 2024 11:59 pm Ah, so that's the first time I read this, that Layer 0 is the graphics layer and Layer 1 is dedicated for displaying text. I thought both of these layer could be used to display graphic maps as described by SlithyMatt here: https://youtu.be/Wn8-unoaWSc?list=PLPSr ... RI_&t=1420

Matt explicitly describes the benefit of having two independent layers to get easy parallax effect for example. To be honest, I'm now a bit confused, but that could also come from just getting old ;)

Thanks a lot, each little piece helps to clarify a bit more.
Well SlithyMatt is talking about Tilemode. Text Mode is actually a version of Tile mode. There we are getting out of my shoebox. I've made my self thoroughly familiar with the Bitmap mode, because I was used to DOS Mode 13h programming in another life. VERA Bitmap has much in common with that. I'm now getting started on Sprites. I haven't really done much with Tile Mode myself.

Your confused because the VERA has MANY capabilities and you are trying to suck it all up at once :D . That's OK though. I'm still learning a lot myself.

Re: Where to find current VRAM layout?

Posted: Fri Mar 22, 2024 12:18 am
by Slevin
Yeah, for a non gaming programmer there are multiple topics to cover at once. And on top of all of this, it's done through retro coding with limited resources, 8bit registers, banking, and to complicate things even more: using a proprietary self developed graphic unit replacement called VERA :).

Don't get me wrong, all of this is quiet impressive and very interesting to dive in, but there is also very much to learn and it's just normal, that the documentation isn't able to cover all varieties of thinking at the very stage the project is for now. I could imagine, that retro programmers who have coded lots of games for the C64 are at least familiar with the basic concepts and must not deal with simple things like tiles or so in their head. However, I have to, and I have tons of question marks flying round my head, forming an halo like Jesus had ;)

Cheers and thank you all for all the worthy information

Re: Where to find current VRAM layout?

Posted: Fri Mar 22, 2024 12:26 am
by ahenry3068
Slevin wrote: Fri Mar 22, 2024 12:18 am Yeah, for a non gaming programmer there are multiple topics to cover at once. And on top of all of this, it's done through retro coding with limited resources, 8bit registers, banking, and to complicate things even more: using a proprietary self developed graphic unit replacement called VERA :).

Don't get me wrong, all of this is quiet impressive and very interesting to dive in, but there is also very much to learn and it's just normal, that the documentation isn't able to cover all varieties of thinking at the very stage the project is for now. I could imagine, that retro programmers who have coded lots of games for the C64 are at least familiar with the basic concepts and must not deal with simple things like tiles or so in their head. However, I have to, and I have tons of question marks flying round my head, forming an halo like Jesus had ;)

Cheers and thank you all for all the worthy information
You don't have to learn it all at once. I did CRAPS first. That's entirely in Text Mode. I didn't mess with VERA really at all. Just BASIC Print commands. Then I did some demo stuff. Learned about VERA. I then wrote HANGMAN (see Games) I'm pretty proud of that. But it doesn't deal with Tiles or Sprites at all. I did it all with just the Graphics and Text Layers already supplied. Now I'm doing a couple of other things and I'm dealing with Sprites on my next project.

Re: Where to find current VRAM layout?

Posted: Fri Mar 22, 2024 2:40 am
by BruceRMcF
ahenry3068 wrote: Thu Mar 21, 2024 11:42 pm
Slevin wrote: Thu Mar 21, 2024 11:37 pm
Graphics Layer starts at 0:0 Text starts at 1:B000
So consequently this would mean that in a symmetric layout I would set the graphics layer for L0 to start at 0:0, while the graphics layer for L1 should start at 0:D800.

And all this will be done through the VERA control register $9F2E for L0 and $9F35 for L1.

Please tell me that I'm correct, so I can go to bed relieved, being able dreaming of unicorns and cotton candy... :D
Not quite. There is a Graphics Layer and a Text Layer. L0 is the Graphics Layer. L1 is the Text Layer (Though Z order can be switched). There is not enough VRAM for more than one 320x240x 256 color graphics layer.
Don't confuse the default layout with the hardware. You can set use either/both layers as a bitmap and you can use either/both layers as a text/tile layer.

There is not enough VRAM for more than one 320x240x8bpp graphics, but there's ample room for two 320x240x4bpp graphics.

Also, you don't have to use the full 320x240 for the 320x240x8bb, so if you have a bit map Layer 1 with transparency only in the top half to see "through" it to Layer 0, you could have a 320x120x8bpp bitmap in the top half of Layer 0 and wouldn't require data for the bottom half of Layer0.

Re: Where to find current VRAM layout?

Posted: Fri Mar 22, 2024 5:43 pm
by hstubbs3
BruceRMcF wrote: Fri Mar 22, 2024 2:40 am
ahenry3068 wrote: Thu Mar 21, 2024 11:42 pm
Slevin wrote: Thu Mar 21, 2024 11:37 pm
So consequently this would mean that in a symmetric layout I would set the graphics layer for L0 to start at 0:0, while the graphics layer for L1 should start at 0:D800.

And all this will be done through the VERA control register $9F2E for L0 and $9F35 for L1.

Please tell me that I'm correct, so I can go to bed relieved, being able dreaming of unicorns and cotton candy... :D
Not quite. There is a Graphics Layer and a Text Layer. L0 is the Graphics Layer. L1 is the Text Layer (Though Z order can be switched). There is not enough VRAM for more than one 320x240x 256 color graphics layer.
Don't confuse the default layout with the hardware. You can set use either/both layers as a bitmap and you can use either/both layers as a text/tile layer.

There is not enough VRAM for more than one 320x240x8bpp graphics, but there's ample room for two 320x240x4bpp graphics.

Also, you don't have to use the full 320x240 for the 320x240x8bb, so if you have a bit map Layer 1 with transparency only in the top half to see "through" it to Layer 0, you could have a 320x120x8bpp bitmap in the top half of Layer 0 and wouldn't require data for the bottom half of Layer0.
Eeek.. I didn't grab a screenshot of it because I was having bugs still but...
https://github.com/hstubbs3/CommanderX1 ... ex_sprites

hex.PRG, press 0 to switch between 160x120 scaled screen and 256x192 scaled screen ... now with DEBUG info .. lol..

also, sorry for the flashing.. was working on getting double-buffering sorted out with a semaphore between main code and the interrupt handler... as I have to copy sprite attributes from a buffer in VRAM into the sprite table during V-blank as well as flip the buffers... and didn't want to muck with trying to figure out how to save/restore VERA state...


using layer0 as 16 color bitmap layer and layer1 is 1bit tilemode / 16 color... so where the 160x120 graphic should not poke through, the tile layer BG is set opaque...

so, hypothetically, one could have a 320x240 "window" on the left side of the screen somewhere, the upper-left being simplest, stay in 640x480 scaled resolution, and use a tile layer1 to implement other elements, and then sprites and such for further things...

there was some posts about how many sprite pixels you can achieve per line... like it appears you should be able to get at least ~500 pixels worth of sprites per line if they're 4bit sprites and you have nothing else going on..
bitmap and tilemode layers and higher bpp chew into the bandwidth the vera can use for sprite pixels on a line-by-line basis..

Re: Where to find current VRAM layout?

Posted: Fri Mar 22, 2024 6:16 pm
by hstubbs3
ahenry3068 wrote: Fri Mar 22, 2024 12:08 am
Slevin wrote: Thu Mar 21, 2024 11:59 pm Ah, so that's the first time I read this, that Layer 0 is the graphics layer and Layer 1 is dedicated for displaying text. I thought both of these layer could be used to display graphic maps as described by SlithyMatt here: https://youtu.be/Wn8-unoaWSc?list=PLPSr ... RI_&t=1420

Matt explicitly describes the benefit of having two independent layers to get easy parallax effect for example. To be honest, I'm now a bit confused, but that could also come from just getting old ;)

Thanks a lot, each little piece helps to clarify a bit more.
Well SlithyMatt is talking about Tilemode. Text Mode is actually a version of Tile mode. There we are getting out of my shoebox. I've made my self thoroughly familiar with the Bitmap mode, because I was used to DOS Mode 13h programming in another life. VERA Bitmap has much in common with that. I'm now getting started on Sprites. I haven't really done much with Tile Mode myself.

Your confused because the VERA has MANY capabilities and you are trying to suck it all up at once :D . That's OK though. I'm still learning a lot myself.

Just want to be sure this is clear - the VERA will not let you SCROLL A W$#W$@#$#$ BITMAP LAYER... or have one that is not 320 or 640 pixels wide..

which feels really off when 160x120 or 256x192 are such reasonable options for the display...

if you needed a bitmap layer that scrolled... You'd end up with a non-linear framebuffer a-la try to draw random pixel to tiles on a Sega Mega Drive...
like you _could_ have the tile map like so - ... we're going with a screen like something x 64 here because time typing..

00 08 10 18 20 28 ... 01 09 11 19 21 29 .. 02 0A 12 1A 22 2A .. 03 0B 13 1B 23 2B .. 04 0C 14 1C 24 2C .. 05 0D 15 1D 25 2D .. 06 0E 16 1E 26 2E .. 07 0F 17 1F 27 2F ..

and then you could draw a vertical line down the screen in (we'll say 256 colors, so 1 byte per pixel.. ) by setting the auto-increment to 8 .... and then each tile just flows into the one below it until the bottom of the screen then it flows into the tile at the top of the next column ..

due to how the tiles are defined, you can't make any run of more than a tile width be a simple affair....


but - for drawing cols to the screen ... say maybe for wolfenstein 3D style raycaster, or for scrolling a bitmap horizontally, could be simplest way??

just messier than I'd like..

Re: Where to find current VRAM layout?

Posted: Fri Mar 22, 2024 7:13 pm
by funkheld
Hi good afternoon.

what is bitmap level 0 and bitmap level 1 please?

How can you make bitmap level 1 transparent to bitmap level 0 in the graphic, no tiles?

you write, 2 bitmap levels can be created with 320x240x4bpp graphics.

that is very, very interesting.

how does that work please?


Thanks.
greeting

Re: Where to find current VRAM layout?

Posted: Fri Mar 22, 2024 7:49 pm
by hstubbs3
funkheld wrote: Fri Mar 22, 2024 7:13 pm Hi good afternoon.

what is bitmap level 0 and bitmap level 1 please?

How can you make bitmap level 1 transparent to bitmap level 0 in the graphic, no tiles?

you write, 2 bitmap levels can be created with 320x240x4bpp graphics.

that is very, very interesting.

how does that work please?


Thanks.
greeting
Funkheld,
Layer0 ... configure as some bitmap format.. let's say we make it 320px wide, 4bpp starting at 0:$0000 in VRAM.
240x320x4bits = 37.5KB ... OK, we still have VRAM left to play with...

Layer1... we'll configure it starting at 1:$0000 in VRAM, for simplicity... so there is 64K-37.5K = 26.5K between these bitmaps
And following layer1 bitmap would be about 25K of VRAM... before we knock into PSG,palette,and sprite attributes (which are fixed at the end of VRAM )

So... we have NO tile layer... any text or other things would need to be done using sprites or drawn to a bitmap layer... but...

Layer0 - color 0 on this layer will always end up being the background screen color.. so layer0 really has 16 colors it could use..
Layer1 - color 0 on this layer is transparent.. so only 15 colors can really be used on this layer..


I don't see a good use case for this configuration, but .... playing a little what-if here...

Layer1 doesn't HAVE to be 4bit... the bitmap modes can be configured to 1bpp or 2bpp ... so maybe Layer0 is a map of the world or something.. maybe it is 256 color and Layer1 is only 1bit/2bit ...

but one potential usecase could be to draw something like a map of the world onto Layer0.. "full screen" 320x240 say... it won't be able to scroll but it fits our need at the moment..

And layer0 was used to draw lines or something... like we want Layer0 to be a bitmap because it simplifies copying sections to it and drawing at random pixels...

But we also want Layer1 to be a bitmap so that we can plot points or whatever, and then be able to _erase_ them without affecting the underlying layer0 ... like I was thinking, Layer0 is a map of the world, and then layer1 we are drawing lines like maybe where planes are flying to or something.. and when we want to update the lines, we have to clear the screen and start all over, but we don't want to have to copy the world map...


this _could_ be very useful i you consider that there is 128 sprites and each is up to 64x64... and you can always put sprites side-by-side on a line and they will render OK.. at 320px wide screen, you will only have issues with some sprites not being drawn if you pile a lot of them onto a single line.

128 sprites.. let's say we place 128 4bit 8x8 sprite 'tiles' into VRAM in-between our bitmap layers... is only 4K worth of sprites graphics.. 128 sprites would be enough for uppercase and lowercase english alphabet , numbers, symbols, and some nice-to-haves...

so 1 sprite taken to be a mouse cursor or something, we could write up to 127 characters onto this screen... or we could use scraps of whatever space we have left still in VRAM to create 16x16 or 32x32 or even 64x64 sprites to group letters together.. like maybe take 1 sprite as 32x8 and it is the just the word 'stop' ..

now to bring this all together...
we have Layer0 that is 4bit bitmap 320x240 that we draw these beautiful but expensive world map on.
then Layer1 is also 4bit bitmap 320x240 that we are doodling lines and whatever onto that... things that we'll change more often than we would the map, certainly..

and then the rest of VRAM and using the sprites we can _still_ have mouse cursor, text, and UI elements...

Vera Victoria!

(Which apparently is Latin for "True Victory!" ... )