Difference between revisions of "Immediate Mode"
m (Protected "Immediate Mode" ([edit=autoconfirmed] (indefinite) [move=autoconfirmed] (indefinite))) |
|||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | 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 | ; Example with Double Byte Data Flag cleared | ||
− | MVII #$0123, R0 | + | MVII #$0123, R0<br/> |
− | encodes to: | + | encodes to:<br/> |
− | $ | + | $02B8 ; 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 | ||
− | $ | + | $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 | ||
+ | |||
+ | The following instructions are Immediate Mode instructions: | ||
+ | |||
+ | [[MVII]]<br/> | ||
+ | [[MVOI]]<br/> | ||
+ | [[ADDI]]<br/> | ||
+ | [[SUBI]]<br/> | ||
+ | [[CMPI]]<br/> | ||
+ | [[ANDI]]<br/> | ||
+ | [[XORI]] |
Latest revision as of 08:35, 4 December 2010
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 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
The following instructions are Immediate Mode instructions: