0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-08-23 10:33:50 -04:00

Allow explicit immediate syntax for imz2 as well as is4

imz2 is just an alias for is4 as far as we are concerned...
This commit is contained in:
H. Peter Anvin 2008-05-20 09:36:41 -07:00
parent e6fb38b9f2
commit 24860b0f0e

View File

@ -678,14 +678,15 @@ sub byte_code_compile($) {
die "$0: $line: $op without 'i' and 's' operands\n"; die "$0: $line: $op without 'i' and 's' operands\n";
} }
push(@codes, 0172, ($oppos{'s'} << 3)+$oppos{'i'}); push(@codes, 0172, ($oppos{'s'} << 3)+$oppos{'i'});
} elsif ($op =~ /^is4\=([0-9]+)$/) { } elsif ($op =~ /^(is4|imz2)\=([0-9]+)$/) {
my $imm = $2;
if (!defined($oppos{'s'})) { if (!defined($oppos{'s'})) {
die "$0: $line: $op without 's' operand\n"; die "$0: $line: $op without 's' operand\n";
} }
if ($1 < 0 || $1 > 15) { if ($imm < 0 || $imm > 15) {
die "$0: $line: invalid imm4 value for $op\n"; die "$0: $line: invalid imm4 value for $op: $imm\n";
} }
push(@codes, 0173, ($oppos{'s'} << 4) + $1); push(@codes, 0173, ($oppos{'s'} << 4) + $imm);
} elsif ($op =~ /^([0-9a-f]{2})\+s$/) { } elsif ($op =~ /^([0-9a-f]{2})\+s$/) {
if (!defined($oppos{'i'})) { if (!defined($oppos{'i'})) {
die "$0: $op without 'i' operand\n"; die "$0: $op without 'i' operand\n";