|
|
1.1 ! root 1: #define disp_error error ! 2: ! 3: /* standard definition file */ ! 4: /* for 'C' diagnostic porgrams. */ ! 5: /* */ ! 6: /* */ ! 7: #define HIGH 31 ! 8: #define IPL 8 ! 9: #define PSWMASK 0xf ! 10: #define T 16 ! 11: #define IV 32 ! 12: #define FU 64 ! 13: #define DV 128 ! 14: #define FLAGS 0x0000000f ! 15: ! 16: extern long scoplp; ! 17: extern long force_lp; ! 18: ! 19: asm(".set PSWMASK,0xf"); ! 20: ! 21: ! 22: /* constants definition for ADWC instruction */ ! 23: /* */ ! 24: /* */ ! 25: ! 26: #define ADWC 0x8d /*opcode */ ! 27: ! 28: ! 29: #define MAX_PATTERNS 6 ! 30: ! 31: ! 32: #define SUM1 0 /*initial value of sum */ ! 33: #define SUM2 -1 ! 34: #define SUM3 0x7fffffff ! 35: #define SUM4 0x7ffffffd ! 36: #define SUM5 0x80000000 ! 37: #define SUM6 0x80000000 ! 38: ! 39: ! 40: #define ADD1 -1 /*initial values for add*/ ! 41: #define ADD2 1 ! 42: #define ADD3 1 ! 43: #define ADD4 1 ! 44: #define ADD5 0x7fffffff ! 45: #define ADD6 0x80000000 ! 46: ! 47: ! 48: ! 49: #define EXP1 0 /*expected result */ ! 50: #define EXP2 1 ! 51: #define EXP3 0x80000000 ! 52: #define EXP4 0x7fffffff ! 53: #define EXP5 0 ! 54: #define EXP6 0 ! 55: ! 56: ! 57: #define IPSW1 1 /*initial psw */ ! 58: #define IPSW2 15 ! 59: #define IPSW3 0 ! 60: #define IPSW4 15 ! 61: #define IPSW5 15 ! 62: #define IPSW6 0 ! 63: ! 64: ! 65: #define EPSW1 5 /*expected psw */ ! 66: #define EPSW2 1 ! 67: #define EPSW3 2 ! 68: #define EPSW4 0 ! 69: #define EPSW5 5 ! 70: #define EPSW6 15 ! 71: ! 72: ! 73: #define ERROR1 1 /*error definitions */ ! 74: #define ERROR2 2 ! 75: #define ERROR3 3 ! 76: ! 77: ! 78: #define EM1 "sum not equal to expected \n" ! 79: #define EM2 "addend operand altered \n" ! 80: #define EM3 "psw not equal to expected \n" ! 81: ! 82: ! 83: ! 84: ! 85: /* Global variables for add with carry test */ ! 86: /* */ ! 87: /* */ ! 88: ! 89: static short index = 0; ! 90: static long sum = 0; /*destination location */ ! 91: static long add = 0; /*addend location */ ! 92: static long psw; /*processor status word */ ! 93: static long error_count = 0; ! 94: ! 95: /*initial flag values */ ! 96: static long i_psw[MAX_PATTERNS] = {IPSW1,IPSW2,IPSW3,IPSW4,IPSW5,IPSW6}; ! 97: /*expected flag values */ ! 98: static long exp_psw[MAX_PATTERNS] = {EPSW1,EPSW2,EPSW3,EPSW4,EPSW5,EPSW6}; ! 99: /*expected destination */ ! 100: static long exp[MAX_PATTERNS] = {EXP1,EXP2,EXP3,EXP4,EXP5,EXP6}; ! 101: /*sum values */ ! 102: static long s[MAX_PATTERNS] = {SUM1,SUM2,SUM3,SUM4,SUM5,SUM6}; ! 103: /*add values */ ! 104: static long a[MAX_PATTERNS] = {ADD1,ADD2,ADD3,ADD4,ADD5,ADD6}; ! 105: ! 106: ! 107: static long savvec4; ! 108: static long old_psw; ! 109: ! 110: ! 111: adwc() ! 112: { ! 113: asm("movl $2,_no_opr"); ! 114: for (index = 0; index < MAX_PATTERNS; index++) t_adwc(); ! 115: asm("jmp *return"); ! 116: } ! 117: ! 118: ! 119: static t_adwc() ! 120: { char *msg; ! 121: for(;;) ! 122: { ! 123: asm("a1: movab a1,_stpc"); ! 124: sum = s[index]; /*initialize sum, addend, & psw */ ! 125: add = a[index]; ! 126: asm("movw _index,r11"); ! 127: asm("shll $16,_i_psw[r11],_savvec4"); ! 128: asm("bicpsw $PSWMASK"); ! 129: asm("movpsl _old_psw"); ! 130: ! 131: if (index==0) { ! 132: setjmp(); ! 133: asm("movl $1,_subtst"); ! 134: asm("bispsw _savvec4"); /* mem to mem */ ! 135: asm("adwc _add,_sum"); ! 136: asm("movpsl _psw"); /*save psw */ ! 137: } ! 138: if (index==1) { ! 139: setjmp(); ! 140: asm("movl $2,_subtst"); ! 141: asm("movl _add,r6"); /* reg to mem */ ! 142: asm("bicpsw $PSWMASK"); ! 143: asm("bispsw _savvec4"); ! 144: asm("adwc r6,_sum"); ! 145: asm("movpsl _psw"); /*save psw */ ! 146: asm("movl r6,_add"); ! 147: } ! 148: if (index==2) { ! 149: setjmp(); ! 150: asm("movl $3,_subtst"); ! 151: asm("movl _sum,r7"); /* mem to reg */ ! 152: asm("bicpsw $PSWMASK"); ! 153: asm("bispsw _savvec4"); ! 154: asm("adwc _add,r7"); ! 155: asm("movpsl _psw"); /*save psw */ ! 156: asm("movl r7,_sum"); ! 157: } ! 158: if (index==3) { ! 159: setjmp(); ! 160: asm("movl $4,_subtst"); ! 161: asm("movl _add,r6"); /* reg to reg */ ! 162: asm("movl _sum,r7"); ! 163: asm("bicpsw $PSWMASK"); ! 164: asm("bispsw _savvec4"); ! 165: asm("adwc r6,r7"); ! 166: asm("movpsl _psw"); /*save psw */ ! 167: asm("movl r6,_add"); ! 168: asm("movl r7,_sum"); ! 169: } ! 170: if (index==4) { ! 171: setjmp(); ! 172: asm("movl $5,_subtst"); ! 173: asm("bicpsw $PSWMASK"); ! 174: asm("bispsw _savvec4"); /* mem to mem */ ! 175: asm("adwc _add,_sum"); ! 176: asm("movpsl _psw"); /*save psw */ ! 177: } ! 178: if (index==5) { ! 179: setjmp(); ! 180: asm("movl $6,_subtst"); ! 181: asm("bicpsw $PSWMASK"); ! 182: asm("bispsw _savvec4"); /* mem to mem */ ! 183: asm("adwc _add,_sum"); ! 184: asm("movpsl _psw"); /*save psw */ ! 185: } ! 186: psw &= FLAGS; /*mask out all bits except flag bits */ ! 187: if (sum != exp[index]) ! 188: { ! 189: asm("movl $1,_ercode"); ! 190: if (scoplp) longjmp(); ! 191: disp_error(sum,exp[index],a[index],s[index]); ! 192: } ! 193: if (add != a[index]) ! 194: { ! 195: asm("movl $3,_ercode"); ! 196: if (scoplp) longjmp(); ! 197: disp_error(add,a[index],a[index],s[index]); ! 198: } ! 199: if (psw != exp_psw[index]) ! 200: { ! 201: asm("movl $2,_ercode"); ! 202: if (scoplp) longjmp(); ! 203: disp_error(psw,exp_psw[index],a[index],s[index]); ! 204: } ! 205: else ! 206: if (force_lp) longjmp(); ! 207: return(0); ! 208: } ! 209: } ! 210:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.