2010-02-19

2010-02-19 - Streams and Lists

Ok, a few more ideas.  The library loader should, could and would (will) be easily adaptable to load executables.  They would be loaded into memory in exactly the same way, except instead of being linked into the library list, we just need to identify an entry point (main?), call it, then free the memory afterwards.  Perhaps some investigation of an executable COFF (like how to make one with DJGPP) would be good.

Started to lay down some code for the stream.  I've planned a small number of functions from the standard C library that should allow me to re-implement some of the buffers (such as the keyboard scancode, command, and video output buffers) using C standard.  This should also allow the stdin, stdout and stderr streams to be passable into files which can then use them as required.

Lists have been made doubly-linked, so that items can be added to the end.  They have also gained the ability to allocate "containers" to reduce memory allocations.  Each list will contain a linked list of containers within it, and each container holds a header and a number of list entries.  The list entries themselves are still doubly linked.  Currently, each container holds 18 entries (so the total size comes in just under 256 bytes) and so that will be 18 times fewer allocations for list entries.

Time spent this evening debugging the list improvements which were programmed blind.  The NextIndex wasn't being updated, and I wasn't setting the ListHead pointer in the add if it was the first element.  Should implement Remove as well.  The interrupt handler would benefit from this technology.

I should create a filesystem driver for Amiga OFS, and device drivers for the floppy drive.  However, both of these should be delayed until I have the Dos abstraction layer in place and have settled on the basic block device and filesystem driver entry points and structures.

Ok, so I was looking at the newly working doubly linked list and decided that a bubble sort algorithm (for functionality, not efficiency) would be beneficial.  A little while later, the system reminded me that I had improved the interrupt handler with a display of the registers at the time of the interrupt ... of course this meant the sort code was not 100% functional.

Success!  The bubble sort on the doubly linked list is complete.  A minor speed increase was gained by changing the sort so that it swapped only the values on the elements instead of the elements themselves.  Now back to the streams.

No comments:

Post a Comment