EasyManua.ls Logo

Intel 8253 - Page 344

Intel 8253
773 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
3/24/97 2-14 Architectural Overview
Since indirect memory references and immediate data values do not implicitly identify the size of
the operation to be performed, a few XA instructions must have an operation size explicitly
called out. An example would be the instruction: "MOV [R1], #1". The immediate data value
does not specify the operation size, and the value stored in memory at the location pointed to by
R1 could be either a byte or a word. To clarify the intent of such an instruction, a size identifier
is added to the mnemonic as follows: "MOV.b [R1], #1". This tells us that the operation should
be performed on a byte. If the line read "MOV.w [R1], #1", it would be a word operation.
If a direct data address is used in an instruction, the address is simply written into the instruction:
"ADD 123, R1", meaning to add the contents of register R1 to the data memory value stored at
direct address 123. In an actual program, the direct data address could be given a name to make
the program more readable, such as "ADD Count, R1".
Operations using Special Function Registers (SFRs) are written in a way similar to direct
addresses, except that they are normally called out by their names only: "MOV PSW,#12". Using
actual SFR addresses rather than their names in instructions makes the code both harder to read
and less transportable between XA derivatives.
Bit addresses within instructions may be specified in one of several ways. A bit may be given a
unique name, or it may be referred to by its position within some larger register or entity. An
example of a bit name would be one of the status flags in the PSW, for instance the carry ("C")
flag. To clear the carry flag, the following instruction could be used: "CLR C". The same bit
could be addressed by its position within the PSW as follows: "CLR PSWL.7", where the period
(".") character indicates that this is a bit reference. A program may use its own names to identify
bits that are defined as part of the application program.
Finally, code addresses are written within instructions either by name or by value. Again, a
program is more readable and easier to modify if addresses are called out by name. Examples
are: "JMP Loop" and "JMP 124".
Figure 2.11 Indirect Addressing with Auto-Increment
ADD R1, [R2+]
R1
R2
register file
data memory
1000
1002
1004
1006
1004
45
1000
Before
R1
R2
register file
data memory
1000
1002
1004
1006
1006
45
1045
After

Table of Contents