]> git.sesse.net Git - pistorm/commitdiff
irq handling simplified
authorClaude <claude.schwarz@gmail.com>
Sat, 21 Nov 2020 12:09:20 +0000 (12:09 +0000)
committerClaude <claude.schwarz@gmail.com>
Sat, 21 Nov 2020 12:09:20 +0000 (12:09 +0000)
Gayle.c
emulator.c

diff --git a/Gayle.c b/Gayle.c
index 5a6c8bf1980bb8767ab764222e6e3eb4ad7e9a74..3bf5cd968c2563a7db91a65f4618bf6864f9abe2 100644 (file)
--- a/Gayle.c
+++ b/Gayle.c
@@ -111,11 +111,14 @@ void InitGayle(void){
 uint8_t CheckIrq(void){
 uint8_t irq;
 
+
+ if (gayle_int  & (1<<7)){ 
        irq = ide0->drive->intrq;
 //     if (irq==0)
-//     printf("IDE IRQ: 0\n");
-
-return irq;
+//     printf("IDE IRQ: %x\n",irq);
+        return irq;
+       };
+  return 0;
 }
 
 void writeGayleB(unsigned int address, unsigned int value){
@@ -164,6 +167,7 @@ void writeGayleB(unsigned int address, unsigned int value){
     if (address == GIRQ){
 //      printf("Write Byte to Gayle GIRQ 0x%06x (0x%06x)\n",address,value);
        gayle_irq = (gayle_irq & value) | (value & (GAYLE_IRQ_RESET | GAYLE_IRQ_BERR));
+       
        return;
        }
 
@@ -254,8 +258,17 @@ uint8_t readGayleB(unsigned int address){
 
      if (address == GIRQ){
 //     printf("Read Byte From GIRQ Space 0x%06x\n",gayle_irq);
+
+       uint8_t irq;
+        irq = ide0->drive->intrq;
+
+       if (irq == 1){
+       //printf("IDE IRQ: %x\n",irq);
        return 0x80;//gayle_irq;
-        }
+       }
+
+       return 0;
+     }
 
       if (address == GCS){
        printf("Read Byte From GCS Space 0x%06x\n",0x1234);
index 0a66a13fe51be3f66631c06a214dc15188f5d85f..cd9a7a27f5f949cd7d6fc82203fa3e5cf7eb8865 100644 (file)
@@ -52,7 +52,6 @@ do {                                  \
 
 
 #define FASTBASE 0x07FFFFFF
-//#define FASTSIZE 0xFFFFFF
 #define FASTSIZE 0xFFFFFFF
 #define GAYLEBASE 0xD80000 //D7FFFF
 #define GAYLESIZE 0x6FFFF
@@ -299,29 +298,41 @@ const struct sched_param priority = {99};
        toggle = 0;
 
 /*
-    pthread_t id;
-    int err;
-
+         pthread_t id;
+         int err;
         //err = pthread_create(&id, NULL, &iplThread, NULL);
         if (err != 0)
             printf("\ncan't create IPL thread :[%s]", strerror(err));
         else
             printf("\n IPL Thread created successfully\n");
 */
+
        m68k_pulse_reset();
        while(42) {
 
-               m68k_execute(50);
+               m68k_execute(6000);
                //usleep(1);
 
                //printf("IRQ:0x%06x\n",CheckIrq());
 
-               if (CheckIrq() == 1)
-                  m68k_set_irq(2);
-               else
-                  m68k_set_irq(0);
+
+               //if (CheckIrq() == 1)
+               //   m68k_set_irq(2);
+               //else
+               //   m68k_set_irq(0);
 
 
+
+
+               if (GET_GPIO(1) == 0){
+                srdata = read_reg();
+                m68k_set_irq((srdata >> 13)&0xff);
+               } else {
+                m68k_set_irq(0);
+               };
+
+/*
+
                if (GET_GPIO(1) == 0 || CheckIrq() == 1){
                  srdata = read_reg();
                //  if (CheckIrq() == 1) srdata |= (1 << 14);
@@ -343,6 +354,8 @@ const struct sched_param priority = {99};
                        toggle = 0;
                        }
                }
+*/
+
 
        }