testpico: show that vres clear is separate
[megadrive.git] / testpico / sh2_main.c
index 6fe8ad7..303fe3f 100644 (file)
@@ -3,6 +3,15 @@
 void spin(int loops);
 u16  read_frt(void);
 
+// comm area map:
+// 00-01: cmd
+// 02-03: error
+// 04-07: arg0/response
+// 08-0b: arg1
+// 0c: last_irq_vec_master
+// 0d: last_irq_vec_slave
+// 0e: exception_index_master
+// 0f: exception_index_slave
 static void do_cmd(u16 cmd, u16 r[6], u32 is_slave)
 {
     u32 *rl = (u32 *)r;
@@ -50,13 +59,21 @@ static void do_cmd(u16 cmd, u16 r[6], u32 is_slave)
         write32(a, d);
         break;
     case CMD_GETGBR:
-        asm("stc gbr, %0" : "=r"(d));
+        asm volatile("stc gbr, %0" : "=r"(d));
         write32(&rl[4/4], d);
         break;
     case CMD_GETVBR:
-        asm("stc vbr, %0" : "=r"(d));
+        asm volatile("stc vbr, %0" : "=r"(d));
         write32(&rl[4/4], d);
         break;
+    case CMD_GETSR:
+        asm volatile("stc sr, %0" : "=r"(d));
+        write32(&rl[4/4], d);
+        break;
+    case CMD_SETSR:
+        d = read32(&rl[4/4]);
+        asm volatile("ldc %0, sr" :: "r"(d));
+        break;
     default:
         r[2/2]++; // error
         mem_barrier();