Support for .asciz directive in perlasm modules.
This commit is contained in:
parent
591e85e928
commit
d68ff71004
@ -64,6 +64,14 @@ my $machine = sub {
|
|||||||
}
|
}
|
||||||
".machine $arch";
|
".machine $arch";
|
||||||
};
|
};
|
||||||
|
my $asciz = sub {
|
||||||
|
shift;
|
||||||
|
my $line = join(",",@_);
|
||||||
|
if ($line =~ /^"(.*)"$/)
|
||||||
|
{ ".byte " . join(",",unpack("C*",$1),0); }
|
||||||
|
else
|
||||||
|
{ ""; }
|
||||||
|
};
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# simplified mnemonics not handled by at least one assembler
|
# simplified mnemonics not handled by at least one assembler
|
||||||
|
@ -323,6 +323,8 @@ my $current_function;
|
|||||||
$line =~ s/\@function.*/\@function/;
|
$line =~ s/\@function.*/\@function/;
|
||||||
if ($line =~ /\.picmeup\s+(%r[\w]+)/i) {
|
if ($line =~ /\.picmeup\s+(%r[\w]+)/i) {
|
||||||
$self->{value} = sprintf "\t.long\t0x%x,0x90000000",$opcode{$1};
|
$self->{value} = sprintf "\t.long\t0x%x,0x90000000",$opcode{$1};
|
||||||
|
} elsif ($line =~ /\.asciz\s+"(.*)"$/) {
|
||||||
|
$self->{value} = ".byte\t".join(",",unpack("C*",$1),0);
|
||||||
} else {
|
} else {
|
||||||
$self->{value} = $line;
|
$self->{value} = $line;
|
||||||
}
|
}
|
||||||
@ -378,6 +380,12 @@ my $current_function;
|
|||||||
/\.picmeup/ && do { $self->{value} = sprintf"\tDD\t 0%Xh,090000000h",$opcode{$line};
|
/\.picmeup/ && do { $self->{value} = sprintf"\tDD\t 0%Xh,090000000h",$opcode{$line};
|
||||||
last;
|
last;
|
||||||
};
|
};
|
||||||
|
/\.asciz/ && do { if ($line =~ /^"(.*)"$/) {
|
||||||
|
$self->{value} = "DB\t"
|
||||||
|
.join(",",unpack("C*",$1),0);
|
||||||
|
}
|
||||||
|
last;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
$line = "";
|
$line = "";
|
||||||
}
|
}
|
||||||
|
@ -94,6 +94,8 @@ sub ::function_end_A
|
|||||||
$stack+=16; # readjust esp as if we didn't pop anything
|
$stack+=16; # readjust esp as if we didn't pop anything
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub ::asciz { foreach (@_) { &data_byte(unpack("C*",$_[0]),0); } }
|
||||||
|
|
||||||
sub ::asm_finish
|
sub ::asm_finish
|
||||||
{ &file_end();
|
{ &file_end();
|
||||||
print @out;
|
print @out;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user