I'm trying to make an TA bufferes initialize by reference to the Marcus's sample.
I wouid like to use Texture freely and lerge in VRAM. So I would like to put the TA buffer at the bottom of the VRAM.
However, if the bottom address(TA_BUFFER_BOTTOM2) of the Ta buffer is 0xa5800000, the screen freezes.
but if the adress is 0xa5700000, not freezes.
Code: Select all
#define TA_BUFFER_BOTTOM1 0xa5400000
#define TA_BUFFER_BOTTOM2 0xa5800000
/* TA Buffers */
static unsigned char *vtx_buf[2]; /* Vertex CMD buffer*/
static unsigned char *obj_ptr_buf[2]; /*Object pointer buffer*/
static unsigned char *tile_buf[2]; /*Tile buffer*/
static unsigned char *screen[2]; /*screen*/
static int current; /*video flip num*/
static int scr_w; /*screen width*/
static int scr_h; /*screen height*/
.........
.........
void ta_create_buffer(){
int i;
unsigned char *ptr = (unsigned char *)TA_BUFFER_BOTTOM1;
int h = scr_w>>5; /*Tile num*/
int v = scr_h>>5;
for (i = 0; i<2; i++, ptr = (unsigned char *)TA_BUFFER_BOTTOM2) {
ptr -= scr_w * scr_h * 2;
screen[i] = ptr;
ptr -= ((24 + (6 * h*v)) * 4);
tile_buf[i] = ptr; /*Tile Buffer*/
ptr -= (512 * 1024);
vtx_buf[i] = ptr; /* Vertex Buffer */
ptr -= (128 * h*v * 3); /*(128*w*h) * (opaque+transparent+punchthruの分) */
obj_ptr_buf[i] = ptr; /*Object Pointer Buffer*/
/*set tile buffers*/
ta_create_tile_buffer(tile_buf[i], obj_ptr_buf[i], h, v);
}
}
Code: Select all
volatile unsigned int *regs = (volatile unsigned int *)0xa05f8000;
unsigned int vtx = ( (unsigned int)(vtx_buf[current]) )&0x007fffff;
unsigned int opb = ( (unsigned int)(obj_ptr_buf[current]) )&0x007fffff;
regs[0x008/4] = 1; /* Reset TA */
regs[0x008/4] = 0;
regs[0x124/4] = opb;
regs[0x12c/4] = 0;
regs[0x128/4] = vtx;
regs[0x130/4] = vtx + (512*1024);
regs[0x13c/4] = (((scr_h>>5)-1)<<16) | ((scr_w>>5)-1);
regs[0x164/4] = opb;
regs[0x140/4] = 0x00130303;
regs[0x144/4] = 0x80000000;