**aem0.mc - last modified November 9, 1979 3:54 PM gmcd
** OIS version - eliminates JUNK wakeup at N2
** OIS version - eliminates IDIS wakeup at N16
TITLE[aem0.mc... November 9, 1979 7:09 PM];
TOP LEVEL;
%
November 9, 1979 7:08 PM
Fix placement proble with new junk task stuff.
November 9, 1979 3:54 PM
Add JunkTask init & main loop code (it maintains tripple precision event counters)
%
***** - - - - - - - - - -
** MODEL1 OIS version
***** - - - - - - - - - -
* canonical place to restart the Alto Emulator running as DHT task
* branch here when display task sees the boot button down
set[xtask, IP[DHT]];
Boot: nop, at[emuBootLoc];
call[TasksOFF];
taskingon;
T← TaskBase;
subroutine;*****
Link← T;*Setup emulator task’s TPC
top level;*****
LDTPC← EMU;
block;
breakpoint, branch[.];
***** - - - - - - - - - -
* do some necessary initialization
***** - - - - - - - - - -
set[xtask, IP[EMU]];
knowrbase[AC0];
startEmulator:
call[InitDefaultDisk];** for boots going thru initmap
TerminalHi← A0;** tell dispY to load HRAM
***** - - - - standard place to start
SW:
nop, TaskInitAddr[EMU];
taskingoff;
rbase← rbase[AC0], call[setupBRs];* returns with membase set up
CRY← A0;
T← EmuBrHiReg;
ASAHiReg← T;** for ois terminal
T← 100000C;
NWW← T, NORESCHEDULE;* start with interrupts disabled
T← 33C;* ALUF[15]← A and (not B)
ALUFMRW← T, ALUF[15];
** make sure keys are all 1’s
*** core image does not contain page 376b
T← 177000C;
T← T + (34C);
T← (store← T) + 1, dbuf← 177777C;* 177034
T← (store← T) + 1, dbuf← 177777C;* 177035
T← (store← T) + 1, dbuf← 177777C;* 177036
store← T, dbuf← 177777C;* 177037
temp17← TaskBase;
***** - - - - - - - - - -
T← (temp17) + (JNKAddr);* TaskBase + TASKN[JNK]
subroutine;****
Link← T;*Setup ether input task’s TPC
top level;****
LDTPC← JNK;
***** - - - - - - - - - -
T← (temp17) + (EOTAddr);* TaskBase + TASKN[EOT]
subroutine;****
Link← T;*Setup ether output task’s TPC
top level;****
LDTPC← EOT;
***** - - - - - - - - - -
T← (temp17) + (EITAddr);* TaskBase + TASKN[EIT]
subroutine;****
Link← T;*Setup ether input task’s TPC
top level;****
LDTPC← EIT;
***** - - - - - - - - - -
T← (temp17) + (DSKAddr);* TaskBase + TASKN[DSK]
subroutine;****
Link← T;*Setup disk task’s TPC
top level;****
LDTPC← DSK;
***** - - - - - - - - - -
T← (temp17) + (FLTAddr);* TaskBase + TASKN[FLT]
subroutine;****
Link← T;*Setup fault task’s TPC
top level;****
LDTPC← FLT;
***** - - - - - - - - - -
T← (temp17) + (DHTLoc);* TaskBase + TASKN[DHT]
subroutine;****
Link← T;*Setup DDC task’s TPC
top level;****
LDTPC← DHT;
***** - - - - - - - - - -
T← (temp17) + (DWTLoc);* TaskBase + TASKN[DWT]
subroutine;****
Link← T;*Setup DDC task’s TPC
top level;****
LDTPC← DWT;
taskingon;*So tasks can run
n2: WakeUp[JNK];
n14: WakeUp[DSK];
n7: WakeUp[EIT];
n6: WakeUp[EOT];
n3: WakeUp[DHT];
**** alto boot sequence *****
ABoot:
Xreg← 400C;
Xreg← (Xreg) + (20C);
store← Xreg, T← (dbuf← 0C);* zero the display header pointer
kbwait:* wait long enough to read keyboard
XReg ← 35C;* at least 0.1 seconds!!
CNT ← XReg;
Branch[., cnt#0&-1];
T← T + 1;
branch[kbwait, alu#0];
T← 177000C;
Xreg← T or (34C);
fetch← Xreg;* first keyboard word
T← 177777C;
Ireg← T xor md;
branch[EBoot, R odd], Ireg;* BS key was down
Ireg← BootTries;
DiskBoot:
Xreg← 1C;
Xreg← (store← Xreg) + 1, dbuf← 0C;* making up disk command
Xreg← (store← Xreg) + 1, dbuf← 0C;* initial status
Xreg← (store← Xreg) + 1, dbuf← ACmmdSeal;* read command
T← 400C;
T← T + (2C);
Xreg← (store← Xreg) + 1, dbuf← T;* store header at 402
Xreg← (store← Xreg) + 1, dbuf← T;* store label at 402
Xreg← (store← Xreg) + 1, dbuf← 1C;* store data at 1
Xreg← (store← Xreg) + 1, dbuf← 0C;
Xreg← (store← Xreg) + 1, dbuf← 0C;
Xreg← (store← Xreg) + 1, dbuf← 0C;
Xreg← (store← Xreg) + 1, dbuf← 0C;* diskAddr 0
db1:
Xreg← 400C;
Xreg← (Xreg) + (123C);
Xreg← (store← Xreg) - 1, dbuf← 177777C;* previous diskAddr
Xreg← (store← Xreg) - 1, dbuf← 0C;
store← Xreg, dbuf← 1C;*521b← 1b
*** look for disk status in loc 2b
KWait:
fetch← 2S;
T← DoneStatus;
pd← T and md;
branch[KWait, alu=0], T← 3C;* error bits in status word
pd← T and md;
branch[.+2, alu#0];
branch[start], PC← 1C;* succuessful xfer, run the code
Ireg← (Ireg) - 1;
branch[DiskBoot, alu>=0], pd← Ireg;* too many tries?
DiskBootError:
branch[initmap], breakpoint;* even restore didn’t work
***** - - - - - - - - - -
subroutine;
*** uses Xreg as temp
***** - - - - - - - - - -
** EmuBrHiValX = EmuBrHiVal - 1, for ’negative’ indexing
** usual case is EmuBrHiVal = 0, EmuBrHiValX = 377b
** for DoradoLisp, values are 77b and 76b *****
setupBRs:
EmuBrHiReg← EmuBrHiVal;
EmuXMBrHiReg← EmuBrHiVal;
Xreg← A0;
T← 37C;
Cnt← T, T← A0;
doBRs: Membase← T;
BrHi← EmuBrHiReg;
BrLo← Xreg;
T← T + (400C), branch[doBRs, Cnt#0&-1];
** IO base registers used for negative indexing
T← (EmuBrHiReg) - 1;
membase← EIBR;* {EmuBrHiValX,,xxx}
BrHi← T;
membase← EOBR;* {EmuBrHiValX,,xxx}
BrHi← T;
** points to page 1
membase← AemBr400;* {EmuBrHiVal,,400}
T← 400C;
BrLo← T;
membase← AemBr0, return;* return with correct membase
***** - - - - - - - - - -
TasksOFF:
TaskingOff;
rbase← rbase[Yreg];
Yreg← Link;
top level;****
T← 2000C;*ShutUp Timer Task
MOS← T;
T ← 177400C; * T←DDCStatics, but Defs aren’t compiled yet
TIOA ← T;
T ← 3C; * T←AllShutUp, but defs not compiled yet- shut off DDC
OUTPUT ← T;
rbase← rbase[Krscr7];
call[clear-disk];* clear any pending disk TWs - uses Krscr7
call[ResetEther];* reset Ethernet hardware
rbase← rbase[Yreg], T← A0;* reset TIOA addr
subroutine;
link← Yreg;
TIOA← T, return;
***** - - - - - - - - - -
*** some locations for doing code patching
**** make sure FF is not used for LONGGO
***** - - - - - - - - - -
lx0:taskingon;
taskingon, pd← T;
branch[.+2, alu=0], taskingon;
taskingon;
taskingon, pd← T;
branch[.+2, alu#0], taskingon;
taskingon;
lx7: branch[lx0], taskingon;
* November 9, 1979 7:09 PM
m[EventCntA’, IFA[BSEL,ER[Multiple.B.sources],FF256[171]] B ];
m[EventCntB’, IFA[BSEL,ER[Multiple.B.sources],FF256[174]] B ];
m[test←, FF256[101] B←];
set[xtask, 1];
junkTaskInit:* maintain tripple precision event counters
noop, TaskInitAddr[JNK];* for placement.
RBASE ← rbase[eventAHi0];
junkTaskLoop:
(EventALo)-(EventCntA’)-1;
PD←EventAovFlag, branch[.+2, ALU>=0];
eventAovFlag ← t-t-1, branch[.+3];
eventAovFlag ← a0, branch[.+2, ALU>=0];
eventAHi1 ← (eventAHi1)+1;
skpif[carry’];
eventAHi0 ← (eventAHi0)+1;
(EventBLo)-(EventCntB’)-1;
PD←EventBovFlag, branch[.+2, ALU>=0];
eventBovFlag ← t-t-1, branch[.+3];
eventBovFlag ← a0, branch[.+2, ALU>=0];
eventBHi1 ← (eventBHi1)+1;
skpif[carry’];
branch[junkTaskLoop], eventBHi0 ← (eventBHi0)+1, block;