Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Blinker 5.10 Online Reference - <b> code that cannot be overlaid</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Code that cannot be overlaid
------------------------------------------------------------------------------
 The following exceptions to the general rule are most likely to affect
 assembly language programmers:

 Interrupt handlers

 Routines to handle interrupts CANNOT be overlaid as there is no guarantee
 that they will be resident in memory when the interrupt occurs. This type of
 code MUST be placed in the root.

 Data in the code segment

 Code to be overlaid should not modify or store data in segments that are of
 the overlay class(es) as these segments can be discarded and reloaded at any
 time, causing stored data items to be lost. Additionally, root or overlaid
 code should not attempt to directly access public data items stored in a
 different overlaid segment, since Blinker cannot detect such accesses.
 Instead, use a function in the same overlaid segment to return the data
 value.

 It is possible to store temporary data in code segments, but it should be
 remembered that if any calls to other overlaid segments occur, the routine
 may be discarded and the modified data lost. To be safe, assume that at any
 given time, the currently executing overlaid module is the only overlaid
 module in memory.

 Near calls

 Entry into an overlaid segment must be done via a far call, and likewise
 calls from an overlaid segment to the root, or another overlay, must also be
 far calls. Returns from overlaid segments must be far returns. Near calls
 may be used between functions in the root, and also between routines within
 the same overlaid segment. Do not use jumps to enter or exit overlays.

 Passing pointers

 Code that passes pointers to other code where these pointers are only
 evaluated at run time, cannot be overlaid, because it cannot be assumed that
 a piece of code will be in the same place on any two calls to the code. This
 can rule out jump tables set up at run time, although jump tables which are
 evaluated at link time are overlayable.

 Almost all high level languages generate code that is overlayable by these
 definitions, but Assembler code can often contain constructs which will
 prevent overlaying.

 Whether a particular routine may be overlaid or not can only be established
 by trying it under carefully monitored circumstances to ensure that it is
 functioning correctly.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson