changeset 102:09148bb27659

fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 27 Dec 2018 16:03:36 +0900
parents 15569aa4098e
children 844305752064
files os9/mc09/crtos9.asm os9/mc09/makefile os9/mc09/mc2.c os9/mc09/mclibos9.c
diffstat 4 files changed, 22 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/os9/mc09/crtos9.asm	Thu Dec 27 15:40:50 2018 +0900
+++ b/os9/mc09/crtos9.asm	Thu Dec 27 16:03:36 2018 +0900
@@ -21,7 +21,7 @@
         leay    ,u 
 	pshs	d,x              POINT TO CONTENT OF ARGUMENT VECTOR
 	PSHS	Y
-                         	clear globals on Y
+*                         	clear globals on Y
 	LDX	#_GLOBALS
 _0C002	BEQ	_0C003
 	CLR	,Y+
--- a/os9/mc09/makefile	Thu Dec 27 15:40:50 2018 +0900
+++ b/os9/mc09/makefile	Thu Dec 27 16:03:36 2018 +0900
@@ -5,7 +5,7 @@
 
 DESTDIR=/usr/local/bin
 
-CFLAGS = -m32 -Wno-return-type -Wno-implicit-int -Wno-implicit-function-declaration -Wno-parentheses
+CFLAGS = -m32 -O0 -g -Wno-return-type -Wno-implicit-int -Wno-implicit-function-declaration -Wno-parentheses
 
 AS09 = ../../src/a09
 
--- a/os9/mc09/mc2.c	Thu Dec 27 15:40:50 2018 +0900
+++ b/os9/mc09/mc2.c	Thu Dec 27 16:03:36 2018 +0900
@@ -1,7 +1,7 @@
 
 #define DEBUG	error(-1)
 
-#include "mclib.c"
+#include "mclibos9.c"
 
 #define INT	(-1)
 #define CHAR	(-2)
@@ -176,10 +176,11 @@
 char **argv;
 {NMTBL *nptr;
 int i;
-char *ccout;
+char *ccout,*modname;
 	if(argc==1) exit(1);
 	lsrc = chk = asmf = 0;
 	ccout = "C.OUT";
+	modname = "aout";
 	ac=argc;
 	av=argv;
 	for (ac2=1; (ac2 < ac) && (*av[ac2] == '-'); ++ac2)
@@ -190,6 +191,9 @@
 		case 'O': case 'o':
 			ccout = av[ac2]+2;
 			break;
+                case 'M': case 'm':
+                       modname = av[ac2]+2;
+                       break;
 		case 'C': case 'c':
 			chk = 1;
 			break;
@@ -198,8 +202,13 @@
 			exit(1);
 		}
 	fclose(stdout);
-	if (!chk)
-		if ( (obuf = fopen(ccout,"wc")) == NULL ) error(FILERR);
+        if (!chk) {
+              if ( (obuf = fopen(ccout,"w")) == NULL ) error(FILERR);
+                else {
+                    printf("\tmod   _eom,_name,_tylg,_atrv,_main,_GLOBALS\n");    /* os9 module header */
+                    printf("_name      fcs   /%s/\n",modname);
+                }
+        }
 	init();
 	while(1)
 	{	for (nptr = &ntable[GSYMS],i=LSYMS; i--;)
--- a/os9/mc09/mclibos9.c	Thu Dec 27 15:40:50 2018 +0900
+++ b/os9/mc09/mclibos9.c	Thu Dec 27 16:03:36 2018 +0900
@@ -13,8 +13,8 @@
     int mode;                 /*  2 */
     int len;                  /*  4 */
     char *name;               /*  6 */
-    unsigned char*ptr;        /*  8 */
-    unsigned char buf[256];       /*  10 */
+    char *ptr;        /*  8 */
+    char buff[256];       /*  10 */
  } FILE ;
 
 #define	FCBSIZE	(sizeof(FILE))
@@ -52,7 +52,7 @@
         n = 0;
         quote = 0;
         for( i = 0; i < 2 ; i++ ) {
-            if (i==1 && argc) { argv = (char**)malloc(sizeof(char*)*argc; }
+            if (i==1 && argc) { argv = (char**)malloc(sizeof(char*)*argc); }
             p = args;
             while((c = *p++)) {
                 if (i==1) argv[n] = args;
@@ -134,8 +134,8 @@
 _LC0002
         puls      x,y,u
 #endasm
-	if fcbp->fd < 0 ) return NULL;
-	fcbp->ptr = fcpp->buf;
+	if (fcbp->fd < 0 ) return NULL;
+	fcbp->ptr = fcbp->buff;
 	fcbp->len = 0;
 	return (_fcbtbl[i] = fcbp);
 }
@@ -171,8 +171,8 @@
 _LC0002
         puls      x,y,u
 #endasm
-	if fcbp->fd < 0 ) return NULL;
-	fcbp->ptr = fcpp->buf;
+	if (fcbp->fd < 0 ) return NULL;
+	fcbp->ptr = fcbp->buff;
 	fcbp->len = 0;
 	return (_fcbtbl[i] = fcbp);
 }