Annotation of cci/d/memman/cp.s, revision 1.1.1.1

1.1       root        1: LL0:
                      2:        .data
                      3: .set CPMDCB,21
                      4: .set DC_OFF,2
                      5: .set DC_ON,1
                      6: .set MME,9
                      7: .set DCR,27
                      8: .set PDCS,28
                      9: .set CTL_SW,0x41b
                     10:        .comm   _tmp_lw,4
                     11:        .align  2
                     12:        .globl  _cpbuf_sz
                     13: _cpbuf_sz:
                     14:        .long   1
                     15:        .align  2
                     16:        .globl  _charcnt
                     17: _charcnt:
                     18:        .long   0
                     19:        .comm   _cpout,204
                     20: .set HISR,0x410
                     21:        .text
                     22:        .align  1
                     23:        .globl  _putstr
                     24: _putstr:
                     25:        .word   L16
                     26:  # /*  Console Processor Interface     */
                     27:  # /*  Tahoe version, Nov. 1982        */
                     28:  # 
                     29:  # /****************************************/
                     30:  # /*                                  */
                     31:  # /*  Reduced DCB layout for byte     */
                     32:  # /*  communication.                  */
                     33:  # /*                                  */
                     34:  # /****************************************/
                     35:  # 
                     36:  # asm(".set CPMDCB,21");
                     37:  # asm(".set DC_OFF,2");
                     38:  # asm(".set DC_ON,1");
                     39:  # asm(".set MME,9");
                     40:  # asm(".set DCR,27");
                     41:  # asm(".set PDCS,28");
                     42:  # asm(".set CTL_SW,0x41b");  /* Addr of switches to turn on Cache, MME, Fault */
                     43:  # long tmp_lw;
                     44:  # 
                     45:  # 
                     46:  # #define     CPBUFLEN 200            /* Output buffer length */
                     47:  # struct      cphdr
                     48:  # {
                     49:  #     char    cp_unit;        /* Done bit & unit # */
                     50:  #     char    cp_comm;        /* Command */
                     51:  #     short   cp_count;       /* Counter (when relevant) */
                     52:  # };
                     53:  # 
                     54:  # struct      cpdcb_o                 /* Output structure */
                     55:  # {
                     56:  #     struct  cphdr   cp_hdr;
                     57:  #     char    cp_buf[CPBUFLEN]; /* Buffer for output or 'stty' */
                     58:  # };
                     59:  # 
                     60:  # struct      cpdcb_i                 /* Structure for input */
                     61:  # {
                     62:  #     struct  cphdr   cp_hdr;
                     63:  #     char    cpi_buf[4];     /* Buffer for input */
                     64:  # };
                     65:  # 
                     66:  # #define     CPDONE  0x80            /* 'Done' bit in cp_unit */
                     67:  # #define     CPTAKE  0x40            /* CP 'ack' to this cpdcb */
                     68:  # 
                     69:  #             /* Values for 'unit' */
                     70:  # #define     CPUNIT  0               /* The CP itself */
                     71:  # #define     CPCONS  1               /* Console line */
                     72:  # #define     CPREMOT 2               /* Remote line */
                     73:  # 
                     74:  #             /* Values for 'command' */
                     75:  # #define     CPRESET 0
                     76:  # #define     CPWRITE 1
                     77:  # #define     CPREAD  2
                     78:  # #define     CPSTTY  3
                     79:  # #define     CPBOOT  4
                     80:  # 
                     81:  # 
                     82:  # /*  Put a char to CPU2 console */
                     83:  # 
                     84:  # #define NCHAR       1
                     85:  # 
                     86:  # long cpbuf_sz = 1;          /* Buffer size   */
                     87:  # long charcnt = 0;
                     88:  # struct cpdcb_o cpout;                       /* DCB for output */
                     89:  # 
                     90:  # asm(".set HISR,0x410");
                     91:  # 
                     92:  # putstr(str)
                     93:  # char *str;
                     94:  # {   long c_cnt;
                     95:        jbr     L18
                     96: L19:
                     97:  # 
                     98:  #     cpout.cp_hdr.cp_unit = CPCONS;          /* Reset done bit */
                     99:        cvtlb   $1,_cpout
                    100:  #     cpout.cp_hdr.cp_comm = CPWRITE;         /* Set command */
                    101:        cvtlb   $1,_cpout+1
                    102:  #     for(c_cnt=0;;c_cnt++) {
                    103:        clrl    -56(fp)
                    104: L22:
                    105:  #             cpout.cp_buf[c_cnt] = *str++;
                    106:        movl    $_cpout+4,r0
                    107:        movl    -56(fp),r1
                    108:        movb    *4(fp),(r0)[r1]
                    109:        incl    4(fp)
                    110:  #             if (cpout.cp_buf[c_cnt]=='\n') {
                    111:        movl    $_cpout+4,r0
                    112:        movl    -56(fp),r1
                    113:        cmpb    (r0)[r1],$10
                    114:        jneq    L23
                    115:  #                      c_cnt++;
                    116:        incl    -56(fp)
                    117:  #                      cpout.cp_buf[c_cnt]='\r';
                    118:        movl    $_cpout+4,r0
                    119:        movl    -56(fp),r1
                    120:        cvtlb   $13,(r0)[r1]
                    121:  #                      }
                    122:  #             if (cpout.cp_buf[c_cnt]=='\0') break;
                    123: L23:
                    124:        movl    $_cpout+4,r0
                    125:        movl    -56(fp),r1
                    126:        tstb    (r0)[r1]
                    127:        jneq    L24
                    128:        jbr     L21
                    129:  #     }
                    130: L24:
                    131: L20:
                    132:        incl    -56(fp)
                    133:        jbr     L22
                    134: L21:
                    135:  #     if (c_cnt) {
                    136:        tstl    -56(fp)
                    137:        jeql    L25
                    138:  #             cpout.cp_hdr.cp_count = c_cnt;
                    139:        cvtlw   -56(fp),_cpout+2
                    140:  #             cp_poll('\0'); }
                    141:        pushl   $0
                    142:        callf   $8,_cp_poll
                    143:  # }
                    144: L25:
                    145:        ret
                    146:        .set    L16,0x0
                    147: L18:
                    148:        subl3   $56,fp,sp
                    149:        jbr     L19
                    150:        .data
                    151:        .text
                    152:        .align  1
                    153:        .globl  _putchar
                    154: _putchar:
                    155:        .word   L28
                    156:  # 
                    157:  # putchar(c)
                    158:  # {
                    159:        jbr     L30
                    160: L31:
                    161:  #     cpout.cp_hdr.cp_unit = CPCONS;          /* Reset done bit */
                    162:        cvtlb   $1,_cpout
                    163:  #     cpout.cp_hdr.cp_comm = CPWRITE;         /* Set command */
                    164:        cvtlb   $1,_cpout+1
                    165:  #     cpout.cp_buf[charcnt] = c;
                    166:        movl    $_cpout+4,r0
                    167:        movl    _charcnt,r1
                    168:        cvtlb   4(fp),(r0)[r1]
                    169:  #     cpout.cp_hdr.cp_count = 1;
                    170:        cvtlw   $1,_cpout+2
                    171:  #     cp_poll(c);
                    172:        pushl   4(fp)
                    173:        callf   $8,_cp_poll
                    174:  # }
                    175:        ret
                    176:        .set    L28,0x0
                    177: L30:
                    178:        jbr     L31
                    179:        .data
                    180:        .text
                    181:        .align  1
                    182:        .globl  _cp_poll
                    183: _cp_poll:
                    184:        .word   L32
                    185:  # 
                    186:  # cp_poll(c)
                    187:  # char c;
                    188:  # {   register long time, r11;
                    189:        jbr     L34
                    190: L35:
                    191:  # 
                    192:  #     time = 900000;
                    193:        movl    $900000,r12
                    194:  #     asm("movab _cpout,r10");
                    195: movab _cpout,r10
                    196:  #     asm("andl2 $0xffffff,r10");
                    197: andl2 $0xffffff,r10
                    198:  #     asm("mtpr r10,$CPMDCB");
                    199: mtpr r10,$CPMDCB
                    200:  #     tmp_lw = (long)(&cpout.cp_hdr.cp_unit);
                    201:        movl    $_cpout,_tmp_lw
                    202:  # 
                    203:  #     r11 = (long)(&cpout.cp_hdr.cp_unit);
                    204:        movl    $_cpout,r11
                    205:  #     while (time-- && !(cpout.cp_hdr.cp_unit & CPDONE)) { 
                    206: L36:
                    207:        movl    r12,r0
                    208:        decl    r12
                    209:        tstl    r0
                    210:        jeql    L37
                    211:        cvtbl   _cpout,r0
                    212:        bitl    $128,r0
                    213:        jneq    L37
                    214:  #             asm("mtpr r11,$0x1c");                  /* mtpr r11,$PDCS */
                    215: mtpr r11,$0x1c
                    216:  #             }
                    217:        jbr     L36
                    218: L37:
                    219:  #     if (!(cpout.cp_hdr.cp_unit & CPDONE)) cp_hlt(); /* Time out */
                    220:        cvtbl   _cpout,r0
                    221:        bitl    $128,r0
                    222:        jneq    L38
                    223:        callf   $4,_cp_hlt
                    224:  #     if (c== '\n') putchar('\r');
                    225: L38:
                    226:        cmpb    7(fp),$10
                    227:        jneq    L40
                    228:        pushl   $13
                    229:        callf   $8,_putchar
                    230:  # }
                    231: L40:
                    232:        ret
                    233:        .set    L32,0x1800
                    234: L34:
                    235:        jbr     L35
                    236:        .data
                    237:        .text
                    238:        .align  1
                    239:        .globl  _cp_hlt
                    240: _cp_hlt:
                    241:        .word   L41
                    242:  # 
                    243:  # cp_hlt()
                    244:  # {
                    245:        jbr     L43
                    246: L44:
                    247:  #     asm("movl $0xeeeeeeee,r0");
                    248: movl $0xeeeeeeee,r0
                    249:  #     asm("movl $0xeeeeeeee,r1");
                    250: movl $0xeeeeeeee,r1
                    251:  #     asm("movl $0xeeeeeeee,r2");
                    252: movl $0xeeeeeeee,r2
                    253:  #     asm("halt");
                    254: halt
                    255:  # }
                    256:        ret
                    257:        .set    L41,0x0
                    258: L43:
                    259:        jbr     L44
                    260:        .data
                    261:  # 

unix.superglobalmegacorp.com

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