/
interpro.cpp
1746 lines (1428 loc) · 64.9 KB
/
interpro.cpp
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
// license:BSD-3-Clause
// copyright-holders:Patrick Mackinlay
/*
* An emulation of the Intergraph InterPro/InterServe family of CLIPPER based
* UNIX workstations.
*
* The first systems were built using the original C100 CLIPPER CPU, and used
* an additional Intel 80186 as an I/O processor, later upgraded to a C300 and
* 80386 IOP. Around 1990, the CLIPPER became fast enough to obviate the need
* for the separate I/O processor, and systems from that point used the main
* CPU for both compute and I/O, along with some custom ASICs.
*
* Over the lifespan of the InterPro, there were five distinct families of
* systems, varying mainly in terms of the primary CPU, as follows:
*
* Year Family Models CPU
* 1986 amethyst 32C/100/200 C100 (80186 IOP)
* 300 C100 (80386 IOP)
* 1988 topaz 3000/4000/5000 C300/C300Plus (80386 IOP)
* 1990 emerald 6000/6100/6200/6500 C300/C300Plus
* 1990 turquoise 2000 C300
* 1991 emerald 6600 C4?
* 1992 sapphire 2400/6400 C4T
* 1993 sapphire 2500/2700/6700/6800 C4I
* 1994 sapphire 2800 C4I
*
* Individual models and some of their specific attributes include:
*
* Model Year CPU Performance Clock Family Bus
* 6000 1990 C300 10 MIPS 40MHz emerald SRX
* 1991 12 MIPS
* 6100 1990 C300+? 14 MIPS emerald IOI, 12-slot
1991 15.5 MIPS
* 6500 1990 C300+ 20 MIPS emerald IOI, QWIC bus?, 12-slot
* 6200 1990 C300+ 14 MIPS 60MHz emerald
* 1991 18 MIPS
* 2000 1990 C300 12.5 MIPS 50MHz? turquoise CBUS
* 1991 16 MIPS
* 6600 1991 C400 40 MIPS emerald IOI, SRX bus?
* 2400 1992 C4T 36 MIPS/33 SPECmarks 40MHz? sapphire CBUS
* 6400 1992 C4T 36 MIPS/33 SPECmarks 40MHz sapphire SRX
* 2700 1993 C400I 61 MIPS?/40.1 SPECmark89 sapphire 2 CBUS
* 6700 1993 C400I 61 MIPS?/40.1 SPECmark89 sapphire 2 SRX
* 6800 1993 C400I 85 MIPS/67.2 SPECmark89 sapphire 3 SRX
* 2500 1993 C400I 19.9 SPECint92 sapphire
* 2800 1994 C400I sapphire 3 CBUS?
*
* IOI == I/O Interface (another type of bus?)
* Sapphire 2 w/CBUS supports RETRY (maybe bus retry?)
*
* With some exceptions, system models are numbered ABCD, where:
*
* A: case type (2=desktop, 6=minicase)
* B: CPU type (0=C300, 4=C4T, 6=C400?, 7/8/5 = C400I)
* C: graphics type (0=none, 2=GT, 3=GT+, 5=GTII, 4=EDGE-1, 8=EDGE-2/2+)
* D: usually 0, 6xxx systems have 5, 7 and 9 options (backplane type?)
*
* Both the desktop and minicase units supported expansion slots with a variety
* of cards, although with different profiles and connectors between 2xxx and
* 6xxx systems. The 2xxx bus is referred to as CBUS, with the 6xxx bus known
* as SRX bus; SR (shared resource) bus is used to refer to either type. The
* bus supported a range of add-in cards, ranging from expanded SCSI and serial
* controllers, to specialised scanning and plotting controllers, a VME bridge,
* and most importantly various single and dual-headed graphics boards.
*
* The InterPro graphics options included the GT range, generally fitted to the
* desktops, and EDGE graphics for the 6xxx systems. Systems with no graphics
* were operated through a serial terminal on serial port 2, and were branded
* InterServe rather than InterPro.
*
* Model Year Performance
* GT 1990? 360k 2D vec/s (in a 2020)
* EDGE-1 8 planes + 1 highlight plane, double buffered (6040)
* EDGE-2 24 bit, 400k 2D vec/s, 350k 3D vec/s (6280)
* GT+ 500k 2D vec/s, 300k 2D vec/s (in a 2430)
* 760k 2D vec/s, 530k 3D vec/s (in a 2730)
* GTII 800k 2D vec/s, 500k 3D vec/s (in a 6450)
* 830k 2D vec/s, 640k 3D vec/s (in a 6750)
* 900k 2D vec/s, 700k 3D vec/s (in a 6850)
* EDGE II+ 600k 2D vec/s, 500k 3D vec/s, 50k shaded poly/s (in a 6480)
*
* GT graphics are also referred to in various places as Memory Mapped Graphics
* or MMG. EDGE stands for Extensible Display Geometry Engine.
*
* This driver currently supports the Emerald, Turquoise and Sapphire systems
* (i.e. 2x00 and 6x00 models), but not all of the variants of the Emerald at
* this point. GT/GTDB or EDGE graphics can be used depending on model, or
* graphics and keyboard uninstalled and a serial terminal used instead.
*
* Key parts lists for the supported models are as follows.
*
* 2000 Turquoise (PCB962 rev A, PCB824 rev J)
*
* Ref Part Function
* U37 Intel 82072 Floppy drive controller
* U39 Intel 82586 Ethernet controller
* U40 Zilog 8530 SCC Keyboard and console serial controller
* U41 Zilog 8530 SCC Serial controller for serial port 0 and 1
* U42 Xilinx XC3020-50 Plotter control FPGA?
* U43 (MPRGM610C) Bitstream for XC3020?
* U54 4.9152 MHz crystal Clock source for 8530s?
* U55 20.0 MHz crystal
* U57 24.0 MHz crystal Clock source for 53C90A?
* U61 NCR 53C90A SCSI controller
* U63 CIDC84607 TC110G75CY-0011 Intergraph I/O gate array?
* U116 Dallas DS1287 RTC and NVRAM
* U137? diagnostic 7-segment LED?
* U171 128 kB EPROM (MPRGM530E) Boot ROM MSB
* U172 128 kB EPROM (MPRGM540E) Boot ROM LSB
*
* 2400 Sapphire (SMT047 rev 0, SMT038?)
*
* Ref Part Function
* U31 Zilog Z85C30 SCC Keyboard and console serial controller
* U32 Zilog Z85230 ESCC Serial controller for serial port 0 and 1
* U34 Xilinx XC3020-50 Plotter control FPGA?
* U35 128 kB EPROM (MPRGW510B) Boot ROM
* U43? (MPRGM610P) Bitstream for XC3020?
* U44 Intel 82596SX-20 Ethernet controller
* U67 Intel N28F010-200 128Kx8 flash memory (Y226 0B03 0592)
* U68 CYID21603 TC150G89AF
* U71 LSI L1A6104 CICD 95801 Intergraph I/O gate array
* U76 Intel N28F010-200 128Kx8 flash memory (Y225 0B?? 27??)
* U81 NCR 53C94 SCSI controller
* U86 24.0 MHz crystal Clock source for 53C94?
* U87 4.9152 MHz crystal Clock source for 8530s?
* U88 20.0 MHz crystal Clock source for 82596?
* U91 Intel N82077AA-1 Floppy drive controller
* U96 32.0 MHz crystal
* U97 40.0 MHz crystal
* U112? (MPRG4230A) node ID prom?
* U113? Dallas DS1287 RTC and NVRAM
* U117? diagnostic 7-segment LED?
* U118? (MPRG X510R)
* U155 CYID21704 TC140G54AF
*
* 2700 Sapphire (SMT128 rev 0, SMT104 rev A)
*
* Ref Part Function
* U31 Zilog Z85C30 SCC Keyboard and console serial controller
* U32 Zilog Z85230 ESCC Serial controller for serial port 0 and 1
* U34 Xilinx XC3020-70 Plotter control FPGA?
* U35 128 kB EPROM (MPRGZ530A) Boot ROM
* U43? (MPRGM610P) Bitstream for XC3020?
* U44 Intel 82596SX-20 Ethernet controller
* U68 CYID21603 TC150G89AF
* U67 Intel N28F010 128Kx8 flash memory (Y226 0C30 4291)
* U71 LSI L1A7374 CICD094A3 Intergraph I/O gate array
* U76 Intel N28F010 128Kx8 flash memory (Y225 0C30 4220)
* U81 NCR 53C94 SCSI controller
* U86 24.0 MHz crystal Clock source for 82077
* U87 4.9152 MHz crystal Clock source for 8530s?
* U88 20.0 MHz crystal Clock source for 82596?
* U91 Intel N82077SL-1 Floppy drive controller
* U96 29.0 MHz crystal
* U97 40.0 MHz crystal
* U112? (MPRGZ260E) node ID prom?
* U113 Dallas DS12887 RTC and NVRAM
* U117? diagnostic 7-segment LED?
* U118? ()
* U155 CYID212?4 TC140G54AF?
*
* 6000 (PCB765 rev B, PCB82409 rev D)
*
* Ref Part Function
* U264 Xilinx XC3020-50 Plotter control FPGA?
* U294 4.9152 MHz crystal
* U287 Z8530H-6JC Serial controller
* U288 Z8530H-6JC Serial controller
* U318 24.0 MHz crystal
* U323 20.0 MHz crystal
* U324 Intel 82586-10 Ethernet controller
* U303 CICD84607 TC110G75CY
* U311 NCR 53C90A SCSI controller
* U336 27C010 (MPRGG360F) 128Kx8 Boot EPROM MSB
* U341 Dallas DS1287 RTC and NVRAM
* U349 27C010 (MPRGG350F) 128Kx8 Boot EPROM LSB
* U347 Intel 82072 Floppy drive controller
*
* 6400 (SMT046 rev B, SMT082)
*
* 6800 Sapphire (SMT127 rev B, SMT104 rev C)
*
* Ref Part Function
* U53 LSI L1A7751 CICD094A3 Intergraph I/O gate array
* U55 Xilinx XC3020-70 Plotter control FPGA?
* U57 CYID21704 TC140G54AF
* U69 CYID21603 TC150G89AF
* U73 20.0 MHz crystal Clock source for 82596?
* U78 29.0 MHz crystal
* U88 4.9152 MHz crystal Clock source for 8530s?
* U94 40.0 MHz crystal
* U95 CICD 89703 TC110G11AT
* U108 24.0 MHz crystal Clock source for 82077
* U117 Intel N28F010 128Kx8 flash memory (Y225 0C40 6010)
* U118 Zilog Z85C30 SCC Keyboard and console serial controller
* U119 Zilog Z85230 ESCC Serial controller for serial port 0 and 1
* U130 Intel N28F010 128Kx8 flash memory (Y226 0C40 6280)
* U136 NCR 53C94 SCSI controller
* U144 27C1024 (MPRGZ530A) 64Kx16 Boot EPROM
* U145 Dallas DS12887 RTC and NVRAM
* U159 Intel 82596SX-20 Ethernet controller
* U164 Intel N82077SL-1? Floppy drive controller
*
* CPU daughter-boards
*
* PCB824 Rev J (MPCBA5507)
* CPCB82409 rev D (MPCB92108) - 6000 C311 + 2xC322 + 80MHz crystal
*
* SMT082 (MSMT0820B, 36MHz?) - 6400 (SMT046 "6400 36-MHz Series System Board")
* SMT03? 2400/6400 - (MSMT03804 -> rev 2 cammu, goes with "6400 36-MHz Series System Board", MSMT0380A eco 3+ use rev 3 cammu)
* SMT019 (MSMT019 C4E CPU Assembly)
* SMT104 Rev A - 2700/6700 (aka MSMT1040A "C4I CPU", C4 CPU REV 3 + C4 FPU REV 3 + C4I CAMMU)
*
* PCB962 2000 System Board MPCB824 C300
* PCB??? 6000 System Board w/?MB MPCB824 C300
* SMT046 6400 36-MHz Series System Board MSMT03804 rev 2 CAMMU/30MHz Kryptonite Rev 3 CAMMU/32MHz Kryptonite Rev 3 CAMMU/MSMT0820B(36MHz)
* SMT047 2400 Series System Board MSMT03804 rev 2 CAMMU/MSMT0380A eco 3+ Rev 3 CAMMU
* SMT098A 6400 32-MHz Sapphire System Board
* SMT098B 6400 32-MHz Sapphire System Board
* SMT127 6700 Series System Board MSMT1040A C4I: C4 CPU Rev 3 + C4 FPU Rev 3 + C4I CAMMU
* SMT128 2700 Series System Board MSMT1040A C4I: C4 CPU Rev 3 + C4 FPU Rev 3 + C4I CAMMU
* SMT144 6800 Series System Board integrated cpu?
* SMT145 2800 Series System Board
*/
#include "emu.h"
#include "cpu/clipper/clipper.h"
#include "machine/cammu.h"
#include "interpro_ioga.h"
#include "interpro_mcga.h"
#include "interpro_sga.h"
#include "interpro_arbga.h"
#include "imagedev/floppy.h"
#include "machine/ram.h"
#include "machine/28fxxx.h"
#include "machine/mc146818.h"
#include "machine/z80scc.h"
#include "machine/upd765.h"
#include "machine/i82586.h"
#include "machine/ncr53c90.h"
#include "machine/nscsi_bus.h"
#include "bus/nscsi/cd.h"
#include "bus/nscsi/hd.h"
#include "bus/rs232/rs232.h"
#include "bus/interpro/sr/sr.h"
#include "bus/interpro/sr/sr_cards.h"
#include "bus/interpro/keyboard/keyboard.h"
#include "bus/interpro/mouse/mouse.h"
#include "softlist.h"
#include "machine/input_merger.h"
#include "debugger.h"
#include "interpro.lh"
#define VERBOSE 0
#include "logmacro.h"
namespace {
class interpro_state : public driver_device
{
public:
interpro_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "cpu")
, m_ram(*this, "ram")
, m_mcga(*this, "mcga")
, m_sga(*this, "sga")
, m_fdc(*this, "fdc")
, m_scc1(*this, "scc1")
, m_scc2(*this, "scc2")
, m_rtc(*this, "rtc")
, m_scsibus(*this, "scsi")
, m_eth(*this, "eth")
, m_ioga(*this, "ioga")
, m_eprom(*this, "eprom")
, m_softlist(*this, "softlist")
, m_diag_led(*this, "digit0")
{
}
required_device<clipper_device> m_maincpu;
required_device<ram_device> m_ram;
required_device<interpro_mcga_device> m_mcga;
required_device<interpro_sga_device> m_sga;
required_device<upd765_family_device> m_fdc;
required_device<z80scc_device> m_scc1;
required_device<z80scc_device> m_scc2;
required_device<mc146818_device> m_rtc;
required_device<nscsi_bus_device> m_scsibus;
required_device<i82586_base_device> m_eth;
required_device<interpro_ioga_device> m_ioga;
required_region_ptr<u16> m_eprom;
required_device<software_list_device> m_softlist;
void init_common();
virtual u32 unmapped_r(address_space &space, offs_t offset);
virtual void unmapped_w(offs_t offset, u32 data);
enum error_mask : u16
{
ERROR_BPID4 = 0x0001,
ERROR_SRXMMBE = 0x0002,
ERROR_SRXHOG = 0x0004,
ERROR_SRXNEM = 0x0008,
ERROR_SRXVALID = 0x0010,
ERROR_CBUSNMI = 0x0020,
ERROR_CBUSBG = 0x00c0,
ERROR_BG = 0x0070,
ERROR_BUSHOG = 0x0080
};
u16 error_r();
void led_w(offs_t offset, u16 data, u16 mem_mask = ~0);
enum status_mask : u16
{
STATUS_YELLOW_ZONE = 0x0001,
STATUS_SRNMI = 0x0002,
STATUS_PWRLOSS = 0x0004,
STATUS_RED_ZONE = 0x0008,
STATUS_BP = 0x00f0
};
u16 status_r() { return m_status; }
virtual u16 ctrl1_r() = 0;
virtual void ctrl1_w(offs_t offset, u16 data, u16 mem_mask = ~0) = 0;
virtual u16 ctrl2_r() = 0;
virtual void ctrl2_w(offs_t offset, u16 data, u16 mem_mask = ~0) = 0;
u8 nodeid_r(address_space &space, offs_t offset);
void ioga(machine_config &config);
void interpro_serial(machine_config &config);
void interpro(machine_config &config);
static void interpro_scsi_adapter(device_t *device);
static void interpro_cdrom(device_t *device);
void interpro_boot_map(address_map &map);
void interpro_common_map(address_map &map);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
output_finder<> m_diag_led;
emu_timer *m_reset_timer = nullptr;
u16 m_error = 0;
u16 m_status = 0;
u16 m_led = 0;
};
class emerald_state : public interpro_state
{
public:
emerald_state(const machine_config &mconfig, device_type type, const char *tag)
: interpro_state(mconfig, type, tag)
, m_d_cammu(*this, "cammu_d")
, m_i_cammu(*this, "cammu_i")
, m_scsi(*this, "scsi:7:host")
, m_bus(*this, "slot")
{
}
void error_w(u8 data) { m_error = data; }
enum ctrl1_mask : u16
{
CTRL1_FLOPLOW = 0x0001, // 3.5" floppy select
CTRL1_FLOPRDY = 0x0002, // floppy ready enable?
CTRL1_LEDENA = 0x0004, // led display enable
CTRL1_LEDDP = 0x0008, // led right decimal point enable
CTRL1_ETHLOOP = 0x0010, // ethernet loopback enable?
CTRL1_ETHDTR = 0x0020, // modem dtr pin enable?
CTRL1_ETHRMOD = 0x0040, // remote modem configured (read)?
CTRL1_CLIPRESET = 0x0040, // hard reset (write)?
CTRL1_FIFOACTIVE = 0x0080 // plotter fifo active?
};
u16 ctrl1_r() override { return m_ctrl1; }
void ctrl1_w(offs_t offset, u16 data, u16 mem_mask = ~0) override;
enum ctrl2_mask : u16
{
CTRL2_PWRUP = 0x0001, // power supply voltage adjust?
CRTL2_PWRENA = 0x0002, // ?
CTRL2_HOLDOFF = 0x0004, // power supply shut down delay
CTRL2_EXTNMIENA = 0x0008, // power nmi enable
CTRL2_COLDSTART = 0x0010, // cold start flag
CTRL2_RESET = 0x0020, // soft reset
CTRL2_BUSENA = 0x0040, // clear bus grant error
CTRL2_FRCPARITY = 0x0080, // ?
CTRL2_WMASK = 0x000f
};
u16 ctrl2_r() override { return m_ctrl2; }
void ctrl2_w(offs_t offset, u16 data, u16 mem_mask = ~0) override;
required_device<cammu_c3_device> m_d_cammu;
required_device<cammu_c3_device> m_i_cammu;
required_device<ncr53c90a_device> m_scsi;
required_device<srx_bus_device> m_bus;
void emerald(machine_config &config);
void ip6000(machine_config &config);
void interpro_82586_map(address_map &map);
void emerald_base_map(address_map &map);
void emerald_main_map(address_map &map);
void emerald_io_map(address_map &map);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
private:
u16 m_ctrl1 = 0;
u16 m_ctrl2 = 0;
};
class turquoise_state : public interpro_state
{
public:
turquoise_state(const machine_config &mconfig, device_type type, const char *tag)
: interpro_state(mconfig, type, tag)
, m_d_cammu(*this, "cammu_d")
, m_i_cammu(*this, "cammu_i")
, m_kbd_port(*this, "kbd")
, m_mse_port(*this, "mse")
, m_scsi(*this, "scsi:7:host")
, m_bus(*this, "slot")
{
}
void error_w(u8 data) { m_error = data; }
enum ctrl1_mask : u16
{
CTRL1_FLOPLOW = 0x0001, // 3.5" floppy select
CTRL1_FLOPRDY = 0x0002, // floppy ready enable?
CTRL1_LEDENA = 0x0004, // led display enable
CTRL1_LEDDP = 0x0008, // led right decimal point enable
CTRL1_ETHLOOP = 0x0010, // ethernet loopback enable?
CTRL1_ETHDTR = 0x0020, // modem dtr pin enable?
CTRL1_ETHRMOD = 0x0040, // remote modem configured (read)?
CTRL1_CLIPRESET = 0x0040, // hard reset (write)?
CTRL1_FIFOACTIVE = 0x0080 // plotter fifo active?
};
u16 ctrl1_r() override { return m_ctrl1; }
void ctrl1_w(offs_t offset, u16 data, u16 mem_mask = ~0) override;
enum ctrl2_mask : u16
{
CTRL2_PWRUP = 0x0001, // power supply voltage adjust?
CRTL2_PWRENA = 0x0002, // ?
CTRL2_HOLDOFF = 0x0004, // power supply shut down delay
CTRL2_EXTNMIENA = 0x0008, // power nmi enable
CTRL2_COLDSTART = 0x0010, // cold start flag
CTRL2_RESET = 0x0020, // soft reset
CTRL2_BUSENA = 0x0040, // clear bus grant error
CTRL2_FRCPARITY = 0x0080, // ?
CTRL2_WMASK = 0x000f
};
u16 ctrl2_r() override { return m_ctrl2; }
void ctrl2_w(offs_t offset, u16 data, u16 mem_mask = ~0) override;
required_device<cammu_c3_device> m_d_cammu;
required_device<cammu_c3_device> m_i_cammu;
required_device<interpro_keyboard_port_device> m_kbd_port;
required_device<interpro_mouse_port_device> m_mse_port;
required_device<ncr53c90a_device> m_scsi;
required_device<cbus_bus_device> m_bus;
void turquoise(machine_config &config);
void ip2000(machine_config &config);
void interpro_82586_map(address_map &map);
void turquoise_base_map(address_map &map);
void turquoise_main_map(address_map &map);
void turquoise_io_map(address_map &map);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
private:
u16 m_ctrl1 = 0;
u16 m_ctrl2 = 0;
};
class sapphire_state : public interpro_state
{
public:
sapphire_state(const machine_config &mconfig, device_type type, const char *tag)
: interpro_state(mconfig, type, tag)
, m_mmu(*this, "cammu")
, m_scsi(*this, "scsi:7:host")
, m_arbga(*this, "arbga")
, m_flash_lsb(*this, "flash_lsb")
, m_flash_msb(*this, "flash_msb")
{
}
virtual u32 unmapped_r(address_space &space, offs_t offset) override;
virtual void unmapped_w(offs_t offset, u32 data) override;
enum ctrl1_mask : u16
{
CTRL1_FLOPLOW = 0x0001, // 3.5" floppy select
// unused
CTRL1_LEDENA = 0x0004, // led display enable
CTRL1_LEDDP = 0x0008, // led right decimal point enable
CTRL1_MMBE = 0x0010, // mmbe enable
CTRL1_ETHDTR = 0x0020, // modem dtr pin enable
CTRL1_ETHRMOD = 0x0040, // 0 = sytem configured for remote modems
CTRL1_FIFOACTIVE = 0x0080 // 0 = plotter fifos reset
};
u16 ctrl1_r() override { return m_ctrl1; }
void ctrl1_w(offs_t offset, u16 data, u16 mem_mask = ~0) override;
enum ctrl2_mask : u16
{
CTRL2_PWRUP = 0x0003, // power supply voltage adjust
CTRL2_HOLDOFF = 0x0004, // power supply shut down delay
CTRL2_EXTNMIENA = 0x0008, // power nmi enable
CTRL2_COLDSTART = 0x0010, // cold start flag
CTRL2_RESET = 0x0020, // soft reset
CTRL2_BUSENA = 0x0040, // clear bus grant error
CTRL2_FLASHEN = 0x0080, // flash eprom write enable
};
u16 ctrl2_r() override { return m_ctrl2; }
void ctrl2_w(offs_t offset, u16 data, u16 mem_mask = ~0) override;
required_device<cammu_c4_device> m_mmu;
required_device<ncr53c94_device> m_scsi;
required_device<interpro_arbga_device> m_arbga;
required_device<intel_28f010_device> m_flash_lsb;
required_device<intel_28f010_device> m_flash_msb;
void sapphire(machine_config &config);
void interpro_82596_map(address_map &map);
void sapphire_base_map(address_map &map);
void sapphire_main_map(address_map &map);
void sapphire_io_map(address_map &map);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
private:
u16 m_ctrl1 = 0;
u16 m_ctrl2 = 0;
};
class cbus_sapphire_state : public sapphire_state
{
public:
cbus_sapphire_state(const machine_config &mconfig, device_type type, const char *tag)
: sapphire_state(mconfig, type, tag)
, m_kbd_port(*this, "kbd")
, m_mse_port(*this, "mse")
, m_bus(*this, "slot")
{
}
void cbus_sapphire(machine_config &config);
void ip2500(machine_config &config);
void ip2400(machine_config &config);
void ip2700(machine_config &config);
void ip2800(machine_config &config);
protected:
required_device<interpro_keyboard_port_device> m_kbd_port;
required_device<interpro_mouse_port_device> m_mse_port;
required_device<cbus_bus_device> m_bus;
};
class srx_sapphire_state : public sapphire_state
{
public:
srx_sapphire_state(const machine_config &mconfig, device_type type, const char *tag)
: sapphire_state(mconfig, type, tag)
, m_bus(*this, "slot")
{
}
void srx_sapphire(machine_config &config);
void ip6400(machine_config &config);
void ip6700(machine_config &config);
void ip6800(machine_config &config);
protected:
required_device<srx_bus_device> m_bus;
};
void interpro_state::machine_start()
{
m_diag_led.resolve();
save_item(NAME(m_error));
save_item(NAME(m_status));
save_item(NAME(m_led));
}
void interpro_state::machine_reset()
{
m_error = 0;
m_status = 0;
m_led = 0;
}
void emerald_state::machine_start()
{
interpro_state::machine_start();
save_item(NAME(m_ctrl1));
save_item(NAME(m_ctrl2));
m_ctrl1 = 0;
// FIXME: disabled for now to avoid cold start diagnostic errors
m_ctrl2 = 0; // CTRL2_COLDSTART
}
void turquoise_state::machine_start()
{
interpro_state::machine_start();
save_item(NAME(m_ctrl1));
save_item(NAME(m_ctrl2));
m_ctrl1 = 0;
// FIXME: disabled for now to avoid cold start diagnostic errors
m_ctrl2 = 0; // CTRL2_COLDSTART
}
void sapphire_state::machine_start()
{
interpro_state::machine_start();
save_item(NAME(m_ctrl1));
save_item(NAME(m_ctrl2));
m_ctrl1 = 0;
// FIXME: disabled for now to avoid cold start diagnostic errors
m_ctrl2 = 0; // CTRL2_COLDSTART
}
void emerald_state::machine_reset()
{
interpro_state::machine_reset();
// deassert floppy ready
m_fdc->ready_w(true);
}
void turquoise_state::machine_reset()
{
interpro_state::machine_reset();
// deassert floppy ready
m_fdc->ready_w(true);
}
void sapphire_state::machine_reset()
{
interpro_state::machine_reset();
// flash rom requires the following
m_status = 0x400;
}
void interpro_state::init_common()
{
// FIXME: not all memory sizes are reported properly using fdm "5 inqhw" and
// "optimum_memory" commands
// 16 = reports 16M, banks empty?
// 32 = reports 16M, banks empty?
// 64 = reports 128M, 16x8
// 128 = reports 128M, 16x8
// 256 = reports 256M, 32x8
// map the configured ram
m_maincpu->space(0).install_ram(0, m_ram->mask(), m_ram->pointer());
}
void interpro_state::led_w(offs_t offset, u16 data, u16 mem_mask)
{
// 7-segment decode patterns (hex digits) borrowed from wico.cpp (mc14495)
static const u8 patterns[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71 };
m_diag_led = patterns[data & 0xf];
COMBINE_DATA(&m_led);
}
void emerald_state::ctrl1_w(offs_t offset, u16 data, u16 mem_mask)
{
LOG("control register 1 data 0x%04x mem_mask 0x%04x (%s)\n", data, mem_mask, machine().describe_context());
// check if led decimal point changes state
if ((data ^ m_ctrl1) & CTRL1_LEDDP)
m_led = (m_led + 0x80) & 0xff;
// FIXME: select 3.5" or 5.25" floppy drive?
//if ((data ^ m_sreg_ctrl1) & CTRL1_FLOPLOW)
// logerror("floplow %d\n", data & CTRL1_FLOPLOW ? 1 : 0);
// FIXME: floppy ready line handling - this is strange but working
if (data & CTRL1_FLOPRDY)
m_fdc->ready_w(!(data & CTRL1_FLOPRDY));
COMBINE_DATA(&m_ctrl1);
}
void turquoise_state::ctrl1_w(offs_t offset, u16 data, u16 mem_mask)
{
LOG("control register 1 data 0x%04x mem_mask 0x%04x (%s)\n", data, mem_mask, machine().describe_context());
// check if led decimal point changes state
if ((data ^ m_ctrl1) & CTRL1_LEDDP)
m_led = (m_led + 0x80) & 0xff;
// FIXME: select 3.5" or 5.25" floppy drive?
//if ((data ^ m_sreg_ctrl1) & CTRL1_FLOPLOW)
// logerror("floplow %d\n", data & CTRL1_FLOPLOW ? 1 : 0);
// FIXME: floppy ready line handling - this is strange but working
if (data & CTRL1_FLOPRDY)
m_fdc->ready_w(!(data & CTRL1_FLOPRDY));
COMBINE_DATA(&m_ctrl1);
}
void sapphire_state::ctrl1_w(offs_t offset, u16 data, u16 mem_mask)
{
LOG("control register 1 data 0x%04x mem_mask 0x%04x (%s)\n", data, mem_mask, machine().describe_context());
// check if led decimal point changes state
if ((data ^ m_ctrl1) & CTRL1_LEDDP)
m_led = (m_led + 0x80) & 0xff;
// FIXME: select 3.5" or 5.25" floppy drive?
//if ((data ^ m_ctrl1) & CTRL1_FLOPLOW)
// logerror("floplow %d\n", data & CTRL1_FLOPLOW ? 1 : 0);
COMBINE_DATA(&m_ctrl1);
}
void emerald_state::ctrl2_w(offs_t offset, u16 data, u16 mem_mask)
{
LOG("control register 2 data 0x%04x mem_mask 0x%04x (%s)\n", data, mem_mask, machine().describe_context());
if (data & CTRL2_RESET)
{
m_ctrl2 &= ~CTRL2_COLDSTART;
machine().schedule_soft_reset();
}
else
m_ctrl2 = (m_ctrl2 & ~CTRL2_WMASK) | (data & CTRL2_WMASK);
}
void turquoise_state::ctrl2_w(offs_t offset, u16 data, u16 mem_mask)
{
LOG("control register 2 data 0x%04x mem_mask 0x%04x (%s)\n", data, mem_mask, machine().describe_context());
if (data & CTRL2_RESET)
{
m_ctrl2 &= ~CTRL2_COLDSTART;
machine().schedule_soft_reset();
}
else
m_ctrl2 = (m_ctrl2 & ~CTRL2_WMASK) | (data & CTRL2_WMASK);
}
void sapphire_state::ctrl2_w(offs_t offset, u16 data, u16 mem_mask)
{
LOG("control register 2 data 0x%04x mem_mask 0x%04x (%s)\n", data, mem_mask, machine().describe_context());
if (data & CTRL2_RESET)
{
m_ctrl2 &= ~CTRL2_COLDSTART;
machine().schedule_soft_reset();
}
else
m_ctrl2 = (m_ctrl2 & ~0x4d) | (data & 0x4d);
// enable/disable programming power on both flash devices
m_flash_lsb->vpp(data & CTRL2_FLASHEN ? ASSERT_LINE : CLEAR_LINE);
m_flash_msb->vpp(data & CTRL2_FLASHEN ? ASSERT_LINE : CLEAR_LINE);
}
u16 interpro_state::error_r()
{
const u16 result = m_error;
// clear error register on read
if (!machine().side_effects_disabled())
m_error = 0;
return result;
}
u32 interpro_state::unmapped_r(address_space &space, offs_t offset)
{
if (!machine().side_effects_disabled())
{
// flag non-existent memory error in system error register
m_error |= (ERROR_SRXNEM | ERROR_SRXVALID);
// tell ioga to raise a bus error
m_ioga->bus_error(interpro_ioga_device::BINFO_BERR | interpro_ioga_device::BINFO_SNAPOK, offset << 2);
}
return space.unmap();
}
void interpro_state::unmapped_w(offs_t offset, u32 data)
{
if (!machine().side_effects_disabled())
{
// flag non-existent memory error in system error register
m_error |= (ERROR_SRXNEM | ERROR_SRXVALID);
// tell ioga to raise a bus error
m_ioga->bus_error(interpro_ioga_device::BINFO_BERR | interpro_ioga_device::BINFO_SNAPOK, offset << 2);
}
}
u32 sapphire_state::unmapped_r(address_space &space, offs_t offset)
{
// check if non-existent memory errors are enabled
if (!machine().side_effects_disabled())
if (m_arbga->tctrl_r() & interpro_arbga_device::TCTRL_ENNEM)
{
// flag non-existent memory error in system error register
m_error |= (ERROR_SRXNEM | ERROR_SRXVALID);
// tell ioga to raise a bus error
m_ioga->bus_error(interpro_ioga_device::BINFO_BERR | interpro_ioga_device::BINFO_SNAPOK, offset << 2);
}
return space.unmap();
}
void sapphire_state::unmapped_w(offs_t offset, u32 data)
{
// check if non-existent memory errors are enabled
if (m_arbga->tctrl_r() & interpro_arbga_device::TCTRL_ENNEM)
{
// flag non-existent memory error in system error register
m_error |= (ERROR_SRXNEM | ERROR_SRXVALID);
// tell ioga to raise a bus error
m_ioga->bus_error(interpro_ioga_device::BINFO_BERR | interpro_ioga_device::BINFO_SNAPOK, offset << 2);
}
}
u8 interpro_state::nodeid_r(address_space &space, offs_t offset)
{
// FIXME: hard coded node id for now
switch (offset)
{
// read system node id prom (contains last 3 bytes of mac address)
case 0: return 0x12;
case 1: return 0x34;
case 2: return 0x56;
case 3: return 0x9c; // checksum - sum of other bytes
}
return space.unmap();
}
void interpro_state::interpro_common_map(address_map &map)
{
//map(0x00000000, 0xffffffff).rw(FUNC(interpro_state::unmapped_r), FUNC(interpro_state::unmapped_w));
// FIXME: don't know what this range is for
map(0x08000000, 0x08000fff).noprw();
map(0x4f007e00, 0x4f007eff).m(m_sga, FUNC(interpro_sga_device::map));
map(0x7f000100, 0x7f00011f).m(m_fdc, FUNC(upd765_family_device::map)).umask32(0x000000ff);
map(0x7f000300, 0x7f000301).r(FUNC(interpro_state::error_r));
map(0x7f000304, 0x7f000305).rw(FUNC(interpro_state::status_r), FUNC(interpro_state::led_w));
map(0x7f000308, 0x7f000309).rw(FUNC(interpro_state::ctrl1_r), FUNC(interpro_state::ctrl1_w));
map(0x7f00030c, 0x7f00030d).rw(FUNC(interpro_state::ctrl2_r), FUNC(interpro_state::ctrl2_w));
map(0x7f000400, 0x7f00040f).rw(m_scc1, FUNC(z80scc_device::ab_dc_r), FUNC(z80scc_device::ab_dc_w)).umask32(0x000000ff);
map(0x7f000410, 0x7f00041f).rw(m_scc2, FUNC(z80scc_device::ab_dc_r), FUNC(z80scc_device::ab_dc_w)).umask32(0x000000ff);
map(0x7f000500, 0x7f000500).rw(m_rtc, FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w));
map(0x7f000600, 0x7f000600).w(m_rtc, FUNC(mc146818_device::address_w));
// the system board id prom
map(0x7f000700, 0x7f00077f).rom().region("idprom", 0);
map(0x7f0fff00, 0x7f0fffff).m(m_ioga, FUNC(interpro_ioga_device::map));
}
void emerald_state::emerald_base_map(address_map &map)
{
interpro_common_map(map);
map(0x40000000, 0x4000003f).m(m_mcga, FUNC(interpro_mcga_device::map));
// scsi registers have unusual address mapping
map(0x7f000201, 0x7f000201).rw(m_scsi, FUNC(ncr53c90a_device::tcounter_lo_r), FUNC(ncr53c90a_device::tcount_lo_w));
map(0x7f000205, 0x7f000205).rw(m_scsi, FUNC(ncr53c90a_device::tcounter_hi_r), FUNC(ncr53c90a_device::tcount_hi_w));
map(0x7f000209, 0x7f000209).rw(m_scsi, FUNC(ncr53c90a_device::fifo_r), FUNC(ncr53c90a_device::fifo_w));
map(0x7f00020d, 0x7f00020d).rw(m_scsi, FUNC(ncr53c90a_device::command_r), FUNC(ncr53c90a_device::command_w));
map(0x7f000211, 0x7f000211).rw(m_scsi, FUNC(ncr53c90a_device::status_r), FUNC(ncr53c90a_device::bus_id_w));
map(0x7f000215, 0x7f000215).rw(m_scsi, FUNC(ncr53c90a_device::istatus_r), FUNC(ncr53c90a_device::timeout_w));
map(0x7f000219, 0x7f000219).rw(m_scsi, FUNC(ncr53c90a_device::seq_step_r), FUNC(ncr53c90a_device::sync_period_w));
map(0x7f00021d, 0x7f00021d).rw(m_scsi, FUNC(ncr53c90a_device::fifo_flags_r), FUNC(ncr53c90a_device::sync_offset_w));
map(0x7f000221, 0x7f000221).rw(m_scsi, FUNC(ncr53c90a_device::conf_r), FUNC(ncr53c90a_device::conf_w));
map(0x7f000225, 0x7f000225).w(m_scsi, FUNC(ncr53c90a_device::clock_w));
map(0x7f000229, 0x7f000229).w(m_scsi, FUNC(ncr53c90a_device::test_w));
map(0x7f00022d, 0x7f00022d).rw(m_scsi, FUNC(ncr53c90a_device::conf2_r), FUNC(ncr53c90a_device::conf2_w));
map(0x7f000300, 0x7f000300).w(FUNC(emerald_state::error_w));
map(0x7f000600, 0x7f00067f).rom().region("nodeid", 0);
}
void emerald_state::emerald_main_map(address_map &map)
{
//map(0x00000000, 0xffffffff).rw(FUNC(interpro_state::unmapped_r), FUNC(interpro_state::unmapped_w));
emerald_base_map(map);
map(0x00000000, 0x00ffffff).ram().share("ram");
map(0x7f100000, 0x7f13ffff).lr16([this] (offs_t offset) { return m_eprom[offset]; }, "eprom");
}
void turquoise_state::turquoise_base_map(address_map &map)
{
interpro_common_map(map);
map(0x40000000, 0x4000003f).m(m_mcga, FUNC(interpro_mcga_device::map));
// scsi registers have unusual address mapping
map(0x7f000201, 0x7f000201).rw(m_scsi, FUNC(ncr53c90a_device::tcounter_lo_r), FUNC(ncr53c90a_device::tcount_lo_w));
map(0x7f000205, 0x7f000205).rw(m_scsi, FUNC(ncr53c90a_device::tcounter_hi_r), FUNC(ncr53c90a_device::tcount_hi_w));
map(0x7f000209, 0x7f000209).rw(m_scsi, FUNC(ncr53c90a_device::fifo_r), FUNC(ncr53c90a_device::fifo_w));
map(0x7f00020d, 0x7f00020d).rw(m_scsi, FUNC(ncr53c90a_device::command_r), FUNC(ncr53c90a_device::command_w));
map(0x7f000211, 0x7f000211).rw(m_scsi, FUNC(ncr53c90a_device::status_r), FUNC(ncr53c90a_device::bus_id_w));
map(0x7f000215, 0x7f000215).rw(m_scsi, FUNC(ncr53c90a_device::istatus_r), FUNC(ncr53c90a_device::timeout_w));
map(0x7f000219, 0x7f000219).rw(m_scsi, FUNC(ncr53c90a_device::seq_step_r), FUNC(ncr53c90a_device::sync_period_w));
map(0x7f00021d, 0x7f00021d).rw(m_scsi, FUNC(ncr53c90a_device::fifo_flags_r), FUNC(ncr53c90a_device::sync_offset_w));
map(0x7f000221, 0x7f000221).rw(m_scsi, FUNC(ncr53c90a_device::conf_r), FUNC(ncr53c90a_device::conf_w));
map(0x7f000225, 0x7f000225).w(m_scsi, FUNC(ncr53c90a_device::clock_w));
map(0x7f000229, 0x7f000229).w(m_scsi, FUNC(ncr53c90a_device::test_w));
map(0x7f00022d, 0x7f00022d).rw(m_scsi, FUNC(ncr53c90a_device::conf2_r), FUNC(ncr53c90a_device::conf2_w));
map(0x7f000300, 0x7f000300).w(FUNC(turquoise_state::error_w));
map(0x7f000600, 0x7f00067f).rom().region("nodeid", 0);
}
void turquoise_state::turquoise_main_map(address_map &map)
{
//map(0x00000000, 0xffffffff).rw(FUNC(interpro_state::unmapped_r), FUNC(interpro_state::unmapped_w));
turquoise_base_map(map);
map(0x00000000, 0x00ffffff).ram().share("ram");
map(0x7f100000, 0x7f13ffff).lr16([this] (offs_t offset) { return m_eprom[offset]; }, "eprom");
}
void sapphire_state::sapphire_base_map(address_map &map)
{
interpro_common_map(map);
map(0x40000000, 0x4000004f).m(m_mcga, FUNC(interpro_fmcc_device::map));
map(0x7f000200, 0x7f0002ff).m(m_arbga, FUNC(interpro_arbga_device::map));
map(0x7f000600, 0x7f00060f).r(FUNC(sapphire_state::nodeid_r)).umask32(0x000000ff);
// scsi registers have unusual address mapping
map(0x7f001001, 0x7f001001).rw(m_scsi, FUNC(ncr53c94_device::tcounter_lo_r), FUNC(ncr53c94_device::tcount_lo_w));
map(0x7f001101, 0x7f001101).rw(m_scsi, FUNC(ncr53c94_device::tcounter_hi_r), FUNC(ncr53c94_device::tcount_hi_w));
map(0x7f001201, 0x7f001201).rw(m_scsi, FUNC(ncr53c94_device::fifo_r), FUNC(ncr53c94_device::fifo_w));
map(0x7f001301, 0x7f001301).rw(m_scsi, FUNC(ncr53c94_device::command_r), FUNC(ncr53c94_device::command_w));
map(0x7f001401, 0x7f001401).rw(m_scsi, FUNC(ncr53c94_device::status_r), FUNC(ncr53c94_device::bus_id_w));
map(0x7f001501, 0x7f001501).rw(m_scsi, FUNC(ncr53c94_device::istatus_r), FUNC(ncr53c94_device::timeout_w));