From 1967c06b858c37964d1482ce3ca6b0796fdf7b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Sun, 26 Sep 2021 11:33:03 +0300 Subject: [PATCH] Fix shift used for converting KiB to paragraphs The old code was essentially a no-op due to x86 taking shifts mod 32. This lead DOS to believe that it had 10KiB of memory, which is not enough to contain io.sys, the DOS kernel, and command.com. This causes command.com to overwrite the DOS kernel when it goes to relocate itself at the end of the memory, leading to system crash. --- io.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/io.asm b/io.asm index 11dc5ed..4bd50b9 100644 --- a/io.asm +++ b/io.asm @@ -60,8 +60,8 @@ init: ; AX = memory size in kilobytes ; We want it in paragraphs ; There are 64 paragraphs in a kilobyte - mov cx, 64 - shl al, cl + mov cx, 6 + shl ax, cl ; Memory size is passed in dx mov dx, ax