MOV AX, @DATA //move address of data that matters to you MOV DS, AX //initialize data segment This code initialize the Data Segment. It loads starting address of data segment into AX register. And then copy that to DS //data segment register. @DATA is the segment value of the data section. @DATA is fully known at the runtime. Why can't we directly move address of DATA into DS ?? MOVE DS,@DATA //some assembler might support but you should not use it for convention. You should never use the segment registers as data registers to hold arbitrary values. They should only contain segment addresses. In addition to the general purpose registers, MOV instruction allow you to specify one of the segment registers as an operand. There are two restrictions on the use of the segment registers with the mov instruction. 1.You may not specify cs as the destination operand. 2. only one of the operands can be a segment register. You cannot move data from one segment register to another with a single mov instruction. To copy the value of cs to ds, you have to code something like this: mov ax, cs mov ds, ax Let me remind again ,You should never use the segment registers as data registers to hold arbitrary values. They should only contain segment addresses.
The error message "A2004" typically indicates an issue in your assembly code. In the context of the x86 assembly language, MOV is used to move data between registers or memory locations. However, it appears that you are trying to use @DATA, which is not a valid operand in standard x86 assembly language. @DATA is not recognized as a valid operand in x86 assembly. Instead, you should use actual memory addresses or labels that have been defined in your assembly code. For example, if you want to move data from a memory location identified by a label, you should define the label and then use it in your MOV instruction like this: assembly Copy code .data ; This section defines data myData DW 123 ; Define a word (16-bit) variable named myData with the value 123 .code ; This section contains code mov AX, [myData] ; Move the value stored at the memory location myData into the AX register In this example, we first define a data section with the label myData to represent a memory location with a 16-bit (word) value of 123. Then, we use [myData] to reference that memory location in the MOV instruction. Make sure to define your data or labels correctly within the .data or .data? section of your assembly code, and then use those labels or memory addresses in your instructions.
Very well explained.Sir, I have an assignment which stuck my head alot and last date of submission is 30 Jan 2021.l try alot time but not write the right program. My assignment is write program that print table of 4 in Assembly language using display memory formation method. Kindly help me! I shall be thankful to you for this act of kindness.
.MODEL SMALL .STACK 100H .DATA MESSAGE DB 0AH, 0DH, "ENTER A NUMBER: $" NOTPROCESS DB 0AH, 0DH, "NOT A VALID DIGIT, CANNOT PROCES$" AGAIN DB 0AH, 0DH, "REPEAT?(Y/N): $" .CODE
MAIN: MOV AX, @DATA MOV DS, AX
LEA DX, MESSAGE MOV AH, 09H INT 21H
MOV AH, 01H INT 21H
MOV CH, 0AH MOV CL, 00H
CMP AL, 3AH JGE NOT_PRO SUB AL, 30H MOV BH, AL MOV BL, 01H NEXT:
MOV DL, 0DH MOV AH, 02H INT 21H
MOV DL, 0AH MOV AH, 02H INT 21H
MOV DL, '0' MOV AH, 02H INT 21H
MOV DL, BH ADD DL, 30H MOV AH, 02H INT 21H
MOV DL, '*' MOV AH, 02H INT 21H
MOV AL, BL MUL BH
AAM
PUSH AX
MOV AH, 00H MOV AL, BL AAA
MOV CL, AH MOV BL, AL
MOV DL, CL ADD DL, 30H MOV AH, 02H INT 21H
MOV DL, BL ADD DL, 30H MOV AH, 02H INT 21H
RESULT: MOV DL, '=' MOV AH, 02H INT 21H
;-----------------------
POP AX
MOV DH, AL MOV DL, AH ADD DL, 30H MOV AH, 02H INT 21H
MOV DL, DH ADD DL, 30H MOV AH, 02H INT 21H
;-----------------------
INC BL DEC CH CMP CH, 00H JNE NEXT JMP QUESTION NOT_PRO: LEA DX, NOTPROCESS MOV AH, 09H INT 21H
QUESTION: LEA DX, AGAIN MOV AH, 09H INT 21H
MOV AH, 01H INT 21H
OR AL, 20H
CMP AL, 'y' JNE EXIT JMP MAIN EXIT: MOV AH, 04CH INT 21H
MOV AX, @DATA //move address of data that matters to you
MOV DS, AX //initialize data segment
This code initialize the Data Segment. It loads starting address of data segment into AX register. And then copy that to DS //data segment register.
@DATA is the segment value of the data section. @DATA is fully known at the runtime.
Why can't we directly move address of DATA into DS ??
MOVE DS,@DATA //some assembler might support but you should not use it for convention.
You should never use the segment registers as data registers to hold arbitrary values.
They should only contain segment addresses.
In addition to the general purpose registers,
MOV instruction allow you to specify one of the segment registers as an operand.
There are
two restrictions on the use of the segment registers with the mov instruction.
1.You may not specify cs as the destination operand.
2. only one of the operands can
be a segment register. You cannot move data from one segment register to another with a single mov instruction.
To copy the value of cs to ds, you have to code something like this:
mov ax, cs
mov ds, ax
Let me remind again ,You should never use the segment registers as data registers to hold arbitrary values.
They should only contain segment addresses.
Thank you sir..
wow thanks
I'm from Pakistan and enjoying *"8086 Assembly Language"* playlist......... Thank You so much....thanks You are a very good teacher
I really appreciate this kind of playlist, great job!
I like your reason for not starting programming early. Simply because it's the basics and terminology that counts.
Very well explanation Sir.thanks a lot for this viedo
Wonderful teaching sir, can understand everything clearly. thank you very much
Thank you for your dedication and love for your viewers
You should sing lullabies bro , i feel sleepy after 2 mins , nice explaination though
Thanks sir this video is very important for me sir
Your voice sounds like very great asmr... I'm so sleepy c:
wow! zero dislikes!
Thank you sir!
thankyou sir for your nice explanation
Thank you for saving me ❤️
you rock man thank you
many thaaaaanks for you !!!!
I Wish TH-cam could be having voice note you teach very nicely can't thank you enough I am From Tanzania 🇹🇿🇹🇿🇹🇿🇹🇿🇹🇿🇹🇿🇹🇿🇹🇿🇹🇿🇹🇿🇹🇿🇹🇿🇹🇿🇹🇿🇹🇿🇹🇿🇹🇿🇹🇿
You explain beautifully sir Thanks.
Great great great
Thanks. will try to make it even better.
Thanks a lot sir
Thanks
thank you sir
great explanation but MOV AX, @DATA give me 'error A2004: symbol type conflict' how to fix that ??
The error message "A2004" typically indicates an issue in your assembly code. In the context of the x86 assembly language, MOV is used to move data between registers or memory locations. However, it appears that you are trying to use @DATA, which is not a valid operand in standard x86 assembly language.
@DATA is not recognized as a valid operand in x86 assembly. Instead, you should use actual memory addresses or labels that have been defined in your assembly code.
For example, if you want to move data from a memory location identified by a label, you should define the label and then use it in your MOV instruction like this:
assembly
Copy code
.data ; This section defines data
myData DW 123 ; Define a word (16-bit) variable named myData with the value 123
.code ; This section contains code
mov AX, [myData] ; Move the value stored at the memory location myData into the AX register
In this example, we first define a data section with the label myData to represent a memory location with a 16-bit (word) value of 123. Then, we use [myData] to reference that memory location in the MOV instruction.
Make sure to define your data or labels correctly within the .data or .data? section of your assembly code, and then use those labels or memory addresses in your instructions.
Thank you sir..
Very well explained.Sir, I have an assignment which stuck my head alot and last date of submission is 30 Jan 2021.l try alot time but not write the right program. My assignment is write program that print table of 4 in Assembly language using display memory formation method. Kindly help me! I shall be thankful to you for this act of kindness.
.MODEL SMALL
.STACK 100H
.DATA
MESSAGE DB 0AH, 0DH, "ENTER A NUMBER: $"
NOTPROCESS DB 0AH, 0DH, "NOT A VALID DIGIT, CANNOT PROCES$"
AGAIN DB 0AH, 0DH, "REPEAT?(Y/N): $"
.CODE
MAIN:
MOV AX, @DATA
MOV DS, AX
LEA DX, MESSAGE
MOV AH, 09H
INT 21H
MOV AH, 01H
INT 21H
MOV CH, 0AH
MOV CL, 00H
CMP AL, 3AH
JGE NOT_PRO
SUB AL, 30H
MOV BH, AL
MOV BL, 01H
NEXT:
MOV DL, 0DH
MOV AH, 02H
INT 21H
MOV DL, 0AH
MOV AH, 02H
INT 21H
MOV DL, '0'
MOV AH, 02H
INT 21H
MOV DL, BH
ADD DL, 30H
MOV AH, 02H
INT 21H
MOV DL, '*'
MOV AH, 02H
INT 21H
MOV AL, BL
MUL BH
AAM
PUSH AX
MOV AH, 00H
MOV AL, BL
AAA
MOV CL, AH
MOV BL, AL
MOV DL, CL
ADD DL, 30H
MOV AH, 02H
INT 21H
MOV DL, BL
ADD DL, 30H
MOV AH, 02H
INT 21H
RESULT:
MOV DL, '='
MOV AH, 02H
INT 21H
;-----------------------
POP AX
MOV DH, AL
MOV DL, AH
ADD DL, 30H
MOV AH, 02H
INT 21H
MOV DL, DH
ADD DL, 30H
MOV AH, 02H
INT 21H
;-----------------------
INC BL
DEC CH
CMP CH, 00H
JNE NEXT
JMP QUESTION
NOT_PRO:
LEA DX, NOTPROCESS
MOV AH, 09H
INT 21H
QUESTION:
LEA DX, AGAIN
MOV AH, 09H
INT 21H
MOV AH, 01H
INT 21H
OR AL, 20H
CMP AL, 'y'
JNE EXIT
JMP MAIN
EXIT:
MOV AH, 04CH
INT 21H
END MAIN
@@ITIndustryExposure Thanks alot sir
For immediate mode , doesn't it have to be preceded by the '#' sign? Like MOV A, #5H
@@nishanthr4968 Yes. I ran th command told by you in 8086 and it showed error.
Still watching in 2024❤✌
bro what does MOV AX,DATA mean? Is 'DATA' immediate?
Its move ax,@data and not move ax,data. here we are copying address of data segment to general purpose register that is AX.
Can you be my teacher? thank you so much!!!!!!
Thanks
thanks a lot sir