| | |
is this code Right and why
![]() |
•
•
Join Date: Dec 2005
Posts: 26
Reputation:
Solved Threads: 0
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
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
>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:
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.
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?
Once again, add doesn't have a valid syntax that takes 4 operands.
You're using ax as an offset into ax?
My only suggestion for the correct code would be a guess:
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.
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:
Assembly Syntax (Toggle Plain Text)
Get AX,[AX] Get BX,[BX] Get CX,[CX]
Assembly Syntax (Toggle Plain Text)
add AX[AX], BX,[BX]
Assembly Syntax (Toggle Plain Text)
add AX, [AX] , CX,[CX]
Assembly Syntax (Toggle Plain Text)
put AX[AX]
My only suggestion for the correct code would be a guess:
Assembly Syntax (Toggle Plain Text)
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
But even then it's still not entirely correct. IIRC, dx and cx can't be used for addressing in 16-bit programs.
I'm here to prove you wrong.
![]() |
Similar Threads
- Code 19 Registry Error (Windows NT / 2000 / XP)
- Why won't this code work? (VB.NET)
- Need help with DirectX code (C)
- Tutorials & Code Submissions - Questions? (DaniWeb Community Feedback)
- Some Basic Code Hopefully (Help Needed) (HTML and CSS)
Other Threads in the Assembly Forum
- Previous Thread: Control Intructions
- Next Thread: copy string and convert to upper case
| Thread Tools | Search this Thread |






