DO
ok: BOOLEAN;
IF (ok ← getPage[pageBuffer])
THEN
BEGIN
ENABLE BadPage, Error =>
IF thisPage=hardUCodeStart THEN GOTO firstPageBad
ELSE {thisPage ← [thisPage+1]; RETRY};
IF thisPage>=hardUCodeStart+hardUCodeSize THEN ERROR MicrocodeInstallFailure[microcodeTooBig];
label ← initialMicrocodeLabel;
label.dontCare ← channel.GetBootChainLink[[thisPage+1]];
Transfer[channel: channel, firstPage: thisPage, pageCount: 1, command: [verify, write, write], label: @label, data: pageBuffer];
label ← initialMicrocodeLabel;
Transfer[channel: channel, firstPage: thisPage, pageCount: 1, command: [verify, verify, verify], label: @label, data: pageBuffer];
END;
IF thisPage#Disk.PageNumber[prevPage+1]
OR ~ok
THEN
BEGIN ENABLE BadPage, Error => GOTO flakeyPageFound;
label ← initialMicrocodeLabel;
Transfer[channel: channel, firstPage: prevPage, pageCount: 1, command: [verify, verify, read], label: @label, data: pageBuffer];
label ← initialMicrocodeLabel;
label.dontCare ← IF ok THEN channel.GetBootChainLink[thisPage] ELSE eofLink;
Transfer[channel: channel, firstPage: prevPage, pageCount: 1, command: [verify, write, write], label: @label, data: pageBuffer];
END;
IF ~ok THEN EXIT;
thisPage ← [(prevPage ← thisPage)+1];
REPEAT
firstPageBad => ERROR MicrocodeInstallFailure[firstPageBad];
flakeyPageFound => ERROR MicrocodeInstallFailure[flakeyPageFound];
ENDLOOP;