X16Community / x16-rom

Other
43 stars 27 forks source link

[enhancement] add a way to find out the size of a file on the SDcard #332

Closed tallLeRoy closed 4 months ago

tallLeRoy commented 4 months ago

The R47 ROM does not have a method that can return the size of a file on the SDcard. For some things, like fonts, it is an advantage to know the size of the file before loading it into VERA RAM. The method I am using to load the 2048 or 4096 byte files is load it first into banked RAM, determine the size and then transfer the font into VERA RAM at 1E800 for 4096 byte fonts, and 1F000 for 2048 byte fonts. Loading the larger font at 1F000 would harm VERA PSG, PALETTE and Sprite operations. Loading the smaller font at 1E800 would allow the 80 line text buffer to intrude on the font.

There are a lot of wasted cycles in the font loading example, I am sure there are other cases where knowing the size of a file before loading would save some cycles.