211/317
7 - Debugger and PROM Programmer Tutorial for ST72251
The
Yield
functions are characteristic of cooperative multitasking. It is the programmer’s job
to select the places to put them.
The advantage is that they can easily be put at places where task-switching is safe, thus
solving the problem of data coherence and collision protection. The drawback is that the time
interval between two successive calls to
Yield
within a single task is difficult to estimate and
depends on how long each of the other tasks execute between two successive calls to
Yield
,
so once
Yield
is called, it is difficult to know how long it will be before the task can proceed.
This kernel is very simple and does not provide any feature other than task switching. Also, the
stack capacity for each task is small, as there are only 16 bytes available for each stack (for
the 72251; other members of the ST7 family have bigger stacks). 5 bytes for ainterrupt, is not
a lot. However, the advantage of this kernel is its speed, since the code of
Yield
is very short
and does not take many machine cycles.
To finish this discussion about the mechanism of the stack, we should bear in mind that the
role of the stack is to store whatever is pushed into it, in particular when servicing an interrupt
request:
07-order
A multitasking environment is no exception to this.
7.6.4 The source code of the application
The source code is divided into the following files:
Multitsk.asm
, the main file
Acana.asm
, containing the routine that does the analog to digital conversion
Littlk.asm
, that is the real-time kernel
Map72251.asm
that declares the segments
Reg72251.asm
and Reg72251.inc that declare the registers
PCL
PCH
X index register
Accumulator
Condition code
In
te
rr
u
p
t
Re
tu
rn
unstack
(pop)
stack
(push)
Stacking order for an interrupt
(reminder)