carts: add a lookup for slot/cartridge
authorAlan Cox <alan@linux.intel.com>
Sun, 7 Jun 2015 09:23:15 +0000 (10:23 +0100)
committerAlan Cox <alan@linux.intel.com>
Sun, 7 Jun 2015 09:23:15 +0000 (10:23 +0100)
Hopefully we can eventually sort of autodetect floppy type etc

Kernel/platform-dragon-nx32/carts.h [new file with mode: 0644]
Kernel/platform-dragon-nx32/main.c

diff --git a/Kernel/platform-dragon-nx32/carts.h b/Kernel/platform-dragon-nx32/carts.h
new file mode 100644 (file)
index 0000000..3e3f401
--- /dev/null
@@ -0,0 +1,6 @@
+#define CART_DRAGONDOS 1               /* DragonDOS floppy */
+#define CART_DELTADOS  2               /* DeltaDOS floppy */
+#define CART_RSDOS     3               /* RSDOS Cartridge */
+#define CART_ORCH90    4               /* Orchestra Sound */
+
+extern int cart_find(int id);
index 7fdb531..6ed6de1 100644 (file)
@@ -4,6 +4,7 @@
 #include <printf.h>
 #include <device.h>
 #include <devtty.h>
+#include <carts.h>
 
 uint8_t membanks;
 uint8_t system_id;
@@ -51,13 +52,25 @@ struct cart_rom_id {
 static const char empty[] = "(empty)";
 
 struct cart_rom_id carts[] = {
-       { 0x72B0, 1, "DragonDOS" },
-       { 0x9063, 3, "DeltaDOS" },
+       { 0x72B0, CART_DRAGONDOS, "DragonDOS" },
+       { 0x9063, CART_DELTADOS, "DeltaDOS" },
        { 0xB400, 0, empty },
-       { 0xC248, 2, "RS-DOS" },
+       { 0xC248, CART_RSDOS, "RS-DOS" },
+       { 0xE1BA, CART_ORCH90, "Orchestra-90 CC" },
        { 0x0000, 0, "No ROM" }
 };
 
+/* Find a cartridge or it's slot */
+int cart_find(int id)
+{
+       int i;
+       for (i = 0; i < id; i++) {
+               if (carttype[i] == id)
+                       return i;
+       }
+       return -1;
+}
+
 static struct cart_rom_id *cart_lookup(uint16_t hash)
 {
        struct cart_rom_id *cart = carts;