James_Parsons wrote:
I heard you could do a ram Test by writing $AA and $55 into ram locations and reading them back, but im a noob and I need to know how to read the ram back, and how to know if the test was a success
What is the goal? For example, do you want to test RAMs separately from the ones on the computer's own buses, like production test, being that if the RAM on the computer's own buses worked initially, it will probably continue to indefinitely? If you want to test the RAM on the computer's own buses, is it to verify the working of the RAM itself, or make sure the address decoding was done right, or something else?
If testing the computer's own memory that it needs to run, make sure that you first read each location and keep it in a register or a known-good RAM location before storing and checking the $55 and $AA, and then restore its original value after the check, and don't allow anything to interrupt that process that might overwrite something without saving and restoring. You can see that stepping on, and not restoring, needed variables, stack locations, etc. would crash the computer at some point.
If you're making an external tester like a peripheral, be sure to put other things on the bus between storing a value and reading it back, otherwise you don't know if you're just reading the same value back stored in the data bus capacitance and the memory wasn't really putting out anything. This is not an issue if you're testing RAM on the computer's own buses, because the data bus will have the values of program instruction op codes and operands between accesses to the location being tested. For my
4Mx8 10ns 5V SRAM module's testing, I store $A5 to one byte and $5A to the next, the go back to the first and read and make sure I get $A5, then read the second and make sure I get $5A. Then bus capacitance cannot fake a successful test. I do it again with $5A & $A5 (ie, flip all bits), so each location gets tested with both values. I have the display showing the address progress and the number of failures found (which so far is 0). I use the 8 bits of a byte variable to record which chips are to be tested, since someone may want a module that is less than fully loaded with all 8.
To answer one of your questions, reading back the values is just a matter of LDA___ or CMP___ (CMP to compare the read-back value with what's in the accumulator to make sure it matches) where what's in the blank ("___") tells the address and addressing mode (which may be indirect).
If you want actual code, it would be helpful if you can answer the questions at the top. We are not in the habit of doing homework for students, but will otherwise give whatever help we can to understand how to accomplish the goal.