/[VRac]/M6502/t/05-M6502.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /M6502/t/05-M6502.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 207 by dpavlin, Mon Apr 14 15:03:56 2008 UTC revision 208 by dpavlin, Mon Apr 14 19:40:02 2008 UTC
# Line 6  use strict; Line 6  use strict;
6  use blib;  use blib;
7  use lib './lib';  use lib './lib';
8    
9  use Test::More tests => 226;  use Test::More tests => 236;
10  use Test::Exception;  use Test::Exception;
11  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
12    
# Line 66  foreach my $byte ( 0x00, 0x01, 0xff, 0xa Line 66  foreach my $byte ( 0x00, 0x01, 0xff, 0xa
66          cmp_ok( M6502::_read($a), '==', $byte, 'M6502::_read' );          cmp_ok( M6502::_read($a), '==', $byte, 'M6502::_read' );
67  }  }
68    
69    M6502::mem_poke( 0x2000, 0x42 );
70    is( M6502::mem_peek( 0x2000 ), 0x42, 'mem_peek' );
71    
72    ok( my $bytes = M6502::mem_peek_region( 0x2000, 0x200f ), 'mem_peek_region' );
73    is( length($bytes), 0x10, 'correct size' );
74    is( $bytes, pack("H*","42ffffffffffffffffffffffffffffff"), 'correct' );
75    is( $bytes, pack('C*', M6502->ram( 0x2000, 0x200f )), 'M6502->ram' );
76    
77  sub dump_callbacks {  sub dump_callbacks {
78          my $out = 'callbacks:';          my $out = 'callbacks:';
79          $out .= sprintf(" %02x", M6502::get_callback( $_ )) foreach ( 0x6000 .. 0x6020 );          $out .= sprintf(" %02x", M6502::get_callback( $_ )) foreach ( 0x6000 .. 0x6020 );
# Line 111  foreach my $test ( @flip_tests ) { Line 119  foreach my $test ( @flip_tests ) {
119          dump_callbacks('after set_write_callback');          dump_callbacks('after set_write_callback');
120    
121          diag 'flip bytes 6502 asm';          diag 'flip bytes 6502 asm';
122          my $a = 0x1000;          my @flip_asm = (
   
         $mem[$a++] = $_ foreach (  
123                  0xa9, 0x60, 0xa2, 0x7f, 0xa0, 0x00, 0x85, 0xe1,                  0xa9, 0x60, 0xa2, 0x7f, 0xa0, 0x00, 0x85, 0xe1,
124                  0x84, 0xe0, 0xb1, 0xe0, 0x4a, 0x26, 0xe2, 0x4a,                  0x84, 0xe0, 0xb1, 0xe0, 0x4a, 0x26, 0xe2, 0x4a,
125                  0x26, 0xe2, 0x4a, 0x26, 0xe2, 0x4a, 0x26, 0xe2,                  0x26, 0xe2, 0x4a, 0x26, 0xe2, 0x4a, 0x26, 0xe2,
# Line 123  foreach my $test ( @flip_tests ) { Line 129  foreach my $test ( @flip_tests ) {
129                  0xd9, 0x60, 0x00,                  0xd9, 0x60, 0x00,
130          );          );
131    
132            my $a = 0x1000;
133    
134            $mem[$a++] = $_ foreach @flip_asm;
135    
136            is(
137                    M6502::mem_peek_region( 0x1000, $a - 1 ),
138                    pack('C*', @flip_asm),
139                    'mem_peek_region'
140            );
141    
142          diag 'clean video ram';          diag 'clean video ram';
143          $mem[$_] = $test->{fill} foreach ( 0x6000 .. 0x7fff );          $mem[$_] = $test->{fill} foreach ( 0x6000 .. 0x7fff );
144    

Legend:
Removed from v.207  
changed lines
  Added in v.208

  ViewVC Help
Powered by ViewVC 1.1.26