changeset 111:c4e909f21b25

micro c,j self compiled on os9 level2
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 31 Dec 2018 17:51:27 +0900
parents 098b3feab38c
children 348d062ee8de
files os9/mc09/crtos9.asm os9/mc09/makefile os9/mc09/mc.c os9/mc09/mc2.c os9/mc09/mclibos9.c
diffstat 5 files changed, 27 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/os9/mc09/crtos9.asm	Mon Dec 31 15:57:24 2018 +0900
+++ b/os9/mc09/crtos9.asm	Mon Dec 31 17:51:27 2018 +0900
@@ -1,6 +1,6 @@
 
 * * micro-C driver under FLEX * * 12-Dec-81 M.Ohta,H.Tezuka
-* 12-Dec-2018 S.Kono * 
+* 12-Dec-2018 for OS-9 S.Kono * 
 
 *
 * micro-C user program
@@ -46,9 +46,19 @@
         bra     __0C004
 __0C005
 *       y is heap upper bound
+* copy arg string
+        ldx     4,s
+__0C007 tst     ,x+
+        bne     __0C007
+        clr     ,-y
+__0C008 lda     ,-x
+        sta     ,-y
+        cmpx    4,s
+        bne     __0C008
+        sty     4,s
+        leax    ,y
 *  copy saved arg into new stack
 *  and change the stack
-        leax    ,y
         ldy     2,s
         ldd     4,s
         std     ,--x
--- a/os9/mc09/makefile	Mon Dec 31 15:57:24 2018 +0900
+++ b/os9/mc09/makefile	Mon Dec 31 17:51:27 2018 +0900
@@ -3,7 +3,7 @@
 
 MCUTILS=uf.c
 
-DESTDIR=/usr/local/bin
+DESTDIR=../level2
 
 # CFLAGS = -m32 -O0 -g -Wno-return-type -Wno-implicit-int -Wno-implicit-function-declaration -Wno-parentheses
 CFLAGS = -O0 -g -Wno-return-type -Wno-implicit-int -Wno-implicit-function-declaration -Wno-parentheses -Wno-format
@@ -16,8 +16,8 @@
 	cc $(CFLAGS) mc.c -o mc
 
 mc2:	mc mc2.c mclib.c
-	./mc -Mmc mc2.c
-	$(AS09) crtos9.asm -l c.lst -o mc2
+	./mc -s -Mmc mc2.c
+	$(AS09) crtos9.asm -l mc2.lst -o mc2
 
 # mc2.o:	c.out
 #	$(AS09) c.txt -l c.lst -o mc2.o 
@@ -42,5 +42,6 @@
 clean:
 	rm -f mc c.out mc2.o lint testcp
 
-install: mc
-	cp mc $(DESTDIR)/mc
+install: mc2
+	cp mc2 $(DESTDIR)/cmds
+	cp crtos9.asm mclibos9.c test/cp.c $(DESTDIR)/
--- a/os9/mc09/mc.c	Mon Dec 31 15:57:24 2018 +0900
+++ b/os9/mc09/mc.c	Mon Dec 31 17:51:27 2018 +0900
@@ -224,7 +224,7 @@
 		if ( (obuf = fopen(ccout,"w")) == NULL ) error(FILERR);
                 else {
                     /* we'l resize data area later */
-                    printf("\tmod   _eom,_name,_tylg,_atrv,_start,16384\n");    /* os9 module header */
+                    printf("\tmod   _eom,_name,_tylg,_atrv,_start,1024\n");    /* os9 module header */
                     printf("_name      fcs   /%s/\n\tfcb 0\n",modname);
                 }
         }
--- a/os9/mc09/mc2.c	Mon Dec 31 15:57:24 2018 +0900
+++ b/os9/mc09/mc2.c	Mon Dec 31 17:51:27 2018 +0900
@@ -145,7 +145,7 @@
 #define GSYMS	450
 #define LSYMS	50
 
-#define HEAPSIZE	700
+#define HEAPSIZE	1000
 #define CHEAPSIZE	3000
 #define LBUFSIZE	256
 
@@ -205,7 +205,7 @@
         if (!chk) {
               if ( (obuf = fopen(ccout,"w")) == NULL ) error(FILERR);
                 else {
-                     printf("\tmod   _eom,_name,_tylg,_atrv,_start,_GLOBALS\n");    /* os9 module header */
+                     printf("\tmod   _eom,_name,_tylg,_atrv,_start,1024\n");    /* os9 module header */
                      printf("_name      fcs   /%s/\n\tfcb 0\n",modname);
                 }
         }
--- a/os9/mc09/mclibos9.c	Mon Dec 31 15:57:24 2018 +0900
+++ b/os9/mc09/mclibos9.c	Mon Dec 31 17:51:27 2018 +0900
@@ -1,6 +1,4 @@
-/*
- *  os9  driver
- */
+/* os9 driver  */ 
 
 
 int errno  = 0;
@@ -50,13 +48,13 @@
         argc = 0;
         argv = 0;
         for( i = 0; i < 2 ; i++ ) {
+            q = p = args;
             if (i==1) { 
                 argv = (char**)malloc(sizeof(char*)*(argc+1)); 
                 argv[0] = prog; 
             }
             n = 1;
             quote = 0;
-            q = p = args;
             if (i==1) argv[n] = args;
             while((c = *p) && c!='\r') {
                 if (c=='\'') { 
@@ -98,9 +96,9 @@
 		case 'r':
 			rd = 1; cm |= 1; break;
 		case 'w':
-			wt = 1; cm |= 2; break;
-		case 'c':
-			cm = 2; break;
+			wt = 1; cm |= 3; break;
+		case 'c':     /* charcter mode */
+			cm = 1; break;
 		default:
 			return NULL;
 		}
@@ -162,6 +160,7 @@
         pshs      x,y,u
         ldx       -2,u
         lda       7,u          mode
+        ldb       #3
         ldx       6,x          name
         os9       I$Create
         bcs        _LC0003