Article View: net.micro.pc
Article #6002.EXE file problems
From: Walter Bright
Date: Wed, 19 Mar 1986 18:31
Date: Wed, 19 Mar 1986 18:31
24 lines
1609 bytes
1609 bytes
I have recently spent much time tracking down an obscure problem with .EXE files, and am posting this so others may avoid it. The problem is that the code would work fine if there was more than 64k of free memory available past the end of the program, but would lock up the PC if there was less. I eventually traced the cause to the values of SP and SS as set by the .EXE file. It seems that there must be some allocated stack in the .EXE file, even if the first instruction executed is a CLI (turn off interrupts). Since in my program I set up my own stack, I had a stack segment with 1 byte in it (to get rid of the silly warning from LINK). MS-DOS fired up the program with SS pointing to the segment, and SP having a value of 2 in it. The crash is apparently caused by a segment wrap occurring. Note that you can't use DEBUG to single step a program with this problem. This problem exists in MS-DOS 3.0 and 3.1, and probably in the others too. This requirement is not documented. Also, methinks the linker should give a warning about this.
Technical Details
Message-ID:
<931@dataioDataio.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!princeton!orsvax1!pyrnj!caip!seismo!rochester!bullwinkle!uw-beaver!uw-june!entropy!dataio!brightShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!princeton!orsvax1!pyrnj!caip!seismo!rochester!bullwinkle!uw-beaver!uw-june!entropy!dataio!bright From: bright@dataioDataio.UUCP (Walter Bright) Newsgroups: net.micro.pc Subject: .EXE file problems Message-ID: <931@dataioDataio.UUCP> Date: Wed, 19-Mar-86 13:31:19 EST Article-I.D.: dataioDa.931 Posted: Wed Mar 19 13:31:19 1986 Date-Received: Sat, 22-Mar-86 23:11:00 EST Organization: Data I/O Corp., Redmond WA Lines: 24