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

Function TestSTThenLD

cpu/cpu_test.go:135–167  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

133 checkFlagsRegister(c, true, true, false, true, t)
134}
135func TestSTThenLD(t *testing.T) {
136 ClearMem()
137 c := SetUpCPU()
138
139 for i := uint16(0); i < 512; i++ {
140 // ST R2, R3
141 setMemoryLocation(c, i, 0x001B)
142 }
143 c.SetIAR(0x0000)
144
145 //storing values into memory
146 var value uint16 = 0x0400
147 for i := 0x0200; i < 0x0400; i++ {
148 setRegisters(c, [4]uint16{0x0001, 0x0001, uint16(i), value})
149 doFetchDecodeExecute(c)
150 value--
151 }
152
153 for i := uint16(0); i < 512; i++ {
154 // LD R2, R3
155 setMemoryLocation(c, i, 0x000B)
156 }
157 c.SetIAR(0x0000)
158
159 //retrieving them back from memory
160 value = 0x0400
161 for i := 0x0200; i < 0x0400; i++ {
162 setRegisters(c, [4]uint16{0x0001, 0x0001, uint16(i), 0x0001})
163 doFetchDecodeExecute(c)
164 checkRegisters(c, 0x0001, 0x0001, uint16(i), value, t)
165 value--
166 }
167}
168
169func TestLD4Times(t *testing.T) {
170 ClearMem()

Callers

nothing calls this directly

Calls 7

ClearMemFunction · 0.85
SetUpCPUFunction · 0.85
setMemoryLocationFunction · 0.85
setRegistersFunction · 0.85
doFetchDecodeExecuteFunction · 0.85
checkRegistersFunction · 0.85
SetIARMethod · 0.80

Tested by

no test coverage detected