ImageCraft Assembly Language Guide, Document # 001-44475 Rev. *B
49
M8C Instruction Set
4.12
Relative Table Read
INDEX
Places the contents of ROM at the location indicated by the sum of the Accumulator, the argument,
and the current
PC+2
into the Accumulator. This instruction has a 12-bit, two’s-complement offset
address, relative to the current
PC+2
. The current PC value is defined as the PC value that corre-
sponds to the ROM address of the first byte of the instruction.
The
INDEX
instruction is used to retrieve information from a table to the Accumulator. The lower nib-
ble of the first byte of the instruction is used as the upper 4 bits of the 12-bit address. Therefore, all
instructions that begin with 0xF are
INDEX
instructions, so all of the following are
INDEX
opcodes:
0xF0, 0xF1, 0xF2,..., 0xFF.
The offset into the table is taken as the value of the Accumulator when the
INDEX
instruction is exe-
cuted. The maximum readable table size is 256 bytes due to the Accumulator being 8 bits in length.
Instructions
Operation
Opcode
Cycles Bytes
Mnemonic
Argument
INDEX
expr
0xFx
13
2
Conditional
Flags:
CF
ZF
Unaffected.
Set if the byte returned to
A
is zero.
Example:
0000
OUT_REG: equ 04h
0000
40
[04]
nop
0001
50 03
[04]
mov A, 3
0003
F0 E6
[13]
index ASCIInumbers
0005
60 04
[05]
mov reg[OUT_REG], A
Note that the 12-bit address for the
INDEX
instruction is positive and that the sum
of the address (
0x0E6
) and the next instruction’s address (
0x0005
) are equal to
the first address of the ASCIInumbers table (
0x00EB
). Because the Accumulator
has been set to 3 before executing the
INDEX
instruction, the fourth byte in the
ASCIInumbers table will be returned to A. Therefore, A will be
0x33
at the end of
the
INDEX
instruction.
0007
00EB
org 0x00EB
00EB
ASCIInumbers:
00EB
30 31 ... ds "0123456789"
32 33 34 35 36 37 38 39
A
rom k A PC 2
+
+
+
, 2048 k
–
2047
Summary of Contents for PSoC DESIGNER ImageCraft M8C
Page 6: ...6 ImageCraft Assembly Language Guide Document 001 44475 Rev B Contents Feedback ...
Page 10: ...10 ImageCraft Assembly Language Guide Document 001 44475 Rev B Introduction Feedback ...
Page 24: ...24 ImageCraft Assembly Language Guide Document 001 44475 Rev B M8C Microprocessor Feedback ...
Page 95: ...ImageCraft Assembly Language Guide Document 001 44475 Rev B 95 Assembler Directives Feedback ...
Page 96: ...96 ImageCraft Assembly Language Guide Document 001 44475 Rev B Assembler Directives Feedback ...
Page 104: ...104 ImageCraft Assembly Language Guide Document 001 44475 Rev B Feedback ...
Page 108: ...108 ImageCraft Assembly Language Guide Document 001 44475 Rev B Index Feedback ...