SWITCH JOB   TEST SWITCHES
       ORG   500
START  CS    332
       CS
       MLCWA @SENSE SWITCH TEST@,250
       W
       CS    299
       BLC   FIRSTA
       MLCWA @SENSE SWITCH A OFF/NO LAST CARD@,250
       W
       CS    299
       B     GO
FIRSTA MLCWA @SENSE SWITCH A ON/LAST CARD@,250
       W
       CS    299
*
* MAIN LOOP.  SCAN SWITCHES.  IF THERE IS A CHANGE, PRINT OUT THE NEW
* CONFIGURATION AS 'A*B*C*D*E*F*G*' WHERE * IS + OR - FOR ON OR OFF
*
GO     H
       BSS   A1,A                            IS THE SWITCH ON?
       BCE   A0,STATE+0,-                    NO, WAS IT ON LAST TIME?
       MLC   @Y@,CHANGE                      STATE WAS +, WE CHANGED
       MLC   @-@,STATE+0                     SET STATE OFF
       B     A0
A1     BCE   A0,STATE+0,+                    IT IS ON, WAS IT ON LAST TIME?
       MLC   @Y@,CHANGE                      STATE WAS -, WE CHANGED
       MLC   @+@,STATE+0                     SET STATE ON
A0     EQU   *
       BSS   B1,B                            IS THE SWITCH ON?
       BCE   B0,STATE+1,-                    NO, WAS IT ON LAST TIME?
       MLC   @Y@,CHANGE                      STATE WAS +, WE CHANGED
       MLC   @-@,STATE+1                     SET STATE OFF
       B     B0
B1     BCE   B0,STATE+1,+                    IT IS ON, WAS IT ON LAST TIME?
       MLC   @Y@,CHANGE                      STATE WAS -, WE CHANGED
       MLC   @+@,STATE+1                     SET STATE ON
B0     EQU   *
       BSS   C1,C                            IS THE SWITCH ON?
       BCE   C0,STATE+2,-                    NO, WAS IT ON LAST TIME?
       MLC   @Y@,CHANGE                      STATE WAS +, WE CHANGED
       MLC   @-@,STATE+2                     SET STATE OFF
       B     C0
C1     BCE   C0,STATE+2,+                    IT IS ON, WAS IT ON LAST TIME?
       MLC   @Y@,CHANGE                      STATE WAS -, WE CHANGED
       MLC   @+@,STATE+2                     SET STATE ON
C0     EQU   *
* REPEAT AS NEEDED...
       BCE   GO,CHANGE,N                     IF NO CHANGE, LOOP
* WE DON'T HAVE WORKING INDEX REGISTERS, SO DO THIS THE HARD WAY
       MLCWA ESTATE,250
       MLCWA ENAMES
       MLCWA ESTATE-1
       MLCWA ENAMES-1
       MLCWA ESTATE-2
       MLCWA ENAMES-2
       MLCWA ESTATE-3
       MLCWA ENAMES-3
       MLCWA ESTATE-4
       MLCWA ENAMES-4
       MLCWA ESTATE-5
       MLCWA ENAMES-5
       MLCWA ESTATE-6
       MLCWA ENAMES-6
       MLCWA @SWITCH STATUS CHANGED; NEW STATUS: @
       W
       CS    299
       MLC   @N@,CHANGE
       B     GO
*
*
NAMES  DCW   @A@
       DCW   @B@
       DCW   @C@
       DCW   @D@
       DCW   @E@
       DCW   @F@
ENAMES DCW   @G@
STATE  DCW   @ @                             A STATE
       DCW   @ @                             B STATE
       DCW   @ @                             C STATE
       DCW   @ @                             D STATE
       DCW   @ @                             E STATE
       DCW   @ @                             F STATE
ESTATE DCW   @ @                             G STATE
CHANGE DCW   @Y@                             Y OR N, START AS Y
       END   START
