-Rewrote the framebuffer code. Now it supports VRAM blocks A-D

-Added support for Display Mode 0(Display Off)
-Added the basic framework for Display Mode 3(Display from Main RAM)
This commit is contained in:
cyberwarriorx 2006-11-27 20:11:20 +00:00
parent 97b68cc3be
commit 36a1ce556b
2 changed files with 54 additions and 15 deletions

View File

@ -2,6 +2,8 @@
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2006 Theo Berkau
This file is part of DeSmuME
DeSmuME is free software; you can redistribute it and/or modify
@ -123,11 +125,30 @@ void GPU_DeInit(GPU * gpu)
free(gpu);
}
/* NOTICE: the name of function is unclear, but it's about writing in DISPLAY_CR */
/* Sets up LCD control variables for Display Engines A and B for quick reading */
void GPU_setVideoProp(GPU * gpu, u32 p)
{
gpu->prop = p;
gpu->dispMode = p >> 16;
if (gpu->lcd == 0)
gpu->dispMode &= 0x3;
else
gpu->dispMode &= 0x1;
switch (gpu->dispMode)
{
case 0: // Display Off
return;
case 1: // Display BG and OBJ layers
break;
case 2: // Display framebuffer
gpu->vramBlock = (p >> 18) & 0x3;
return;
case 3: // Display from Main RAM
LOG("FIXME: Display Mode 3 not supported(Display from Main RAM)\n");
return;
}
gpu->nbBGActif = 0;
if(p & DISPLAY_SPR_1D_LAYOUT)
{
@ -1127,7 +1148,7 @@ void sprite2D(GPU * gpu, u16 l, u8 * dst, u8 * prioTab)
size sprSize = sprSizeTab[(aux->attr1>>14)][(aux->attr0>>14)];
u32 lg = sprSize.x;
if(sprY>192)
sprY = (s32)((s8)(aux->attr0 & 0xFF));

View File

@ -2,6 +2,8 @@
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2006 Theo Berkau
This file is part of DeSmuME
DeSmuME is free software; you can redistribute it and/or modify
@ -80,7 +82,10 @@ struct _GPU
u8 lcd;
u8 core;
u8 dispMode;
u8 vramBlock;
u8 nbBGActif;
u8 BGIndex[4];
u8 ordre[4];
@ -137,20 +142,33 @@ static INLINE void GPU_ligne(Screen * screen, u16 l)
u8 i8;
u16 i16;
/* FIXME I've just quickly added mic's framebuffer patch here.
* I'm really not sure it's correct.
*/
if (gpu->lcd == 0) {
u32 mainlcdcnt = T1ReadLong(ARM9Mem.ARM9_REG, 0);
int ii = l * 256;
if ((mainlcdcnt & 0x10000) == 0) {
for (i=0; i<256; i++) {
T2WriteWord(dst, i << 1, T1ReadWord(ARM9Mem.ARM9_LCD, ii << 1));
ii++;
// This could almost be changed to use function pointers
switch (gpu->dispMode)
{
case 1: // Display BG and OBJ layers
break;
case 0: // Display Off(Display white)
{
for (i=0; i<256; i++)
{
T2WriteWord(dst, i << 1, 0x7FFF);
}
return;
}
case 2: // Display framebuffer
{
int ii = l * 256 * 2;
for (i=0; i<(256 * 2); i+=2)
{
u8 * vram = ARM9Mem.ARM9_LCD + (gpu->vramBlock * 0x20000);
T2WriteWord(dst, i, T1ReadWord(vram, ii));
ii+=2;
}
return;
}
case 3: // Display from Main RAM(FIX ME)
return;
}
u32 c = T1ReadWord(ARM9Mem.ARM9_VMEM, gpu->lcd * 0x400);