Chiron, Thanks for the ideas. Fortunately, I had already done something similar after consulting with Jim Brain a bit. Here's how CBM-Command works with directories. When a drive is selected, it opens the directory and starts reading it into a sliding window structure. There are three variables involved: the length of the sliding structure (right now set to 30), the current slidingStructureStartIndex and the current index. If the current directory entry falls within the range of the slidingStructureStartIndex and the sliding structure length, then it retains the information about that directory entry, otherwise it simply counts the record and moves on until the end of the directory is reached. When the user is viewing the directory a fourth variable called displayStartAt is used to determine what is the first record to show on the screen. displayStartAt is managed such that it is always within the bounds of the sliding window. CBM-Command can display 19 records at a time, so this leaves a buffer around the top and bottom of the visible list so that the user can scroll up and down a bit before having to retrieve data from the disk drive, which can be very slow (worst case scenario is a 1541 with lots of files and no fast load cart/rom). So, at the end of the day, regardless of the size of the drive we are only holding directory entries for up to 30 records. There is an index structure which has 9 bytes (pointer to a string for the name, unsigned int size, unsigned char type, unsigned int index and pointer to the next node) of data for each directory entry regardless of whether it is in the sliding window, but this is unavoidable as far as I can tell. I don't actually store the cbm_dirent structs as the names are hard coded to 17 bytes and thus there's a lot of waste in the typical directory. If someone has a good idea on how to get rid of the linked list for the index, I'm all ears. I've already reduced the size for a node entry from constant 27 to a minimum 9 bytes and just don't see a way to make it any smaller. ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Thu May 6 14:25:24 2010
This archive was generated by hypermail 2.1.8 : 2010-05-06 14:25:26 CEST