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.
This commit is contained in:
Juhani Krekelä 2021-09-26 11:33:03 +03:00
parent 2cab8ae6cf
commit 1967c06b85
1 changed files with 2 additions and 2 deletions

4
io.asm
View File

@ -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