/DECTAPE INPUT
 .LOC 17000
    .SIZE
    .SIXBT 'DT'
    200001                  /INPUT
UNIT 1
BLOCK1 2
    .SIXBT 'N'
DI
    SPA!CLA; JMP D9         /CLOSE ->
    JMP* USE                /EXIT FROM COROUTINE
D1  JMS .BU; DAC DV+3       /GET BUFFER
    LAC LITAA1; DAC SUM     /INITIAL CHECKSUM
    LAC BLOCK1              /FIRST BLOCK
D2  DAC DV+1
D3  LAC (2000; XOR UNIT     /FUNCTION + UNIT
    DAC DV
    LAC (DV
    GUARD; JMP .DH          /CALL HANDLER
    GUARD                   /WAIT FOR TRANSFER
    LAC DV; SMA!SZA; WAIT
    ION
    SMA!CMA; JMP D4         /OK ->
    GUARD; JMP .MH          /REPORT
    JMP D3
D4  LAC DV+3; DAC CA        /CA = BUFF START
    LAC* CA; ISZ CA         /CHECKSUM OK?
    SAD SUM; JMP D5         /YES ->
    DAC SUM                 /ALLOW FOR RE-ENTRY
    LAC (D5; DAC USE
    CLL; LAC (1             /ERROR
    JMP* DI
D5  LAW -376; DAC WC        /254[10] DATA WORDS
D6  LAC* CA; DAC I          /EXTRACT WORD
    TAD SUM; DAC SUM
    JMS USE; JMS USE; JMS USE
    ISZ CA
    ISZ WC; JMP D6
    LAC* CA                 /ENDFILE MARK?
    SMA; JMP D2             /NO ->
D9  LAC (D1; DAC USE        /FOR RE-ENTRY
    LAC DV+3                /RELEASE BUFFER
    SZA; JMS .BU            /IF FILE OPEN
    DZM DV+3                /SET INDICATOR
    CLL; LAC DI-1           /CONCATENATED FILE
    JMP* DI
/COROUTINE
USE D1
    LAC I
    SMA!CLL; STL            /RESTORE BIT 7
    RTL; RTL; RTL           /ROTATE 6
    DAC I
    RAL; AND (177           /EXTRACT CHAR
    SAD (100; JMP* USE      /IGNORE NULL
    SAD (42; LAC .NL       /NL FOR DQ
    SAD (136; LAC (100      /AT FOR UP
    STL
    JMP* DI
I;CA;WC;SUM
LITAA1 .SIXBT 'AA1'
DV  0; 0; -400; 0
GUARD=JMS 3;WAIT=JMP 2
.BU=16000;.DH=16010;.MH=16020;.NL=16030
 .END
