2 ### Class Stub68k: Create a 68k stub file #####################################
11 my $class = ref($proto) || $proto;
12 my $self = $class->SUPER::new
( @_ );
13 bless ($self, $class);
20 my $prototype = $params{'prototype'};
21 my $sfd = $self->{SFD
};
23 if ($prototype->{type
} eq 'function') {
27 if (!$prototype->{nb
}) {
28 print " BASE_EXT_DECL\n";
30 if (!$prototype->{nr
}) {
31 print " register $prototype->{return} _res __asm(\"d0\");\n";
33 if (!$prototype->{nb
}) {
34 print " register $sfd->{basetype} _base __asm(\"a6\") " .
39 $self->SUPER::function_start
(@_);
46 my $prototype = $params{'prototype'};
47 my $argtype = $params{'argtype'};
48 my $argname = $params{'argname'};
49 my $argreg = $params{'argreg'};
50 my $argnum = $params{'argnum'};
51 my $sfd = $self->{SFD
};
53 if ($$prototype{'type'} eq 'function') {
54 if ($argreg eq 'a4' || $argreg eq 'a5') {
58 print " register $prototype->{args}[$argnum] __asm(\"$argreg\") " .
62 $self->SUPER::function_arg
(@_);
69 my $prototype = $params{'prototype'};
70 my $sfd = $self->{SFD
};
73 if ($$prototype{'type'} eq 'function') {
74 my $regs = join(',', @
{$$prototype{'regs'}});
75 my $a4 = $regs =~ /a4/;
76 my $a5 = $regs =~ /a5/;
78 if ($a4 && $a5 && !$quiet) {
79 print STDERR
"$$prototype{'funcname'} uses both a4 and a5 " .
80 "for arguments. This is not going to work.\n";
84 print " __asm volatile (\"exg d7,a4\\n\\tjsr a6@(-" .
85 "$prototype->{bias}:W)\\n\\texg d7,a4\"\n";
88 print " __asm volatile (\"exg d7,a5\\n\\tjsr a6@(-" .
89 "$prototype->{bias}:W)\\n\\texg d7,a5\"\n";
92 print " __asm volatile (\"jsr a6@(-$prototype->{bias}:W)\"\n";
95 ($prototype->{nr
} ?
"/* No output */" : '"=r" (_res)') . "\n";
97 if (!$prototype->{nb
}) {
101 for my $i (0 .. $prototype->{numargs
} - 1) {
102 if ($i != 0 || !$prototype->{nb
}) {
106 print '"r" (' . $prototype->{argnames
}[$i] . ')';
110 print ' : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");';
113 if (!$prototype->{nr
}) {
114 print " return _res;\n";
120 $self->SUPER::function_end
(@_);