Jump to content
IGNORED

double buffering ?


Recommended Posts

Hello,

 

i continue to code in C Colecovision and i'd like to test something ...

 

In puzzli i write characters and making "animation" directly in CHRTAB at adresse 0x1800 with command put_char/pu_frame for example. To move the player, i put "blank" characters then i draw the player at the new position, so it flickers.

 

I'd like to write byte/characters at adress 1C00 (Seems that 1C00 to 1FFF is free in vram) then copy 1C00-1FFF to 0X1800-17FF. But, in C, how did i copy memory with direct adressing ???

 

is a memcpy(0x1C00,0x1800,32*64*8) is enough (it's VRAM so maybe it's not possible, or it's the wrong syntax, i can't test this weekend, it's not my computer here :) ...) ? Or must i declare pointer on 0X1C00 and 0X1800 and what is the exact syntax ?

 

I know it must be newbie question but i've never adressing directly the memory in C ... and it's the vram ...

 

Thanks in advance !

Link to comment
Share on other sites

No flicker should be visible if the "erase" codes are immediatly followed by the "draw elsewhere" codes and everything done within the allowed time to update VRAM.

 

If you want to consider a double buffering technic, you have to consider this possible issue : the screen you are updating is not the one presented on screen, so it can be difficult to keep track of the modifications to do in order to make the new screen looks like just an update of the screen actually on. For example, showing score points need to be done on both screens, otherwise it will looks like the score is flickering between two values.

Link to comment
Share on other sites

No flicker should be visible if the "erase" codes are immediatly followed by the "draw elsewhere" codes and everything done within the allowed time to update VRAM.

 

If you want to consider a double buffering technic, you have to consider this possible issue : the screen you are updating is not the one presented on screen, so it can be difficult to keep track of the modifications to do in order to make the new screen looks like just an update of the screen actually on. For example, showing score points need to be done on both screens, otherwise it will looks like the score is flickering between two values.

 

yes, i understand (i think), but if i make every graphic modification in an vram area not visible , and copy the entire area in CHRTAB , is it possible ?. I don't want to swap between screen1 and screen2 then screen2 and screen1 etc etc ...

 

I want to draw everything always in screen 2 then at end copy screen2 in screen1 who is the visible screen. Is it possible ?

 

ex :

 

while (1)

{

do drawing in screen2 (not visible)

 

copy(screen2-->screen1)

}

Link to comment
Share on other sites

Hello,

 

you can do double buffering , mainly as you only change the NAMES table.

 

But you have to know first, that you can not access directly to the VRAM . The VRAM is a ram that is not adressable in the address space of the processor. To write or read the VRAM you have to go thru a port of the VDC (via an OUT in asm) .

 

The VDC (Video processeur) has some register that control at what address you place your color, names and pattern tables.

The Register 2 , allows to change the address of the NAMES Table by step of 1024k in the VRAM.

 

So to double buffer, you would have to create some API to put char in the Second page while the first page being the one displayed. When you completed the update of the second page , wait a VSync (nmi) and switch to the new page by simply changing the pointed address in Register 2 . Then make in sort that your APIs write now to the first page that is becoming in fact the second page.

 

This way works for characters. It does not double buffers the sprites of course , but you don't need and i thing you don't use sprites.

 

To change the address pointed by register 2 from C , you can use the function : vdp_out(2,0xXX);

to write a char in the second page , you can do that for instance with put_vram , you will have just to calculate the address according to X and Y coordonnate before calling the put_vram.

Link to comment
Share on other sites

Hello,

 

you can do double buffering , mainly as you only change the NAMES table.

 

But you have to know first, that you can not access directly to the VRAM . The VRAM is a ram that is not adressable in the address space of the processor. To write or read the VRAM you have to go thru a port of the VDC (via an OUT in asm) .

 

The VDC (Video processeur) has some register that control at what address you place your color, names and pattern tables.

The Register 2 , allows to change the address of the NAMES Table by step of 1024k in the VRAM.

 

So to double buffer, you would have to create some API to put char in the Second page while the first page being the one displayed. When you completed the update of the second page , wait a VSync (nmi) and switch to the new page by simply changing the pointed address in Register 2 . Then make in sort that your APIs write now to the first page that is becoming in fact the second page.

 

This way works for characters. It does not double buffers the sprites of course , but you don't need and i thing you don't use sprites.

 

To change the address pointed by register 2 from C , you can use the function : vdp_out(2,0xXX);

to write a char in the second page , you can do that for instance with put_vram , you will have just to calculate the address according to X and Y coordonnate before calling the put_vram.

 

 

ok so vdp_out(2,0x1800)-->vdp_out(2,0x06) for screen1 to seen on TV and vdp_out(2,0x1C00)-->vdp_out(2,0x07) to show another part of the vram ?

 

I must look at daniel's doc to see how the vdp work too.

Edited by bfg.gamepassion
Link to comment
Share on other sites

Hello,

 

you can do double buffering , mainly as you only change the NAMES table.

 

But you have to know first, that you can not access directly to the VRAM . The VRAM is a ram that is not adressable in the address space of the processor. To write or read the VRAM you have to go thru a port of the VDC (via an OUT in asm) .

 

The VDC (Video processeur) has some register that control at what address you place your color, names and pattern tables.

The Register 2 , allows to change the address of the NAMES Table by step of 1024k in the VRAM.

 

So to double buffer, you would have to create some API to put char in the Second page while the first page being the one displayed. When you completed the update of the second page , wait a VSync (nmi) and switch to the new page by simply changing the pointed address in Register 2 . Then make in sort that your APIs write now to the first page that is becoming in fact the second page.

 

This way works for characters. It does not double buffers the sprites of course , but you don't need and i thing you don't use sprites.

 

To change the address pointed by register 2 from C , you can use the function : vdp_out(2,0xXX);

to write a char in the second page , you can do that for instance with put_vram , you will have just to calculate the address according to X and Y coordonnate before calling the put_vram.

 

 

ok so vdp_out(2,0x1800)-->vdp_out(2,0x06) for screen1 to seen on TV and vdp_out(2,0x1C00)-->vdp_out(2,0x07) to show another part of the vram ?

 

I must look at daniel's doc to see how the vdp work too.

 

no, it is the bits b0 to b3 from register 2 that holds the most significant bits of the NAMES Table address.

 

and look that post, it could interrest you

 

http://www.atariage.com/forums/topic/130508-tms9918-family-vdp-programmers-guide/page__view__findpost__p__1573662

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...