-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystem_asm
6648 lines (5969 loc) · 166 KB
/
system_asm
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
* JS - DISASSEMBLY
*
* ---------------------------------------------------------------
* THIS VERSION CONTAINS IN BASIC3_ASM CORRECTIONS THAT HAVE BEEN
* NECESSARY - SORRY I SELDOM USE BASIC, THAT'S WHY I DID NOT NOTICE
* THE BUGS - LOCATION: L08B2A L0932E L08DAA
* ALL CORRECTIONS ARE MARKED WITH !!! CORRECTED
*
* SOME ADDITIONAL COMMENTS HAVE BEEN MADE - YET THERE'S FEW
* OF THEM!!
* I hope that this disassembly is correct - if you find any faults:
* Drop me a line.
* BY INTENSIVE TESTING OF OWN CODE I COULD FIND NO BUG -
* BUT OF COURSE IT'S IMPOSSIBLE TO TEST ANY CONFIGURATION
* THOUGH THERE MIGHT BE SOMEWHERE A WRONG DEFINITION THAT WILL
* BE NOTICED ONLY, IF YOU HAPPEN TO INSERT JUST THERE SOME CODE.
* IN FACT, I'M QUITE SURE THAT NOW EVERYTHING IS WORKING IN ANY
* CONIGURATION IF YOU KEEP IN MIND THAT SOME CODE RETURNS WITH
* MANIPLUATED STACK - SEE ADDER ON MDV-VECTORS: THERE ARE THREE
* POSSIBLE RETURNS SOMETIMES.
* Don't write to me with 'just one question' on details.
* I think the disassembly is enough work.
*
* The disassembly is poorly commented - but those who will be
* working with it, know what they are doing anyhow!
*
* IMPORTANT
*
* The disassembly is for private use only.
* Any commercial usage is N O T allowed.
* QDOS is copyright by SINCLAIR / ARMSTRAD!!!!
*
* Even TONY TEBBY was not allowed to use his QDOS on his
* FUTURA project. He had to rewrite QDOS!
*
* It is evident, that nobody else may use QDOS commercial when even
* he was not entitled to use it.
*
* I was offered to use this disassembly comercial.
* I refused to do so.
*
* Only fools (!!) will try to market any part of this disassembly.
*
* ---------------------------------------------------------------------
* ---------------------------------------------------------------------
* How to use this disassembly
*
* LOOK and learn from it - you own programming technique might profit.
*
* Don't write progs that access direct the ROM.
*
* Use the defined TRAPS and VECTORS.
*
* If you want to change things ½ hope that you know what you are doing
*
* REASSEMBLY ONLY WITH GST MACRO ASSEMBLER POSSIBLE
* Minimum configuration: 256 K memory expansion + diskdrive
*
* USE OPTION -NOLIST OR YOU WILL RUN OUT OF DISKSPACE
*
* ESSENTIAL FOR UNDERSTANDING: ADDER "QL ADVANCED USER GUIDE"
* REFFERENCES TO THIS BOOK IN MY COMMENTS AS ½Adder
* ---------------------------------------------------------------
*
* Please note: all values that I've been redifinig for use as Labels
* have significant names: XL-labels are labels that are defined by
* using an EQU somewhere in the Prog.
* Tr -labels are labels for TRAPS e.g.
* Tr1d03 is label of Trap 1 with d0=3
* Tr3d12 is label of Trap 3 with d0=$12
* labels that start with 'o' have been installed for
* my own use during the disassembly-work
* any critical comments are marked with '!!'
* any doubts - yes there are some - are marked with '?'
*
* SOME comments might be silly - but have been of any value for
* me when I did the disassembly. I don't want to put them out
* you can enjoy them or erase them as you like.
*
* FOR TESTING PURPOSES I'VE ADDED SOME 'NOP' TO PREVENT THAT
* THE GST-MACRO ASSEMBLER PRODUCES SHORTER CODE - MOST NOP's MIGHT
* BE OMITTED - DO IT YOURSELF - But: Control it thoroughfully:
* Especially in BASIC and MDV-routines returns form subroutines
* manipulate the Stack(a7). Changing code could mean that
* the adress for Return was wrong.
*
* YOU WILL FIND INCLUDED EVEN KEYBOARD_ASM FOR MGG VERSION
* THE JM_MDV_ROUTINES MIGHT NEED SOME MODIFICATIONS
* IT'S JUST AN ATTEMPT TO REPLACE THE UNNECESSARY LONG JS-
* ROUTINES.
* BUT: THE JM-ROUTINES MIGHT HAVE A BUG. SO TRY IT WITH
* CAUTION.
* ON TRA_TAB: SINCE I WORK ON MY QL WITH EPROMS AND LOST MY ORIGINAL
* JS-FILE IT MIGHT BE WORTH, ADAPTING THAT PIECE OF BYTES EXACTLY
* TO YOUR PRINTER. AS IT IS, IT WORKS PERFECTLY WELL WITH THE
* BROTHER EP 44 PRINTER IN T/W MODE - AT LEAST WITH THE VERSION THAT
* HAS BEEN DELIVERED IN SWITZERLAND.
*
*
* MY ADRESS:
* WOLFGANG GOELLER
* ROSENSTR. 21
* CH 8105 REGENSDORF
* SWITZERLAND
*
org $00
NOLIST
DC.L $00030000 * RESET supervisor-stack
DC.W $0000
dc.W XL0016A * RESET prog - start
DC.W $0000
DC.W XL0005C * bus error
DC.L $00000028 * adress - error
DC.L $0000002A * ilegal instruction
DC.L $0000002C * divison by zero
DC.L $0000002E * CHK-instruction
DC.L $00000030 * TRAPV
DC.L $00000032 * privilege violation
DC.L $00000034 * trace
o028 BSR.S L00050 * 1010- trap * dc.l $61266124
o02a BSR.S L00050
o02c BSR.S L00050 * 1111- trap * dc.l $61226120
o02e BSR.S L00050
o030 BSR.S L00050
o032 BSR.S L00050
o034 BSR.S L00050
o036 BSR.S L00050
o038 BSR.S L00050
BSR.S L00050
BSR.S L00050
BSR.S L00050
BSR.S L00050
BSR.S L00050
BSR.S L00050
BSR.S L00050
BSR.S L00050
BSR.S L00050
BSR.S L00050
DC.W $0000
L00050 BRA L0013C * Test Interrupt
L00054 SUBI.L #$0000002A,(A7)+ * suppress Backaddr
BNE.S L0005E * erroradress
L0005C ADDQ.W #8,A7 * yes: restore backaddr.
XL0005C EQU L0005C
L0005E RTE
oo60 DC.L L0005E *
oo64 DC.L L0005E * interrupt L1
oo68 DC.L XL00352 * L2
oo6C DC.L L0005E
oo70 DC.L L0005E
oo74 DC.L L0005E
oo78 DC.L L0005E
oo7c DC.L $00000036 * ... L7
oo80 DC.L XLTRAP0
oo84 DC.L XLTRAP1
oo88 DC.L XLTRAP2
oo8C DC.L XLTRAP3
oo90 DC.L XLTRAP4
DC.L $00000038 * vectors for Trap 5 - 15
oo98 DC.L $0000003A
oo9C DC.L $0000003C
ooA0 DC.L $0000003E
ooA4 DC.L $00000040
ooA8 DC.L $00000042
ooAC DC.L $00000044
ooB0 DC.L $00000046
ooB4 DC.L $00000048
L000B8 DC.L $0000004A
DC.L $0000004C
ooC0 DC.W L02FAE * MM.ALCHP
DC.W L0305E * MM.RECHP
ooC4 DC.W L039F2 * UT.WINDW
DC.W L039F6 * UT.CON
ooC8 DC.W L039FC * UT.SCR
DC.W L0395E * UT.ERR0
ooCC DC.W L03968 * UT.ERR
DC.W L03990 * UT.MINT
ooD0 DC.W L039B2 * UT.MTEXT
DC.W L039DC * UT.LINK
ooD4 DC.W L039E2 * UT.UNLNK
DC.W $0000
oD8 DC.W L03104 * MM.ALLOC
DC.W L03162 * MM.LINKFR
oDC DC.W L037F4 * IO.QSET
DC.W L0380A * IO.QTEST
oE0 DC.W L03838 * IO.QIN
DC.W L0385E * IO.QOUT
oE4 DC.W L03888 * IO.QEOF
DC.W L03A9C * UT.CSTR
oE8 DC.W L037CC * IO.SERQ
DC.W L0388C * IO.SERIO
oEC DC.W L0405E * CN.DATE
DC.W L040BE * CN.DAY
oF0 DC.W L03EF6 * CN.FTOD
DC.W L03E54 * CN.ITOD
L000F4 DC.W L03EDC * CN.ITOBB
DC.W L03ED8 * CN.ITOBW
DC.W L03ED4 * CN.ITOBL
DC.W L03EB0 * CN.ITOHB
L000FC DC.W L03EAC * CN.ITOHW
DC.W L03EA8 * CN.ITOHL
o00100 DC.W L03D16 * CN.DTOF
DC.W L03DC2 * CN.DTOI
o104 DC.W L03E34 * CN.BTOIB
DC.W L03E38 * CN.BTOIW
o108 DC.W L03E3C * CN.BTOIL
DC.W L03DD4 * CN.HTOIB
o10c DC.W L03DD8 * CN.HTOIW
DC.W L03DDC * CN.HTOIL
o110 DC.W L06DA6 * BP.INIT
DC.W L061DA * CA.GTINT
DC.W L061DE * CA.GTFP
DC.W L061D6 * CA.GTSTR
DC.W L061E2 * CA.GTLIN
DC.W L04E4E * BV.CHRIX
DC.W L041AC * RI.EXEC
DC.W L041B4 * RI.EXECB
DC.W L072C2 * BP.LET
o00122 DC.W L0372C * IO.DECODE
* from now on: add $4000 to get the correct adress
* refer to Adder ½ vectors 124 ff
o00124 DC.W XL0125C * MD.READ - 525C
DC.W XL011B0 * MD.WRITE - 51B0
DC.W XL01262 * MD.VERIN - 5262
DC.W XL0123A * MD.SECTR - 523A
DC.W XL047D4 * BASIC SYNTAX ANALYSER - 87D4
DC.W XL04B5A * FIRST SYNTAX TABLE - COMMANDS - 8B5A
* next adress is odd!! don't mistrust - it is really odd !!!
DC.W XL04CE7 * SECOND SYNTAX TABLE - EXPRESSIONS - 8CE7
DC.W XL04AB4 * FORMAT PRECOMPILED BASIC LINE - 8AB4
DC.W XL04A4E * ERROR WHEN COMPILING - 8A4E
DC.W XL04E88 * STORE PRECOMPILE LINE - 8E88
DC.W XL03518 * CONVERT PRECOMPILED BASIC TO ASCII - 7518
DC.W XL0490C * INITIALISE BASIC STACKS - 890C
L0013C TST.L $00028050 * Test for redirection
BEQ L00054 * no
MOVE.L A6,-(A7) * a6 on stack
MOVEA.W $0006(A7),A6 *
ADDA.W A6,A6
ADDA.L $00028050,A6 * a6 pointer to redirect-routine
MOVE.L (A6),$0004(A7)
MOVEA.L (A7)+,A6 * restore a6
RTS
Ramerror
L0015C MOVEA.L A3,A5 * endless loop
L0015E MOVE.W D7,(A5)+
CMPA.L #$00028000,A5
BNE.S L0015E
BRA.S L0015C
* start QL init/reset
L0016A MOVEA.L #$00040000,A1 * Ramtest
XL0016A EQU L0016A
MOVEA.L A1,A4
L00172 MOVE.L A4,(A4)
CMPA.L (A4),A4
BNE.S L00184 * till A1 = A4 = ramtop + 1
CMPA.L (A1),A1
BNE.S L00184
ADDA.L #$00010000,A4
BRA.S L00172
L00184 MOVEQ #$00,D0 * first writing value
MOVEQ #-$01,D1 * second value
MOVEQ #-$01,D7 * first colour (white)
L0018A LEA $00020000,A3 * screenmemory
MOVEA.L A3,A5
MOVEA.L D0,A1
LEA $1FE4(A1),A2
SF -$7F9D(A3) * initialise sv.jbmax
L0019C CMPA.L A1,A2
BNE.S L001A2 * test whole memory
MOVEA.L D0,A1
* the ramtes is performed by pokeinig different values in RAM
* and afterwars testing, whether they are still present.
* Sine this is done very fast, only very bad RAM could be detected.
* IBM-compatibles test only for one value
* the questione remains unanswered : what's the use of all this
* shorttime tests. Better: a separate Ram-test prog that tests
* thoroughfully.
* You could as well live without this shorttest.
* The only part of RAM, that should be set to 0 when booting are the
* systemvariables.
*
L001A2 MOVE.L (A1)+,D2
TST.B D7 * second time only with one value
BEQ.S L001C2
MOVE.L D0,(A5) * pokeing
CMP.L (A5),D0 * peeking
BNE.S L0015C * Ramerror
MOVE.L D1,(A5)
CMP.L (A5),D1
BNE.S L0015C * Ramerror
MOVE.L D2,(A5)
CMP.L (A5)+,D2
BNE.S L0015C * Ramerror
CMPA.L A5,A4
BNE.S L0019C
LSL.W #8,D7
BRA.S L0018A
L001C2 CMP.L (A5),D2
BNE.S L0015C * Ramerror
CLR.L (A5)+
CMPA.L A4,A5
BNE.S L0019C
MOVE.L #XL04A74,A1 * Startadress of BASIC
LEA $00028000,A6 * Startadress of sysvars
LEA $0480(A6),A7 * top of supervisor-stack
LEA $00018020,A3 * statusregister of 8049
MOVE.B #$08,$0043(A3) * initialise 8049 to mode 8
SF -$001E(A3)
MOVE.L #$061F0000,(A3) * initialise MDV
MOVE.B #$1F,$0001(A3)
MOVE.B #$01,-$001D(A3)
MOVE.B #$C0,$0035(A6)
JSR L02C50(PC) * stop mdv-motor
MOVE.W #$D254,(A6) * mark start of RAM
MOVE.L A5,$0020(A6) * A5=Ramtop
SUBA.L #$00000000,A5 * !!! this makes hardly a sense
* might be, that there was a change intended to have different
* values for ramtop and base of resident procs
MOVE.L A5,$001C(A6) * base of resident procs
MOVE.L A5,$0014(A6) * base of transient procs
MOVE.L $0020(A6),D0 * !!! look for previous comment !!
* as the ROM is now A5 still is the same as 20(A6) but if value
* of A5 would have been changed this was correct.
SUB.L A6,D0 * ramtop-$28000/64
LSR.L #6,D0
MOVEA.L A7,A3 * A3 = pointer to supervisor stack
LEA $0054(A6),A4 * A4 = SV.BPNT
BSR.S L00250 * initialise table of slave-blocks
LSR.L #1,D0
ADD.L D0,$0054(A6)
LSR.L #2,D0 * D0 now ramtop-$2800/512
ADDI.L #$20,D0
CMPI.W #$01E0,D0 * compare with 480
BLS.S L00246 * if less - use that value
MOVE.W #$01E0,D0 * if more: use only 480 (=$1E0)
L00246 BSR.S L00250 * init job table
MULU #$0003,D0 * initalise table of channels
BSR.S L00250
BRA.S L0025C
L00250 MOVE.L A3,(A4)+ * initialising-routine
MOVE.L A3,(A4)+
ADDA.L D0,A3
MOVE.L A3,(A4)+
ADDQ.W #4,A4
RTS
L0025C MOVE.L A3,D0 * init system variables
SUB.L A6,D0
LSR.L #6,D0
MOVEA.L D0,A4
ADDA.L A7,A4
MOVEA.L $005C(A6),A3 * A3 = pointer to top of slave-blocks
MOVE.W #$0200,D1 * !!! the shortform of this two commands:
LSR.W #6,D1 * !!! MOVE.W #8,D1 - since I don't know
* another part in ROM calling this routine MOVEQ #8,D1 was better
SUBA.W D1,A3 * !!! best: SUBQ.W #8,A3 / A3 = SV.BTPNT
MOVEQ #$01,D0
L00274 MOVE.B D0,(A4) * PLACE 0100 0000 0000 0000 in all
ADDQ.W #8,A4 * slaveblock tables
CMPA.L A3,A4
BLT.S L00274
MOVEA.L $0068(A6),A4 * SV.JBBAS base of Job table
MOVEA.L $007C(A6),A3 * SV.JBTOP
MOVEQ #-$01,D0
L00286 MOVE.B D0,(A4) * place FF00 0000 0000 0000 in all
ADDQ.W #4,A4 * job and channel tables
CMPA.L A3,A4
BLT.S L00286
MOVE.L A3,$0004(A6) * SV.CHEAP
MOVE.L A3,$000C(A6) * SV.FREE
MOVEA.L $001C(A6),A4 * SV.RESPR
LEA -$0200(A4),A4 * ADRESS IF RAMTOP-512
MOVE.L A4,$0010(A6) * BASE OF BASIC STACK
LEA L02CF8(PC),A5 * start of polled task
MOVE.L A5,$003C(A6) * SV.PLIST
LEA L01202(PC),A5
MOVE.L A5,$0040(A6) * SV.SHLIST
LEA L00AC0(PC),A5 * pointer to device drivers
MOVE.L A5,$0044(A6)
LEA L01230(PC),A5 * !!! pointer to dir drivers must be
MOVE.L A5,$0048(A6) * omitted or changed when removing MDVs !!
ADDQ.B #1,$0037(A6) * network station nr. default 1
ADDQ.B #8,$0034(A6) * mode 8
ADDQ.B #1,$00A0(A6) * ULA TRANSMIT MODE
ADDQ.W #1,$00A8(A6) * SV.TIMVOV baud rate=9600
MOVE.W #$001E,$008C(A6) * autorepeat delay
ADDQ.W #2,$008E(A6) * autorepeat frequency
ADDQ.W #3,$0092(A6) *
MOVE.L $BFE6,$014A(A6) * BOOT-MESS ETC.
MOVE.L $BFE2,$0146(A6) * TRA-TABELLE
MOVEA.L $0068(A6),A4 * SV.JBBAS
MOVE.L A4,$0064(A6) * SV.JBPNT
MOVEA.L $0014(A6),A3 * SV.TRNSP
CLR.L -(A3) * RAMTOP = 0
MOVEA.L $0010(A6),A0 * SV.BASIC
MOVE.L A0,(A4) * ADRESS OF JOB 0: BASIC
MOVE.B #$20,$0013(A0) * jobs priority increment
MOVE.L A3,USP * pointer of userstack=ramtop-4
LEA $0068(A0),A6 * SV.JBBAS
MOVEA.L A3,A5
SUBA.L A6,A5 * a5 = zone for basic
MOVE.W #$0000,SR * now user-mode
JMP (A1) * A1 = XL04A74=BASIC-START
* find init roms, display F1/F2, do basic
LTRAP0 ADDQ.W #2,A7 * discard saved status register
RTS
XLTRAP0 EQU LTRAP0
LTRAP1 BSR.S L00336 * initialise A5 and A6
BRA L00460 * Trap 1 continues
XLTRAP1 EQU LTRAP1
LTRAP2 BSR.S L00336 * initialise A5 and A6
BRA L032A2 * Trap2 continues
XLTRAP2 EQU LTRAP2
LTRAP3 BSR.S L00336 * initialise A5 and A6
BRA L0337C * Trap3 continues
XLTRAP3 EQU LTRAP3
LTRAP4 BSR.S L00336 * initialise A5 and A6
BRA L03432 * Trap4 continues
XLTRAP4 EQU LTRAP4
L00336 SUBQ.W #8,A7 * initialising of A5 and A6 and D0 to Bytes
MOVE.L $0008(A7),-(A7)
MOVEM.L D7/A5-A6,$0004(A7)
MOVEA.L #$00028000,A6
LEA $0004(A7),A5
MOVEQ #$7F,D7
AND.L D7,D0
RTS
L00352 MOVEM.L D7/A5-A6,-(A7) * INTERRUPT 2 handler
XL00352 EQU L00352
MOVEA.L A7,A5
MOVEA.L #$00028000,A6
MOVE.B $00018021,D7
LSR.B #1,D7
BCS L02ABC * gap interrupt
LSR.B #1,D7
BCS L02CCC * interface (8049) interrupt
LSR.B #1,D7
BCS L02CD8 * transmit interrupt
LSR.B #1,D7
BCS L00900 * frame (poll) interrupt
LSR.B #1,D7
BCC.S L003A0
MOVEM.L D0-D6/A0-A4,-(A7) * external interrupt
MOVEQ #$00,D0
MOVEA.L $0038(A6),A0 * polled list
JSR L00A9E(PC) * execute polled tasks
MOVE.B $0035(A6),D7
ORI.B #$10,D7
MOVE.B D7,$00018021
MOVEM.L (A7)+,D0-D6/A0-A4
L003A0 BRA L003B6 * rte
*#: ret from syscall, clear d0
L003A4 MOVEQ #$00,D0 * back from interrupt
*#: ret from syscall
L003A6 BTST #$05,$000C(A7) * was it supervisor-mode?
BNE.S L003B6
TST.W $0030(A6) * time for a scheduler rerun?
BNE L00936
L003B6 MOVEM.L (A7)+,D7/A5-A6
RTE
* returns bas addr. of JOB in A0
*#: D1 jobid(-1)<>A0 base, D1 jobid
L003BC TST.W D1 * test D1 Job's ID
BGE.S L003D8
MOVE.L $0064(A6),D1 * SV.JBPNT
MOVEA.L D1,A0
MOVEA.L (A0),A0 * start adress
SUB.L $0068(A6),D1 * SV.JBBAS
LSR.L #2,D1
SWAP D1
MOVE.W $0010(A0),D1 * TAG for JOB
SWAP D1
L003D6 RTS
L003D8 BSR.S L003E4 * is valid job?
BEQ.S L003D6
MOVEQ #-$02,D0 * invalid job
ADDQ.W #4,A7
BRA.L L003A6 * end of interrupt
* D1= jobid
* returns JOB.BASE in a0, ^Z flag if fails
L003E4 CMP.W $0062(A6),D1 * SV.JBMAX
BHI.S L003D6
MOVEA.W D1,A0
ADDA.W A0,A0
ADDA.W A0,A0
ADDA.L $0068(A6),A0 * SV.JBBAS
TST.B (A0)
BLT.S L003D6
MOVEA.L (A0),A0
SWAP D1
CMP.W $0010(A0),D1 * TAG for JOB
BNE.S L003D6
SWAP D1
CMP.B D1,D1
RTS
* returns ID of CURRENT JOB in in D0
* base adress in A3
*#: > D0= currjob_id, A3= currjob base
L00408 MOVEA.L $0064(A6),A3 * pointer to current job
MOVE.L A3,D0
SUB.L $0068(A6),D0 * SV.JBBAS
LSR.W #2,D0
MOVEA.L (A3),A3
SWAP D0
MOVE.W $0010(A3),D0
SWAP D0
RTS
* initialise transmission through 8049
L00420 MOVE.B D0,-(A7)
L00422 SUBQ.W #1,$00A6(A6) * timeout for switching
BLT.S L00432
MOVE.W #$208B,D0
L0042C DBF D0,L0042C
BRA.S L00422
L00432 CLR.W $00A6(A6) * reset timeout
ANDI.B #$E7,$00A0(A6)
MOVE.B (A7)+,D0
OR.B D0,$00A0(A6)
ANDI.B #$7F,$0035(A6)
L00448 MOVE.B $00A0(A6),$00018002
RTS
* stop transmission through 8049
L00452 BCLR #$04,$00A0(A6)
ORI.B #$80,$0035(A6)
BRA.S L00448
* trap 1 jump according to D0
L00460 CMPI.W #$0024,D0
BHI.S L004BC
MOVE.W D0,D7
ADD.W D7,D7
MOVE.W L00472(PC,D7.W),D7
JMP ADUMMY(PC,D7.W)
L00472
ADUMMY EQU L00472-$12
DC.W XLtr1d00-L00460
DC.W XLtr1d01-L00460
DC.W XLtr1d02-L00460
o78 DC.W XLtr1d03-L00460
DC.W XLtr1d04-L00460
o7c DC.W XLtr1d05-L00460
o7e DC.W XLtr1d06-L00460
o80 DC.W XLtr1d07-L00460
DC.W XLtr1d08-L00460
DC.W XLtr1d09-L00460
DC.W XLtr1d0a-L00460
DC.W XLtr1d0b-L00460
o8A DC.W XLtr1d0c-L00460
DC.W XLtr1d0d-L00460
DC.W XLtr1d0e-L00460
o90 DC.W XLtr1d0f-L00460
DC.W XLtr1d10-L00460
DC.W XLtr1d11-L00460
DC.W XLtr1d12-L00460
DC.W XLtr1d13-L00460
DC.W XLtr1d14-L00460
DC.W XLtr1d15-L00460
oA0 DC.W XLtr1d16-L00460
DC.W XLtr1d17-L00460
DC.W XLtr1d18-L00460
DC.W XLtr1d19-L00460
DC.W XLtr1d1a-L00460
DC.W XLtr1d1b-L00460
DC.W XLtr1d1c-L00460
DC.W XLtr1d1d-L00460
DC.W XLtr1d1e-L00460
DC.W XLtr1d1f-L00460
DC.W XLtr1d20-L00460
DC.W XLtr1d21-L00460
DC.W XLtr1d22-L00460
DC.W XLtr1d23-L00460
DC.W XLtr1d24-L00460
* If D0=3 or >$25 bad parameter
TR1d03
L004BC MOVEQ #-$0F,D0
BRA L003A6
XLtr1d03 EQU TR1d03
* Info on QDOS
TR1d00
XLtr1d00 EQU TR1d00
o4C2 MOVEQ #-$01,D1 * sets Job-ID
JSR L003BC(PC) *
MOVE.L $BFF6,D2 * D2 = Nr. of version
MOVEA.L A6,A0
BRA L003A4
* Install new table of error messages or tra table
* D2 = adress of error messages or 0
* D1 = adress of tra-table or 0,1
TR1d24
XLtr1d24 EQU TR1d24
o4D4 TST.L D2
L004D6 BEQ.S L004EA * no new message table
BTST #$00,D2 * test odd adress
BNE.S L0051E * bad parameter
MOVEA.L D2,A0
CMPI.W #$4AFB,(A0) * starts with identifier
BNE.S L0051E * errorend
MOVE.L A0,$014A(A6) * set new adress
L004EA CLR.B $0144(A6) *
TST.L D1 * new tra-table ?
BEQ.S L00518 * no: end
CMPI.L #$0001,D1 * is it TRA 1
BNE.S L00500 * take adress from BFE2
MOVE.L $BFE2,D1 * ADRESSE VON TRA-TABELLE
L00500 BTST #$00,D1 * odd adress?
BNE.S L0051E
MOVEA.L D1,A0
CMPI.W #$4AFB,(A0) * starts with identifier
BNE.S L0051E * errorend
MOVE.B #$01,$0144(A6) * set
MOVE.L A0,$0146(A6)
L00518 MOVEQ #$00,D0
BRA L003A6
L0051E MOVEQ #-$0F,D0 * bad parameter
BRA L003A6
* info on JOB
TR1d02
XLtr1d02 EQU TR1d02
o524 JSR L003BC(PC) * returns in d1 JOB-ID in a0 addr
MOVEQ #$00,D3
TST.W $0014(A0) * JOB status
BEQ.S L00532
MOVEQ #-$01,D3
L00532 MOVE.B $0013(A0),D3 * jobs priority increment
MOVE.L D2,D0
MOVE.L A0,-(A7)
JSR L006C6(PC)
MOVEA.L (A7)+,A0
MOVE.L $0008(A0),D2 * owner of job
LEA $0068(A0),A0 * prog-start of job
BRA L003A4
* create new job
* mt.cjob
TR1d01
XLtr1d01 EQU TR1d01
o54C TST.L D1 * identifier<>0
BEQ.S L00554
JSR L003BC(PC) * get a0 base
L00554 MOVEM.L D1-D3/A1-A4,-(A7)
MOVEQ #$00,D7
MOVEA.L $0068(A6),A4 * SV.JBBAS
L0055E TST.B (A4) * free entry ?
BLT.S L00570 * initalise
ADDQ.W #1,D7
ADDQ.W #4,A4 * next job
CMPA.L $006C(A6),A4 * too far
BLT.S L0055E * no - continue testing
MOVEQ #-$02,D0 * invalid job
BRA.S L005E0
* activate job
L00570 MOVEQ #$68,D1
ADD.L D2,D1 * add size of jobs descriptor to length
ADD.L D3,D1
JSR L02FFA(PC) * reserve d1 Bytes
BNE.S L005E0
MOVEM.L (A7),D1-D3/A1
MOVE.L A0,(A4)
* !!! from now on D1-D3,A0-A4 COULD BE USED without problems - see
* end of routine - but only A0 is used !!!
CMP.W $0062(A6),D7 * jobnr < highest jobnr?
BLS.S L0058C * old job
MOVE.W D7,$0062(A6) * new job
L0058C ADDQ.W #4,A0 * a0=jobbas+4
MOVEQ #$18,D0 * set job descriptor to 0
L00590 CLR.L (A0)+
DBF D0,L00590
SUBA.W #$0060,A0 * again start of job
MOVE.L D1,(A0)
ADDQ.W #8,A0
SWAP D7
MOVE.W $0060(A6),D7 * SV.JBTAG current value of job
MOVE.W D7,(A0)
SWAP D7
ADDQ.W #1,$0060(A6) * increment value of SV.JBMAX
MOVE.L $0050(A6),$000C(A0) * pointer to trap redirection table
ADDA.W #$0040,A0
MOVE.L D2,(A0)+ * length of job
ADD.L D2,D3 * + data-aera
MOVE.L D3,(A0)+
MOVEQ #$10,D0
ADD.L A0,D0 * D0 = base of job's prog
MOVE.L D0,(A0)+
ADD.L D0,D3 * d3 = total length
EXG D3,A0
CLR.L -(A0)
EXG D3,A0
MOVE.L D3,(A0)
ADDQ.W #6,A0 * start of prog
MOVE.L A1,D3
BEQ.S L005D4
MOVE.L D3,D0
L005D4 MOVE.L D0,(A0)
MOVE.L D0,-$005E(A0)
LEA $0006(A0),A0 * start of prog-aera
MOVEQ #$00,D0
L005E0 MOVEM.L (A7)+,D1-D3/A1-A4
MOVE.L D7,D1
BRA L003A6
TR1d04
XLtr1d04 EQU TR1d04
o5EA JSR L003BC(PC) * returns bas addr. in A0; ID in D1
MOVE.L D1,D0
L005F0 TST.B $0013(A0) * jobs priority increment
BNE L006C0 * 'not complete'
JSR L006C6(PC) * look for next job
TST.L D1 * same owner?
BNE.S L005F0 * continue
MOVE.L D0,D1 * restore D1 (JOB-ID)
* none active so far, fall through
* mt.frjob
* suspend active job
TR1d05
XLtr1d05 EQU TR1d05
JSR L003BC(PC) * returns bas addr. in A0
MOVE.L D1,D0 * IOB-ID
BEQ L006C0 * BASIC? 'not complete'
MOVEA.W D1,A1
ADDA.W A1,A1
ADDA.W A1,A1
ADDA.L $0068(A6),A1 * find table entry
L00616 ADDQ.B #1,(A1) * mark table entry
JSR L006C6(PC) * find next job in tree
TST.L D1
BNE.S L00616 * ... while any job in tree
SF -(A7) * flag: jobid -1 removed?
MOVEQ #$00,D1 * now scan the marked jobs
MOVEA.L $0068(A6),A1 * SV.JBBAS
L00628 ADDQ.W #4,A1 * next table entry
ADDQ.W #1,D1 * next job nr
CMP.W $0062(A6),D1 * SV.JBMAX
BHI L006B6
TST.B (A1) * marked ?
BLE.S L00628 * no ->
SF (A1) * clear mark
MOVEA.L (A1),A0
SWAP D1
MOVE.W $0010(A0),D1 * TAG for JOB
SWAP D1
CMPA.L $0064(A6),A1 * SV.JBPNT
BNE.S L0064C
ST (A7) * set if removed jobid=-1
L0064C TST.B $0017(A0) * JOB.WFLAG
BEQ.S L00670
MOVE.L $0018(A0),D0 * D0 = ID of waiting JOB
EXG D0,D1
JSR L003E4(PC) * get its base, Z flag
EXG D1,D0
BNE.S L00670 * ... invalid job
CMPI.W #$FFFE,$0014(A0) * is it really waiting ?
BNE.S L00670
CLR.W $0014(A0) * release it
MOVE.L D3,$0020(A0) * JOB.D0 = error code
* now free jobs resources
L00670 MOVEA.L $0004(A6),A0 * base of common heap
L00674 CMP.L $0008(A0),D1 * owner of this ?
BNE.S L0069A
MOVEM.L D1/D3/A0-A1,-(A7)
MOVE.L $000C(A0),D1
BEQ.S L00688
MOVEA.L D1,A1
ST (A1) * set flag on release
L00688 MOVEA.L $0004(A0),A1
LEA -$0018(A1),A3
MOVEA.L $000C(A1),A1 * dev_close
JSR (A1) * close channel or release memory
MOVEM.L (A7)+,D1/D3/A0-A1
L0069A ADDA.L (A0),A0
CMPA.L $000C(A6),A0 * SV.FREE
BLT.S L00674 * try next block
MOVEM.L D1/D3/A1,-(A7)
MOVEA.L (A1),A0
JSR L0308C(PC) * RELEASE headerblock + program space
MOVEM.L (A7)+,D1/D3/A1
ST (A1) * invalidate table entry
BRA L00628 * remove some more jobs
L006B6 TST.B (A7)+
BEQ L003A4 * return
BRA L0093A * must run through scheduler(job -1 removed)
L006C0 MOVEQ #-$01,D0 * 'not complete'
BRA L003A6
* look for ID of next JOB in tree
L006C6 MOVE.L D1,D2 * D2 = owner job
MOVEQ #$00,D1
L006CA ADDQ.W #1,D1
CMP.W $0062(A6),D1 * SV.JBMAX
BGT.S L006E0 * -> try next branch
BSR.S L006EE * get Job base
TST.B (A1) * valid entry?
BLT.S L006CA
CMP.L $0008(A0),D2 * child of JOB ?
BEQ.S L00700
BRA.S L006CA * continue searching
L006E0 CMP.W D2,D0 * setup for next branch
BEQ.S L006FC
MOVE.W D2,D1
BSR.S L006EE
MOVE.L $0008(A0),D2 * owner of JOB
BRA.S L006CA * continue searching
L006EE MOVEA.W D1,A1
ADDA.W A1,A1
ADDA.W A1,A1
ADDA.L $0068(A6),A1 * SV.JBBAS
MOVEA.L (A1),A0 * a0 = base of JOB
RTS
L006FC MOVEQ #$00,D1
RTS
L00700 SWAP D1
MOVE.W $0010(A0),D1 * get job TAG
SWAP D1
RTS
* mt.trapv set for this job the trap vectors
TR1d07
XLtr1d07 EQU TR1d07
o70A JSR L003BC(PC) * returns bas addr. of JOB in A0
SUBA.W #$0054,A1
MOVE.L A1,$0050(A6) * pointer to current trap redir. table
MOVE.L A1,$001C(A0) * ... jobs ...
BRA L003A4
* allocate area in a heap
TR1d0c
XLtr1d0c EQU TR1d0c
o71E ADDA.L $0008(A5),A0 * a0=pointer to pointer to free space
JSR L03104(PC) * MM.ALLOC
SUBA.L $0008(A5),A0 * base of allocated area
BRA.S L007A2
* link free space
TR1d0d
XLtr1d0d EQU TR1d0d
o72C ADDA.L $0008(A5),A0
ADDA.L $0008(A5),A1
JSR L03162(PC) * MM.LINKFR
BRA.S L007A2
* allocate common heap area
TR1d18
XLtr1d18 EQU TR1d18
L0073A EXG D2,D1
JSR L003BC(PC) * returns bas addr. in A0, ID in d1
MOVE.L D1,-(A7)
MOVEQ #$10,D1
ADD.L D2,D1 * d2= number of bytes
JSR L02FAE(PC) * allocate memory
BNE.S L007BC
ADDQ.W #4,A0
L0074E
MOVE.L #XL0075A,(A0)+ * pseudo driver address
MOVE.L (A7)+,(A0)+ * job id
CLR.L (A0)+
BRA.S L00766 * !!! there: BRA L003A4
L0075A DC.L L0305E * address for release of heap
XL0075A EQU L0075A-$0C * that's the value, we need
* release area in common heap
L0075E
TR1d19
XLtr1d19 EQU TR1d19
LEA -$0010(A0),A0 * TAG for JOB
JSR L0305E(PC) * MT.RECHP
L00766 BRA L003A4
* allocation (d0=E) and release (d0=F) of resident proc area
TR1d0e
TR1d0f
XLtr1d0e EQU TR1d0e
XLtr1d0f EQU TR1d0e
L0076A MOVEA.L $001C(A6),A0 * SV.RESPR
CMPA.L $0014(A6),A0 * SV.TRNSP
BNE.S L007A0
CMPI.B #$0F,D0
BEQ.S L00786
TST.L D1
BLE.S L00766
JSR L02FFA(PC) * reserve d1 bytes
BLT.S L007BE
BRA.S L00792
L00786 MOVE.L $0020(A6),D1 * SV.RAMT
SUB.L $001C(A6),D1 * SV.RESPR
JSR L0308C(PC) * RELEASE MEMORY
L00792 MOVE.L $0014(A6),$001C(A6) * SV TRNSP ½ SV.RESPR
CLR.L $0018(A6) * SV.TRNFR
BRA L003A4
L007A0 MOVEQ #-$01,D0 * 'not complete'
L007A2 BRA.S L007BE * !!! Faster: Jump direct - used to save space
* allocate Basic prog aera
TR1d16
XLtr1d16 EQU TR1d16
L007A4 JSR L031B8(PC) * allocate memory
BRA.S L007BE * !!! there: BRA L003A6
* Faster: Jump direct - used to save space
* Release Basic Prog Area
TR1d17
XLtr1d17 EQU TR1d17
MOVE.L $0014(A6),-(A7) * SV TRNSP
SUB.L D1,$0014(A6) * SV TRNSP
JSR L031C8(PC) * Release memory
MOVE.L (A7)+,$0014(A6) * SV TRNSP
BRA.S L007BE * !!! memory saving but time wasting
L007BC ADDQ.W #4,A7
L007BE BRA L003A6
* set or read display mode according to D1 and D2 ½ Adder
TR1d10
XLtr1d10 EQU TR1d10
o7C0 MOVE.B $0034(A6),D0 * SV.MCSTA
TST.B D1 * read?
BLT L0085E * yes
ANDI.B #$F7,D0 * !!! this and next command used for security
ANDI.B #$08,D1 * if calling routine did set word
* 'cause all use moveq... not necessary
OR.B D1,D0
MOVE.B D0,$0034(A6) * set SV.MCSTA
MOVE.B D0,$00018063 * set 8049 according
MOVE.L A6,-(A7) * preserves A6
MOVE.W #$1FFF,D0
L007E6 CLR.L -(A6) * now cls of whole screen
DBF D0,L007E6
MOVEA.L (A7)+,A6
* reinitialisation of screen channels
MOVEA.L $0078(A6),A4 * SV.CHBAS
L007F2 MOVE.L (A4)+,D0
MOVEM.L D1-D6/A0-A6,-(A7)
BLT.S L00852 * channel closed?
MOVEA.L D0,A0
CMPI.L #L00D36,$0004(A0) * is it no screen channel
BNE.S L00852 * look for next channels
MOVE.B D1,-(A7)
MOVE.W $0020(A0),-(A7)
MOVEQ #$00,D2
JSR L01AFC(PC) * set border
LEA $0036(A0),A1 * paper colour masque
LEA $0044(A0),A5 * paper colour byte