Mercurial > hg > Members > kono > os9 > sbc09
changeset 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 | 01519215ec70 |
files | a09.c d09.c io.c os9/level1/IOMan os9/level1/OS9p2 os9/level1/SCF os9/level1/Shell os9/level1/SysGo os9/level1/clock.asm os9/level1/d0 os9/level1/mdir os9/level2/Makefile os9/level2/defsfile os9/makerom.c |
diffstat | 14 files changed, 80 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/a09.c Sat Jul 14 15:22:54 2018 +0900 +++ b/a09.c Sun Jul 15 14:18:19 2018 +0900 @@ -213,9 +213,8 @@ }; int symcounter=0; -int os9 = 0; // os9 flag -int prevloc = 0; -int prevrmb = 0; +int os9 = 0; // os9 flag +int rmbmode = 0; // in os9 work area struct symrecord * prevlp = 0; /* expression categories... @@ -334,7 +333,7 @@ char relocatable; /* flag to indicate relocatable object. */ char terminate; /* flag to indicate termination. */ char generating; /* flag to indicate that we generate code */ -unsigned short loccounter,oldlc; /* Location counter */ +unsigned short loccounter,oldlc,prevloc,rmbcounter; /* Location counter */ char inpline[128]; /* Current input line (not expanded)*/ char srcline[128]; /* Current source line */ @@ -351,10 +350,10 @@ void generate() { generating = 1; - if (prevloc) { - prevrmb = loccounter+1; // we were in rmb mode - oldlc = loccounter = prevloc-1 ; - prevloc = 0; + if (rmbmode) { + rmbcounter = loccounter; + oldlc = loccounter = prevloc; + rmbmode = 0; } } @@ -489,8 +488,8 @@ if(isalpha(c))return scanlabel(); else if(isdigit(c))return scandecimal(); else switch(c) { - case '*' : srcptr++;exprcat|=2; if(prevloc) return prevloc-1; else return loccounter; - case '.' : srcptr++;exprcat|=2; if(prevrmb) return prevrmb-1; else return loccounter; + case '*' : srcptr++;exprcat|=2; if(rmbmode) return prevloc; else return loccounter; + case '.' : srcptr++;exprcat|=2; if(os9&&!rmbmode) return rmbcounter; else return loccounter; case '$' : return scanhex(); case '%' : return scanbin(); case '&' : /* compatibility */ @@ -1169,13 +1168,11 @@ } } -int modStart; - void os9begin() { generate(); os9=1; // contiguous code generation ( i.e. ignore org nor rmb ) - modStart = loccounter; + oldlc = loccounter = rmbcounter = rmbmode = 0; reset_crc(); putword(0x87cd); putword(scanexpr(0)-loccounter); // module size @@ -1194,6 +1191,9 @@ putword(scanexpr(0)); skipspace(); } + prevloc = codeptr; + rmbmode = 1; // next org works on rmb + loccounter = 0x10000-codeptr; // should start at 0 } void os9end() @@ -1218,9 +1218,10 @@ case 0:/* RMB */ // in OS9 mode, this generates no data // loccounter will be reset after any code to the current code generation - if (prevrmb) { - oldlc = loccounter = prevrmb-1 ; - prevrmb = 0; + if (os9 && !rmbmode) { + prevloc = loccounter; + oldlc = loccounter = rmbcounter; + rmbmode = 1; } setlabel(lp); operand=scanexpr(0); @@ -1463,10 +1464,6 @@ } if(error)report(); loccounter+=codeptr; - if (os9 && prevloc==0 ) { - prevloc = loccounter+1; - oldlc = loccounter = 0; - } } void
--- a/d09.c Sat Jul 14 15:22:54 2018 +0900 +++ b/d09.c Sun Jul 15 14:18:19 2018 +0900 @@ -1312,7 +1312,7 @@ break; case 0x0d : offset = prog[pc+2] * 256 + prog[pc+3]; - offset = ((offset>0x7fff?offset-0x8001 : offset )+pc+4) & 0xFFFF; + offset = ((offset>0x7fff? offset-0x10000 : offset )+pc+4) & 0xFFFF; s = ">"; fprintf(fp,"%0.2X %0.2X %0.2X %0.2X %s%s %s$%0.4X,PCR", code, postbyte, prog[pc+2], prog[pc+3], suffix, op->name, s, offset+adoffset);
--- a/io.c Sat Jul 14 15:22:54 2018 +0900 +++ b/io.c Sun Jul 15 14:18:19 2018 +0900 @@ -1,8 +1,7 @@ /* 6808 Simulator V092 - created 1993,1994 by L.C. Benschop. copyleft (c) 1994-2014 -by the sbc09 team, see AUTHORS for more details. license: -GNU General Public License version 2, see LICENSE for more -details. + created 1993,1994 by L.C. Benschop. copyleft (c) 1994-2014 +by the sbc09 team, see AUTHORS for more details. license: GNU +General Public License version 2, see LICENSE for more details. This program simulates a 6809 processor. @@ -49,7 +48,9 @@ * IOPAGE ~ IOPAGE+0x7f * for OS9 level2 * IOPAGE 0xff80 means ioport beging 0xff80 but IOPAGE itself starts 0xff00 - * 0xfe00-0xff7f, 0xffe0-0xffff can be used as ROM in fixed area + * 0xfe00-0xff7f, 0xffe0-0xffff can be used as RAM in fixed area in level2 + * and these are ROM in level1 + * * * IOPAGE + 0x00 ACIA control * IOPAGE + 0x01 ACIA data @@ -66,6 +67,7 @@ * tr=1 mmu=IOPAGE+0xa8 * * IOPAGE + 0x30 Timer control 0x8f start timer/0x80 stop timer/0x04 update date + * read 0x10 bit menas timer * IOPAGE + 0x31- YY/MM/DD/HH/MM/SS * * IOPAGE + 0x40 Disk control 0x81 read/0x55 write 0 ... ok / 0xff .. error @@ -94,6 +96,7 @@ int acknak; int rcvdnak; int blocknum; +int timer_irq = 2 ; // 2 = FIRQ, 1 = IRQ FILE *infile; FILE *xfile; @@ -194,15 +197,19 @@ if (a == 0+(IOPAGE&0x1ff)) { if (f == EOF) f = char_input(); - if (f != EOF) + if (f != EOF) { c = f; - return 2 + (f != EOF); + mem[(IOPAGE&0xfe00) + a] = c; + } + mem[(IOPAGE&0xfe00) + a] = c = 2 + (f != EOF); + return c; } else if (a == 1+(IOPAGE&0x1ff)) { /*data port*/ if (f == EOF) f = char_input(); if (f != EOF) { c = f; f = EOF; + mem[(IOPAGE&0xfe00) + a] = c; } return c; } @@ -274,11 +281,14 @@ timercontrol.it_interval.tv_usec = 20000; timercontrol.it_value.tv_sec = 0; timercontrol.it_value.tv_usec = 20000; + timer_irq = 1; setitimer(ITIMER_REAL, &timercontrol, NULL); + mem[(IOPAGE&0xfe00)+a]=c; } else if (a==0x30+(IOPAGE&0x1ff) && c==0x80) { timercontrol.it_interval.tv_sec = 0; timercontrol.it_interval.tv_usec = 0; setitimer(ITIMER_REAL, &timercontrol, NULL); + mem[(IOPAGE&0xfe00)+a]=c; } else if (a==0x30+(IOPAGE&0x1ff) && c==0x04) { time_t tm = time(0); struct tm *t = localtime(&tm); @@ -338,7 +348,8 @@ void timehandler(int sig) { attention = 1; irq = 2; - signal(SIGALRM, timehandler); + mem[(IOPAGE&0xfe00)+0x30] |= 0x10 ; + // signal(SIGALRM, timehandler); } void handler(int sig) {
--- a/os9/level1/clock.asm Sat Jul 14 15:22:54 2018 +0900 +++ b/os9/level1/clock.asm Sun Jul 15 14:18:19 2018 +0900 @@ -23,6 +23,9 @@ rev set $01 edition set $06 TimerPort set $e030 +TkPerSec set 60 +TkPerTS equ TkPerSec/10 ticks per time slice + mod eom,name,tylg,atrv,ClkEnt,size @@ -38,22 +41,33 @@ ClockIRQ clra tfr a,dp -L00AE jsr [>D.Poll] - bcc L00AE -L00B4 jmp [>D.AltIRQ] - rts + ldx #TimerPort + lda ,x + bita #$10 + beq L00B4 + ldb #$8f start timer + stb ,x +L00B4 + jmp [>D.SvcIRQ] ClkEnt equ * + ldd #59*256+$01 last second and last tick + std <D.Sec will prompt RTC read at next time slice +* ldb #TkPerSec +* stb <D.TSec set ticks per second + ldb #TkPerTS get ticks per time slice + stb <D.TSlice set ticks per time slice + stb <D.Slice set first time slice pshs cc orcc #FIRQMask+IRQMask mask ints - leax >ClockIRQ,pcr + leax <ClockIRQ,pcr stx <D.IRQ * install system calls - leay >SysTbl,pcr + leay <SysTbl,pcr os9 F$SSvc ldx #TimerPort - ldb #$8f start timer - stb ,x +* ldb #$8f start timer +* stb ,x puls pc,cc * F$Time system call code @@ -68,6 +82,7 @@ ldd 5,y std 4,x clrb + rts emod
--- a/os9/level2/Makefile Sat Jul 14 15:22:54 2018 +0900 +++ b/os9/level2/Makefile Sun Jul 15 14:18:19 2018 +0900 @@ -18,10 +18,10 @@ $(A09) boot.asm -o boot $(LST) sysgo : sysgo.asm - $(A09) sysgo.asm -o sysgo $(LST) + $(A09) ../level1/sysgo.asm -o sysgo $(LST) init : init.asm - $(A09) init.asm -o init $(LST) + $(A09) ${OS9SRC}/level1/modules/init.asm -o $@ $(LST) vector : vector.asm $(A09) vector.asm -o vector $(LST) @@ -35,8 +35,8 @@ d1 : d1.asm $(A09) d1.asm -o d1 $(LST) -clock : clock.asm - $(A09) clock.asm -o clock $(LST) +clock : + $(A09) ../level1/clock.asm -o clock $(LST) pty : $(A09) ../level1/pty.asm -o pty $(LST)
--- a/os9/level2/defsfile Sat Jul 14 15:22:54 2018 +0900 +++ b/os9/level2/defsfile Sun Jul 15 14:18:19 2018 +0900 @@ -3,9 +3,13 @@ * * OS-9 Level and Version equates Level equ 2 -OS9Vrsn equ 0 +OS9Vrsn equ 1 OS9Major equ 0 -OS9Minor equ 0 +OS9Minor equ 1 +NOS9VER equ OS9Vrsn +NOS9MAJ equ OS9Major +NOS9MIN equ OS9Minor + use ../../../../nitros9-code/defs/coco.d use ../../../../nitros9-code/defs/os9.d use ../../../../nitros9-code/defs/scf.d
--- 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);