# HG changeset patch # User Shinji KONO # Date 1532242359 -32400 # Node ID 51b437557f423c4f4d90733c5c49b67ad4f88bde # Parent 498b6fcaf270bbc31d53f5c398ac1b43915666bc boot without disk image dir -e on other directory diff -r 498b6fcaf270 -r 51b437557f42 a09.c --- a/a09.c Sun Jul 22 05:48:04 2018 +0900 +++ b/a09.c Sun Jul 22 15:52:39 2018 +0900 @@ -1182,12 +1182,16 @@ reset_crc(); putword(0x87cd); putword(scanexpr(0)-loccounter); // module size + if(unknown&&pass==2)error|=4; skipComma(); putword(scanexpr(0)-loccounter); // offset to module name + if(unknown&&pass==2)error|=4; skipComma(); putbyte(scanexpr(0)); // type / language + if(unknown&&pass==2)error|=4; skipComma(); putbyte(scanexpr(0)); // attribute + if(unknown&&pass==2)error|=4; int parity=0; for(int i=0; i< 8; i++) parity^=codebuf[i]; putbyte(parity^0xff); // header parity @@ -1195,6 +1199,7 @@ while (*srcptr==',') { // there are some more srcptr++; putword(scanexpr(0)); + if(unknown&&pass==2)error|=4; skipspace(); } prevloc = codeptr; diff -r 498b6fcaf270 -r 51b437557f42 d09.c --- a/d09.c Sun Jul 22 05:48:04 2018 +0900 +++ b/d09.c Sun Jul 22 15:52:39 2018 +0900 @@ -1375,7 +1375,7 @@ s = "-"; offset=0xffff-offset+1; } - fprintf(fp,"%0.2X %0.2X %0.2X %0.2X %s%s %s$%0.4X,%s", + fprintf(fp,"%0.2X %0.2X %0.2X %0.2X %s%s [%s$%0.4X,%s]", code, postbyte, prog[pc+2], prog[pc+3], suffix, op->name, s, offset, IndexRegister(postbyte)); extrabytes = 2; diff -r 498b6fcaf270 -r 51b437557f42 io.c --- a/io.c Sun Jul 22 05:48:04 2018 +0900 +++ b/io.c Sun Jul 22 15:52:39 2018 +0900 @@ -331,12 +331,13 @@ int drv = mem[IOPAGE+0x41]; int lsn = (mem[IOPAGE+0x42]<<16) + (mem[IOPAGE+0x43]<<8) + mem[IOPAGE+0x44]; int buf = (mem[IOPAGE+0x45]<<8) + mem[IOPAGE+0x46]; - if (drv > 1 || disk[drv]==0) goto error; Byte *phy = pmem(buf); if (c==0x81) { + if (drv > 1 || disk[drv]==0) goto error; if (lseek(fileno(disk[drv]),lsn*SECSIZE,SEEK_SET)==-1) goto error; if (read(fileno(disk[drv]),phy,SECSIZE)==-1) goto error; } else if (c==0x55) { + if (drv > 1 || disk[drv]==0) goto error; if (lseek(fileno(disk[drv]),lsn*SECSIZE,SEEK_SET)==-1) goto error; if (write(fileno(disk[drv]),phy,SECSIZE)==-1) goto error; #ifdef USE_VDISK diff -r 498b6fcaf270 -r 51b437557f42 os9/level2/Makefile --- a/os9/level2/Makefile Sun Jul 22 05:48:04 2018 +0900 +++ b/os9/level2/Makefile Sun Jul 22 15:52:39 2018 +0900 @@ -23,7 +23,7 @@ $(A09) sysgo.asm -o sysgo $(LST) init : init.asm - $(A09) ${OS9SRC}/level1/modules/init.asm -o $@ $(LST) + $(A09) init.asm -o $@ $(LST) vector : vector.asm $(A09) vector.asm -o vector $(LST) diff -r 498b6fcaf270 -r 51b437557f42 os9/level2/init.asm --- a/os9/level2/init.asm Sun Jul 22 05:48:04 2018 +0900 +++ b/os9/level2/init.asm Sun Jul 22 15:52:39 2018 +0900 @@ -1,28 +1,188 @@ -* OS9 standard init modul. - nam Init - ttl os9 system module +******************************************************************** +* Init - NitrOS-9 Configuration module +* +* $Id$ +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* 204 1998/10/12 Boisy G. Pitre +* Original OS-9 L2 Tandy distribution. +* +* 205 1998/10/20 Boisy G. Pitre +* Added CC3IO and Clock sections. +* +* 205r2 1998/10/20 Boisy G. Pitre +* Removed clock information from here. +* +* 1 2003/01/08 Boisy G. Pitre +* Restarted edition number back to 1, removed CMDS/cc3go reference and +* just have cc3go so that in certain cases, cc3go can be in the bootfile, +* and so that ROMmed systems don't have to have a special init module. +* +* 2003/11/05 Robert Gault +* Corrected CC3IO info regards mouse. Changed from fcb to fdb low res/ right +* Corrected OS9Defs to match. +* +* 2006/07/06 P.Harvey-Smith. +* Conditionally excluded port messages on Dragon Alpha, due to insufficient +* space ! +* - ifp1 + nam Init + ttl NitrOS-9 Configuration module + + ifp1 use defsfile - endc -null set $0000 + IFGT Level-1 + use cocovtio.d + ENDC + endc + tylg set Systm+$00 atrv set ReEnt+rev -rev set $01 - mod eom,initnam,tylg,atrv - fcb 7 - fdb $c000 - fcb $0C - fcb $0C - fdb sysgo - fdb sysdev system device (sysdev) - fdb systerm - fdb bootst bootstrap module (bootst) -initnam fcs "Init" -sysgo fcs "SysGo" -sysdev fcs "/D0" -systerm fcs "/Term" -bootst fcs "Boot" +rev set $00 +edition set 1 + +* +* Usually, the last two words here would be the module entry +* address and the dynamic data size requirement. Neither value is +* needed for this module so they are pressed into service to show +* MaxMem and PollCnt. For example: +* $0FE0,$0015 means +* MaxMem = $0FE000 +* PollCnt = $0015 +* + mod eom,name,tylg,atrv,$0FE0,$0015 + +***** USER MODIFIABLE DEFINITIONS HERE ***** + +* +* refer to +* "Configuration Module Entry Offsets" +* in os9.d +* +start equ * + fcb $27 entries in device table + fdb DefProg offset to program to fork + fdb DefDev offset to default disk device + fdb DefCons offset to default console device + fdb DefBoot offset to boot module name + fcb $01 write protect flag (?) + fcb Level OS level + fcb NOS9VER OS version + fcb NOS9MAJ OS major revision + fcb NOS9MIN OS minor revision + IFNE H6309 + fcb Proc6309+CRCOff feature byte #1 + ELSE + fcb CRCOff feature byte #1 + ENDC + fcb $00 feature byte #2 + fdb OSStr + fdb InstStr + fcb 0,0,0,0 reserved + + IFGT Level-1 +* CC3IO section + fcb Monitor monitor type + fcb 0,1 mouse info, low res right mouse + fcb $1E key repeat start constant + fcb $03 key repeat delay constant + ENDC + +name fcs "Init" + fcb edition + +DefProg fcs "SysGo" +DefDev fcs "/V0" +DefCons fcs "/Term" +DefBoot fcs "Boot" + +* +* The DragonAlpha is so pushed for boot track space, that we have to exclude these +* messages ! +* + + IFEQ dalpha +OSStr equ * + fcc "NitrOS-9/" + IFNE H6309 + fcc /6309 / + ELSE + fcc /6809 / + ENDC + fcc /Level / + fcb '0+Level + fcc / V/ + fcb '0+NOS9VER + fcc /./ + fcb '0+NOS9MAJ + fcc /./ + fcb '0+NOS9MIN + fcb 0 + +InstStr equ * + IFNE coco1 + fcc "Radio Shack Color Computer" + ELSE + IFNE deluxe + fcc "Deluxe Color Computer" + ELSE + IFNE coco2 + fcc "Radio Shack Color Computer 2" + ELSE + IFNE coco2b + fcc "Tandy Color Computer 2" + ELSE + IFNE coco3 + fcc "Tandy Color Computer 3" + ELSE + IFNE tano + fcc "Tano Dragon (US)" + ELSE + IFNE d64 + fcc "Dragon 64 (UK)" + ELSE + IFNE dalpha + fcc "Dragon Alpha" + ELSE + IFNE atari + fcc "Atari XL/XE" + ELSE + IFNE mc09 + fcb $1B text in bright blue + fcc "[94mMulticomp09" + fcb $1B + fcc "[0m" + ELSE + IFNE coco3fpga + fcc "Gary Becker's Coco3FPGA" + ELSE + IFNE corsham + fcc "Corsham 6809" + ELSE + fcc "Unknown Machine" + ENDC match IFNE corsham + ENDC match IFNE coco3fpga + ENDC match IFNE mc09 + ENDC match IFNE atari + ENDC match IFNE dalpha + ENDC match IFNE d64 + ENDC match IFNE tano + ENDC match IFNE coco3 + ENDC match IFNE coco2b + ENDC match IFNE coco2 + ENDC match IFNE delux + ENDC match IFNE coco1 + fcb 0 null-terminate the name string + ELSE +* DragonAlpha +OSStr equ * +InstStr equ * + fcb 0 null-length string + ENDC match IFEQ dalpha + emod eom equ * - + end diff -r 498b6fcaf270 -r 51b437557f42 os9/level2/sysgo.asm --- a/os9/level2/sysgo.asm Sun Jul 22 05:48:04 2018 +0900 +++ b/os9/level2/sysgo.asm Sun Jul 22 15:52:39 2018 +0900 @@ -69,7 +69,7 @@ IFEQ ROM DefDev equ * - fcc "/D0" + fcc "/V0" * IFNE DD * fcc "/DD" * ELSE @@ -77,13 +77,14 @@ * ENDC fcb C$CR HDDev equ * - fcc "/DD" + fcc "/V0" + fcb C$CR * IFNE DD * fcc "/DD/" * ELSE * fcc "/H0/" * ENDC -ExecDir fcc "/D0/CMDS" +ExecDir fcc "/V0/cmds" fcb C$CR ENDC diff -r 498b6fcaf270 -r 51b437557f42 os9/level2/vrbf.asm --- a/os9/level2/vrbf.asm Sun Jul 22 05:48:04 2018 +0900 +++ b/os9/level2/vrbf.asm Sun Jul 22 15:52:39 2018 +0900 @@ -114,25 +114,22 @@ stu 5,x caller stack lda next = breakpoint; - breakpoint = bp; bp->count = count; bp->laddr = adr; bp->address = paddr(adr,mmu); #ifdef USE_MMU + if (bp->address >= memsize) { free(bp); return; } bp->watch = *mem0(phymem,adr,mmu); #else bp->watch = mem[adr]; #endif + bp->next = breakpoint; + breakpoint = bp; } int nexti(void) { diff -r 498b6fcaf270 -r 51b437557f42 v09.c --- a/v09.c Sun Jul 22 05:48:04 2018 +0900 +++ b/v09.c Sun Jul 22 15:52:39 2018 +0900 @@ -83,7 +83,31 @@ exit(2); } long len = filesize(image); + /* + * + * 0x0000-0xdfff normal mem + * 0xxxxx-0xdfff rom + * 0xe000-0xe100 i/o + * 0xe000-0xffff rom + * + * discless boot + * rom image will be copyied from 0xed00-0x1xxxx + * boot copies 0x10000-0x1xxxx to os9's boot memory + */ #ifdef USE_MMU + /* + * In case of Coco, there is no ROM (switched out after boot ) + * 0x00000-0x0fdff normal mem + * 0x0fe00-0x0ffff ram fixed address ram including io + * 0x10000-0x7ffff ram (512Kb memory current implementation) + * it should have 2MB memory + * 0x10000-0xfffff ram + * >0x100000 lapround + * + * discless boot + * rom image will be copyied from 0xed00-0x1xxxx + * boot copies 0x10000-0x1xxxx to os9's boot memory + */ phymem = malloc(memsize + len - 0x2000); rommemsize = memsize + len - 0x2000; mem = phymem + memsize - 0x10000 ; diff -r 498b6fcaf270 -r 51b437557f42 vdisk.c --- a/vdisk.c Sun Jul 22 05:48:04 2018 +0900 +++ b/vdisk.c Sun Jul 22 15:52:39 2018 +0900 @@ -116,12 +116,12 @@ #define MAXPAHTLEN 256 static void -putOs9str(char *s) { +putOs9str(char *s,int max) { if (s==0) { printf("(null)"); return; } - while(*s && *s>=' ' && ((*s&0x80)==0)) { + while(*s && (*s&0x7f)>=' ' && ((*s&0x80)==0) && --max !=0) { putchar(*s); s++; } if (*s&0x80) putchar(*s&0x7f); @@ -136,7 +136,7 @@ addCurdir(char *name, PathDesc *pd, int curdir) { int ns =0 ; char *n = name; -if(vdiskdebug&0x2) { printf("addcur \""); putOs9str(name); printf("\" cur \""); putOs9str( cdt[curdir]); printf("\"\n"); } +if(vdiskdebug&0x2) { printf("addcur \""); putOs9str(name,0); printf("\" cur \""); putOs9str( cdt[curdir],0); printf("\"\n"); } if (name[0]=='/') { name++; while(*name !='/' && *name!=0) name ++ ; // skip /d0 while(name[ns]!=0) ns++; @@ -172,15 +172,15 @@ char *p = path; char *name = path; int maxlen = MAXPAHTLEN; -if(vdiskdebug&2) { printf("checkf \""); putOs9str(name); printf("\"\n"); } +if(vdiskdebug&2) { printf("checkf \""); putOs9str(name,0); printf("\"\n"); } while(*p!=0 && (*p&0x80)==0 && (*p&0x7f)>' ' && maxlen-->0) p++; if (maxlen==MAXPAHTLEN) return 0; - if (*p!=0) { - name = (char *)malloc(p-path+1); + if (*p) { // 8th bit termination or non ascii termination + int eighth = ((*p&0x80)!=0); + name = (char *)malloc(p-path+1+eighth); int i; - for(i=0;iname = name1; if(vdiskdebug&2) { printf(" remain = \""); - char *p1 = p; - while(*p1 && (*p1&0x80)==0 ) { if (*p1<0x20) printf("(0x%02x)",*p1); else putchar(*p1); p1++; } + char *p1 = p; int max=31; + while(*p1 && (*p1&0x80)==0 && max-->0) { if (*p1<0x20) printf("(0x%02x)",*p1); else putchar(*p1); p1++; } if (*p1) { if ((*p1&0x7f)<0x20) printf("(0x%02x)",*p1); else putchar(*p1&0x7f); } - printf("\" checkname result \""); putOs9str(pd->name); printf("\"\n"); + printf("\" checkname result \""); putOs9str(pd->name,0); printf("\"\n"); } return p; } static void -os9setmode(char *os9mode,int mode) { +os9setmode(Byte *os9mode,int mode) { char m = 0; if (mode&S_IFDIR) m|=0x80; if (mode&S_IRUSR) m|=0x01; @@ -303,12 +303,12 @@ } static void -os9setdate(char *d,struct timespec * unixtime) { +os9setdate(Byte *d,struct timespec * unixtime) { // yymmddhhss struct tm r; localtime_r(&unixtime->tv_sec,&r); - d[0] = r.tm_year-2000; - d[1] = r.tm_mon; + d[0] = r.tm_year-2048; + d[1] = r.tm_mon + 1; d[2] = r.tm_mday; d[3] = r.tm_hour; d[4] = r.tm_min; @@ -320,24 +320,27 @@ * if buf!=0, copy it */ static int -filedescriptor(Byte *buf, int len, PathDesc *pd) { +filedescriptor(Byte *buf, int len, Byte *name,int curdir) { + int err = 0x255; + PathDesc pd; + if (len<13) return -1; + checkFileName((char*)name,&pd,curdir); struct stat st; - if (pd->fd) return 1; - pd->fd = (char *)malloc(256); - stat(pd->name,&st); - os9setmode(pd->fd+FD_ATT,st.st_mode); - pd->fd[FD_OWN]=(st.st_uid&0xff00)>>8; - pd->fd[FD_OWN+1]=st.st_uid&0xff; - os9setdate(pd->fd + FD_DAT,&st.st_mtimespec); - pd->fd[FD_LNK]=st.st_nlink&0xff; - pd->fd[FD_SIZ+0]=(st.st_size&0xff000000)>>24; - pd->fd[FD_SIZ+1]=(st.st_size&0xff0000)>>16; - pd->fd[FD_SIZ+2]=(st.st_size&0xff00)>>8; - pd->fd[FD_SIZ+3]=st.st_size&0xff; - os9setdate(pd->fd+FD_Creat,&st.st_ctimespec); - // dummy segment list - for(int i=FD_SEG ; i < 256; i++) pd->fd[i] = 0; - return 0; + if (stat(pd.name,&st)!=0) goto err1; + os9setmode(buf+FD_ATT,st.st_mode); + buf[FD_OWN]=(st.st_uid&0xff00)>>8; + buf[FD_OWN+1]=st.st_uid&0xff; + os9setdate(buf+ FD_DAT,&st.st_mtimespec); + buf[FD_LNK]=st.st_nlink&0xff; + buf[FD_SIZ+0]=(st.st_size&0xff000000)>>24; + buf[FD_SIZ+1]=(st.st_size&0xff0000)>>16; + buf[FD_SIZ+2]=(st.st_size&0xff00)>>8; + buf[FD_SIZ+3]=st.st_size&0xff; + os9setdate(buf+FD_Creat,&st.st_ctimespec); + err = 0; +err1: + free(pd.name); + return err; } /* read direcotry entry for any file in the directory @@ -347,25 +350,24 @@ * inode==bitmap should return disk sector map for os9 free command */ static int -fdinfo(Byte *buf,int len, int inode, PathDesc *pd) { +fdinfo(Byte *buf,int len, int inode, PathDesc *pd,int curdir) { int i; for(i=0;iuse || !pd->dir) continue; // find inode in directory - char *dir = (char *)pd->dirfp; - char *end = (char *)pd->dirfp + pd->sz; + Byte *dir = (Byte*)pd->dirfp; + Byte *end = (Byte*)pd->dirfp + pd->sz; while( dir < end ) { - Byte *p = (Byte *)(dir + DIR_NM); + Byte *p = (dir + DIR_NM); int dinode = (p[0]<<16)+(p[1]<<8)+p[2]; if (inode == dinode) { - filedescriptor(buf,len,pd); - return 1; + return filedescriptor(buf,len,dir,curdir); } dir += 0x20; } } - return 0; + return 255; } void @@ -763,11 +765,10 @@ * R$B=SS.FD ($0F) * R$X=Pointer to a 256 byte buffer * R$Y=# bytes of FD required - * this should be handled in vrbf */ *breg = 0xff; if (pd==0) break; - *breg = filedescriptor(pmem(xreg), yreg,pd) ; + *breg = filedescriptor(pmem(xreg), yreg,(Byte*)pd->name,curdir) ; break; case 0x20: // Pos.FDInf mandatry for dir command /* SS.FDInf ($20) - Directly reads a file descriptor from anywhere @@ -782,7 +783,7 @@ *breg = 0xff; if (pd==0) break; ureg = getword(smem(u+8)); - *breg = fdinfo(pmem(xreg),yreg,xreg*0x10000+ureg,pd); + *breg = fdinfo(pmem(xreg),(yreg&0xff),((yreg&0xff00)>>8)*0x10000+ureg,pd,curdir); break; default: *breg = 0xff; @@ -815,6 +816,7 @@ } break; } + if (vdiskdebug && *breg) printf(" vdisk call error %x\n",*breg); // return value mem[0xffc0] = *breg; *smem(u+2) = *breg ;