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

Function testJMP

cpu/cpu_test.go:357–377  ·  view source on GitHub ↗
(expectedIAR uint16, t *testing.T)

Source from the content-addressed store, hash-verified

355}
356
357func testJMP(expectedIAR uint16, t *testing.T) {
358 c := SetUpCPU()
359 var insAddr uint16 = 0x0000
360
361 // JMP
362 setMemoryLocation(c, insAddr, 0x0040)
363 setMemoryLocation(c, insAddr+1, expectedIAR)
364
365 c.SetIAR(insAddr)
366
367 inputRegisters := [4]uint16{0x0001, 0x0001, 0x0001, 0x0001}
368 setRegisters(c, inputRegisters)
369
370 doFetchDecodeExecute(c)
371
372 // registers shouldn't change
373 checkRegisters(c, inputRegisters[0], inputRegisters[1], inputRegisters[2], inputRegisters[3], t)
374
375 // check IAR has jumped to the new location
376 checkIAR(c, expectedIAR, t)
377}
378
379func TestJMPC(t *testing.T) {
380 ClearMem()

Callers 1

TestJMPFunction · 0.85

Calls 7

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