/  A ROUTINE TO AID ANIMATION
/  BY  SAVAGE & COOK FEB.70
/
        .TITLE  PULSE
        .GLOBL  PULSE,.DA,DRAW,BEGIN
        .IODEV  2
/
/ AC 14 FILM.
/  AC SWITS 15 & 16.... NONE-ENTER ONLY,  16  DISK
/  15- CAMERA;;  AC 17..  UP REPLAY,  DOWN CONTINUE.
/
PULSE   XX
        JMS*    .DA
        JMP     BOO
ACT     0
FRM     0
BOO     NOP
SETUP   CAL
        16
        700501
        VIOL
        CAL
        16
        701001
        VIOL
/  CLODCK SETUP
        CAL     77
        16
        702641
        CLKINT
        DBK
        702642
/
        DZM*    FRM
        LAC     (JMP    FRMCNT
        DAC     BOO
FRMCNT  ISZ*    FRM
        LAS
        AND     (6
        SAD     (0
        JMP*    PULSE   /OUT
        SAD     (2
        JMP     DISK    /DISK WRITE
        JMS     RELAY
        JMP*    PULSE
/ OR CAMERA FIRE
/
RELAY   XX
        LAC     (477777
        DAC     CNTR
        ISZ     CNTR
        JMP     .-1
        LAC     (477777
        DAC     CNTR
        LAW     -1
        702104  /CLOSE RELAYS
        ISZ     CNTR
        JMP     .-1
        702101          /OPEN RELAYS
        LAC     (577777
        DAC     CNTR
        ISZ     CNTR
        JMP     .-1
        JMP*    RELAY
/  WORDS
SAVE    0
GO      -1
WORD    0
FULL    0
ONSWIT  0
SIZE    0
TEMPAD  0
FILTOP  0
LASTFL  0
OUT     0
CHECK   0
END     0
ADDR    0
CNT     0
COUNT   0
CNTR    0
ONE     1
WRDCNT  4
SWIT    0
IN      0
PAR     0
CONTRL  160000
OUTS    0
/
VIOL    DAC     SAVE
        LAC*    (0
        DAC     OUT
        LAW     -1
        DAC     END
        700704          /CLEAR EDGE FLAG
GONE    LAC     SAVE    /RESET AC
        ION
        DBR
        XCT     .+1
        JMP*    OUT
/  CLOCK ENTRANCE
CLKINT  XX
        DZM     GO
        702624          /CLEAR FLAG
        DBR
        XCT     .+1
        JMP*    CLKINT
/
/  CLOCK TIMES REPLAY,  CLEAR MUST BE CALLED IST.
/TO SET UP STOP ABILITY.
DISK    NOP
        .INIT 2,1,PULSE
        LAC     (FILE1-1
        DAC     ADDR
        LAC     (JMP    DRAW1
        DAC     DISK
///
/ SEARCH DISPLY FOR ON FILES
DRAW1   LAC     ADDR
        DAC*    (11
        LAC*    BEGIN
        DAC     TEMPAD  /ADRS
        LAC*    TEMPAD  /CNTS
        TAD     TEMPAD  /ADD ADRS
        DAC     TEMPAD  /1ST ADRS OF FILES
BLOCK   LAC*    TEMPAD  /1ST WORD
        DAC     WORD    /CNTES
        AND     (177777 /MASK
        DAC     SIZE
        LAC     WORD
        AND     (400000
        DAC     FULL
        LAC     WORD
        AND     (200000
        DAC     LASTFL  /END
/  NEXT WORD
        ISZ     TEMPAD  /2ND WORD
        LAC*    TEMPAD
        AND     (400000 /ON BIT
        DAC     ONSWIT
/
//////
/  PROCEDE TO GET FILES
        LAC     FULL
        SNA
        JMP     ENDCHK
        LAC     ONSWIT
        SNA
        JMP     ENDCHK
        JMS     ADDMOD  /GET THE DATA
/  CHECK FOR END; SET TEMPAD,  CONTINUE
ENDCHK  LAC     LASTFL
        SZA
        JMP     LASMOD
        LAC     TEMPAD
        TAD     SIZE
        TAD     (-1
        DAC     TEMPAD  /NEW ADRS FOR NEW FILE
        JMP     BLOCK   / BACK FOR MORE DATA.
/  TRANSFER
/
ADDMOD  XX
        LAC     SIZE
        SAD     (5
        JMP*    ADDMOD  /  ZERO LNGTH FILE CHECK
        LAC     TEMPAD
        TAD     (1
        DAC*    (10   /  LOAD DARS OF 0 WORD
        TAD     SIZE
        TAD     (-5
        DAC     END     /LAST ADRS TO BE TRANS.
/
/  LOAD TO FILE1
DUMP    LAC*    10
        DAC*    11
        LAC*    (10
        SAD     END
        JMP*    ADDMOD
        JMP     DUMP
/
LASMOD  LAC     (2000
        DAC*    11
//
/
/
/  PLACE ONTO DISK
WRITE   .TRAN 2,1,0,FILE1,255
        .WAIT 2
        LAC     WRITE+2
        SAD     (1077
        SKP
        JMP     INC
        LAW     -1
INC     TAD     (1
        DAC     WRITE+2
/  CHECK AC 17
        LAS
        AND     (1
        SAD     (1
        SKP
        JMP*    PULSE
/
/  REPLAY SECTION
REPLAY  LAC*    FRM
        DAC     CNT
        CMA
        TAD     (1
        TAD     (1077
        SMA
        JMP     SET
        LAC     (1077
        DAC     CNT     /FRAME CNT ON DISK
/  GET DRAW
SET     JMS*    DRAW
        JMP     .+4
        .DSA    (IN
        .DSA    ONE
        .DSA    WRDCNT
/  STOP DISPLAY 
        LAC     (2000
        DAC     PAR
/  WAIT FOR STOP
CHECX   700512
        TAD     (-1
        SAD     (PAR
        SKP
        JMP     CHECX
/  PREPARE TO START
        DZM     TR1+2
        DZM     TR2+2
        ISZ     TR2+2
        LAW     -1
        DAC     GO	/INIT TO -1 FOR WAIT LOOP.
        LAC     (-12130 /40 MSEC
        702607  /CLK GO
/
READY   .INIT 2,0,PULSE
TR1     .TRAN 2,0,0,FILE1,255
        .WAIT 2
        JMS     WAIT
        LAC     (-12130
        702607
        LAC     (FILE1  /ADRS
        700606
        DZM     SWIT
        ISZ     TR1+2
        ISZ     TR1+2
        LAC     TR1+2
        SAD     CNT     /ALL FRAMES BEEN SEEN
        JMS     REPEAT
TR2     .TRAN 2,0,1,FILE2,255
        .WAIT 2
        JMS     WAIT    /LET OTHER FILE COME TO STOP
        LAC     (-12130
        702607
        LAC     (FILE2
        700606
        ISZ     SWIT
        ISZ     TR2+2
        ISZ     TR2+2
        LAC     TR2+2
        SAD     CNT
        JMS     REPEAT
        JMP     TR1     /NEXT FRAME
REPEAT  XX
        LAS
        DAC     COUNT   /SAVE VALUE
        AND     (1
        SAD     (0
        JMP     DONE
        LAC     COUNT   /AC
        AND     (10
        SAD     (10
        JMP     CLICK   /GO TO FILM SECTION
        DZM     TR1+2
        DZM     TR2+2
        LAC     SWIT
        SZA
        JMP     REVERS
        ISZ     TR1+2
        SKP
REVERS  ISZ     TR2+2
        JMP*    REPEAT
/
WAIT    XX      /LOOP
        LAC     GO
        SZA
        JMP     .-2
        LAW     -1
        DAC     GO      /ARM SWIT
        JMP* WAIT
/
/
/  FILM SECTION
CLICK   LAS
        AND     (10
        SAD     (10
        JMP     CLICK
ALERT   DZM     TRFILM+2
PREP    .INIT   2,0,PULSE
TRFILM  .TRAN   2,0,0,FILE1,255
        .WAIT   2
/
        LAC     (FILE1
        DAC     TEMPAD
/
GETEND  ISZ     TEMPAD
        LAC*    TEMPAD
        SAD     (2000
        SKP
        JMP     GETEND
        LAC     (160000
        DAC*    TEMPAD  /DEPOSIT
        LAC     (FILE1
        AND     (17777
        TAD     (400000
        ISZ     TEMPAD
        DAC*    TEMPAD  /SRORE SUB JMP.
        LAC     (FILE1  /ADRS TOP FILE
        700606  /START DUSPLY
        JMS     RELAY   /SNAP
/
        LAW     -1
        TAD     TEMPAD
        DAC     TEMPAD  /RESET ADRS.
        LAC     (2000
        DAC*    TEMPAD
        LAS
        DAC     COUNT
        ISZ     COUNT
        JMP     .-1
/
/  REPLAY
        ISZ     TRFILM+2        /NEXT FRAME
        LAC     TRFILM+2
        SAD     CNT
        JMP     DONE
        JMP     TRFILM  /TOP
DONE    LAC     (NOP
        DAC     DISK    /ALLOW DISK IN INIT
/  TURN ON DISPLAY,  TURN OFF ENTRANCE STOP.
        LAC     (1
        DAC     CNTR
        ISZ     CNTR
        JMP     .-1
        DZM     PAR
        LAC     (PAR    /ADRS
        700606
        JMS*    DRAW
        JMP     .+4
        .DSA    (IN
        .DSA    ONE
        .DSA    PAR
        JMP*    PULSE   /EXIT
/
FILE1   .BLOCK  400
FILE2   .BLOCK  400
        .END
