* fixed a bug in the startup code for tiny memory model, which caused the

program MCB address not to be calculated correctly, when the program is a tiny
  model .exe file, leading to possible memory corruption. Previously, the code
  assumed that dos_psp=CS, but that's only true for tiny .com files; tiny .exe
  files have a 256-byte gap between dos_psp and CS.

git-svn-id: trunk@28032 -
This commit is contained in:
nickysn 2014-06-22 11:06:57 +00:00
parent cd6b15f49a
commit 3164a10d9d

View File

@ -147,15 +147,14 @@ cpu_detect_done:
; allocate max heap
; TODO: also support user specified heap size
; try to resize our main DOS memory block until the end of the data segment
%ifdef __TINY__
mov cx, cs
mov dx, 1000h ; 64kb in paragraphs
%else
mov cx, word [dos_psp]
%ifdef __TINY__
mov dx, cs
%else
mov dx, dgroup
%endif
sub dx, cx ; dx = (ds - psp) in paragraphs
add dx, 1000h ; 64kb in paragraphs
%endif
; get our MCB size in paragraphs
dec cx