Mercurial > hg > Members > kono > os9 > sbc09
diff io.c @ 34:2032755628dc
fix for nitros9
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 15 Jul 2018 14:18:19 +0900 |
parents | 7b1b25ff010a |
children | 01519215ec70 |
line wrap: on
line diff
--- a/io.c Sat Jul 14 15:22:54 2018 +0900 +++ b/io.c Sun Jul 15 14:18:19 2018 +0900 @@ -1,8 +1,7 @@ /* 6808 Simulator V092 - created 1993,1994 by L.C. Benschop. copyleft (c) 1994-2014 -by the sbc09 team, see AUTHORS for more details. license: -GNU General Public License version 2, see LICENSE for more -details. + created 1993,1994 by L.C. Benschop. copyleft (c) 1994-2014 +by the sbc09 team, see AUTHORS for more details. license: GNU +General Public License version 2, see LICENSE for more details. This program simulates a 6809 processor. @@ -49,7 +48,9 @@ * IOPAGE ~ IOPAGE+0x7f * for OS9 level2 * IOPAGE 0xff80 means ioport beging 0xff80 but IOPAGE itself starts 0xff00 - * 0xfe00-0xff7f, 0xffe0-0xffff can be used as ROM in fixed area + * 0xfe00-0xff7f, 0xffe0-0xffff can be used as RAM in fixed area in level2 + * and these are ROM in level1 + * * * IOPAGE + 0x00 ACIA control * IOPAGE + 0x01 ACIA data @@ -66,6 +67,7 @@ * tr=1 mmu=IOPAGE+0xa8 * * IOPAGE + 0x30 Timer control 0x8f start timer/0x80 stop timer/0x04 update date + * read 0x10 bit menas timer * IOPAGE + 0x31- YY/MM/DD/HH/MM/SS * * IOPAGE + 0x40 Disk control 0x81 read/0x55 write 0 ... ok / 0xff .. error @@ -94,6 +96,7 @@ int acknak; int rcvdnak; int blocknum; +int timer_irq = 2 ; // 2 = FIRQ, 1 = IRQ FILE *infile; FILE *xfile; @@ -194,15 +197,19 @@ if (a == 0+(IOPAGE&0x1ff)) { if (f == EOF) f = char_input(); - if (f != EOF) + if (f != EOF) { c = f; - return 2 + (f != EOF); + mem[(IOPAGE&0xfe00) + a] = c; + } + mem[(IOPAGE&0xfe00) + a] = c = 2 + (f != EOF); + return c; } else if (a == 1+(IOPAGE&0x1ff)) { /*data port*/ if (f == EOF) f = char_input(); if (f != EOF) { c = f; f = EOF; + mem[(IOPAGE&0xfe00) + a] = c; } return c; } @@ -274,11 +281,14 @@ timercontrol.it_interval.tv_usec = 20000; timercontrol.it_value.tv_sec = 0; timercontrol.it_value.tv_usec = 20000; + timer_irq = 1; setitimer(ITIMER_REAL, &timercontrol, NULL); + mem[(IOPAGE&0xfe00)+a]=c; } else if (a==0x30+(IOPAGE&0x1ff) && c==0x80) { timercontrol.it_interval.tv_sec = 0; timercontrol.it_interval.tv_usec = 0; setitimer(ITIMER_REAL, &timercontrol, NULL); + mem[(IOPAGE&0xfe00)+a]=c; } else if (a==0x30+(IOPAGE&0x1ff) && c==0x04) { time_t tm = time(0); struct tm *t = localtime(&tm); @@ -338,7 +348,8 @@ void timehandler(int sig) { attention = 1; irq = 2; - signal(SIGALRM, timehandler); + mem[(IOPAGE&0xfe00)+0x30] |= 0x10 ; + // signal(SIGALRM, timehandler); } void handler(int sig) {