问题描述:

I have a split a code and am trying to understand each part of it. I have learnt very well java, c++ and many languages, but assembly was difficult for me, so I came here.

I think that I know it, but I am not sure(it passed a long time). I checked on the internet, but I can't find anything. I wrote some things from code I had, because I wanted to test my knowledge, so, at this split code I have some comments. Please let me know if I am right or wrong. Please tell me where I'm wrong.

The program I use generally is emu8086. I don't know if this is playing an important role. The code may not be well-formatted, because it is only partial code.

1) MOV DS,AX ---> mean that AX will take the DS.The "variable" lets say

2) LEA DX,MESSAGE ---> LEA means load to DX

3) MOV AH,9 ---->Give(i am not sure if means move) the 9 to AH

4) INT 21H --->stops

5) MOV AL, N

Move N to AL

MUL AL --->multiple the AL that means N and N.More specific N*N

6) MOV SI, AX --->AX goes to SI (i hope with this to remember it good).That means N*N goes to SI?

`MOV BL, 2` --->Give 2 to BL

`MOV AL, N` --->Take N and give it to AL

`MUL BL` --->BL * AL?if i am not doing wrong that it is 2* N

7) SUB SI,AX ---> AX ( N*N) -SI(2*N)

INC SI ---> ?appear the sub?

8) MOV AX,SI --->SI goes to AX.2*N goes to AX.Now AX is 2*N

MOV CL,10 --->10 goes to CL

DIV CL -->2*N / 10 ?

9)MOV CL,AH --> AH "variable" goes to CL

MOV DL,AL -->AL "variable" goes to DL

ADD DL,48 -->DL will be AL +48

网友答案:
  1. Means: move (or copy/load) AX to DS (so the opposite you said)
  2. Means: load MESSAGE's address into DX
  3. Means what you said. MOV is for move
  4. Calls a subroutine. In this case it will print MESSAGE on screen see here for details
  5. Right
  6. Right
  7. Right. INC SI means: increase SI by 1.
  8. SI goeas into AX but the value is N*N - 2*N + 1 (If I'm following calculations properly). Also DIV works as you think, but remember about missing part of calculations ;)
  9. Right
相关阅读:
Top