From e376d4a002061cad847c116d9c69c23c31a0db39 Mon Sep 17 00:00:00 2001 From: IonutParau Date: Tue, 17 Feb 2026 14:37:34 +0100 Subject: [PATCH] bugfix --- rewrite/minBIOS.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/rewrite/minBIOS.lua b/rewrite/minBIOS.lua index 10bc800..97cc702 100644 --- a/rewrite/minBIOS.lua +++ b/rewrite/minBIOS.lua @@ -52,14 +52,21 @@ local function getBootCode(addr) return load(string.sub(codeSec, 1, term and (term - 1) or -1)) end -- TODO: whatever else NC might be testing + + -- Read first 32K, which is a standard convention local sectorsIn32K = math.ceil(32768 / sectorSize) local bootCode = {firstSector} - for i=2,sectorsIn32K do - table.insert(bootCode, drive.readSector(i)) + if not firstSector:find("\0") then + for i=2,sectorsIn32K do + local sec = drive.readSector(i) + table.insert(bootCode, sec) + if sec:find("\0") then break end + end end local rawCode = table.concat(bootCode) local term = string.find(rawCode, "\0") rawCode = string.sub(rawCode, 1, term and (term - 1) or -1) + if rawCode == "" then return end return load(rawCode) end