NAME
CPU::Emulator::6502 - Class representing a 6502 CPU
SYNOPSIS
DESCRIPTION
REGISTERS
acc - Accumulator
x
y
pc - Program Counter
sp - Stack Pointer
status
METHODS
new( )
init( )
create_instruction_table
Dynamically loads all instructions from the CPU::Emulator::6502::Op namespace and creates a table.
reset( )
Simulate a hardware reset or power-on
RAM_read( $address )
Reads data from $address
in memory.
RAM_write( $address => $data )
Writes $data
to $address
in memory.
interrupt_request()
execute_instruction( )
get_instruction( )
Reads the op from memory then moves the program counter forward 1.
debug( )
This will return of a string with some debugging info, including: the current instruction, the pc location of the instruction, 10 lines of context from the PRG at the pc location and the state of the stack, sp, a, x, y and status registers after the op has executed.
set_nz( $value )
Sets the Sign and Zero status flags based on $value
.
push_stack( $value )
Pushes $value
onto the stack and decrements the stack pointer.
pop_stack( )
Increments the stack pointer and returns the current stack value.
branch_if( $bool )
Branches if $bool
is true.
make_word( $lo, $hi )
Combines $lo
and $hi
into a 16-bit word.
lo_byte( $word )
Returns the lower byte of $word
.
hi_byte( $word )
Returns the higher byte of $word
.
AUTHOR
Brian Cassidy <bricas@cpan.org>
COPYRIGHT AND LICENSE
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.