Previous 199869 Revisions Next

r36308 Saturday 7th March, 2015 at 19:56:30 UTC by hap
small cleanup
[src/emu/cpu/hmcs40]hmcs40op.inc

trunk/src/emu/cpu/hmcs40/hmcs40op.inc
r244819r244820
44
55inline UINT8 hmcs40_cpu_device::ram_r()
66{
7   UINT8 address = (m_x << 4 | m_y) & m_datamask;
7   UINT16 address = (m_x << 4 | m_y) & m_datamask;
88   return m_data->read_byte(address) & 0xf;
99}
1010
1111inline void hmcs40_cpu_device::ram_w(UINT8 data)
1212{
13   UINT8 address = (m_x << 4 | m_y) & m_datamask;
13   UINT16 address = (m_x << 4 | m_y) & m_datamask;
1414   m_data->write_byte(address, data & 0xf);
1515}
1616
r244819r244820
4949   }
5050   
5151   if (m_is_cmos)
52      return inp & m_r[index];
52      return (inp & m_r[index]) & 0xf;
5353   else
54      return inp | m_r[index];
54      return (inp | m_r[index]) & 0xf;
5555}
5656
5757void hmcs40_cpu_device::write_r(int index, UINT8 data)
5858{
5959   index &= 7;
60   m_r[index] = data & 0xf;
60   data &= 0xf;
61   m_r[index] = data;
6162   
6263   switch (index)
6364   {
r244819r244820
8687{
8788   index &= 15;
8889   
89   m_d = (m_d & ~(1 << index)) | (state << index);
90   m_d = (m_d & ~(1 << index)) | (((state) ? 1 : 0) << index);
9091   m_write_d(index, m_d, 0xffff);
9192}
9293
r244819r244820
9697
9798UINT8 hmcs43_cpu_device::read_r(int index)
9899{
99   if ((index & 7) >= 4)
100      logerror("%s read from unknown port R%d at $%04X\n", tag(), index & 7, m_prev_pc << 1);
100   index &= 7;
101101   
102   if (index >= 2)
103      logerror("%s read from %s port R%d at $%04X\n", tag(), (index >= 4) ? "unknown" : "output", index, m_prev_pc << 1);
104
102105   return hmcs40_cpu_device::read_r(index);
103106}
104107
r244819r244820
114117
115118int hmcs43_cpu_device::read_d(int index)
116119{
117   if ((index & 15) >= 4)
120   index &= 15;
121   
122   if (index >= 4)
123   {
124      logerror("%s read from output pin D%d at $%04X\n", tag(), index, m_prev_pc << 1);
118125      return m_d >> index & 1;
126   }
119127   else
120128      return hmcs40_cpu_device::read_d(index);
121129}
r244819r244820
126134
127135UINT8 hmcs44_cpu_device::read_r(int index)
128136{
129   if ((index & 7) >= 6)
130      logerror("%s read from unknown port R%d at $%04X\n", tag(), index & 7, m_prev_pc << 1);
137   index &= 7;
131138   
139   if (index >= 6)
140      logerror("%s read from unknown port R%d at $%04X\n", tag(), index, m_prev_pc << 1);
141   
132142   return hmcs40_cpu_device::read_r(index);
133143}
134144
r244819r244820
148158
149159UINT8 hmcs45_cpu_device::read_r(int index)
150160{
151   if ((index & 7) == 7)
152      logerror("%s read from unknown port R%d at $%04X\n", tag(), index & 7, m_prev_pc << 1);
161   index &= 7;
153162   
163   if (index >= 6)
164      logerror("%s read from %s port R%d at $%04X\n", tag(), (index == 7) ? "unknown" : "output", index, m_prev_pc << 1);
165   
154166   return hmcs40_cpu_device::read_r(index);
155167}
156168
r244819r244820
215227   // determine MR(Memory Register) location
216228   UINT8 y = m_op & 0xf;
217229   UINT8 x = (y > 3) ? 0xf : (y + 12);
218   UINT8 address = (x << 4 | y) & m_datamask;
230   UINT16 address = (x << 4 | y) & m_datamask;
219231   
220232   UINT8 old_a = m_a;
221233   m_a = m_data->read_byte(address) & 0xf;
r244819r244820
555567void hmcs40_cpu_device::op_tm()
556568{
557569   // TM n: Test Memory Bit
558   m_s = ((ram_r() & (1 << (m_op & 3))) != 0);
570   m_s = ram_r() >> (m_op & 3) & 1;
559571}
560572
561573
r244819r244820
594606void hmcs40_cpu_device::op_tbr()
595607{
596608   // TBR p: Table Branch
597   m_pc = (m_a | m_b << 4 | m_c << 8 | (m_op & 7) << 9) & m_pcmask;
609   UINT16 address = m_a | m_b << 4 | m_c << 8 | (m_op & 7) << 9 | (m_pc & ~0x3f);
610   m_pc = address & m_pcmask;
598611}
599612
600613void hmcs40_cpu_device::op_rtn()
r244819r244820
781794{
782795   // P p: Pattern Generation
783796   m_icount--;
784   UINT16 address = (m_a | m_b << 4 | m_c << 8 | (m_op & 7) << 9) | (m_pc & ~0x3f);
797   UINT16 address = m_a | m_b << 4 | m_c << 8 | (m_op & 7) << 9 | (m_pc & ~0x3f);
785798   UINT16 o = m_program->read_word((address & m_prgmask) << 1);
786799   
787800   // destination is determined by the 2 highest bits


Previous 199869 Revisions Next


© 1997-2024 The MAME Team