Jump to content
pvmpkin

sprite masking

Recommended Posts

Hey, does anyone have any suggestions on how best to mask parts of a sprite, to change a certain number of lines—instead of having a separate full sprite ?

 

*ideally without doing this during the kernel

 

	lda (objectptr),y
	cpx #5
	bcc .nomask
	and #%11110000
.nomask
	sta GRP1

I am doing this in the kernel though, and seems to work as intended, but wondering if there is another way.

Edited by pvmpkin

Share this post


Link to post
Share on other sites

Use a byte of RAM:

 

outside of kernel:
    cpx #5
    bcc .nomask
    lda #%11110000
    .byte $2c ; skips over the next LDA instruction
.nomask:
    lda #%11111111
    sta mask

Kernel:
    lda (objectptr),y
    and mask
    sta GRP1

 

Share this post


Link to post
Share on other sites

brilliant, thank you.

 

I've noticed this a few times:

.byte $2c

You indicate that it skips the next LDA instruction but I don't understand why that is used, the context of it.

 

OH, I think I see it. It's a way of reusing the store instruction without changing the value right ?

Edited by pvmpkin

Share this post


Link to post
Share on other sites
32 minutes ago, pvmpkin said:

You indicate that it skips the next LDA instruction but I don't understand why that is used, the context of it.

 

 

Check the comments in Step 4 - 2 Line Kernel of my 2600 tutorial, one of my replies goes into detail in how the .byte $2c trick works.

  • Like 1

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