// SaveRegs.bcpl

external SaveRegs

static regValues

let SaveRegs() be
[
let regs = table [ 14B; 71B; 72B; 73B; 74B; 75B; 76B ]
regValues = table [ 0; 0; 0; 0; 0; 0; 0 ]
manifest nRegs = 7

let WriteRam = table [ 55001B; 35003B; 61012B; 35001B; 1401B ]
let JumpRam = table [ 61010B; 1401B ]

// Microcode to be executed:
//	1000:	L← Reg, SWMODE, :1001;
//	1001:	AC0← L, :START;

WriteRam(014030B, 1001B, 102020B)

for i = 0 to nRegs-1 do
   [
   WriteRam((regs!i ge 40B? 60B, 0B) + regs!i lshift 11, 1000B, 101001B)
   regValues!i = JumpRam(nil, 1000B)
   ]
]