Site Logo

Move Instructions

Website

Home | Previous | Next

Move Instructions - Flags are NOT set.

Move instructions are used to copy data between registers and between RAM and registers.

Addressing Mode Assembler Example Supported Explanation
Immediate mov al,10
YES
Copy 10 into AL
Direct (register) mov al,bl
NO
Copy BL into AL
Direct (memory) mov al,[50]
YES
Copy data from RAM at address 50 into AL.
mov [40],cl
YES
Copy data from CL into RAM at address 40.
Indirect mov al,[bl]
YES
BL is a pointer to a RAM location. Copy data from that RAM location into AL.
mov [cl],dl
YES
CL is a pointer to a RAM location. Copy data from DL into that RAM location.
Indexed mov al,[20 + bl]
NO
A data table is held in RAM at address 20. BL indexes a data item within the data table. Copy from the data table at address 20+BL into AL.
mov [20 + bl],al
NO
A data table is held in RAM at address 20. BL indexes a data item within the data table. Copy from AL into the data table at address 20+BL.
Base Register mov al,[bl+si]
NO
BL points to a data table in memory. SI indexes to a record inside the data table. BL is called the "base register". SI is called the "offset or index". Copy from RAM at address BL+SI into AL.
mov [bl+si],al
NO
BL points to a data table in memory. SI indexes to a record inside the data table. BL is called the "base register". SI is called the "offset". Copy from AL into RAM at address BL+SI.

 

Right to Left Convention

Data Movement Direction Image

 

ADDRESSING MODES

 

Immediate

MOV AL,10

Copy a number into a register. This is the simplest move command and easy to understand.

Direct (register)

MOV AL,BL

Copy one register into another. This is easy to understand. The simulator does not support this command. If you have to copy from one register to another, use a RAM location or the stack to achieve the move.

Direct (memory)

MOV AL,[50]    ; Copy from RAM into AL. Copy the data from address 50.
MOV [50],AL    ; Copy from AL into RAM. Copy the data to address 50.

The square brackets indicate data in RAM. The number in the square brackets indicates the RAM address/location of the data.

Indirect

MOV AL,[BL]    ; Copy from RAM into AL. Copy from the address that BL points to.
MOV [BL],AL    ; Copy from AL into RAM. Copy to the address that BL points to.

Copy between a specified RAM location and a register. The square brackets indicate data in RAM. In this example BL points to RAM.

Indexed

MOV AL,[20 + BL]    ; Copy from RAM into AL. The RAM address is located at 20+BL.
MOV [20 + BL],AL    ; Copy from AL into RAM. The RAM address is located at 20+BL.

Here the BL register is used to "index" data held in a table. The table data starts at address 20.

Base Register

MOV AL,[BL+SI]    ; Copy from RAM into AL. The RAM address is located at BL+SI.
MOV [BL+SI],AL    ; Copy from AL into RAM. The RAM address is located at BL+SI.

BL is the "base register". It holds the start address of a data table. SI is the "source index". It is used to index a record in the data table.

Home | Previous | Next

© C Neil Bauers 2003