Why in this training code nop
? The code changes lowercase letters to the title.
Datasg Segment Para
MyText DB 'OUR Native Town', 13.10, '$'
Datasg Ends.
Stacksg Segment 'Stack'
DB 12 dup (?)
Stacksg Ends.
CodeSG Segment Para 'Code'
Begin Proc Far.
Assume SS: Stacksg, CS: CodeSG, DS: Datasg
Push ds.
Sub AX, AX
Push AX.
MOV AX, DATASG
MOV DS, AX
LEA BX, MyText
MOV CX, 10H
MT1: MOV AH, [BX]
CMP AH, 61H
JB MT2.
CMP AH, 7Ah
JA MT2.
Call Cor.
MT2: INC BX
Loop MT1.
LEA DX, MyText
MOV AH, 09H
INT 21H.
RET.
Begin Endp.
Cor Proc Near.
Nop.
And ah, 0dfh
MOV [BX], AH
RET.
Cor Endp.
Codesg Ends.
End Begin.
Answer 1, Authority 100%
There are several reasons to insert into the NOP code. One of them is to fit the size of the program under the desired to say, it occupied a certain amount of memory. The second is the alignment of command addresses that are executed (for optimization). The most common reason is to improve the work of the conveyor. To ensure the correct unconditional transitions, and that the predictor of the branches is less tupil, NOP is inserted, in case the predictor is mistaken. In case of an error, he will not do anything. With manual coding, the assembler does not make sense to do this. This is if briefly, because you can get a more deployed answer if you understand the processor architecture well. More NOP is often used to debug. In your code it is not needed.
Answer 2
I can assume that:
- This place where you can in the already working program put the “Point stop” or “Transition to the debugger”.
- place where you can put RET to make the plug procedure.
Answer 3
nop is the instruction “not surgery”, that is nothing.
Formally not needed.