Double Byte Data

From Intellivision Wiki

(Difference between revisions)
Jump to: navigation, search
Line 13: Line 13:
The [[CP1610]] does not specifically support SDBD with [[Indirect]] accesses through the stack pointer.  Programs also must be careful not to use the same register both as a numeric operand and an indirect register when accessing Double Byte Data.  In both of these cases, [[Undocumented SDBD Behavior|strange behavior results]].<br/>
The [[CP1610]] does not specifically support SDBD with [[Indirect]] accesses through the stack pointer.  Programs also must be careful not to use the same register both as a numeric operand and an indirect register when accessing Double Byte Data.  In both of these cases, [[Undocumented SDBD Behavior|strange behavior results]].<br/>
<br/>
<br/>
-
Note that the D flag only remains set for the next executed opcode, regardless of whether of not the next opcode is actually affected by the status of the Double Byte Data Flag. After execution of the next opcode, the CPU clears the Double Byte Data Flag automatically.<br/>
+
Note that the D flag only remains set for the next executed opcode, regardless of whether of not the next opcode is actually affected by the status of the Double Byte Data Flag. After execution of the next opcode, the CPU clears the Double Byte Data Flag automatically. As a result, [[SDBD]] acts as like a prefix instruction.<br/>
<br/>
<br/>
The Double Byte Data Flag affects the behavior of the following instructions:<br/>
The Double Byte Data Flag affects the behavior of the following instructions:<br/>

Revision as of 16:30, 7 November 2007

The Set Double Byte Data instruction sets the Double Byte Data Flag (D). This flag causes the next instruction, if it is an Indirect Mode or Immediate Mode instruction, to issue two memory reads instead of one, and construct a 16-bit operand from the lowest 8 bits from the values it read. The first read fills the lower 8 bits of the result, and the second read fills the upper 8 bits. SDBD also modifies the behavior of Direct Mode accesses.

For Immediate mode accesses, the CPU reads the two locations immediately following the instruction. This allows ROMs narrower than 16 bits to hold immediate constants up to 16 bits long. The following diagram illustrates:

SDBD prefix used with Immediate Mode instruction


For Indirect mode accesses, if the indirect register is auto-incrementing (R4 or R5), the two values read come from consecutive addresses, as shown:

SDBD prefix with Indirect via an auto-incrementing pointer


If the indirect register is not auto-incrementing (R1, R2 or R3), the instruction reads the same location twice.

SDBD prefix with Indirect via a non-incrementing pointer


The CP1610 does not specifically support SDBD with Indirect accesses through the stack pointer. Programs also must be careful not to use the same register both as a numeric operand and an indirect register when accessing Double Byte Data. In both of these cases, strange behavior results.

Note that the D flag only remains set for the next executed opcode, regardless of whether of not the next opcode is actually affected by the status of the Double Byte Data Flag. After execution of the next opcode, the CPU clears the Double Byte Data Flag automatically. As a result, SDBD acts as like a prefix instruction.

The Double Byte Data Flag affects the behavior of the following instructions:

Indirect ModeImmediate ModeDirect Mode
MVI@MVIIMVI
ADD@ADDIADD
SUB@SUBISUB
CMP@CMPICMP
AND@ANDIAND
XOR@XORIXOR


The D flag also changes the timing of the instruction it modifies. Generally, it adds 2 cycles to most Indirect and Immediate instructions. Thus, where MVI@ might take 8 cycles, SDBD + MVI@ takes 14: 4 for the SDBD, 10 for the MVI@ modified by the D flag.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox