Jump to content
IGNORED

Repeating double/quad sied players


Recommended Posts

Hi,

I tried to repeat a player having NUSIZ0=3 (1 copy, 2x width) but at least in Stella strobing RESP0 mutiple times during a scanline has no effect (only last strobe is used). Do mutiple only work in 1x width+copy modes?

Link to comment
Share on other sites

Hi,

I tried to repeat a player having NUSIZ0=3 (1 copy, 2x width) but at least in Stella strobing RESP0 mutiple times during a scanline has no effect (only last strobe is used). Do mutiple only work in 1x width+copy modes?

NUSIZ0=3 will give you 2 copies. For 2x width you need NUSIZ0=5.

 

Michael

Link to comment
Share on other sites

When RESPx is used only the last 2 copies are shown on the scanline RESPx was hit, so if there are no copies then there are none that get shown.

So it only works in 2/3 copy modes.

Strobing RESP0 multiple times can display all of the copies-- including the main copy-- if you time the strobes just right.

 

RESP0 doesn't generate a START signal, which is what triggers the TIA to draw the sprite, and that's why you don't (normally) get the main copy after strobing RESP0.

 

A START signal *is* generated for each extra copy, which is why you *do* get the extra copies after strobing RESP0.

 

A START signal is also generated when the player's position counter reaches the END state, which is what triggers the counter to reset itself-- and that's why you do get the main copy on the *next* line.

 

Now, if you have NUSIZ0 set to get extra copies, you can strobe RESP0 once to reset the position counter, but without generating a START signal. If you then strobe RESP0 a second time such that the reset occurs while a START signal for one of the extra copies is active, you *will* get the main copy, followed by all the other copies.

 

For example:

 

  STA RESP0
  sleep 3
  STA RESP0 ; the reset occurs during the START signal for the first extra copy

  STA RESP0
  sleep 8
  STA RESP0 ; the reset occurs during the START signal for the second extra copy

  STA RESP0
  sleep 19
  STA RESP0 ; the reset occurs during the START signal for the third extra copy

Michael

Link to comment
Share on other sites

Hi,

I tried to repeat a player having NUSIZ0=3 (1 copy, 2x width) but at least in Stella strobing RESP0 mutiple times during a scanline has no effect (only last strobe is used). Do mutiple only work in 1x width+copy modes?

 

There is a trick that the game Meltdown uses to display two 2x width sprites. I don't know how it works exactly, but If I remember correctly, it has something to do with changing NUSIZx values mid line. There is an old [stella] post about it somewhere.

Link to comment
Share on other sites

There is a trick that the game Meltdown uses to display two 2x width sprites. I don't know how it works exactly, but If I remember correctly, it has something to do with changing NUSIZx values mid line. There is an old [stella] post about it somewhere.

I was wondering if there were a way to use mid-line NUSIZx changes to accomplish this. I'll have to disassemble "Meltdown" and search through the old [stella] posts. :)

 

Michael

Link to comment
Share on other sites

After reading the first post I was disappointed. Yesterday I read this hoping to the find more infos. I gave me the idea that mid-line change to NUSIZ could have the desired effect. I don't know Meltdown, so if you find out something, please post.

Edited by JAC!
Link to comment
Share on other sites

After reading the first post I was disappointed. Yesterday I read this hoping to the find more infos. I gave me the idea that mid-line change to NUSIZ could have the desired effect. I don't know Meltdown, so if you find out something, please post.

Yes, Andrew Towers used mid-line NUSIZx changes to display four double-wide players (two for player0 and two for player1), and "Meltdown" used the same trick.

 

The secret is to draw the main copy with NUSIZx set to 5 (double-wide player). After the player is finished being drawn, switch NUSIZx to 4 to activate the far copy. Then, just as the far copy is about to be drawn, switch NUSIZx back to 5 so the far copy is drawn as a double-wide player. If the timing isn't exact, either the far copy doesn't get drawn at all (if NUSIZx is changed too early), or the far copy will be partly single-wide and partly double-wide. You could also get two quadruple-wide players this way.

 

In theory, you should also be able to get three double-wide players this way, but I suspect that it might not work correctly due to the tricky timing. This is because the CPU runs at one-third of the pixel clock, so you need to position the player such that the change to NUSIZx can be made at just the right time, and I don't think you can do that for more than one copy at a time. So even though you can change the size for each copy, one of the extra copies will probably be partly single-wide and partly double-wide. But I'd have to try it on a real machnine to be sure.

 

By the way, this trick doesn't work correctly in emulation, so you have to do it on a real machine.

 

Michael

Link to comment
Share on other sites

I see, very neat trick :) I stand corrected.

I didn't know it would also work for a single sprite and thought it had to be in a double or triple clone mode to send the start signals.

You are correct, the START signal won't be generated for an extra copy unless NUSIZx is set to 1, 2, 3, 4, or 6. That's why you need to change NUSIZx mid-line.

 

Assuming you have the player pre-positioned, you start the line with NUSIZx set to 5 so the player will be drawn double-wide.

 

After the player has been drawn, you must change NUSIZx to a value that will give you one or two extra copies. The closest copy is no good for this, because it's too close, so set NUSIZx to 2, 4, or 6.

 

Then you have to wait for the START signal to be generated for the copy. I think you probably have to let the START signal actually trigger the copy to start drawing, then change NUSIZx back to 5 at just the right moment so the copy is drawn double-wide instead of single-wide.

 

Anyway, this trick doesn't strobe RESPx multiple times per line, so your original answer was mostly correct-- except for the fact that timing multiple strobes of RESPx just right *can* display all three copies on that line. As far as that goes, try this:

 

; somewhere during vblank...
  LDA #3
  STA NUSIZ0
  STA NUSIZ1
; also set GRP0, GRP1, COLUP0, and COLUP1

; then in the loop for the active lines...
  STA RESP0
  sleep 3
  STA RESP0

  sleep 7

  STA RESP1
  sleep 3
  STA RESP1

  sleep 7

  STA RESP0
  sleep 3
  STA RESP0

  sleep 7

  STA RESP1
  sleep 3
  STA RESP1

You should get 10 single-wide players, all spaced 8 pixels apart (the second set of player1 sprites will wrap around to the left side of the screen and get covered up by player0):

 

0 0 0 1 1 1 0 0 0 1

1 1

 

There's not much time to change the graphics between copies, but you could use this to get 10 evenly-spaced copies of the same shape. :)

 

Michael

  • Like 1
Link to comment
Share on other sites

Hmmm, have to look over this timing. It might be possible using the DPC+ to have a full 160x192 bitmap kernal shifting 10 columns each frame. It would be alot better than my current 96x192 bitmap display kernal. That is, only if each column could be pixel set.

 

Anyways, great info!

Link to comment
Share on other sites

Hmmm, have to look over this timing. It might be possible using the DPC+ to have a full 160x192 bitmap kernal shifting 10 columns each frame. It would be alot better than my current 96x192 bitmap display kernal. That is, only if each column could be pixel set.

That 10-column trick is no good for a text display, because there's no way you'd be able to update the graphics for all of the sprites.

 

Here's a breakdown of how the show-all-3-copies trick works:

 

---------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-
?????????????000000000000000000000000000000000000000011111111111111111111111111
?????????????000011112222333344445555666677778888999900001111222233334444555566
---------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-
STA RESP0^^^^-76543210---ssss-76543210---ssss-76543210---....
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
0000000000000000000000000000001111111111111111111111111111112222222222222222222
0001112223334445556667778889990001112223334445556667778889990001112223334445556
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

The top 4 lines are a ruler depicting the counts of player0's position counter; each count lasts 4 color clocks. A plus indicates the start of a count, and a minus indicates another color clock in the current count. The numbers are read down-- the first row is the 10s digit, and the second row is the 1s digit. The question marks indicate unknown counts before RESP0 is strobed.

 

The bottom 4 rows are a similar ruler depicting the cycles of the CPU; each cycle lasts 3 color clocks. The numbers are counted from the beginning of the STA RESP0 instruction.

 

The middle row shows the STA instruction. The four carets after the instruction represent the reset signal, which begins after STA RESP0 ends, and lasts 4 clocks. Then the counter begins at 00. Nothing is drawn during the first clock, then the player is drawn in the order shown-- bits 76543210-- assuming REFP0 is off. There are 3 more clocks after bit 0 is drawn, then the close copy triggers a START signal, represented by ssss, followed by drawing the close copy. Then the middle copy triggers a START signal and is drawn.

 

STA RESP0^^^^-76543210---ssss-76543210---ssss-76543210---....
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
.........sleep 3..STA RESP0^^^^-76543210---ssss-76543210---ssss-76543210---....
................................00000000........00000000........00000000.......

This next figure dispenses with the rulers, except for a line of pluses and minuses for the cycles. If you wait 3 cycles after STA RESP0 and then do another STA RESP0, the reset signal from the second STA RESP0 occurs during the START signal for the near copy from the previous STA RESP0. Although RESP0 doesn't trigger a START for the main copy, the main copy is drawn anyway, thanks to the START signal for the previous RESP0's near copy. So you get all 3 copies of player0.

 

If you strobe RESP0 again to try to make more copies of player0, it will interfere with the last copy of player0-- but you can strobe RESP1 instead. Normally it's almost impossible to get player1 lined up 8 clocks after player0 when strobing RESP0 and RESP1 multiple times, due to 1 cycle equaling 3 clocks. But if you let all 3 copies of player0 display before strobing RESP1, it works out correctly, since 3 times something equals a multiple of 3, hence you can time the STA RESP1 instruction just right:

 

STA RESP0^^^^-76543210---ssss-76543210---ssss-76543210---
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--
.........sleep 3..STA RESP0^^^^-76543210---ssss-76543210---ssss-76543210---
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--
...........................sleep 7..............STA RESP1^^^^-76543210---ssss-76543210---ssss-76543210---
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--
.........................................................sleep 3..STA RESP1^^^^-76543210---ssss-76543210---ssss-76543210---
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--
................................00000000........00000000........00000000........11111111........11111111........11111111...

You have to wait 7 cycles after the second RESP0, then strobe RESP1 twice like you did RESP0-- strobe RESP1, wait 3 cycles, then strobe RESP1 again. You get 3 copies of player0 spaced 8 clocks apart, then 3 copies of player1 spaced 8 clocks apart, with 8 clocks between player0 and player1.

 

STA RESP0 ; .........
sleep 3   ; .........
STA RESP0 ; .........
sleep 7   ; .....00000000........
STA RESP1 ; 00000000.
sleep 3   ; .......00
STA RESP1 ; 000000...
sleep 7   ; .....11111111........
STA RESP0 ; 11111111.
sleep 3   ; .......11
STA RESP0 ; 111111...
sleep 7   ; .....00000000........
STA RESP1 ; 00000000.
sleep 3   ; .......00
STA RESP1 ; 000000...

This shows the RESP0 and RESP1 instructions, along with the sleep instructions, with the players shown in the comments. The main copy of player0 gets drawn during the first sleep 7 instruction, and the close copy of player0 gets drawn during the first STA RESP1 instruction. You'd have time during the sleep 7 to load and store the graphics for the close copy of player0, but you can't store new graphics for the middle (third) copy of player0 before it starts to draw. Likewise with player1. If you pre-load GRP0 and GRP1 during HBLANK, you'd have time to update them during the sleep 7 instructions so the first near copies would be different than the main copies. And you could use the sleep 3 instructions to update GRP0 and GRP1 again if needed, assuming the data were already loaded into the A, X, or Y registers. But there's just no way to update the third copies of player0 and player1 to make them unique-- at best, you'd get the first few pixels of the third copy being equal to the first few pixels of the second copy. So this trick has limited applications.

 

Michael

  • Like 1
Link to comment
Share on other sites

A nice easy trick for getting a 108-column "flicker-blinds" display is to start with the two sprites set for three copies wide (32-pixel spacing) and have one sprite 16 pixels to the right of the other. Then on every scan line you shift both sprites left 8 pixels, and on every other scan line you RESPx the leftmost sprite just as its second copy would appear. That "second copy" will still appear, but now it will be the first copy and two more will follow. The net effect is the sequence:

---1-0-1-0-1-0-----
--1-0-I-0-1-0-1----
---0-1-0-1-0-1-----
--0-1-O-1-0-1-0----

Where "I" and "O" are the spots were RESP1 and RESP0 are hit, respectively, and "1" and "0" are the places the other copies of player 1 and 0 show up.

  • Like 1
Link to comment
Share on other sites

A nice easy trick for getting a 108-column "flicker-blinds" display is to start with the two sprites set for three copies wide (32-pixel spacing) and have one sprite 16 pixels to the right of the other. Then on every scan line you shift both sprites left 8 pixels, and on every other scan line you RESPx the leftmost sprite just as its second copy would appear. That "second copy" will still appear, but now it will be the first copy and two more will follow.

Very cool! :thumbsup:

 

Michael

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