two screens for graphics (buffer)

All aspects of programming on the Commander X16.
Post Reply
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

two screens for graphics (buffer)

Post by funkheld »

Hi good afternoon

how can you please create two screens for graphics (buffer) 320x240 ?
how many colors do you have please?

Thanks.
greeting
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: two screens for graphics (buffer)

Post by unartic »

Well, if you are only using one bitmap layer of 320x240

You need:
- 320x240= 76.800 bytes per page in 8bpp mode (256 colors)
- 320x240/2 = 38.400 bytes per page in 4bpp mode (16 colors)
- 320x240/4 = 19.200 bytes per page in 2bpp mode (4 colors)

VERA has 128kb of memory so, you can store two pages in VRAM in 4bpp and 2bpp, but you cannot in 8bpp.

For 4bpp and 2bpp you can just allocate two offsets (for example $00000 and $09600) for each page.
You first update page 1 ($00000) and after that update page 2 ($09600). When you want to swap pages you change the Tile-base address of the layer you're working on. And when page 1 is updated, you switch back.

If you want to use 256 colors you can best have one buffer in highram and between each vertical sync (when the screen is not beingupdated) you can copy the highram buffer to the bitmap address. Ofcourse this approach is also possible with 4bpp and 2bpp modes.

This might seem prety complicated if you're not familiar with vera. So I'd suggest: take it one step at a time and ask for help if needed.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: two screens for graphics (buffer)

Post by funkheld »

thanks for the nice help.

For me it's a total start with the screens.

Can this please be explained for 4bit and 2bit.

at which address does the switching take place for the background and foreground screen?
Where do I set the color for the 4bit tile and the 2bit tile?

does the text mode (tile) then go from $1:B000 to $0:0000?

-------------------------------------
$0:0000-$1:2BFF 320x240@256c Bitmap
$1:B000-$1:EBFF Text Mode
-----------------------------------

Thanks.
greeting
Last edited by funkheld on Tue May 07, 2024 8:57 am, edited 1 time in total.
User avatar
ahenry3068
Posts: 1136
Joined: Tue Apr 04, 2023 9:57 pm

Re: two screens for graphics (buffer)

Post by ahenry3068 »

funkheld wrote: Tue May 07, 2024 8:44 am thanks for the nice help.

For me it's a total start with the screens.

Can this please be explained for 4bit and 2bit.

at which address does the switching take place for the background and foreground screen?
Where do I set the color for the 4bit tile and the 2bit tile?

can you also make a 4bit/2bit bitmap?

I've already played with little Vera things.

Thanks.
greeting
You have to go over the charts in the VERA programmers reference. It's not trivial ....
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: two screens for graphics (buffer)

Post by unartic »

At startup the vram has a certain setup. You could stick to it, but thats not needed. If you only want to have a bitmap layer showing a 320x240 image, you dont need to care about the default setup.

If you cant to keep the default setup, you have one 'page' of a 256 color bitmap (320x240). You can buffer the page in highram (normal ram, but accesible by setting a bank byte) and copy the page over during the vertical blanking interval. You can setup an interrupt to let you know when that happens.

This is however already a bit advanced stuff.

What is it that you want to accomplish? Maybe I can point you in the 'right' direction.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: two screens for graphics (buffer)

Post by funkheld »

I would like 2 screens 320x240 with 16 colors please.
I would like to paint the screens (tile).
a screen in the background and a screen in the foreground.
then I want to switch the screens.

I want two tile screens.
Which command do I use to set the addresses for screen1 and screen2 ?
Which command switches the two screens?

Thanks.
greeting
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: two screens for graphics (buffer)

Post by unartic »

Do you want to use 2 tilemaps? Or 2 bitmap screens?

And which programming language are you aiming for?
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: two screens for graphics (buffer)

Post by funkheld »

Thanks for the help.

II want to use tilemaps (Screen).

I use madpascal.
in madpascal I can use inline-asm and make the screens etc.

The utility for my question can be written in ASM.

Thanks.
greeting.
Post Reply