gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > slow tiles

#1478 - whodoo - Sun Jan 19, 2003 2:37 pm

I got a tiny problem..it takes about 5 seconds for the emulator to start a program when using tiles..I got 64x64 tiles and the screen is just black for some seconds for the game starts.. I always got this "delay" when working with tiles but Ive seen lots of other games which start emiedatlly(and they are using tiles too)..I?ve tried to sue DMA copy for the tiles but I still got this problem..whatcoul it depend on?

#1480 - tepples - Sun Jan 19, 2003 3:24 pm

Emulators take time to load from disk, and some emulators aren't completely loaded by the time they create the main window.

1. Does it happen on hardware?

2. If you don't have hardware, what happens if you set the palette (especially color 0) and turn the screen on before you write the tiles? Is the delay still there?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#1483 - Splam - Sun Jan 19, 2003 3:34 pm

hmmm I noticed that on the test file you sent me to check on hardware ( a couple of seconds pause), I wondered at the time what it was doing. Even if you copied enough data to fill the whole of vram it shouldn't take more than a frame using dma. Only thing I could think of looking at it is your code to copy the map to vram but I just checked and it's not that. Must be something in your setup somewhere. hmmm hard to tell from a debugger with no labels to work from :(

#1486 - tepples - Sun Jan 19, 2003 3:46 pm

In that case, could you post the minimal source code that displays the problem?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#1489 - whodoo - Sun Jan 19, 2003 4:10 pm

this is the code before tha mainloop...(almost all)



REG_TM3D = 0;
REG_TM3CNT = TIME_FREQUENCY_1024 | TIME_ENABLE;

//set mode 1 and enable sprites and 1d mapping
SetMode(MODE_1 | OBJ_ENABLE | OBJ_MAP_1D);

// Sprites
vaInitializeSprites(); //set all sprites off screen (stops artifact)

//pointer to tile where sprite starts
for(int loop = 0; loop < 256; loop++)
OBJPaletteMem[loop] = palette[loop];

for(loop = 0; loop < 768; loop++)
{
OAMData[loop] = pacanimData[loop];
}

sprites[0].attribute0 = COLOR_256 | SQUARE | pacman.y; sprites[0].attribute1 = SIZE_16 | pacman.x;
sprites[0].attribute2 = 0;



//Let us set up the backgroud two structure and enable the background

bg2.number = 2; //background number 0-3
bg2.charBaseBlock = 0; //tile data position (right at the start of the available memory on 16Kb boundary)
bg2.screenBaseBlock = 28; //map data position on 2Kb boundary
bg2.colorMode = BG_COLOR_256; //256-colour background
bg2.size = ROTBG_SIZE_512x512; //size of map
bg2.mosaic = 0; //not enabled
bg2.x_scroll = 120; //scrolling variables
bg2.y_scroll = 80;

//Point to correct tile
//Point to correct tile and map data, update the Background and Display registers accordingly

EnableBackground(&bg2);

for(loop = 0; loop < 256; loop++)
BGPaletteMem[loop] = exptilesPalette[loop]; //load the background palette into memory

for(loop = 0; loop < exptiles_WIDTH * exptiles_HEIGHT /2; loop++) //load tile image data
bg2.tileData[loop] = exptilesData[loop];

//load the map image data
REG_DMA3SAD = (u32)map;
REG_DMA3DAD = (u32)bg2.mapData;
REG_DMA3CNT = 64*64/2 |DMA_16NOW;
*/
RotateBackground(&bg2,angle,120,80,zoom);
//Main Game loop

#1493 - Kay - Sun Jan 19, 2003 4:43 pm

You may try with FORCED_BLANK bit set (bit 7, 0x04000000) on real hardware during transfer, and clear it after completion.

Otherwise you may look at your CRT0.S file to remove inner loop and/or network booting/search code.


-- Kay

#1570 - dummer Anf?nger - Mon Jan 20, 2003 10:28 am

Can it be that u use dovotos sample?
It is very slow because u calculate all thosse rotation values at the beginning.
_________________
... but im just a dummy Newbie

(sorry for my terrible english)

#1597 - whodoo - Mon Jan 20, 2003 5:12 pm

yes it was the code to store sin/cos-values for the rotation...
but if I disabled the function RotateBackground(bg, angle, scrollx, scrolly, zoom) or something, the "track" didnt show up...why?