196 Vertical Windows

(#3123) 196 Vertical Windows

196 Vertical Windows

The purpose of this article is to explain how the iC96 compiler and the RL96 linker use the WSR. The reader needs to already have a basic knowledge of how the verticalwindow works. To find out more information on how vertical windows work read the 1991 edition of the 16-Bit Embedded Controller's Handbook, Order No. 270640, pages 5-15 through 5-17.

There is a compiler control on the iC96 compiler called `windows' that generates code in the prolog and epilog of a function that saves and restores the Window's Select Register (WSR).

PROLOG Example:

EPILOG Example:

This allows the programmer to freely change the WSR to access any vertical window he or she wants to. See the iC-96 User's Guide, Order Number 481195-004, page 3-78 for more information on the compiler control.

The linker has two controls that effect the use of the WSR. These controls are `register ` and `windows' controls, the `Register' control tells the linker how many registers there are (1Ah -0FFh or 1Ah - 1FFh).

The linker first locates global registers in low register addresses (starting at 24H) and then locates the local register variables in an "overlay register segment" (oseg).

With the `windows' control, the linker checks for the largest vertical window that can be used after global register allocation. Then the linker places the overlay registers in the first vertical window whose address is above 0FFH. When the linker has filled that vertical window register space it then increments ?WSR to the next vertical window and finishes locating the overlay registers. If you use the `windows' control you must also use the `register' control.

The question often arises "How can the user allocate specific window registers for specific tasks?" I do not know of a way to have vertical windows saved for tasks switching.

By using the `locate' pragma and compiling with `window' control and either the model KR or KC control, the user can locate global variables for specific modules into the specific vertical windows . The programmer must keep track of the WSR changes throughout the code generated. After defining the global registers, the user would locate them in the vertical window. For instance, if using a 32-byte vertical window, locate global variables between 00EH to 00FFH. If you use a 64-byte vertical window, use the address range between 00C0H to 00FFH. If you use a 128-byte vertical window, then use the address range 0080h to 00FFH. The compiler will generate code that uses 8-bit addresses to access those global variables. Now the programmer must keep track of the WSR settings to insure the correct variables get used.

The compiler will compile with zero errors and zero warnings, but the linker will issue warnings. The object file that is generated is good even though the linker issued warnings. There will be problems when debugging this code with a symbolic debugger or emulator, since the same address has multiple symbol names. DO NOT use the `windows' control at link time. The programmer is left to his own experimenting to find out what will work and what will not work.

For more information on vertical windows check iC96 User's Guide, page 3-78 and the MCS-96 Utilities User's Guide, Order No. 122355-004, pages 2-17 through 2-19, 2-56, and 2-69.

Free Web Hosting

Legal Stuff © 1997 Intel Corporation