| Games-NES-Emulator documentation | Contained in the Games-NES-Emulator distribution. |
CPU::Emulator::6502::Op::DEC - Decrement by one
Decrements the value at $addr by 1.
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::DEC; use strict; use warnings; use constant INSTRUCTIONS => { 0xC6 => { addressing => 'zero_page', cycles => 5, code => \&dec, }, 0xD6 => { addressing => 'zero_page_x', cycles => 6, code => \&dec, }, 0xCE => { addressing => 'absolute', cycles => 6, code => \&dec, }, 0xDE => { addressing => 'absolute_x', cycles => 7, code => \&dec, }, };
sub dec { my $self = shift; my $reg = $self->registers; my $temp = $self->memory->[ shift ]; $temp--; $self->RAM_write( $temp ); $self->set_nz( $temp ); }
1;