changeset 3:831ac057ea86

before mmu
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 04 Jul 2018 14:03:56 +0900
parents 31d96e2b364e
children 6159cc57d44e
files Makefile a09.c io.c os9/Makefile v09.c v09.h
diffstat 6 files changed, 47 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Mon Jul 02 21:39:55 2018 +0900
+++ b/Makefile	Wed Jul 04 14:03:56 2018 +0900
@@ -35,6 +35,9 @@
 v09: v09.o engine.o io.o os9disass.o
 	$(CC) -o v09 $(CFLAGS) v09.o engine.o io.o os9disass.o
 
+v09c: v09.c engine.c io.c os9disass.o
+	$(CC) -o v09c $(CFLAGS) $(V09FLAGS) -DIOBASE=0xff00 -DUSE_MMU=1 v09.c engine.c io.c os9disass.o
+
 v09.o: v09.c v09.h
 	$(CC) -c $(CFLAGS) $(V09FLAGS) v09.c
 
--- a/a09.c	Mon Jul 02 21:39:55 2018 +0900
+++ b/a09.c	Wed Jul 04 14:03:56 2018 +0900
@@ -178,6 +178,7 @@
                 };
 
 int symcounter=0;
+int os9 = 0;   // os9 flag
 
 /* Symbol categories.
    0 Constant value (from equ).
@@ -1091,6 +1092,7 @@
 void os9begin()
 {
  generating=1;
+ os9=1;   // contiguous code generation ( i.e. ignore org nor rmb )
  modStart = loccounter;
  reset_crc();
  putword(0x87cd);
@@ -1132,13 +1134,14 @@
 
  switch(co) {
  case 0:/* RMB */
+        //   in OS9 mode, this generates no data
+        //   loccounter will be reset after any code to the current code generation
         setlabel(lp);
         operand=scanexpr(0);
         if(unknown)error|=4;
         loccounter+=operand;
         if(generating&&pass==2) {
-           if(!outmode)for(i=0;i<operand;i++) {
-              crc = os9crc(0,crc);   
+           if(!outmode || os9 )for(i=0;i<operand;i++) {
               fputc(0,objfile);
            } else flushhex();  
         }   
@@ -1175,6 +1178,7 @@
         } while(*srcptr==',');
         break;
  case 8:/* FCC */
+        generating=1;
         setlabel(lp);
         skipspace();
         c=*srcptr++;
@@ -1183,8 +1187,8 @@
         if(*srcptr==c)srcptr++;
         break;
  case 9:/* FDB */
+        generating=1;
         setlabel(lp);
-        generating=1;
         do {
          if(*srcptr==',')srcptr++;
          skipspace();
@@ -1194,8 +1198,8 @@
         } while(*srcptr==',');
         break;
  case 23 :/* FCS */
+        generating=1;
         setlabel(lp);
-        generating=1;
         skipspace();
         int sep = *srcptr;
         if(sep=='\"' || sep=='/') {
@@ -1222,12 +1226,12 @@
         if(unknown)error|=4;
         if(operand<0)suppress=2;
         break;                
- case 28: /* IFNE */
+ case 30: /* IFEQ */
         operand=scanexpr(0);
         if(unknown)error|=4;
         if(operand==0)suppress=2;
         break;                
- case 30: /* IFEQ */
+ case 28: /* IFNE */
  case 10: /* IF */
         operand=scanexpr(0);
         if(unknown)error|=4;
@@ -1236,10 +1240,10 @@
  case 12: /* ORG */
          operand=scanexpr(0);
          if(unknown)error|=4;
-         if(generating&&pass==2) {
+         if(generating&&pass==2&&!outmode&&!os9) {
            for(i=0;i<(unsigned short)operand-loccounter;i++)
-                if(!outmode) { fputc(0,objfile); crc=os9crc(0,crc); } else flushhex();
-         }             
+                fputc(0,objfile); 
+         } else flushhex();
          loccounter=operand;
          hexaddr=loccounter;
          break;
@@ -1281,7 +1285,7 @@
         processfile(fname);
         codeptr=0;
         srcline[0]=0;
-        if (co==27) loccounter = locsave;
+        // if (co==27) loccounter = locsave;
         break; 
    case 24: /* MOD */     
         loccounter = 0;
@@ -1292,8 +1296,9 @@
         os9end();
         break; 
    case 32: /* OS9 */     
+        generating = 1;
         setlabel(lp);
-      putword(0x103f); // SWI2
+        putword(0x103f); // SWI2
         putbyte(scanexpr(0));
         break; 
    case 18: /* TTL */     
--- a/io.c	Mon Jul 02 21:39:55 2018 +0900
+++ b/io.c	Wed Jul 04 14:03:56 2018 +0900
@@ -44,23 +44,34 @@
 #include "v09.h"
 
 /*
- *      IO Map
+ *   IO Map ( can be overrupped by ROM )
+ *
+ *   IOPAGE ~ IOPAGE+0xff
  *
- *   0xe000 - 0xe100
+ *   IOPAGE + 0x00   ACIA  control
+ *   IOPAGE + 0x01   ACIA  data
  *
- *   0xe000   ACIA  control
- *   0xe001   ACIA  data
+ *   IOPAGE + 0x10   Timer control       0x8f start timer/0x80 stop timer/0x04 update date
+ *   IOPAGE + 0x11-  YY/MM/DD/HH/MM/SS
  *
- *   0xe010   Timer control       0x8f start timer/0x80 stop timer/0x04 update date
- *   0xe011-  YY/MM/DD/HH/MM/SS
+ *   IOPAGE + 0x20   Disk control        0x81 read/0x55 write   0 ... ok / 0xff .. error
+ *   IOPAGE + 0x21   drive no
+ *   IOPAGE + 0x22   LSN2
+ *   IOPAGE + 0x23   LSN1
+ *   IOPAGE + 0x24   LSN0
+ *   IOPAGE + 0x25   ADR2
+ *   IOPAGE + 0x26   ADR1
  *
- *   0xe020   Disk control        0x81 read/0x55 write   0 ... ok / 0xff .. error
- *   0xe021   drive no
- *   0xe022   LSN2
- *   0xe023   LSN1
- *   0xe024   LSN0
- *   0xe025   ADR2
- *   0xe026   ADR1
+ *   IOPAGE + 0x91   MMU Taskreg         0  system map, 1 user map
+ *   IOPAGE + 0xa0-0xa7   MMU reg        system map
+ *   IOPAGE + 0xa8-0xaf   MMU reg        user   map
+ *
+ *        on reset tr==0 and only IOPAGE is valid
+ *        translatation occur only on non-IOPAGE
+ *        mem == phymem + 0x70000
+ *        phy addr = phymem[ ( mmu[ adr >> 13 ] <<13 ) + (adr & 0x1fff ) ]
+ *            tr=0  mmu=IOPAGE+0xa0
+ *            tr=1  mmu=IOPAGE+0xa8
  *
  */
 
@@ -180,12 +191,8 @@
                         f = EOF;
                 }
                 return c;
-        } else if ((a&0xf0) == 0x10) { /* timer */
-                return mem[IOPAGE + a];
-        } else if ((a&0xf0) == 0x20) { /* disk */
-                return mem[IOPAGE + a];
         }
-        return 0;
+        return mem[IOPAGE + a];
 }
 
 void do_output(int a, int c) {
--- a/os9/Makefile	Mon Jul 02 21:39:55 2018 +0900
+++ b/os9/Makefile	Wed Jul 04 14:03:56 2018 +0900
@@ -19,5 +19,5 @@
 	./makerom os9b.rom modules/Basic09 modules/Shell modules/init.b modules/mdir modules/SysGo modules/IOMan modules/SCF modules/pty-dd.b modules/pty.b modules/OS9p2 modules/OS9
 
 os9d.rom : makerom modules/init.b modules/pty.b
-	./makerom os9d.rom  modules/Shell modules/dir.b  modules/init.b modules/mdir modules/SysGo modules/IOMan modules/SCF modules/rbf.b modules/pty-dd.b modules/pty.b modules/pdisk.b modules/d0.b modules/d1.b modules/clock.b modules/OS9p2 modules/OS9
+	./makerom os9d.rom  modules/Shell modules/dir.b  modules/init.b modules/mdir modules/SysGo modules/IOMan modules/pty-dd.b modules/pty.b modules/pdisk.b modules/d0.b modules/d1.b modules/clock.b modules/SCF modules/rbf.b modules/OS9p2 modules/OS9
    
--- a/v09.c	Mon Jul 02 21:39:55 2018 +0900
+++ b/v09.c	Wed Jul 04 14:03:56 2018 +0900
@@ -98,7 +98,6 @@
 int
 main(int argc,char *argv[])
 {
- Word loadaddr=0x100;
  char *imagename=0;
  int i;
  int setterm = 1;
--- a/v09.h	Mon Jul 02 21:39:55 2018 +0900
+++ b/v09.h	Wed Jul 04 14:03:56 2018 +0900
@@ -31,7 +31,9 @@
 engine int timer;
 engine FILE *tracefile;
 
+#ifndef IOPAGE
 #define IOPAGE 0xe000
+#endif 
 
 void interpr(void);
 void do_exit(void);