MCPcopy Create free account
hub / github.com/djhworld/simple-computer / NewComputer

Function NewComputer

computer/computer.go:35–53  ·  view source on GitHub ↗
(screenChannel chan *[160][240]byte, quitChannel chan bool)

Source from the content-addressed store, hash-verified

33}
34
35func NewComputer(screenChannel chan *[160][240]byte, quitChannel chan bool) *SimpleComputer {
36 c := new(SimpleComputer)
37
38 c.screenChannel = screenChannel
39 c.quitChannel = quitChannel
40
41 c.mainBus = components.NewBus(arch.BUS_WIDTH)
42 c.memory = memory.NewMemory64K(c.mainBus)
43 c.cpu = cpu.NewCPU(c.mainBus, c.memory)
44
45 c.keyboardAdapter = io.NewKeyboardAdapter()
46 c.cpu.ConnectPeripheral(c.keyboardAdapter)
47
48 c.displayAdapter = io.NewDisplaydAdapter()
49 c.screenControl = io.NewScreenControl(c.displayAdapter, c.screenChannel, c.quitChannel)
50 c.cpu.ConnectPeripheral(c.displayAdapter)
51
52 return c
53}
54
55func (c *SimpleComputer) ConnectKeyboard(keyboard *io.Keyboard) {
56 keyboard.ConnectTo(c.keyboardAdapter.KeyboardInBus)

Callers 1

runFunction · 0.92

Calls 7

NewBusFunction · 0.92
NewMemory64KFunction · 0.92
NewCPUFunction · 0.92
NewKeyboardAdapterFunction · 0.92
NewDisplaydAdapterFunction · 0.92
NewScreenControlFunction · 0.92
ConnectPeripheralMethod · 0.80

Tested by

no test coverage detected