Jump to content



0

Batari DPC+ Sprite Masking?


12 replies to this topic

#1 jrok OFFLINE  

jrok

    Stargunner

  • 1,108 posts

Posted Tue Jul 19, 2011 6:18 PM

Would it be possible in the batari DPC+ kernel to mask-wrap the multiplexed P1 sprite similar to Demo 4 of the Harmony DPC+ programming thread?

Quote

Demo 4 - Data Writer Demo

* Unlike the DPC cartridge, the DPC+ Display Data ends up in RAM and can be modified at run time.
* Joystick to move snowman - notice when he moves on/off screen he is masked to smoothly enter/exit the display. (compare with Demo 0)
* Fire to flip snowman - this shows the difference between DFxWRITE and DFxPUSH.
* Attached Image: DPC+ demo.bin_4.png

Thanks,
J

#2 ScumSoft OFFLINE  

ScumSoft

    Moonsweeper

  • 331 posts
  • Location:Polysorbate 60

Posted Tue Jul 19, 2011 7:21 PM

The demo manually masks the sprite data based on sprite location, so I don't think bB can do this right now without loading prefab'd masked sprites.

I would also love to dynamically alter sprite data such as X = player sprite data index:

player0[X] = $FF

But I don't think anything like this is implemented right now.

Edited by ScumSoft, Tue Jul 19, 2011 7:22 PM.


#3 jrok OFFLINE  

jrok

    Stargunner

  • 1,108 posts

Posted Tue Jul 19, 2011 7:29 PM

View PostScumSoft, on Tue Jul 19, 2011 7:21 PM, said:

The demo manually masks the sprite data based on sprite location...

Hmmm. So do you mean that it manually loads and repositions shapes at positions 0 and 160 to simulate a smooth exit/entry? It just surprises me a little, since I assumed that its inclusion in the demo was demonstrating a dynamic mask of some sort. In other words, since we could do this manually sans the chip, why is it part of the demo? What's the advantage being shown?

Edited by jrok, Tue Jul 19, 2011 7:29 PM.


#4 ScumSoft OFFLINE  

ScumSoft

    Moonsweeper

  • 331 posts
  • Location:Polysorbate 60

Posted Tue Jul 19, 2011 7:46 PM

I'll post the meaningful parts, but essentially what's being done is the data-fetchers are manually altering the bank 6 graphic data.
Spoiler
So what is happening is the pointers are pointed to where frosty resides in Bank6 ram, and then updated as needed, then rewritten from a non-altered frosty when he needs to be shown again.

This can be done if we could access bank6 in ASM from bB, though I haven't tried doing such a thing yet.

Edited by ScumSoft, Fri Jul 22, 2011 4:55 PM.


#5 SpiceWare OFFLINE  

SpiceWare

    Quadrunner

  • 5,990 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Wed Jul 20, 2011 9:06 AM

View Postjrok, on Tue Jul 19, 2011 7:29 PM, said:

It just surprises me a little, since I assumed that its inclusion in the demo was demonstrating a dynamic mask of some sort. In other words, since we could do this manually sans the chip, why is it part of the demo? What's the advantage being shown?
You're posting this in the bB forms - are you overlooking that my DPC+ demo was not a demo for bB?

The name for that part of the demo is Data Writer Demo. As such, it's whole purpose is to show how to write data into the DD(Display Data) bank at run time. The masking was just a way to visually show that the data changed, along with being a potential reason as to why you'd want to manipulate the DD in the first place. I have some updated masking routines, run by the ARM chip, in Chun Li that handle all 3 sizes of the player.


View PostScumSoft, on Tue Jul 19, 2011 7:46 PM, said:

So what is happening is the pointers are pointed to where frosty resides in Bank6 ram, and then updated as needed, then rewritten from a non-altered frosty when he needs to be shown again.

This can be done if we could access bank6 in ASM from bB, though I haven't tried doing such a thing yet.
Using the Copy Data to Fetcher feature, and the fact that "bank 6" for it is the original DD ROM, you could do this:
1) Copy the original, unmasked sprite image from DD ROM to DD RAM
2) point 2 DataFetchers at the sprite in DD RAM
3) Do a loop that reads using one of those DataFetchers, masks the value it read, and finally writes the masked value back out using the other DataFetcher.

Edited by SpiceWare, Wed Jul 20, 2011 9:06 AM.


#6 jrok OFFLINE  

jrok

    Stargunner

  • 1,108 posts

Posted Wed Jul 20, 2011 9:15 AM

View PostSpiceWare, on Wed Jul 20, 2011 9:06 AM, said:

You're posting this in the bB forms - are you overlooking that my DPC+ demo was not a demo for bB?

Um... no. That's why I specified the "Batari DPC+" kernel in the topic title. I was just wondering if a similar runtime write could be done to mask sprites in that kernel.

#7 SpiceWare OFFLINE  

SpiceWare

    Quadrunner

  • 5,990 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Wed Jul 20, 2011 10:10 AM

Your text in #3 asked "why is it part of the demo?" - that's what I was responding to.

#8 jrok OFFLINE  

jrok

    Stargunner

  • 1,108 posts

Posted Wed Jul 20, 2011 10:17 AM

View PostSpiceWare, on Wed Jul 20, 2011 10:10 AM, said:

Your text in #3 asked "why is it part of the demo?" - that's what I was responding to.

I suppose I was wondering what the difference was between masking a sprite stored in RAM (as I've done before with sprites stored in Sara RAM) and the technique being shown in the demo. Although I gess I wasn't really 'wondering' that aloud, so fair enough.

It wasn't meant as an offense or anything. I was asking Scumsoft to elaborate on his reply a little, so I could understand the difference. Moreover, I posted this in the bB section, and explained I was trying to understand whether the technique could be appropriated for batari's kernel, and did everything except write "Please don't come over here and yell at me, Darrell!"

But, alas... :)

Edited by jrok, Wed Jul 20, 2011 10:18 AM.


#9 SpiceWare OFFLINE  

SpiceWare

    Quadrunner

  • 5,990 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Wed Jul 20, 2011 11:26 AM

I'm not yelling - just was explaining the why :)

Batari has access to Chun Li's source, and he's free to add the masking routines to bB. It's possible he's waiting for Chun Li to be officially released as the routines could be revised before then, or possibly the routines won't work as they need to know the NUSIZ for the sprite(I don't know if the bB multi-sprite DPC+ kernel supports setting that per multiplexed sprite or not).

#10 batari OFFLINE  

batari

    )66]U('=I;B$*

  • 6,236 posts
  • begin 644 contest

Posted Wed Jul 20, 2011 3:25 PM

The sprite data for P1 is copied every frame, so it should be possible to optionally mask the data every frame as well. It looks like NUSIZ bits 6-7 are unused so maybe these could enable the feature - D6 could enable/disable masking, and D7 would mask on the left or right edge of the screen. I'm not sure how feasible it is to handle single, double, and quad-width sprites as the code could get a little convoluted.

#11 ScumSoft OFFLINE  

ScumSoft

    Moonsweeper

  • 331 posts
  • Location:Polysorbate 60

Posted Wed Jul 20, 2011 5:30 PM

View PostSpiceWare, on Wed Jul 20, 2011 9:06 AM, said:

Using the Copy Data to Fetcher feature, and the fact that "bank 6" for it is the original DD ROM, you could do this:
1) Copy the original, unmasked sprite image from DD ROM to DD RAM
2) point 2 DataFetchers at the sprite in DD RAM
3) Do a loop that reads using one of those DataFetchers, masks the value it read, and finally writes the masked value back out using the other DataFetcher.
Good idea, this calls for some tests!
I'll see if I can get something similar working.

[edit]
I've tried a few things, but during compile it names the player0 objects as player(randomID)_0 so I lose my pointer references.
Otherwise this would update the player0 objects as needed:

 
Mask_P0
 rem MASK PLAYER0
 if player0x <= 17 then goto maskL
 if player0x >= 153 then goto maskR
 return

maskL
 asm
 lda #<(pointerplayer0)
 sta DF0LOW
 lda #>(pointerplayer0)
 sta DF0HI
 lda player0x
 and #7
 tay
 ldx MaskDataL,y
.applymaskL
 sax DF0WRITE
 dec player0height
 bne .applymaskL
end
	return

maskR
 asm
 lda #<(pointerplayer0)
 sta DF0LOW
 lda #>(pointerplayer0)
 sta DF0HI
 lda player0x
 and #7
 tay
 ldx MaskDataR,y
.applymaskR
 sax DF0WRITE
 dec player0height
 bne .applymaskR
end
	return

 data MaskDataR
        %11111110
        %11111100
        %11111000
        %11110000
        %11100000
        %11000000
        %10000000
        %00000000
end

 data MaskDataL 
        %01111111
        %00111111
        %00011111
        %00001111
        %00000111
        %00000011
        %00000001
        %00000000
end

Edited by ScumSoft, Thu Jul 21, 2011 4:33 PM.


#12 SpiceWare OFFLINE  

SpiceWare

    Quadrunner

  • 5,990 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Thu Jul 21, 2011 8:34 AM

View Postbatari, on Wed Jul 20, 2011 3:25 PM, said:

I'm not sure how feasible it is to handle single, double, and quad-width sprites as the code could get a little convoluted.
Chun Li's routines already handle all 3 sizes. Feel free to use them in bB. They work by using the X position to determine which side to mask, using a range of -7 thru 160 if I recall correctly.

#13 batari OFFLINE  

batari

    )66]U('=I;B$*

  • 6,236 posts
  • begin 644 contest

Posted Sat Jul 23, 2011 1:33 PM

I will take a look. I'm still not sure about double and quad-width sprites as it's impossible to mask them smoothly without using other objects to hide part of them.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users