Guys..
See this code? is it right code or have it mistake?please advice in details,

1- By knowing the numbers: so i guess here the numbering is knowing

mov AX, 2
mov BX, 2
mov CX, 2
add AX,BX
add AX,CX
put AX
end


2- By entering the number enering from the users. here i am using memordy addressing and inderect addressing

Get AX,[AX]
Get BX,[BX]
Get CX,[CX]
add AX[AX], BX,[BX]
add AX, [AX] , CX,[CX]
put AX[AX]
end

Recommended Answers

All 2 Replies

Hellooooo
anybody here?!!

>anybody here?!!
Yes, but let me make it clear that just because you ask a question, it doesn't mean you're entitled to an answer. We're all volunteers here, and we aren't obliged to help you if we don't want to. Bumping your thread on the assumption that you deserve an answer is very rude.

>is it right code or have it mistake?
I'm inclined to think that it's a mistake. Let's see why:

Get AX,[AX]
Get BX,[BX]
Get CX,[CX]

What does Get do? Unless ax, bx, and cx hold the addresses of memory locations that you want to write to, I would question why you're using indirect memory addressing here, and the purpose of the other operand.

add AX[AX], BX,[BX]

That's not even a valid syntax for add. You have 3 operands instead of 2, and it looks like you're trying to use ax as an offset for ax?

add AX, [AX] , CX,[CX]

Once again, add doesn't have a valid syntax that takes 4 operands.

put AX[AX]

You're using ax as an offset into ax?

My only suggestion for the correct code would be a guess:

Get dx ; Using ax for other things
Get bx
Get cx
mov ax,[dx] ; add doesn't allow mem,mem operands
add ax,[bx]
add ax,[cx]
Put ax

This is on the assumption that dx, bx, and cx already contain addresses to memory that you want to write to. Then Get uses those addresses to get user input. The value of contained at the address of dx is stored in ax, then the values contained at the addresses of bx and cx are added to ax, and the value of ax (the result) is sent to Put to be printed to the screen.

But even then it's still not entirely correct. IIRC, dx and cx can't be used for addressing in 16-bit programs.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.