bugfix
This commit is contained in:
@@ -52,14 +52,21 @@ local function getBootCode(addr)
|
|||||||
return load(string.sub(codeSec, 1, term and (term - 1) or -1))
|
return load(string.sub(codeSec, 1, term and (term - 1) or -1))
|
||||||
end
|
end
|
||||||
-- TODO: whatever else NC might be testing
|
-- TODO: whatever else NC might be testing
|
||||||
|
|
||||||
|
-- Read first 32K, which is a standard convention
|
||||||
local sectorsIn32K = math.ceil(32768 / sectorSize)
|
local sectorsIn32K = math.ceil(32768 / sectorSize)
|
||||||
local bootCode = {firstSector}
|
local bootCode = {firstSector}
|
||||||
for i=2,sectorsIn32K do
|
if not firstSector:find("\0") then
|
||||||
table.insert(bootCode, drive.readSector(i))
|
for i=2,sectorsIn32K do
|
||||||
|
local sec = drive.readSector(i)
|
||||||
|
table.insert(bootCode, sec)
|
||||||
|
if sec:find("\0") then break end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local rawCode = table.concat(bootCode)
|
local rawCode = table.concat(bootCode)
|
||||||
local term = string.find(rawCode, "\0")
|
local term = string.find(rawCode, "\0")
|
||||||
rawCode = string.sub(rawCode, 1, term and (term - 1) or -1)
|
rawCode = string.sub(rawCode, 1, term and (term - 1) or -1)
|
||||||
|
if rawCode == "" then return end
|
||||||
return load(rawCode)
|
return load(rawCode)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user