Mercurial > hg > Members > kono > os9 > sbc09
diff os9/makerom.c @ 34:2032755628dc
fix for nitros9
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 15 Jul 2018 14:18:19 +0900 |
parents | 7c5379eb406e |
children |
line wrap: on
line diff
--- a/os9/makerom.c Sat Jul 14 15:22:54 2018 +0900 +++ b/os9/makerom.c Sun Jul 15 14:18:19 2018 +0900 @@ -47,6 +47,7 @@ typedef struct os9module { int size; + int entry; int location; int ioflag; unsigned char *mod; @@ -74,6 +75,7 @@ m->mod = (unsigned char*)m + sizeof(struct os9module); fread(m->mod , size, 1, fp); m->name = (char*) (m->mod + (m->mod[4]*256 + m->mod[5]) ); + m->entry = m->mod[9]*256 + m->mod[10] ; fclose(fp); return m; } @@ -87,11 +89,15 @@ void printOs9Str(char *p) { + char *q = p; while((*p & 0x80)==0) { putchar(*p); p++; } putchar(*p & 0x7f); + while(p<q+8) { + putchar(' '); p++; + } } unsigned short @@ -248,7 +254,7 @@ printOs9Str(cur->name); cur->location = pos; fwrite(cur->mod, cur->size, 1, romfile); - printf(" \t: 0x%x - 0x%x size 0x%x\n",pos, pos + cur->size-1,cur->size); + printf(" \t: 0x%x - 0x%x size 0x%04x entry 0x%x\n",pos, pos + cur->size-1,cur->size,cur->entry+cur->location); #ifdef DEBUG printf(" \t: 0x%x \n",cur->location); printf(" \t: 0x%x - 0x%x : 0x%lx \n",pos, pos + cur->size, ftell(romfile)+start); @@ -273,8 +279,9 @@ if (vecofs==0) { printf("can't find vector\n"); } + static int perm[] = {0,1,5,4,2,3}; for(int i=0;i<6;i++) { - fputword(os9p1->location +vecofs+i*4,romfile); + fputword(os9p1->location +vecofs+perm[i]*4,romfile); } int entry_ofs = (m->mod[9]<<8) + m->mod[10]; fputword( os9p1->location + entry_ofs ,romfile); @@ -331,7 +338,7 @@ printf("mod "); printOs9Str(cur->name); fwrite(cur->mod, cur->size, 1, romfile); - printf(" \t: 0x%x - 0x%x size 0x%x\n",pos, pos + cur->size-1, cur->size); + printf(" \t: 0x%x - 0x%x size 0x%04x entry 0x%x\n",pos, pos + cur->size-1, cur->size, cur->entry+cur->location); #ifdef DEBUG printf(" \t: 0x%x \n",cur->location); printf(" \t: 0x%x - 0x%x : 0x%lx \n",pos, pos + cur->size, ftell(romfile)+start);