
/
STRING  0
        DAC 17
        LAC* 17
        SNA
        JMP* STRING
        JMS TYPE
         JMP .-4
/
ERROR   ERROR+1
        0
        277
        215
        212
        276
        0
EOL    EOL+1
       0
       215
       212
       0
/
/   KEYBOARD HANDLER
KEYIN   0
        CLA
        KRB
        SAD SPACE
        JMP* KEYIN
        DAC* INBUFF
         ISZ INBUFF
        SAD CR
        JMP EOM
        LAC INBUFF
        SAD LASTIN
        SKP
        JMP* KEYIN
EOM     LAC LF
        JMS TYPE
        LAC INBUFA
        DAC INBUFF
        ISZ INFLAG
        JMP* KEYIN
SPACE  240
CR     215
LF     212
INFLAG  0
INBUFF  INBUFA+1
INBUFA  INBUFA+1
        .BLOCK 100
LASTIN LASTIN
/
/   INPUT HANDLER
INPUT  0
       DZM INFLAG
       LAC INBUFA
       DAC INBUF
       LAC* INBUF
       JMS INTAB
       SNA
       JMP ERR1
       DAC COMAND
       ISZ INBUF
       LAC* INBUF
       SAD CR
       JMP NOARG
       JMS NUMHAN
       SNA
       JMP ERR1
JUMP3  LAC COMAND
       JMP* INPUT
NOARG  DZM NUMARG
       JMP JUMP3
ERR1   CLA
       JMP* INPUT
NUMARG 0
COMAND 0
INBUF  0
/
/   INPUT COMMAND TABLE
INTAB  0
       DAC SAVE1
       DZM CARVAL
       LAC TABLE1
       DAC TABAD1
AGAIN1 ISZ CARVAL
       LAC SAVE1
       SAD* TABAD1
       JMP MATCH1
       ISZ TABAD1
       LAC TABAD1
       SAD LAST1
       JMP .+2
       JMP AGAIN1
       DZM CARVAL
MATCH1 LAC CARVAL
       JMP* INTAB
SAVE1  0
CARVAL 0
/
/   NUMBER DETECTOR
INTAB2 0
       DAC SAVE2
       DZM NUMVAL
       LAC TABLE2
       DAC TABAD2
AGAIN2 LAC SAVE2
       SAD* TABAD2
       JMP MATCH2
       ISZ NUMVAL
       ISZ TABAD2
       LAC TABAD2
       SAD LAST2
       JMP .+2
       JMP AGAIN2
       CLA!CMA
       DAC NUMVAL
MATCH2 LAC NUMVAL
       JMP* INTAB2
SAVE2  0
NUMVAL 0
TABAD2 TABLE2+1
TABLE2 TABLE2+1
 260
 261
 262
 263
 264
 265
 266
 267
 270
 271
LAST2 LAST2
/   NUMBER HANDLER
NUMHAN 0
       DAC SAVE4
       DZM NUMARG
       LAC ARGTAB
       DAC ARGADD
       DZM* ARGADD
       LAC SAVE4
       SAD EQUAL
       JMP JUMP4
       JMP ERR
JUMP4  ISZ INBUF
       LAC* INBUF
       SAD COMMA
       JMP JUMP5
       SAD CR
       JMP VALID
       JMS INTAB2
       SPA
       JMP ERR
       DAC SAVE5
/
/      MULTIPLY STORED NUMBER BY TEN.
       LAC* ARGADD
       CLL!RAL
       SPA
       JMP OVER
       CLL!RAL
       SPA
       JMP OVER
       CLL!RAL
       SPA
       JMP OVER
       TAD* ARGADD
       SPA
       JMP OVER
       TAD* ARGADD
       SPA
       JMP OVER
       TAD SAVE5
       SPA
       JMP OVER
       DAC* ARGADD
       JMP JUMP4
OVER   LAC MESS7
       JMS ASPRT
       LAC EOL
       JMS STRING
ERR    CLA
       DZM NUMARG
       JMP* NUMHAN
JUMP5  ISZ NUMARG
       ISZ ARGADD
       DZM* ARGADD
       JMP JUMP4
VALID  ISZ NUMARG
       CLA!IAC
       JMP* NUMHAN
SAVE4  0
SAVE5  0
EQUAL  275
COMMA  254
MESS7  MESS7+1
       .SIXBT "   OVERFLOW. MAXIMUM INPUT = 131 071@"
ARGADD ARGTAB+1
ARGTAB ARGTAB+1
       .BLOCK 12
/   MAXIMUM OF 10 ARGUMENTS.
ARROW  ARROW+1
 0
 215
 212
 276
 0
/
/TWO DIGIT DECIMAL INTEGER PRINTOUT
DECP   0
       DAC SAVE8
       DZM TENS
DECP1  TAD N10    /SUBTRACT TEN REPEATEDLY
       SPA
       JMP .+4
       ISZ TENS
       DAC SAVE8
       JMP DECP1
       LAC TENS  /TENS DIGIT OBTAINED
       TAD P260
       JMS TYPE
       LAC SAVE8 /GET UNITS DIGIT
       TAD P260
       JMS TYPE
       JMP* DECP
SAVE8  0
TENS   0
N10    -12
P260   260
/
/ARGUMENT HANDLER FOR ALL PROCESSES.
/RETURN WITH AC = NUMBER OF ARGUMENTS ENTERED.
ARGS   0
       TAD ARGLOC
       DAC ARGS1
       LAC* ARGS1
       DAC ARGS1
       LAC ARGTAB
       DAC ARGADD   /INITIALIZE ARGUMENT ADDRESS
       LAC NUMARG
       CMA!IAC
       DAC NARG
       LAC NUMARG
       SNA
       JMP* ARGS    /NO ARGUMENTS, AC=0
ARGS3  LAC* ARGS1
       DAC ARGS2    /ARGS2 CONTAINS THE ADDESS OF DESTINATION.
                     /CHECK IF TOO MANY ARGUMENTS
       SAD ARGSTP
       SKP
       JMP ARGS4
       LAC MESS6    /YES, PRINT MESSAGE
       JMS ASPRT
       LAC NUMARG
       TAD NARG
       DAC SAVE16   /NUMBER OF ARGUMENTS ENTERED
       JMS DECP     /OUTPUT WITH MESS6
       LAC SAVE16
       JMP* ARGS    /RETURN WITH AC = NUMBER OF ARGS 
ARGS4  LAC* ARGADD  /GET ARGUMENT
       DAC* ARGS2   /STORE IN FINAL ARGUMENT DESTINATION
       ISZ ARGADD   /INCREMENT ADDRESSES AND COUNTER
       ISZ ARGS1
       ISZ NARG
       JMP ARGS3   /REPEAT
       LAC NUMARG   /AC = NUMBER OF ARGUMENTS ENTERED.
       JMP* ARGS   /NO MOR ARGUMENTS
ARGS1  0
ARGS2  0
NARG   0
ARGSTP ARGSTP
SAVE16 0
MESS6  MESS6+1
       .SIXBT "   NUMBER OF ARGUMENTS ENTERED =   @"
