Mercurial > hg > Members > kono > os9 > sbc09
diff os9/makerom.c @ 6:9c2602e1d716
level2 rom done
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 05 Jul 2018 00:02:54 +0900 |
parents | 3c736a81b886 |
children | a6db579d8c11 |
line wrap: on
line diff
--- a/os9/makerom.c Wed Jul 04 21:30:24 2018 +0900 +++ b/os9/makerom.c Thu Jul 05 00:02:54 2018 +0900 @@ -7,8 +7,9 @@ #include <strings.h> #include <sys/stat.h> -#define IOBASE 0xe000 -#define IOSIZE 0x100 +int IOBASE = 0xe000; +int IOSIZE = 0x100; +char * outfile ; typedef struct os9module { int size; @@ -85,7 +86,19 @@ root.mod = 0; m = &root; - for(int i = 2 ; i<ac ; i++ ) { + for(int i = 1 ; i<ac ; i++ ) { + if (*av[i]=='-') { + if (av[i][1] =='i') { + IOBASE = strtol(av[i],(char**)0,0); + i += 1; + } else if (av[i][1] =='o') { + outfile = av[i+1]; + i += 1; + } else { + return 1; + } + continue; + } struct os9module *cur; cur = readOS9module(av[i]); m->next = cur; @@ -94,8 +107,9 @@ FILE *romfile; unsigned pos; + if (outfile==0) return 1; - romfile=fopen(av[1],"wb"); + romfile=fopen(outfile,"wb"); if(!romfile) { fprintf(stderr,"Cannot create file %s\n",av[1]); exit(1); @@ -108,7 +122,8 @@ pos = start; for(struct os9module *cur = root.next; cur ; cur = cur->next ) { - if ( cur->size && (cur->name[0]=='O' && cur->name[1]=='S' && cur->name[2]== -71)) { + // last module have to os9p1 + if ( cur->next == 0 ) { // cur->size && (cur->name[0]=='O' && cur->name[1]=='S' && cur->name[2]== -71)) { for(; pos < 0xf800 ; pos++) { // os9p1 begins at 0xf800 fputc(0xff,romfile); }