1
0
mirror of https://github.com/ariejan/i6502.git synced 2024-05-28 07:41:32 +00:00
i6502/cpu.go

26 lines
382 B
Go
Raw Normal View History

2014-08-12 19:28:30 +00:00
package i6502
type Cpu struct {
2014-08-13 07:26:33 +00:00
bus *AddressBus // The address bus
PC uint16 // 16-bit program counter
P byte // Status Register
}
const (
ResetVector = 0xFFFC
)
func NewCpu(bus *AddressBus) (*Cpu, error) {
return &Cpu{bus: bus}, nil
}
func (c *Cpu) HasAddressBus() bool {
return c.bus != nil
2014-08-12 19:28:30 +00:00
}
2014-08-13 07:26:33 +00:00
func (c *Cpu) Reset() {
c.PC = c.bus.Read16(ResetVector)
c.P = 0x34
2014-08-12 19:28:30 +00:00
}