Jump to content
Sign in to follow this  
José Pereira

Bitmap Masking

Recommended Posts

Just a question:

 

"If I have a soft sprite over Gfxs. I would do 'LDA,AND,OR,STA' and this is normally 21cycles lost each byte.

But on the other way if it's over a clean Area it would be, I think, 'LDA,EOR,STA' that it's 16cycles (just replace, there's no Gfxs. on, just a clean, for example, a Sky...)

 

And it this last I want to ask: This just 'EOR' over clean bytes 16cycles would work over 00 or if I also have, for example, the clean space as 01,10 or 11.

This is because most of the times I have all sprites over a sky but need that skyy to be, for example, PF0.

There's no Gfxs. there just clean but cannot be background Reg.

Here I can have a '16cycles EOR' or must go to '21cycles LDA,AND,OR,STA'?"

 

 

Thanks.

José Pereira.

Share this post


Link to post
Share on other sites

If it's over clean area why would you do EOR? Just do LDA, STA. Of course sprites can't overlap but I suppose it will not because of EOR would not work for "clean" sprites either. So just have soft sprite data prepared with sky color as background and do simple LDA sprite_data, STA screen. On background gfx you will mask out the "sky" anyway.

Share this post


Link to post
Share on other sites

If you know for sure an area is "clean" then it'd just be LDA / STA. But "clean" also means no overlap of softsprites, or even occupying the same byte of screen RAM.

 

Character mode can be of help in a mixed up situation where cleaar areas aren't clearly defined.

Just check the value of the character, e.g. if it's zero, then you can use an alternate draw routine that skips the AND/OR phase.

 

You don't EOR - EOR is used when you don't have a save buffer or use masking. EOR any byte twice with the same value and you end up with what you started with.

So in a softsprite situation you draw all your sprites with EOR, erase them last to first with EOR again and eventually get a restored background.

Share this post


Link to post
Share on other sites

O.k. forget 'EOR'

 

 

Lets focus on that 'only LDA,STA'

I have a clean sky that it's PF0 (01)

A sky byte would be 01010101

My sprite it's 00101000

(The Bitmap Masking, sprite over Backgr. have to be 01101001)

 

Normally I would do:

01010101 (Gfx)

AND

11000011 (Inverse Sprite)

-----------

01000001

OR

00101000 (real sprite shape)

___________

01101001

 

But this takes with more the first 'LDA' and the last 'STA' 21cycles.

This need to be done if the Gfxs. byte would be with Gfxs... (if byte would, for example, have all types of bit-pairs)

 

But, like you're saying I just put my soft sprite (00101000) over sky and like that it's my sprite and it's 'transparent/border' the sky colour (01)

What/How operation to get this? How that just 'LDA,STA' works?

And this just simple 'LDA,STA' takes how many cycles (7or8cycles)?

(And it can be done over any possible sky bit-pair?)

 

 

Just need to know this for some Matemathical screen soft sprites calcultions...

Thanks.

Share this post


Link to post
Share on other sites

In sprite data just set the pixels which are 'transparent/border' to the sky bit pair.

Share this post


Link to post
Share on other sites

you can do "brute force copy" when your background gfx is done by "00" but if not like you mentioned 01 then you will overwrite the "01" with "00". so if you have anything else than 00 you would need to go the EOR way.

 

EOR soft sprite engines are often used in the past and I am a fan of the method... look at f.e. Drol, Zone Ranger, Donkey Kong, Defender, Centipede 5200 et al.

 

if you have a background patter or the sky is filled with "01010101" then of course you can prepare the sprites already with the pattern and mask them properly or you could do

 

lda

ora #pattern

sta screen

 

sprite routines really depend heavily on the game design and what do you want to do.

Share this post


Link to post
Share on other sites

In sprite data just set the pixels which are 'transparent/border' to the sky bit pair.

 

That's the 'LDA,STA' stuff? But How many cycles each byte (it's what I really want to know)

 

 

Thanks.

José Pereira.

Share this post


Link to post
Share on other sites

you can do "brute force copy" when your background gfx is done by "00" but if not like you mentioned 01 then you will overwrite the "01" with "00". so if you have anything else than 00 you would need to go the EOR way.

 

EOR soft sprite engines are often used in the past and I am a fan of the method... look at f.e. Drol, Zone Ranger, Donkey Kong, Defender, Centipede 5200 et al.

 

if you have a background patter or the sky is filled with "01010101" then of course you can prepare the sprites already with the pattern and mask them properly or you could do

 

lda

ora #pattern

sta screen

 

sprite routines really depend heavily on the game design and what do you want to do.

 

 

 

 

 

The thing here is that I need that PF0 be the sky...

And all sprites move over PF0.

So in sprites byte I'll put (01) in the 'transparency' colour instead of a normal (00)

 

What I need is to get this with the less cycles lost I can because I have many soft sprites 'flying' on screen, but always over (01).

My real need here is to know how many cycles per byte this takes (because I need to know nºsprites bytes cycles lost and calculate how much I could have on screen... if have to be, for example, 32,40 or 48wide Modes)

Edited by José Pereira

Share this post


Link to post
Share on other sites

LDA

STA

 

when your sky is "already inserted" in the sprite data like MaPa and I suggested.

cycles depend on if you are using "unrolled" code, "compiled data"

 

so you don't have stuff like

 

lda ($b0),y

sta screen,x

...

 

for one byte where $b0 points to your sprite data

 

and "compiled data" means that you have routines for each sprite... then you can do

 

lda #data1

sta screen,x

lda #data2

sta screen+1,x

...

Share this post


Link to post
Share on other sites

LDA

STA

 

when your sky is "already inserted" in the sprite data like MaPa and I suggested.

cycles depend on if you are using "unrolled" code, "compiled data"

 

so you don't have stuff like

 

lda ($b0),y

sta screen,x

...

 

for one byte where $b0 points to your sprite data

 

and "compiled data" means that you have routines for each sprite... then you can do

 

lda #data1

sta screen,x

lda #data2

sta screen+1,x

...

 

 

In a simple ships shoot'em'up and Horizontal scrolling over clean sky that is PF0 with 8ships on screen you would put already (01) transparency in your sprites 'Data'?

And wich method best and how many cycle taken in each byte?

 

Sorry to ask again, but you know I am not a coder but 'cycles counting' is very important for my Ideas/Planning and I need to 'count' these 8sprites cycles, I really need (Screen cycle lost I already know for he three wide possible (32,40or48)).

 

Thanks.

Share this post


Link to post
Share on other sites

for Sub Hunter?

 

I need more info on the game itself. or mockups to tell you which could be the best approach.

Share this post


Link to post
Share on other sites

for Sub Hunter?

 

I need more info on the game itself. or mockups to tell you which could be the best approach.

 

 

No, just for a simple Horizontal Scrolling Shoot'em'up like Armalyte but Black colour sky must be PF0 and the ships wouldn't cross Gfxs. but only move in the sky.

 

 

(EDIT: but with just 6,7or8 sprites on screen at once maximum;)

Edited by José Pereira

Share this post


Link to post
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.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...