0: mar := pc; rd; { begin to fetch a Mac-1 instruction } 1: pc := pc + 1; rd; { and increment the PC } 2: ir := mbr; if n then goto 28; { finish fetch; decode: 0xxx or 1xxx ? } 3: tir := lshift(ir + ir); if n then goto 19; { decode: 00xx or 01xx ? } 4: tir := lshift(tir); if n then goto 11; { decode: 000x or 001x ? } 5: alu := tir; if n then goto 9; { decode: 0000 or 0001 ? } 6: mar := ir; rd; { execute: 0000 LODD } 7: rd; 8: ac := mbr; goto 0; { finish execution; go back to fetch } 9: mar := ir; mbr := ac; wr; { execute: 0001 STOD } 10: wr; goto 0; { finish execution; go back to fetch } 11: alu := tir; if n then goto 15; { decode: 0010 or 0011 ? } 12: mar := ir; rd; { execute: 0010 ADDD } 13: rd; 14: ac := mbr + ac; goto 0; { finish execution; go back to fetch } 15: mar := ir; rd; { execute: 0011 SUBD } 16: ac := ac + 1; rd; { use x - y = x + 1 + inv(y) } 17: a := inv(mbr); 18: ac := ac + a; goto 0; { finish execution; go back to fetch } 19: tir := lshift(tir); if n then goto 25; { decode: 010x or 011x ? } 20: alu := tir; if n then goto 23; { decode: 0100 or 0101 ? } 21: alu := ac; if n then goto 0; { execute: 0100 JPOS; maybe back to fetch } 22: pc := band(ir, amask); goto 0; { do the jump; go back to fetch } 23: alu := ac; if z then goto 22; { execute: 0101 JZER } 24: goto 0; { no jump; go back to fetch } 25: alu := tir; if n then goto 27; { decode: 0110 or 0111 ? } 26: pc := band(ir, amask); goto 0; { execute: 0110 JUMP; go back to fetch } 27: ac := band(ir, amask); goto 0; { execute: 0111 LOCO; go back to fetch } 28: tir := lshift(ir + ir); if n then goto 40; { decode: 10xx or 11xx ? } 29: tir := lshift(tir); if n then goto 35; { decode: 100x or 101x ? } 30: alu := tir; if n then goto 33; { decode: 1000 or 1001 ? } 31: a := ir + sp; { execute: 1000 LODL } 32: mar := a; rd; goto 7; { finish by reusing code at line 7 } 33: a := ir + sp; { execute: 1001 STOL } 34: mar := a; mbr := ac; wr; goto 10; { finish by reusing code at line 10 } 35: alu := tir; if n then goto 38; { decode: 1010 or 1011 ? } 36: a := ir + sp; { execute: 1010 ADDL } 37: mar := a; rd; goto 13; { finish by reusing code at line 13 } 38: a := ir + sp; { execute: 1011 SUBL } 39: mar := a; rd; goto 16; { finish by reusing code at line 16 } 40: tir := lshift(tir); if n then goto 46; { decode: 110x or 111x ? } 41: alu := tir; if n then goto 44; { decode: 1100 or 1101 ? } 42: alu := ac; if n then goto 22; { execute: 1100 JNEG } 43: goto 0; { no jump; go back to fetch } 44: alu := ac; if z then goto 0; { execute: 1101 JNZE } 45: pc := band(ir, amask); goto 0; { finish execution; go back to fetch } 46: tir := lshift(tir); if n then goto 50; { decode: 1110 or 1111 ? } 47: sp := sp + (-1); { execute: 1110 CALL } 48: mar := sp; mbr := pc; wr; 49: pc := band(ir, amask); wr; goto 0; { finish execution; go back to fetch } 50: tir := lshift(tir); if n then goto 65; { decode: 1111 0xxx or 1111 1xxx ? } 51: tir := lshift(tir); if n then goto 59; { decode: 1111 00xx or 1111 01xx ? } 52: alu := tir; if n then goto 56; { decode: 1111 000x or 1111 001x ? } 53: mar := ac; rd; { execute: 1111 000x PSHI } 54: sp := sp + (-1); rd; { 1111 0000 and 1111 0001 treated same } 55: mar := sp; wr; goto 10; { finish by reusing code at line 10 } 56: mar := sp; sp := sp + 1; rd; { execute: 1111 001x POPI } 57: rd; { 1111 0010 and 1111 0011 treated same } 58: mar := ac; wr; goto 10; { finish execution; go back to fetch } 59: alu := tir; if n then goto 62; { decode: 1111 010x or 1111 011x ? } 60: sp := sp + (-1); { execute: 1111 010x PUSH } 61: mar := sp; mbr := ac; wr; goto 10; { 1111 0100 and 1111 0101 treated same } { finish by reusing code at line 10 } 62: mar := sp; sp := sp + 1; rd; { execute: 1111 011x POP } 63: rd; { 1111 0110 and 1111 0111 treated same } 64: ac := mbr; goto 0; { finish execution; go back to fetch } 65: tir := lshift(tir); if n then goto 73; { decode: 1111 10xx or 1111 11xx ? } 66: alu := tir; if n then goto 70; { decode: 1111 100x or 1111 101x ? } 67: mar := sp; sp := sp + 1; rd; { execute: 1111 100x RETN } 68: rd; { 1111 1000 and 1111 1001 treated same } 69: pc := mbr; goto 0; { finish execution; go back to fetch } 70: a := ac; { execute: 1111 101x SWAP } 71: ac := sp; { 1111 1010 and 1111 1011 treated same } 72: sp := a; goto 0; { finish execution; go back to fetch } 73: tir := lshift(tir); if n then goto 76; { decode: 1111 110x or 1111 111x ? } 74: a := band(ir, smask); { execute: 1111 110x INSP } 75: sp := sp + a; goto 0; { finish execution; go back to fetch } 76: alu := tir; if n then goto 80; { 1111 1110 or 1111 1111, if latter: HALT } 77: a := band(ir, smask); { execute: 1111 1110 DESP } 78: a := inv(a); 79: a := a + 1; goto 75; { finish by reusing code at line 75 }