Mercurial > hg > Members > kono > os9 > sbc09
diff io.c @ 18:e3b08716aa53
fix mmu
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 09 Jul 2018 00:40:05 +0900 |
parents | 2aebc6b17fbf |
children | 84b28178c82f |
line wrap: on
line diff
--- a/io.c Sun Jul 08 16:15:34 2018 +0900 +++ b/io.c Mon Jul 09 00:40:05 2018 +0900 @@ -49,7 +49,7 @@ * IOPAGE ~ IOPAGE+0x7f * for OS9 level2 * IOPAGE 0xff80 means ioport beging 0xff80 but IOPAGE itself starts 0xff00 - * 0xff00-0xff7f, 0xffe0-0xffff can be used as ROM in fixed area + * 0xfe00-0xff7f, 0xffe0-0xffff can be used as ROM in fixed area * * IOPAGE + 0x00 ACIA control * IOPAGE + 0x01 ACIA data @@ -187,13 +187,13 @@ int do_input(int a) { static int c, f = EOF; - if (a == 0+(IOPAGE&0xff)) { + if (a == 0+(IOPAGE&0x1ff)) { if (f == EOF) f = char_input(); if (f != EOF) c = f; return 2 + (f != EOF); - } else if (a == 1+(IOPAGE&0xff)) { /*data port*/ + } else if (a == 1+(IOPAGE&0x1ff)) { /*data port*/ if (f == EOF) f = char_input(); if (f != EOF) { @@ -202,12 +202,12 @@ } return c; } - return mem[(IOPAGE&0xff00) + a]; + return mem[(IOPAGE&0xfe00) + a]; } void do_output(int a, int c) { int i, sum; - if (a == 1+(IOPAGE&0xff)) { /* ACIA data port,ignore address */ + if (a == 1+(IOPAGE&0x1ff)) { /* ACIA data port,ignore address */ if (!xmstat) { if (logfile && c != 127 && (c >= ' ' || c == '\n')) putc(c, logfile); @@ -253,11 +253,11 @@ xidx = 0; } } - } else if (a >= 0x40+(IOPAGE&0xff)) { /* disk */ + } else if (a >= 0x40+(IOPAGE&0x1ff)) { /* disk */ do_disk(a,c); - } else if (a >= 0x30+(IOPAGE&0xff)) { /* timer */ + } else if (a >= 0x30+(IOPAGE&0x1ff)) { /* timer */ do_timer(a,c); - } else if (a >= 0x10+(IOPAGE&0xff)) { /* mmu */ + } else if (a >= 0x10+(IOPAGE&0x1ff)) { /* mmu */ do_mmu(a,c); } } @@ -275,17 +275,17 @@ void do_timer(int a, int c) { struct itimerval timercontrol; - if (a==0x30+(IOPAGE&0xff) && c==0x8f) { + if (a==0x30+(IOPAGE&0x1ff) && c==0x8f) { timercontrol.it_interval.tv_sec = 0; timercontrol.it_interval.tv_usec = 20000; timercontrol.it_value.tv_sec = 0; timercontrol.it_value.tv_usec = 20000; setitimer(ITIMER_REAL, &timercontrol, NULL); - } else if (a==0x30+(IOPAGE&0xff) && c==0x80) { + } 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); - } else if (a==0x30+(IOPAGE&0xff) && c==0x04) { + } else if (a==0x30+(IOPAGE&0x1ff) && c==0x04) { time_t tm = time(0); struct tm *t = localtime(&tm); mem[IOPAGE+0x31] = t->tm_year; @@ -295,13 +295,13 @@ mem[IOPAGE+0x35] = t->tm_min; mem[IOPAGE+0x36] = t->tm_sec; } else { - mem[(IOPAGE&0xff00)+a]=c; + mem[(IOPAGE&0xfe00)+a]=c; } } void do_disk(int a, int c) { - if (a!=0x40+(IOPAGE&0xff)) { - mem[(IOPAGE&0xff00)+a]=c; + if (a!=0x40+(IOPAGE&0x1ff)) { + mem[(IOPAGE&0xfe00)+a]=c; return; } int drv = mem[IOPAGE+0x41]; @@ -325,14 +325,14 @@ { #ifdef USE_MMU - if (a==0x11+(IOPAGE&0xff)) { + if (a==0x11+(IOPAGE&0x1ff)) { if (c&1) { mmu = phymem+memsize-0x10000+0xffa8; } else { mmu = phymem+memsize-0x10000+0xffa0; } } - mem[(IOPAGE&0xff00)+a] = c; // other register such as 0xffa0-0xffaf + mem[(IOPAGE&0xfe00)+a] = c; // other register such as 0xffa0-0xffaf #endif }