changeset 55:8d151f303bee

FIRQ does not worked
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 23 Jul 2018 08:35:25 +0900
parents fc10b7ae23d0
children 4fa2bdb0c457
files io.c os9/level2/clock.asm v09.c v09.h
diffstat 4 files changed, 28 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/io.c	Sun Jul 22 19:41:06 2018 +0900
+++ b/io.c	Mon Jul 23 08:35:25 2018 +0900
@@ -91,6 +91,7 @@
 
 
 int timer = 1;
+int timer_usec = 20000;   //  50Hz
 struct termios termsetting;
 struct termios newterm;
 struct itimerval timercontrol;
@@ -297,9 +298,9 @@
    struct itimerval timercontrol;
    if (a==0x30+(IOPAGE&0x1ff) && c==0x8f) {
         timercontrol.it_interval.tv_sec = 0;
-        timercontrol.it_interval.tv_usec = 20000;
+        timercontrol.it_interval.tv_usec = timer_usec;
         timercontrol.it_value.tv_sec = 0;
-        timercontrol.it_value.tv_usec = 20000;
+        timercontrol.it_value.tv_usec = timer_usec;
         timer_irq = 1;
         setitimer(ITIMER_REAL, &timercontrol, NULL);
         mem[(IOPAGE&0xfe00)+a]=c;
@@ -369,11 +370,7 @@
 
 void timehandler(int sig) {
         attention = 1;
-#ifdef USE_MMU
-        irq = 1;
-#else
-        irq = 2;
-#endif
+        irq = timerirq;
         mem[IOPAGE+0x30] |= 0x10  ;
         // signal(SIGALRM, timehandler);
 }
@@ -405,9 +402,9 @@
         fcntl(0, F_SETFL, tflags | O_NDELAY); /* Make input from stdin non-blocking */
         signal(SIGALRM, timehandler);
         timercontrol.it_interval.tv_sec = 0;
-        timercontrol.it_interval.tv_usec = 2000000;
+        timercontrol.it_interval.tv_usec = timer_usec;
         timercontrol.it_value.tv_sec = 0;
-        timercontrol.it_value.tv_usec = 2000000;
+        timercontrol.it_value.tv_usec = timer_usec;
         if (timer)
             setitimer(ITIMER_REAL, &timercontrol, NULL);
 }
--- a/os9/level2/clock.asm	Sun Jul 22 19:41:06 2018 +0900
+++ b/os9/level2/clock.asm	Mon Jul 23 08:35:25 2018 +0900
@@ -18,6 +18,8 @@
          use   defsfile
          endc
 
+usefirq  equ 0
+
 tylg     set   Systm+Objct
 atrv     set   ReEnt+rev
 rev      set   $01
@@ -38,7 +40,18 @@
          fcb   $80
 
 
-ClockIRQ ldx   #TimerPort
+       ifeq  usefirq-1
+ClockFIRQ 
+         leas  -1,s
+         pshs  d,dp,x,y
+         lda   8,s
+         ora   #$80       Entire flag
+         pshs  a
+         stu   8,s
+         jmp   [$FFF8]
+       endc
+ClockIRQ 
+         ldx   #TimerPort
          lda   ,x
          bita  #$10
          beq   L00AE
@@ -64,6 +77,10 @@
          orcc  #FIRQMask+IRQMask       mask ints
          leax  >ClockIRQ,pcr
          stx   <D.IRQ
+       ifeq usefirq-1
+         leax  >ClockFIRQ,pcr
+         stx   $FFF6     must be a RAM
+       endc
 * install system calls
          leay  >SysTbl,pcr
          os9   F$SSvc
--- a/v09.c	Sun Jul 22 19:41:06 2018 +0900
+++ b/v09.c	Mon Jul 23 08:35:25 2018 +0900
@@ -144,6 +144,7 @@
  char *imagename=0;
  int i;
  int setterm = 1;
+ timerirq = 2;   // use FIRQ default
  memsize = 512*1024;
  escchar='\x1d'; 
  tracelo=0;tracehi=0xffff;
@@ -157,7 +158,8 @@
      tracing=1;attention=1;    
    } else if (strcmp(argv[i],"-rom")==0) {
      i++;
-     timer = 0;  // non standard rom image, don't start timer
+     timer = 0;         // non standard rom image, don't start timer
+     timerirq = 1 ;     // os9 cannot handle FIRQ
      romfile = argv[i];
 
    } else if (strcmp(argv[i],"-0")==0) {
--- a/v09.h	Sun Jul 22 19:41:06 2018 +0900
+++ b/v09.h	Mon Jul 23 08:35:25 2018 +0900
@@ -36,6 +36,7 @@
 #endif
 
 engine volatile int tracing,attention,escape,irq;
+engine int timerirq;
 engine Word tracehi,tracelo;
 engine char escchar;
 engine int timer;