Jump to content
IGNORED

Back Buffer & Suzy


GadgetUK

Recommended Posts

Is there a way to point Suzi to another address for the Back Buffer? Ie. instead of Suzi blitting/painting to the default location of the back buffer, is thete a word in RAM that dictates where she outputs? I want to point it to another fullscreen sized bitmap in order that I can permenantly affect that bitmap and avoid having to keep redrawing particular sprites? The alternatve would be to use Mikey to copy the bitmap manually to the dest bitmap but thats not as elegant and will eat a lot of cycles...

Edited by GadgetUK
Link to comment
Share on other sites

Maybe I have a problem with your definition of the word "back buffer".

You can set any of the buffers to any memory location (in muliplies of i thing 16 or so, read the docs to be sure).

If you want to write to the buffers by cpu, you should be sure thast you do not overlap with the suzy/mikey space _or_ switch of the overlay.

If you want to modify a sprite which you use a background sprite you have to take care about the additional end of line bytes in the literal sprite.

apart from that, this is the mechanism which I use. Modifing the screen buffer is in most cases not the bet way to go.

 

 

Suzy Address space (part of):

 

L1 (CPU) 04,05 H0FFL,H 0ffset to H edge of screen

H1 (CPU) 06,07 V0FFL,H 0ffset to V edge of screen

L2 (CPU) 08,09 VIDBASL,H Base Address of Video Build Buffer

H2 (CPU) 0A,0B COLLBASL,H Base Address of Coll Build Buffer

L3 (ENG) 0C,0D VIDADRL,H Current Video Build Address

H3 (ENG) 0E,0F COLLADR,LH Current Collision Build Address

Link to comment
Share on other sites

In the tgi driver you can also decide not to call tgi_updatedisplay. Then you can build your static backgrounds to screen1 and keep screen0 as the display buffer always.

 

A simple:

void bgcopy()
{
   asm("sei");
   asm("lda #$0f");
   asm("sta $fff9");
   memcpy(0xc038, 0xe018, 8160);
   asm("lda #$0c");
   asm("sta $fff9");
   asm("cli");
}

 

Will the initialize the screen with the background.

Link to comment
Share on other sites

  • 4 weeks later...

Thanks! My idea orignally was to try and use Suzi to blit sprites directly to a 'background' bitmap in elsewhere in RAM but sounds like Suzi deals with fixed destination addresses. Instead I will manually draw to the background bitmap using the CPU. The idea being that when an enemy dies I draw the body or damaged vehicle directly to the main image I am using as a background, and do this once when an enemy dies. The benefit is visual carnage as the bodies and destruction build up, and I wont have to keep drawing dead bodies - no hit in suzi for possibly hundreds of dead sprites.

Edited by GadgetUK
Link to comment
Share on other sites

Thanks! My idea orignally was to try and use Suzi to blit sprites directly to a 'background' bitmap in elsewhere in RAM but sounds like Suzi deals with fixed destination addresses.

Suzy is NOT limited to fixed adresses. But its limited to a fixed screen size. I used this background blitting for the rekursive effects in lynx reloaded.

But befoe, you have to overwrite the last byte of every line to get a valid literal sprite, therefore it is mostly not the best idea to go that way.

Nevertheless, its still faster than doing it in software.

 

 

Instead I will manually draw to the background bitmap using the CPU. The idea being that when an enemy dies I draw the body or damaged vehicle directly to the main image I am using as a background, and do this once when an enemy dies. The benefit is visual carnage as the bodies and destruction build up, and I wont have to keep drawing dead bodies - no hit in suzi for possibly hundreds of dead sprites.

Link to comment
Share on other sites

OK, thanks! I will try using Suzi to do this if I can work out the ASM in order to temporarily point Suzi to the address of my bitmap. Also understood about writting additional byte at the end of every scanline of a sprite. Thanks =)

 

You don't need asm to do this.

 

Define the viewpage as

tgi_setviewpage(1);

 

To draw on the background you just do:

tgi_setdrawpage(0);

draw on the background buffer using normal tgi commands

...

tgi_setdrawpage(1);

bg_copy();

draw on screen.

 

And do not use tgi_updatedisplay() at all.

 

You will have a little flicker because you lose double buffering.

 

--

Karri

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...