do a little test to see if memory mapping works

This code creates a shared mapping in high ram, makes sure that that
works, and also makes sure that the memory which is mapped over is left
unchanged.
This commit is contained in:
Byron Lathi
2022-04-07 12:43:47 -05:00
parent 2f79a00000
commit 0752cc4b8c

View File

@@ -22,6 +22,30 @@ int main() {
cprintf("Enabling Mapper\n");
mapper_enable(1);
cprintf("Writing 0xcccc to 0x4000\n");
*(unsigned int*)(0x4000) = 0xcccc;
cprintf("Writing 0xdddd to 0x5000\n");
*(unsigned int*)(0x5000) = 0xdddd;
cprintf("Mapping %1xxxx to %2xxxx\n", 4, 16);
mapper_write(16, 4);
cprintf("Mapping %1xxxx to %2xxxx\n", 5, 16);
mapper_write(16, 5);
cprintf("Writing 0xa5a5 to 0x4000\n");
*(unsigned int*)(0x4000) = 0xa5a5;
cprintf("Reading from 0x5000: %x\n", *(unsigned int*)(0x5000));
cprintf("Resetting map\n");
mapper_write(4, 4);
mapper_write(5, 5);
cprintf("Reading from 0x4000: %x\n", *(unsigned int*)(0x4000));
cprintf("Reading from 0x5000: %x\n", *(unsigned int*)(0x5000));
while (1) {
sw = sw_read();