Forum - With regard to relotsiruemyh programs.

ZX Review #5-6
            FORUM



(C) Ivan Roshchin, Moscow, 1997

About relotsiruemyh programs


   After reading several articles in
ZX-REVIEW on relotsiruemym program, I noticed that
to determine the base address
usually uses the following
way:
140.
CALL # 007C; at this address - RET.
DEC SP; Since in the stack is
DEC SP; return address.
POP HL; Remove address from the stack.
2

   This method has several drawbacks:

   - If during this
fragment program will
interrupt, the stack will be corrupted, resulting in
obtain an incorrect address. Therefore,
have to remember the state of
trigger an interrupt, restrain
interrupt and then restore the old regime of their work.
All this leads to additional costs of memory.

   - Method does not work if
at # 007C, no team RET
(Non-standard ROM).

   - A large length of the fragment (6
bytes).

   There is a way, free from
the above-mentioned drawbacks:

HALT; written to the stack address

            , The following command (for

            ; Return from interrupt)
DEC SP; Just as in the first
DEC SP; fragment
POP HL; remove the address from the stack


   The consumption of memory is only four bytes instead of
six. In contrast to previous
example, interruption during operation of the program fragment
should be allowed (to execute the command HALT). Despite this, 
the teams DEC SP interrupt can not happen, because after the 
command HALT is still 1 / 50 seconds before the next 
interruption. 


           *