;;; This 8008 program will test memory. Basically, it writes ;;; pseudo-random byte values to all of memory (except the part ;;; where this program resides) and then reads each byte back, ;;; to see if the read value is correct. It repeats this 207 ;;; times, which is once for each possible random bit pattern. ;;; ;;; When the program finds an error in the read value, it will ;;; display the bit on the output led display (port 0), and halt. ;;; The operator then interrupts a NOP code (or LAA 300) onto the ;;; control panel, and the program displays the high-byte of the ;;; address of the error, and again halts. The operator interupts ;;; in another NOP code, and the program continues. ;;; ;;; While running, the program can either display the count of the ;;; number of cycles (about 4 minutes/cycle for 1K or 45 minutes ;;; for 16K) or the program can display the random number seed for ;;; the current pass (a much more interesting display, of 207 byte ;;; values. LBI 0 ; B will count number of complete cycles. START: LDI 001 ; D Is random number seed for this pass. LCI 004 ; C IS HIGHEST 6 BITS OF MEMTOP+1 ; (1 for 256, 4 for 1K, 64 for 16K.) NXTPAS: LHI \HB\ENDPRG ; Load HL with the starting address to test LLI \LB\ENDPRG ; (the address right after this program ; LAB ; Uncomment this line to display cycle count LAD ; Uncomment this line to display seed OUT 0 ; Display the cycle count or seed for pass. LED ; Load E with the random number WRNEXT: CAL RANDOM ; GET RAND, LOAD INTO MEMORY LMA INL JFZ WRNEXT INH LAH CPC ; Compare H with Memory Top JFZ WRNEXT ; If not done, write more READIT: LHI \HB\ENDPRG LLI \LB\ENDPRG ; Set HL to srarting point again. LED ; Reset seed again NXTLOC: CAL RANDOM XRM JTZ OKAY OUT 0 ; Error Found, Display Bad Bit and Halt HLT LAH OUT 0 HLT ; Display High Address and Halt INL JFZ NXTLOC INH LAH CPC JFZ NXTLOC OKAY: LED ; Gets here if read value is correct CAL RANDOM LDE ; Save Seed for next pass. CPI 001 ; When seed returns to one, we've done all JFZ NXTPAS ; 207 combos, and we're done with pass. INB ; Increment cycle counter JMP START ; Do another full cycle of program. ;;; Here is the Pseudo-Random Number Generator. It takes a Seed in ;;; the E register, and replaces it with the new pseudo-random ;;; sequence. The seqence generates 207 possible values, so after ;;; calling it 207 times, E will contain the original seed. RANDOM: LAE ; THE PSEUDORANDOM NUMBER RRC ; GENERATOR, MAKES A SEQUENCE RRC ; OF 207 OF POSSIBLE 256 VALUES. RRC XRE RAR LAE RRC LEA RET ENDPRG: ; THIS MARKS WHERE TO START TESTING MEM