Nop90 Posted November 14, 2023 Share Posted November 14, 2023 I'm using karri's template and his version of CC65. To optimize the speed of Starblader I reduced every sprite loaded from cart to no more than 2KB (2 blocks of the cart). Is there a trick to force the rom builder to align every sprite at the start of Block, padding with 0s the unused space of the cart? This will optimize the loading speed. The game is already running fine without this optimization, but I wasn't able to figure it out how it could be done and I'm curious. Quote Link to comment Share on other sites More sharing options...
42bs Posted November 14, 2023 Share Posted November 14, 2023 Lynxer had #ALIGN which would align the next file on block boundary. But have a look into the rom builder source. Quote Link to comment Share on other sites More sharing options...
+karri Posted November 14, 2023 Share Posted November 14, 2023 I believe you need to define all your segments with two new keywords like this: TILES: file = %O, define = yes, start = $0200, size = 2048, fill = yes, fillval = $ff; This should force the linker to add $ff bytes up to the end of the block. Edit: The align=256 keyword tells the linker that the RAM starting point has to be aligned. So it does not help you much in this case. 1 Quote Link to comment Share on other sites More sharing options...
42bs Posted November 14, 2023 Share Posted November 14, 2023 (edited) fillval = $ff is important, flashing "ff" is quicker than flashing "00" Edited November 14, 2023 by 42bs 1 Quote Link to comment Share on other sites More sharing options...
+karri Posted November 14, 2023 Share Posted November 14, 2023 2 minutes ago, 42bs said: fillval = $ff is important, flashing "ff" is quicker than flashing "00" Yeah.. I just realized that in my programmer code I forgot to test for $ff. Stupid me. I just added it and the result is amazing. You can actually skip all the $ff bytes while programming. Quote Link to comment Share on other sites More sharing options...
Nop90 Posted November 14, 2023 Author Share Posted November 14, 2023 Thank you, this is of great help Quote Link to comment Share on other sites More sharing options...
Nop90 Posted November 17, 2023 Author Share Posted November 17, 2023 (edited) If someone needs to address the same thing, this is what I did: first applied the padding SP00: start = __MEMORY_SP__, size = __SP_SIZE__, define = yes, file = %O, fill = yes, fillval = $ff; than changed the size of all the sprite files on cart from: _SP00_FILENR=_BGC_FILENR+1 entry bgCoff, bgClen, sp00off, sp00block, sp00len,__SP00_RODATA_SIZE__, __SP00_START__ to _SP00_FILENR=_BGC_FILENR+1 entry bgCoff, bgClen, sp00off, sp00block, sp00len,__BLOCKSIZE__, __SP00_START__ and last thing defined a CARTPADDING file just before the sprites CARTPADDING: start = __MEMORY_SP__, size = __SP_SIZE__, define = yes, file = %O; _CARTPADDING_FILENR=_BGC_FILENR+1 entry bgCoff, bgClen, cpoff, cpblock, cplen,__CARTPADDING_RODATA_SIZE__, __CARTPADDING_START__ _SP00_FILENR=_CARTPADDING_FILENR+1 entry cpoff, cplen, sp00off, sp00block, sp00len,__BLOCKSIZE__, __SP00_START__ the content of this cart file is a sequence of $FF created with a simple c file in a dummy rodata segment // padding.c // Dummy data // to fill some of the cart space with $FF (that is a value faster to write ona cart flash chip) to align the sprites data to the start of a new block // the length of the array can be determined in 2 pass, compile the ROM, check the cart directory, calculate the padding size, change the value and compile again const char padding[604] = {255}; don't know if this is the best solution, but it works and is fast Edited November 17, 2023 by Nop90 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.