-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path+IO_Ports.s
1168 lines (1087 loc) · 29 KB
/
+IO_Ports.s
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
;---------------------------------------------------------------------
; ** ** ** *** *** **** ** *** ** ****
; **** *** *** ** ** ** ** ** **** ** ** ** **
; ** ** ** * ** ** ** *** ***** ** ** *** ** **
; ****** ** ** ** ** ** ** ** ****** ** ** **
; ** ** ** ** ** ** * ** ** ** ** ** * ** ** ** **
; ** ** ** ** *** *** ***** ** ** *** ** ****
;---------------------------------------------------------------------
; Serial / Parallel / Printer extension source code
; By François Lionet
; AMOS, AMOSPro, AMOS Compiler (c) Europress Software 1990-1992
; To be used with AMOSPro V2.0 and over
;---------------------------------------------------------------------
; This file is public domain
;---------------------------------------------------------------------
;
; Please refer to the _Music.s file for more informations...
;
;---------------------------------------------------------------------
ExtNb equ 6-1
; AMIGA's includes
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INCDIR "includes/"
INCLUDE "Exec/Types.I"
INCLUDE "Exec/Exec.I"
INCLUDE "Devices/Serial.I"
INCLUDE "Devices/PrtBase.I"
INCLUDE "Devices/Printer.I"
INCLUDE "Devices/PrtGfx.I"
INCLUDE "Devices/Parallel.I"
;---------------------------------------------------------------------
; Include the files automatically calculated by
; Library_Digest.AMOS
;---------------------------------------------------------------------
Include "+AMOS_Includes.s"
Include "+Version.s"
Include "+IO_Ports_Size.s"
Include "+IO_Ports_Labels.s"
; Number of serial channels allowed
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NSerial equ 4
Dlea MACRO
move.l ExtAdr+ExtNb*16(a5),\2
add.w #\1-DT,\2
ENDM
Dload MACRO
move.l ExtAdr+ExtNb*16(a5),\1
ENDM
Start dc.l C_Tk-C_Off
dc.l C_Lib-C_Tk
dc.l C_Title-C_Lib
dc.l C_End-C_Title
dc.w 0
dc.b "AP20"
;---------------------------------------------------------------------
; Creates the pointers to functions
;---------------------------------------------------------------------
MCInit
C_Off
REPT Lib_Size
MC
ENDR
;---------------------------------------------------------------------
; TOKEN TABLE
;---------------------------------------------------------------------
; TOKEN_START
C_Tk
dc.w 1,0
dc.b $80,-1
dc.w L_InSerialOpen2,L_Nul
dc.b "!serial ope","n"+$80,"I0,0",-2
dc.w L_InSerialOpen5,L_Nul
dc.b $80,"I0,0,0,0,0",-1
dc.w L_InSerialClose0,L_Nul
dc.b "!serial clos","e"+$80,"I",-2
dc.w L_InSerialClose1,L_Nul
dc.b $80,"I0",-1
dc.w L_InSerialSpeed,L_Nul
dc.b "serial spee","d"+$80,"I0,0",-1
dc.w L_Nul,L_FnSerialCheck
dc.b "serial chec","k"+$80,"00",-1
dc.w L_InSerialSend,L_Nul
dc.b "serial sen","d"+$80,"I0,2",-1
dc.w L_InSerialSpeed,L_Nul
dc.b "serial spee","d"+$80,"I0,0",-1
dc.w L_InSerialBits,L_Nul
dc.b "serial bit","s"+$80,"I0,0,0",-1
dc.w L_InSerialX,L_Nul
dc.b "serial ","x"+$80,"I0,0",-1
dc.w L_InSerialBuf,L_Nul
dc.b "serial bu","f"+$80,"I0,0",-1
dc.w L_InSerialParity,L_Nul
dc.b "serial parit","y"+$80,"I0,0",-1
dc.w L_Nul,L_FnSerialGet
dc.b "serial ge","t"+$80,"00",-1
dc.w L_Nul,L_FnSerialInput
dc.b "serial input","$"+$80,"20",-1
dc.w L_InSerialFast,L_Nul
dc.b "serial fas","t"+$80,"I0",-1
dc.w L_InSerialSlow,L_Nul
dc.b "serial slo","w"+$80,"I0",-1
dc.w L_Nul,L_FnSerialError
dc.b "serial erro","r"+$80,"00",-1
dc.w L_InSerialOut,L_Nul
dc.b "serial ou","t"+$80,"I0,0,0",-1
dc.w L_Nul,L_FnSerialStatus
dc.b "serial statu","s"+$80,"00",-1
dc.w L_Nul,L_FnSerialBase
dc.b "serial bas","e"+$80,"00",-1
dc.w L_InSerialAbort,L_Nul
dc.b "serial abor","t"+$80,"I0",-1
; Printer commands
; ~~~~~~~~~~~~~~~~
dc.w L_InPrinterOpen,L_Nul
dc.b "printer ope","n"+$80,"I",-1
dc.w L_InPrinterClose,L_Nul
dc.b "printer clos","e"+$80,"I",-1
dc.w L_InPrinterSend,L_Nul
dc.b "printer sen","d"+$80,"I2",-1
dc.w L_InPrinterOut,L_Nul
dc.b "printer ou","t"+$80,"I0,0",-1
dc.w L_InPrinterDump0,L_Nul
dc.b "!printer dum","p"+$80,"I",-2
dc.w L_InPrinterDump4,L_Nul
dc.b $80,"I0,0t0,0",-2
dc.w L_InPrinterDump7,L_Nul
dc.b $80,"I0,0t0,0,0,0,0",-1
dc.w L_InPrinterAbort,L_Nul
dc.b "printer abor","t"+$80,"I",-1
dc.w L_Nul,L_FnPrinterCheck
dc.b "printer chec","k"+$80,"0",-1
dc.w L_Nul,L_FnPrinterOnline
dc.b "printer onlin","e"+$80,"0",-1
dc.w L_Nul,L_FnPrinterBase
dc.b "printer bas","e"+$80,"0",-1
dc.w L_Nul,L_FnPrinterError
dc.b "printer erro","r"+$80,"0",-1
; Parallel commands
; ~~~~~~~~~~~~~~~~~
dc.w L_InParallelOpen,L_Nul
dc.b "parallel ope","n"+$80,"I",-1
dc.w L_InParallelClose,L_Nul
dc.b "parallel clos","e"+$80,"I",-1
dc.w L_InParallelSend,L_Nul
dc.b "parallel sen","d"+$80,"I2",-1
dc.w L_InParallelOut,L_Nul
dc.b "parallel ou","t"+$80,"I0,0",-1
dc.w L_InParallelAbort,L_Nul
dc.b "parallel abor","t"+$80,"I",-1
dc.w L_Nul,L_FnParallelCheck
dc.b "parallel chec","k"+$80,"0",-1
dc.w L_Nul,L_FnParallelStatus
dc.b "parallel statu","s"+$80,"0",-1
dc.w L_Nul,L_FnParallelBase
dc.b "parallel bas","e"+$80,"0",-1
dc.w L_Nul,L_FnParallelError
dc.b "parallel erro","r"+$80,"0",-1
dc.w L_Nul,L_FnParallelInput1
dc.b "!parallel input","$"+$80,"20",-2
dc.w L_Nul,L_FnParallelInput2
dc.b $80,"20,0",-2
; TOKEN_END
dc.w 0
dc.l 0 Important!
;---------------------------------------------------------------------
Lib_Ini 0
;---------------------------------------------------------------------
C_Lib
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; COLD START
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Def IOCold
; - - - - - - - - - - - - -
cmp.l #"APex",d1 Version 1.10 or over?
bne.s BadVer
movem.l a3-a6,-(sp)
lea DT(pc),a3
move.l a3,ExtAdr+ExtNb*16(a5)
lea SerDef(pc),a0
move.l a0,ExtAdr+ExtNb*16+4(a5)
lea SerEnd(pc),a0
move.l a0,ExtAdr+ExtNb*16+8(a5)
movem.l (sp)+,a3-a6
moveq #ExtNb,d0 * NO ERRORS
move.w #VerNumber,d1 * Current version
rts
; In case this extension is runned on AMOSPro V1.00
BadVer moveq #-1,d0 * Bad version number
sub.l a0,a0
rts
; SCREEN RESET (called by AMOSPro)
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SerDef
; QUIT (called by AMOSPro)
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SerEnd Rbsr L_InSerialClose0
Dlea PrinterIO,a2
Rjsr L_Dev.CloseA2
Dlea ParallelIO,a2
Rjsr L_Dev.CloseA2
rts
*************** Data zone
DT
SerialIO ds.l 3*NSerial Serial IO Port
PrinterIO ds.l 3 Printer IO Port
ParallelIO ds.l 3 Parallel IO Port
BufIn dc.l 0
Prt_Query dc.l 0 Espace pour informations
Prt_Request dc.l 0 Ancien requester
; Screen Dump
; ~~~~~~~~~~~
width: dc.w 0
height: dc.w 0
viewModes dc.w 0
depth: dc.w 0
screen dc.l 0
vPort dc.l 0
rPort dc.l 0
colourmap dc.l 0
oldCtable dc.l 0
special dc.w $84
srcX dc.w 0
srcY dc.w 0
pwidth dc.w 0
pheight dc.w 0
temp1 dc.w 0
temp2 dc.w 0
destCols dc.l 0
destRows dc.l 0
ScreenBase: dc.l 0
; Nom des devices
; ~~~~~~~~~~~~~~~
SerName dc.b "serial.device",0
PrtName dc.b "printer.device",0
ParName dc.b "parallel.device",0
even
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Leave one empty routine here!
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Empty
; - - - - - - - - - - - - -
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; SERIAL OPEN logicnumber,physicnumber[,shared,xdisabled,7wires]
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InSerialOpen2
; - - - - - - - - - - - - -
move.l d3,-(a3)
moveq #0,d3
move.l d3,-(a3)
move.l d3,-(a3)
Rbra L_InSerialOpen5
; - - - - - - - - - - - - -
Lib_Par InSerialOpen5
; - - - - - - - - - - - - -
move.l d3,-(a3)
move.l 16(a3),d0
Rbsr L_GetSerial
; Opening parameters
move.w #IO_SERFLAGS,d5
swap d5
clr.w d5
tst.l (a3)+
beq.s SerOpA
bset #SERB_7WIRE,d5
SerOpA bset #SERB_XDISABLED,d5
tst.l (a3)+
beq.s SerOpB
bclr #SERB_XDISABLED,d5
SerOpB tst.l (a3)+
beq.s SerOpC
bset #SERB_SHARED,d5
SerOpC Dlea SerName,a0
moveq #IOEXTSER_SIZE,d0
move.l (a3),d1
moveq #0,d2
move.w #145,d3
moveq #16,d4
Rjsr L_Dev.Open
move.l (a3)+,d0
addq.l #4,a3
beq.s .PaSet
* If NOT user-serial (#0),
* default settings for French MINITEL: 1200/7/1 Stop/EVEN parity
move.l (a2),a1
move.l #1200,IO_BAUD(a1)
move.b #7,IO_READLEN(a1)
move.b #7,IO_WRITELEN(a1)
move.b #1,IO_STOPBITS(a1)
bset #SERB_XDISABLED,IO_SERFLAGS(a1)
bset #SERB_PARTY_ON,IO_SERFLAGS(a1)
bclr #SERB_PARTY_ODD,IO_SERFLAGS(a1)
bclr #SEXTB_MSPON,IO_EXTFLAGS+3(a1)
bclr #SEXTB_MARK,IO_EXTFLAGS+3(a1)
* Call the device at least once
.PaSet move.l (a2),a1
Rbra L_Stpar
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Serclose [N]
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InSerialClose1
; - - - - - - - - - - - - -
move.l d3,d0
Rbsr L_GetSerial
Rjmp L_Dev.CloseA2
; - - - - - - - - - - - - -
Lib_Par InSerialClose0
; - - - - - - - - - - - - -
Dlea SerialIO,a2
moveq #NSerial-1,d2
.Loop Rjsr L_Dev.CloseA2
lea 12(a2),a2
dbra d2,.Loop
rts
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Serial Send ser,A$
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InSerialSend
; - - - - - - - - - - - - -
move.l d3,d2
move.l (a3)+,d0
Rbsr L_GetSerA1
move.l d2,a0
moveq #0,d0
move.w (a0)+,d0
Rbeq L_IOFonc
move.l d0,IO_LENGTH(a1)
move.l a0,IO_DATA(a1)
moveq #CMD_WRITE,d0
Rjmp L_Dev.SendIO
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Serial Out ser,address,length
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InSerialOut
; - - - - - - - - - - - - -
move.l d3,d2
Rbmi L_IOFonc
Rbeq L_IOFonc
move.l (a3)+,d1
move.l (a3)+,d0
Rbsr L_GetSerA1
move.l d1,IO_DATA(a1)
move.l d2,IO_LENGTH(a1)
moveq #CMD_WRITE,d0
Rjmp L_Dev.SendIO
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; =Serial Get(ser)
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par FnSerialGet
; - - - - - - - - - - - - -
move.l d3,d0
Rbsr L_GetSerA1
move.w #SDCMD_QUERY,d0
Rjsr L_Dev.DoIO
moveq #-1,d3
move.l IO_ACTUAL(a1),d0
beq.s .SerINo
Dlea BufIn,a0
move.l a0,IO_DATA(a1)
move.l #1,IO_LENGTH(a1)
moveq #CMD_READ,d0
Rjsr L_Dev.DoIO
moveq #0,d3
Dlea BufIn,a0
move.b (a0),d3
.SerINo Ret_Int
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; =Serial Input$(Ser)
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par FnSerialInput
; - - - - - - - - - - - - -
move.l d3,d0
Rbsr L_GetSerA1
moveq #SDCMD_QUERY,d0
Rjsr L_Dev.DoIO
move.l IO_ACTUAL(a1),d4
beq.s .No
cmp.l #String_Max,d4
Rbcc L_IOFonc
* Ask for string space...
movem.l a1/a2,-(sp)
move.l d4,d3
and.w #$FFFE,d3 * Only EVEN!
addq.w #2,d3
Rjsr L_Demande
lea 2(a1,d3.w),a1
move.l a1,HiChaine(a5)
* Send to device...
movem.l (sp)+,a1/a2
move.l a0,d3
move.w d4,(a0)+
move.l a0,IO_DATA(a1)
move.l d4,IO_LENGTH(a1)
moveq #CMD_READ,d0
Rjsr L_Dev.DoIO
bra.s .Out
* Nothing to return
.No move.l ChVide(a5),d3 * Empty string
.Out Ret_String
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Serial Speed ser,baud
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InSerialSpeed
; - - - - - - - - - - - - -
move.l d3,d1
move.l (a3)+,d0
Rbsr L_GetSerA1
move.l d1,IO_BAUD(a1)
Rbra L_Stpar
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Serial Bit ser,number,stop
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InSerialBits
; - - - - - - - - - - - - -
move.l d3,d2
move.l (a3)+,d1
move.l (a3)+,d0
Rbsr L_GetSerA1
move.b d1,IO_READLEN(a1)
move.b d1,IO_WRITELEN(a1)
move.b d2,IO_STOPBITS(a1)
Rbra L_Stpar
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Serial Parity ser,on/off/odd/even/mspon
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InSerialParity
; - - - - - - - - - - - - -
move.l d3,d1
move.l (a3)+,d0
Rbsr L_GetSerA1
bclr #SERB_PARTY_ON,IO_SERFLAGS(a1)
bclr #SERB_PARTY_ODD,IO_SERFLAGS(a1)
bclr #SEXTB_MSPON,IO_EXTFLAGS+3(a1)
bclr #SEXTB_MARK,IO_EXTFLAGS+3(a1)
; -1-> NO PARITY
tst.w d1
bmi.s .parX
; 0--> EVEN
bne.s .par1
bset #SERB_PARTY_ON,IO_SERFLAGS(a1)
bra.s .parX
; 1--> ODD
.par1 cmp.w #1,d1
bne.s .par2
bset #SERB_PARTY_ON,IO_SERFLAGS(a1)
bset #SERB_PARTY_ODD,IO_SERFLAGS(a1)
bra.s .parX
; 2--> SPACE
.par2 cmp.w #2,d1
bne.s .par3
bset #SEXTB_MSPON,IO_EXTFLAGS+3(a1)
bra.s .parX
; 3--> MARK
.par3 cmp.w #3,d1
bne.s .parX
bset #SEXTB_MSPON,IO_EXTFLAGS+3(a1)
bset #SEXTB_MARK,IO_EXTFLAGS+3(a1)
; Envoie
.parX Rbra L_Stpar
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Serial X ser,value
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InSerialX
; - - - - - - - - - - - - -
move.l d3,d1
move.l (a3)+,d0
Rbsr L_GetSerA1
bset #SERB_XDISABLED,IO_SERFLAGS(a1)
cmp.l #-1,d1
Rbeq L_Stpar
bclr #SERB_XDISABLED,IO_SERFLAGS(a1)
move.l d1,IO_CTLCHAR(a1)
Rbra L_Stpar
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Serial Buf ser,length
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InSerialBuf
; - - - - - - - - - - - - -
move.l d3,d1
move.l (a3)+,d0
Rbsr L_GetSerA1
move.l d1,IO_RBUFLEN(a1)
Rbra L_Stpar
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Serial Fast ser
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InSerialFast
; - - - - - - - - - - - - -
move.l d3,d0
Rbsr L_GetSerA1
bclr #SERB_PARTY_ON,IO_SERFLAGS(a1)
bclr #SEXTB_MSPON,IO_EXTFLAGS+3(a1)
bset #SERB_XDISABLED,IO_SERFLAGS(a1)
move.b #8,IO_READLEN(a1)
move.b #8,IO_WRITELEN(a1)
bset #SERB_RAD_BOOGIE,IO_SERFLAGS(a1)
Rbra L_Stpar
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Serial Slow Ser
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InSerialSlow
; - - - - - - - - - - - - -
move.l d3,d0
Rbsr L_GetSerA1
bclr #SERB_RAD_BOOGIE,IO_SERFLAGS(a1)
Rbra L_Stpar
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; =Serial Check(N)
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par FnSerialCheck
; - - - - - - - - - - - - -
move.l d3,d0
Rbsr L_GetSerial
Rjsr L_Dev.CheckIO
move.l d0,d3
beq.s .Out
moveq #-1,d3
.Out Ret_Int
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; =Serial Error(n)
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par FnSerialError
; - - - - - - - - - - - - -
move.l d3,d0
Rbsr L_GetSerA1
moveq #0,d3
move.b IO_ERROR(a1),d3
Ret_Int
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; =Serial Status(n)
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par FnSerialStatus
; - - - - - - - - - - - - -
move.l d3,d0
Rbsr L_GetSerA1
moveq #SDCMD_QUERY,d0
Rjsr L_Dev.DoIO
moveq #0,d3
move.l (a2),a1
move.w IO_STATUS(a1),d3
Ret_Int
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; =SERIAL BASE
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par FnSerialBase
; - - - - - - - - - - - - -
move.l d3,d0
Rbsr L_GetSerA1
move.l a1,d3
Ret_Int
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; SERIAL ABORT channel
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InSerialAbort
; - - - - - - - - - - - - -
move.l d3,d0
Rbsr L_GetSerial
Rjmp L_Dev.AbortIO
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Routines
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Def GetSerA1
; - - - - - - - - - - - - - -----> IO #D0 to A1/a2
Rbsr L_GetSerial
Rjmp L_Dev.GetIO
; - - - - - - - - - - - - -
Lib_Def GetSerial
; - - - - - - - - - - - - - -----> Find IO address > D0
cmp.l #NSerial,d0
Rbcc L_IOFonc
mulu #12,d0
Dlea SerialIO,a2
add.w d0,a2
rts
; - - - - - - - - - - - - -
Lib_Def Stpar
; - - - - - - - - - - - - -
moveq #SDCMD_SETPARAMS,d0
Rjmp L_Dev.DoIO
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; =PRINTER BASE
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par FnPrinterBase
; - - - - - - - - - - - - -
Dlea PrinterIO,a2
Rjsr L_Dev.GetIO
move.l a1,d3
Ret_Int
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; =PRINTER CHECK
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par FnPrinterCheck
; - - - - - - - - - - - - -
Dlea PrinterIO,a2
Rjsr L_Dev.CheckIO
move.l d0,d3
beq.s .Skip
moveq #-1,d3
.Skip Ret_Int
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; PRINTER OPEN
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InPrinterOpen
; - - - - - - - - - - - - -
Rjsr L_PRT_Close Ferme LPRINT
Dlea PrtName,a0
Dlea PrinterIO,a2
moveq #64,d0
moveq #0,d1
moveq #0,d2
move.w #161,d3 Premier message erreurs
moveq #7,d4 7 messages
moveq #0,d5
Rjsr L_Dev.Open
; Ask for printer device task, and forbid its requester...
Dload a2
lea PrtName-DT(a2),a1
move.l a6,-(sp)
move.l $4.w,a6
jsr _LVOFindTask(a6)
move.l (sp)+,a6
tst.l d0
beq.s .Skip
move.l d0,a0
move.l $b8(a0),Prt_Request-DT(a2)
move.l #-1,$b8(a0)
.Skip rts
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; PRINTER CLOSE
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InPrinterClose
; - - - - - - - - - - - - -
Dload a2
; Restore printer.device requester
tst.l Prt_Request-DT(a2)
beq.s .Skip
lea PrtName-DT(a2),a1
move.l a6,-(sp)
move.l $4.w,a6
jsr _LVOFindTask(a6)
move.l (sp)+,a6
tst.l d0
beq.s .Skip
move.l d0,a0
move.l Prt_Request-DT(a2),$b8(a0)
clr.l Prt_Request-DT(a2)
; Close device
.Skip Dlea PrinterIO,a2
Rjmp L_Dev.CloseA2
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; =PRINTER ERROR
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par FnPrinterError
; - - - - - - - - - - - - -
Dlea PrinterIO,a2
Rjsr L_Dev.GetIO
moveq #0,d3
move.b IO_ERROR(a1),d3
Ret_Int
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; PRINTER SEND A$
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InPrinterSend
; - - - - - - - - - - - - -
Dlea PrinterIO,a2
Rjsr L_Dev.GetIO
move.l d3,a0
moveq #0,d0
move.w (a0)+,d0
Rbeq L_IOFonc
move.l d0,IO_LENGTH(a1)
move.l a0,IO_DATA(a1)
moveq #CMD_WRITE,d0
Rjmp L_Dev.SendIO
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; PRINTER OUT ad,lenght
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InPrinterOut
; - - - - - - - - - - - - -
Dlea PrinterIO,a2
Rjsr L_Dev.GetIO
move.l d3,d0
Rbeq L_IOFonc
move.l (a3)+,a0
move.l d0,IO_LENGTH(a1)
move.l a0,IO_DATA(a1)
moveq #PRD_RAWWRITE,d0
Rjmp L_Dev.SendIO
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; PRINTER ABORT
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InPrinterAbort
; - - - - - - - - - - - - -
Dlea PrinterIO,a2
Rjmp L_Dev.AbortIO
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; =PRINTER ONLINE
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par FnPrinterOnline
; - - - - - - - - - - - - -
Dlea PrinterIO,a2
Rjsr L_Dev.GetIO
Dlea Prt_Query,a0
move.l a0,IO_DATA(a1)
moveq #PRD_QUERY,d0
Rjsr L_Dev.DoIO
Dlea Prt_Query,a0
moveq #0,d3
move.l (a2),a1
cmp.l #1,IO_ACTUAL(a1)
bne.s .Skip
btst #0,(a0)
bne.s .Skip
moveq #-1,d3
.Skip Ret_Int
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; PRINTER DUMP [parameters!]
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InPrinterDump0
; - - - - - - - - - - - - -
Dload a2
Rbsr L_GetScr
move.w width-DT(a2),pwidth-DT(a2)
move.w height-DT(a2),pheight-DT(a2)
move.l #0,destCols-DT(a2)
move.l #0,destRows-DT(a2)
move.w #$8c,special-DT(a2) ; ASPECT | FULLROWS | FULLCOLS
Rbra L_Dump
; - - - - - - - - - - - - -
Lib_Par InPrinterDump4
; - - - - - - - - - - - - -
move.l d3,-(a3)
Dload a2
Rbsr L_Dump2a
; Calculate proportional DestX, DestY
clr.l d0
clr.l d1
move.w pwidth-DT(a2),d0
tst.w d0
Rbeq L_IOFonc
move.w width-DT(a2),d1
divu.w d0,d1
tst.w d1
Rbeq L_IOFonc
lea destCols-DT(a2),a0
move.l #$ffff,d0
divu.w d1,d0
move.l d0,(a0)
andi.l #$ffff,(a0)
move.l #$10,d1
move.l (a0),d0
rol.l d1,d0
move.l d0,(a0)
clr.l d0
clr.l d1
move.w pheight-DT(a2),d0
tst.w d0
Rbeq L_IOFonc
move.w height-DT(a2),d1
divu.w d0,d1
tst.w d1
Rbeq L_IOFonc
lea destRows-DT(a2),a0
move.l #$ffff,d0
divu.w d1,d0
move.l d0,(a0)
andi.l #$ffff,(a0)
move.l #$10,d1
move.l (a0),d0
rol.l d1,d0
move.l d0,(a0)
lea special-DT(a2),a0
move.w #$b0,(a0)
Rbra L_Dump
; - - - - - - - - - - - - -
Lib_Par InPrinterDump7
; - - - - - - - - - - - - -
move.l d3,-(a3)
movem.l a4-a6,-(sp)
Dload a2
Rbsr L_Dump3a
Rbra L_Dump
; - - - - - - - - - - - - -
Lib_Def Dump3a
; - - - - - - - - - - - - -
lea special-DT(a2),a0
lea 2(a3),a3
move.w (a3)+,(a0) ; special
lea destRows-DT(a2),a0
move.l (a3)+,(a0) ; destY
lea destCols-DT(a2),a0
move.l (a3)+,(a0) ; destY
Rbra L_Dump2a
; - - - - - - - - - - - - -
Lib_Def Dump2a
; - - - - - - - - - - - - -
lea pheight-DT(a2),a0
lea 2(a3),a3
move.w (a3)+,(a0) ; bottom y
lea pwidth-DT(a2),a0
lea 2(a3),a3
move.w (a3)+,(a0) ; bottom x
lea srcY-DT(a2),a0
lea 2(a3),a3
move.w (a3)+,(a0) ; srcy
lea srcX-DT(a2),a0
lea 2(a3),a3
move.w (a3)+,(a0) ; srcx
Rbsr L_GetScr
; get srcX,Y back
move.w srcX-DT(a2),d0
move.w srcY-DT(a2),d1
; calculate width, height
neg.w d0
neg.w d1
lea pwidth-DT(a2),a0
add.w d0,(a0) ; width = -srcX+bottomX
lea pheight-DT(a2),a0
add.w d1,(a0) ; height = -srcY+bottomY
rts
; - - - - - - - - - - - - -
Lib_Def Dump
; - - - - - - - - - - - - -
; Check the structure
Dlea PrinterIO,a2
Rjsr L_Dev.GetIO
; Initialise colour map
Dload a2
moveq #32,d0
move.l a6,-(sp)
move.l T_GfxBase(a5),a6
jsr -570(a6)
move.l (sp)+,a6
tst.l d0
beq cl5
move.l d0,colourmap-DT(a2)
move.l d0,a0
moveq #0,d0
move.l ScreenBase-DT(a2),a1
lea EcPal(a1),a1
.loop move.w (a1)+,d1
move.w d1,d3
and.w #$f,d3
lsr.w #4,d1
move.w d1,d2
and.w #$f,d2
lsr.w #4,d1
movem.l d0/a0-a1/a6,-(sp)
move.l T_GfxBase(a5),a6
jsr -$276(a6)
movem.l (sp)+,d0/a0-a1/a6
addq.w #1,d0
cmp.w #32,d0
bne.s .loop
; Dump the rast port!!!
move.l PrinterIO-DT(a2),a1 ; IO structure
move.l T_RastPort(a5),32(a1) ; rastPort
move.l colourmap-DT(a2),36(a1) ; colourmap
move.w viewModes-DT(a2),40+2(a1) ; viewmodes
move.w srcX-DT(a2),44(a1) ; srcX
move.w srcY-DT(a2),46(a1) ; srcY
move.w pwidth-DT(a2),48(a1) ; srcWidth
move.w pheight-DT(a2),50(a1) ; srcHeight
move.l destCols-DT(a2),52(a1) ; destCols
move.l destRows-DT(a2),56(a1) ; destRows
move.w special-DT(a2),60(a1) ; special
moveq #11,d0 ; command
Dlea PrinterIO,a2
Rjsr L_Dev.DoIO
move.w d0,-(sp)
Dload a2
; Free colour map
cl8 move.l colourmap-DT(a2),a0
move.l a6,-(sp)
move.l T_GfxBase(a5),a6
jsr -576(a6) ; Free colourmap
move.l (sp)+,a6
cl5
; Return to the user
move.w (sp)+,d0
bne.s .Err
rts
; Error
.Err Rjmp L_Dev.Error
; Return informations about the current screen
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; - - - - - - - - - - - - -
Lib_Def GetScr
; - - - - - - - - - - - - -
move.l ScOnAd(a5),d0
beq.s .Err ; get the address of the screen
move.l d0,a0
move.l a0,ScreenBase-DT(a2)
; Now we need to extract all the information about the screen
move.w EcTx(a0),width-DT(a2) ; width
move.w EcTy(a0),height-DT(a2) ; height
move.w EcCon0(a0),d0
and.w #%1000100010000100,d0 ; Hires / HAM / DualPF / Halfbrite
move.w d0,viewModes-DT(a2) ; View Modes
move.w EcNPlan(a0),depth-DT(a2) ; depth
rts
.Err moveq #47,d0 ; Screen not opened
Rjmp L_Error
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; =PARALLEL BASE
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par FnParallelBase
; - - - - - - - - - - - - -
Dlea ParallelIO,a2
Rjsr L_Dev.GetIO
move.l a1,d3
Ret_Int
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; =PARALLEL CHECK
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par FnParallelCheck
; - - - - - - - - - - - - -
Dlea ParallelIO,a2
Rjsr L_Dev.CheckIO
move.l d0,d3
beq.s .Skip
moveq #-1,d3
.Skip Ret_Int
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; PARALLEL OPEN
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par InParallelOpen
; - - - - - - - - - - - - -
Rjsr L_PRT_Close
Dlea ParName,a0
Dlea ParallelIO,a2
moveq #62,d0
moveq #0,d1