OpenCores
URL https://opencores.org/ocsvn/System09/System09/trunk

Subversion Repositories System09

[/] [System09/] [branches/] [mkfiles_rev1/] [src/] [Flex9/] [f9-cli.asm] - Blame information for rev 120

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 42 davidgb
*********************************************
2
*
3
* FLEX COMMAND LINE INTERPRETER & SUBROUTINES
4
*
5
*********************************************
6
 ORG $CD00
7
*
8
** FLEX JUMPS
9
*
10
COLDS JMP >COLD1
11
WARMS JMP >WARM1
12
RENTER JMP >RENT1
13
INCH JMP >INCH
14
INCH2 JMP >INCH2
15
OUTCH JMP >OUTCH
16
OUTCH2 JMP >OUTCH2
17
GETCHR JMP >GETCH1
18
PUTCHR JMP >PUTCH1
19
INBUFF JMP >INBUF1
20
PSTRNG JMP >PSTRG1
21
CLASS JMP >CLASS1
22
PCRLF JMP >PCRLF1
23
NXTCH JMP >NXTCH1
24
RSTRIO JMP >RSTIO1
25
GETFIL JMP >GETFL1
26
LOAD JMP >LOAD1
27
SETEXT JMP >SETEX1
28
ADDBX JMP >ADDBX1
29
OUTDEC JMP >OUTDC1
30
OUTHEX JMP >OUTHX1
31
RPTERR JMP >RPTER1
32
GETHEX JMP >GETHX1
33
OUTADR JMP >OUTAD1
34
INDEC JMP >INDEC1
35
DOCMND JMP >DOCMD1
36
ZCD4E JMP >ZCD4E
37
 JMP >ZCE05
38
 JMP >ZCE05
39
*
40
** COLD START ENTRY
41
*
42
COLD1 LDS #ZC07F
43
ZCD5B CLR >LASTRM
44
 JSR >ZD400
45
 CLR >CMDFLG
46
 JSR >ZD3FD
47
*
48
** WARM START ENTRY
49
*
50
WARM1 LDS #ZC07F
51
 JSR >WARMDR
52
 LDX #WARMS
53
 STX >ESCVEC
54
 LDX #PRSPL1
55
 STX [SWIVVC]
56
 LDX >IHNDVC
57
 STX [IRQVVC]
58
 LDX #ZCCF8
59
 STX >ZCC31
60
 CLR >ZCC34
61
 CLR >ZCC4C
62
 BSR RSTIO1
63
 LDA >LASTRM
64
 CMPA >EOLCHR
65
 BNE ZCD9D
66
 INC >LINPTR+1
67
 BRA RENT1
68
 
69
ZCD9D TST >CMDFLG
70
 LBNE ZD33B
71
 JSR >FMSCLS
72
 BNE ZCD5B
73
 LDX #PMTSTR
74
 JSR >PSTRG1
75
 BSR INBUF1
76
*
77
** MAIN CONTROL LOOP
78
*
79
RENT1 JSR >ZD0D4
80
 CMPA #$0D
81
 BEQ ZCD9D
82
ZCDB8 LDX #FCB
83
 INC >ZCC0D
84
 JSR >GETFL1
85
 BCS ZCDD9
86
 LDX #CMDTBL
87
 BSR ZCE06
88
 BEQ ZCDD3
89
 LDX >UCTVEC
90
 BEQ ZCDD6
91
 BSR ZCE06
92
 BNE ZCDD6
93
ZCDD3 JMP [$01,X]
94
 
95
ZCDD6 JSR >ZD22E
96
ZCDD9 LDX #WOTMSG
97
 LDA #$15
98
ZCDDE STA >ERRTYP
99
ZCDE1 JSR >PSTRG1
100
ZCDE4 CLR >LASTRM
101
 JMP >WARM1
102
*
103
** RESTORE IO VECTORS
104
*
105
RSTIO1 LDX >OUTCH2+1
106
 STX >OUTCH+1
107
 LDX >INCH2+1
108
 STX >INCH+1
109
 CLR >INPSWT
110
 CLR >OUTSWT
111
 CLR >SIOFLG
112
 CLR >FIPADR
113
 CLR >FOPADR
114
ZCE05 RTS
115
 
116
ZCE06 LDY #ZC844
117
ZCE0A LDA ,Y+
118
 CMPA #$5F
119
 BLS ZCE12
120
 SUBA #$20
121
ZCE12 CMPA ,X+
122
 BNE ZCE1E
123
 TST ,X
124
 BNE ZCE0A
125
 TST ,Y
126
 BEQ ZCE2A
127
ZCE1E TST ,X+
128
 BNE ZCE1E
129
 LEAX $02,X
130
 TST ,X
131
 BNE ZCE06
132
 ANDCC #$FB
133
ZCE2A RTS
134
*
135
** GET USER COMMAND LINE
136
*
137
INBUF1 LDX #LINBUF
138
 STX >LINPTR
139
ZCE31 JSR >GETCH1
140
 CMPA >DELCHR
141
 BEQ ZCE56
142
 CMPA >BSPCHR
143
 BEQ ZCE5D
144
 CMPA #$0D
145
 BEQ ZCE4F
146
 CMPA #$0A
147
 BEQ ZCE78
148
 CMPA #$1F
149
 BLS ZCE31
150
ZCE4A CMPX #ZC0FF
151
 BEQ ZCE31
152
ZCE4F STA ,X+
153
 CMPA #$0D
154
 BNE ZCE31
155
 RTS
156
 
157
ZCE56 LDX #QRYSTR
158
 BSR PSTRG1
159
 BRA INBUF1
160
 
161
ZCE5D CMPX #LINBUF
162
 BEQ ZCE56
163
 LEAX -$01,X
164
 LDA >BSECHR
165
 CMPA #$08
166
 BNE ZCE73
167
 LDA #$20
168
 JSR >ZCF66
169
 LDA >BSECHR
170
ZCE73 JSR >ZCF66
171
 BRA ZCE31
172
 
173
ZCE78 LDA #$0D
174
 JSR >PUTCH1
175
 LDA #$20
176
 BRA ZCE4A
177
 
178
PSTRG1 BSR PCRLF1
179
ZCE83 LDA ,X
180
 CMPA #$04
181
 BEQ ZCEF8
182
 JSR >PUTCH1
183
 LEAX $01,X
184
 BRA ZCE83
185
 
186
ZCE90 JSR >ZCD4E
187
 BEQ ZCEFA
188
 JSR [ZD3E5]
189
 CMPA >ESCCHR
190
 BNE ZCEFA
191
ZCE9E CLR >CURLIN
192
ZCEA1 JSR [ZD3E5]
193
 CMPA >ESCCHR
194
 BEQ ZCEFA
195
 CMPA #$03 CTRL C
196
 BNE ZCEA1
197
 CLR >LASTRM
198
 JMP [ESCVEC]
199
*
200
** PRINT CR, LINEFEED
201
*
202
PCRLF1 TST >SIOFLG
203
 BNE ZCEE1
204
 BSR ZCE90
205
 LDA >DEPCNT
206
 BEQ ZCEE1
207
 CMPA >CURLIN
208
 BHI ZCEDE
209
 CLR >CURLIN
210
 TST >PAUSE
211
 BEQ ZCED0
212
 BSR ZCE9E
213
ZCED0 PSHS B
214
 LDB >EJTCNT
215
 BEQ ZCEDC
216
ZCED7 BSR ZCEE1
217
 DECB
218
 BNE ZCED7
219
ZCEDC PULS B
220
ZCEDE INC >CURLIN
221
ZCEE1 LDA #$0D
222
 BSR PUTCH1
223
 LDA #$0A
224
 BSR PUTCH1
225
 PSHS B
226
 LDB >NULCNT
227
 BEQ ZCEF6
228
ZCEF0 CLRA
229
 BSR PUTCH1
230
 DECB
231
 BNE ZCEF0
232
ZCEF6 PULS B
233
ZCEF8 ANDCC #$FE
234
ZCEFA RTS
235
*
236
** GET A CHARACTER HONOURING TTYSET
237
*
238
GETCH1 TST >INPSWT
239
 BNE ZCF1A
240
 TST >FIPADR
241
 BEQ ZCF15
242
 BSR ZCF21
243
 TST >FIEFLG
244
 BEQ ZCF1D
245
 TST >FOPADR
246
 BEQ ZCF1D
247
 BSR ZCF66
248
 BRA ZCF1D
249
ZCF15 JSR >INCH
250
 BRA ZCF1D
251
 
252
ZCF1A JSR >INCH2
253
ZCF1D CLR >CURLIN
254
 RTS
255
 
256
ZCF21 STX >ZCC47
257
 LDX >FIPADR
258
 BRA ZCF2F
259
 
260
ZCF29 STX >ZCC47
261
 LDX >FOPADR
262
ZCF2F JSR >FMS
263
 BNE ZCF38
264
 LDX >ZCC47
265
 RTS
266
 
267
ZCF38 CLR >FOPADR
268
 JSR >RPTER1
269
 JMP >WARMS
270
*
271
** OUTPUT CHARACTER HONOURING TTYSET
272
*
273
PUTCH1 TST >SIOFLG
274
 BNE ZCF66
275
 CMPA #$1F
276
 BHI ZCF4F
277
 CLR >CURCOL
278
 BRA ZCF66
279
 
280
ZCF4F INC >CURCOL
281
 PSHS A
282
 LDA >WIDCNT
283
 BEQ ZCF64
284
 CMPA >CURCOL
285
 BCC ZCF64
286
 JSR >PCRLF1
287
 INC >CURCOL
288
ZCF64 PULS A
289
ZCF66 PSHS A
290
 TST >OUTSWT
291
 BNE ZCF80
292
 TST >FOPADR
293
 BEQ ZCF76
294
 BSR ZCF29
295
 BRA ZCF83
296
 
297
ZCF76 TST >FIPADR
298
 BNE ZCF83
299
 JSR >OUTCH
300
 BRA ZCF83
301
ZCF80 JSR >OUTCH2
302
ZCF83 PULS A
303
 RTS
304
 
305
OUTDC1 CLR >ZCC4A
306
 STB >TRNFLG
307
 LDA #$04
308
 STA >ZCC4D
309
 LDD ,X
310
 LDX #DECTBL
311
ZCF96 BSR ZCFA3
312
 LEAX $02,X
313
 DEC >ZCC4D
314
 BNE ZCF96
315
 TFR B,A
316
 BRA OUTHXR
317
 
318
ZCFA3 CLR >ZCC4B
319
ZCFA6 CMPD ,X
320
 BCS ZCFB2
321
 SUBD ,X
322
 INC >ZCC4B
323
 BRA ZCFA6
324
 
325
ZCFB2 PSHS A
326
 LDA >ZCC4B
327
 BNE ZCFC9
328
 TST >ZCC4A
329
 BNE ZCFC9
330
 TST >TRNFLG
331
 BEQ ZCFCE
332
 LDA #$20
333
 BSR ZCFEA
334
 BRA ZCFCE
335
 
336
ZCFC9 INC >ZCC4A
337
 BSR OUTHXR
338
ZCFCE PULS PC,A
339
*
340
** DISPLAY HEX ADDRESS
341
*
342
OUTAD1 BSR OUTHX1
343
 LEAX $01,X
344
*
345
** OUPUT HEX BYTE
346
*
347
OUTHX1 LDA ,X
348
 BSR OUTHXL
349
 LDA ,X
350
 BRA OUTHXR
351
 
352
OUTHXL LSRA
353
 LSRA
354
 LSRA
355
 LSRA
356
OUTHXR ANDA #$0F
357
 ADDA #$30
358
 CMPA #$39
359
 BLS ZCFEA
360
 ADDA #$07
361
ZCFEA JMP >PUTCH1
362
*
363
** CLASSIFY CHARACTER ALHA/NUMERIC
364
*
365
CLASS1 CMPA #'0
366
 BCS ZD005
367
 CMPA #'9
368
 BLS ZD00B
369
 CMPA #'A
370
 BCS ZD005
371
 CMPA #'Z
372
 BLS ZD00B
373
 CMPA #'a $61
374
 BCS ZD005
375
 CMPA #'z $7A
376
 BLS ZD00B
377
ZD005 ORCC #$01
378
 STA >LASTRM
379
 RTS
380
ZD00B ANDCC #$FE
381
 RTS
382
*
383
** GET NEXT CHARACTER FROM FILE
384
*
385
NXTCH1 PSHS X
386
 LDX >LINPTR
387
 LDA >CURCHR
388
 STA >PRVCHR
389
ZD019 LDA ,X+
390
 STA >CURCHR
391
 CMPA #$0D
392
 BEQ ZD032
393
 CMPA >EOLCHR
394
 BEQ ZD032
395
 STX >LINPTR
396
 CMPA #$20
397
 BNE ZD032
398
 CMPA ,X
399
 BEQ ZD019
400
ZD032 BSR CLASS1
401
 PULS PC,X
402
*
403
** PARSE FILE SPEC. IN LINE BUFFER
404
*
405
GETFL1 LDA #$15
406
 STA $01,X
407
 LDA #$FF
408
 STA $03,X
409
 CLR $04,X
410
 CLR $0C,X
411
 JSR >ZD0D4
412
 LDA #$08
413
 STA >ZCC4B
414
 BSR ZD080
415
 BCS ZD07C
416
 BNE ZD05F
417
 BSR ZD080
418
 BCS ZD07C
419
 BNE ZD05F
420
 CMPX >ZCC3F
421
 BEQ ZD0C7
422
 BSR ZD080
423
 BLS ZD0C7
424
ZD05F LDX >ZCC3F
425
 TST $04,X
426
 BEQ ZD0C7
427
 TST $03,X
428
 BPL ZD079
429
 TST >ZCC0D
430
 BEQ ZD074
431
 LDA >SYSDRV
432
 BRA ZD077
433
 
434
ZD074 LDA >WRKDRV
435
ZD077 STA $03,X
436
ZD079 CLR >ZCC0D
437
ZD07C LDX >ZCC3F
438
 RTS
439
 
440
ZD080 BSR NXTCH1
441
 BCS ZD0C7
442
 CMPA #$39
443
 BHI ZD09D
444
 LDX >ZCC3F
445
 TST $03,X
446
 BPL ZD0C7
447
 ANDA #$03
448
 STA $03,X
449
 JSR >NXTCH1
450
 BCC ZD0C7
451
ZD098 CMPA #$2E
452
 ANDCC #$FE
453
 RTS
454
 
455
ZD09D LDB >ZCC4B
456
 BMI ZD0C7
457
 PSHS B
458
 SUBB #$05
459
 STB >ZCC4B
460
 PULS B
461
ZD0AB CMPA >MAPUP
462
 BCS ZD0B2
463
 SUBA #$20
464
ZD0B2 STA $04,X
465
 LEAX $01,X
466
 DECB
467
 JSR >NXTCH1
468
 BCC ZD0C4
469
 CMPA #$2D
470
 BEQ ZD0C4
471
 CMPA #$5F
472
 BNE ZD0CA
473
ZD0C4 TSTB
474
 BNE ZD0AB
475
ZD0C7 ORCC #$01
476
 RTS
477
 
478
ZD0CA TSTB
479
 BEQ ZD098
480
 CLR $04,X
481
 LEAX $01,X
482
 DECB
483
 BRA ZD0CA
484
 
485
ZD0D4 STX >ZCC3F
486
 LDX >LINPTR
487
ZD0DA LDA ,X
488
 CMPA #$20
489
 BNE ZD0E4
490
 LEAX $01,X
491
 BRA ZD0DA
492
ZD0E4 STX >LINPTR
493
 LDX >ZCC3F
494
 RTS
495
*
496
** DEFAULT FILE EXTENSION
497
*
498
SETEX1 PSHS Y,X
499
 LDB $0C,X
500
 BNE ZD109
501
 LDY #EXTTBL
502
 CMPA #$0B
503
 BHI ZD109
504
 LDB #$03
505
 MUL
506
 LEAY B,Y
507
 LDB #$03
508
ZD100 LDA ,Y+
509
 STA $0C,X
510
 LEAX $01,X
511
 DECB
512
 BNE ZD100
513
ZD109 PULS PC,Y,X
514
*
515
** STANDARD FILE NAME EXTTENSIONS
516
*
517
EXTTBL FCC "BIN"
518
 FCC "TXT"
519
 FCC "CMD"
520
 FCC "BAS"
521
 FCC "SYS"
522
 FCC "BAK"
523
 FCC "SCR"
524
 FCC "DAT"
525
 FCC "BAC"
526
 FCC "DIR"
527
 FCC "PRT"
528
 FCC "OUT"
529
*
530
** READ A HEX ADDRESS FROM THE LINE BUFFER
531
*
532
GETHX1 JSR >ZD21E
533
ZD132 JSR >NXTCH1
534
 BCS ZD159
535
 BSR ZD15F
536
 BCS ZD153
537
 PSHS B
538
 LDB #$04
539
ZD13F ASL >LODOFF+1
540
 ROL >LODOFF
541
 DECB
542
 BNE ZD13F
543
 PULS B
544
 ADDA >LODOFF+1
545
 STA >LODOFF+1
546
 INCB
547
 BRA ZD132
548
 
549
ZD153 JSR >NXTCH1
550
 BCC ZD153
551
 RTS
552
 
553
ZD159 LDX >LODOFF
554
 ANDCC #$FE
555
 RTS
556
 
557
ZD15F SUBA #$47
558
 BPL ZD172
559
 ADDA #$06
560
 BPL ZD16B
561
 ADDA #$07
562
 BPL ZD172
563
ZD16B ADDA #$0A
564
 BMI ZD172
565
 ANDCC #$FE
566
 RTS
567
 
568
ZD172 ORCC #$01
569
 RTS
570
 
571
INDEC1 JSR >ZD21E
572
ZD178 JSR >NXTCH1
573
 BCS ZD159
574
 CMPA #$39
575
 BHI ZD153
576
 ANDA #$0F
577
 PSHS B
578
 PSHS A
579
 LDD >LODOFF
580
 ASLB
581
 ROLA
582
 ASLB
583
 ROLA
584
 ASLB
585
 ROLA
586
 ADDD >LODOFF
587
 ADDD >LODOFF
588
 ADDB ,S+
589
 ADCA #$00
590
 STD >LODOFF
591
 PULS B
592
 INCB
593
 BRA ZD178
594
*
595
** LOAD BINARY FILE
596
*
597
LOAD1 CLR >TRNFLG
598
ZD1A5 BSR ZD1E4
599
 CMPA #$02
600
 BEQ ZD1C0
601
 CMPA #$16
602
 BNE ZD1A5
603
 BSR ZD1E4
604
 STA >TRNVEC
605
 BSR ZD1E4
606
 STA >TRNVEC+1
607
 LDA #$01
608
 STA >TRNFLG
609
 BRA ZD1A5
610
 
611
ZD1C0 BSR ZD1E4
612
 TFR A,B
613
 BSR ZD1E4
614
 EXG A,B
615
 ADDD >LODOFF
616
 STD >ZCC3D
617
 BSR ZD1E4
618
 TFR A,B
619
 TSTA
620
 BEQ ZD1A5
621
ZD1D5 BSR ZD1E4
622
 LDX >ZCC3D
623
 STA ,X+
624
 STX >ZCC3D
625
 DECB
626
 BNE ZD1D5
627
 BRA ZD1A5
628
 
629
ZD1E4 LDX #FCB
630
 JSR >FMS
631
 BEQ ZD1FD
632
 LDA $01,X
633
 CMPA #$08
634
 BNE ZD200
635
 LEAS $02,S
636
ZD1F4 LDA #$04
637
 STA ,X
638
 JSR >FMS
639
 BNE ZD20A
640
ZD1FD ANDCC #$FE
641
 RTS
642
 
643
ZD200 STA >ERRTYP
644
 CMPA #$04
645
 BNE ZD20A
646
 ORCC #$01
647
 RTS
648
 
649
ZD20A BSR RPTER1
650
 JMP >ZCDE4
651
*
652
** 'GET' - LOAD BINARY FILE
653
*
654
GETCMD LDA #$00
655
 BSR ZD248
656
 BCS ZD224
657
 BSR ZD21E
658
 INC >ZCC4C
659
 BSR LOAD1
660
 BRA GETCMD
661
 
662
ZD21E CLRA
663
 CLRB
664
 STD >LODOFF
665
 RTS
666
 
667
ZD224 LDB >ZCC4C
668
 LBEQ ZCDD9
669
 JMP >WARMS
670
 
671
ZD22E LDA #$02
672
 BSR ZD254
673
 BSR ZD21E
674
 JSR >LOAD1
675
 LDB >TRNFLG
676
 BEQ ZD240
677
 JMP [TRNVEC]
678
 
679
ZD240 LDX #NTRMSG
680
 LDA #$81
681
 JMP >ZCDDE
682
 
683
ZD248 PSHS A
684
 LDX #FCB
685
 JSR >GETFL1
686
 PULS A
687
 BCS ZD26E
688
ZD254 LDX #FCB
689
 JSR >SETEX1
690
 LDX #FCB
691
 LDA #$01
692
 STA ,X
693
 JSR >ZD1E4
694
 LBCS ZD323
695
 LDA #$FF
696
 STA $3B,X
697
 RTS
698
 
699
ZD26E LDA >LASTRM
700
 CMPA #$0D
701
 BEQ ZD27C
702
 CMPA >EOLCHR
703
 LBNE ZCDD9
704
ZD27C ORCC #$01
705
 RTS
706
 
707
RPTER1 PSHS Y,X
708
 LDA $01,X
709
 STA >ERRTYP
710
 BEQ ZD2EB
711
 JSR >RSTIO1
712
 LDY >ERRVEC
713
 BNE ZD299
714
 CMPA #$10
715
 BEQ ZD2ED
716
 LDY #ZD361
717
ZD299 LDX #FCB
718
 TST $02,X
719
 BEQ ZD2A9
720
 LDA #$04
721
 STA ,X
722
 JSR >FMS
723
 BNE ZD2D7
724
ZD2A9 LDX #ZC838
725
 LDB #$0B
726
 BSR ZD31E
727
 LDX #FCB
728
 LDA >SYSDRV
729
 STA $03,X
730
 LDA #$01
731
 STA ,X
732
 JSR >FMS
733
 BNE ZD2D7
734
 LDA >ERRTYP
735
 DECA
736
 ASRA
737
 ASRA
738
 INCA
739
 CLR $20,X
740
 STA $21,X
741
 LDA #$15
742
 STA ,X
743
 JSR >FMS
744
 BEQ ZD2F5
745
ZD2D7 LDX #DERMSG
746
 JSR >PSTRG1
747
 LDX >ZCC3F
748
 LDA >ERRTYP
749
 STA $01,X
750
 CLR ,X
751
 CLRB
752
 JSR >OUTDC1
753
ZD2EB PULS PC,Y,X
754
 
755
ZD2ED LDX #DNRMSG
756
 JSR >PSTRG1
757
 BRA ZD2EB
758
 
759
ZD2F5 JSR >PCRLF1
760
 LDX #FCB
761
 LDA >ERRTYP
762
 DECA
763
 ANDA #$03
764
 LDB #$3F
765
 MUL
766
 ADDB #$04
767
 STB $22,X
768
ZD309 JSR >FMS
769
 BNE ZD2D7
770
 JSR >PUTCH1
771
 CMPA #$0D
772
 BNE ZD309
773
 LDA #$04
774
 STA ,X
775
 JSR >FMS
776
 BRA ZD2EB
777
ZD31E PSHS Y,X
778
 JMP >ZD100
779
 
780
ZD323 LDX #NFDMSG NOT FOUND
781
 JMP >ZCDE1
782
*
783
** CALL FLEX AS A SUBROUTINE
784
*
785
DOCMD1 PULS B,A
786
 STD >ZCC43
787
ZD32E STS >ZCC45
788
 CLR >ERRTYP
789
 INC >CMDFLG
790
 JMP >ZCDB8
791
ZD33B CLR >CMDFLG
792
 LDS >ZCC45
793
 LDB >ERRTYP
794
 JMP [ZCC43]
795
*
796
** ADD ACCB TO IX
797
*
798
ADDBX1 ABX
799
 RTS
800
 
801
ZD34B TST >ZCCFC
802
 BNE ZD354
803
 JMP [MONVEC]
804
 
805
ZD354 LDX #FCB
806
 LDA #$1B
807
 STA $01,X
808
 JSR >RPTER1
809
 JMP >WARM1
810
 
811
ZD361 FCC /ERRORS/
812
 FCB $00,$00
813
 FCC /SYS/
814
 END

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.