Repository navigation
Expand file tree
/
Copy pathcmd.asm
More file actions
10536 lines (9894 loc) · 183 KB
/
Copy pathcmd.asm
File metadata and controls
10536 lines (9894 loc) · 183 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
keep obj/cmd
mcopy cmd.macros
****************************************************************
*
* Commands
*
* This module contains the subroutines called to execute the
* commands available at the shell level.
*
****************************************************************
copy sh.dp
eject
****************************************************************
*
* ShellCommand - Command interpreter entry point
*
* Inputs:
* LINE - line to interpret
*
****************************************************************
*
ShellCommand start
debug ShellCommand
using Common
using RecCom
using Command
;
; Do initial processing
;
stz error indicate no error yet
stz io_error indicate no I/O redirection error
stz executeCmd not an EXECUTE command (yet)
jsr LineLength if line is zero length then quit
tax
jeq lc8
ldx #0 if the line is all spaces, quit
mn2 jsr NextChar
cmp #RETURN
jeq lc6
cmp #' '
beq mn2
;
; Execute the line
;
lc1 jsr DoRedirection handle I/O redirection
bcc lc2
lda #$FFFF
sta error
bra lc6
lc2 lda o_error
sta io_error
jsr FindCommand if this is a command then
bcc lc4
sta r0 save the command number
cmp #max_command+1 if the command is good then
bge lc3
asl a call command handler
tax
jsr (cTable,X)
sta error set {Status}
bra lc5 else
lc3 puts #'Bad command number: ',errout=t write bad command number
put2 r0,cr=t,errout=t
err lda #$FFFF set exit flag
sta error
bra lc5 endif
lc4 anop else
jsr PushLine push command line pointer, disp
bcc err
jsr BRun execute the program
sta error
jsr PullLine pop command line pointer, disp
lc5 lda io_error
bne lc5a
lda o_error
sta io_error
lc5a jsr PopRedirection restore old I/O redirection
lc6 lda io_error if there was an I/O error then
beq lc7
sta error set the error code
lc7 lda error set the status flag
jsr SetStatus
lc8 lda error return the error code
rts
mntr_entry entry monitor entry vector
phb
pla
pla
jmp Monitor
;
; Bad command
;
badcom entry
pla bad command in table exit
brl lc3
;
; Local data
;
error ds 2 error number/flag
io_error ds 2 IO error flag
end
****************************************************************
*
* COMMAND - Common Data Area for command table
*
****************************************************************
*
Command privdata
;
; Global variables for this module
;
catChar ds 2 separator character for full path names
catCol ds 2 column number for CATALOG
catFlags ds 4 minus flags field for CATALOG
catPathLength ds 2 length of the path name for CATALOG
max_command equ 49 number of commands available
;
; ORCA Command Table
;
cTable dc a'SetLanguage' 0 languages
dc a'ASML' 1 ASML
dc a'ASMLG' 2 ASMLG
dc a'Assemble' 3 ASSEMBLE
dc a'Catalog' 4 CATALOG
dc a'Copy' 5 COPY
dc a'Create' 6 CREATE
dc a'Delete' 7 DELETE
dc a'Disable' 8 DISABLE
dc a'Edit' 9 EDIT
dc a'Enable' 10 ENABLE
dc a'Help' 11 HELP
dc a'Link' 12 LINK
dc a'Input' 13 INPUT
dc a'Prefix' 14 PREFIX
dc a'Quit' 15 QUIT
dc a'Rename' 16 RENAME
dc a'Show' 17 SHOW
dc a'Type' 18 TYPE
dc a'Exists' 19 EXISTS
dc a'Change' 20 CHANGE
dc a'FileType' 21 FILETYPE
dc a'For' 22 FOR
dc a'End' 23 END
dc a'Loop' 24 LOOP
dc a'Break' 25 BREAK
dc a'Continue' 26 CONTINUE
dc a'Exit' 27 EXIT
dc a'Set' 28 SET
dc a'Echo' 29 ECHO
dc a'If' 30 IF
dc a'Else' 31 ELSE
dc a'Compress' 32 COMPRESS
dc a'Switch' 33 SWITCH
dc a'Move' 34 MOVE
dc a'Commands' 35 COMMANDS
dc a'Export' 36 EXPORT
dc a'Unset' 37 UNSET
dc a'Execute' 38 EXECUTE
dc a'History' 39 HISTORY
dc a'Alias' 40 ALIAS
dc a'Unalias' 41 UNALIAS
dc a'Comment' 42 COMMENT
dc a'Home' 43 HOME
dc a'Erase' 44 ERASE
dc a'Init' 45 INIT
dc a'Touch' 46 TOUCH
dc a'Bye' 47 SHUTDOWN
dc a'Devices' 48 DEVICES
dc a'Newer' 49 NEWER
end
****************************************************************
*
* Alias - Set an alias
*
****************************************************************
*
Alias private
debug Alias
using Common
stz error no error so far
stz token token = null
stz token+2
jsr RemoveCommand remove the command
flags get command line flags
jcs rts
jsr GetToken if an alias name is not given then
sta r0
sta token
stx r2
stx token+2
ora r2
bne lb1
oom lda #outOfMem
sta error
brl rts
lb1 lda [r0]
bne al1
jsr ListAlias list all the aliases
brl rts
;
; Print a specific variable
;
al1 jsr SkipBlanks skip blanks in command line
jsr LineLength if there is no string then
tax
jne al5
move4 token,r12 read the alias value
jsr ReadAlias
sta r0
stx r2
ora r0
beq oom
lda [r0]
bne al2
puts #'No such alias',cr=t,errout=t
dec error
bra al3
al2 puts #'Alias ' print the alias and value
ph4 token
ph2 #0
jsl PrintOSName
puts #' '
ph4 r0
ph2 #0
jsl PrintOSName
putcr
al3 free r0
brl rts
;
; Set the alias
;
al5 jsr SkipBlanks get a string from the command line
jsr GetString
sta r16
stx r18
ora r18
jeq oom
move4 token,r12 set the alias
jsr SetAlias
php dispose of the pointer
free r16
plp
bcc rts
puts #'Could not set the alias',cr=t,errout=t
dec error
;
; Return any error code
;
rts free token free(token)
lda error handle any error
brl CommandError
;
; Local data
;
error ds 2 error code
token ds 4 pointer to a token
end
****************************************************************
*
* Assemble - Assemble
*
* Assemble the source file.
*
****************************************************************
*
Assemble private
debug Assemble
using Common
jsr Operands read the operand
bcs err
lm li_ops,#%00000001 set operations flag
jsr Compile do it
pha
putcr
pla
rts
err lda #$FFFF error return
rts
end
****************************************************************
*
* ASMLG - Assemble, link and go
*
* Assemble the source file. If the max error level found is
* less than or equal to the max error level allowed, link the
* output file. If the max error level is still less than or
* equal to the max error level allowed, execute the program.
*
****************************************************************
*
ASMLG private
debug ASMLG
using Common
jsr Operands read the operand
bcs err
lm li_ops,#%00000111 set operations flag
jsr Compile do it
pha
putcr
pla
rts
err lda #$FFFF error return
rts
end
****************************************************************
*
* ASML - Assemble and link
*
* Assemble the source file. If the max error level found is
* less than or equal to the max error level allowed, link the
* output file.
*
****************************************************************
*
ASML private
debug ASML
using Common
jsr Operands read the operand
bcs err
lm li_ops,#%00000011 set operations flag
jsr Compile do it
pha
putcr
pla
rts
err lda #$FFFF error return
rts
end
****************************************************************
*
* Break - BREAK statement.
*
****************************************************************
*
Break private
debug Break
using RecCom
using Common
jsr RemoveCommand remove the command
jsr EOLCheck make sure there is no garbage
bcc bk1
err lda #$FFFF
rts
bk1 jsr DoContinue skip to end of loop
bcs err
jsr PopStack pop loop type
cmp #forsy if forsy then
bne bk4
bk2 jsr TopType while tos != forsy do
cmp #forsy
beq bk3
jsr PopWord free(PopWord)
free r0
bra bk2 endwhile
bk3 jsr PopStack pop forsy
bk4 lda #0 endif
rts
end
****************************************************************
*
* Bye - shut down the OS
*
****************************************************************
*
Bye private
debug Bye
using Common
jsr RemoveCommand remove the command
flags get command line flags
bcc lb1
err lda #$FFFF
rts
lb1 jsr EOLCheck check for garbage in line
bcs err
jsr ShutDown shut down restartable applications
DisposeAll User_ID get rid of my memory
php disable interrupts
sei
lda ProDOS reset ProDOS hook
sta >pro_entry
lda ProDOS+2
sta >pro_entry+2
lda StackProDOS reset ProDOS stack hook
sta >pro_stack_entry
lda StackProDOS+2
sta >pro_stack_entry+2
plp enable interrupts
stz dcDevNum eject any disks
lb2 inc dcDevNum
OSD_Control dcRec
bcc lb2
cmp #$004E
beq lb2
OS_ShutDown sdRec shut down the OS
lda #0
rts
sdRec dc i'1'
dc i'$0000'
dcRec dc i'5' OS_DControl record
dcDevNum ds 2
dc i'2'
dc i4'0'
dc i4'0'
dc i4'0'
end
****************************************************************
*
* Catalog
*
* Catalog a directory.
*
****************************************************************
*
Catalog private
debug Catalog
using Common
using Command
DIR equ $F directory file type
;
; Set up for a directory scan
;
stz err err = 0 (no error, yet)
stz catCol starting in column 0
stz catPathLength length of the path name being cataloged
stz didOne no catalogs done, yet
stz edIn edIn = nil
stz edIn+2
stz edOut edOut = nil
stz edOut+2
stz nxOptionList nxOptionList = nil
stz nxOptionList+2
malloc #buffSize reserve a wildcard buffer
sta nxPath
sta r0
stx nxPath+2
stx r2
ora r2
jeq oom
lda #buffSize set the buffer length
sta [r0]
jsr RemoveCommand remove the command
flags ,(A,D,H,L,N,P,T) get command line flags
bcc fl1
lda #-1
sta err
brl ex1
fl1 move4 r0,catFlags save the flags
gd0 jsr GetToken read the first file name
sta edIn
sta r0
stx edIn+2
stx r2
ora r2
jeq oom
lda [r0] if there is no name then
bne gd1
lda didOne if we have done a catalog then
jne ex1 quit
! else
free edIn Free(edIn)
malloc #5 edIn = malloc(strlen("8:="));
sta edIn
sta r0
stx edIn+2
stx r2
ora r2
jeq oom
lda #3 strcpy(edIn, "8:=")
sta [r0]
ldy #2
lda #':8'
sta [r0],Y
iny
lda #'=:'
sta [r0],Y
gd1 inc didOne starting a catalog
stz first initialize first time in flag
stz directory not a directory
ph4 #edRec expand devices and prefixes
jsr ExpandDevice
sta err
tax
jne ex1
free edIn Free(edIn)
stz edIn edIn = nil
stz edIn+2
move4 edOut,r0 replace all '?' on token with '='
stz r4 and check for wildcard characters
ldy #2
lda [r0],Y
tax
ldy #4
short I,M
gd2 lda [r0],Y
cmp #'?'
bne gd3
lda #'='
sta [r0],Y
gd3 cmp #'='
bne gd4
inc r4
gd4 iny
dex
bne gd2
long I,M
lda r4 if no wildcards
jne gd7
ph2 edOut+2 and file is a directory then
lda edOut
inc A
inc A
pha
jsr GetFileType
cmp #-1
bne gd4a
sta err
puts #'Could not find the directory ',errout=t
ph4 edOut
ph2 #$C000
jsl PrintOSName
putcr errout=t
brl ex1
gd4a cmp #DIR
bne gd7
add4 r0,#2 append := onto the name
ph4 r0
lda [r0]
tay
iny
lda [r0],Y
and #$00FF
cmp #':'
beq gd5
ph4 #colonEqual
bra gd6
gd5 ph4 #equal
gd6 ph2 #1
jsl AppendOSNames
sta r0
stx r2
ora r2
jeq oom
free edOut Free(edOut)
move4 r0,edOut edOut = r0
inc directory directory = true
gd7 lda catFlags+2 if -d flag set then
and #^set_d
beq gd8
lda #$2000 wcFlags = $2000 (recursive)
sta wcFlags
bra gd9 else
gd8 stz wcFlags wcFlags = 0
gd9 anop endif
add4 edOut,#2,wcName initialize for file find
OSInit_Wildcard wcRec
sta err
jcs ex1
lda catFlags+2 if no -p flag used then
and #^set_p
bne pt3
add4 edOut,#2,r0 find the length of the base path name
lda [r0]
inc A
tay
short M
lda #':'
pt1 cmp [r0],Y
beq pt2
dey
bne pt1
iny
pt2 long M
dey
sty catPathLength
pt3 anop endif
putcr skip a line
lda catFlags+2 if no -h given then
and #^set_h
bne gd10
ph4 wcName write the full path name
ph2 #0
jsl PrintOSName
putcr skip two lines
putcr
puts head,cr=t write the header
putcr
gd10 anop endif
lda #':' set the separator character
sta catChar
jsl SeparatorSet
bcc gd11
sta catChar
gd11 anop
;
; List files until no more entries
;
lf1 OSNext_Wildcard nxRec get the next entry
move4 nxPath,r0 if there are no more entries then
ldy #2
lda [r0],Y
bne lf2
lda first if no entries were found then
bne lf5
puts #'No entries found',cr=t print the error message
bra lf5 exit the loop
lf2 lda nxAccess if the invisible bit is set then
and #$0004
beq lf3
lda catFlags+2 if the -a flag was not used then
and #^set_a
beq lf4 skip printing this file
lf3 inc first update first time in flag
jsr WriteFileInfo list the file catalog entry
lf4 jsr Pause Pause
bcc lf1 if exit not requested then loop
lf5 putcr put one blank line after the files
;
; End of loop processing
;
lda catFlags+2 if no -h given then
and #^set_h
jne gd0
add4 edOut,#2,r0 create a volume name
ldy #3
short M
lda #':'
el1 cmp [r0],Y
beq el2
iny
bra el1
el2 long M
tya
dec A
sta [r0]
move4 r0,gdDevName get volume info
OSGet_Dev_Number gdRec
sta err
jcs ex1
lda gdDevNum
sta diDivNum
OSD_Info diRec
sta err
jcs ex1
OSVolume vlRec
sta err
jcs ex1
puts #'Blocks Free: ' print the volume info
put4 vlFree,#6
puts #' Blocks used: '
sub4 vlBlocks,vlFree,r0
put4 r0,#6
puts #' Total Blocks: '
put4 vlBlocks,#6,cr=t
brl gd0 get the next command line argument
;
; Out of memory error
;
oom lda #outOfMem
sta err
;
; Exit processing
;
ex1 free edIn Free(edIn)
free edOut Free(edOut)
free nxPath Free(nxPath)
lda err handle any error
brl CommandError
;
; Local data
;
didOne ds 2 have we done a catalog, yet?
directory ds 2 directory flag
err ds 2 error number
first ds 2 first time in flag
colonEqual dc i'2',c':=' used to form wildcard paths
equal dc i'1',c'='
head dc 2i1'77' header message
dc c'Name Type Blocks Modified '
dc c' Created Access Subtype'
edRec dc i'2' ExpandDevice record
edIn ds 4
edOut ds 4
gdRec dc i'2' OSGet_Dev_Number record
gdDevName ds 4
gdDevNum ds 2
diRec dc i'2' OSD_Info record
diDivNum ds 2
dc a4'volumeName'
vlRec dc i'4' OSVolume record
dc a4'volumeName+2'
dc a4'volumeName'
vlBlocks ds 4
vlFree ds 4
wcRec dc i'2' OSInit_Wildcard record
wcName ds 4
wcFlags ds 2
end
****************************************************************
*
* Change - Change the language stamp of a SRC file.
*
****************************************************************
*
Change private
debug Change
using Common
minus_flags equ r0 minus flags mask
TXT equ 4 file types for text and src
SRC equ $B0
stz error no error so far
stz nxPath nxPath = nil
stz nxPath+2
jsr RemoveCommand remove the command
flags ,(P) get command line flags
bcc in1
err dec error return error code of -1
brl rts
in1 lda minus_flags+2 noProgress = <-p flag set>
and #^set_p
sta noProgress
;
; Read in the file name
;
sec get the file name (must exist)
lda #0
ldx #1
jsr GetFileName
sta error
jcs rts
stz error
sta wcard
;
; Get the file type
;
jsr SkipBlanks skip leading blanks
jsr LineLength see if line is empty
tax
bne ch2
puts #'Language: '
jsr GetLine ask for a language if none specified
jsr SkipBlanks
jsr LineLength if line is blank again return
tax
jeq rts
ch2 jsr FindCommand identify language
jcc ch2a
cmp #0
beq ch3
ch2a puts #'Language not available',cr=t,errout=t
brl err
ch3 sty type save the language type
jsr RemoveCommand remove the language type
jsr EOLCheck check for garbage at end of command
jcs err
lda wcard if wildcards used then
beq ch4
lda noProgress if not noProgress then
bne ch4
puts #'Files changed:',cr=t write the header message
;
; Loop thru each file and change the language
;
ch4 lda wcard write space for file names list
beq ch5
puts #' '
ch5 lda nxFileType make sure file is text or src
cmp #TXT
beq ch6
cmp #SRC
beq ch6
ph4 nxPath file type error - print the message
ph2 #$C000
jsl PrintOSName
puts #' must be TXT or SRC',cr=t,errout=t
brl ch9
ch6 lda #TXT split on SRC or TXT
ldx type
beq ch7
lda #SRC
ch7 sta nxFileType set the file type
stx nxAuxType set the language
move #0,nxModDateTime,#8 reset mod date/time
lda wcard if wcard then
beq ch8
lda noProgress if not noProgress then
bne ch8
ph4 nxPath print the path name
ph2 #$8000
jsl PrintOSName
putcr
ch8 inc nxPath modify flags
inc nxPath
OSSet_File_Info nxRec
dec nxPath
dec nxPath
bcc ch9
dec error
bra rts
ch9 jsr Pause
bcs rts
OSNext_Wildcard nxRec get next file name
move4 nxPath,r0
ldy #2
lda [r0],Y
jne ch4
rts free nxPath free(nxPath)
lda error handle any error
brl CommandError
;
; Local data
;
error ds 2 error number
noProgress ds 2 noProgress flag set?
wcard ds 2 wildcards in use?
type ds 2 file type
end
****************************************************************
*
* Commands - Reread the system command table
*
****************************************************************
*
Commands private
debug Commands
using Common
jsr RemoveCommand remove the command
flags get command line flags
bcs err
sec get the file name
lda #$4000
ldx #1
jsr GetFileName
bcs rts
jsr ShutDown shut down restartable applications
free cthandle get rid of old table
add4 nxPath,#2,r0 read the command table
jsr ReadSYSCMND
free nxPath free(nxPath)
lda #0 return with no error
rts rts
err lda #$FFFF
rts
end
****************************************************************
*
* Comment
*
* Comment statement.
*
****************************************************************
*
Comment private
lda #0 comment command
rts
end
****************************************************************
*
* Compress
*
* Alphabetize/compress directories
*
****************************************************************
*
Compress private
debug Compress
using Common
elength equ r20
eperblk equ r22
filecnt equ r24
stz cflag initialize the operation flag
stz aflag
stz error no error so far
stz buff buff = nil
stz buff+2
stz edOut edOut = nil
stz edOut+2
jsr RemoveCommand remove the command
flags get command line flags
bcc cm1
lda #$FFFF
rts
;
; Read the flags and set the flag mask
;
cm1 jsr GetToken get compress parameters
sta r0
sta buff
stx r2
stx buff+2
ora r0
bne cm1a
oom lda #outOfMem
sta error
brl rts
cm1a lda [r0] if there were no parameters then
bne cm2
free r0 free the token buffer
puts #'Parameters(C A): ' ask for some
jsr GetLine
jsr GetToken
sta r0
sta buff
stx r2
stx buff+2
ora r0
beq oom
lda [r0]
jeq rts
cm2 cmp #1 make sure it is a single character
beq cm3
err2 puts #'Invalid parameter',cr=t,errout=t
dec error
brl rts
cm3 jsr IDPrm identify the parameter; must be legal
bcs err2
free buff free(buff)
jsr GetToken get a second parameter or file name
sta r0
sta buff
stx r2
stx buff+2
ora r2
jeq oom
lda [r0]
beq cm4
cmp #1 possible second parameter
bne cm4
jsr idprm identify second parameter
bcs cm4
free r0 free(r0)
jsr GetToken if a parameter then get file name
sta buff
stx buff+2
ora buff+2
jeq oom
cm4 move4 buff,edIn expand devices and prefixes
move4 edIn,r0
lda [r0]
bne cm4a
lla edIn,prefix0