Command Read and Dispatch

Two letter command names are stored left justified in the array KM.
 
      DATA KM/2LAC,2LLO,2LCL,2LCO,2LDE,2LEX,2LHA,2LMA,
     +   2LMD,2LST,2LSW,2LPC,2LPR,2LPP,2LTI,2LRI,2LPU,2LME,2*0/ 
 
A word of input is masked to two characters and compared with each command in the array. The position of a match is used to dispatch to the appropriate handler.
 
202   T1=RC(I1) 
      DO 204 I2=1,20
204   IF((I1.AND.7777 0000 0000 0000 0000B).EQ.KM(I2)) GOTO 208 
      PRINT 206, T1 
206   FORMAT(' ERR: ',A10)
      GOTO 202
208   GOTO (310,320,330,340,350,360,370,380,390,
     +       400,410,420,430,440,450,460,470,480), I2 
 
 

PDP-8 Simulator
© 1975, 1998, Ward Cunningham
all rights reserved