-- PrivateRamDefs.mesa  Last Edited by Johnsson, May 21, 1980  11:02 AM

PrivateRamDefs: DEFINITIONS =
  BEGIN
  
  Version: CARDINAL = 0;
  
  BootLocusVector: TYPE = RECORD [CARDINAL];
  
  PackedMuFile: TYPE = MACHINE DEPENDENT RECORD [
    brJunk: ARRAY [0..21B) OF UNSPECIFIED,
    -- header stuff in .br file prepared by Packmu.Run
    blv: BootLocusVector, -- put there by Packmu.Run
    constVector: ARRAY [1..maxConstAddr] OF CARDINAL,
    -- const 0 is always zero
    ramVector: ARRAY [0..maxRamAddr] OF MicroCode];
  
  MicroAddress: TYPE = [0..7777B];
  
  -- Bus Source (bs) field values when not used as part of a Const address
  
  ReadR: CARDINAL = 0;
  RGets: CARDINAL = 1;
  MinusOne: CARDINAL = 2;
  ReadS: CARDINAL = 3; -- RAM related
  
  SGets: CARDINAL = 4; -- RAM related
  
  ReadMD: CARDINAL = 5;
  ReadMouse: CARDINAL = 6;
  ReadDisplacement: CARDINAL = 7;
  
  MicroCode: TYPE = MACHINE DEPENDENT RECORD -- for RAM-related tasks
    
    [
    -- the best definition of these fields is in Alto manual, pp. 5-7, p. 53
    r: [0..37B], -- R register select
    aluF: {
      Bus, T, BusOrT, BusAndT, BusXorT, BusPlus1, BusMinus1, BusPlusT, BusMinusT,
      BusMinusTMinus1, BusPlusTPlus1, BusPlusSkip, BusDotT, BusAndNotT, undefAlu1,
      undefAlu2},
    bs: [0..7B], -- a bus source constant or low 3 bits of const address
    f1: {
      SwMode, WrtRam, RdRam, RmrGets, taskSpec4, taskSpec5, taskSpec6, taskSpec7,
      Noop, MarGets, Task, Block, Llsh1, Lrsh1, Llcy8, ReadConst},
    f2: {
      taskSpec0, taskSpec1, taskSpec2, taskSpec3, taskSpec4, taskSpec5, taskSpec6,
      taskSpec7, Noop, BusEq0, ShLt0, ShEq0, Bus, AluCy, MdGets, ReadConst},
    loadT: {no, yes},
    loadLM: {yes, no}, -- inverted bit
    next: [0..1777B] -- next MicroInstruction Address
    ];
  EmSTART: CARDINAL = 20B; -- microaddress of Alto emulator main loop
  
  maxConstAddr: MicroAddress = 377B;
  maxRamAddr: MicroAddress = 1777B;
  
  RamImage: TYPE = DESCRIPTOR FOR ARRAY OF MicroCode;
  
  ConstantImage: TYPE = DESCRIPTOR FOR ARRAY [1..maxConstAddr] OF CARDINAL;
  
  END...