mirror of
https://github.com/ariejan/i6502.git
synced 2024-06-04 08:29:27 +00:00
26 lines
382 B
Go
26 lines
382 B
Go
package i6502
|
|
|
|
type Cpu struct {
|
|
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
|
|
}
|
|
|
|
func (c *Cpu) Reset() {
|
|
c.PC = c.bus.Read16(ResetVector)
|
|
c.P = 0x34
|
|
}
|