There appears to be a problem with the program generated from the following code:
chkstart=$ mov edx,1 jmp chkstart+maxsize
This, however, generates the correct jump
chkstart=$ nxt=$+maxsize mov edx,nxt jmp nxt
Here is the full test program:
.nolist
.586
.model flat, stdcall
option casemap:none ; case sensitive
include windows.inc
uselib Macro libname:req
include libname.inc
includelib libname.lib
Endm
uselib kernel32
uselib user32
.code
Program:
invoke ExitProcess,0 align 4
.listall
maxsize=40
chkstart=$ nxt=$+maxsize mov edx,nxt jmp nxt chkstart=$ mov edx,nxt jmp chkstart+maxsize
End Program
Here is the output from masm and jwasm
JWasm v2.12pre, Nov 27 2013
F:\WinAsm\Progs\alltemps\testjwasmbug\ec.asm
.listall
= 28 maxsize=40
00000008 = 8 C chkstart=$
00000008 = 30 C nxt=$+maxsize
00000008 BA30000000 mov edx,nxt
0000000D EB21 jmp nxt
0000000F = F C chkstart=$
0000000F BA30000000 mov edx,nxt
00000014 EB26 jmp chkstart+maxsize *******
End Program
00000016 F:\WinAsm\Progs\alltemps\testjwasmbug\ec.asm: 37 lines, 2 passes, 94 ms, 0 warnings, 0 errors
Microsoft (R) Macro Assembler Version 6.15.8803 05/19/14 13:41:07
F:\WinAsm\Progs\alltemps\testjwasmbug\ec.asm Page 1 - 1
invoke ExitProcess,0 align 4
= 00000028 .listall
00000008 maxsize=40
= 00000008
00000008 = 00000030 chkstart=$
00000008 BA 00000030 R nxt=$+maxsize
0000000D EB 21 mov edx,nxt
0000000F jmp nxt
= 0000000F
0000000F BA 00000030 R chkstart=$
00000014 EB 21 mov edx,nxt
jmp chkstart+maxsize
End Program
Notice the jmp chkstart+maxsize is not jumping to the correct spot