Esempio n. 1
0
func NewOAM() *OAM {
	return &OAM{
		BasicMemory: m65go2.NewBasicMemory(256),
		Buffer:      m65go2.NewBasicMemory(32),
		readCycle:   fetchAddress,
		writeCycle:  failCopyYPosition,
	}
}
Esempio n. 2
0
func NewRP2A03() *RP2A03 {
	mem := NewMappedMemory(m65go2.NewBasicMemory(m65go2.DEFAULT_MEMORY_SIZE))
	mirrors := make(map[uint16]uint16)

	// Mirrored 2KB internal RAM
	for i := uint16(0x0800); i <= 0x1fff; i++ {
		mirrors[i] = i % 0x0800
	}

	// Mirrored PPU registers
	for i := uint16(0x2008); i <= 0x3fff; i++ {
		mirrors[i] = 0x2000 + (i & 0x0007)
	}

	mem.AddMirrors(mirrors)

	cpu := m65go2.NewM6502(mem)
	cpu.DisableDecimalMode()
	apu := NewAPU()

	// APU memory maps
	mem.AddMappings(apu, CPU)

	dma := NewDMA(mem)

	// DMA memory maps
	mem.AddMappings(dma, CPU)

	return &RP2A03{
		Memory: mem,
		M6502:  cpu,
		APU:    apu,
		dma:    dma,
	}
}
Esempio n. 3
0
func NewRP2C02(interrupt func(bool)) *RP2C02 {
	mem := rp2ago3.NewMappedMemory(m65go2.NewBasicMemory(m65go2.DEFAULT_MEMORY_SIZE))
	mirrors := make(map[uint16]uint16)

	// Mirrored nametables
	for i := uint16(0x3000); i <= 0x3eff; i++ {
		mirrors[i] = i - 0x1000
	}

	// Mirrored palette
	for _, i := range []uint16{0x3f10, 0x3f14, 0x3f18, 0x3f1c} {
		mirrors[i] = i - 0x0010
	}

	for i := uint16(0x3f20); i <= 0x3fff; i++ {
		mirrors[i] = i - 0x0020
	}

	mem.AddMirrors(mirrors)

	return &RP2C02{
		Output:    make(chan []uint8),
		Memory:    mem,
		Interrupt: interrupt,
		oam:       NewOAM(),
		Cycles:    make(chan uint16),
	}
}