Improved NCR banking signals with magic smoke
This commit is contained in:
parent
3c4adb03df
commit
87659bdf83
|
@ -204,14 +204,16 @@ public class FourCornerZionStenoLexer {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void ncrBankReset() {
|
||||
private void ncrBankReset(boolean magic) {
|
||||
fireSignals.fireStateNCR1632BankReset(magic);
|
||||
for (int i = 0; i < denominatorBank.length; i++) {
|
||||
denominatorBank[i] = 0;
|
||||
numeratorBank[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void ncrBankFire() {
|
||||
private void ncrBankFire(boolean magic) {
|
||||
fireSignals.fireStateNCR1632BankSparkler(magic);
|
||||
BigInteger denominator = BigInteger.ONE;
|
||||
for (int i = 0; i < denominatorBank.length; i++) {
|
||||
denominator = denominator.add(BigInteger.valueOf(denominatorBank[i]).shiftLeft(i * 9));
|
||||
|
@ -310,7 +312,7 @@ public class FourCornerZionStenoLexer {
|
|||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
lexer.ncrBankReset();
|
||||
lexer.ncrBankReset(false);
|
||||
boolean magicSparkler = true;
|
||||
boolean requestBankReset = false;
|
||||
for (int i = idxFirst; i <= idxLast; i++) {
|
||||
|
@ -323,13 +325,11 @@ public class FourCornerZionStenoLexer {
|
|||
}
|
||||
int numeratorX = cakePoint - FourCornerDotCake.FC_NCR1632_XN.getStart();
|
||||
lexer.numeratorBank[numeratorX / 512] = numeratorX % 512;
|
||||
|
||||
// highest number, 1st select + enable request, if second than reset bank
|
||||
// 1st select + enable request, if second than reset bank
|
||||
if (cakePoint == FourCornerDotCake.FC_NCR1632_XN.getStop()) {
|
||||
if (requestBankReset) {
|
||||
requestBankReset = false;
|
||||
lexer.fireSignals.fireStateNCR1632BankReset();
|
||||
lexer.ncrBankReset();
|
||||
lexer.ncrBankReset(true);
|
||||
magicSparkler = false; // if block ends with bank reset, don't leak a sparkler
|
||||
continue;
|
||||
}
|
||||
|
@ -337,17 +337,15 @@ public class FourCornerZionStenoLexer {
|
|||
} else {
|
||||
requestBankReset = false;
|
||||
}
|
||||
|
||||
if (cakePoint > FourCornerDotCake.FC_NCR1632_XN.getStart() + 512) {
|
||||
magicSparkler = true;
|
||||
continue; // Only fire fraction on lowest value select
|
||||
} else
|
||||
lexer.ncrBankFire();
|
||||
lexer.ncrBankFire(false);
|
||||
magicSparkler = false;
|
||||
}
|
||||
if (magicSparkler) {
|
||||
lexer.fireSignals.fireStateNCR1632BankSparkler();
|
||||
lexer.ncrBankFire();
|
||||
lexer.ncrBankFire(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,9 +34,9 @@ public interface FourCornerZionStenoLexerFire {
|
|||
|
||||
void fireStateScanner(int blockStart, int blockStop, int cakePoint);
|
||||
|
||||
void fireStateNCR1632BankSparkler();
|
||||
void fireStateNCR1632BankSparkler(boolean magic);
|
||||
|
||||
void fireStateNCR1632BankReset();
|
||||
void fireStateNCR1632BankReset(boolean magic);
|
||||
|
||||
interface Adapter extends FourCornerZionStenoLexerFire {
|
||||
|
||||
|
@ -53,11 +53,11 @@ public interface FourCornerZionStenoLexerFire {
|
|||
}
|
||||
|
||||
@Override
|
||||
default void fireStateNCR1632BankSparkler() {
|
||||
default void fireStateNCR1632BankSparkler(boolean magic) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void fireStateNCR1632BankReset() {
|
||||
default void fireStateNCR1632BankReset(boolean magic) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,12 +68,16 @@ public class TestFireWalker implements FourCornerZionStenoLexerFire.Adapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fireStateNCR1632BankSparkler() {
|
||||
ncr1632BankSparkler++;
|
||||
public void fireStateNCR1632BankSparkler(boolean magic) {
|
||||
if (magic) {
|
||||
ncr1632BankSparkler++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireStateNCR1632BankReset() {
|
||||
ncr1632BankReset++;
|
||||
public void fireStateNCR1632BankReset(boolean magic) {
|
||||
if (magic) {
|
||||
ncr1632BankReset++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue