| Games-NES-Emulator documentation | Contained in the Games-NES-Emulator distribution. |
CPU::Emulator::6502::Op::BRK - Force break
Force break.
Brian Cassidy <bricas@cpan.org>
Copyright 2007 by Brian Cassidy
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Games-NES-Emulator documentation | Contained in the Games-NES-Emulator distribution. |
package CPU::Emulator::6502::Op::BRK; use strict; use warnings; use constant INSTRUCTIONS => { 0x00 => { cycles => 7, code => \&brk, } };
sub brk { my $self = shift; my $reg = $self->registers; my $mem = $self->memory; $self->push_stack( $self->hi_byte( $reg->{ pc } + 1 ) ); $self->push_stack( $self->lo_byte( $reg->{ pc } + 1 ) ); $reg->{ status } |= CPU::Emulator::6502::SET_BRK; $self->push_stack( $reg->{ status } ); $reg->{ pc } = $self->make_word( $mem->[ 0xfffe ], $mem->[ 0xffff ] ); }
1;