Previous 15994 Revisions Next

r12897 Monday 19th September, 2011 at 14:46:56 UTC by Curt Coder
[ABC1600] Fixed MAC slightly, ABCenix boots a little further now. (nw)
[src/mess/drivers]abc1600.c
[src/mess/includes]abc1600.h
[src/mess/machine]abc99.c

src/mess/machine/abc99.c
r12896r12897
536536     m_so(1),
537537     m_so_z2(1),
538538     m_so_z5(1),
539     m_keydown(0)
539     m_keydown(0),
540     m_t1_z2(0),
541     m_t1_z5(0),
542     m_led_en(0),
543     m_reset(0)
540544{
541545}
542546
src/mess/includes/abc1600.h
r12896r12897
130130   DECLARE_READ8_MEMBER( cio_pc_r );
131131   DECLARE_WRITE8_MEMBER( cio_pc_w );
132132
133   int get_current_task(offs_t offset);
134   offs_t get_segment_address(offs_t offset);
135   offs_t get_page_address(offs_t offset, UINT8 segd);
136   offs_t translate_address(offs_t offset, int *nonx, int *wp);
133137   UINT8 read_ram(offs_t offset);
134138   void write_ram(offs_t offset, UINT8 data);
135139   UINT8 read_io(offs_t offset);
136140   void write_io(offs_t offset, UINT8 data);
137141   UINT8 read_user_memory(offs_t offset);
138142   void write_user_memory(offs_t offset, UINT8 data);
143   int get_fc();
139144   UINT8 read_supervisor_memory(offs_t offset);
140145   void write_supervisor_memory(offs_t offset, UINT8 data);
141146
src/mess/drivers/abc1600.c
r12896r12897
1818    - short/long reset (RSTBUT)
1919    - SCC interrupt
2020    - CIO (interrupt controller)
21   
22      Task 15 BOOTE 1 MAGIC 1
23      Task 0 Segment 0 : 10
24      Z8536 '15b' Unimplemented write 20 to register 8
25      Task 0 BOOTE 1 MAGIC 1
26      Reset caused by the watchdog!!!
27     
2821        - RTC
2922        - NVRAM
3023    - hard disk (Xebec S1410)
r12896r12897
5851#define A1_A2      ((A1 << 1) | A2)
5952#define A2_A1      ((offset >> 1) & 0x03)
6053
61#define CURRENT_TASK \
62   (m_ifc2 ? 0 : ((m_task ^ 0x0f) & 0x0f))
54#define FC0         BIT(fc, 0)
55#define FC1         BIT(fc, 1)
56#define FC2         BIT(fc, 2)
6357
64#define SEGMENT_ADDRESS(_segment) \
65   ((CURRENT_TASK << 5) | _segment)
66
67#define SEGMENT_DATA(_segment) \
68   m_segment_ram[SEGMENT_ADDRESS(_segment)]
69
70#define PAGE_ADDRESS(_segment, _page) \
71   ((SEGMENT_DATA(_segment) << 4) | _page)
72
73#define PAGE_DATA(_segment, _page) \
74   m_page_ram[PAGE_ADDRESS(_segment, _page)]
75
7658#define PAGE_WP      BIT(page_data, 14)
7759#define PAGE_NONX   BIT(page_data, 15)
7860
r12896r12897
397379
398380
399381//-------------------------------------------------
400//  read_user_memory -
382//  get_current_task -
401383//-------------------------------------------------
402384
403UINT8 abc1600_state::read_user_memory(offs_t offset)
385int abc1600_state::get_current_task(offs_t offset)
404386{
405   int segment = (offset >> 15) & 0x1f;
406   int page = (offset >> 11) & 0x0f;
407   UINT16 page_data = PAGE_DATA(segment, page);
387   int force_task0 = !(m_ifc2 | A19);
388   int t0 = !(BIT(m_task, 0) | force_task0);
389   int t1 = !(BIT(m_task, 1) | force_task0);
390   int t2 = !(BIT(m_task, 2) | force_task0);
391   int t3 = !(BIT(m_task, 3) | force_task0);
392   
393   return (t3 << 3) | (t2 << 2) | (t1 << 1) | t0;
394}
408395
396
397//-------------------------------------------------
398//  get_segment_address -
399//-------------------------------------------------
400
401offs_t abc1600_state::get_segment_address(offs_t offset)
402{
403   int sega19 = !(!(A8 | m_ifc2) | !A19);
404   int task = get_current_task(offset);
405   
406   return (task << 5) | (sega19 << 4) | ((offset >> 15) & 0x0f);
407}
408
409
410//-------------------------------------------------
411//  get_page_address -
412//-------------------------------------------------
413
414offs_t abc1600_state::get_page_address(offs_t offset, UINT8 segd)
415{
416   return ((segd & 0x3f) << 4) | ((offset >> 11) & 0x0f);
417}
418
419
420//-------------------------------------------------
421//  translate_address -
422//-------------------------------------------------
423
424offs_t abc1600_state::translate_address(offs_t offset, int *nonx, int *wp)
425{
426   if (offset == 0x4730)
427   {
428      logerror("virtuality %06x\n", 0);
429   }
430
431   // segment
432   offs_t sega = get_segment_address(offset);
433   UINT8 segd = m_segment_ram[sega];
434   
435   // page
436   offs_t pga = get_page_address(offset, segd);
437   UINT16 page_data = m_page_ram[pga];
438   
409439   offs_t virtual_offset = ((page_data & 0x3ff) << 11) | (offset & 0x7ff);
410
440   
411441   if (PAGE_NONX)
412442   {
443      logerror("Bus error %06x : %06x\n", offset, virtual_offset);
413444      m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE);
414445      m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE);
415446   }
416447
448   *nonx = PAGE_NONX;
449   *wp = PAGE_WP;
450
451   return virtual_offset;
452}
453
454
455//-------------------------------------------------
456//  read_user_memory -
457//-------------------------------------------------
458
459UINT8 abc1600_state::read_user_memory(offs_t offset)
460{
461   int nonx = 0, wp = 0;
462   offs_t virtual_offset = translate_address(offset, &nonx, &wp);
417463   UINT8 data = 0;
418464
419465   if (virtual_offset < 0x1fe000)
r12896r12897
435481
436482void abc1600_state::write_user_memory(offs_t offset, UINT8 data)
437483{
438   int segment = (offset >> 15) & 0x1f;
439   int page = (offset >> 11) & 0x0f;
440   UINT16 page_data = PAGE_DATA(segment, page);
484   int nonx = 0, wp = 0;
485   offs_t virtual_offset = translate_address(offset, &nonx, &wp);
441486
442   offs_t virtual_offset = ((page_data & 0x3ff) << 11) | (offset & 0x7ff);
487   if (nonx || !wp) return;
443488
444   if (!PAGE_WP) return;
445
446   if (PAGE_NONX)
447   {
448      m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE);
449      m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE);
450      return;
451   }
452
453489   if (virtual_offset < 0x1fe000)
454490   {
455491      write_ram(virtual_offset, data);
r12896r12897
472508
473509   if (!A19)
474510   {
475      if (!BOOTE && !A18 && !A17)
476      {
477         // _BOOTCE
478         UINT8 *rom = machine().region(MC68008P8_TAG)->base();
479         data = rom[offset & 0x3fff];
480      }
481      else
482      {
483         data = read_user_memory(offset);
484      }
511      data = read_user_memory(offset);
485512   }
486513   else
487514   {
r12896r12897
540567
541568
542569//-------------------------------------------------
570//  get_fc -
571//-------------------------------------------------
572
573int abc1600_state::get_fc()
574{
575   UINT16 fc = m68k_get_fc(m_maincpu);
576
577   m_ifc2 = !(!(MAGIC | FC0) | FC2);
578
579   return fc;
580}
581
582
583//-------------------------------------------------
543584//  mac_r -
544585//-------------------------------------------------
545586
546587READ8_MEMBER( abc1600_state::mac_r )
547588{
548   UINT16 fc = m68k_get_fc(m_maincpu);
589   int fc = get_fc();
590
549591   UINT8 data = 0;
550592
551   if (fc == M68K_FC_SUPERVISOR_DATA || fc == M68K_FC_SUPERVISOR_PROGRAM)
593   if (!BOOTE && !A19 && !A18 && !A17)
552594   {
553      m_ifc2 = 0 ^ MAGIC;
595      // _BOOTCE
596      UINT8 *rom = machine().region(MC68008P8_TAG)->base();
597      data = rom[offset & 0x3fff];
598   }
599   else if (!m_ifc2 && !FC1)
600   {
554601      data = read_supervisor_memory(offset);
555602   }
556603   else
557604   {
558      m_ifc2 = 1 ^ MAGIC;
559605      data = read_user_memory(offset);
560606   }
561607
r12896r12897
569615
570616WRITE8_MEMBER( abc1600_state::mac_w )
571617{
572   UINT16 fc = m68k_get_fc(m_maincpu);
618   int fc = get_fc();
573619
574   if (fc == M68K_FC_SUPERVISOR_DATA || fc == M68K_FC_SUPERVISOR_PROGRAM)
620   if (!m_ifc2 && !FC1)
575621   {
576      m_ifc2 = 0 ^ MAGIC;
577622      write_supervisor_memory(offset, data);
578623   }
579624   else
580625   {
581      m_ifc2 = 1 ^ MAGIC;
582626      write_user_memory(offset, data);
583627   }
584628}
r12896r12897
639683
640684   m_task = data ^ 0xff;
641685
642   if (LOG) logerror("Task %u BOOTE %u MAGIC %u\n", (m_task ^ 0x0f) & 0x0f, BOOTE, MAGIC);
686   if (LOG) logerror("%s: %06x Task %u BOOTE %u MAGIC %u\n", machine().describe_context(), offset, get_current_task(offset), BOOTE, MAGIC);
643687}
644688
645689
r12896r12897
664708
665709    */
666710
667   int segment = (A8 << 4) | ((offset >> 15) & 0x0f);
668   UINT8 data = SEGMENT_DATA(segment);
711   offs_t sega = get_segment_address(offset);
712   UINT8 segd = m_segment_ram[sega];
669713
670   return (READ_MAGIC << 7) | (data & 0x7f);
714   return (READ_MAGIC << 7) | (segd & 0x7f);
671715}
672716
673717
r12896r12897
692736
693737    */
694738
695   int segment = (A8 << 4) | ((offset >> 15) & 0x0f);
696   SEGMENT_DATA(segment) = data & 0x7f;
739   offs_t sega = get_segment_address(offset);
697740
698   if (LOG) logerror("Task %u Segment %u : %02x\n", CURRENT_TASK, segment, data);
741   m_segment_ram[sega] = data & 0x7f;
742
743   if (LOG) logerror("%s: %06x Task %u Segment %03x : %02x\n", machine().describe_context(), offset, get_current_task(offset), sega, data);
699744}
700745
701746
r12896r12897
729774
730775    */
731776
732   int segment = (A8 << 4) | ((offset >> 15) & 0x0f);
733   int page = (offset >> 11) & 0x0f;
734   UINT16 data = PAGE_DATA(segment, page);
777   // segment
778   offs_t sega = get_segment_address(offset);
779   UINT8 segd = m_segment_ram[sega];
780   
781   // page
782   offs_t pga = get_page_address(offset, segd);
783   UINT16 data = m_page_ram[pga];
735784
736785   return A0 ? (data & 0xff) : (data >> 8);
737786}
r12896r12897
767816
768817    */
769818
770   int segment = (A8 << 4) | ((offset >> 15) & 0x0f);
771   int page = (offset >> 11) & 0x0f;
819   // segment
820   offs_t sega = get_segment_address(offset);
821   UINT8 segd = m_segment_ram[sega];
822   
823   // page
824   offs_t pga = get_page_address(offset, segd);
772825
773826   if (A0)
774827   {
775      PAGE_DATA(segment, page) = (PAGE_DATA(segment, page) & 0xff00) | data;
828      m_page_ram[pga] = (m_page_ram[pga] & 0xff00) | data;
776829   }
777830   else
778831   {
779      PAGE_DATA(segment, page) = (data << 8) | (PAGE_DATA(segment, page) & 0xff);
832      m_page_ram[pga] = (data << 8) | (m_page_ram[pga] & 0xff);
780833   }
781834
782   if (LOG) logerror("Task %u Segment %u Page %u : %04x\n", CURRENT_TASK, segment, page, PAGE_DATA(segment, page));
835   if (LOG) logerror("%s: %06x Task %u Segment %03x Page %03x : %02x -> %04x\n", machine().describe_context(), offset, get_current_task(offset), sega, pga, data, m_page_ram[pga]);
783836}
784837
785838
r12896r12897
849902
850903   m_cause = (dmamap & 0x1f) << 3;
851904
852   logerror("virtual addr %06x\n", ((dmamap & 0x1f) << 16) | offset);
853   
854905   return ((dmamap & 0x1f) << 16) | offset;
855906}
856907

Previous 15994 Revisions Next


© 1998-2018 The MESS Team