Immediate Mode

From Intellivision Wiki
Revision as of 02:10, 7 October 2007 by Mr z (talk | contribs)
Jump to: navigation, search

Immediate Mode instructions read (or write) one of their arguments in memory immediately following the instruction. It appears the CP1610 actually implements Immediate Mode as an Indirect Mode access, using R7 (the program counter) as the indirection register.

Immediate Mode instructions ordinarily access one word at the specified location. The Double Byte Data Flag modifies Immediate Mode instructions that read memory. Thus, the constant that follows such an instruction occupies two words of memory instead of one. For example:

   ; Example with Double Byte Data Flag cleared
   MVII #$0123, R0
encodes to:
$02B8  ; MVI@ R7, R0 opcode $0123  ; the immediate constant $0123

Compare that to:

   ; Example with Double Byte Data Flag set
   MVII #$0123, R0
encodes to:
$0001  ; SDBD opcode $02B8  ; MVI@ R7, R0 opcode $0023  ; lower 8 bits of immediate constant $0123 $0001  ; upper 8 bits of immediate constant $0123

The following instructions are Immediate Mode instructions: