From: Alan Cox Date: Thu, 4 Jun 2015 22:02:55 +0000 (+0100) Subject: dragon-nx32: report cartridge hashes and MPI (needs xroar fixes) X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=4a6aba04e187b045102b2de9deeb08fd02da25bb;p=FUZIX.git dragon-nx32: report cartridge hashes and MPI (needs xroar fixes) This is the start of an small experiment to see if we can autodetect some cartridges by spotting their ROMs. --- diff --git a/Kernel/platform-dragon-nx32/main.c b/Kernel/platform-dragon-nx32/main.c index 248cb5f4..cbeaf88c 100644 --- a/Kernel/platform-dragon-nx32/main.c +++ b/Kernel/platform-dragon-nx32/main.c @@ -2,10 +2,14 @@ #include #include #include +#include #include uint8_t membanks; uint8_t system_id; +uint8_t cartslots = 1; +uint16_t carthash[4]; +uint8_t bootslot = 0; void platform_idle(void) { @@ -15,6 +19,9 @@ void do_beep(void) { } + +/* ------------- Below bits can all move to discard if needed ------------ */ + /* * Map handling: We have flexible paging. Each map table consists of a set of pages * with the last page repeated to fill any holes. @@ -33,6 +40,24 @@ void pagemap_init(void) #endif } +static const char *sysname[] = {"Dragon", "COCO", "COCO3", "Unknown"}; + void map_init(void) { + uint8_t i; + + kprintf("%s system.\n", sysname[system_id]); + if (mpi_present()) { + kputs("MPI cartridge detected.\n"); + cartslots = 4; + bootslot = mpi_set_slot(0); + } + for (i = 0; i < cartslots; i++) { + mpi_set_slot((i << 4) | i); + carthash[i] = cart_hash(); + kprintf("%d: %x %c\n", + i, carthash[i], + i == bootslot ? '*':' '); + } + mpi_set_slot(bootslot); }