NAME=negative branch bug 8bit
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=m68k
s 4
wx 60fc
ao | grep jump:
EOF
EXPECT=<<EOF
jump: 0x00000002
EOF
RUN

NAME=negative branch bug 16bit
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=m68k
s 0x200
wx 6000fe10
ao | grep jump:
EOF
EXPECT=<<EOF
jump: 0x00000012
EOF
RUN

NAME=negative branch bug 32bit
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=m68k
s 4
wx 60fffffffffc
ao | grep jump:
EOF
EXPECT=<<EOF
jump: 0x00000002
EOF
RUN


NAME=jsr.l should not terminate function

FILE=malloc://1024
CMDS=<<EOF
e asm.arch=m68k
wx 80004eb90000100080004e75
af
afl~[2]
EOF
EXPECT=<<EOF
12
EOF
RUN

NAME=jsr.w should not terminate function
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=m68k
wx 80004eb8100080004e75
af
afl~[2]
EOF
EXPECT=<<EOF
10
EOF
RUN


NAME="m68k: m68k filter"
CMDS=<<EOF
e asm.arch=m68k
e asm.bits=32
wx 33fc010000a10000
pi 1
f foo.bar = 0xa10000
pi 1
EOF
EXPECT=<<EOF
move.w 0x100, 0xa10000.l
move.w 0x100, foo.bar
EOF
RUN

NAME="m68k: m68k filter2"
CMDS=<<EOF
e asm.arch=m68k
e asm.bits=32
wx 33fc010000a10000
pi 1
f foo.bar = 0x100
pi 1
EOF
EXPECT=<<EOF
move.w 0x100, 0xa10000.l
move.w foo.bar, 0xa10000.l
EOF
RUN

NAME="m68k: m68k 8bit negative branch"

CMDS=<<EOF
e asm.arch=m68k
s 0x100
wx 6afc
pi 1
EOF
EXPECT=<<EOF
bpl.b 0xfe
EOF
RUN

NAME="m68k: m68k 16bit negative branch bug"

CMDS=<<EOF
e asm.arch=m68k
s 0x100
wx 6a00ff7e
pi 1
EOF
EXPECT=<<EOF
bpl.w 0x80
EOF
RUN

NAME="m68k: m68k 32bit negative branch"
CMDS=<<EOF
e asm.arch=m68k
s 0x100
wx 6affffffff7e
pi 1
EOF
EXPECT=<<EOF
bpl.l 0x80
EOF
RUN

NAME="m68k: m68k symbolic labels"
FILE=bins/smd/LiquidSpaceDodgerV3.bin
CMDS=<<EOF
e asm.arch=m68k
s 0x21a
f sym.z80BusReq @ 0x00a11100
pi 1
EOF
EXPECT=<<EOF
move.w 0x100, sym.z80BusReq
EOF
RUN

NAME=backwards seek
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=m68k
e scr.interactive=true
wx 381869000010533912345678680000202049
s 0x10
Vpkq
s
Vkq
s
Vkq
s
Vkq
s
EOF
EXPECT=<<EOF
0xc
0x6
0x2
0x0
EOF
RUN
