|
|
1.1 ! root 1: #define error_hdl1 error ! 2: #define error_str error ! 3: ! 4: extern long scoplp; ! 5: extern long force_lp; ! 6: extern long ercode; ! 7: ! 8: #define C 0x1 ! 9: #define V 0x2 ! 10: #define Z 0x4 ! 11: #define N 0x8 ! 12: ! 13: /* MOVBLK instruction */ ! 14: ! 15: #define MAXLINE 100 ! 16: #define NULL 0 ! 17: ! 18: /* Some global variables */ ! 19: static long flag_msk, psl, len, r2; ! 20: static char *r1, *r0, *s_str; ! 21: ! 22: asm(".align 2"); ! 23: static char srcstr[MAXLINE], *srcptr; ! 24: ! 25: asm(".align 2"); ! 26: static char d_str[MAXLINE], *dstptr; ! 27: ! 28: ! 29: movblk() ! 30: { ! 31: asm("movl $3,_no_opr"); ! 32: mvblock(); ! 33: asm("jmp *return"); ! 34: } ! 35: ! 36: static mvblock() ! 37: { ! 38: long exp_psw, ix, exp_r2; ! 39: char *exp_r0, *exp_r1, *cptr; ! 40: ! 41: cptr = srcstr; ! 42: for(ix=0;ix<95;ix++) { ! 43: *cptr = ' ' + ix; /* make a long string */ ! 44: cptr++; ! 45: } ! 46: *cptr = '\0'; ! 47: exp_r2 = 0; ! 48: ! 49: setjmp(); ! 50: asm("m1: movab m1,_stpc"); ! 51: asm("movl $1,_subtst"); ! 52: flag_msk = exp_psw = N|V|C; ! 53: srcptr = (char *)(srcstr + 2); /* source str begin at word */ ! 54: dstptr = (char *)(d_str + 3); /* Dest. str begin at byte */ ! 55: len = 50; ! 56: exp_r0 = srcptr + len; ! 57: exp_r1 = dstptr + len; ! 58: mvblk(exp_r0,exp_r1,exp_r2,exp_psw); ! 59: ! 60: setjmp(); ! 61: asm("m2: movab m2,_stpc"); ! 62: asm("movl $2,_subtst"); ! 63: flag_msk = exp_psw = Z; ! 64: srcptr = srcstr; /* source str begin at lword */ ! 65: dstptr = (char *)(d_str + 2); /* Dest. str begin at word */ ! 66: len = 94; ! 67: exp_r0 = srcptr + len; ! 68: exp_r1 = dstptr + len; ! 69: mvblk(exp_r0,exp_r1,exp_r2,exp_psw); ! 70: ! 71: setjmp(); ! 72: asm("m3: movab m3,_stpc"); ! 73: asm("movl $3,_subtst"); ! 74: flag_msk = exp_psw = N|Z|V|C; ! 75: srcptr = (char *)(srcstr + 1); /* source str begin at byte */ ! 76: dstptr = d_str; /* Dest. str begin at lword */ ! 77: len = 95; ! 78: exp_r0 = srcptr + len; ! 79: exp_r1 = dstptr + len; ! 80: mvblk(exp_r0,exp_r1,exp_r2,exp_psw); ! 81: ! 82: } ! 83: ! 84: static mvblk(exp_r0,exp_r1,exp_r2,exp_psw) ! 85: char *exp_r0, *exp_r1 ; ! 86: long exp_psw, exp_r2; ! 87: { ! 88: char *msg1, *msg2, *str, saves[MAXLINE], *cptr1, *cptr2; ! 89: int ix; ! 90: long slen, len_op, psw; ! 91: ! 92: flag_msk = flag_msk << 16; ! 93: len_op = len; ! 94: cptr1 = srcptr+len; cptr2 = dstptr+len; ! 95: *cptr1 = *cptr2 = NULL; ! 96: for(;;) ! 97: { ! 98: ! 99: /* CLEAR DESTINATION STRING */ ! 100: cptr1 = d_str; ! 101: for(ix=0;ix<MAXLINE;ix++) { ! 102: *cptr1 = '^'; ! 103: cptr1++; ! 104: } ! 105: /* SAVE SOURCE STRING */ ! 106: str = srcptr; ! 107: cptr1 = saves; ! 108: for(slen=0; slen<=len ;slen++) { ! 109: *cptr1 = *str++; ! 110: cptr1++; ! 111: } ! 112: /* set flags */ ! 113: len = len_op; ! 114: asm("movl _srcptr,r0"); ! 115: asm("movl _dstptr,r1"); ! 116: asm("movl _len,r2"); ! 117: asm("bicpsw $0xf"); /* clear all flags */ ! 118: asm("bispsw _flag_msk"); ! 119: asm("movblk"); ! 120: asm("movpsl _psl"); ! 121: asm("movl r0,_r0"); ! 122: asm("movl r1,_r1"); ! 123: asm("movl r2,_r2"); ! 124: ! 125: psw = psl & 0xf; ! 126: ! 127: /* check flags */ ! 128: if (psw != exp_psw) ! 129: { ! 130: ercode = 2; ! 131: if (scoplp) longjmp(); ! 132: error_hdl1(psw,exp_psw,srcptr,dstptr,len); ! 133: } ! 134: ! 135: /* CHECK IF SOURCE OPERANDS GET CHANGED */ ! 136: if (len != len_op) ! 137: { ! 138: ercode = 3; ! 139: if (scoplp) longjmp(); ! 140: error_hdl1(len,len_op,srcptr,dstptr,len); ! 141: } ! 142: ! 143: cptr1 = saves; ! 144: cptr2 = srcptr; ! 145: for(ix=0;ix<len;ix++) ! 146: { ! 147: if ((*cptr2) != (*cptr1)) ! 148: { ! 149: ercode = 3; ! 150: if (scoplp) longjmp(); ! 151: error_str(srcstr,saves,srcptr,dstptr,len); ! 152: } ! 153: cptr1++; ! 154: cptr2++; ! 155: } ! 156: ! 157: /* CHECK DESTINATION STRING */ ! 158: cptr1 = srcptr; ! 159: cptr2 = dstptr; ! 160: for(ix=0;ix<len;ix++) ! 161: { ! 162: if ((*cptr1) != (*cptr2)) ! 163: { ! 164: ercode = 3; ! 165: if (scoplp) longjmp(); ! 166: error_str(d_str,srcstr,srcptr,dstptr,len); ! 167: } ! 168: cptr1++; ! 169: cptr2++; ! 170: } ! 171: ! 172: cptr1 = dstptr+len+1; ! 173: if (((*cptr1) != '^') && ((*cptr1) != NULL)) ! 174: { ! 175: ercode = 3; ! 176: if (scoplp) longjmp(); ! 177: error_str(cptr1,dstptr+len+1,d_str,srcstr); ! 178: } ! 179: ! 180: /* CHECK R0, R1, R2 */ ! 181: ! 182: if (r0 != exp_r0) ! 183: { ! 184: ercode = 1; ! 185: if (scoplp) longjmp(); ! 186: error_hdl1(r0,exp_r0,srcptr,dstptr,len); ! 187: } ! 188: if (r1 != exp_r1) ! 189: { ! 190: ercode = 1; ! 191: if (scoplp) longjmp(); ! 192: error_hdl1(r1,exp_r1,srcptr,dstptr,len); ! 193: } ! 194: if (r2 != exp_r2) ! 195: { ! 196: ercode = 1; ! 197: if (scoplp) longjmp(); ! 198: error_hdl1(r2,exp_r2,srcptr,dstptr,len); ! 199: } ! 200: /* if (force_lp) longjmp(); */ ! 201: ! 202: break; ! 203: } ! 204: } ! 205:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.