Previous 15994 Revisions Next

r10116 Thursday 20th January, 2011 at 17:16:51 UTC by Curt Coder
M6801 changes: [Curt Coder]
- added operating mode enum
- fixed port writes
- implemented SCI status follower bits
[src/emu/cpu/m6800]m6800.c m6800.h

src/emu/cpu/m6800/m6800.h
r10115r10116
2222                           /* it is usuali to use PULSE_LINE state         */
2323};
2424
25enum
26{
27   M6801_MODE_0 = 0,
28   M6801_MODE_1,
29   M6801_MODE_2,
30   M6801_MODE_3,
31   M6801_MODE_4,
32   M6801_MODE_5,
33   M6801_MODE_6,
34   M6801_MODE_7
35};
36
2537/* By default, on a port write port bits which are not set as output in the DDR */
2638/* are set to the value returned by a read from the same port. If you need to */
2739/* know the DDR for e.g. port 1, do m6803_internal_registers_r(M6801_DDR1) */
src/emu/cpu/m6800/m6800.c
r10115r10116
5353
5454/*
5555
56    Chip                RAM     NVRAM   ROM     SCI
57    -----------------------------------------------
58    MC6800              -       -       -       no
59    MC6801              128     64      2K      yes
60    MC68701             128     64      -       yes
61    MC6803              128     64      -       yes
62    MC6802              128     32      -       no
63    MC6802NS            128     -       -       no
64    MC6808              -       -       -       no
56    Chip                RAM     NVRAM   ROM     SCI      r15-f   ports
57    -----------------------------------------------------------------
58    MC6800              -       -       -       no      no      4
59    MC6802              128     32      -       no      no      4
60    MC6802NS            128     -       -       no      no      4
61    MC6808              -       -       -       no      no      4
62   
63   MC6801              128     64      2K      yes      no      4
64    MC68701             128     64      -       yes      no      4
65    MC6803              128     64      -       yes      no      4
6566
66    HD6301              128     -       4K      yes
67    HD63701             192     -       4K      yes
68    HD6303              128     -       -       yes
69    HD6801              128     64      2K      yes
67   MC6801U4         192      32      4K      yes      yes      4
68   MC6803U4         192      32      -      yes      yes      4
7069
70    HD6801              128     64      2K      yes      no      4
71   HD6301V             128     -       4K      yes      no      4
72    HD63701V            192     -       4K      yes      no      4
73    HD6303R             128     -       -       yes      no      4
74
75   HD6301X            192      -      4K      yes      yes      6
76   HD6301Y             256     -       16K     yes      yes      6
77   HD6303X             192     -       -       yes      yes      6
78    HD6303Y             256     -       -       yes      yes      6
79
7180    NSC8105
7281    MS2010-A
7382
r10115r10116
142151
143152   int      clock;
144153   UINT8   trcsr, rmcr, rdr, tdr, rsr, tsr;
145   int      rxbits, txbits, txstate, trcsr_read, tx;
154   int      rxbits, txbits, txstate, trcsr_read_tdre, trcsr_read_orfe, trcsr_read_rdrf, tx;
155   int      port2_written;
146156
147157   int      icount;
148158   int      latch09;
149159
150160   PAIR   timer_over;
151   emu_timer *m6800_rx_timer;
152   emu_timer *m6800_tx_timer;
161   emu_timer *sci_timer;
153162   PAIR ea;      /* effective address */
154163
155164};
r10115r10116
271280#define M6800_TRCSR_RDRF      0x80 // Receive Data Register Full
272281#define M6800_TRCSR_ORFE      0x40 // Over Run Framing Error
273282#define M6800_TRCSR_TDRE      0x20 // Transmit Data Register Empty
274#define M6800_TRCSR_RIE      0x10 // Receive Interrupt Enable
283#define M6800_TRCSR_RIE         0x10 // Receive Interrupt Enable
275284#define M6800_TRCSR_RE         0x08 // Receive Enable
276#define M6800_TRCSR_TIE      0x04 // Transmit Interrupt Enable
285#define M6800_TRCSR_TIE         0x04 // Transmit Interrupt Enable
277286#define M6800_TRCSR_TE         0x02 // Transmit Enable
278287#define M6800_TRCSR_WU         0x01 // Wake Up
279288
280#define M6800_PORT2_IO4      0x10
281#define M6800_PORT2_IO3      0x08
289#define M6800_PORT2_IO4         0x10
290#define M6800_PORT2_IO3         0x08
282291
283292static const int M6800_RMCR_SS[] = { 16, 128, 1024, 4096 };
284293
r10115r10116
587596          ((cpustate->trcsr & (M6800_TRCSR_RIE|M6800_TRCSR_ORFE)) == (M6800_TRCSR_RIE|M6800_TRCSR_ORFE)) ||
588597          ((cpustate->trcsr & (M6800_TRCSR_TIE|M6800_TRCSR_TDRE)) == (M6800_TRCSR_TIE|M6800_TRCSR_TDRE)))
589598   {
599      //logerror("M6800 '%s' SCI interrupt\n", cpustate->device->tag());
590600      TAKE_SCI;
591601   }
592602}
r10115r10116
665675      check_timer_event(cpustate);
666676}
667677
678INLINE void set_rmcr(m6800_state *cpustate, UINT8 data)
679{
680   if (cpustate->rmcr == data) return;
681
682   cpustate->rmcr = data;
683
684   switch ((cpustate->rmcr & M6800_RMCR_CC_MASK) >> 2)
685   {
686   case 0:
687   case 3: // not implemented
688      timer_enable(cpustate->sci_timer, 0);
689      break;
690
691   case 1:
692   case 2:
693      {
694         int divisor = M6800_RMCR_SS[cpustate->rmcr & M6800_RMCR_SS_MASK];
695
696         timer_adjust_periodic(cpustate->sci_timer, ATTOTIME_IN_HZ(cpustate->clock / divisor), 0, ATTOTIME_IN_HZ(cpustate->clock / divisor));
697      }
698      break;
699   }
700}
701
702INLINE void write_port2(m6800_state *cpustate)
703{
704   if (!cpustate->port2_written) return;
705
706   UINT8 data = cpustate->port2_data;
707   UINT8 ddr = cpustate->port2_ddr & 0x1f;
708
709   if ((ddr != 0x1f) && ddr)
710   {
711      data = (cpustate->port2_data & ddr)   | (ddr ^ 0xff);
712   }
713
714   if (cpustate->trcsr & M6800_TRCSR_TE)
715   {
716      data = (data & 0xef) | (cpustate->tx << 4);
717   }
718
719   data &= 0x1f;
720
721   cpustate->io->write_byte(M6803_PORT2, data);
722}
723
668724/* include the opcode prototypes and function pointer tables */
669725#include "6800tbl.c"
670726
671727/* include the opcode functions */
672728#include "6800ops.c"
673729
674static void m6800_tx(m6800_state *cpustate, int value)
675{
676   cpustate->port2_data = (cpustate->port2_data & 0xef) | (value << 4);
677
678   if(cpustate->port2_ddr == 0xff)
679      cpustate->io->write_byte(M6803_PORT2,cpustate->port2_data);
680   else
681      cpustate->io->write_byte(M6803_PORT2,(cpustate->port2_data & cpustate->port2_ddr)
682         | (cpustate->io->read_byte(M6803_PORT2) & (cpustate->port2_ddr ^ 0xff)));
683}
684
685730static int m6800_rx(m6800_state *cpustate)
686731{
687732   return (cpustate->io->read_byte(M6803_PORT2) & M6800_PORT2_IO3) >> 3;
688733}
689734
690static TIMER_CALLBACK(m6800_tx_tick)
735static void serial_transmit(m6800_state *cpustate)
691736{
692    m6800_state *cpustate = (m6800_state *)ptr;
737   //logerror("M6800 '%s' Tx Tick\n", cpustate->device->tag());
693738
694739   if (cpustate->trcsr & M6800_TRCSR_TE)
695740   {
r10115r10116
732777               cpustate->tx = 0;
733778
734779               cpustate->txbits++;
780               
781               //logerror("M6800 '%s' Transmit START Data %02x\n", cpustate->device->tag(), cpustate->tsr);
735782            }
736783            break;
737784
r10115r10116
742789            CHECK_IRQ_LINES(cpustate);
743790
744791            cpustate->txbits = M6800_SERIAL_START;
792
793            //logerror("M6800 '%s' Transmit STOP\n", cpustate->device->tag());
745794            break;
746795
747796         default:
r10115r10116
751800            // shift transmit register
752801            cpustate->tsr >>= 1;
753802
803            //logerror("M6800 '%s' Transmit Bit %u: %u\n", cpustate->device->tag(), cpustate->txbits, cpustate->tx);
804
754805            cpustate->txbits++;
755806            break;
756807         }
757808         break;
758809      }
810
811      cpustate->port2_written = 1;
812      write_port2(cpustate);
759813   }
760
761   m6800_tx(cpustate, cpustate->tx);
762814}
763815
764static TIMER_CALLBACK(m6800_rx_tick)
816static void serial_receive(m6800_state *cpustate)
765817{
766    m6800_state *cpustate = (m6800_state *)ptr;
767
818   //logerror("M6800 '%s' Rx Tick TRCSR %02x bits %u check %02x\n", cpustate->device->tag(), cpustate->trcsr, cpustate->rxbits, cpustate->trcsr & M6800_TRCSR_RE);
819   
768820   if (cpustate->trcsr & M6800_TRCSR_RE)
769821   {
770822      if (cpustate->trcsr & M6800_TRCSR_WU)
771823      {
772824         // wait for 10 bits of '1'
773
774825         if (m6800_rx(cpustate) == 1)
775826         {
776827            cpustate->rxbits++;
777828
829            //logerror("M6800 '%s' Received WAKE UP bit %u\n", cpustate->device->tag(), cpustate->rxbits);
830
778831            if (cpustate->rxbits == 10)
779832            {
833               //logerror("M6800 '%s' Receiver Wake Up\n", cpustate->device->tag());
834
780835               cpustate->trcsr &= ~M6800_TRCSR_WU;
781836               cpustate->rxbits = M6800_SERIAL_START;
782837            }
783838         }
784839         else
785840         {
841            //logerror("M6800 '%s' Receiver Wake Up interrupted\n", cpustate->device->tag());
842
786843            cpustate->rxbits = M6800_SERIAL_START;
787844         }
788845      }
789846      else
790847      {
791848         // receive data
792
793849         switch (cpustate->rxbits)
794850         {
795851         case M6800_SERIAL_START:
r10115r10116
797853            {
798854               // start bit found
799855               cpustate->rxbits++;
856           
857               //logerror("M6800 '%s' Received START bit\n", cpustate->device->tag());
800858            }
801859            break;
802860
803861         case M6800_SERIAL_STOP:
804862            if (m6800_rx(cpustate) == 1)
805863            {
864               //logerror("M6800 '%s' Received STOP bit\n", cpustate->device->tag());
865
806866               if (cpustate->trcsr & M6800_TRCSR_RDRF)
807867               {
808868                  // overrun error
809
810869                  cpustate->trcsr |= M6800_TRCSR_ORFE;
811870
871                  //logerror("M6800 '%s' Receive Overrun Error\n", cpustate->device->tag());
872
812873                  CHECK_IRQ_LINES(cpustate);
813874               }
814875               else
r10115r10116
817878                  {
818879                     // transfer data into receive register
819880                     cpustate->rdr = cpustate->rsr;
881         
882                     //logerror("M6800 '%s' Receive Data Register: %02x\n", cpustate->device->tag(), cpustate->rdr);
820883
821884                     // set RDRF flag
822885                     cpustate->trcsr |= M6800_TRCSR_RDRF;
r10115r10116
828891            else
829892            {
830893               // framing error
831
832894               if (!(cpustate->trcsr & M6800_TRCSR_ORFE))
833895               {
834896                  // transfer unframed data into receive register
r10115r10116
838900               cpustate->trcsr |= M6800_TRCSR_ORFE;
839901               cpustate->trcsr &= ~M6800_TRCSR_RDRF;
840902
903               //logerror("M6800 '%s' Receive Framing Error\n", cpustate->device->tag());
904
841905               CHECK_IRQ_LINES(cpustate);
842906            }
843907
r10115r10116
851915            // receive bit into register
852916            cpustate->rsr |= (m6800_rx(cpustate) << 7);
853917
918            //logerror("M6800 '%s' Received DATA bit %u: %u\n", cpustate->device->tag(), cpustate->rxbits, BIT(cpustate->rsr, 7));
919
854920            cpustate->rxbits++;
855921            break;
856922         }
r10115r10116
858924   }
859925}
860926
927static TIMER_CALLBACK( sci_tick )
928{
929    m6800_state *cpustate = (m6800_state *)ptr;
930
931   serial_transmit(cpustate);
932   serial_receive(cpustate);
933}
934
861935/****************************************************************************
862936 * Reset registers to their initial values
863937 ****************************************************************************/
r10115r10116
883957   state_save_register_device_item(cpustate->device, 0, cpustate->port2_data);
884958   state_save_register_device_item(cpustate->device, 0, cpustate->port3_data);
885959   state_save_register_device_item(cpustate->device, 0, cpustate->port4_data);
960   state_save_register_device_item(cpustate->device, 0, cpustate->port2_written);
886961   state_save_register_device_item(cpustate->device, 0, cpustate->tcsr);
887962   state_save_register_device_item(cpustate->device, 0, cpustate->pending_tcsr);
888963   state_save_register_device_item(cpustate->device, 0, cpustate->irq2);
r10115r10116
903978   state_save_register_device_item(cpustate->device, 0, cpustate->rxbits);
904979   state_save_register_device_item(cpustate->device, 0, cpustate->txbits);
905980   state_save_register_device_item(cpustate->device, 0, cpustate->txstate);
906   state_save_register_device_item(cpustate->device, 0, cpustate->trcsr_read);
981   state_save_register_device_item(cpustate->device, 0, cpustate->trcsr_read_tdre);
982   state_save_register_device_item(cpustate->device, 0, cpustate->trcsr_read_orfe);
983   state_save_register_device_item(cpustate->device, 0, cpustate->trcsr_read_rdrf);
907984   state_save_register_device_item(cpustate->device, 0, cpustate->tx);
908985}
909986
r10115r10116
9401017
9411018   cpustate->port1_ddr = 0x00;
9421019   cpustate->port2_ddr = 0x00;
1020   cpustate->port2_written = 0;
9431021   /* TODO: on reset port 2 should be read to determine the operating mode (bits 0-2) */
9441022   cpustate->tcsr = 0x00;
9451023   cpustate->pending_tcsr = 0x00;
r10115r10116
9501028   cpustate->ram_ctrl |= 0x40;
9511029
9521030   cpustate->trcsr = M6800_TRCSR_TDRE;
953   cpustate->rmcr = 0;
954   if (cpustate->m6800_rx_timer) timer_enable(cpustate->m6800_rx_timer, 0);
955   if (cpustate->m6800_tx_timer) timer_enable(cpustate->m6800_tx_timer, 0);
1031
9561032   cpustate->txstate = M6800_TX_STATE_INIT;
9571033   cpustate->txbits = cpustate->rxbits = 0;
958   cpustate->trcsr_read = 0;
1034   cpustate->tx = 1;
1035   cpustate->trcsr_read_tdre = 0;
1036   cpustate->trcsr_read_orfe = 0;
1037   cpustate->trcsr_read_rdrf = 0;
9591038
1039   set_rmcr(cpustate, 0);
1040
9601041   cpustate->cc = 0xc0;
9611042}
9621043
r10115r10116
10461127   cpustate->io = device->space(AS_IO);
10471128
10481129   cpustate->clock = device->clock() / 4;
1049   cpustate->m6800_rx_timer = timer_alloc(device->machine, m6800_rx_tick, cpustate);
1050   cpustate->m6800_tx_timer = timer_alloc(device->machine, m6800_tx_tick, cpustate);
1130   cpustate->sci_timer = timer_alloc(device->machine, sci_tick, cpustate);
10511131
10521132   state_register(cpustate, "m6801");
10531133}
r10115r10116
10901170   cpustate->io = device->space(AS_IO);
10911171
10921172   cpustate->clock = device->clock() / 4;
1093   cpustate->m6800_rx_timer = timer_alloc(device->machine, m6800_rx_tick, cpustate);
1094   cpustate->m6800_tx_timer = timer_alloc(device->machine, m6800_tx_tick, cpustate);
1173   cpustate->sci_timer = timer_alloc(device->machine, sci_tick, cpustate);
10951174
10961175   state_register(cpustate, "m6803");
10971176}
r10115r10116
11451224   cpustate->io = device->space(AS_IO);
11461225
11471226   cpustate->clock = device->clock() / 4;
1148   cpustate->m6800_rx_timer = timer_alloc(device->machine, m6800_rx_tick, cpustate);
1149   cpustate->m6800_tx_timer = timer_alloc(device->machine, m6800_tx_tick, cpustate);
1227   cpustate->sci_timer = timer_alloc(device->machine, sci_tick, cpustate);
11501228
11511229   state_register(cpustate, "hd63701");
11521230}
r10115r10116
12091287      case 0x01:
12101288         return cpustate->port2_ddr;
12111289      case 0x02:
1212         return (cpustate->io->read_byte(M6803_PORT1) & (cpustate->port1_ddr ^ 0xff))
1290         if(cpustate->port1_ddr == 0xff)
1291            return cpustate->port1_data;
1292         else
1293            return (cpustate->io->read_byte(M6803_PORT1) & (cpustate->port1_ddr ^ 0xff))
12131294               | (cpustate->port1_data & cpustate->port1_ddr);
12141295      case 0x03:
1215         return (cpustate->io->read_byte(M6803_PORT2) & (cpustate->port2_ddr ^ 0xff))
1296         if(cpustate->port2_ddr == 0xff)
1297            return cpustate->port2_data;
1298         else
1299            return (cpustate->io->read_byte(M6803_PORT2) & (cpustate->port2_ddr ^ 0xff))
12161300               | (cpustate->port2_data & cpustate->port2_ddr);
12171301      case 0x04:
12181302         return cpustate->port3_ddr;
12191303      case 0x05:
12201304         return cpustate->port4_ddr;
12211305      case 0x06:
1222         return (cpustate->io->read_byte(M6803_PORT3) & (cpustate->port3_ddr ^ 0xff))
1306         if(cpustate->port3_ddr == 0xff)
1307            return cpustate->port3_data;
1308         else
1309            return (cpustate->io->read_byte(M6803_PORT3) & (cpustate->port3_ddr ^ 0xff))
12231310               | (cpustate->port3_data & cpustate->port3_ddr);
12241311      case 0x07:
1225         return (cpustate->io->read_byte(M6803_PORT4) & (cpustate->port4_ddr ^ 0xff))
1312         if(cpustate->port4_ddr == 0xff)
1313            return cpustate->port4_data;
1314         else
1315            return (cpustate->io->read_byte(M6803_PORT4) & (cpustate->port4_ddr ^ 0xff))
12261316               | (cpustate->port4_data & cpustate->port4_ddr);
12271317      case 0x08:
12281318         cpustate->pending_tcsr = 0;
r10115r10116
12651355      case 0x10:
12661356         return cpustate->rmcr;
12671357      case 0x11:
1268         cpustate->trcsr_read = 1;
1358         if (cpustate->trcsr & M6800_TRCSR_TDRE)
1359         {
1360            cpustate->trcsr_read_tdre = 1;
1361         }
1362         if (cpustate->trcsr & M6800_TRCSR_ORFE)
1363         {
1364            cpustate->trcsr_read_orfe = 1;
1365         }
1366         if (cpustate->trcsr & M6800_TRCSR_RDRF)
1367         {
1368            cpustate->trcsr_read_rdrf = 1;
1369         }
12691370         return cpustate->trcsr;
12701371      case 0x12:
1271         if (cpustate->trcsr_read)
1372         if (cpustate->trcsr_read_orfe)
12721373         {
1273            cpustate->trcsr_read = 0;
1274            cpustate->trcsr = cpustate->trcsr & 0x3f;
1374            cpustate->trcsr_read_orfe = 0;
1375            cpustate->trcsr &= ~M6800_TRCSR_ORFE;
12751376         }
1377         if (cpustate->trcsr_read_rdrf)
1378         {
1379            //logerror("M6801 '%s' Clear RDRF\n", space->cpu->tag());
1380            cpustate->trcsr_read_rdrf = 0;
1381            cpustate->trcsr &= ~M6800_TRCSR_RDRF;
1382         }
12761383         return cpustate->rdr;
12771384      case 0x13:
12781385         return cpustate->tdr;
r10115r10116
13081415            cpustate->port1_ddr = data;
13091416            if(cpustate->port1_ddr == 0xff)
13101417               cpustate->io->write_byte(M6803_PORT1,cpustate->port1_data);
1311            else
1418            else if (cpustate->port1_ddr)
13121419               cpustate->io->write_byte(M6803_PORT1,(cpustate->port1_data & cpustate->port1_ddr)
13131420                  | (cpustate->io->read_byte(M6803_PORT1) & (cpustate->port1_ddr ^ 0xff)));
13141421         }
r10115r10116
13171424         if (cpustate->port2_ddr != data)
13181425         {
13191426            cpustate->port2_ddr = data;
1320            if(cpustate->port2_ddr == 0xff)
1321               cpustate->io->write_byte(M6803_PORT2,cpustate->port2_data);
1322            else
1323               cpustate->io->write_byte(M6803_PORT2,(cpustate->port2_data & cpustate->port2_ddr)
1324                  | (cpustate->io->read_byte(M6803_PORT2) & (cpustate->port2_ddr ^ 0xff)));
1427            write_port2(cpustate);
13251428
13261429            if (cpustate->port2_ddr & 2)
13271430               logerror("CPU '%s' PC %04x: warning - port 2 bit 1 set as output (OLVL) - not supported\n",space->cpu->tag(),cpu_get_pc(space->cpu));
r10115r10116
13311434         cpustate->port1_data = data;
13321435         if(cpustate->port1_ddr == 0xff)
13331436            cpustate->io->write_byte(M6803_PORT1,cpustate->port1_data);
1334         else
1437         else if (cpustate->port1_ddr)
13351438            cpustate->io->write_byte(M6803_PORT1,(cpustate->port1_data & cpustate->port1_ddr)
13361439               | (cpustate->io->read_byte(M6803_PORT1) & (cpustate->port1_ddr ^ 0xff)));
13371440         break;
13381441      case 0x03:
1339         if (cpustate->trcsr & M6800_TRCSR_TE)
1340         {
1341            cpustate->port2_data = (data & 0xef) | (cpustate->tx << 4);
1342         }
1343         else
1344         {
1345            cpustate->port2_data = data;
1346         }
1347         if(cpustate->port2_ddr == 0xff)
1348            cpustate->io->write_byte(M6803_PORT2,cpustate->port2_data);
1349         else
1350            cpustate->io->write_byte(M6803_PORT2,(cpustate->port2_data & cpustate->port2_ddr)
1351               | (cpustate->io->read_byte(M6803_PORT2) & (cpustate->port2_ddr ^ 0xff)));
1442         cpustate->port2_data = data;
1443         cpustate->port2_written = 1;
1444         write_port2(cpustate);
13521445         break;
13531446      case 0x04:
13541447         if (cpustate->port3_ddr != data)
r10115r10116
13561449            cpustate->port3_ddr = data;
13571450            if(cpustate->port3_ddr == 0xff)
13581451               cpustate->io->write_byte(M6803_PORT3,cpustate->port3_data);
1359            else
1452            else if (cpustate->port3_ddr)
13601453               cpustate->io->write_byte(M6803_PORT3,(cpustate->port3_data & cpustate->port3_ddr)
13611454                  | (cpustate->io->read_byte(M6803_PORT3) & (cpustate->port3_ddr ^ 0xff)));
13621455         }
r10115r10116
13671460            cpustate->port4_ddr = data;
13681461            if(cpustate->port4_ddr == 0xff)
13691462               cpustate->io->write_byte(M6803_PORT4,cpustate->port4_data);
1370            else
1463            else if (cpustate->port4_ddr)
13711464               cpustate->io->write_byte(M6803_PORT4,(cpustate->port4_data & cpustate->port4_ddr)
13721465                  | (cpustate->io->read_byte(M6803_PORT4) & (cpustate->port4_ddr ^ 0xff)));
13731466         }
r10115r10116
13761469         cpustate->port3_data = data;
13771470         if(cpustate->port3_ddr == 0xff)
13781471            cpustate->io->write_byte(M6803_PORT3,cpustate->port3_data);
1379         else
1472         else if (cpustate->port3_ddr)
13801473            cpustate->io->write_byte(M6803_PORT3,(cpustate->port3_data & cpustate->port3_ddr)
13811474               | (cpustate->io->read_byte(M6803_PORT3) & (cpustate->port3_ddr ^ 0xff)));
13821475         break;
r10115r10116
13841477         cpustate->port4_data = data;
13851478         if(cpustate->port4_ddr == 0xff)
13861479            cpustate->io->write_byte(M6803_PORT4,cpustate->port4_data);
1387         else
1480         else if (cpustate->port4_ddr)
13881481            cpustate->io->write_byte(M6803_PORT4,(cpustate->port4_data & cpustate->port4_ddr)
13891482               | (cpustate->io->read_byte(M6803_PORT4) & (cpustate->port4_ddr ^ 0xff)));
13901483         break;
r10115r10116
14291522         logerror("CPU '%s' PC %04x: warning - write %02x to unsupported internal register %02x\n",space->cpu->tag(),cpu_get_pc(space->cpu),data,offset);
14301523         break;
14311524      case 0x10:
1432         cpustate->rmcr = data & 0x0f;
1433
1434         switch ((cpustate->rmcr & M6800_RMCR_CC_MASK) >> 2)
1435         {
1436         case 0:
1437         case 3: // not implemented
1438            timer_enable(cpustate->m6800_rx_timer, 0);
1439            timer_enable(cpustate->m6800_tx_timer, 0);
1440            break;
1441
1442         case 1:
1443         case 2:
1444            {
1445               int divisor = M6800_RMCR_SS[cpustate->rmcr & M6800_RMCR_SS_MASK];
1446
1447               timer_adjust_periodic(cpustate->m6800_rx_timer, attotime_zero, 0, ATTOTIME_IN_HZ(cpustate->clock / divisor));
1448               timer_adjust_periodic(cpustate->m6800_tx_timer, attotime_zero, 0, ATTOTIME_IN_HZ(cpustate->clock / divisor));
1449            }
1450            break;
1451         }
1525         set_rmcr(cpustate, data);
14521526         break;
14531527      case 0x11:
14541528         if ((data & M6800_TRCSR_TE) && !(cpustate->trcsr & M6800_TRCSR_TE))
14551529         {
14561530            cpustate->txstate = M6800_TX_STATE_INIT;
1531            cpustate->txbits = 0;
1532            cpustate->tx = 1;
14571533         }
1534         
1535         if ((data & M6800_TRCSR_RE) && !(cpustate->trcsr & M6800_TRCSR_RE))
1536         {
1537            cpustate->rxbits = 0;
1538         }
1539
14581540         cpustate->trcsr = (cpustate->trcsr & 0xe0) | (data & 0x1f);
14591541         break;
14601542      case 0x13:
1461         if (cpustate->trcsr_read)
1543         //logerror("M6800 '%s' Transmit Data Register: %02x\n", space->cpu->tag(), data);
1544         if (cpustate->trcsr_read_tdre)
14621545         {
1463            cpustate->trcsr_read = 0;
1546            cpustate->trcsr_read_tdre = 0;
14641547            cpustate->trcsr &= ~M6800_TRCSR_TDRE;
14651548         }
14661549         cpustate->tdr = data;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team