VDP2 Transparency Issue

I have been messing with the Saturn VDP2 in cell mode, I have NBG0 set to 32k rbg color which has the main colored tiles, and NBG1 in 256 color mode /w transparency displaying the white outlines. When I enable bothe backgrounds the display seems interlaced, is this normal or am I missing something. I am not using SGL or SBL just straight access.

[attachmentid=1377][attachmentid=1378]
 

Attachments

  • photo1.jpg
    photo1.jpg
    61.7 KB · Views: 147
  • photo1.jpg
    photo1.jpg
    61.7 KB · Views: 133
  • photo1.jpg
    photo1.jpg
    61.7 KB · Views: 138
  • photo1.jpg
    photo1.jpg
    61.7 KB · Views: 150
  • photo2.jpg
    photo2.jpg
    85.5 KB · Views: 154
  • photo2.jpg
    photo2.jpg
    85.5 KB · Views: 149
  • photo2.jpg
    photo2.jpg
    85.5 KB · Views: 137
  • photo2.jpg
    photo2.jpg
    85.5 KB · Views: 140
Originally posted by a-dac@Sun, 2005-07-17 @ 10:12 AM

I have been messing with the Saturn VDP2 in cell mode, I have NBG0 set to 32k rbg color which has the main colored tiles, and NBG1 in 256 color mode /w transparency displaying the white outlines. When I enable bothe backgrounds the display seems interlaced, is this normal or am I missing something. I am not using SGL or SBL just straight access.

[attachmentid=1377][attachmentid=1378]

[post=136820]Quoted post[/post]​


This isn't normal. If the display is truly interlaced (try changing TVMD to enable interlacing and see if they look identical) then there is some kind of bug in the code that is also writing to TVMD.

Usually when you are setting up different types of backgrounds in respect to color depth, you get problems when the cycle pattern registers (CYCA0L through CYCB1U, IIRC) aren't set up properly. For example when using the 32K RGB mode you need to allocate more cycles to pattern data fetches.

Normally the Action Replay initializes the VDP for 16-color displays, but you'll have to change the cycle pattern registers for anything more colorful than that.
 
I played with the TVMD reg and things got really funky when turning on interlacing I currently have it set to 0x8010 (tv on at 320x240) and the timing regs are:

CYCA0 = 0x0123FFFF;

CYCA1 = 0xCDFFFFFF;

CYCB0 = 0x445F445F;

CYCB1 = 0xFFFFFFFF;

I have also tried different combbinations of CYCB0 without much luck.

The only other thing is this:

if(trns_flg==NBG1ON) {

trns_flg=NBG1OFF;

BGON = 0x0101;

} else {

trns_flg=NBG1ON;

BGON = 0x0103;

}

I found it in the SGL manual on using transparency. Adding this was the only way I could get the NBG1 pixels to be transparent.
 
Ok got things working... finally... the turning on and off of the backgrounds isn't right :p Turns out bgcon put the black bits as the last color code 255 instead of 0 which is the transparent bit. oh well.. moving on btw thanks cgfm2.
 
i'm glad you're not using the sgl and or sbl libraries! ugh, i don't understand the vram cycle patterns at all! i have written some code to make use of the nbg2 it probably doesn't run on real hardware due to the fact that i didn't set any of the cycle patterns up. note, this is my 100% code:
Code:
#include "vdp2.h"

#define NBG2_CEL_ADR (VDP2_VRAM_A0 + 0x02000)

#define NBG2_MAP_ADR (VDP2_VRAM_A0 + 0x10000)

#define NBG2_COL_ADR (VDP2_COLRAM)

void

vblank(struct VDP2 *io)

{

 while((io->reg[TVSTAT] & (1<<3)) == 8);

 while((io->reg[TVSTAT] & (1<<3)) == 0);

}

int

main(void)

{

 unsigned long i,x=0;

 unsigned char *video_bank_a = (unsigned char *)VDP2_VRAM_A0;

 unsigned char *video_bank_b = (unsigned char *)VDP2_VRAM_B0;

 unsigned short *map = (unsigned short *)NBG2_MAP_ADR;

 unsigned short *cram = (unsigned short *)NBG2_COL_ADR;

 /* Point to the VDP2 IO address */

 struct VDP1 *vdp1 = (struct VDP1 *)VDP1_IO;

 struct VDP2 *vdp2 = (struct VDP2 *)VDP2_IO;

 /* VRAM - Tiles*/

 for(i = 0; i < 0x8000; i++) {

  video_bank_a[i] = 0x0000;

  video_bank_b[i] = 0x0000;

 }

 /* Clear Map */

 for(i = 0; i < (1024 * 256); i++) {

  map[i] = 0x0000;

 }

 /* clear CRAM */

 for(i = 0; i <0x1000; i++) {

  cram[i] = 0x0000;

 }

 /* Clear VDP1 */

 for(i = 0; i < 72; i++) {

  vdp1->reg[i] = 0x0000;

 }

 /* Clear VDP2 */

 for(i = 0; i < 72; i++) {

  vdp2->reg[i] = 0x0000;

 }

 /* Copy stuff, Add DMA support later */

 Cel2VRAM(pad_cel,(void *)NBG2_CEL_ADR,31808);

 Map2VRAM(pad_map,(void *)NBG2_MAP_ADR,32,23,0,256);

 Pal2CRAM(pad_pal,(void *)NBG2_COL_ADR,256);

 vdp2->reg[TVMD] = (1<<15);

 vdp2->reg[VRSIZE] = 0x0000;

 vdp2->reg[RAMCTL] = 0x0000;

 vdp2->reg[PLSZ] = 0x0000;

 vdp2->reg[CYCA0L] = 0x0123;

 vdp2->reg[CYCA0U] = 0xFFFF; /* unused? */

 vdp2->reg[BGON] = (1<<2);

 vdp2->reg[CHCTLB] = (1<<1);

 vdp2->reg[PNCN2] = (1<<14)|(1<<15);

/* ((NBG2_MAP_ADR>>16)&0x1F)|((NBG2_MAP_ADR>>8)&0x1FFF) */

 vdp2->reg[MPABN2] = ((NBG2_MAP_ADR>>5)&0xFFF)|((NBG2_MAP_ADR>>13)&0xFF);

 vdp2->reg[MPCDN2] = ((NBG2_MAP_ADR>>5)&0xFFF)|((NBG2_MAP_ADR>>13)&0xFF);

 vdp2->reg[MPOFN] = 0x0000; /* no map offset */

 /* Loop forever */

 while(1)

 {

  vblank(vdp2);

  *(volatile unsigned short *)0x25F80090 = x & 0x1FF;

  x++;

 }

 /* We'll never get here */

 return 0;

}

/* EOF */

any corrections would be great!
 
it's suppose to display a sega saturn control pad using the nbg2 background. so apparently the priority number register is very important. so, here is the binary. sorry about this, i'm going to burn a cdr now :)
 
Hey Piratero,

I tried the nbg2.bin demo, but sorry, only black screen instead of the Saturn control pad.

:(
 
Sorry, I havn't had much time lately.. hopefully this week or weekend I will be able to devote more time to it.
 
ah, that's too bad :( Rockin'-B: that really sucks, i wonder what i'm doing wrong (could it be the vram cycle patterns?) thank you all for testing my binary!
 
Originally posted by Piratero@Wed, 2005-07-27 @ 06:18 AM

ah, that's too bad :( Rockin'-B: that really sucks, i wonder what i'm doing wrong (could it be the vram cycle patterns?) thank you all for testing my binary!

[post=137330]Quoted post[/post]​


Some emulator doesn't care about the RGB flag, but the real Saturn does. So displaying a background image with RGB flag not set (MSB of each pixel) will succedd on Satourne, but not on real Saturn. What tool did you use for graphic conversion?
 
It doesn't look like a timing issue I looked and tried that with no change. It looks more like the saturn may be going to the wrong address for the tiles & map, but I haven't been able to verify that yet.
 
i actually copied the image from one of the sgl demos. what do you mean by rgb flag? are you talking about the ram color modes? thank you all for helping!
 
Ok, I got it to work right, but its hevily modified from your source and is on NBG0 not NBG2. If you want it on NBG2 let me know and i'll work on that otherwise i'll clean up the code and post it back.
 
Back
Top