PROGRAMMING NUMERIC APPLICATIONS

The ASM286 version (figure 2-7) defines the external procedure INIT287, which makes the different initialization requirements of the processor and its emulator transparent to the source code. After defining the data and setting up the segment registers and stack pointer, the program calls INIT287 and loads the control word. The computation begins with the next three instructions, which clear three registers by loading (pushing) zeros onto the stack. As shown in figure 2-8, these registers remain at the bottom of the stack throughout the computation while temporary values are pushed on and popped off the

stack above them.

'

The program uses the CPU LOOP instruction to control its iteration through )CARRAY; register CX, which LOOP automatically decrements, is loaded with N_OF.J(, the number of array elements to be summed. Register SI is used to select (index) the array elements. The program steps through )CARRAY from back to front, so SI is initialized to point at the element just beyond the first element to be processed. The ASM286 TYPE operator is used to determine the number of bytes in each array element. This permits changing )CARRAY to a long real array by simply changing its definition (DD to DQ) and reassembling.

Figure 2-8 shows the effect of the instructions in the program loop. on the NPX register stack. The figure assumes that the program is in its first iteration, that N_OF.J( is 20, and that }CARRAY(19) (the 20th element) contains the value 2.5. When the loop terminates, the three sums are left as the top stack elements so that the program ends by simply popping them into memory variables.

80287 Emulation

I

The programming of applications to execute on both 80286 and 802~7 is made much easier by the existence of an 80287 emulator for 80286 systems. The Intel E80287 emulator offers a complete software counterpart to the 80287 hardware; NPX instructions can be simply emulated in softwar~ rather than being executed in hardware. With software emulation, the distinction between 80286 arid 80287 systems is reduced to a simple performance differential (see Table 1-2 for a performance comparison between an actual 80287 and an emulator 80287). Identical numeric programs will simply execute more slowly on 80286 systems (using software emulation of NPX instructions) than on executing NPX instructions

directly.

'

When incorporated into the systems software, the emulation of NPX instructions on the 80286 systems is completely transparent to the programmer. Applications software needs no special libraries, linking, or other activity to allow it to run on an 80286 with 80287 emulation.

To the applications programmer, the development of programs for 80286 systems is the same ~hether the 80287 NPX hardware is available or not. The full 80287 instruction set is available for use, with NPX instructions being either emulated or executed directly. Applications programmers need not be concerned with the hardware configuration of the computer systems on which their applications will eventually run.

For systems programmers, details relating to 80287 emulators are described in a later section of this supplement. An E80287 software emulator for 80286 systems is contained in the iMDX 364 8086 Software Toolbox, available from Intel and described in the 8086 Software Toolbox Manual.

CONCURRENT PROCESSING WITH THE 80287

Because the 80286 CPU and the 80287 NPX have separate execution units, it is possible for the NPX to execute numeric instructions in parallel with instructions executed by the CPU. This simultaneous execution of different instructions is called concurrency.

2-45

Page 437
Image 437
Intel 80286, 80287 manual Emulation, Concurrent Processing with