Jump to content
Sign in to follow this  
h0trod

two copies medium to get four different sprites with arbitrary colors?

Recommended Posts

Is anybody aware of any games or sample code that uses "two copies medium" with both players interwoven (as in the six digit score routine) to generate four sprites on a line and assign each of those sprites chosen colors?  (See my cribbage squares thread for what I'm trying to do.)  My attempts so far have failed and if someone else has managed to do it I'd love to try to figure out their code.  If it's just impossible, that's worth knowing too!

 

(I guess I did have the crazy thought that since I only have two possible colors in my case, I could have sixteen different display routines, one for every combination from red red red red to black black black black, and save 12 cycles worth of memory access for color lookups every scanline.. maybe that would give me just enough time, but it seems.. drastic.)

 

Thanks.

Edited by h0trod
crazy thought

Share this post


Link to post
Share on other sites

If you load up the registers and make use of VDELPx, I think there's enough time to do this. I'll whip up a quick example shortly.

Share this post


Link to post
Share on other sites

do you actually mean medium copies or close copies - the demo in the cribbage squares looks like it's 4 copies next to each other, e.g. P0 and P1 both set to two close.

If you only want red and black, it is better to set the P0 and P1 to background colour and draw inverted sprites over BG and PF with e.g. BG set to red and PF to black - I hope that makes sense....

Share this post


Link to post
Share on other sites

Yeah; there's enough time to do the updates if it's medium copies, but I don't think there is for close copies.

Share this post


Link to post
Share on other sites
1 hour ago, eshu said:

do you actually mean medium copies or close copies - the demo in the cribbage squares looks like it's 4 copies next to each other, e.g. P0 and P1 both set to two close.

If you only want red and black, it is better to set the P0 and P1 to background colour and draw inverted sprites over BG and PF with e.g. BG set to red and PF to black - I hope that makes sense....

 

The most recent screenshot in the Cribbage thread is two players medium, but interwoven:

 

P0__P1__P0__P1

 

I think @Karl G is suggesting:

 

P0____P0____P1____P1

 

which would give more time, but in terms of how far spread apart the cards are would (I think) be the same as I was getting with two players wide interwoven:

 

P0____P1____P0____P1

 

(as in this screenshot:)

cribbage.thumb.png.a21b60a1451a72a2187bd0bc04b000b9.png 

 

@Karl G, if I am misunderstanding you, please let me know.

 

It sounds like my best chance at getting cards close together and having control over Red/Black is the approach you suggest here and @RevEng suggested in the other thread - making the sprites themselves all white, and using the black background for a black card and setting a red playfield under the sprite for a red card.  Thanks!

Edited by h0trod

Share this post


Link to post
Share on other sites

No, I meant medium spacing, as in your first example. I didn't see that @RevEng had a suggestion that was useful for this specific case where we are only worried about two possible colors, but I was answering the general question asked in this topic. I think there's enough time for 4 different graphics with 4 different colors with medium spacing interwoven here, and I'm working on a quick demo, in case it's useful for anyone.

Share this post


Link to post
Share on other sites
1 minute ago, Karl G said:

No, I meant medium spacing, as in your first example. I didn't see that @RevEng had a suggestion that was useful for this specific case where we are only worried about two possible colors, but I was answering the general question asked in this topic. I think there's enough time for 4 different graphics with 4 different colors with medium spacing interwoven here, and I'm working on a quick demo, in case it's useful for anyone.

Thank you Karl, I would love to see that!

Share this post


Link to post
Share on other sites

Here's some sample code that does this - each of the 4 sprites are set randomly to one of 8 possible sprites, each of which has its own color. I didn't end up using VDELPx afterall.

 

4sprite_1.thumb.png.4c67ca95d6ecf5dbd365461e8b64685c.png

 

I've attached the source. Here's the kernel code that displays the 4 sprites:

 

    lda Color1
    sta COLUP0
    lda Color2
    sta COLUP1
    ldy SpritePos
    
SpriteLoop
    sta WSYNC               ; 3     (0)
    lda (Sprite1Ptr),y      ; 5     (5)
    sta GRP0                ; 3     (8)
    lda (Sprite2Ptr),y      ; 5     (13)
    sta GRP1                ; 3     (16)
    lda (Sprite3Ptr),y      ; 5     (21)
    tax                     ; 2     (23*)
    lda (Sprite4Ptr),y      ; 5     (28)
    ldy Color3              ; 3     (31)
    dec SpritePos           ; 5     (36)
    sleep 3                 ; 3     (39)
    stx GRP0                ; 3     (42)
    sty COLUP0              ; 3     (45)
    ldy Color4              ; 3     (48)
    sta GRP1                ; 3     (51)
    sty COLUP1              ; 3     (54)
    lda Color1              ; 3     (57)
    ldx Color2              ; 3     (60)
    sta COLUP0              ; 3     (63)
    stx COLUP1              ; 3     (66)
    ldy SpritePos           ; 3     (69)
    bpl SpriteLoop          ; 2/3   (71/72)
    lda #0
    sta GRP0
    sta GRP1

4sprite.asm

  • Like 4

Share this post


Link to post
Share on other sites
39 minutes ago, Karl G said:

Here's some sample code that does this - each of the 4 sprites are set randomly to one of 8 possible sprites, each of which has its own color. I didn't end up using VDELPx afterall.

 

Amazing.  Thank you!

  • Like 1

Share this post


Link to post
Share on other sites
6 minutes ago, h0trod said:

Amazing.  Thank you!

No problem. It was a fun challenge. :) 

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