* fixed the msdos startup code for the cases when the largest available memory block is smaller that what would be needed for a full 64kb data segment

git-svn-id: trunk@24714 -
This commit is contained in:
nickysn 2013-06-01 13:19:10 +00:00
parent 9239adbc1e
commit 14ded034f6

View File

@ -52,15 +52,30 @@ no_bss:
; 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
mov bx, word [dos_psp]
mov es, bx
sub bx, dgroup
neg bx ; bx = (ds - psp) in paragraphs
add bx, 1000h ; 64kb in paragraphs
mov dx, word [dos_psp]
mov cx, dx
sub dx, dgroup
neg dx ; dx = (ds - psp) in paragraphs
add dx, 1000h ; 64kb in paragraphs
; get our MCB size in paragraphs
dec cx
mov es, cx
mov bx, word [es:3]
; is it smaller than the maximum data segment size?
cmp bx, dx
jbe skip_mem_realloc
mov bx, dx
inc cx
mov es, cx
mov ah, 4Ah
int 21h
jc mem_realloc_err
skip_mem_realloc:
; bx = the new size in paragraphs
add bx, word [dos_psp]
sub bx, dgroup