# HG changeset patch # User Shinji KONO # Date 1546092340 -32400 # Node ID c5dd5c363d434297686b7b07006456a14c6452b5 # Parent 6566b9f47f4aaed067ce3ecbb4d03d28c169dd99 mc.c in intel64 ( LP64 ) diff -r 6566b9f47f4a -r c5dd5c363d43 os9/mc09/defsfile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/mc09/defsfile Sat Dec 29 23:05:40 2018 +0900 @@ -0,0 +1,18 @@ +* Main defsfile for OS-9 Level One V1 +* +* +* OS-9 Level and Version equates +Level equ 1 +OS9Vrsn equ 1 +OS9Major equ 0 +OS9Minor equ 1 + +NOS9VER equ OS9Vrsn +NOS9MAJ equ OS9Major +NOS9MIN equ OS9Minor + + + use ../nitros9-code/defs/os9.d + use ../nitros9-code/defs/scf.d + use ../nitros9-code/defs/rbf.d + diff -r 6566b9f47f4a -r c5dd5c363d43 os9/mc09/makefile --- a/os9/mc09/makefile Sat Dec 29 18:29:06 2018 +0900 +++ b/os9/mc09/makefile Sat Dec 29 23:05:40 2018 +0900 @@ -5,7 +5,8 @@ DESTDIR=/usr/local/bin -CFLAGS = -m32 -O0 -g -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 +CFLAGS = -O0 -g -Wno-return-type -Wno-implicit-int -Wno-implicit-function-declaration -Wno-parentheses -Wno-format AS09 = ../../src/a09 diff -r 6566b9f47f4a -r c5dd5c363d43 os9/mc09/mc.c --- a/os9/mc09/mc.c Sat Dec 29 18:29:06 2018 +0900 +++ b/os9/mc09/mc.c Sat Dec 29 23:05:40 2018 +0900 @@ -159,7 +159,8 @@ int sym,ch,chsave,type,mode,gfree,lfree,mflag,lineno,glineno; int labelno,gpc,lvar,disp; -int symval,args,heap[HEAPSIZE]; +int symval,args; +long heap[HEAPSIZE]; int blabel,clabel,dlabel,cslabel,ilabel,control,ac,ac2,lsrc,chk,asmf; unsigned hash; @@ -171,12 +172,22 @@ typedef struct nametable { char nm[9]; - int sc,ty,dsp; } NMTBL; + int sc,ty; long dsp; } NMTBL; NMTBL ntable[GSYMS+LSYMS],*nptr,*gnptr,*decl0(),*decl1(),*lsearch(),*gsearch(); struct {int fd,ln;/*char fcb[320]*/FILE *fcb;} *filep,filestack[FILES]; +long car(); +long cadr(); +long caddr(); +long cadddr(); +void leaxpcr(NMTBL *n); +long error(); +list2(long e1,long e2); +list3(long e1,long e2,long e3); +list4(long e1,long e2,long e3,long e4); + main(argc,argv) int argc; char **argv; @@ -228,6 +239,7 @@ decl(); } } +long error(n) int n; { if(n == EOFERR) @@ -275,6 +287,7 @@ "Bug of compiler"); errmsg(); exit(1); + return 0; } errmsg() {char *p,*lim; @@ -1284,7 +1297,7 @@ getsym(); break; case FUNCTION: - e1=list2(FNAME,(int)nptr); + e1=list2(FNAME,(long)nptr); type=list2(FUNCTION,nptr->ty); getsym(); break; @@ -1293,14 +1306,14 @@ { nptr->sc = FUNCTION; nptr->ty= INT; type= list2(FUNCTION,INT); - e1=expr15(list2(FNAME,(int)nptr)); + e1=expr15(list2(FNAME,(long)nptr)); break; } default:error(UDERR); } break; case STRING: - e1=list3(STRING,(int)sptr,symval); + e1=list3(STRING,(long)sptr,symval); type=list3(ARRAY,CHAR,symval); getsym(); break; @@ -1677,7 +1690,7 @@ gexpr(e1) int e1; -{int e2,e3; +{long e2,e3; if (chk) return; e2 = cadr(e1); switch (car(e1)) @@ -1879,7 +1892,7 @@ } function(e1) int e1; -{int e2,e3,e4,e5,nargs; +{long e2,e3,e4,e5,nargs; NMTBL *n; e2 = cadr(e1); nargs = 0; @@ -2374,6 +2387,7 @@ int n; { printf("\tLEAX\t%d,U\n",n); } +void leaxpcr(n) NMTBL *n; { printf("\tLEAX\t%s,PCR\n",n->nm); @@ -2798,7 +2812,7 @@ if (getsym() == IDENT) { if (nptr->sc == EMPTY) { nptr->sc = MACRO; - nptr->dsp = (int)cheapp; + nptr->dsp = (long)cheapp; while ((*cheapp++ = c = *chptr++) && c != '\n'); *cheapp++ = '\0'; @@ -2851,24 +2865,28 @@ return 1; } +long car(e) int e; { return heap[e]; } +long cadr(e) int e; { return heap[e+1]; } +long caddr(e) int e; { return heap[e+2]; } +long cadddr(e) int e; { return heap[e+3]; } list2(e1,e2) -int e1,e2; +long e1,e2; {int e; e=getfree(2); heap[e]=e1; @@ -2876,7 +2894,7 @@ return e; } list3(e1,e2,e3) -int e1,e2,e3; +long e1,e2,e3; {int e; e=getfree(3); heap[e]=e1; @@ -2885,7 +2903,7 @@ return e; } list4(e1,e2,e3,e4) -int e1,e2,e3,e4; +long e1,e2,e3,e4; {int e; e=getfree(4); heap[e]=e1; @@ -2910,7 +2928,8 @@ return e; } rplacad(e,n) -int e,n; +int e; +long n; { heap[e+1]=n; return e; } diff -r 6566b9f47f4a -r c5dd5c363d43 os9/mc09/test/cp.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/mc09/test/cp.c Sat Dec 29 23:05:40 2018 +0900 @@ -0,0 +1,21 @@ +#include "mclibos9.c" + +int +main(argc,argv) +int argc;char *argv[]; { + FILE *input ; + FILE *output ; + int c; + int i; + + input = STDIN; + output = STDOUT; + + i = 1; + if (argv[i]) { input = fopen(argv[i++],"r"); } + if (argv[i]) { output = fopen(argv[i++],"w"); } + while( (c = getc(input) ) != -1) { + putc(c,output); + } + return 1; +}