--- M6502/Screen.pm 2007/07/30 18:07:29 31 +++ M6502/Screen.pm 2007/07/30 18:37:37 32 @@ -109,3 +109,30 @@ } } +=head2 mmap_pixel + +Draw pixel in memory map + + $self->mmap_pixel( $addr, $r, $g, $b ); + +=cut + +# keep accesses to memory +my $_mem_stat; + +sub mmap_pixel { + my ( $self, $addr, $r, $g, $b ) = @_; + + my ( $x, $y ) = mem_xy( $addr ); + warn sprintf "## mem %04x %02x %02x %02d*%02d\n", $addr, $r, $g, $x, $y if $self->trace; + + my $col = sdl::color->new( -r => $r, -g => $g, -b => $b ); + $app->pixel( $x, $y, $col ); + + $_mem_stat++; + if ( $_mem_stat % 1000 == 0 ) { + $app->sync; + } +} + +1;