Technical Field
The present invention is directed toward a method for interfacing an operating system of a computer with an application program and, more particularly, a method for interfacing an application program with an operating system of a computer wherein the operating system of the computer is stored in the high memory area of the computer's memory.
Background of the Invention
Most personal computers include an operating system for interfacing application programs with the computer. Personal computers also include a microprocessor that has a number of address lines sufficient for addressing the memory of the computer, referred to as the computer memory. The address lines define an address space of the personal computer's memory wherein the address space has an upper region and a lower region.
Typically, the operating system of a personal computer is stored in the lowest available region of the computer's address space. For this reason, certain ones of the computer's address lines are usually set to a logical zero when the operating system is being accessed. Particularly, address line 20 is normally set to logical zero when an operating system stored in the lowest available region of a personal computer's address space is being accessed. Conversely, when the operating system is stored in the upper region of the computer's address space, i.e., high memory area, address line 20 must be set to a logical one when the operating system is being accessed.
Herein, the term upper region and lower region are used to distinguish those portions of the computer's memory that are addressable with address line 20 enabled and disabled, respectively. Generally, the lower region of the computer's memory is always accessible and the upper region of the computer's memory can be made accessible under program control.
Some application programs rely upon address line 20 being set to zero during their initial stages of execution. However, if the operating system is stored in the upper region of the computer's address space, address line 20 must be set to a logical one so that the operating system can be accessed. For this reason, application programs that rely upon address line 20 being set to a logical zero when they are being executed may not operate properly when the operating system is stored in the upper region of the computer's address space. Accordingly, it is desirable to provide a method for loading application programs from a fixed storage medium into a computer's memory when the operating system of the computer is stored in the upper region of the computer's address space.
Further, after the application program has been loaded into the memory of the computer and the computer is executing the program, all calls to the operating system must be made with address line 20 set to a logical one. However, since some application programs will not operate properly if address line 20 is set to a logical one during their initial stages of execution, it is necessary to have address line 20 set to a logical zero for at least this period of time. Further, changing the state of address line 20 while an application program is executing is time consuming, increasing the overall time necessary for the application. For this reason, it is desirable to leave address line 20 set to a logical one, to enable proper access to the operating system, as much as possible. Accordingly, it is desirable to provide a method for loading application programs from a fixed storage medium into a computer's memory when the operating system of the computer is stored in the upper region of the computer's address space, which method also is capable of leaving address line 20 set for as much time as possible while an application program is being executed.
Summary of the Invention
The present invention is a method for interfacing an application program with an operating system of a computer. The computer includes a plurality of address lines for accessing an address space of the computer wherein the plurality of address lines define an upper region of the computer's address space and a lower region of the computer's address space. A predetermined address line of the computer must be in a first state to access the upper region of the address space. The method includes the steps of storing the operating system of the computer in the upper region of the computer's address space. The method also includes the step of determining whether the predetermined address line is in the first state prior to each call to the operating system and, if not, placing the predetermined address line in the first state. The method further includes the step of determining whether more than a predetermined number of calls have been made to the operating system while the application program is being executed and, if so, leaving the predetermined address line in the first state after each subsequent call to the operating system is completed and, if not, returning the predetermined address line to the second state after the call to the operating system is completed.
Brief Description of the Drawings
FIG. 1 illustrates a personal computer practicing the method that is the subject of the present invention.
FIG. 2 is a decision flow diagram illustrating the method that is the subject of the present invention.
Detailed Description of the Invention
The present invention is a method for interfacing application programs with a personal computer. FIG. 1 illustrates a personal computer practicing the method that is the subject of the present invention. As is known in the art, personal computers typically include an operating system 100 for interfacing application programs 102 with the personal computer. Also, personal computers usually include memory devices 104 for storing the operating system and for storing application programs that are being executed by the personal computer. The personal computer further includes a microprocessor 106, or other data processing device, having a number of address lines 108 sufficient for accessing the address space 110 of the personal computer. The address lines of the microprocessor define an upper region 112 of the personal computer's address space and a lower region 114 of the personal computer's address space.
As discussed above, the terms upper region 112 and lower region 114 are used herein to distinguish those portions of the computer's memory that are addressable with a predetermined address line enabled and disabled, respectively. Generally, the lower region 114 of the computer's memory is always accessible and the upper region of the computer's memory can be made accessible under program control.
In a presently preferred embodiment of the invention, the operating system 100 of the personal computer is stored in the upper region 112 of the personal computer's address space 110. As such, predetermined ones of the microprocessor's address lines 108 must be in a predetermined state to access the operating system 100. Particularly, address line 20, sometimes referred to as A20 (see FIG. 1), must be set to a logical one to access the upper region 112 of the address space 110 of the personal computer.
However, some application programs do not operate properly if address line 20 is set to a logical one during certain times. As an example, some application programs 102 will not execute properly if address line 20 is set to a logical one during their initial stages of execution. Accordingly, it is desirable to have address line 20 set to a logical one when the operating system 100 of the subject personal computer is being accessed and to have address line 20 set to a logical zero at times necessary for proper operation of the application program 102.
To accomplish the switching of address line 20, the subject personal computer stores a stub 116, or portion of the operating system, in the lower region of the computer's address space 110. All calls to the operating system 100 from the application program 102 are directed to the stub 116, which in turn directs the call the operating system 100. Further, after the operating system 100 has completed the call, it returns control of the computer to the stub 116 before control is passed back to the application program 102.
An example of the manner in which the operating system of the computer, the stub, and the application program interact, in accordance with the subject invention, is illustrated in the decision flow diagram of FIG. 2. Therein, calls to the operating system from the application program are received by the stub, step 200. The stub determines whether address line 20 is set, step 202, and, if not, sets address line 20, step 204, prior to forwarding the call to the operating system, step 206. In this manner, the stub insures that address line 20 is set prior to each access of the operating system.
Those skilled in the art will appreciate that the processing of setting and resetting address line 20, described above, is time consuming, increasing the overall time required to complete the application. To minimize the time burden of switching address line 20, while insuring that address line 20 is set at times necessary for proper operation of the application program, the stub also determines when it is safe to leave address line 20 set without danger that the application program will malfunction. In a presently preferred embodiment of the invention, this decision is made by the stub after the call to the operating system is complete, step 206.
When the call is complete, the stub determines whether the operating system has been called more than a predetermined number of times, step 208, and, if not, resets address line 20, step 210, before returning control of the computer to the application program, step 212. However, if the operating system has been called more than the predetermined number of times, then the stub leaves address line 20 set and returns to the application program.
The above method for determining when it is safe to leave address line 20 set is both effective and efficiently implemented. However, those skilled in the art will appreciate that other methods for determining when it is safe to leave address line 20 set may be substituted therefor without departing from the true scope and spirit of the present invention. Further, the number of system calls to be made before the predetermined address line is left set may be variable from program to program and from operating system to operating system. This information can be associated with the program in the manner described in U.S. patent application Ser. No. 07/847,525, entitled Method For Storing Programs, by Eric Straub et al., filed Mar. 6, 1992 (concurrently herewith), the disclosure of which is incorporated herein by the foregoing reference thereto.
Also, it will be apparent to those skilled in the art that although the invention has been described herein by reference to a single address line, several address lines could be toggled in the manner discussed above.
It will be apparent to those skilled in the art that although only several presently preferred embodiments of the invention have been described in detail herein, many modifications and variations may be provided without departing from the true scope and spirit of the invention. Accordingly, the invention is not limited except as by the appended claims. Also, those skilled in the art will appreciate that the enabling and disabling of the address line could be performed by the application program instead of the stub.