Assembly: Constant jmp Statement (MASM/TASM)

Posted March 5, 2006 by William_Wilson in Computer programming

The following tech recipe covers how to use jmp.


jmp, used as a jump statement, jumps from one place to another.

Example:

.MODEL SMALL
.STACK 100H
.DATA
result_msg DB 'true inside if statement',0
test_msg DB 'no jmp',0

.486
.CODE
INCLUDE io.mac

main PROC
.STARTUP

start_go:
putStr test_msg
jmp done
mov Ax,0
putStr test_msg
cmp Ax,0
jne done

putStr test_msg
putStr test_msg

done:
putStr test_msg
.EXIT

main ENDP
END main

All of the code in this program is passed over by this jmp command. Try moving it to different places to prove that it is a static jump, and all code between the jump and the target (in this case, the tag done) is skipped.

Questions/Comments: [email protected]
-William. ยง (marvin_gohan)

The Conversation

Follow the reactions below and share your own thoughts.