From 4c7dfe0dfe8b1f4e5aadd1c715b90c3a01a5642d Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 12 Apr 2020 21:49:42 -0400 Subject: [PATCH] Add drv/at28 --- drv/at28.fs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 drv/at28.fs diff --git a/drv/at28.fs b/drv/at28.fs new file mode 100644 index 0000000..7c3ce85 --- /dev/null +++ b/drv/at28.fs @@ -0,0 +1,17 @@ +( With dst being assumed to be an AT28 EEPROM, perform ! + operation while doing the right thing. Checks data integrity + and ABORT on mismatch. +) +( a n -- ) +: AT28! + 2DUP C! SWAP + ( as long as writing operation is running, IO/6 will toggle at each + read attempt. We know that write is finished when we read the same + value twice. ) + BEGIN ( n1 a ) + DUP C@ ( n1 a n2 ) + OVER C@ ( n1 a n2 n3 ) + = UNTIL + ( We're finished writing. do we have a mismatch? ) + C@ = NOT IF ABORT" mismatch" THEN +;