From b69b424ebecb2edb93e1aaa09afa3a44cc4c4c0c Mon Sep 17 00:00:00 2001 From: IonutParau Date: Mon, 16 Feb 2026 13:59:10 +0100 Subject: [PATCH] fixed MBR --- rewrite/minBIOS.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rewrite/minBIOS.lua b/rewrite/minBIOS.lua index 11991d8..89d1273 100644 --- a/rewrite/minBIOS.lua +++ b/rewrite/minBIOS.lua @@ -47,8 +47,9 @@ local function getBootCode(addr) -- Generic MBR bootcode if firstSector:sub(-2, -1) == "\x55\xAA" then local codeEnd = sectorSize - 66 - local term = string.find(firstSector, "\0", 5, true) - return load(string.sub(firstSector, 5, term and (term - 1) or codeEnd)) + local codeSec = string.sub(firstSector, 1, codeEnd) + local term = string.find(codeSec, "\0", 5, true) + return load(string.sub(codeSec, 0, term and (term - 1) or -1)) end -- TODO: whatever else NC might be testing local sectorsIn32K = math.ceil(32768 / sectorSize)