On Tue, Jun 29, 2004 at 03:46:20PM +0200, Versteeg, Benjamin wrote:
> Oops, 10 million is a bit wrong...
> Should be something as:
> 
> > LD DE,%aabbbbbbbbbbbbbb
> So, 14 bits for block selection = 16384 blocks
> 16384*16k = 262144k = 256 Mb :)
> 
> When all 16 bits are use, you have 1 Gb adressing, but have to use another
> byte to select the memory page.
> 
> Or you want to only use page b000-efff for swapping.
> 
> What ya think?

I don't know how each 16k segment will be used yet, and I don't know how
large each page will be.

Something that would be generally useful is a series of LDI instructions
in ROM.  Larger copies can be done from RAM using loops that jump to
this series of LDIs.  (The return address can be passed in HL'.)

If the offset within the memory mapped I/O space has no effect:

LD (%sp), SP
DI
LD SP, %source 
LD HL, %cfmmio
POP BC          ; 10 t-states
LD (HL), B      ;  7
LD (HL), C      ;  7
POP BC          ; 10
LD (HL), B      ;  7
LD (HL), C      ;  7
; ...
LD SP, (%sp)
EI

LDI takes 32 cycles per word, stack-copying uses more than 21, and this
"stack-read-copying" method uses 24.  It takes less space, too -- LDI
uses 4 bytes per word, but stack-read-copying uses 3.  Recovering from
interrupts during copying should be possible, and I'd really like this.

Using DJNZ, a loop of 4 or 8 of these in ROM should suffice.  You could
initialise the loop from RAM, since that part doesn't need to be as
fast.  A loop of 4 iterations would only occupy 13 bytes of ROM.

I've noticed that stack-copying can be used to write to the interface,
but the registers just need to be pushed in the same order that you
popped them in (I.e. the opposite order to ordinary stack-copying).
Again, recovering from interrupts during copying should be possible.

Stack-copying could be used for reading from the disk, but I don't think
that interrupts can be handled without corrupting the data.  You'd need
a read-only mode, really.  For writing, "stack-read-copying" may work,
although care is needed when repairing the damage.

Checksum, error correction and compression code seem like good ways to
use any spare ROM space, as well as sorts and searches, and manipulation
of trees, lists and hash tables.  How much space is there?
-- 
Stuart Brady

Reply via email to