A segment is a window into memory.
Exemple #1
0
 /// <summary>
 /// Initializes arrays for memory banks, internal ram, and internal rom.
 /// Must be called before running any operations.
 /// </summary>
 public void InitializeMemory()
 {
     m_CS_NoMMU = new Segment(SegmentIndex.CS, BUS, 0x80000000);
     m_DS_NoMMU = new Segment(SegmentIndex.DS, BUS, 0x00000000);
     m_ES_NoMMU = new Segment(SegmentIndex.ES, BUS, 0x00000000);
     m_SS_NoMMU = new Segment(SegmentIndex.SS, BUS, 0x00000000);
     m_IS_NoMMU = new Segment(SegmentIndex.IS, BUS, 0x80000000);
     m_CSS = new Segment(SegmentIndex.CS, BUS, 0x80000000);
     m_CSU = new Segment(SegmentIndex.CS, BUS, 0x80000000);
     m_DSS = new Segment(SegmentIndex.DS, BUS, 0x00000000);
     m_DSU = new Segment(SegmentIndex.DS, BUS, 0x00000000);
     m_ESS = new Segment(SegmentIndex.ES, BUS, 0x00000000);
     m_ESU = new Segment(SegmentIndex.ES, BUS, 0x00000000);
     m_SSS = new Segment(SegmentIndex.SS, BUS, 0x00000000);
     m_SSU = new Segment(SegmentIndex.SS, BUS, 0x00000000);
     m_IS = new Segment(SegmentIndex.IS, BUS, 0x80000000);
 }
Exemple #2
0
 /// <summary>
 /// Returns  the byte array of memory attached to the device. Accepts values from 0 - 16. Device 0 is ROM.
 /// </summary>
 internal void GetDeviceMemoryReference(Segment segment, ushort deviceIndex)
 {
     if (deviceIndex == 0) {
         // request memory from ycpu
         GetROMReference(segment);
     }
     else if (deviceIndex > 16) {
         // this should never happen - requested memory from device index that cannot exist.
         segment.SetMemoryReference(null);
         segment.Reference = MemoryReferenceInfo.None;
         AddSegmentToReferences(segment);
     }
     else {
         // request memory from device in slot index.
         if (m_Devices[deviceIndex - 1] == null) {
             segment.SetMemoryReference(null);
             segment.Reference = MemoryReferenceInfo.None;
         }
         else {
             segment.SetMemoryReference(m_Devices[deviceIndex - 1].GetMemoryInterface());
             segment.Reference = MemoryReferenceInfo.Device | (MemoryReferenceInfo)deviceIndex;
         }
         AddSegmentToReferences(segment);
     }
 }
Exemple #3
0
 internal void GetROMReference(Segment segment)
 {
     segment.SetMemoryReference(m_ROM);
     segment.Reference = MemoryReferenceInfo.ROM;
     AddSegmentToReferences(segment);
 }
Exemple #4
0
 internal void AddSegmentToReferences(Segment segment)
 {
     int index = m_References.IndexOf(segment);
     if (index == -1) {
         m_References.Add(segment);
     }
 }