-
Notifications
You must be signed in to change notification settings - Fork 0
/
MONITOR2P1.L99
1834 lines (1809 loc) · 88.5 KB
/
MONITOR2P1.L99
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
;
;-----------------------------------------------------------------------
; MONITOR AND FDC INTERFACE ROUTINES for the TI99000 SBC
;
; Written by Alex Cameron
;
; The monitor routines are called from a DOS or other
; programme to perform Console I/O and Disc I/O similar
; to a BIOS.
;
; Version 2.1 14th May 2020 - The year of the Corona Virus
; Version 2.2 3rd February, 2024 -
; Combined partial set of TIBUG commands into Monitor
; and targeted for the SBC ROM.
; RAM ADDRESS: EC00H-EFFFH;
; ROM ADDRESS: F000H-FFFFH
;
;
;---------------------------------------------------------------------
;
0000 R0 EQU 0
0001 R1 EQU 1
0002 R2 EQU 2
0003 R3 EQU 3
0004 R4 EQU 4
0005 R5 EQU 5
0006 R6 EQU 6
0007 R7 EQU 7
0008 R8 EQU 8
0009 R9 EQU 9 ;Use to index workspace pointer not stack overflow
;SL EQU R9 ;STACK LIMIT
000A R10 EQU 10
000A SP EQU R10 ;STACK POINTER
000B R11 EQU 11
000C R12 EQU 12
000C PORT EQU R12 ;IO BASE
000D R13 EQU 13
000E R14 EQU 14
000F R15 EQU 15
000F ST EQU 15
;
;***************************************************
;
; DEFINE SOME XOP'S.
; ALL PROGRAMMES USE THESE XOPS
;
;****************************************************
;
DXOP PUSHREG,4 ;PUSH RANGE OF REGISTERS TO STACH
DXOP POPREG,5
DXOP CALL,6
DXOP RET,7
DXOP PUSH,8 ;PUSH SINGLE REGISTER
DXOP POP,9
DXOP WHEX,10 ;WRITE OUT A 16 BIT HEX VALUE
DXOP RHEX,11 ;READ IN A 16 BIT HEX VALUE
DXOP WRITE,12 ;WRITE CHAR IN MSB
DXOP READ,13 ;READ CHAR IN MSB
DXOP MESG,14 ;OUTPUT NULL TERMINATED MESSAGE
DXOP DEBUG,15 ;DEBUG CURRENT LOCATION & STORE INTO DEBUG_BUFFER
;
; SOME EQUATES
;
C300 SHELL: EQU 0C300H ;ADDRESS OF SHELL
F000 MONORG: EQU 0F000H ;ORIGIN FOR THIS MONITOR
0008 INTVEC: EQU 08H
BF00 LOADER: EQU SHELL - 1024 ;THIS IS THE LOADER ADDRESS
;
;--------------------------------------------
;LOW MEMORY VECTORS INTO MONITOR, SHELL AND DOS
;ALLOWS APPLICATIONS TO USE A FIXED SYSTEM VECTOR
;RATHER THAN BEING ASSEMBLED WITH ABSOLUTE ADDRESSES
;SO FOR EXAMPLE MONITOR IS NOT KNOW TO BDOS
;---------------------------------------------
;
;SHELL_ADDR: EQU 080H ;ORGANISED 2 WORDS AS WP:PC VECTOR
;BDOS_ADDR: EQU 084H ;POINTER TO BDOS ORGANISED 2 WORDS AS WP:PC
0088 MON_PTR: EQU 088H ;MONITOR VECTOR. PROGRAMMES CAN USE THIS
;CMDLINE_PTR: EQU 0A0H ;POINTER TO COMMAND LINE
;CMDLINE_LEN: EQU 0A2H ;COMMAND LINE LENGTH
;SYSBUFF_PTR: EQU 0A4H ;POINTER TO SYSTEM BUFFER (512 BYTES)
;FREEMEM_ADDR: EQU 0A6H ;START OF FREE MEMORY
;
; DECLARE VARIABLES THAT NEED RAM
;
ED00 MONITOR_RAM: EQU MONORG-0300H
ED00 AORG MONITOR_RAM
ECFE STACKP: EQU MONITOR_RAM-2 ;STACK POINTER SITS ON TOP OF RAM
ED00 INTWP0: BSS 25*16 ;7 INT, 16 WORKSPACES OF 16 BYTES EACH
EE90 BOOT_WP: BSS 32 ;THIS IS BOOT TEMPORARY WORKSAPCE
EEB0 WORKSP: BSS 32
;
; NOTE THIS IS USED BY DEBUG TO STORE MULTIPLE DEBUG POINTERS TO
; PROGRAMMES CALLING DEBUG
;
EED0 DEBUG_NAME: BSS 9 ;;NAME OF MODULE 8 CHARS LONG NULL TERMINATED
EED9 00 EVEN
DEBUG_BUFFER:
EEDA BSS 20 ;DEBUG TRACE LIST
;DISC_RAM: EQU $ + 0
;
;-- RAM BASED IO PARAMETER BLOCK
;
EEEE EVEN
EEEE DISC_PARAM EQU $ + 0
EEEE 0000 FDCSTATUS WORD 0 ;OPERATION STATUS
EEF0 0000 BYTESRD WORD 0 ;A DEBUGGING FEATURE FOR NUMBER OF BYTES READ
EEF2 0000 TRKSTAT WORD 0 ;VERIFIED TRACK STATUS
EEF4 0000 SECSTAT WORD 0 ;VERIFIED SECTOR STATUS
EEF6 0000 IOPTR WORD 0 ;IO BUFFER POINTER IN R8 OF DRQ INT
EEF8 FFFF TRACK WORD -1 ;CURRENT SELECTED DRIVE TRACK NO
EEFA 0000 0000 TRKTAB WORD 0,0 ;DRIVE 1, 2 => ;HEAD POSITIONS FOR 2 DRIVES
EEFE 0000 0000 TYPTAB WORD 0,0 ;DRIVE 1, 2 => BIT 1 1=SD,0=DD;BIT 2 1=MINI=5.25, 0=MINI=3.5
EF02 0000 SECTOR WORD 0 ;CURRENT SECTOR NO.
EF04 0000 SIDE WORD 0 ;SIDE SELECT BIT
EF06 0000 CMDTYP WORD 0 ;COMMAND TYPE
EF08 0000 DSKTYP WORD 00B ;CURRENT UNIT / DENSITY INDICATOR (USING TYPTAB ABOVE)
EF0A 0000 DRIVE WORD 0 ;CURRENT DRIVE
EF0C 0007 FNDTRY WORD 7 ;FIND TRACK RETRY COUNT
EF0E 0005 MAXRWT WORD 5 ;NUMBER OF RETRIES ALLOWED
EF10 0005 RWTRY WORD 5
EF12 0000 ERRTYP WORD 0 ;ERROR STATUS FOR READ/WRITE ROUTINES
EF14 0000 OPCOMP WORD 0 ;CLEARED WHEN IF DISK OPERATION COMPLETE
EF16 0000 DRVRDY WORD 0 ;CLEARED WHEN DRIVE READY TIME OUT
EF18 0000 SELCPY WORD 0 ;COPY OF DATA IN SELECT/MUX OUTPUTS
EF1A 0001 TIMEOUT WORD 1 ;N * 16MS DURATION
; EVEN
EF1C 0000 DISC_INUSE WORD 0
0030 RAM_SIZE EQU $ - DISC_PARAM
;-----TESTING CODE
; AORG 0100H
; BLWP @TEMP
;TEMP: WORD WORKSP
; WORD INITIAL
;----- END TESTING CODE
;
; LOCATE THE MONITOR IN MEMORY
;
F000 AORG MONORG
;
; INITIALISATION
;
;
;************************************************************************************
;
; USE BLWP @MONITOR TO INITIALISE MONITOR VECTORS AND INTERRUPTS
;
; NOTE ALL PROGRAMMES OR MODULES MUST SET THEIR WORSPACE
; POINTERS AND STACKS BEFORE CALLING, e.g.
;
; AORG 0100H
; LWPI WORKSP
; BLWP @INIT_MONITOR
; <INITIALISED MONITOR WILL RETURN HERE>
;
;
;*************************************************************************************
;
INIT_MONITOR:
F000 EEB0 WORD WORKSP ;THIS IS MONITOR WORKSAPCE
F002 F1AE WORD INIT_VECTORS ;INITIALISE ALL XOP, INTERRUPT AND ENTRY VECTORS
F004 0460 F236 BOOT_ADDR: B @BOOT ;PERFORM A COLD BOOT - POS IN TABLE HELPS DEBUGGING
F008 0460 F28C B @CIN ;CHAR IN
F00C 0460 F290 B @COUT ;CHAR OUT
F010 0460 F298 B @SELDSK ;SELECT A DISK DRIVE
F014 0460 F356 B @RECAL ;RECALIBRATE DRIVES
F018 0460 F57E B @SEEK ;SEEK THE TRACK IN R3
F01C 0460 F38E B @RDREC ;READ SELECTED SECTOR
F020 0460 F3E6 B @WRREC ;WRITE SELECTED SECTOR
F024 0460 F368 B @RDID ;READ TRACK ID ADDRESS
F028 0460 F21E B @WBOOT ;PERFORM A WARM BOOT
F02C 0460 F3AA B @RDTRK ;READ A TRACK OF DATA
F030 0460 F3CA B @WRTRK ;WRITE A TRACK OF DATA
;
;**********************************************************
;
; DMA PARAMETER BLOCK DEFINITIONS
; INDEXED DEPENDING ON READ(0), OR WRITE(1) COMMAND
;
;************************************************************
;
F034 34B8 CMDTBL: STCR *R8+,BYTEWIDE ;BYTE WIDE FDC DATA READ
F036 30B8 LDCR *R8+,BYTEWIDE ;BYTE WIDE FDC DATA WRITE
;
;--REGISTERS IN INTERRUPT 3 WORKSPACE
;
ED32 DMACMD SET 2*R9+INTWP2 ;CURRENT COMMAND
ED30 DMAADDR SET 2*R8+INTWP2 ;REGISTER HOLDING SOURCE ADDRESS
ED38 DMAPORT SET 2*R12+INTWP2 ;IO BASE REG I.E. DATAREG
F038 0D0A 00 CRLF BYTE 0DH,0AH,0
F03B 00 EVEN
;
;FDC 1797 COMMANDS
;
0088 RDCMD: EQU 10001000B ;READ CMD
00C0 RIDCMD: EQU 11000000B ;READ ID
00A8 WRCMD: EQU 10101000B ;WRITE CMD
00F0 WTCMD: EQU 11110000B ;WRITE TRACK
00E0 RTCMD: EQU 11100000B ;READ TRACK
001C SEKCMD: EQU 00011100B ;SEEK CMD
000C RSTCMD: EQU 00001100B ;RESTORE COMMAND
00D0 FINTCMD: EQU 11010000B ;FORCE INTERRUPT COMMAND
005C SICMD: EQU 01011100B ;STEP IN COMMAND
007C SOCMD: EQU 01111100B ;STEP OUT COMMAND
;
;--FDC 1797 IO REG LOCATIONS
;
8000 FDC1797: EQU 8000H ;IO BASE REGISTER- BYTE TRANSFER WITH MSB SET
8000 STSREG: EQU FDC1797+0 ;MAIN STATUS REG
8000 CMDREG: EQU FDC1797+0 ;COMMAND REGISTER
8002 TRKREG: EQU FDC1797+2 ;TRACK REGISTER
8004 SECREG: EQU FDC1797+4 ;SECTOR REGISTER
8006 DATREG: EQU FDC1797+6 ;DATA REGISTER
;
;
;--PORTS ETC.
;
0000 SELMUX: EQU 0 ;SELECT CONTROL PORT
000A TYPMUX: EQU SELMUX + 2*5 ;START AT BIT 5
0002 BYTEWIDE: EQU 2 ;PARALLEL I/O DONE IN BYTES (UNIQUE TO 99105)
;
;
; THESE ARE THE TIBUG BASIC COMMANDS, SUCH AS:
; QBOOT, ADDR G(O), ADDR O(UTPUT), W(ORKSPACE), R(EGISTERS), ADDRESS O(PEN).
;
; TIBUG WILL BE THE DEFAULT ENTRY POINT.
; BOOTING IS EFFECTED BY ISSUING THE Q(QBOOT) COMMAND
;
TIBUG_ENTRY:
F03C 2FA0 F0EA BANNER MESG @MESS00 ;_PRINT ">> TMS9900 TIBUG <<"
; READ R1 ;READ ANY RUBBISH
F040 2FA0 F107 PROMPT MESG @MESS01 ;PRINT PROMPTER
F044 06A0 F12E BL @HEXIN ;OBTAIN ADDRESS IN R2 AND INSTRUCTION IN R1
F048 0204 0013 LI R4,19 ;20 POSSIBLE INSTRUCTIONS
F04C 9064 F096 MON01 CB @INTAB(R4),R1 ;SEARCH INTAB
F050 1305 JEQ MON03
F052 0604 DEC R4
F054 18FB JOC MON01
F056 2FA0 F10B MON02 MESG @MESS02 ;PRINT " ??"
F05A 10F2 JMP PROMPT
F05C 0A14 MON03 SLA R4,1 ;BRANCH TO APPROPRIATEE ROUTINE
F05E C124 F0AA MOV @SUBTAB(R4),R4 ;
F062 C0C3 MOV R3,R3 ;TEST HEXIN FLAG
F064 0454 B *R4
;
; TIBUG INSTRUCTION TABLE
;
F066 3031 3233 HEXTAB TEXT '0123456789ABCDEF'
F06A 3435 3637
F06E 3839 4142
F072 4344 4546
F076 3020 3120 NUMTAB TEXT '0 1 2 3 4 5 6 7 8 9 101112131415'
F07A 3220 3320
F07E 3420 3520
F082 3620 3720
F086 3820 3920
F08A 3130 3131
F08E 3132 3133
F092 3134 3135
F096 1A INTAB BYTE 1AH ;CONTROL Z(CLEARS SCREEN)
F097 2F2F 5155 TEXT '//QUGMZOWRPXLHST/. '
F09B 474D 5A4F
F09F 5752 5058
F0A3 4C48 5354
F0A7 2F2E 20
F0AA EVEN
F0AA F03C 0000 SUBTAB WORD BANNER,0,0,QBOOT,HEXLOAD,GO,MOVE,FIND,OUTPUT,WP,PRINT_REGS,PRINT
F0AE 0000 F862
F0B2 F94A F866
F0B6 F0DE F0E0
F0BA F8F2 F932
F0BE F86A F0E8
F0C2 F0E2 F0E4 WORD XCUTE,LOWW,SETBP,SSTEP,TRACE,CHAR,INSTANT,OPEN
F0C6 F0D8 F0D6
F0CA F0DA F0DC
F0CE F0E6 F8B4
;
; COMMANDS IMPLEMENTED IN DISC_MONITOR
; REGIST, OPEN, GO AND QBOOT.
;
;MASK32 WORD 001FH
F0D2 000F MASK15 WORD 000FH
;MASK8 WORD 0007H
F0D4 0003 MASK3 WORD 0003H
;
; DUMMY LIST
;
F0D6 10B4 SSTEP: JMP PROMPT; NULL COMMAND
F0D8 10B3 SETBP: JMP PROMPT; NULL COMMAND
F0DA 10B2 TRACE: JMP PROMPT; NULL COMMAND
F0DC 10B1 CHAR: JMP PROMPT; NULL COMMAND
F0DE 10B0 MOVE: JMP PROMPT; NULL COMMAND
F0E0 10AF FIND: JMP PROMPT; NULL COMMAND
F0E2 10AE XCUTE: JMP PROMPT; NULL COMMAND
F0E4 10AD LOWW: JMP PROMPT; NULL COMMAND
F0E6 10AC INSTANT: JMP PROMPT; NULL COMMAND
F0E8 10AB PRINT: JMP PROMPT; NULL COMMAND
;
;ONLY THESE ONES HAVE BEEN IMPLEMENT WITHIN THE DISC_MONITOR ROM. AS
;THE ADDRESS SPACE HAS BEEN TAKEN UP WITH THE DISC-IO AND THE OTHER FUNCTIONS
;CAN BE EASILY IMPLEMENTED WITH DISC BASED PROGRAMMES.
;
;QBOOT: JMP PROMPT; NULL COMMAND
;GO: JMP PROMPT; NULL COMMAND
;OUTPUT: JMP PROMPT; NULL COMMAND
;WP: JMP PROMPT; NULL COMMAND
;PRINT_REGS: JMP PROMPT; NULL COMMAND
;OPEN: JMP PROMPT; NULL COMMAND
;
; MESSGES AND OTHER EQUATES
;
F0EA 0D0A MESS00 BYTE CR,LF
F0EC 3C54 4D53 TEXT '<TMS9900 DISC MONITOR V2.1>'
F0F0 3939 3030
F0F4 2044 4953
F0F8 4320 4D4F
F0FC 4E49 544F
F100 5220 5632
F104 2E31 3E
; BYTE 0
F107 0D0A MESS01 BYTE CR,LF
F109 3E TEXT '>'
F10A 00 BYTE 0
F10B 3F3F MESS02 TEXT '??'
F10D 00 BYTE 0
F10E 0A0D 0A MESS03 BYTE LF,CR,LF
F111 2020 2020 TEXT ' '
F115 00 BYTE 0
F116 203D 20 MESS04 TEXT ' = '
F119 00 BYTE 0
F11A 2053 5441 MESS05 TEXT ' STACK OVERFLOW AT'
F11E 434B 204F
F122 5645 5246
F126 4C4F 5720
F12A 4154
F12C 00 BYTE 0
000D CR: EQU 0DH ;CARRIAGE RETURN
000A LF: EQU 0AH ;LINE FEED
F12D 00 EVEN
;
;*********************************
; SUPPORT ROUTINES FOR INPUT AND OUTPUT
;**********************************
;
;
; SUBROUTINE HEXIN
; INPUTS A HEX NO. INTO R2
; AND INSTRUCTION INTO R1
; (INSTRUCTION ' ' INSERT AND MOVE TO NEXT ADDRESS
; (INSTRUCTION '-' INSERT AND MOVE TO PREVIOUS ADDRESS
; THE HEX INDEX USES THE TRANSLATE TABLE HEXTAB TO IDENTIFY THE HEX DIGIT.
; THE LAST CHARACTER, EITHER SPACE OR - BREAKS THE CYCLE AS THEY ARE NOT IN THE HEXTABLE
;
; USES R1,R2,R3,R4
;
F12E 04C1 HEXIN: CLR R1
F130 04C2 CLR R2
F132 0703 SETO R3 ;SET FLAG
F134 2F41 HEXIN0 READ R1 ;GET CHARACTER
F136 2F01 WRITE R1 ;PRINT CHARACTER
F138 0204 000F LI R4,15
F13C 9064 F066 HEXIN1 CB @HEXTAB(R4),R1
F140 1604 JNE HEXIN2
F142 04C3 CLR R3 ;CLEARS FLAG
F144 0A42 SLA R2,4 ;SHIFTS HEX DIGIT INTO R2
F146 E084 SOC R4,R2
F148 10F5 JMP HEXIN0
F14A 0604 HEXIN2 DEC R4
F14C 18F7 JOC HEXIN1 ;SUBTRACTING 1 FROM 0 DOES NOT RESULT IN CARRY
F14E C0C3 MOV R3,R3 ;TEST HEXIN FLAG
F150 045B RT ;RETURN FROM BL
;
; SUBROUTINE HEXOUT ;OUTPUT CONTENTS OF R2
; USES R0,R1,R2,R3
;
;HEXOUT WRITE @MESS03+7 ;PRINTS " "
;HEXOUT0 PUSHREG R3 ;SAVE R0-R3
;HEXOUTX CLR R0
; LI R3,4
;HEXOUT1 SRC R2,12
; MOV R2,R1
; ANDI R1,000FH
; MOVB @HEXTAB(R1),R0
; WRITE R0
; DEC R3
; JNE HEXOUT1
; POPREG R3 ;RESTORE R3-R0
; RT
;
F152 2E00 DOT: BYTE '.',0
F154 2B00 PLUS BYTE '+',0
F156 4C4F 4144 LOADERR: TEXT 'LOAD ERROR'
F15A 2045 5252
F15E 4F52
F160 00 BYTE 0
F161 00 EVEN
;
;**********************************************
; XOP WP ENTRY POINTS
;**********************************************
;
F162 ED80 F6BC XOPTAB WORD XOPWP0,XOP0,XOPWP1,XOP1,XOPWP2,XOP2,XOPWP3,XOP3
F166 ED90 F6BE
F16A EDA0 F6C0
F16E EDB0 F6C2
F172 EDC0 F6C4 WORD XOPWP4,XOP4,XOPWP5,XOP5,XOPWP6,XOP6,XOPWP7,XOP7,XOPWP8,XOP8
F176 EDD0 F6D8
F17A EDE0 F6EA
F17E EDF0 F6FA
F182 EE00 F706
F186 EE10 F714 WORD XOPWP9,XOP9,XOPWP10,XOP10,XOPWP11,XOP11
F18A EE20 F720
F18E EE30 F744
F192 EE40 F774 WORD XOPWP12,XOP12,XOPWP13,XOP13,XOPWP14,XOP14,XOPWP15,XOP15
F196 EE50 F784
F19A EE60 F794
F19E EE70 F79E
;
F1A2 ED20 F668 INTTAB WORD INTWP2,INTDRQ,INTWP3,INTREQ ;FDC1797 INTERUPT VECTORS
F1A6 ED30 F636
F1AA ED40 F66C WORD INTWP4,INTTIMER ;TIMER INTERRUPT
;
F1AE EVEN
;
; NOTE. APPLICATIONS MUST CALL WITH THEIR WP POINTERS SET
; THIS CALL IS USED TO SET UP MONITOR
; CALLED USING BLWP @MONITOR
;
INIT_VECTORS:
F1AE 0360 RSET ;CLEAR INTERRUPT MASK
F1B0 02E0 EEB0 LWPI WORKSP ;USE MONITOR LOCAL WORKSPACE
F1B4 020A ECFE LI SP,STACKP ;STACK FOR LOCAL MONITOR USE
F1B8 0200 0088 LI R0,MON_PTR ;SET UP THE MONITOR POINTER
F1BC 0201 F000 LI R1,MONORG
F1C0 CC31 MOV *R1+,*R0+ ;MOVE WORKSPACE POINTER
F1C2 CC31 MOV *R1+,*R0+ ;MOVE MONITOR INITIALISATION ADDRESS
;
;************************************************************
;
; SWTICH TO MONITOR XOP VECTORS RATHER THAN TIMON ROM
; THIS MEANS THAT ALL PROGRAMMES THAT USE XOP WILL USE THE
; THE XOP IMPLEMENTATIONS DEFINED IN MONITOR THAT IS HERE!
;
;************************************************************
F1C4 0200 0008 LI R0,INTVEC ;SET UP INTERRUPT VECTORS
F1C8 0201 F1A2 LI R1,INTTAB ;ONLY INT 2 TO 4
F1CC CC31 INT1: MOV *R1+,*R0+
F1CE CC31 MOV *R1+,*R0+
F1D0 0280 0014 CI R0,INTVEC+12
F1D4 16FB JNE INT1
F1D6 0200 0040 LI R0,40H ;INITIALISE XOP-START AT XOP0
F1DA 0201 F162 LI R1,XOPTAB
F1DE CC31 INIT2: MOV *R1+,*R0+
; NOP ;WTRITE PROTECT
F1E0 CC31 MOV *R1+,*R0+
F1E2 0280 0080 CI R0,80H ;FINISHED?
F1E6 16FB JNE INIT2 ;NO
;
;Now initialise DISC and OTHER RAM. FIRST ZERO THEN COMPY PRESETS
;
F1E8 0200 0030 LI R0,RAM_SIZE
F1EC 0201 EEEE LI R1,DISC_PARAM
F1F0 04C2 CLR R2
F1F2 DC42 INIT_RAM MOVB R2,*R1+
F1F4 0600 DEC R0
F1F6 16FD JNE INIT_RAM
;
; NOW MOVE PRESETS
;
F1F8 0700 SETO R0
F1FA C800 EEF8 MOV R0,@TRACK
F1FE 0200 0005 LI R0,5
F202 C800 EF0E MOV R0,@MAXRWT
F206 C800 EF10 MOV R0,@RWTRY
F20A 0220 0002 AI R0,2
F20E C800 EF0C MOV R0,@FNDTRY
F212 05A0 EF1A INC @TIMEOUT ;THIS JUST SETS TIMEOUT TO 1 AS IT IS ALREAY 0
;
F216 0300 0007 LIMI 7 ;ENABLE INTERRUPTS
F21A 0460 F03C B @BANNER
;
;************************************************************
;
; WARM BOOT ASSUMES A COLD BOOT HAS ALREADY OCCURED
; AND DISC IS JUST BEING CALIBRATED TO A KNOWN STATE
;
;************************************************************
;
F21E 0720 EEF8 WBOOT: SETO @TRACK ;INVALIDATE TRACK
F222 04E0 EF02 CLR @SECTOR
F226 04E0 EF0A CLR @DRIVE
F22A 04C2 CLR R2 ;SELECT BOOT DRIVE
F22C 2DA0 F298 CALL @SELDSK ;SELECT DISK
F230 2DA0 F356 CALL @RECAL ;RECAL
F234 2DC0 RET ;RETURN FROM BLWP
;
;*********************************************************
;
; BOOT ASSUMES MONITOR HAS BEEN INITIALISED AND SO
; THE FDC AND INTERRUPT VECTORS ARE IN VALID
;
;***********************************************************
;
F236 02E0 EE90 BOOT: LWPI BOOT_WP ;WORKSP CAN'T BE THE SAME AS MONITOR THIS IS A TEMPORARY WORKSPACE
F23A 020A ECFE LI SP,STACKP
;
;---NOW TRY TO BOOT FROM TRACK 0 SECTOR 1
;
F23E 2FA0 F27C MESG @BMSG2
F242 04C2 CLR R2
F244 2DA0 F298 CALL @SELDSK ;SELECT DRIVE A
F248 160B JNE BOOT2
F24A 2DA0 F356 CALL @RECAL ;RECAL DRIVE A
F24E 0203 0001 LI R3,1 ;BOOT SECTOR
F252 0204 BF00 LI R4,LOADER ;USE THIS AREA TO BOOT
F256 2DA0 F38E CALL @RDREC
F25A 1602 JNE BOOT2
F25C 0460 BF00 B @LOADER ;LET THERE BE LIFE - LOAD THE SYSTEM
;
; --BOOT ERROR
;
F260 C801 EEEE BOOT2 MOV R1,@FDCSTATUS
F264 2FA0 F26C MESG @BMSG1
F268 0460 F040 B @PROMPT
;
F26C 2D2D 426F BMSG1 TEXT '--Boot error'
F270 6F74 2065
F274 7272 6F72
F278 0D0A 00 BYTE 0DH,0AH,0
F27B 00 EVEN
F27C 2D2D 426F BMSG2 TEXT '--Booting....'
F280 6F74 696E
F284 672E 2E2E
F288 2E
F289 0D0A 00 BYTE 0DH,0AH,0
F28C EVEN
;
;****************************
;
; CHAR IN (MSB OF R1)
;
;*****************************
F28C 2F41 CIN READ R1 ;GET CHAR
F28E 2DC0 RET
;*******************************
;
; CHAR OUT (MSB OF R2)
;
;********************************
;
F290 04C1 COUT CLR R1
F292 D042 MOVB R2,R1 ;COPY CHAR TO R1
F294 2F01 WRITE R1 ;OUTPUT IT
F296 2DC0 RET
;
;************************************************
;
; SELECT THE DRIVE IN R2
;
;************************************************
;
F298 0282 0001 SELDSK: CI R2,1 ;MAXIMUM NUMBER IS 2
F29C 1526 JGT SELRET
F29E 2DA0 F2F0 CALL @DRVSEL ;SELECT THE DRIVE
F2A2 2DA0 F30A CALL @READY ;EMIT NEW SELECT BITS AND TEST READY
F2A6 1621 JNE SELRET
F2A8 C041 MOV R1,R1
F2AA 161F JNE SELRET ;NOT READY
F2AC C0E0 EF0A MOV @DRIVE,R3 ;SAVE LAST UNIT
F2B0 0A13 SLA R3,1 ;TWO BYTES PER WORD
F2B2 C802 EF0A MOV R2,@DRIVE ;NEW UNIT
F2B6 C8E0 EEF8 MOV @TRACK,@TRKTAB(R3) ;STORE PREVIOUS DRIVES TRACK POSITION
F2BA EEFA
F2BC C060 EF08 MOV @DSKTYP,R1
F2C0 0241 0003 ANDI R1,00000011B
F2C4 C8C1 EEFE MOV R1,@TYPTAB(R3) ;STORE PREVIOUS DISK TYPE
F2C8 020C 8002 LI PORT,TRKREG
F2CC 0A12 SLA R2,1 ;MULTIPLY BY 2, IE TWO BYTES PER WORD
F2CE C062 EEFA MOV @TRKTAB(R2),R1 ;GET LAST KNOWN HEAD POSITION FOR NEW DRIVE
F2D2 C801 EEF8 MOV R1,@TRACK ;SAVE THE DRIVE'S NEW POSITION AND
F2D6 06C1 SWPB R1
F2D8 3081 LDCR R1,BYTEWIDE ;OUTPUT TO THE 1797 FDC
F2DA C060 EF08 MOV @DSKTYP,R1 ;DENSITY BITS ETC
F2DE 0241 00FC ANDI R1,11111100B ;MERGE IN NEW DENSITY CONTROL BIT
F2E2 E062 EEFE SOC @TYPTAB(R2),R1
F2E6 2DA0 F55A CALL @SETDENS ;SET DENSITY CONTROL BIT
F2EA 0420 F51E SELRET: BLWP @SETTIMER ;SET DRIVE TIMER
F2EE 2DC0 RET
;
; OUTPUT SELECT BITS
;
F2F0 0242 0003 DRVSEL: ANDI R2,00000011B ;MAKE SURE IT'S IN RANGE
F2F4 D822 F2FC MOVB @SELTAB(R2),@SELCPY ;STORE NEW STATE OF SELECT/MUX PORT
F2F8 EF18
F2FA 2DC0 RET
;
F2FC 01 SELTAB: BYTE 00000001B ;BITS FOR UNIT # 0 (INCLUDE DENSITY BIT)
F2FD 02 BYTE 00000010B
F2FE 04 BYTE 00000100B
F2FF 08 BYTE 00001000B
;
; TURN OFF ALL DRIVES
;
F300 020C 0000 DESELECT: LI PORT,SELMUX
F304 04C0 CLR R0
F306 3140 LDCR R0,00000101B ;CLEAR DISKS
F308 2DC0 RET
;
; EMIT MUX BITS AND SEE IF DRIVE IS READY
;
F30A 0201 0001 READY: LI R1,1
F30E C801 EF1C MOV R1,@DISC_INUSE ;SET DISK-ACTIVE FLAG
F312 020C 0000 LI PORT,SELMUX ;SELECT PORT
F316 04C1 CLR R1
F318 3141 LDCR R1,5 ;CLEAR SELECT BITS FIRST
F31A 31A0 EF18 LDCR @SELCPY,6 ;;OUTPUT CURRENT DRIVE SELECT/MUX 5 BITS PLUS DENSITY
F31E C020 EF1A MOV @TIMEOUT,R0
F322 0280 0001 CI R0,1
F326 1605 JNE READY1
F328 2DA0 F344 CALL @FORCE
F32C 0241 0080 ANDI R1,10000000B
F330 1606 JNE READY2
F332 2DA0 F53E READY1: CALL @WAITRDY
F336 2DA0 F344 CALL @FORCE ;CLEAR CONTROLLER AND TEST DRIVE
F33A 0241 0080 ANDI R1,10000000B ;READY FLAG
F33E C801 EEEE READY2: MOV R1,@FDCSTATUS
F342 2DC0 RET
;
;
F344 0201 00D0 FORCE: LI R1,FINTCMD ;FORCE INTERRUPT COMMAND
F348 2DA0 F5E6 CALL @EXCMD
F34C 020C 8000 LI PORT,STSREG ;GET RESULT BYTE AS NO INTERRUPT
F350 3481 STCR R1,BYTEWIDE ;HAS OCCURRED
F352 0981 SRL R1,8
F354 2DC0 RET
;
;*****************************
;
;--RECAL IS JUST SEEK TO TRK ZERO (RECAL IS HANDLED THERE)
;
;*****************************
;
F356 0203 0000 RECAL: LI R3,0 ;RECAL COMMAND
F35A 0720 EEF8 SETO @TRACK ;INVALIDATE TRACK SEEK WILL ZERO
F35E 2DA0 F57E CALL @SEEK ;TRACK REGISTER IS ZEROED
F362 0241 0081 ANDI R1,10000001B
F366 2DC0 RET
;
;*******************************
;
;READ ID FIELDS
;
;******************************
;
F368 C804 EEF6 RDID MOV R4,@IOPTR
F36C 2DA0 F30A CALL @READY
F370 160B JNE RDIDX
F372 0202 00C0 LI R2,RIDCMD
F376 2DA0 F3FE CALL @RDWRT ;READ ID RECORD INTO (R4)
F37A 1606 JNE RDIDX ;EXIT IF DISK ERROR
F37C C120 EEF6 MOV @IOPTR,R4
F380 0224 0006 AI R4,6 ;POINT TO 7TH BYTE AFTER ID RECORD
F384 C520 EF08 MOV @DSKTYP,*R4 ;STORE DISK TYPE THERE
F388 0420 F51E RDIDX BLWP @SETTIMER
F38C 2DC0 RET
;
;****************************
;
;READ A RECORD
; R3 HOLDS SECTOR
; R4 HOLDS BUFFER POINTER
;
;*****************************
;
F38E C804 EEF6 RDREC: MOV R4,@IOPTR
F392 C803 EF02 MOV R3,@SECTOR
F396 2DA0 F30A CALL @READY
F39A 1604 JNE RDRECX ;EXIT IF DRIVE NOT READY
F39C 0202 0088 LI R2,RDCMD ;DO A READ COMMAND
F3A0 2DA0 F3FE CALL @RDWRT
F3A4 0420 F51E RDRECX: BLWP @SETTIMER
F3A8 2DC0 RET ;BIND *SP+ ;RET
;****************************
;
;READ A TRACK
; R3 NOT REQUIRED
; R4 HOLDS BUFFER POINTER
;
;*****************************
;
F3AA C804 EEF6 RDTRK MOV R4,@IOPTR
F3AE 0203 0001 LI R3,1 ;DUMMY
F3B2 C803 EF02 MOV R3,@SECTOR
F3B6 2DA0 F30A CALL @READY
F3BA 1604 JNE RDTRKX ;EXIT IF DRIVE NOT READY
F3BC 0202 00E0 LI R2,RTCMD ;DO A READ COMMAND
F3C0 2DA0 F3FE CALL @RDWRT
F3C4 0420 F51E RDTRKX BLWP @SETTIMER
F3C8 2DC0 RET ;BIND *SP+ ;RET;
;
;****************************
;
;WRITE A TRACK
; R3 NOT REQUIRED
; R4 HOLDS BUFFER POINTER
;
;*****************************
;
F3CA C804 EEF6 WRTRK MOV R4,@IOPTR
F3CE C803 EEF8 MOV R3,@TRACK
F3D2 2DA0 F30A CALL @READY
F3D6 16F6 JNE RDTRKX ;EXIT IF DRIVE NOT READY
F3D8 0202 00F0 LI R2,WTCMD ;DO A WRITE COMMAND
F3DC 2DA0 F3FE CALL @RDWRT
F3E0 0420 F51E WRTRKX BLWP @SETTIMER
F3E4 2DC0 RET ;BIND *SP+ ;RET;
;
;******************************
;
;WRITE A RECORD
; R3 HOLDS SECTOR
; R4 HOLDS BUFFER POINTER
;
;*****************************
;
F3E6 C804 EEF6 WRREC MOV R4,@IOPTR
F3EA C803 EF02 MOV R3,@SECTOR
F3EE 2DA0 F30A CALL @READY
F3F2 1604 JNE WRRECX
F3F4 0202 00A8 LI R2,WRCMD
F3F8 2DA0 F3FE CALL @RDWRT
WRRECX ;BLWP @SETTIMER
F3FC 2DC0 RET
;
; SECTOR TRANSLATE (NOT NEEDED ANYMORE MAY 2010)
; SO JUST RETURN
;
;SECTRAN RET ;NOT NEEDED WITH IBM FORMATS
; ANDI R3,000FH
; DEC R3 ; 0 -> 8
; AI R3,SETTBL
; MOVB *R3,R0
; MOV R0,R3
; SRL R3,8
; RET
;SETTBL BYTE 1,4,7,2,5,8,3,6,9 ;1,4,7,9,2,5,8,3,6
; EVEN
;
;
;********************************
;
; COMMON READ AND WRITE ROUTINE (RDWRT)
; ENTER WITH
; R4 -> IO BUFFER
; R3 -> SECTOR
; R2 -> COMMAND TYPE
;
; ASSUME THE CORRECT TRACK IS UNDER THE DISK HEAD
;
; TREAT DRQINT AS A PSUEDO DMA CHANNEL
; BY LOADING THE PORT REGISTER(R12) WITH THE
; I/O ADDRESS AND THE TYPE OF OPERATION I.E. READ/WRITE
; THERE IS NO COUNT AS I RELY ON AN INTERRUPT FROM THE
; FDC1797 TO TERMINATE THE TRANSFER.
;
;*********************************
;
F3FE C802 EF06 RDWRT: MOV R2,@CMDTYP ;SAVE READ/WRITE/READID COMMAND
F402 C820 EF0E MOV @MAXRWT,@RWTRY ;SET READ/WRITE RETRY
F406 EF10
F408 C0E0 EF02 RDWRT0: MOV @SECTOR,R3
F40C 020C 8004 LI PORT,SECREG ;FDC SECTOR REGISTER
F410 06C3 SWPB R3
F412 3083 LDCR R3,BYTEWIDE
;
; SET UP PSUEDO DMA CHANNEL
;
F414 04C3 CLR R3 ;INDEX POINTER
F416 0200 8006 LI R0,DATREG ;FDC REG WHERE DATA IS
F41A C800 ED38 MOV R0,@DMAPORT
F41E C820 EEF6 MOV @IOPTR,@DMAADDR ;DMA TRANSFER ADDRESS
F422 ED30
F424 C060 EF06 MOV @CMDTYP,R1
F428 0281 00A8 CI R1,WRCMD ;WRITE COMMAND ?
F42C 1307 JEQ RDWRT1 ;YES
F42E 0281 00F0 CI R1,WTCMD ;WRITE COMMAND ?
F432 1304 JEQ RDWRT1 ;YES
F434 C823 F034 MOV @CMDTBL(R3),@DMACMD ;EXECUTE A READ COMMAND (STCR)
F438 ED32
F43A 1004 JMP RDWRT2
F43C 05C3 RDWRT1: INCT R3
F43E C823 F034 MOV @CMDTBL(R3),@DMACMD ;EXECUTE A WRITE COMMAND (LDCR)
F442 ED32
;
;
;--MERGE SIDE BIT BEFORE COMMAND IS EXECUTED
;
F444 0281 00C0 RDWRT2: CI R1,RIDCMD ;IF ID CMD DON'T NEED TO MERGE
F448 1304 JEQ RDWRT5
F44A C020 EF04 MOV @SIDE,R0 ;GET SIDE BIT
F44E 0A10 SLA R0,1
F450 E040 SOC R0,R1 ;OR IN SIDE BIT INTO COMMAND BYTE
F452 2DA0 F5E6 RDWRT5: CALL @EXCMD
F456 0241 00DF ANDI R1,11011111B ;MASK READY/WRITEPROTECT/RNF/CRC/OVERRUN/DRQ/BUSY
F45A 130C JEQ RDWRT4 ;RETURN IN NO DISK IO ERROR
F45C C801 EF12 DSKERR: MOV R1,@ERRTYP
F460 2DA0 F476 CALL @RECOVER ;DO READ/WRITE ERROR RECOVERY
F464 1603 JNE RDWRT3 ;DON'T RETRY IF UN-RECOVERABLE ERROR
F466 0620 EF10 DEC @RWTRY ;ELSE DECREMENT AND KEEP TRYING UNTIL 0
F46A 16CE JNE RDWRT0
F46C C060 EF12 RDWRT3: MOV @ERRTYP,R1
F470 0460 F614 B @IOERR
F474 2DC0 RDWRT4: RET
;
;***************************************
;
; ATTEMPT TO RECOVER FROM A READ WRITE
; ERROR
;
;****************************************
;
F476 C081 RECOVER MOV R1,R2 ;COPY ERROR CODE TO R2
F478 0242 0087 ANDI R2,10000111B ;ISOLATE READY/OVERRUN/DRQ/BUSY ERRORS
F47C 1305 JEQ RECOV1 ;JUMP IF NONE OF THOSE SET
F47E C081 MOV R1,R2
F480 2DA0 F344 CALL @FORCE ;CLEAR ERROR FLAGS IN 1797
F484 C042 MOV R2,R1
F486 2DC0 RECOV0 RET
;
; ARRIVE HERE IF CRC OR RNF ERROR
;
F488 C081 RECOV1 MOV R1,R2
F48A 0242 0010 ANDI R2,00010000B ;SECTOR ID NOT FOUND
F48E 1304 JEQ STEP
F490 0242 0020 ANDI R2,00100000B ;RNF ERROR
F494 1318 JEQ RECOV3
F496 2DC0 RET ;PROCESS ID NOT FOUND ERROR
;
; ARRIVE HERE ON BAD CRC IN DATA OR ID FIELD
;
F498 8820 EF10 STEP: C @RWTRY,@MAXRWT ;CHECK FOR FIRST TIME
F49C EF0E
F49E 13F3 JEQ RECOV0
F4A0 0201 005C LI R1,SICMD ;STEP BACK AND FORTH
F4A4 2DA0 F5E6 CALL @EXCMD
F4A8 0201 005C LI R1,SICMD ;STEP IN TWO TRACKS THEN BACK
F4AC 2DA0 F5E6 CALL @EXCMD
F4B0 0201 007C LI R1,SOCMD
F4B4 2DA0 F5E6 CALL @EXCMD
F4B8 0201 007C LI R1,SOCMD
F4BC 2DA0 F5E6 CALL @EXCMD
F4C0 2DA0 F4E8 CALL @VERIFY
F4C4 2DC0 RET ;RETURN WITH STATUS IN R1
;
; ARRIVE HERE IF RNF ERROR
;
F4C6 2E20 EF08 RECOV3 PUSH @DSKTYP ;SAVE DENSITY CONTROL BYTE
F4CA 2DA0 F4E8 CALL @VERIFY ;TRACK VERIFY USING READ - ID
F4CE 2E43 POP R3 ;KEEP PREVIOUS DENSITY BYTE HERE
F4D0 1301 JEQ RECOV4 ;RETURN IF NO ID MARK FOUND
F4D2 2DC0 RET
;
F4D4 80E0 EF08 RECOV4 C @DSKTYP,R3 ;SEE IF DENSITY WAS CHANGED BY 'VERIFY'
F4D8 1303 JEQ RECOV5 ;AND EXIT WITH RNF IF NOT
F4DA 04C1 CLR R1
F4DC C041 MOV R1,R1 ;CLEAR R1 TO INDICATE A RETRY SHOULD BE
F4DE 2DC0 RET ;DONE NOW THAT DENSITY IS RIGHT
;
F4E0 0201 0010 RECOV5 LI R1,00010000B ;HEX 0010H
F4E4 C041 MOV R1,R1 ;INDICATE ERROR DUE TO NON-EXISTENT
F4E6 2DC0 RET ; SECTOR OR INDETERMINATE TRACK
;
; VERIFY WE ARE TRACK
;
F4E8 0201 00C0 VERIFY LI R1,RIDCMD
F4EC 2DA0 F5E6 CALL @EXCMD ;READ NEXT ID-MARK TO VERIFY SEEK
F4F0 0241 0099 ANDI R1,10011001B
F4F4 1308 JEQ VERFY2 ;JUMP IF ID MARK READ SUCCESSFULLY
F4F6 2DA0 F56C CALL @FLIPDENS ;ELSE SWITCH DISK DENSITY CONFIGURATION
F4FA 0201 00C0 LI R1,RIDCMD
F4FE 2DA0 F5E6 CALL @EXCMD ;TRY AGAIN
F502 0241 0099 ANDI R1,10011001B
F506 C141 VERFY2 MOV R1,R5 ;SAVE STATUS OF READ-ID COMMAND
F508 2DA0 F344 CALL @FORCE ;CLEAR OVERRUN AND DRQ BITS IN 1797
F50C C045 MOV R5,R1
F50E 1601 JNE VERFY3 ;RETURN IF ID MARK WAS FOUND
F510 2DC0 RET
F512 2DA0 F55A VERFY3 CALL @SETDENS ;ELSE GO BACK TO ORIGINAL DENSITY
F516 C045 MOV R5,R1 ;RETURN WITH ERROR INDICATED
F518 2DC0 RET
;
;********************************
;
;INTIALISE INT.VECTORS ETC
;
;*******************************
;
F51A 2DC0 INTSYS RET
;
;********************************
;
;RESET FDC
;
;********************************
;
F51C 2DC0 RSET RET
;
;
;*******************************************
;
; SET THE TIME OUT TIMER
;
F51E ED40 F522 SETTIMER: WORD INTWP4,SETTIMER+4
F522 020C 0080 LI PORT,0080H
F526 1E14 SBZ 20 ;RESET INTERRUPT
F528 0208 00C8 LI R8,200 ; 200 X 16MS = 7.0SEC
F52C C808 EF1A MOV R8,@TIMEOUT
F530 1E0E SBZ 14
F532 1D0D SBO 13 ;LOAD INTERVAL TIMER ONLY
F534 3220 F53C LDCR @INTLV2,8
F538 1D14 SBO 20 ;ENABLE INTERRUPT
F53A 0380 RTWP
;
F53C FF INTLV2: BYTE 255 ;16.0 MILLISECONDS
F53D 00 EVEN
;
;ALLOW TIME FOR USER TO INSERT DISC (IN FUTURE MAY INCREASE THE TIMEOUT)
;
WAITRDY:
F53E 2DA0 F344 CALL @FORCE
F542 020C 8000 LI PORT,STSREG
F546 0720 EF16 SETO @DRVRDY ;ALLOWS US TO TIMEOUT
;
WAITRDY1:
F54A 3480 STCR R0,BYTEWIDE
F54C 0240 8000 ANDI R0,8000H
F550 1303 JEQ WAITRDY2
;
; WAIT FOR 32uS FOR DRIVE TO BECOME READY
;
F552 0620 EF16 DEC @DRVRDY
F556 16F9 JNE WAITRDY1
WAITRDY2:
F558 2DC0 RET
;
;******************************************
;
; SET DENSITY BIT
;
;******************************************
;
F55A C801 EF08 SETDENS: MOV R1,@DSKTYP
F55E 020C 000A LI PORT,TYPMUX
F562 06C1 SWPB R1
F564 3081 LDCR R1,2 ;OUTPUT CONTROL BITS
F566 04C1 CLR R1
F568 C041 MOV R1,R1
F56A 2DC0 RET
;
;******************************************
;
; FLIP DENSITY BIT
;
;******************************************
;
F56C C801 EF08 FLIPDENS: MOV R1,@DSKTYP
F570 020C 000A LI PORT,TYPMUX
F574 06C1 SWPB R1
F576 3001 LDCR R1,0 ;OUTPUT CONTROL BITS
F578 04C1 CLR R1
F57A C041 MOV R1,R1
F57C 2DC0 RET
;
;;*******************************************
;
; SEEK TO THE TRACK NUMBER HELD IN R3
;
; DRIVE # IS IN DRIVE
;
;********************************************
;
F57E 2DA0 F30A SEEK: CALL @READY ;SEE IF DRIVE IS READY FIRST
F582 162F JNE SEEKX ;ERROR CONDITION IN OPSTAT
F584 04E0 EF04 CLR @SIDE ;ASSUME SIDE 0
F588 0C0A 0003 TCMB R3,0 ;TEST AND CLEAR MSB
F58C 02CF STST ST