Difference between revisions of "Immediate Mode"

From Intellivision Wiki
Jump to: navigation, search
m
(put in actual opcode value for MVI@)
Line 4: Line 4:
  
 
     ; Example with Double Byte Data Flag cleared
 
     ; Example with Double Byte Data Flag cleared
     MVII #$0123, R0   
+
     MVII #$0123, R0<br/>    
  encodes to:
+
  encodes to:<br/>
 
     $0xxx  ; MVI@ R7, R0 opcode
 
     $0xxx  ; MVI@ R7, R0 opcode
 
     $0123  ; the immediate constant $0123
 
     $0123  ; the immediate constant $0123
Line 13: Line 13:
 
     ; Example with Double Byte Data Flag set
 
     ; Example with Double Byte Data Flag set
 
     SDBD   
 
     SDBD   
     MVII #$0123, R0
+
     MVII #$0123, R0<br/>
  encodes to:
+
  encodes to:<br/>
 
     $0001  ; SDBD opcode
 
     $0001  ; SDBD opcode
     $0xxx   ; MVI@ R7, R0
+
     $02B8   ; MVI@ R7, R0 opcode
 
     $0023  ; lower 8 bits of immediate constant $0123
 
     $0023  ; lower 8 bits of immediate constant $0123
 
     $0001  ; upper 8 bits of immediate constant $0123
 
     $0001  ; upper 8 bits of immediate constant $0123

Revision as of 22:17, 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 $02B8  ; MVI@ R7, R0 opcode $0023  ; lower 8 bits of immediate constant $0123 $0001  ; upper 8 bits of immediate constant $0123