|
|
1.1 ! root 1: /* Copyright (c) 1982, Regents, University of California */ ! 2: #define ADDQ 5 ! 3: #define ADD 13 ! 4: #define IMMED 074 ! 5: /* These structures are here for looks, only */ ! 6: struct add { short op:4, reg:3, mode:3, ea:6; } x; ! 7: struct addq { short op:4, data:3, size:3, ea:6; } y; ! 8: nargs(arg) ! 9: long arg; /* this is only here for address calculation */ ! 10: { ! 11: register long *a5; ! 12: register handy; ! 13: register char reg, mode, ea; ! 14: #define size mode ! 15: #define data reg ! 16: ! 17: a5 = (&arg) - 2; /* this points to old a6 */ ! 18: a5 = (long *) *a5; /* a5 now = my parents a6 */ ! 19: a5 = (long *) a5[1]; /* pick up return address into a5 */ ! 20: ! 21: handy = * (short *)a5; ! 22: ea = handy & 077; handy >>= 6; ! 23: mode = handy & 07; handy >>= 3; ! 24: reg = handy & 07; handy >>= 3; ! 25: /* op = handy & 017; */ ! 26: switch(handy & 017) { ! 27: case ADD: ! 28: if(reg!=7) ! 29: return(0); /* this instruction doesn't adjust the sp */ ! 30: if(ea!=IMMED) ! 31: return(0); /* too hard to decode adjustment */ ! 32: handy = (long) (1 + (short *) a5); ! 33: if(mode==03) { /* addw #n,a7 */ ! 34: handy = *(short *)handy; ! 35: return(handy >> 2); ! 36: } ! 37: if(mode==07) { /* addl #n,a7 */ ! 38: handy = *(long *)handy; ! 39: return(handy >> 2); ! 40: } ! 41: else return(0); /* this was doing something to d7 */ ! 42: case ADDQ: ! 43: if(ea!=017) ! 44: return(0); /* this doesn't adjust a7 */ ! 45: if(size!=02) ! 46: return(0); /* should complain -- we are doing ! 47: addq[bw] something,a7 */ ! 48: switch(data) { ! 49: case 0: return(2); ! 50: case 4: return(1); ! 51: } ! 52: } ! 53: return(0); ! 54: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.