Queues - Motorola CPU32 Reference Manual

M68300 series central processor unit
Hide thumbs Also See for CPU32:
Table of Contents

Advertisement

LOW MEMORY
BOTTOM OF STACK
·
·
·
TOP OF STACK
An
~
(FREE)
HIGH MEMORY
3.7.3 Queues
Queues can be implemented using the address register indirect with
postincrement or predecrement addressing modes. Queues are pushed from
one end and pulled from the other, and use two registers. A queue filled either
from high to low memory or from low to high memory can be implemented with a
pair (two of AD to A6) of address registers. (An) is the "put" pointer and (Am) is
the" get" pointer.
To implement growth of the queue from low to high memory, use (An)+ to put
data into the queue, (Am)+ to get data from the queue.
After a "put" operation, the "put" register points to the next available queue
space, and the unchanged "get" register points to the next item to be removed
from the queue. After a "get" operation, the "get" register points to the next item
to be removed from the queue, and the unchanged "put" register points to the
next available queue space, which is illustrated as follows:
lOW MEMORY
LAST GET (FREE)
GET (Am) +
~
NEXT GET
·
· ·
l
LAST PUT
PUT (An) +
~
(FREE)
HIGH MEMORY
To implement a queue as a circular buffer, the relevant address register should
be checked and (if necessary) adjusted before performing a "put" or "get"
CPU32 REFERENCE MANUAL
DATA ORGANIZATION AND
ADDRESSING
CAPABILITIES
MOTOROLA
3-21
lEI

Advertisement

Table of Contents
loading

Table of Contents