| Games-NES-Emulator documentation | Contained in the Games-NES-Emulator distribution. |
CPU::Emulator::6502::Op::CPY - Compare the Y register
Compares the Y register to the data held at $addr.
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::CPY; use strict; use warnings; use constant INSTRUCTIONS => { 0xC0 => { addressing => 'immediate', cycles => 2, code => \&cpy }, 0xC4 => { addressing => 'zero_page', cycles => 3, code => \&cpy }, 0xCC => { addressing => 'absolute', cycles => 4, code => \&cpy } };
sub cpy { my $self = shift; my $reg = $self->registers; my $temp = $reg->{ y } - $self->memory->[ shift ]; $reg->{ status } &= CPU::Emulator::6502::CLEAR_SZC; $self->set_nz( $temp ); $reg->{ status } |= CPU::Emulator::6502::SET_CARRY if $temp < 0x100; }
1;