From 06b71a69065912136b50b14f1505ea2169062138 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 7 Dec 2020 12:28:48 -0500 Subject: [PATCH] Add AT28, as a companion to AT28! This word, suitable to plug to A, , increases HERE before doing its verification to minimize waiting time: While we increase HERE, the AT28 has the time to do its programming, and thus we'll need to idle for less time afterwards. Also, made the mismatch check silently ignore MSB. Previously, writing a value larger than 0xff with AT28! would always result in a mismatch. --- blk.fs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/blk.fs b/blk.fs index d58310d..d32fba5 100644 --- a/blk.fs +++ b/blk.fs @@ -2204,11 +2204,10 @@ XCURRENT @ _xapply ORG @ 0x04 ( stable ABI BOOT ) + ! ':' X' _ 4 - C! ( give : its name ) '(' X' _ 4 - C! ( ----- 400 ) -( With dst being assumed to be an AT28 EEPROM, perform ! +( With dst being assumed to be an AT28 EEPROM, perform C! operation while doing the right thing. Checks data integrity and ABORT on mismatch. ) -: AT28! ( n a -- ) - 2DUP C! +: _ ( n a -- wait until addr is "stable", err on mismatch ) ( 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. ) @@ -2217,8 +2216,9 @@ XCURRENT @ _xapply ORG @ 0x04 ( stable ABI BOOT ) + ! OVER C@ ( n1 a n2 n3 ) = UNTIL ( We're finished writing. do we have a mismatch? ) - C@ = NOT IF ABORT" mismatch" THEN -; + C@ SWAP 0xff AND = NOT IF ABORT" mismatch" THEN ; +: AT28! ( n a -- ) 2DUP C! _ ; +: AT28, ( n -- ) H@ 2DUP C! DUP 1+ HERE ! _ ; ( ----- 401 ) Grid subsystem