_DISPCNT_ struct completed

This commit is contained in:
damdoum 2007-01-09 08:09:59 +00:00
parent 86a54a81fd
commit 4ba50a1f1e
2 changed files with 41 additions and 36 deletions

View File

@ -130,7 +130,7 @@ void GPU_setVideoProp(GPU * gpu, u32 p)
gpu->prop = p;
// gpu->dispMode = DISPCNT_DISPLAY_MODE(p,gpu->lcd) ;
gpu->dispMode = cnt->ExMode & ((gpu->lcd)?1:3);
gpu->dispMode = cnt->DisplayMode & ((gpu->lcd)?1:3);
switch (gpu->dispMode)
{
@ -140,7 +140,7 @@ void GPU_setVideoProp(GPU * gpu, u32 p)
break;
case 2: // Display framebuffer
// gpu->vramBlock = DISPCNT_VRAMBLOCK(p) ;
gpu->vramBlock = cnt->FrameBufferSelect;
gpu->vramBlock = cnt->VRAM_Block;
return;
case 3: // Display from Main RAM
LOG("FIXME: Display Mode 3 not supported(Display from Main RAM)\n");
@ -148,25 +148,23 @@ void GPU_setVideoProp(GPU * gpu, u32 p)
}
gpu->nbBGActif = 0;
if(cnt->SpriteMode & 0x1)
if(cnt->OBJ_Tile_1D)
{
/* 1-d sprite mapping */
gpu->sprBlock = 5 + DISPCNT_TILEOBJ1D_BOUNDARY(p) ; /* TODO: better comment (and understanding btw 8S) */
if((gpu->core == GPU_SUB) && (DISPCNT_TILEOBJ1D_BOUNDARY(p) == 3))
/* TODO: better comment (and understanding btw 8S) */
gpu->sprBlock = 5 + cnt->OBJ_Tile_1D_Bound ;
if((gpu->core == GPU_SUB) && (cnt->OBJ_Tile_1D_Bound == 3))
{
gpu->sprBlock = 7;
}
gpu->spriteRender = sprite1D;
}
else
{
} else {
/* 2d sprite mapping */
gpu->sprBlock = 5;
gpu->spriteRender = sprite2D;
}
if(DISPCNT_BMPOBJ1D_BOUNDARY(p) && (gpu->core == GPU_MAIN))
if(cnt->OBJ_BMP_1D_Bound && (gpu->core == GPU_MAIN))
{
gpu->sprBMPBlock = 8;
}
@ -175,7 +173,7 @@ void GPU_setVideoProp(GPU * gpu, u32 p)
gpu->sprBMPBlock = 7;
}
gpu->sprEnable = cnt->Sprite_Enable;
gpu->sprEnable = cnt->OBJ_Enable;
GPU_setBGProp(gpu, 3, T1ReadWord(ARM9Mem.ARM9_REG, gpu->core * ADDRESS_STEP_4KB + 14));
GPU_setBGProp(gpu, 2, T1ReadWord(ARM9Mem.ARM9_REG, gpu->core * ADDRESS_STEP_4KB + 12));
@ -394,8 +392,8 @@ void GPU_setBGProp(GPU * gpu, u16 num, u16 p)
else
{
gpu->BG_bmp_ram[num] = ((u8 *)ARM9Mem.ARM9_ABG) + BGCNT_SCREENBASEBLOCK(p) * ADDRESS_STEP_16KB;
gpu->BG_tile_ram[num] = ((u8 *)ARM9Mem.ARM9_ABG) + BGCNT_CHARBASEBLOCK(p) * ADDRESS_STEP_16KB + ((gpu->prop >> 24) & 0x7) * ADDRESS_STEP_64kB ;
gpu->BG_map_ram[num] = ARM9Mem.ARM9_ABG + BGCNT_SCREENBASEBLOCK(p) * ADDRESS_STEP_2KB + ((_DISPCNT_*)(&(gpu->prop)))->ScreenBaseBlock * ADDRESS_STEP_64kB;
gpu->BG_tile_ram[num] = ((u8 *)ARM9Mem.ARM9_ABG) + BGCNT_CHARBASEBLOCK(p) * ADDRESS_STEP_16KB + ((_DISPCNT_*)&gpu->prop)->CharacBase_Block * ADDRESS_STEP_64kB ;
gpu->BG_map_ram[num] = ARM9Mem.ARM9_ABG + BGCNT_SCREENBASEBLOCK(p) * ADDRESS_STEP_2KB + ((_DISPCNT_*)&gpu->prop)->ScreenBase_Block * ADDRESS_STEP_64kB;
}
/*if(!(p&(1<<7)))
@ -417,8 +415,8 @@ void GPU_setBGProp(GPU * gpu, u16 num, u16 p)
/* we got a naming problem here, dispMode actual is _DISPCNT_.ExMode */
// gpu->BGSize[num][0] = sizeTab[mode2type[gpu->dispMode][num]][BGCNT_SCREENSIZE(p)][0];
// gpu->BGSize[num][1] = sizeTab[mode2type[gpu->dispMode][num]][BGCNT_SCREENSIZE(p)][1];
gpu->BGSize[num][0] = sizeTab[mode2type[((_DISPCNT_*)(&(gpu->prop)))->DisplayMode][num]][BGCNT_SCREENSIZE(p)][0];
gpu->BGSize[num][1] = sizeTab[mode2type[((_DISPCNT_*)(&(gpu->prop)))->DisplayMode][num]][BGCNT_SCREENSIZE(p)][1];
gpu->BGSize[num][0] = sizeTab[mode2type[((_DISPCNT_*)&gpu->prop)->BG_Mode][num]][BGCNT_SCREENSIZE(p)][0];
gpu->BGSize[num][1] = sizeTab[mode2type[((_DISPCNT_*)&gpu->prop)->BG_Mode][num]][BGCNT_SCREENSIZE(p)][1];
}
@ -793,7 +791,7 @@ INLINE void renderline_textBG(GPU * gpu, u8 num, u8 * DST, u16 X, u16 Y, u16 LG)
}
return;
}
if(!((_DISPCNT_*)(&(gpu->prop)))->ExBGPalette_Enable) /* color: no extended palette */
if(!((_DISPCNT_*)&gpu->prop)->ExBGxPalette_Enable) /* color: no extended palette */
{
yoff = ((Y&7)<<3);
pal = ARM9Mem.ARM9_VMEM + gpu->core * ADDRESS_STEP_1KB ;
@ -1180,7 +1178,7 @@ void sprite1D(GPU * gpu, u16 l, u8 * dst, u8 * prioTab)
u16 i;
src = gpu->sprMem + (spriteInfo->TileIndex<<block) + ((y>>3)*sprSize.x*8) + ((y&0x7)*8);
if(gpu->prop&(1<<31))
if(((_DISPCNT_*)&gpu->prop)->ExOBJPalette_Enable)
pal = ARM9Mem.ObjExtPal[gpu->core][0]+(spriteInfo->PaletteIndex*0x200);
else
pal = ARM9Mem.ARM9_VMEM + 0x200 + gpu->core *0x400;

View File

@ -48,25 +48,32 @@ extern "C" {
typedef struct
{
/*0*/ unsigned DisplayMode:3;
/*3*/ unsigned BG0_3D:1;
/*4*/ unsigned SpriteMode:3;
/*7*/ unsigned ForceBlank:1;
/*8*/ unsigned BG0_Enable:1;
/*9*/ unsigned BG1_Enable:1;
/*10*/ unsigned BG2_Enable:1;
/*11*/ unsigned BG3_Enable:1;
/*12*/ unsigned Sprite_Enable:1;
/*13*/ unsigned Win0_Enable:1;
/*14*/ unsigned Win1_Enable:1;
/*15*/ unsigned SpriteWin_Enable:1;
/*16*/ unsigned ExMode:2; // (00: Framebuffer, 01: GBA-style, 10: Framebuffer-alike, 11: ?)
/*18*/ unsigned FrameBufferSelect:2; // ExMode 2
/*20*/ unsigned ExSpriteMode:3;
/*23*/ unsigned :4;
/*27*/ unsigned ScreenBaseBlock:3;
/*30*/ unsigned ExBGPalette_Enable:1;
/*31*/ unsigned ExSpritePalette_Enable:1;
/*0*/ unsigned BG_Mode:3; // A+B:
/*3*/ unsigned BG0_3D:1; // A : 0=2D, 1=3D
/*4*/ unsigned OBJ_Tile_1D:1; // A+B: 0=2D (32KB), 1=1D (32..256KB)
/*5*/ unsigned OBJ_BMP_2D_dim:1; // A+B: 0=128x512, 1=256x256 pixels
/*6*/ unsigned OBJ_BMP_mapping:1; // A+B: 0=2D (128KB), 1=1D (128..256KB)
// 7-15 same as GBA
/*7*/ unsigned ForceBlank:1; // A+B:
/*8*/ unsigned BG0_Enable:1; // A+B: 0=disable, 1=Enable
/*9*/ unsigned BG1_Enable:1; // A+B: 0=disable, 1=Enable
/*10*/ unsigned BG2_Enable:1; // A+B: 0=disable, 1=Enable
/*11*/ unsigned BG3_Enable:1; // A+B: 0=disable, 1=Enable
/*12*/ unsigned OBJ_Enable:1; // A+B: 0=disable, 1=Enable
/*13*/ unsigned Win0_Enable:1; // A+B: 0=disable, 1=Enable
/*14*/ unsigned Win1_Enable:1; // A+B: 0=disable, 1=Enable
/*15*/ unsigned WinOBJ_Enable:1; // A+B: 0=disable, 1=Enable
/*16*/ unsigned DisplayMode:2; // A+B: coreA(0..3) coreB(0..1) GBA(Green Swap)
/*18*/ unsigned VRAM_Block:2; // A : VRAM block (0..3=A..D)
/*20*/ unsigned OBJ_Tile_1D_Bound:2; // A+B:
/*22*/ unsigned OBJ_BMP_1D_Bound:1; // A :
/*23*/ unsigned OBJ_HBlank_process:1; // A+B: OBJ processed during HBlank (GBA bit5)
/*24*/ unsigned CharacBase_Block:3; // A : Character Base (64K step)
/*27*/ unsigned ScreenBase_Block:3; // A : Screen Base (64K step)
/*30*/ unsigned ExBGxPalette_Enable:1; // A+B: 0=disable, 1=Enable BG extended Palette
/*31*/ unsigned ExOBJPalette_Enable:1; // A+B: 0=disable, 1=Enable OBJ extended Palette
} _DISPCNT_;
#define DISPCNT_OBJMAPING1D(val) (((val) >> 4) & 1)