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

Function TestDATA

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

Source from the content-addressed store, hash-verified

284}
285
286func TestDATA(t *testing.T) {
287 ClearMem()
288 c := SetUpCPU()
289
290 var insAddr uint16 = 0x0000
291
292 // DATA R0
293 setMemoryLocation(c, insAddr, 0x0020)
294 setMemoryLocation(c, insAddr+1, 0xF071)
295
296 // DATA R1
297 setMemoryLocation(c, insAddr+2, 0x0021)
298 setMemoryLocation(c, insAddr+3, 0xF172)
299
300 // DATA R2
301 setMemoryLocation(c, insAddr+4, 0x0022)
302 setMemoryLocation(c, insAddr+5, 0xF273)
303
304 // DATA R3
305 setMemoryLocation(c, insAddr+6, 0x0023)
306 setMemoryLocation(c, insAddr+7, 0xF374)
307
308 c.SetIAR(insAddr)
309
310 setRegisters(c, [4]uint16{0x0001, 0x0001, 0x0001, 0x0001})
311
312 for i := 0; i < 4; i++ {
313 doFetchDecodeExecute(c)
314 }
315
316 checkRegisters(c, 0xF071, 0xF172, 0xF273, 0xF374, t)
317
318 // check IAR has incremented 2 each time
319 checkIAR(c, 0x0008, t)
320}
321
322func TestJMPR(t *testing.T) {
323 ClearMem()

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected