The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: bawrobin on March 22, 2010, 07:09:20 AM

Title: JMP function
Post by: bawrobin on March 22, 2010, 07:09:20 AM
Hello.
Please help.


Here is my code:

.686p

.model flat, stdcall

option casemap:none


includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\windows.inc





.data

MsgText     db 'Calculating results - %d',0
MsgTitle    db 'Hello',0
buffer      db 100 dup(?)
number EQU 80




.code
start:

mov eax, number

jmp sign1

sign1:
sub eax, 15

sign2:
add eax, 20

   invoke  wsprintf,ADDR buffer,ADDR MsgText,eax
   invoke  MessageBox,0,ADDR buffer,ADDR MsgTitle,MB_OK
   invoke  ExitProcess,0

end start




Please help.
I need to ignore "sign2:*" code after executing jumping and reading to sign1. So, I need that results must be 65. Please help. How to ignore reading of sign2 after jumping to sign1.
Title: Re: JMP function
Post by: MichaelW on March 22, 2010, 07:13:36 AM
One possibility:

sign1:
  sub eax, 15
  jmp around2
sign2:
  add eax, 20
around2: 
Title: Re: JMP function
Post by: bawrobin on March 22, 2010, 07:29:57 AM
Thank you. It works !
Title: Re: JMP function
Post by: theunknownguy on March 22, 2010, 10:54:22 PM
Quote from: MichaelW on March 22, 2010, 07:13:36 AM
One possibility:

sign1:
  sub eax, 15
  jmp around2
sign2:
  add eax, 20
around2: 


Another here:

sign1:
  sub eax, 15
  sub eax, 20
sign2:
  add eax, 20


When it pass over the add eax, 20 it will be like nothing happen, but lol i just go to far with the assumption ^^.

sign1:
  sub eax, 15
  push offset lol
  ret
sign2:
  add eax, 20
lol::


Too far again...
Title: Re: JMP function
Post by: MichaelW on March 22, 2010, 11:16:29 PM
QuoteToo far again...

Yes, too far :lol