// FullBootInit.bcpl
// Copyright Xerox Corporation 1979, 1980, 1982
// Last modified April 7, 1982  6:31 PM by Boggs

get "SysDefs.d"
get "Streams.d"
get "AltoDefs.d"
get "SysInternals.d"

external
[
// outgoing procedures
FullBootInit; SysErr

// incoming procedures
InitializeZone; Allocate; GetFixedInit; Dvec
CreateDisplayStream; ShowDisplayStream
CreateKeyboardStream

// outgoing statics
dsp; sysZone; lvSysZone; lvCursorLink

// incoming statics
CursorLink; lvIdle; Idle
]

static [ dsp; sysZone; lvSysZone; lvCursorLink ]

manifest lenSysZone = 2400

//----------------------------------------------------------------------------
let FullBootInit(runBLV, bootBLV) be
//----------------------------------------------------------------------------
[
let z = lenSysZone
Dvec(FullBootInit, lv z)
sysZone = InitializeZone(z, lenSysZone)
GetFixedInit()

CreateKeyboardStream()

// pointers to the OS copies of useful statics
lvIdle = lv Idle
lvSysZone = lv sysZone
lvCursorLink = lv CursorLink

// display
dsp = CreateDisplayStream(nSysDisplayLines,
 Allocate(sysZone, 1500, false, true), 1500, 0, sysDisplayWidthInWords)
ShowDisplayStream(dsp, DSalone)

// Having DVECed sysZone into the stack frame of this procedure, we
// better not deallocate the frame when returning!
(table [ 35000b; 35401b; 1401b ])()  //lda 3 0,2; lda 3 1,3; jmp 1,3
]

//----------------------------------------------------------------------------
and SysErr(p1, errNo, p2, p3, p4, p5; numargs na) be
//----------------------------------------------------------------------------
[
let t = p1; p1 = errNo; errNo = t
(table [ 77403b; 1401b ])("sys.errors", lv p1)
]