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.
MOV DS,AX ---> mean that AX will take the DS.The "variable" lets say
LEA DX,MESSAGE ---> LEA means load to DX
MOV AH,9 ---->Give(i am not sure if means move) the 9 to AH
INT 21H --->stops
MOV AL, N
Move N to AL
MUL AL --->multiple the AL that means N and N.More specific N*N
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
SUB SI,AX ---> AX ( N*N) -SI(2*N)
INC SI ---> ?appear the sub?
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 ?
MOV CL,AH --> AH "variable" goes to CL
MOV DL,AL -->AL "variable" goes to DL
ADD DL,48 -->DL will be AL +48
DS(so the opposite you said)
MESSAGE's address into
MOVis for move
MESSAGEon screen see here for details
INC SImeans: increase
AXbut the value is N*N - 2*N + 1 (If I'm following calculations properly). Also
DIVworks as you think, but remember about missing part of calculations ;)