/  A ROUTINE TO AID ANIMATION
/  BY  SAVAGE & COOK FEB.70
/
        .TITLE  PULSE
	.GLOBL	PULSE,.ARG,DRAWS
        .IODEV  2
/
/ AC 14 FILM.
/  AC SWITS 15 & 16.... NONE-ENTER ONLY,  16  DISK
AUTO15=15
/  15- CAMERA;;  AC 17..  UP REPLAY,  DOWN CONTINUE.
/
PULSE   XX
        JMS*    .ARG
        JMP     BOO
ACT     0
FRM     0
IVECT	0
IST	0
LAST	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     IVECT
	DAC*	(16	/PAR ADRRS -1
	TAD	(-3
	TAD*	LAST	/CNTS
	DAC	END	/LAST ADDRS.
	LAC	ADDR
	DAC*	(AUTO15	/FILE ADDRS-1
/  TRANSFER
/
/
/  LOAD TO FILE1
DUMP    LAC*    16
        DAC*    AUTO15
        LAC*    (16
        SAD     END
	SKP
        JMP     DUMP
/
LASMOD  LAC     (2000
        DAC*    AUTO15
//
/
/
/  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*    DRAWS
        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*    DRAWS
        JMP     .+4
        .DSA    (IN
        .DSA    ONE
        .DSA    PAR
        JMP*    PULSE   /EXIT
/
FILE1   .BLOCK  400
FILE2   .BLOCK  400
        .END
