CMP AL,0D
Compare the AL register with the hexadecimal number 0D. 0D is the ASCII code of the Enter key. This line is asking "Was the enter key pressed?" CMP works by subtracting 0D from AL. If they were equal then the subtraction gives an answer of zero. This causes the CPU zero or 'Z' flag to be set.
JZ Stop
Jump to the Stop label if the CPU 'Z' flag was set. This is a conditional jump.
MOV [BL],AL
Move the key press stored in AL into the RAM location that [BL] points to. INC BL is then used to make BL point to the next RAM location.
JMP Rep
Jump back to the Rep label. This is an unconditional jump. It always jumps and the CPU flags are ignored.
RET
Return from the procedure to the address stored on the stack. This is done by setting the instruction pointer IP in the CPU.
Share with your friends: |