Annotation of cci/d/event/bio.c, revision 1.1

1.1     ! root        1: 
        !             2: #include "definitions"
        !             3: 
        !             4: /*     I/O ROUTINES TO CPU2 CONSOLE    */
        !             5: 
        !             6: #define MAXC           1000            /* MAX 1000 chars per line */
        !             7: #define OUTADR         0x20000         /* Address of output buffer */
        !             8: #define INADR          0x20100         /* Address of input buffer  */
        !             9: 
        !            10: long ocnt = 0;                         /* Next location in output buffer */
        !            11: long icnt = 0;                         /* Next location in input buffer */
        !            12: extern long savvec7;
        !            13: 
        !            14: writec(c)              /* VERSION to run on the simmulator */
        !            15: char c;
        !            16: {
        !            17:        putchar(c);
        !            18: }
        !            19: 
        !            20: readc(c)
        !            21: char *c;
        !            22: {      char *cptr;
        !            23: 
        !            24:        asm("mfpr $MME,_savvec7");      
        !            25:        savvec7 = savvec7 & 0x1;
        !            26:        asm("mtpr $0,$MME");            /* Disable MME */
        !            27:        cptr = (char *)(INADR+ icnt++);
        !            28:        *c = *cptr;
        !            29:        asm("mtpr _savvec7,$MME");      /* Restore MME */
        !            30: }
        !            31: 
        !            32: writes(s)
        !            33: char *s;
        !            34: {
        !            35:        putstr(s);
        !            36: }
        !            37: 
        !            38: /*     This function read a string of characters.
        !            39:        calling sequence : nochar = reads(s);
        !            40:        input argument   : char *s;
        !            41:        return value     : no. of char read; excluding NULL or CR.
        !            42: */
        !            43: reads(s)
        !            44: char *s;
        !            45: {      char *str;
        !            46:        int ix;
        !            47: 
        !            48:        str = s;
        !            49:        for(ix=0;ix<ALINE;ix++)
        !            50:        {
        !            51:                readc(str);
        !            52:                if ((*str==NULL)||(*str==CR)) 
        !            53:                        { *str = NULL;
        !            54:                          break;
        !            55:                        }
        !            56:                     else str++;
        !            57:        }
        !            58:        icnt = 0;               /* For simulator only */
        !            59: 
        !            60:        return(ix);
        !            61: }
        !            62: /*     This function read a string of HEX digit and
        !            63:        convert it to integer value.
        !            64:        calling sequence : stat = readh(ix);
        !            65:        input parameter  : long *ix;
        !            66:        return value     : (stat < 0) if error else (stat = 0);
        !            67: */
        !            68: 
        !            69: /*
        !            70: readh(ix)      
        !            71: long *ix;
        !            72: {      char line[ALINE], *getnum(), *del;
        !            73:        int nochar;
        !            74: 
        !            75:        if ( (nochar = reads(line)) > 8 ) return(-1);
        !            76:        if ( (del = getnum(line,ix,del,HEX)) < 0 ) return(-1);
        !            77:                else return(0);
        !            78: }
        !            79: 
        !            80: */
        !            81: 
        !            82: 
        !            83: 
        !            84: writeh(ix)     /* 32 bits HEX */
        !            85: long ix;
        !            86: {      long iy, temp, mask;
        !            87:        int count;
        !            88:        char c;
        !            89: 
        !            90:        iy=1; count = 28;
        !            91:        mask = 0xf0000000;
        !            92:        while (mask)
        !            93:        {
        !            94:                c = ( (ix&mask) >> count )&0xf;
        !            95:                count -= 4;
        !            96:                mask = mask >> 4;
        !            97:                if (iy) 
        !            98:                        { mask = 0xf000000; 
        !            99:                          iy=0;
        !           100:                        }
        !           101:                if ((c>=0)&&(c<=9)) c=c+'0';
        !           102:                        else c=c+'7';
        !           103:                writec(c);
        !           104:        }
        !           105: }
        !           106: 
        !           107: /*     This function read a string of DEC digit and
        !           108:        convert it to integer value.
        !           109:        calling sequence : stat = readd(ix);
        !           110:        input parameter  : long *ix;
        !           111:        return value     : (stat < 0) if error else (stat = 0);
        !           112: */
        !           113: 
        !           114: /*
        !           115: readd(ix)      
        !           116: long *ix;
        !           117: {      char line[ALINE], *getnum(), *del;
        !           118:        int nochar;
        !           119: 
        !           120:        if ( (nochar = reads(line)) > 11 ) return(-1);
        !           121:        if ( (del = getnum(line,ix,del,DEC)) < 0 ) return(-1);
        !           122:                else return(0);
        !           123: }
        !           124: */
        !           125: 
        !           126: 
        !           127: writed(ix)     /* 32 bits DECIMAL */
        !           128: long ix;
        !           129: {      char c;
        !           130:        long div;
        !           131:        float divi;
        !           132:        int lead0;
        !           133: 
        !           134: /*
        !           135:        if (ix<0) 
        !           136:                {  writes("********");
        !           137:                   return(0);        }
        !           138:        lead0 = 1;
        !           139:        divi = 1000000000;
        !           140:        div = divi;
        !           141:        while (div)
        !           142:        {
        !           143:                c = (ix/div)+'0';
        !           144:                ix = ix%div;
        !           145:                divi = divi/10;
        !           146:                div = divi;
        !           147:                if ((c=='0')&&(lead0)) c=SPACE;
        !           148:                        else lead0 = 0;
        !           149:                writec(c);
        !           150:        }
        !           151: */
        !           152: 
        !           153: }
        !           154: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.