NEW
  AUTO 3,1
*--------------------------------------
*      SEARCH COMMAND TABLE
*--------------------------------
SEARCH.COMMAND.TABLE
       LDX #-1      COMMAND STRING INDEX
.1     LDY #0       BUFFER INDEX
       STY CHAR.PNTR
.2     INX          NEXT POSITION IN CMD.TBL
       JSR GNC.UC   NEXT CHARACTER OF COMMAND
       BCS .7       ...END OF LINE
       JSR CHECK.LETTER
       BCC .6       ...NOT A LETTER
       LDA CMD.TBL,X  NEXT CHAR OF COMMAND NAME
       BEQ PASS.CMD.TO.PRODOS     ...END OF TABLE
       EOR CURRENT.CHAR
       BEQ .2       ...CORRECT CHARACTER
       ASL          SHIFT OUT END.OF.NAME FLAG
       BNE .5       ...REALLY DIFFERENT
*---GO TO PROCESS COMMAND--------
.3     LDA CMD.TBL+2,X
       PHA
       LDA CMD.TBL+1,X
       PHA
       LDX #0
       RTS
*---SCAN TO NEXT TABLE ENTRY-----
.5     INX
       LDA CMD.TBL-1,X
       BPL .5
       INX          SKIP OVER ADDRESS
       BNE .1       ...ALWAYS
*---ALL LETTERS MATCH-------------
.6     DEY          BACK OFF <EOL>
       STY CHAR.PNTR
.7     CPY #3       AT LEAST THREE LETTERS?
       BCC PASS.CMD.TO.PRODOS     ...NO, SPELLED WRONG
.9     LDA CMD.TBL,X
       BMI .3       ...AT END OF COMMAND NAME
       INX
       BNE .9       ...ALWAYS
*---NOT FOUND IN TABLE------------
PASS.CMD.TO.PRODOS
  .DO 0    NO LONGER NECESSARY, BECAUSE 00=8D IN SCI
       LDX #-1      APPEND A <RETURN> FOR PRODOS
.1     INX
       LDA WBUF,X   LOOK FOR TERMINATING 00
       BNE .1       ...NOT YET
       LDA #$8D
       STA WBUF,X
  .FIN     EFFECTIVE 10-23-86
       JSR SCI.COMMAND   GIVE ProDOS A SHOT AT IT
       BCC .2       ProDOS liked it!
       JMP PRODOS.ERROR   ...not acceptable, explain why
.2     RTS
*--------------------------------
*      COMMAND STRINGS
*--------------------------------
       .MA CTBL
       .AT /]1/
       .DA ]1-1
       .EM
*--------------------------------
CMD.TBL
       >CTBL ASM
       >CTBL AUTO
       >CTBL COPY
       >CTBL DATE
       >CTBL DELETE
       >CTBL EDIT
       >CTBL FAST
       >CTBL FIND
       >CTBL FP
       >CTBL HELP
       >CTBL HIDE
       >CTBL HIMEM
       >CTBL INCREMENT
       >CTBL LIST
       >CTBL LOMEM
       >CTBL MANUAL
       >CTBL MEMORY
       >CTBL MERGE
       >CTBL MGO
       >CTBL MNTR
       >CTBL NEW
       >CTBL PRT
       >CTBL RENUMBER
       >CTBL REPLACE
       >CTBL RESTORE
       >CTBL RST
       >CTBL SLOW
       >CTBL SYMBOLS
       >CTBL TEXT
       >CTBL TIME
       >CTBL USR
       >CTBL VAL
       >CTBL VERSION
       .HS 00       END OF TABLE
*--------------------------------
SCT.1  INY
       INY
       INY
SEARCH.CHAR.TABLES
       LDA CHAR.TABLES,Y
       BEQ .1       ...NOT IN TABLE
       CMP CURRENT.CHAR
       BNE SCT.1
.1     LDA CHAR.TABLES+2,Y
       PHA
       LDA CHAR.TABLES+1,Y
       PHA
       RTS
*--------------------------------------
MAN
SAVE usr/src/scmasm.30/scmasm.s.scmd
LOAD usr/src/scmasm.30/scmasm.s
ASM
