[Coco] Howto for Altera DE1?

Steven Hirsch snhirsch at gmail.com
Mon Jul 5 09:21:36 EDT 2010


On Sun, 4 Jul 2010, Aaron Wolfe wrote:

> On Sun, Jul 4, 2010 at 4:32 PM, Lothan <lothan at newsguy.com> wrote:
>> Wouldn't it be better to use a dynamically-sized array or perhaps
>> List<DWDiskSector> than allocating the maximum theoretical disk size for
>> each image? If you use an array, you'll have to calculate the size of the
>> array prior to allocation. If you use a List<DWDiskSector>, the array can be
>> allocated on the fly as you add items to the list.
>>
>
> It's been a while...  IIRC the reason I didn't use a dynamic sized
> type is that the CoCo can request or write to any sector at any time,
> and there didn't seem to be any elegant way to do sparse arrays...
> maybe a hash on sector number would work.  There may be other reasons
> that I'm not remembering, of course a List would be much nicer so I'm
> hoping I had a good reason not to use it :)  I will revisit this
> entire section at some point.

Why not an array of references to (lazily) heap-allocated sector buffers? 
If the sector is never accessed you only waste one pointer per image 
sector.  Worst case, you'll be slightly worse off than the current 
architecture.

I understand the point in your earlier note about remote images, but 
hopefully these would tend to be small and could continue to be read in 
their entirety up front.

Steve


-- 




More information about the Coco mailing list