Difference between revisions of "Immediate Mode"

From Intellivision Wiki
Jump to: navigation, search
 
m
Line 1: Line 1:
[[Immediate Mode]] instructions read (or write) one of their arguments from 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 read (or write) one of their arguments from 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:
+
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
 
     ; Example with Double Byte Data Flag cleared

Revision as of 21:26, 14 January 2005

Immediate Mode instructions read (or write) one of their arguments from 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:
   $0xxx   ; MVI@ R7, R0 opcode
   $0123   ; the immediate constant $0123

Compare that to:

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