/
amiga.cpp
2567 lines (2132 loc) · 89 KB
/
amiga.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:GPL-2.0+
// copyright-holders:Dirk Best
/***************************************************************************
Commodore Amiga
Notes:
- On Kickstart 2.0 onward holding down both port 1 fire buttons
will bring you to the Amiga Early Startup Control Screen.
This gives you several diagnostic options, including booting from
non-DF0 drive, switch video modes and test expansion boards.
***************************************************************************/
#include "emu.h"
#include "amiga.h"
#include "bus/amiga/keyboard/keyboard.h"
#include "bus/amiga/zorro/zorro.h"
#include "bus/ata/ataintf.h"
#include "cpu/m68000/m68000.h"
#include "cpu/m6502/m6502.h"
#include "machine/6525tpi.h"
#include "machine/mos6526.h"
#include "machine/gayle.h"
#include "machine/dmac.h"
#include "machine/pccard.h"
#include "machine/pccard_sram.h"
#include "machine/nvram.h"
#include "machine/i2cmem.h"
#include "machine/amigafdc.h"
#include "machine/cr511b.h"
#include "machine/rp5c01.h"
#include "softlist.h"
#include "speaker.h"
//**************************************************************************
// CONSTANTS / MACROS
//**************************************************************************
#define EXP_SLOT_TAG "exp"
//**************************************************************************
// PRIVATE DEVICES
//**************************************************************************
/*
The keyboard reset/power-on reset circuit for the Amiga 2000 is built
around the LM339 at U805 (top left on sheet 3 of the schematic). To
simplify things, we assume all components are ideal.
In stead idle state:
* /KBCLK is high
* U805 pin 1 is driven low, holding C813 discharged
* U805 pin 2 is not driven, allowing C814 to remain charged
* U805 pin 13 is driven low setting thresholds to 2.0V and 1.0V
* U805 pin 14 is not driven, leaving /KBRST deasserted
When /KBCLK is asserted, C814 is allowed to charge. A short pulse will
not give it sufficient time to charge past the 2.0V threshold on pin 5
and the circuit will remain in idle.
If /KBCLK is asserted for over 112ms:
* U805 pin 1 is not driven, allowing C813 to charge past 2.0V
* U805 pin 2 is driven low, discharging C814
* U805 pin 13 is not driven, raising thresholds to 2.86V and 3.57V
* U805 pin 14 is driven low, asserting /KBRST
The thresholds changing will cause U805 pin 2 to float, allowing C814 to
begin charging. If /KBCLK is asserted for a further 74 milliseconds,
U805 pin 2 will be driven low keeping C814 discharged until /KBCLK is
deasserted.
C814 (22µF) will charge via R805 (47kΩ) until it reaches the 3.57V
threshold, ensuring the minimum length of a reset pulse is 1.294s.
The power-on reset signal is also allowed to discharge C814, but we
ignore this for simplicity. Earlier boards use a 1N4148 signal diode,
while later boards replace it with a PST518B at XU1.
The equivalent circuit in the Amiga 1000 works similarly, but has
different components:
* 10µF/22kΩ (C104/R62) for timing /KBCLK pulse
* 10µF/100kΩ (C105/R63) for minimum /KBRESET pulse duration
* Thresholds of 2.499/2.501V and 2.474V/2.526V
* BAS32L diode for power-on reset
* This gives delays of 152ms, 176µs, and 704ms
The equivalent circuit in the Amiga CDTV has the same thresholds as the
Amiga 2000, but uses 1kΩ resistors for timing. This gives delays of
11.2ms, 7.43ms, and 27.5ms.
*/
DECLARE_DEVICE_TYPE(A1000_KBRESET, a1000_kbreset_device)
class a1000_kbreset_device : public device_t
{
public:
a1000_kbreset_device(machine_config const &config, char const *tag, device_t *owner, u32 clock = 0U) :
device_t(config, A1000_KBRESET, tag, owner, clock),
m_kbrst_cb(*this)
{
}
auto kbrst_cb() { return m_kbrst_cb.bind(); }
a1000_kbreset_device &set_delays(attotime detect, attotime stray, attotime output)
{
m_detect_time = detect;
m_stray_time = stray;
m_output_time = output;
return *this;
}
void kbclk_w(int state)
{
if (bool(state) != bool(m_kbclk))
{
m_kbclk = state ? 1U : 0U;
if (state)
{
// U805 pin 1 driven low - discharges C813
m_c813_level = 0U;
m_c813_timer->reset();
// U805 pin 2 floating - allows C814 to charge
if (!m_c814_charging)
{
m_c814_charging = 1U;
m_c814_timer->adjust(m_output_time); // 0V to 3.57V
}
}
else
{
// U805 pin 1 floating - allows C813 to charge
assert(0U == m_c813_level);
m_c813_timer->adjust(m_detect_time); // 0V to 2V
}
}
}
protected:
virtual void device_start() override
{
// allocate resources
m_c813_timer = timer_alloc(FUNC(a1000_kbreset_device::c813_charged), this);
m_c814_timer = timer_alloc(FUNC(a1000_kbreset_device::c814_charged), this);
// start in idle state
m_kbclk = 1U;
m_kbrst = 1U;
m_c813_level = 0U;
m_c814_charging = 1U;
// always better to save state
save_item(NAME(m_kbclk));
save_item(NAME(m_kbrst));
save_item(NAME(m_c813_level));
save_item(NAME(m_c814_charging));
}
private:
TIMER_CALLBACK_MEMBER(c813_charged)
{
assert(2U > m_c813_level);
if (2U > ++m_c813_level)
m_c813_timer->adjust(m_stray_time); // 2V to 2.86V
if ((m_kbrst ? 0U : 1U) < m_c813_level)
{
// U805 pin 2 driven low - discharges C814
if (2U > m_c813_level)
{
assert(m_c814_charging);
m_c814_timer->adjust(m_output_time); // 0V to 3.57V
}
else
{
m_c814_charging = 0U;
m_c814_timer->reset();
}
if (m_kbrst)
m_kbrst_cb(m_kbrst = 0U);
}
}
TIMER_CALLBACK_MEMBER(c814_charged)
{
// C814 above high threshold - /KBRST deasserted
assert(m_c814_charging);
assert(!m_kbrst);
m_kbrst_cb(m_kbrst = 1U);
// if C813 is between 2.0V and 2.86V, lowering the threshold will discharge C814
assert(2U > m_c813_level);
if (0U < m_c813_level)
{
// threshold is bumped back up
m_kbrst_cb(m_kbrst = 0U);
m_c814_timer->adjust(m_output_time); // 0V to 3.57V
}
}
attotime m_detect_time = attotime::from_msec(112);
attotime m_stray_time = attotime::from_msec(74);
attotime m_output_time = attotime::from_msec(1294);
devcb_write_line m_kbrst_cb;
emu_timer *m_c813_timer = nullptr; // C813 = 22µF, R802 = 10kΩ
emu_timer *m_c814_timer = nullptr; // C814 = 22µF, R805 = 47kΩ
u8 m_kbclk = 1U; // /KBCLK input
u8 m_kbrst = 1U; // /KBRST output
u8 m_c813_level = 0U; // 0 = 0V-2V, 1 = 2V - 2.86V, 2 = 2.86V - 5V
u8 m_c814_charging = 1U; // U805 pin 2
};
DEFINE_DEVICE_TYPE(A1000_KBRESET, a1000_kbreset_device, "a1000kbrst", "Amiga 1000/2000/CDTV keyboard reset circuit")
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class a1000_state : public amiga_state
{
public:
a1000_state(const machine_config &mconfig, device_type type, const char *tag)
: amiga_state(mconfig, type, tag)
, m_bootrom(*this, "bootrom")
, m_wom(*this, "wom")
{ }
void init_pal();
void init_ntsc();
void write_protect_w(u16 data);
void a1000(machine_config &config);
void a1000n(machine_config &config);
void a1000_bootrom_map(address_map &map);
void a1000_mem(address_map &map);
void a1000_overlay_map(address_map &map);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
private:
required_device<address_map_bank_device> m_bootrom;
required_memory_bank m_wom;
std::vector<u16> m_wom_ram;
};
class a2000_state : public amiga_state
{
public:
a2000_state(const machine_config &mconfig, device_type type, const char *tag)
: amiga_state(mconfig, type, tag)
, m_rtc(*this, "u65")
, m_zorro(*this, "zorrobus")
, m_zorro2_int2(0)
, m_zorro2_int6(0)
{ }
void init_pal();
void init_ntsc();
void zorro2_int2_w(int state);
void zorro2_int6_w(int state);
u16 clock_r(offs_t offset);
void clock_w(offs_t offset, u16 data);
void a2000(machine_config &config);
void a2000n(machine_config &config);
void a2000_mem(address_map &map);
protected:
virtual void machine_reset() override;
// amiga_state overrides
virtual bool int2_pending() override;
virtual bool int6_pending() override;
private:
// devices
required_device<msm6242_device> m_rtc;
required_device<zorro2_bus_device> m_zorro;
// internal state
int m_zorro2_int2;
int m_zorro2_int6;
};
class a500_state : public amiga_state
{
public:
a500_state(const machine_config &mconfig, device_type type, const char *tag)
: amiga_state(mconfig, type, tag)
, m_side(*this, EXP_SLOT_TAG)
, m_side_int2(0)
, m_side_int6(0)
{ }
void init_pal();
void init_ntsc();
void side_int2_w(int state);
void side_int6_w(int state);
void a500n(machine_config &config);
void a500(machine_config &config);
void a500_mem(address_map &map);
protected:
virtual void machine_reset() override;
// amiga_state overrides
virtual bool int2_pending() override;
virtual bool int6_pending() override;
private:
// devices
required_device<exp_slot_device> m_side;
// internal state
int m_side_int2;
int m_side_int6;
};
class cdtv_state : public amiga_state
{
public:
cdtv_state(const machine_config &mconfig, device_type type, const char *tag)
: amiga_state(mconfig, type, tag)
, m_rtc(*this, "u61")
, m_dmac(*this, "u36")
, m_tpi(*this, "u32")
, m_cdrom(*this, "cdrom")
, m_dmac_irq(0)
, m_tpi_irq(0)
{ }
void init_pal();
void init_ntsc();
u16 clock_r(offs_t offset);
void clock_w(offs_t offset, u16 data);
uint8_t dmac_scsi_data_read(offs_t offset);
void dmac_scsi_data_write(offs_t offset, uint8_t data);
void dmac_int_w(int state);
void tpi_port_b_write(uint8_t data);
void tpi_int_w(int state);
void cdtv(machine_config &config);
void cdtvn(machine_config &config);
void cdtv_mem(address_map &map);
void cdtv_rc_mem(address_map &map);
protected:
// driver_device overrides
virtual void machine_start() override;
// amiga_state overrides
virtual bool int2_pending() override;
virtual bool int6_pending() override;
private:
// devices
required_device<msm6242_device> m_rtc;
required_device<amiga_dmac_device> m_dmac;
required_device<tpi6525_device> m_tpi;
required_device<cr511b_device> m_cdrom;
// internal state
int m_dmac_irq;
int m_tpi_irq;
};
class a3000_state : public amiga_state
{
public:
a3000_state(const machine_config &mconfig, device_type type, const char *tag)
: amiga_state(mconfig, type, tag)
{ }
u32 scsi_r(offs_t offset, u32 mem_mask = ~0);
void scsi_w(offs_t offset, u32 data, u32 mem_mask = ~0);
u32 motherboard_r(offs_t offset, u32 mem_mask = ~0);
void motherboard_w(offs_t offset, u32 data, u32 mem_mask = ~0);
void init_pal();
void init_ntsc();
void a3000(machine_config &config);
void a3000n(machine_config &config);
void a3000_mem(address_map &map);
protected:
private:
};
class a500p_state : public amiga_state
{
public:
a500p_state(const machine_config &mconfig, device_type type, const char *tag)
: amiga_state(mconfig, type, tag)
, m_rtc(*this, "u9")
, m_side(*this, EXP_SLOT_TAG)
, m_side_int2(0)
, m_side_int6(0)
{ }
u16 clock_r(offs_t offset);
void clock_w(offs_t offset, u16 data);
void init_pal();
void init_ntsc();
void a500pn(machine_config &config);
void a500p(machine_config &config);
void a500p_mem(address_map &map);
protected:
virtual void machine_reset() override;
// amiga_state overrides
virtual bool int2_pending() override;
virtual bool int6_pending() override;
private:
// devices
required_device<msm6242_device> m_rtc;
required_device<exp_slot_device> m_side;
// internal state
int m_side_int2;
int m_side_int6;
};
class a600_state : public amiga_state
{
public:
a600_state(const machine_config &mconfig, device_type type, const char *tag)
: amiga_state(mconfig, type, tag)
, m_gayle(*this, "gayle")
, m_pcmcia(*this, "pcmcia")
, m_gayle_int2(0)
{ }
void gayle_int2_w(int state);
void gayle_int6_w(int state);
void init_pal();
void init_ntsc();
static const u8 GAYLE_ID = 0xd0;
void a600n(machine_config &config);
void a600(machine_config &config);
void a600_mem(address_map &map);
protected:
// amiga_state overrides
virtual bool int2_pending() override;
virtual bool int6_pending() override;
private:
required_device<gayle_device> m_gayle;
required_device<pccard_slot_device> m_pcmcia;
int m_gayle_int2;
int m_gayle_int6;
};
class a1200_state : public amiga_state
{
public:
a1200_state(const machine_config &mconfig, device_type type, const char *tag)
: amiga_state(mconfig, type, tag)
, m_gayle(*this, "gayle")
, m_pcmcia(*this, "pcmcia")
, m_gayle_int2(0)
{ }
void gayle_int2_w(int state);
void gayle_int6_w(int state);
void init_pal();
void init_ntsc();
static const u8 GAYLE_ID = 0xd1;
void a1200(machine_config &config);
void a1200n(machine_config &config);
void a1200_mem(address_map &map);
protected:
// amiga_state overrides
virtual bool int2_pending() override;
virtual bool int6_pending() override;
private:
required_device<gayle_device> m_gayle;
required_device<pccard_slot_device> m_pcmcia;
int m_gayle_int2;
int m_gayle_int6;
};
class a4000_state : public amiga_state
{
public:
a4000_state(const machine_config &mconfig, device_type type, const char *tag)
: amiga_state(mconfig, type, tag)
, m_ata(*this, "ata")
, m_ramsey_config(0)
, m_gary_coldboot(1)
, m_gary_timeout(0)
, m_gary_toenb(0)
, m_ide_interrupt(0)
{ }
u32 scsi_r(offs_t offset, u32 mem_mask = ~0);
void scsi_w(offs_t offset, u32 data, u32 mem_mask = ~0);
u16 ide_r(offs_t offset, u16 mem_mask = ~0);
void ide_w(offs_t offset, u16 data, u16 mem_mask);
void ide_interrupt_w(int state);
u32 motherboard_r(offs_t offset, u32 mem_mask = ~0);
void motherboard_w(offs_t offset, u32 data, u32 mem_mask = ~0);
void init_pal();
void init_ntsc();
void a400030n(machine_config &config);
void a4000tn(machine_config &config);
void a4000t(machine_config &config);
void a4000n(machine_config &config);
void a4000(machine_config &config);
void a400030(machine_config &config);
void a400030_mem(address_map &map);
void a4000_mem(address_map &map);
void a4000t_mem(address_map &map);
protected:
private:
required_device<ata_interface_device> m_ata;
int m_ramsey_config;
int m_gary_coldboot;
int m_gary_timeout;
int m_gary_toenb;
int m_ide_interrupt;
};
class cd32_state : public amiga_state
{
public:
cd32_state(const machine_config &mconfig, device_type type, const char *tag)
: amiga_state(mconfig, type, tag)
, m_player_ports(*this, {"p1_cd32_buttons", "p2_cd32_buttons"})
, m_cdda(*this, "akiko:cdda")
{ }
void akiko_int_w(int state);
void akiko_cia_0_port_a_write(uint8_t data);
void handle_joystick_cia(u8 pra, u8 dra);
u16 handle_joystick_potgor(u16 potgor);
DECLARE_CUSTOM_INPUT_MEMBER( cd32_input );
template <int P> int cd32_sel_mirror_input();
void init_pal();
void init_ntsc();
required_ioport_array<2> m_player_ports;
int m_oldstate[2]{};
int m_cd32_shifter[2]{};
u16 m_potgo_value = 0;
void cd32n(machine_config &config);
void cd32(machine_config &config);
void cd32_mem(address_map &map);
protected:
// amiga_state overrides
virtual void potgo_w(u16 data) override;
private:
required_device<cdda_device> m_cdda;
};
//**************************************************************************
// REAL TIME CLOCK
//**************************************************************************
u16 cdtv_state::clock_r(offs_t offset)
{
return m_rtc->read(offset / 2);
}
void cdtv_state::clock_w(offs_t offset, u16 data)
{
m_rtc->write(offset / 2, data);
}
u16 a2000_state::clock_r(offs_t offset)
{
return m_rtc->read(offset / 2);
}
void a2000_state::clock_w(offs_t offset, u16 data)
{
m_rtc->write(offset / 2, data);
}
u16 a500p_state::clock_r(offs_t offset)
{
return m_rtc->read(offset / 2);
}
void a500p_state::clock_w(offs_t offset, u16 data)
{
m_rtc->write(offset / 2, data);
}
//**************************************************************************
// CD-ROM CONTROLLER
//**************************************************************************
uint8_t cdtv_state::dmac_scsi_data_read(offs_t offset)
{
if (offset >= 0xb0 && offset <= 0xbf)
return m_tpi->read(offset);
return 0xff;
}
void cdtv_state::dmac_scsi_data_write(offs_t offset, uint8_t data)
{
if (offset >= 0xb0 && offset <= 0xbf)
m_tpi->write(offset, data);
}
void cdtv_state::dmac_int_w(int state)
{
m_dmac_irq = state;
update_int2();
}
void cdtv_state::tpi_port_b_write(uint8_t data)
{
m_cdrom->cmd_w(BIT(data, 0));
m_cdrom->enable_w(BIT(data, 1));
}
void cdtv_state::tpi_int_w(int state)
{
m_tpi_irq = state;
update_int2();
}
//**************************************************************************
// DRIVER INIT
//**************************************************************************
// ocs chipset (agnus with support for 512k or 1mb chip ram, denise)
void a1000_state::init_pal()
{
m_agnus_id = AGNUS_PAL; // 8367
m_denise_id = DENISE; // 8362
}
void a1000_state::init_ntsc()
{
m_agnus_id = AGNUS_NTSC; // 8361
m_denise_id = DENISE; // 8362
}
void a2000_state::init_pal()
{
m_agnus_id = AGNUS_PAL; // 8371 (later versions 8372A)
m_denise_id = DENISE; // 8362
}
void a2000_state::init_ntsc()
{
m_agnus_id = AGNUS_NTSC; // 8370 (later versions 8372A)
m_denise_id = DENISE; // 8362
}
void a500_state::init_pal()
{
m_agnus_id = AGNUS_PAL; // 8371 (later versions 8372A)
m_denise_id = DENISE; // 8362
}
void a500_state::init_ntsc()
{
m_agnus_id = AGNUS_NTSC; // 8370 (later versions 8372A)
m_denise_id = DENISE; // 8362
}
void cdtv_state::init_pal()
{
m_agnus_id = AGNUS_HR_PAL; // 8372A
m_denise_id = DENISE; // 8362
}
void cdtv_state::init_ntsc()
{
m_agnus_id = AGNUS_HR_NTSC; // 8372A
m_denise_id = DENISE; // 8362
}
// ecs chipset (agnus with support for 2mb chip ram, super denise)
void a3000_state::init_pal()
{
m_agnus_id = AGNUS_HR_PAL_NEW; // 8372B (early versions: 8372AB)
m_denise_id = DENISE_HR; // 8373
}
void a3000_state::init_ntsc()
{
m_agnus_id = AGNUS_HR_NTSC_NEW; // 8372B (early versions: 8372AB)
m_denise_id = DENISE_HR; // 8373
}
void a500p_state::init_pal()
{
m_agnus_id = AGNUS_HR_PAL; // 8375 (390544-01)
m_denise_id = DENISE_HR; // 8373
}
void a500p_state::init_ntsc()
{
m_agnus_id = AGNUS_HR_NTSC; // 8375 (390544-02)
m_denise_id = DENISE_HR; // 8373
}
void a600_state::init_pal()
{
m_agnus_id = AGNUS_HR_PAL; // 8375 (390544-01)
m_denise_id = DENISE_HR; // 8373
}
void a600_state::init_ntsc()
{
m_agnus_id = AGNUS_HR_NTSC; // 8375 (390544-02)
m_denise_id = DENISE_HR; // 8373
}
// aga chipset (alice and lisa)
void a1200_state::init_pal()
{
m_agnus_id = ALICE_PAL_NEW;
m_denise_id = LISA;
}
void a1200_state::init_ntsc()
{
m_agnus_id = ALICE_NTSC_NEW;
m_denise_id = LISA;
}
void a4000_state::init_pal()
{
m_agnus_id = ALICE_PAL_NEW;
m_denise_id = LISA;
}
void a4000_state::init_ntsc()
{
m_agnus_id = ALICE_NTSC_NEW;
m_denise_id = LISA;
}
void cd32_state::init_pal()
{
m_agnus_id = ALICE_PAL_NEW;
m_denise_id = LISA;
}
void cd32_state::init_ntsc()
{
m_agnus_id = ALICE_NTSC_NEW;
m_denise_id = LISA;
}
//**************************************************************************
// MACHINE EMULATION
//**************************************************************************
void a1000_state::machine_start()
{
// start base machine
amiga_state::machine_start();
// allocate 256kb for wom
m_wom_ram.resize(256 * 1024 / 2);
m_wom->set_base(&m_wom_ram[0]);
}
void a1000_state::machine_reset()
{
// base reset
amiga_state::machine_reset();
// bootrom visible, wom writable
m_bootrom->set_bank(0);
m_maincpu->space(AS_PROGRAM).install_write_bank(0xfc0000, 0xffffff, m_wom);
}
// any write to this area will write protect the wom and disable the bootrom
void a1000_state::write_protect_w(u16 data)
{
m_bootrom->set_bank(1);
m_maincpu->space(AS_PROGRAM).nop_write(0xfc0000, 0xffffff);
}
void a2000_state::machine_reset()
{
// base reset
amiga_state::machine_reset();
// reset zorro devices
m_zorro->reset();
}
void a2000_state::zorro2_int2_w(int state)
{
m_zorro2_int2 = state;
update_int2();
}
void a2000_state::zorro2_int6_w(int state)
{
m_zorro2_int6 = state;
update_int6();
}
bool a2000_state::int2_pending()
{
return m_cia_0_irq || m_zorro2_int2;
}
bool a2000_state::int6_pending()
{
return m_cia_1_irq || m_zorro2_int6;
}
void a500_state::machine_reset()
{
// base reset
amiga_state::machine_reset();
// reset side expansion slot device
m_side->reset();
}
void a500_state::side_int2_w(int state)
{
m_side_int2 = state;
update_int2();
}
void a500_state::side_int6_w(int state)
{
m_side_int6 = state;
update_int6();
}
bool a500_state::int2_pending()
{
return m_cia_0_irq || m_side_int2;
}
bool a500_state::int6_pending()
{
return m_cia_1_irq || m_side_int6;
}
void cdtv_state::machine_start()
{
// start base machine
amiga_state::machine_start();
// setup dmac
m_dmac->set_address_space(&m_maincpu->space(AS_PROGRAM));
m_dmac->ramsz_w(0);
}
bool cdtv_state::int2_pending()
{
return m_cia_0_irq || m_dmac_irq || m_tpi_irq;
}
bool cdtv_state::int6_pending()
{
return m_cia_1_irq;
}
u32 a3000_state::scsi_r(offs_t offset, u32 mem_mask)
{
u32 data = 0xffffffff;
logerror("scsi_r(%06x): %08x & %08x\n", offset, data, mem_mask);
return data;
}
void a3000_state::scsi_w(offs_t offset, u32 data, u32 mem_mask)
{
logerror("scsi_w(%06x): %08x & %08x\n", offset, data, mem_mask);
}
u32 a3000_state::motherboard_r(offs_t offset, u32 mem_mask)
{
u32 data = 0xffffffff;
logerror("motherboard_r(%06x): %08x & %08x\n", offset, data, mem_mask);
return data;
}
void a3000_state::motherboard_w(offs_t offset, u32 data, u32 mem_mask)
{
logerror("motherboard_w(%06x): %08x & %08x\n", offset, data, mem_mask);
}
void a500p_state::machine_reset()
{
// base reset
amiga_state::machine_reset();
// reset side expansion slot device
m_side->reset();
}
bool a500p_state::int2_pending()
{
return m_cia_0_irq || m_side_int2;
}
bool a500p_state::int6_pending()
{
return m_cia_1_irq || m_side_int6;
}
bool a600_state::int2_pending()
{
return m_cia_0_irq || m_gayle_int2;
}
bool a600_state::int6_pending()
{
return m_cia_1_irq || m_gayle_int6;
}
void a600_state::gayle_int2_w(int state)
{
m_gayle_int2 = state;
update_int2();
}
void a600_state::gayle_int6_w(int state)
{
m_gayle_int6 = state;
update_int6();
}
bool a1200_state::int2_pending()
{
return m_cia_0_irq || m_gayle_int2;
}
bool a1200_state::int6_pending()
{
return m_cia_1_irq || m_gayle_int6;
}
void a1200_state::gayle_int2_w(int state)
{
m_gayle_int2 = state;
update_int2();
}
void a1200_state::gayle_int6_w(int state)
{