From 4e0c27f01690fc294e1f3355ce770fe027333415 Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Thu, 28 Aug 2003 20:47:25 +0000 Subject: [PATCH] Adjust registers used when starting programs. Some demos expect undocumented values. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@660 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/task.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/kernel/task.c b/kernel/task.c index 9fb30fd..2039203 100644 --- a/kernel/task.c +++ b/kernel/task.c @@ -304,12 +304,16 @@ int load_transfer(UWORD ds, exec_blk *exp, UWORD fcbcode, COUNT mode) /* build the user area on the stack */ irp = (iregs FAR *)(exp->exec.stack - sizeof(iregs)); - /* start allocating REGs */ - irp->ES = irp->DS = ds; + /* start allocating REGs (as in MS-DOS - some demos expect them so --LG) */ + /* see http://www.beroset.com/asm/showregs.asm */ + irp->DX = irp->ES = irp->DS = ds; irp->CS = FP_SEG(exp->exec.start_addr); - irp->IP = FP_OFF(exp->exec.start_addr); - irp->AX = fcbcode; - irp->BX = irp->CX = irp->DX = irp->SI = irp->DI = irp->BP = 0; + irp->SI = irp->IP = FP_OFF(exp->exec.start_addr); + irp->DI = FP_OFF(exp->exec.stack); + irp->BP = 0x91e; /* this is more or less random but some programs + expect 0x9 in the high byte of BP!! */ + irp->AX = irp->BX = fcbcode; + irp->CX = 0xFF; irp->FLAGS = 0x200; if (InDOS)