1+ using OldBit . Spectron . Files . Z80 ;
2+ using OldBit . Spectron . Files . Z80 . Types ;
3+
4+ namespace OldBit . Spectron . Files . Tests . Z80 ;
5+
6+ public class Z80FileTests
7+ {
8+ [ Fact ]
9+ public void Memory48_ShouldHaveCorrectBlocsAndValues ( )
10+ {
11+ var memory = new byte [ 0xC000 ] ;
12+
13+ Array . Fill < byte > ( memory , 8 , 0x0000 , 0x4000 ) ;
14+ Array . Fill < byte > ( memory , 4 , 0x4000 , 0x4000 ) ;
15+ Array . Fill < byte > ( memory , 5 , 0x8000 , 0x4000 ) ;
16+
17+ var header = new Z80Header
18+ {
19+ HardwareMode = HardwareMode . Spectrum48 ,
20+ PC = 0xE000 ,
21+ } ;
22+
23+ var snapshot = new Z80File ( header , memory ) ;
24+
25+ snapshot . MemoryBlocks . Count . ShouldBe ( 3 ) ;
26+
27+ snapshot . MemoryBlocks [ 0 ] . PageNumber . ShouldBe ( 4 ) ;
28+ snapshot . MemoryBlocks [ 0 ] . Data . Length . ShouldBe ( 0x4000 ) ;
29+ snapshot . MemoryBlocks [ 0 ] . Data . ShouldAllBe ( b => b == 4 ) ;
30+
31+ snapshot . MemoryBlocks [ 1 ] . PageNumber . ShouldBe ( 5 ) ;
32+ snapshot . MemoryBlocks [ 1 ] . Data . Length . ShouldBe ( 0x4000 ) ;
33+ snapshot . MemoryBlocks [ 1 ] . Data . ShouldAllBe ( b => b == 5 ) ;
34+
35+ snapshot . MemoryBlocks [ 2 ] . PageNumber . ShouldBe ( 8 ) ;
36+ snapshot . MemoryBlocks [ 2 ] . Data . Length . ShouldBe ( 0x4000 ) ;
37+ snapshot . MemoryBlocks [ 2 ] . Data . ShouldAllBe ( b => b == 8 ) ;
38+
39+ }
40+ }
0 commit comments