# Assembly Language issue

DS = 1342, SI = 0111.

I'm trying to figure out the contents of AX after this command?

MOV AX, [SI]

Can someone point me in the right direction?

berkeman
Mentor
DS = 1342, SI = 0111.

I'm trying to figure out the contents of AX after this command?

MOV AX, [SI]

Can someone point me in the right direction?

Which processor is this for? What do the [] brackets mean in that assembly language construct? What documentation do you have for this assembler?

8088 microprocessor

do I find the the Physical Address is 13420 + 0111 = 13531 = 1342:0111

then whatever is at the position becomes AX?

mgb_phys
Homework Helper
ax is a register
mov ax [blah] means move the contents of address [blah] into register ax

rcgldr
Homework Helper
I find the the Physical Address is 13420 + 0111 = 13531 = 1342:0111 ... then whatever is at the position becomes AX?
Yes. Intel processors don't care if a 16 bit value is on an odd byte boundary. Note that little endian format is used, so the low order byte is first.

If [13531] = 34 and [13532] = 12, then AX becomes 1234.

Mark44
Mentor
DS = 1342, SI = 0111.

I'm trying to figure out the contents of AX after this command?

MOV AX, [SI]

Can someone point me in the right direction?

Do you have some kind of debugger to work with, particularly one that shows the contents of the registers and memory locations? If you're working with MS-DOS, there is a very primitive one named debug.exe that can show this information.

It has been a while since I did any 8088 assembly, so I'm a little rusty. I seem to recall that the brackets ([]) indicate that you're not moving the contents of SI into AX, but instead are moving the contents of the memory location pointed to by the SI register. If my memory is correct, the MOV instruction won't move 0111 into AX; instead it will move the value at memory location DS:0111 into AX.

rcgldr
Homework Helper
The [] just means that the operand is the content of a memory address. The two other operand options are an immediate or a register. One exception is LEA (load effective address): LEA AX,[SI] would load the effective address into AX (not including the DS part). In this case AX ends up with the value 0111 instead of the content of [13531]. The Intel cpu's don't have a indirect addressing mode, the equivalent of a [[13531]].

Back in the days of real 8088's and when people cared about instruction times, LEA was faster than add, but it can only be used with registers BP, BX, SI, or DI as operands, or with BP|BX + SI|DI.

LEA BX,1234[BX] (or LEA BX,[BX+1234]) is the same as ADD BX,1234, but it executes faster.

Also the destination register can be diferent, such as LEA AX, 1234[BX+SI] => AX = (1234 + BX + SI).

In 32 bit mode, there is an optional "sib" byte appended to the opcode, allowing for more addressing modes, which allows indexing via any register, and scaling (1x -> 8x) on the second index:

MOV ECX,12345678[EAX+EBX*4]
LEA EAX,[EAX*8] ; multiply by 8 or shift left 3 ; probably not faster than SHL EAX,3

For other examples of "clever" coding, look at the output from microsoft compilers using the -Fa option to produce assembly code.

Last edited: