// SwatDiskInit.bcpl - Disk stuff
// Copyright Xerox Corporation 1979
// Last modified February 27, 1979  8:50 PM by Boggs

get "AltoFileSys.d"
get "Swat.decl"
get "SwatDisk.decl"

external
[
// outgoing procedures
InitDisk

// incoming procedures
CreateKVM
Allocate; MoveBlock
OpenFile; Closes; WriteBlock
ExtractSubstring

// outgoing statics
fpSwat

// incoming statics
sysZone; vm
SWATEEP2; SWATDA; DUMPER
]

static fpSwat

//----------------------------------------------------------------------------
let InitDisk() be
//----------------------------------------------------------------------------
[
vm = CreateKVM(ExtractSubstring("Swat"), true)
SWATDA!0 = vm>>KVM.fp.leaderVirtualDa  // boot disk address for Swat
fpSwat = Allocate(sysZone, lFP); MoveBlock(fpSwat, lv vm>>KVM.fp, lFP)
MoveBlock(lv (@567b)>>SCM.fpSwat, lv vm>>KVM.fp, lFP)  //install in OS
(vm>>VM.destroy)(vm)

vm = CreateKVM(ExtractSubstring("Swatee"), true)
MoveBlock(lv (@567b)>>SCM.fpSwatee, lv vm>>KVM.fp, lFP)  //install in OS

SWATEEP2!0 = vm>>KVM.DAs↑2  // real da for page --> 2 <-- of Swatee
SWATEEP2!5 = vm>>KVM.fp.version
SWATEEP2!6 = vm>>KVM.fp.serialNumber.word1
SWATEEP2!7 = vm>>KVM.fp.serialNumber.word2
let dumper = OpenFile("Dumper.Boot")
WriteBlock(dumper, DUMPER, 400B)
Closes(dumper)
]