Skip to content

Stub out memory bits #160

Description

@archanox
using System;

namespace GameboyEmulator
{
    public class GameboyMemory
    {
        private readonly Span<byte> _memory;

        public GameboyMemory(int size)
        {
            _memory = new byte[size];
        }

        public Span<byte> GetMemorySpan()
        {
            return _memory;
        }

        public Span<byte> ActiveCartridgeRom { get; private set; } = new Span<byte>();

        public void SwitchCartridgeRomBank(int bank)
        {
            int bankSize = 0x4000;
            int bankStart = bank * bankSize;
            ActiveCartridgeRom = _memory.Slice(bankStart, bankSize);
        }

        // ... other methods and properties
    }
}

public Span<byte> CartridgeRom => _memory.Slice(0x0000, 0x8000);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions