Close

Virtual memory?

A project log for PZ1 6502 laptop

I am building a laptop with a W65C02, lots of memory, SID-sound, decent graphics and a filesystem.

adamklotblixtadam.klotblixt 07/22/2020 at 09:170 Comments

The memory allocator works the way I want it now. Here's an example with all commands run in basic.

REM load 4 threads via serial port
tload1
tload1
tload1
tload1
REM print info about the threads
Thread nr     Slot time     Blocks
 0             20            1 2 3 4 5 6 7 8
 1             10            9
 2             10            10
 3             10            11
 4             10            12
REM kill 2 threads
tkill1
tkill3
REM load a 64KiB thread
tload8
REM raise slot time for thread 0, ehBasic
tslotw0,80
REM print info about the threads
Thread nr     Slot time     Blocks
 0             80            1 2 3 4 5 6 7 8
 2             10            10
 4             10            12
 5             10            9 11 13 14 15 16 17 18

Killing thread 1 & 3 creates holes in the block-pool. Thread 5 gets non-consecutive blocks allocated, but it does not matter because the memory is run in the linear 64KiB CPU-space. Banked memory can be good to get rid of memory fragmentation problems.
In other words, I've got (simple) virtual memory management in place :)

Discussions