2020-04-13 11:49:42 +10:00
|
|
|
( With dst being assumed to be an AT28 EEPROM, perform !
|
|
|
|
operation while doing the right thing. Checks data integrity
|
|
|
|
and ABORT on mismatch.
|
|
|
|
)
|
2020-04-14 04:41:02 +10:00
|
|
|
( n a -- )
|
2020-04-13 11:49:42 +10:00
|
|
|
: AT28!
|
2020-04-14 04:41:02 +10:00
|
|
|
2DUP C!
|
|
|
|
( 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. )
|
2020-04-13 11:49:42 +10:00
|
|
|
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
|
|
|
|
;
|