I've had a few thoughts about this.
Ruud wrote:
Then I thought: When doing a copy within a system, a person normally will use a routine that looks like:
LDA (zp1),Y
STA (zp2),Y
INY
BNE ...
Having copied 256 bytes one needs to update the ZP-addresse to beable to copy the next part. But there is not much difference in updating a 2-bytes ZP-address or a 3-bytes register: one byte to be precise. Loss in time: less then 1%.
ROM is cheap.
So you could have dedicated routines that you swap in that copy to or
from specific blocks, ie a routine dedicated to moving data to a specific
block and a routine dedicated to moving data from a specific block.
And a to/from set for each combination of blocks. (though I'd expect
in practice you'd just map the expansion to a specific block and have all
the routines copy to or from that one)
Presumably you'd want to keep the data block aligned or something.
I suppose, in principle, you could have dedicated routines for
any possible move, but ROM's not that cheap
You might have different routines that copied from the bottom up and
the top down and jump into the middle to copy just part of a block.
Being dedicated routines, they could be optimized for speed (absolute
addressing, unrolled loops).
It would depend on exactly how it was done of course, but for blocks
bigger than, say, 8 bytes, I don't think the overhead would be all that
much. That is to say, I think you'd want to move at least 8 bytes
per block/move routine, but I don't think you'd save much in over head
by using 32 byte blocks instead of 16 byte blocks and of course the
smaller the block the smaller the routine in this scheme, and the smaller
the window you'd need to map the routines to.
Quote:
So IMHO using more free address space for this purpose is a waist. But if one wants to do it, that is OK for me.
Using memory that already is in use, is dangerous IMHO. Take my C64 as example. I could use $4000-$7FFF as swapping area. Now I have a program running that ask for some data to be transferred from the RAM-disk to, let's say $6000. Because I cannot directly store it at $6000, I need to reserve some memeory elsewhere in the system that serves as a buffer. But where can I find that ????
FYI: I know some programs that use ALL the RAM of my C64 and therefore I have nothing left to be used as buffer.
My statement: if one needs paging for accessing memory outside the normal 64 KB area, 256+x free bytes is enough [*].
I would like to hear if there is a flaw in this idea. Thank you!
[*] Remark: using the well know area $DE00-$DFFF means one can not insert cartridgea anymore. That's why I modified my system a bit by using the mirrored areas of the video- and soundchip.
If I read the C64 memory map correctly, you ought to be able to map to
anywhere in the address space except for IO and the bottom 4k using
ultimax mode.
My thought is to build a mapper using fast SRAM (junk cache chips)
If you mapped by 256 byte pages then 32k chips could hold 128 maps.
The idea would be to set up the maps and then do context switches by
switching amongst maps.
Unused pages in a map could contain a pattern that caused an IRQ