Fix check for JMP Rn (which is illegal).

This commit is contained in:
Olaf Seibert 2015-05-31 23:34:05 +02:00
parent 60d0afde00
commit a24e3ba3ea
3 changed files with 19 additions and 2 deletions

View File

@ -1241,7 +1241,7 @@ static int assemble(
return 0;
}
if (op->value == 0100 && (mode.type & 07) == 0) {
if (op->value == 0100 && (mode.type & 070) == 0) {
report(stack->top, "JMP Rn is illegal\n");
/* But encode it anyway... */
}

View File

@ -6,7 +6,7 @@
# If there is a .objd.ok file, it compares the result of dumpobj.
#
TESTS="test-asciz test-backpatch test-bsl-mac-arg test-complex-reloc test-endm test-include test-locals test-macro-comma test-undef test-word-comma"
TESTS="test-asciz test-backpatch test-bsl-mac-arg test-complex-reloc test-endm test-include test-jmp test-locals test-macro-comma test-undef test-word-comma"
for t in $TESTS
do

17
tests/test-jmp.mac Normal file
View File

@ -0,0 +1,17 @@
;;;;;
;
; Tests the addressing modes for JMP.
; JMP Rx is not allowed, all other modes are.
;
start: jmp end
jmp r1 ; must fail
jmp (r1)
jmp (r1)+
jmp @(r1)+
jmp -(r1)
jmp @-(r1)
jmp 1234(r1)
jmp @1234(r1)
end: