Jump to content


How Do I REFP with DPC+?

3 replies to this topic

#1 Cybearg OFFLINE  



  • 950 posts

Posted Sun Mar 17, 2013 5:55 PM

Probably just a syntax error on my part, but how do I get REFP1-9 to work with DPC+? Do I need to use _REFP1 like with multisprite? As for the rest, I get Assembly errors claiming that they're unrecognized, so how should they be called?

Also, can TIA registers be called using an index, such as REFP[temp1] ?

#2 SeaGtGruff OFFLINE  



  • 5,566 posts
  • Location:South Carolina, USA

Posted Sun Mar 17, 2013 7:56 PM

Yes, TIA registers can be called using an index. However, that doesn't necessarily mean you can use this to update REFP0 through REFP9 using an index, since only REFP0 and REFP1 are actual TIA registers.

Looking at the header file for the multisprite kernel, I don't even see _REFP1 at all, just _NUSIZ1 through NUSIZ5. If I remember correctly (it's been a while since I've used the multisprite kernel), batari combined REFP with NUSIZ for sprites 1 through 5 in the multisprite kernel, since REFP uses bit 3 but NUSIZ doesn't. Thus, _NUSIZ1 through NUSIZ5 can combine the functions of NUSIZ with the functions of REFP. For sprite 0 you have to use the two separate registers, NUSIZ0 and REFP0. For the other sprites you use _NUSIZ1 through NUSIZ5, which are RAM variables or "virtual registers" rather than actual TIA registers. Whatever you write to _NUSIZ1 will be copied into NUSIZ1 and REFP1 for drawing sprite 1, and likewise the contents of NUSIZ2 through NUSIZ5 will be copied into NUSIZ1 and REFP1 for drawing sprites 2 through 5. The reason you need the underline at the beginning of _NUSIZ1 is to specify that you want to write to the RAM variable rather than to the TIA register named NUSIZ1.

Likewise, I don't see any _REFP or REFP variables in the DPC+ header, just _NUSIZ1 through NUSIZ9. I assume they work the same way as in the multisprite kernel-- i.e., that they combine the functionality of the NUSIZ and REFP registers. _NUSIZ1 has an underline at the beginning but NUSIZ2 through NUSIZ9 do not.

Since _NUSIZ1 through NUSIZ5 (in the multisprite kernel) and _NUSIZ1 through NUSIZ9 (in the DPC+ kernel) are defined one after the other in RAM, you should be able to set them using _NUSIZ1 with an index-- e.g., _NUSIZ1[index]=whatever. The value you set them to should combine the missile size, reflect flag, and number of sprite copies into a single value:

bits 4 and 5 = missile size
bit 3 = reflect flag
bits 0 through 2 = sprite size or number of sprite copies

#3 iesposta OFFLINE  


    River Patroller

  • 3,789 posts
  • Retro-gaming w/my VCS
  • Location:Pennsylvania

Posted Sun Mar 17, 2013 9:58 PM

Yep, Sea is correct.
I couldn't get player1 to reflect, but player2 thru player9 reflect with their NUSIZ2 NUSIZ3 NUSIZ4 NUSIZ5 NUSIZ6 NUSIZ7 NUSIZ8 NUSIZ9
Example: reflect player3
NUSIZ3{3} = 1
(The 3 in curly brackets is bit 3.)
player1 can be reflected using player1's special _NUSIZ1: _NUSIZ1{3} = 1

Also, bits 6 and 7 control smooth entry, called masking, of a player {bit 7} to the screen from the left or right side {bit 6} but was never shown in an example.
It is commented in the code.
This needs figured out!
I figured this out.
It is a subtle effect, but useful if you don't want a player sprite wrapping from the left/right sides of the screen. (On both sides of the screen at the same time.)
You want the sprite to move off screen to the left without it sliding in on the right.
Bit 7 of NUSIZx turns the masking on: NUSIZ2{7} = 1
Bit 6 of NUSIZx sets Left or Right masking (L/R): NUSIZ2{6} = 0 will let the sprite disappear off the left side of the screen.
Once it is moved off screen you should set its location, because if you keep subtracting its position it will appear on the right side and continue right to left.
NUSIZ2{6} = 1 will let the sprite disappear off the right side of the screen.

Edited by iesposta, Mon Mar 18, 2013 7:31 PM.

#4 iesposta OFFLINE  


    River Patroller

  • 3,789 posts
  • Retro-gaming w/my VCS
  • Location:Pennsylvania

Posted Mon Mar 18, 2013 7:30 PM

bump for edited info.

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users