:?:
.model small
.data
var db 5
.code
mov ax,@data
mov ds,ax
mov ax,var ;what this statement set ax
mov dx, ;what this statement set bx
question is what is difference b/w var and
same opertion or different
plz suggest
.model small
.data
var db 5
.code
mov ax,@data
mov ds,ax
mov ax,var ;what this statement set ax
mov dx, ;what this statement set bx
question is what is difference b/w var and
same opertion or different
plz suggest
In this case, they are identical due to the definition of "var". However, there are cases where the square brackets do have a different effect.
If this is still not clear, just tell us, and hopefully you should get a better explaination.
Ossa
mov edx, offset var ; Set edx to a pointer to "var"
mov eax, edx ; Copy contents of edx into eax (ie copy the pointer to "var" into eax)
mov ecx, ; Copy contents of "var" into ecx
If this is still not clear, just tell us, and hopefully you should get a better explaination.
Ossa
Generally, if the register contains a memory location, the control bus instructs the CPU that when a value is moved to that register, it has got to be redirected to the block of memory which the register points out to. but if the register is not pointing to a memory address, the value is simply kept in the register.
using the square brackets surrounding a register, assuming the register holds a memory address, copies the content of the memory address to another place or register. but if the register is not holding to an effective address or a memory block, does nothing of any significance, although you might even get a runtime error.
There are basically a few memory addressing available but you can make a very big set of addressing modes by combining these few modes.
First if you want to load an effective address of a global variable onto a register, use the keyword OFFSET. Example:
Nevertheless, the ADDR doesnt work in some TASM compilers i guess so you have to stick with the OFFSET.
Surrounding a variable inside a pair of square brackets does NOT load it's effective address into the destination.
Example which doesnt change the value of the variable
I hope it helps
using the square brackets surrounding a register, assuming the register holds a memory address, copies the content of the memory address to another place or register. but if the register is not holding to an effective address or a memory block, does nothing of any significance, although you might even get a runtime error.
There are basically a few memory addressing available but you can make a very big set of addressing modes by combining these few modes.
First if you want to load an effective address of a global variable onto a register, use the keyword OFFSET. Example:
MyProc PROC
LOCAL MyWord:WORD
AX , ADDR MyWord
MyProc ENDP
Nevertheless, the ADDR doesnt work in some TASM compilers i guess so you have to stick with the OFFSET.
Surrounding a variable inside a pair of square brackets does NOT load it's effective address into the destination.
Example which doesnt change the value of the variable
.286
.MODEL SMALL
.STACK 500h
.DATA?
Word1 DW ?
.CODE
START:
ASSUME DS: @DATA, CS:@CODE, SS:@STACK
MOV AX , @DATA
MOV DS , AX
MOV BX , OFFSET Word1
MOV WORD PTR , 100
@@EP:
MOV AX , 4C00h
INT 21h
END START
END START
I hope it helps