[Coco] Howto for Altera DE1?
Aaron Wolfe
aawolfe at gmail.com
Sun Jul 4 16:46:32 EDT 2010
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.
I do appreciate the suggestions. There are a number of areas in the
DW4 server that are "less than awesome". In many cases one thing was
written quickly to support another that I simply found more
interesting and spent more time on. If you guys want to take a look
at the code and make improvements or even just offer ideas, great!
> --------------------------------------------------
> From: "Steven Hirsch" <snhirsch at gmail.com>
>
>> On Sun, 4 Jul 2010, Steven Hirsch wrote:
>>
>>> Ding! Here's the problem:
>>>
>>> ----------------------- cut here --------------
>>>
>>> public class DWDisk {
>>>
>>> ...
>>>
>>> public static final int MAX_SECTORS = 122880; // what is coco's max? 24
>>> bits?
>>>
>>> ....
>>>
>>> private DWDiskSector[] sectors = new DWDiskSector[MAX_SECTORS];
>>>
>>>
>>>
>>> ----------------------------------------------
>>>
>>> Looks like a hard-coded assumption about maximum sector offset. I'll try
>>> bumping that up and rebuilding.
>>
>> Ok, I had to increase that to 516096 to allow for a 128MB disk image.
>> With all of the disk buffers allocated on the heap, the process starts to
>> use a lot of memory.
>>
>> Is it possible to deal with memory-mapped files in Java? That might be a
>> more elegant way to do this than a literal heap-allocation.
>
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
>
More information about the Coco
mailing list