root/lang/perl/CPU-Z80/trunk/lib/CPU/Z80/Bus.pm @ 4388

Revision 4388, 0.6 kB (checked in by yappo, 6 years ago)

lang/perl/CPU-Z80: import

Line 
1package CPU::Z80::Bus;
2use strict;
3use warnings;
4use base 'Class::Accessor::Lvalue::Fast';
5
6use Scalar::Util;
7
8use CPU::Z80::Util;
9
10my @SIGNALS = qw(
11    address data
12    mreq iorq rd wd rfsh m1
13    wait int mni halt
14    busrq busak
15);
16__PACKAGE__->mk_accessors(@SIGNALS);
17
18sub new {
19    my($class, %args) = @_;
20    my $self = bless {}, $class;
21    $self->{$_} = bs_h for @SIGNALS;
22    if ($args{cpu}) {
23        $self->{cpu} = delete $args{cpu};
24        Scalar::Util::weaken( $self->{cpu} );
25    }
26
27    $self;
28}
29
30sub cpu { shift->{cpu} }
31sub reset {
32    my($self, $flag) = @_;
33    return bs_h unless $flag eq bs_l;
34    $self->cpu->reset;
35
36    bs_l;
37}
38
391;
40
Note: See TracBrowser for help on using the browser.