Mirror of CollapseOS
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

62 lines
2.5KB

  1. # Writing to a AT28 from Collapse OS
  2. # Gathering parts
  3. * A RC2014 Classic
  4. * An extra AT28C64B
  5. * 1x 40106 inverter gates
  6. * Proto board, RC2014 header pins, wires, IC sockets, etc.
  7. # Building the EEPROM holder
  8. The AT28 is SRAM compatible so you could use a RAM module for
  9. it. However, there is only one RAM module with the Classic
  10. version of the RC2014 and we need it to run Collapse OS.
  11. You could probably use the 64K RAM module for this purpose, but
  12. I don't have one and I haven't tried it. For this recipe, I
  13. built my own module which is the same as the regular ROM module
  14. but with WR wired and geared for address range 0x2000-0x3fff.
  15. If you're tempted by the idea of hacking your existing RC2014
  16. ROM module by wiring WR and write directly to the range
  17. 0x0000-0x1fff while running it, be aware that it's not that
  18. easy. I was also tempted by this idea, tried it, but on bootup,
  19. it seems that some random WR triggers happen and it corrupts the
  20. EEPROM contents. Theoretically, we could go around that by
  21. putting the AT28 in write protection mode, but I preferred
  22. building my own module.
  23. I don't think you need a schematic. It's really simple.
  24. # Writing contents to the AT28
  25. If you wait 10ms between each byte you write, you can write dir-
  26. ectly to the AT28 with regular memory access words. If you don't
  27. wait, the AT28 writing program will fail. Because it's not very
  28. pratical to insert waiting time between each byte writes, you
  29. need another solution.
  30. To that end, Collapse OS has a "memory write override" mech-
  31. anism. Whenever C! or ! is about to set a byte somewhere in
  32. memory, it checks whether such an override is active. If it is,
  33. it calls it. That override is set with the "~C!" word.
  34. B400 contains an override routine compatible with ~C! called
  35. ~AT28. When you're about to write to your AT28, activate that
  36. override with "' ~AT28 ~C!". That overwrite will write the byte,
  37. then poll the AT28 until it indicates that it is finished
  38. writing. This ensures that Collapse OS doesn't try writing
  39. another byte before the AT28 is ready.
  40. When you're done writing to the AT28, unset override with
  41. "0 ~C!". The override routine has a non-negligible speed impact
  42. on all memory writes.
  43. When polling, ~AT28 also verifies that the final byte in memory
  44. is the same as the byte written. If it's not, it will place a
  45. non-zero value in the ~C!ERR 1b variable. Therefore, if you want
  46. to see, after a big write operation to your AT28, whether any
  47. write failed, do "~C!ERR C@ .". Re-initialize to zero before
  48. your next write operation.