forked from virtualagc/virtualagc
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Branch "block1" (i.e., the Block I AGC and DSKY simulations) merged into
master (making the block1 branch obsolete). The VirtualAGC GUI now runs Solarium 55 (i.e., the Block I AGC code), using either the control-panel or nav-bay DSKY styles, as well as Sunburst 120 (Apollo 5) and Aurora 12.
- Loading branch information
1 parent
9d64319
commit e13bee8
Showing
260 changed files
with
43,459 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/**************************************************************************** | ||
* ADR - MEMORY ADDRESS subsystem | ||
* | ||
* AUTHOR: John Pultorak | ||
* DATE: 9/22/01 | ||
* FILE: ADR.cpp | ||
* | ||
* NOTES: see header file. | ||
* | ||
***************************************************************************** | ||
*/ | ||
#include "reg.h" | ||
#include "ADR.h" | ||
#include "SEQ.h" | ||
#include "BUS.h" | ||
regS ADR::register_S; // address register | ||
regBNK ADR::register_BNK; // bank register | ||
// transfer bits 14-11 from the bus into the 4-bit bank register | ||
unsigned ADR::conv_WBK[] = | ||
{ BX, BX, BX, BX, BX, BX, BX, BX, BX, BX, BX, BX, B14, B13, B12, B11 }; | ||
void | ||
ADR::execWP_WS() | ||
{ | ||
register_S.write(BUS::glbl_WRITE_BUS); | ||
} | ||
void | ||
ADR::execRP_RBK() | ||
{ | ||
BUS::glbl_READ_BUS = register_BNK.read() << 10; | ||
} | ||
void | ||
ADR::execWP_WBK() | ||
{ | ||
register_BNK.writeShift(BUS::glbl_WRITE_BUS, ADR::conv_WBK); | ||
} | ||
bool | ||
ADR::GTR_27() | ||
{ | ||
return (register_S.read() > 027); | ||
} | ||
bool | ||
ADR::GTR_17() | ||
{ | ||
// check: address is not a central register | ||
return (register_S.read() > 017); | ||
} | ||
bool | ||
ADR::EQU_25() | ||
{ | ||
return (register_S.read() == 025); | ||
} | ||
bool | ||
ADR::EQU_17() | ||
{ | ||
// check: instruction is INHINT (INDEX 017) | ||
return (register_S.read() == 017); | ||
} | ||
bool | ||
ADR::EQU_16() | ||
{ | ||
// check: instruction is RELINT (INDEX 016)) | ||
return (register_S.read() == 016); | ||
} | ||
bool | ||
ADR::GTR_1777() | ||
{ | ||
// check: address is fixed memory | ||
return (register_S.read() > 01777); | ||
} | ||
unsigned | ||
ADR::bankDecoder() | ||
{ | ||
// Memory is organized into 13 banks of 1K words each. The banks are numbered | ||
// 0-12. Bank 0 is erasable memory; banks 1-12 are fixed (rope) memory. The 10 | ||
// lower bits in the S register address memory inside a bank. The 2 upper bits | ||
// in the S register select the bank. If the 2 upper bits are both 1, the 4-bit | ||
// bank register is used to select the bank. | ||
// 12 11 Bank | ||
// 0 0 0 erasable memory | ||
// 0 1 1 fixed-fixed 1 memory | ||
// 1 0 2 fixed-fixed 2 memory | ||
// 1 1 3-12 fixed-switchable memory (bank register selects bank) | ||
unsigned bank = ADR::register_S.readField(12, 11); | ||
if (bank == 3) | ||
{ | ||
// fixed-switchable | ||
if (register_BNK.read() <= 03) // defaults to 6000 - 7777 | ||
return 03; | ||
else | ||
return register_BNK.read(); // 10000 - 31777 | ||
} | ||
else | ||
return bank; // erasable or fixed-fixed | ||
} | ||
unsigned | ||
ADR::getEffectiveAddress() | ||
{ | ||
// Return the 14-bit address selected by lower 10 bits of the S register (1K) | ||
// and the bank decoder (which selects the 1K bank) | ||
unsigned lowAddress = ADR::register_S.readField(10, 1); | ||
if (ADR::bankDecoder() == 0) | ||
return lowAddress; | ||
unsigned highAddress = ADR::bankDecoder() << 10; | ||
return highAddress | lowAddress; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/**************************************************************************** | ||
* ADR - MEMORY ADDRESS subsystem | ||
* | ||
* AUTHOR: John Pultorak | ||
* DATE: 9/22/01 | ||
* FILE: ADR.h | ||
* | ||
* VERSIONS: | ||
* | ||
* DESCRIPTION: | ||
* Memory address for the Block 1 Apollo Guidance Computer prototype (AGC4). | ||
* | ||
* SOURCES: | ||
* Mostly based on information from "Logical Description for the Apollo | ||
* Guidance Computer (AGC4)", Albert Hopkins, Ramon Alonso, and Hugh | ||
* Blair-Smith, R-393, MIT Instrumentation Laboratory, 1963. | ||
* | ||
* NOTES: | ||
* | ||
***************************************************************************** | ||
*/ | ||
#ifndef ADR_H | ||
#define ADR_H | ||
enum specialRegister | ||
{ // octal addresses of special registers | ||
// Flip-Flop registers | ||
A_ADDR = 00, | ||
Q_ADDR = 01, | ||
Z_ADDR = 02, | ||
LP_ADDR = 03, | ||
IN0_ADDR = 04, | ||
IN1_ADDR = 05, | ||
IN2_ADDR = 06, | ||
IN3_ADDR = 07, | ||
OUT0_ADDR = 010, | ||
OUT1_ADDR = 011, | ||
OUT2_ADDR = 012, | ||
OUT3_ADDR = 013, | ||
OUT4_ADDR = 014, | ||
BANK_ADDR = 015, | ||
// No bits in these registers | ||
RELINT_ADDR = 016, | ||
INHINT_ADDR = 017, | ||
// In eraseable memory | ||
CYR_ADDR = 020, | ||
SR_ADDR = 021, | ||
CYL_ADDR = 022, | ||
SL_ADDR = 023, | ||
ZRUPT_ADDR = 024, | ||
BRUPT_ADDR = 025, | ||
ARUPT_ADDR = 026, | ||
QRUPT_ADDR = 027, | ||
}; | ||
class regS : public reg | ||
{ | ||
public: | ||
regS() : | ||
reg(12, "%04o") | ||
{ | ||
} | ||
}; | ||
class regBNK : public reg | ||
{ | ||
public: | ||
regBNK() : | ||
reg(4, "%02o") | ||
{ | ||
} | ||
}; | ||
class ADR | ||
{ | ||
friend class MON; | ||
friend class MEM; | ||
friend class CLK; | ||
friend class CPM; | ||
public: | ||
static void | ||
execWP_WS(); | ||
static void | ||
execRP_RBK(); | ||
static void | ||
execWP_WBK(); | ||
static bool | ||
GTR_17(); // for MBF, CPM | ||
static bool | ||
GTR_27(); // for PAR | ||
static bool | ||
EQU_16(); // for CPM | ||
static bool | ||
EQU_17(); // for CPM | ||
static bool | ||
EQU_25(); // for SEQ | ||
static bool | ||
GTR_1777(); // for CPM | ||
static unsigned | ||
getEffectiveAddress(); | ||
private: | ||
static regS register_S; // address register | ||
static regBNK register_BNK; // bank register | ||
static unsigned | ||
bankDecoder(); | ||
static unsigned conv_WBK[]; | ||
}; | ||
#endif |
Oops, something went wrong.