Jump to content
IGNORED

In regards to a repeating playfield...


Recommended Posts

Making a wild guess here, but it seems like you want the left/right sides of the playfield to be different and are proposing drawing the left side by using the playfield registers, while drawing the right side with the player registers? If so I assume you'd be using the players at 4x size so the player's pixels are the same size as the playfield pixels.

 

If that's right, you'd still have to update the playfield pixels on the right side, setting them to zero, otherwise the image on the right would be a merging of the playfield pixels and the player pixels - ie:

 

KernelLoop
  sta WSYNC
  lda (playfield0left),y
  sta PF0
  lda (playfield1left),y
  sta PF1 
  lda (playfield2left),y
  sta PF2
  lda (player0left),y
  sta GRP0
  lda (player1left),y
  sta GRP1
  SLEEP ??
  lda #0
  sta PF0
  sta PF1
  sta PF2

 

The other problem is the players, even at 4x sized, would only replace 16 of the 20 pixels on the right side.

Link to comment
Share on other sites

Making a wild guess here, but it seems like you want the left/right sides of the playfield to be different and are proposing drawing the left side by using the playfield registers, while drawing the right side with the player registers? If so I assume you'd be using the players at 4x size so the player's pixels are the same size as the playfield pixels.

 

If that's right, you'd still have to update the playfield pixels on the right side, setting them to zero, otherwise the image on the right would be a merging of the playfield pixels and the player pixels - ie:

 

KernelLoop
  sta WSYNC
  lda (playfield0left),y
  sta PF0
  lda (playfield1left),y
  sta PF1 
  lda (playfield2left),y
  sta PF2
  lda (player0left),y
  sta GRP0
  lda (player1left),y
  sta GRP1
  SLEEP ??
  lda #0
  sta PF0
  sta PF1
  sta PF2

 

The other problem is the players, even at 4x sized, would only replace 16 of the 20 pixels on the right side.

 

If there's going to be a gap in the middle of the scanline, couldn't the COLUPF just be set to match the COLUBK halfway through the scanline to avoid the merging of PF and player graphics? Then you'd only have to update the COLUPF register twice per scanline instead of all the PF registers. (Assuming SpiceWare's assumption is right)

Link to comment
Share on other sites

I guess I shouldn’t have used the word "sprite." I was referring to the bit of data that makes up images used in the game in general. I.e, the following could be an example of what I want to use to draw an image for the playfield:

 

Image1
.byte #%10000001
.byte #%01000010
.byte #%00100100
.byte #%00011000
.byte #%00000000

 

To elaborate further, I'm simply interested in repeating that image vertically. I know there are a few ways to go about it, I'm just looking for what you guys would do (should I actually draw the image multiple times creating one big image, repeat the draw loop in the kernel, etc). Again, I have a grasp on mirroring, but I'm looking for something similar vertically.

 

Sorry for being vague (made sense to me ;) )

 

PS: Thanks spice, I hadn't really had a need to create an asymmetrical playfield, but in the event that I do, I'll refer back to this post.

Edited by hendersonn
Link to comment
Share on other sites

Repeating ~n number of bitmap bytes for the entire display? Simplest way would be to use an independent counter that is increased each pass, and reset it to zero whenever it surpasses the number of bytes in the bitmap. There's a LOT of games that do this the other way around (drawing the first bitmap value for a few scanlines, the second value for a few scanlines, and so on). The process is very similar to using a repeated pattern, except that it's trimming down the scanline counter to get the index...instead of constantly resetting the index.

Link to comment
Share on other sites

PS: Thanks spice, I hadn't really had a need to create an asymmetrical playfield, but in the event that I do, I'll refer back to this post.

Please don't refer to that, it's not efficient. This is what you'll be doing:

KernelLoop
  sta WSYNC
  lda (playfield0left),y
  sta PF0
  lda (playfield1left),y
  sta PF1 
  lda (playfield2left),y
  sta PF2
  SLEEP ??
  lda (playfield0right),y
  sta PF0
  lda (playfield1right),y
  sta PF1
  lda (playfield2right),y
  sta PF2
  dey
  bne KernelLoop 
Link to comment
Share on other sites

To repeat going down, it'll be most efficient if you repeat a shape that's a power of 2 in size. 4 rows, 8 rows, 16 rows, etc.

KernelLoop:
  tya
  and #3 ; repeats an 4 scanline shape
  tax
  sta WSYNC
  lda playfield0left,x
  sta PF0
  lda playfield1left,x
  sta PF1 
  lda playfield2left,x
  sta PF2
  SLEEP ??
  lda playfield0right,x
  sta PF0
  lda playfield1right,x
  sta PF1
  lda playfield2right,x
  sta PF2
  dey
  bne KernelLoop 
Using X to get the playfield data means you'll read directly from ROM, so you can't change the pattern shown. If you want to use Y, just change it so that X is your scanline countdown.

KernelLoop:
  txa
  and #07 ; repeats a 8 scanline shape
  tay
  sta WSYNC
  lda (playfield0left),y
  sta PF0
  lda (playfield1left),y
  sta PF1 
  lda (playfield2left),y
  sta PF2
  SLEEP ??
  lda (playfield0right),y
  sta PF0
  lda (playfield1right),y
  sta PF1
  lda (playfield2right),y
  sta PF2
  dex
  bne KernelLoop 
Use a #15 for an 16 scanline pattern, #31 for a 32 scanline pattern, etc.

 

 

Hope I didn't type anything wrong, won't be able to check back in until later today.

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