Previous 199869 Revisions Next

r21073 Thursday 14th February, 2013 at 19:57:26 UTC by Wilbert Pol
(MESS) radio86.c orion.c: Reduce tagmap lookups (nw)
[src/mess/drivers]orion.c
[src/mess/includes]orion.h radio86.h
[src/mess/machine]orion.c radio86.c
[src/mess/video]orion.c

trunk/src/mess/machine/orion.c
r21072r21073
1111#include "emu.h"
1212#include "cpu/i8085/i8085.h"
1313#include "imagedev/cassette.h"
14#include "machine/mc146818.h"
1514#include "sound/speaker.h"
1615#include "sound/ay8910.h"
1716#include "includes/orion.h"
18#include "includes/radio86.h"
19#include "machine/ram.h"
2017
2118#define SCREEN_WIDTH_384 48
2219#define SCREEN_WIDTH_480 60
r21072r21073
2421
2522
2623
27
28
2924READ8_MEMBER(orion_state::orion_romdisk_porta_r)
3025{
31   UINT8 *romdisk = memregion("maincpu")->base() + 0x10000;
26   UINT8 *romdisk = m_region_maincpu->base() + 0x10000;
3227   return romdisk[m_romdisk_msb*256+m_romdisk_lsb];
3328}
3429
r21072r21073
6055
6156READ8_MEMBER(orion_state::orion128_system_r)
6257{
63   return machine().device<i8255_device>("ppi8255_2")->read(space, offset & 3);
58   return m_ppi8255_2->read(space, offset & 3);
6459}
6560
6661WRITE8_MEMBER(orion_state::orion128_system_w)
6762{
68   machine().device<i8255_device>("ppi8255_2")->write(space, offset & 3, data);
63   m_ppi8255_2->write(space, offset & 3, data);
6964}
7065
7166READ8_MEMBER(orion_state::orion128_romdisk_r)
7267{
73   return machine().device<i8255_device>("ppi8255_1")->read(space, offset & 3);
68   return m_ppi8255_1->read(space, offset & 3);
7469}
7570
7671WRITE8_MEMBER(orion_state::orion128_romdisk_w)
7772{
78   machine().device<i8255_device>("ppi8255_1")->write(space, offset & 3, data);
73   m_ppi8255_1->write(space, offset & 3, data);
7974}
8075
81static void orion_set_video_mode(running_machine &machine, int width)
76void orion_state::orion_set_video_mode(int width)
8277{
83      rectangle visarea(0, width-1, 0, 255);
84      machine.primary_screen->configure(width, 256, visarea, machine.primary_screen->frame_period().attoseconds);
78   rectangle visarea(0, width-1, 0, 255);
79   machine().primary_screen->configure(width, 256, visarea, machine().primary_screen->frame_period().attoseconds);
8580}
8681
8782WRITE8_MEMBER(orion_state::orion128_video_mode_w)
r21072r21073
9388         if (m_video_mode_mask == 31)
9489         {
9590            m_orion128_video_width = SCREEN_WIDTH_512;
96            orion_set_video_mode(machine(),512);
91            orion_set_video_mode(512);
9792         }
9893         else
9994         {
10095            m_orion128_video_width = SCREEN_WIDTH_480;
101            orion_set_video_mode(machine(),480);
96            orion_set_video_mode(480);
10297         }
10398      }
10499      else
105100      {
106101         m_orion128_video_width = SCREEN_WIDTH_384;
107         orion_set_video_mode(machine(),384);
102         orion_set_video_mode(384);
108103      }
109104   }
110105
r21072r21073
122117            if (m_video_mode_mask == 31)
123118            {
124119               m_orion128_video_width = SCREEN_WIDTH_512;
125               orion_set_video_mode(machine(),512);
120               orion_set_video_mode(512);
126121            }
127122            else
128123            {
129124               m_orion128_video_width = SCREEN_WIDTH_480;
130               orion_set_video_mode(machine(),480);
125               orion_set_video_mode(480);
131126            }
132127         }
133128         else
134129         {
135130            m_orion128_video_width = SCREEN_WIDTH_384;
136            orion_set_video_mode(machine(),384);
131            orion_set_video_mode(384);
137132         }
138133      }
139134   }
r21072r21073
145140{
146141   if (data!=m_orion128_memory_page )
147142   {
148      membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + (data & 3) * 0x10000);
143      m_bank1->set_base(m_ram->pointer() + (data & 3) * 0x10000);
149144      m_orion128_memory_page = (data & 3);
150145   }
151146}
r21072r21073
155150   m_orion128_video_page = 0;
156151   m_orion128_video_mode = 0;
157152   m_orion128_memory_page = -1;
158   membank("bank1")->set_base(memregion("maincpu")->base() + 0xf800);
159   membank("bank2")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xf000);
153   m_bank1->set_base(m_region_maincpu->base() + 0xf800);
154   m_bank2->set_base(m_ram->pointer() + 0xf000);
160155   m_orion128_video_width = SCREEN_WIDTH_384;
161   orion_set_video_mode(machine(),384);
162   radio86_init_keyboard(machine());
156   orion_set_video_mode(384);
157   radio86_init_keyboard();
163158}
164159
165160WRITE8_MEMBER(orion_state::orion_disk_control_w)
166161{
167   static const char *names[] = { "fd0", "fd1", "fd2", "fd3"};
168   floppy_image_device *floppy = NULL;
169   floppy_connector *con = machine().device<floppy_connector>(names[data & 3]);
170   if(con)
171      floppy = con->get_device();
162   floppy_connector *names[] = { m_fd0, m_fd1, m_fd2, m_fd3};
163   floppy_image_device *floppy = names[data & 3]->get_device();
172164
173165   m_fdc->set_floppy(floppy);
174166   floppy->mon_w(0);
r21072r21073
212204{
213205   if ((offset >= 0x60) && (offset <= 0x6f))
214206   {
215      return machine().device<mc146818_device>("rtc")->read(space,offset-0x60);
207      return m_rtc->read(space,offset-0x60);
216208   }
217209   else
218210   {
r21072r21073
224216{
225217   if ((offset >= 0x60) && (offset <= 0x6f))
226218   {
227      machine().device<mc146818_device>("rtc")->write(space,offset-0x60,data);
219      m_rtc->write(space,offset-0x60,data);
228220   }
229221   else
230222   {
r21072r21073
240232
241233WRITE8_MEMBER(orion_state::orionz80_sound_w)
242234{
243   device_t *speaker = machine().device(SPEAKER_TAG);
244   if (m_speaker == 0)
235   if (m_speaker_data == 0)
245236   {
246      m_speaker = data;
237      m_speaker_data = data;
247238   }
248239   else
249240   {
250      m_speaker = 0 ;
241      m_speaker_data = 0;
251242   }
252   speaker_level_w(speaker,m_speaker);
243   speaker_level_w(m_speaker,m_speaker_data);
253244
254245}
255246
256247WRITE8_MEMBER(orion_state::orionz80_sound_fe_w)
257248{
258   device_t *speaker = machine().device(SPEAKER_TAG);
259   speaker_level_w(speaker,(data>>4) & 0x01);
249   speaker_level_w(m_speaker,(data>>4) & 0x01);
260250}
261251
262252
263static void orionz80_switch_bank(running_machine &machine)
253void orion_state::orionz80_switch_bank()
264254{
265   orion_state *state = machine.driver_data<orion_state>();
266255   UINT8 bank_select;
267256   UINT8 segment_select;
268   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
257   address_space &space = m_maincpu->space(AS_PROGRAM);
269258
270   bank_select = (state->m_orionz80_dispatcher & 0x0c) >> 2;
271   segment_select = state->m_orionz80_dispatcher & 0x03;
259   bank_select = (m_orionz80_dispatcher & 0x0c) >> 2;
260   segment_select = m_orionz80_dispatcher & 0x03;
272261
273262   space.install_write_bank(0x0000, 0x3fff, "bank1");
274   if ((state->m_orionz80_dispatcher & 0x80)==0)
263   if ((m_orionz80_dispatcher & 0x80)==0)
275264   { // dispatcher on
276      state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x10000 * bank_select + segment_select * 0x4000 );
265      m_bank1->set_base(m_ram->pointer() + 0x10000 * bank_select + segment_select * 0x4000 );
277266   }
278267   else
279268   { // dispatcher off
280      state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x10000 * state->m_orionz80_memory_page);
269      m_bank1->set_base(m_ram->pointer() + 0x10000 * m_orionz80_memory_page);
281270   }
282271
283   state->membank("bank2")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x4000 + 0x10000 * state->m_orionz80_memory_page);
272   m_bank2->set_base(m_ram->pointer() + 0x4000 + 0x10000 * m_orionz80_memory_page);
284273
285   if ((state->m_orionz80_dispatcher & 0x20) == 0)
274   if ((m_orionz80_dispatcher & 0x20) == 0)
286275   {
287      space.install_write_handler(0xf400, 0xf4ff, write8_delegate(FUNC(orion_state::orion128_system_w),state));
288      space.install_write_handler(0xf500, 0xf5ff, write8_delegate(FUNC(orion_state::orion128_romdisk_w),state));
289      space.install_write_handler(0xf700, 0xf7ff, write8_delegate(FUNC(orion_state::orionz80_floppy_rtc_w),state));
290      space.install_read_handler(0xf400, 0xf4ff, read8_delegate(FUNC(orion_state::orion128_system_r),state));
291      space.install_read_handler(0xf500, 0xf5ff, read8_delegate(FUNC(orion_state::orion128_romdisk_r),state));
292      space.install_read_handler(0xf700, 0xf7ff, read8_delegate(FUNC(orion_state::orionz80_floppy_rtc_r),state));
276      space.install_write_handler(0xf400, 0xf4ff, write8_delegate(FUNC(orion_state::orion128_system_w),this));
277      space.install_write_handler(0xf500, 0xf5ff, write8_delegate(FUNC(orion_state::orion128_romdisk_w),this));
278      space.install_write_handler(0xf700, 0xf7ff, write8_delegate(FUNC(orion_state::orionz80_floppy_rtc_w),this));
279      space.install_read_handler(0xf400, 0xf4ff, read8_delegate(FUNC(orion_state::orion128_system_r),this));
280      space.install_read_handler(0xf500, 0xf5ff, read8_delegate(FUNC(orion_state::orion128_romdisk_r),this));
281      space.install_read_handler(0xf700, 0xf7ff, read8_delegate(FUNC(orion_state::orionz80_floppy_rtc_r),this));
293282
294      space.install_write_handler(0xf800, 0xf8ff, write8_delegate(FUNC(orion_state::orion128_video_mode_w),state));
295      space.install_write_handler(0xf900, 0xf9ff, write8_delegate(FUNC(orion_state::orionz80_memory_page_w),state));
296      space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(orion_state::orion128_video_page_w),state));
297      space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(orion_state::orionz80_dispatcher_w),state));
283      space.install_write_handler(0xf800, 0xf8ff, write8_delegate(FUNC(orion_state::orion128_video_mode_w),this));
284      space.install_write_handler(0xf900, 0xf9ff, write8_delegate(FUNC(orion_state::orionz80_memory_page_w),this));
285      space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(orion_state::orion128_video_page_w),this));
286      space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(orion_state::orionz80_dispatcher_w),this));
298287      space.unmap_write(0xfc00, 0xfeff);
299      space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),state));
288      space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),this));
300289
301      state->membank("bank3")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0xf000);
302      state->membank("bank5")->set_base(machine.root_device().memregion("maincpu")->base() + 0xf800);
290      m_bank3->set_base(m_ram->pointer() + 0xf000);
291      m_bank5->set_base(m_region_maincpu->base() + 0xf800);
303292
304293   }
305294   else
306295   {
307296      /* if it is full memory access */
308      state->membank("bank3")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0xf000 + 0x10000 * state->m_orionz80_memory_page);
309      state->membank("bank4")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0xf400 + 0x10000 * state->m_orionz80_memory_page);
310      state->membank("bank5")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0xf800 + 0x10000 * state->m_orionz80_memory_page);
297      m_bank3->set_base(m_ram->pointer() + 0xf000 + 0x10000 * m_orionz80_memory_page);
298      m_bank4->set_base(m_ram->pointer() + 0xf400 + 0x10000 * m_orionz80_memory_page);
299      m_bank5->set_base(m_ram->pointer() + 0xf800 + 0x10000 * m_orionz80_memory_page);
311300   }
312301}
313302
314303WRITE8_MEMBER(orion_state::orionz80_memory_page_w)
315304{
316305   m_orionz80_memory_page = data & 7;
317   orionz80_switch_bank(machine());
306   orionz80_switch_bank();
318307}
319308
320309WRITE8_MEMBER(orion_state::orionz80_dispatcher_w)
321310{
322311   m_orionz80_dispatcher = data;
323   orionz80_switch_bank(machine());
312   orionz80_switch_bank();
324313}
325314
326315MACHINE_RESET_MEMBER(orion_state,orionz80)
327316{
328   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
317   address_space &space = m_maincpu->space(AS_PROGRAM);
329318
330319   space.unmap_write(0x0000, 0x3fff);
331320   space.install_write_bank(0x4000, 0xefff, "bank2");
r21072r21073
346335   space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),this));
347336
348337
349   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0xf800);
350   membank("bank2")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x4000);
351   membank("bank3")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xf000);
352   membank("bank5")->set_base(memregion("maincpu")->base() + 0xf800);
338   m_bank1->set_base(m_region_maincpu->base() + 0xf800);
339   m_bank2->set_base(m_ram->pointer() + 0x4000);
340   m_bank3->set_base(m_ram->pointer() + 0xf000);
341   m_bank5->set_base(m_region_maincpu->base() + 0xf800);
353342
354343
355344   m_orion128_video_page = 0;
356345   m_orion128_video_mode = 0;
357346   m_orionz80_memory_page = 0;
358347   m_orionz80_dispatcher = 0;
359   m_speaker = 0;
348   m_speaker_data = 0;
360349   m_orion128_video_width = SCREEN_WIDTH_384;
361   orion_set_video_mode(machine(),384);
362   radio86_init_keyboard(machine());
350   orion_set_video_mode(384);
351   radio86_init_keyboard();
363352}
364353
365354INTERRUPT_GEN_MEMBER(orion_state::orionz80_interrupt)
r21072r21073
374363{
375364   if (offset == 0xFFFD)
376365   {
377      return ay8910_r (machine().device("ay8912"), space, 0);
366      return ay8910_r(m_ay8912, space, 0);
378367   }
379368   return 0xff;
380369}
r21072r21073
392381   }
393382   switch(offset)
394383   {
395      case 0xfffd : ay8910_address_w(machine().device("ay8912"), space, 0, data);
384      case 0xfffd : ay8910_address_w(m_ay8912, space, 0, data);
396385                  break;
397386      case 0xbffd :
398      case 0xbefd : ay8910_data_w(machine().device("ay8912"), space, 0, data);
387      case 0xbefd : ay8910_data_w(m_ay8912, space, 0, data);
399388                  break;
400389   }
401390}
r21072r21073
406395
407396
408397
409static void orionpro_bank_switch(running_machine &machine)
398void orion_state::orionpro_bank_switch()
410399{
411   orion_state *state = machine.driver_data<orion_state>();
412   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
413   int page = state->m_orionpro_page & 7; // we have only 8 pages
414   int is128 = (state->m_orionpro_dispatcher & 0x80) ? 1 : 0;
415   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
400   address_space &space = m_maincpu->space(AS_PROGRAM);
401   int page = m_orionpro_page & 7; // we have only 8 pages
402   int is128 = (m_orionpro_dispatcher & 0x80) ? 1 : 0;
403   UINT8 *ram = m_ram->pointer();
416404
417405   if (is128==1)
418406   {
419      page = state->m_orionpro_128_page & 7;
407      page = m_orionpro_128_page & 7;
420408   }
421409   space.install_write_bank(0x0000, 0x1fff, "bank1");
422410   space.install_write_bank(0x2000, 0x3fff, "bank2");
r21072r21073
428416   space.install_write_bank(0xf800, 0xffff, "bank8");
429417
430418
431   if ((state->m_orionpro_dispatcher & 0x01)==0x00)
419   if ((m_orionpro_dispatcher & 0x01)==0x00)
432420   {   // RAM0 segment disabled
433      state->membank("bank1")->set_base(ram + 0x10000 * page);
434      state->membank("bank2")->set_base(ram + 0x10000 * page + 0x2000);
421      m_bank1->set_base(ram + 0x10000 * page);
422      m_bank2->set_base(ram + 0x10000 * page + 0x2000);
435423   }
436424   else
437425   {
438      state->membank("bank1")->set_base(ram + (state->m_orionpro_ram0_segment & 31) * 0x4000);
439      state->membank("bank2")->set_base(ram + (state->m_orionpro_ram0_segment & 31) * 0x4000 + 0x2000);
426      m_bank1->set_base(ram + (m_orionpro_ram0_segment & 31) * 0x4000);
427      m_bank2->set_base(ram + (m_orionpro_ram0_segment & 31) * 0x4000 + 0x2000);
440428   }
441   if ((state->m_orionpro_dispatcher & 0x10)==0x10)
429   if ((m_orionpro_dispatcher & 0x10)==0x10)
442430   {   // ROM1 enabled
443431      space.unmap_write(0x0000, 0x1fff);
444      state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x20000);
432      m_bank1->set_base(m_region_maincpu->base() + 0x20000);
445433   }
446   if ((state->m_orionpro_dispatcher & 0x08)==0x08)
434   if ((m_orionpro_dispatcher & 0x08)==0x08)
447435   {   // ROM2 enabled
448436      space.unmap_write(0x2000, 0x3fff);
449      state->membank("bank2")->set_base(machine.root_device().memregion("maincpu")->base() + 0x22000 + (state->m_orionpro_rom2_segment & 7) * 0x2000);
437      m_bank2->set_base(m_region_maincpu->base() + 0x22000 + (m_orionpro_rom2_segment & 7) * 0x2000);
450438   }
451439
452   if ((state->m_orionpro_dispatcher & 0x02)==0x00)
440   if ((m_orionpro_dispatcher & 0x02)==0x00)
453441   {   // RAM1 segment disabled
454      state->membank("bank3")->set_base(ram + 0x10000 * page + 0x4000);
442      m_bank3->set_base(ram + 0x10000 * page + 0x4000);
455443   }
456444   else
457445   {
458      state->membank("bank3")->set_base(ram + (state->m_orionpro_ram1_segment & 31) * 0x4000);
446      m_bank3->set_base(ram + (m_orionpro_ram1_segment & 31) * 0x4000);
459447   }
460448
461   if ((state->m_orionpro_dispatcher & 0x04)==0x00)
449   if ((m_orionpro_dispatcher & 0x04)==0x00)
462450   {   // RAM2 segment disabled
463      state->membank("bank4")->set_base(ram + 0x10000 * page + 0x8000);
451      m_bank4->set_base(ram + 0x10000 * page + 0x8000);
464452   }
465453   else
466454   {
467      state->membank("bank4")->set_base(ram + (state->m_orionpro_ram2_segment & 31) * 0x4000);
455      m_bank4->set_base(ram + (m_orionpro_ram2_segment & 31) * 0x4000);
468456   }
469457
470   state->membank("bank5")->set_base(ram + 0x10000 * page + 0xc000);
458   m_bank5->set_base(ram + 0x10000 * page + 0xc000);
471459
472460   if (is128)
473461   {
474      state->membank("bank6")->set_base(ram + 0x10000 * 0 + 0xf000);
462      m_bank6->set_base(ram + 0x10000 * 0 + 0xf000);
475463
476      space.install_write_handler(0xf400, 0xf4ff, write8_delegate(FUNC(orion_state::orion128_system_w),state));
477      space.install_write_handler(0xf500, 0xf5ff, write8_delegate(FUNC(orion_state::orion128_romdisk_w),state));
464      space.install_write_handler(0xf400, 0xf4ff, write8_delegate(FUNC(orion_state::orion128_system_w),this));
465      space.install_write_handler(0xf500, 0xf5ff, write8_delegate(FUNC(orion_state::orion128_romdisk_w),this));
478466      space.unmap_write(0xf600, 0xf6ff);
479      space.install_write_handler(0xf700, 0xf7ff, write8_delegate(FUNC(orion_state::orion128_floppy_w),state));
480      space.install_read_handler(0xf400, 0xf4ff, read8_delegate(FUNC(orion_state::orion128_system_r),state));
481      space.install_read_handler(0xf500, 0xf5ff, read8_delegate(FUNC(orion_state::orion128_romdisk_r),state));
467      space.install_write_handler(0xf700, 0xf7ff, write8_delegate(FUNC(orion_state::orion128_floppy_w),this));
468      space.install_read_handler(0xf400, 0xf4ff, read8_delegate(FUNC(orion_state::orion128_system_r),this));
469      space.install_read_handler(0xf500, 0xf5ff, read8_delegate(FUNC(orion_state::orion128_romdisk_r),this));
482470      space.unmap_read(0xf600, 0xf6ff);
483      space.install_read_handler(0xf700, 0xf7ff, read8_delegate(FUNC(orion_state::orion128_floppy_r),state));
471      space.install_read_handler(0xf700, 0xf7ff, read8_delegate(FUNC(orion_state::orion128_floppy_r),this));
484472
485      space.install_write_handler(0xf800, 0xf8ff, write8_delegate(FUNC(orion_state::orion128_video_mode_w),state));
486      space.install_write_handler(0xf900, 0xf9ff, write8_delegate(FUNC(orion_state::orionpro_memory_page_w),state));
487      space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(orion_state::orion128_video_page_w),state));
473      space.install_write_handler(0xf800, 0xf8ff, write8_delegate(FUNC(orion_state::orion128_video_mode_w),this));
474      space.install_write_handler(0xf900, 0xf9ff, write8_delegate(FUNC(orion_state::orionpro_memory_page_w),this));
475      space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(orion_state::orion128_video_page_w),this));
488476      space.unmap_write(0xfb00, 0xfeff);
489      space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),state));
477      space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),this));
490478
491479
492      state->membank("bank8")->set_base(ram + 0x10000 * 0 + 0xf800);
480      m_bank8->set_base(ram + 0x10000 * 0 + 0xf800);
493481   }
494482   else
495483   {
496      if ((state->m_orionpro_dispatcher & 0x40)==0x40)
484      if ((m_orionpro_dispatcher & 0x40)==0x40)
497485      {   // FIX F000 enabled
498         state->membank("bank6")->set_base(ram + 0x10000 * 0 + 0xf000);
499         state->membank("bank7")->set_base(ram + 0x10000 * 0 + 0xf400);
500         state->membank("bank8")->set_base(ram + 0x10000 * 0 + 0xf800);
486         m_bank6->set_base(ram + 0x10000 * 0 + 0xf000);
487         m_bank7->set_base(ram + 0x10000 * 0 + 0xf400);
488         m_bank8->set_base(ram + 0x10000 * 0 + 0xf800);
501489      }
502490      else
503491      {
504         state->membank("bank6")->set_base(ram + 0x10000 * page + 0xf000);
505         state->membank("bank7")->set_base(ram + 0x10000 * page + 0xf400);
506         state->membank("bank8")->set_base(ram + 0x10000 * page + 0xf800);
492         m_bank6->set_base(ram + 0x10000 * page + 0xf000);
493         m_bank7->set_base(ram + 0x10000 * page + 0xf400);
494         m_bank8->set_base(ram + 0x10000 * page + 0xf800);
507495      }
508496   }
509497}
r21072r21073
511499WRITE8_MEMBER(orion_state::orionpro_memory_page_w)
512500{
513501   m_orionpro_128_page = data;
514   orionpro_bank_switch(machine());
502   orionpro_bank_switch();
515503}
516504
517505MACHINE_RESET_MEMBER(orion_state,orionpro)
518506{
519   radio86_init_keyboard(machine());
507   radio86_init_keyboard();
520508
521509   m_orion128_video_page = 0;
522510   m_orion128_video_mode = 0;
r21072r21073
529517   m_orionpro_rom2_segment = 0;
530518
531519   m_orionpro_dispatcher = 0x50;
532   orionpro_bank_switch(machine());
520   orionpro_bank_switch();
533521
534   m_speaker = 0;
522   m_speaker_data = 0;
535523   m_orion128_video_width = SCREEN_WIDTH_384;
536   orion_set_video_mode(machine(),384);
524   orion_set_video_mode(384);
537525
538526   m_video_mode_mask = 31;
539527   m_orionpro_pseudo_color = 0;
r21072r21073
566554   }
567555   if (offset == 0xFFFD)
568556   {
569      return ay8910_r (machine().device("ay8912"), space, 0);
557      return ay8910_r(m_ay8912, space, 0);
570558   }
571559   return 0xff;
572560}
r21072r21073
575563{
576564   switch (offset & 0xff)
577565   {
578      case 0x04 : m_orionpro_ram0_segment = data; orionpro_bank_switch(machine()); break;
579      case 0x05 : m_orionpro_ram1_segment = data; orionpro_bank_switch(machine()); break;
580      case 0x06 : m_orionpro_ram2_segment = data; orionpro_bank_switch(machine()); break;
581      case 0x08 : m_orionpro_page = data;       orionpro_bank_switch(machine()); break;
582      case 0x09 : m_orionpro_rom2_segment = data; orionpro_bank_switch(machine()); break;
583      case 0x0a : m_orionpro_dispatcher = data;   orionpro_bank_switch(machine()); break;
566      case 0x04 : m_orionpro_ram0_segment = data; orionpro_bank_switch(); break;
567      case 0x05 : m_orionpro_ram1_segment = data; orionpro_bank_switch(); break;
568      case 0x06 : m_orionpro_ram2_segment = data; orionpro_bank_switch(); break;
569      case 0x08 : m_orionpro_page = data;       orionpro_bank_switch(); break;
570      case 0x09 : m_orionpro_rom2_segment = data; orionpro_bank_switch(); break;
571      case 0x0a : m_orionpro_dispatcher = data;   orionpro_bank_switch(); break;
584572      case 0x10 : m_fdc->cmd_w(space, 0,data); break;
585573      case 0x11 : m_fdc->track_w(space, 0,data);break;
586574      case 0x12 : m_fdc->sector_w(space, 0,data);break;
r21072r21073
596584      case 0x2a : orion128_romdisk_w(space,2,data); break;
597585      case 0x2b : orion128_romdisk_w(space,3,data); break;
598586      case 0xf8 : orion128_video_mode_w(space,0,data);break;
599      case 0xf9 : m_orionpro_128_page = data;   orionpro_bank_switch(machine()); break;
587      case 0xf9 : m_orionpro_128_page = data;   orionpro_bank_switch(); break;
600588      case 0xfa : orion128_video_page_w(space,0,data);break;
601589      case 0xfc : m_orionpro_pseudo_color = data;break;
602590      case 0xfe : orionz80_sound_fe_w(space,0,data);break;
r21072r21073
604592   }
605593   switch(offset)
606594   {
607      case 0xfffd : ay8910_address_w(machine().device("ay8912"), space, 0, data);
595      case 0xfffd : ay8910_address_w(m_ay8912, space, 0, data);
608596                  break;
609597      case 0xbffd :
610      case 0xbefd : ay8910_data_w(machine().device("ay8912"), space, 0, data);
598      case 0xbefd : ay8910_data_w(m_ay8912, space, 0, data);
611599                  break;
612600   }
613601}
trunk/src/mess/machine/radio86.c
r21072r21073
99
1010#include "emu.h"
1111#include "cpu/i8085/i8085.h"
12#include "imagedev/cassette.h"
1312#include "machine/i8255.h"
1413#include "machine/8257dma.h"
1514#include "video/i8275.h"
r21072r21073
1716
1817
1918
20void radio86_init_keyboard(running_machine &machine)
19void radio86_state::radio86_init_keyboard()
2120{
22   radio86_state *state = machine.driver_data<radio86_state>();
23   state->m_keyboard_mask = 0;
24   state->m_tape_value = 0x10;
21   m_keyboard_mask = 0;
22   m_tape_value = 0x10;
2523}
2624
2725/* Driver initialization */
2826DRIVER_INIT_MEMBER(radio86_state,radio86)
2927{
3028   /* set initialy ROM to be visible on first bank */
31   UINT8 *RAM = memregion("maincpu")->base();
29   UINT8 *RAM = m_region_maincpu->base();
3230   memset(RAM,0x0000,0x1000); // make frist page empty by default
33   membank("bank1")->configure_entries(1, 2, RAM, 0x0000);
34   membank("bank1")->configure_entries(0, 2, RAM, 0xf800);
35   radio86_init_keyboard(machine());
31   m_bank1->configure_entries(1, 2, RAM, 0x0000);
32   m_bank1->configure_entries(0, 2, RAM, 0xf800);
33   radio86_init_keyboard();
3634}
3735
3836DRIVER_INIT_MEMBER(radio86_state,radioram)
r21072r21073
4442READ8_MEMBER(radio86_state::radio86_8255_portb_r2)
4543{
4644   UINT8 key = 0xff;
47   if ((m_keyboard_mask & 0x01)!=0) { key &= ioport("LINE0")->read(); }
48   if ((m_keyboard_mask & 0x02)!=0) { key &= machine().root_device().ioport("LINE1")->read(); }
49   if ((m_keyboard_mask & 0x04)!=0) { key &= machine().root_device().ioport("LINE2")->read(); }
50   if ((m_keyboard_mask & 0x08)!=0) { key &= machine().root_device().ioport("LINE3")->read(); }
51   if ((m_keyboard_mask & 0x10)!=0) { key &= machine().root_device().ioport("LINE4")->read(); }
52   if ((m_keyboard_mask & 0x20)!=0) { key &= machine().root_device().ioport("LINE5")->read(); }
53   if ((m_keyboard_mask & 0x40)!=0) { key &= machine().root_device().ioport("LINE6")->read(); }
54   if ((m_keyboard_mask & 0x80)!=0) { key &= machine().root_device().ioport("LINE7")->read(); }
45   if ((m_keyboard_mask & 0x01)!=0) { key &= m_io_line0->read(); }
46   if ((m_keyboard_mask & 0x02)!=0) { key &= m_io_line1->read(); }
47   if ((m_keyboard_mask & 0x04)!=0) { key &= m_io_line2->read(); }
48   if ((m_keyboard_mask & 0x08)!=0) { key &= m_io_line3->read(); }
49   if ((m_keyboard_mask & 0x10)!=0) { key &= m_io_line4->read(); }
50   if ((m_keyboard_mask & 0x20)!=0) { key &= m_io_line5->read(); }
51   if ((m_keyboard_mask & 0x40)!=0) { key &= m_io_line6->read(); }
52   if ((m_keyboard_mask & 0x80)!=0) { key &= m_io_line7->read(); }
5553   return key;
5654}
5755
5856READ8_MEMBER(radio86_state::radio86_8255_portc_r2)
5957{
60   double level = (machine().device<cassette_image_device>(CASSETTE_TAG)->input());
61   UINT8 dat = ioport("LINE8")->read();
58   double level = m_cassette->input();
59   UINT8 dat = m_io_line8->read();
6260   if (level <  0) {
6361      dat ^= m_tape_value;
6462   }
r21072r21073
7270
7371WRITE8_MEMBER(radio86_state::radio86_8255_portc_w2)
7472{
75   machine().device<cassette_image_device>(CASSETTE_TAG)->output(data & 0x01 ? 1 : -1);
73   m_cassette->output(data & 0x01 ? 1 : -1);
7674}
7775
7876
r21072r21073
10098
10199READ8_MEMBER(radio86_state::rk7007_8255_portc_r)
102100{
103   double level = (machine().device<cassette_image_device>(CASSETTE_TAG)->input());
101   double level = m_cassette->input();
104102   UINT8 key = 0xff;
105   if ((m_keyboard_mask & 0x01)!=0) { key &= ioport("CLINE0")->read(); }
106   if ((m_keyboard_mask & 0x02)!=0) { key &= machine().root_device().ioport("CLINE1")->read(); }
107   if ((m_keyboard_mask & 0x04)!=0) { key &= machine().root_device().ioport("CLINE2")->read(); }
108   if ((m_keyboard_mask & 0x08)!=0) { key &= machine().root_device().ioport("CLINE3")->read(); }
109   if ((m_keyboard_mask & 0x10)!=0) { key &= machine().root_device().ioport("CLINE4")->read(); }
110   if ((m_keyboard_mask & 0x20)!=0) { key &= machine().root_device().ioport("CLINE5")->read(); }
111   if ((m_keyboard_mask & 0x40)!=0) { key &= machine().root_device().ioport("CLINE6")->read(); }
112   if ((m_keyboard_mask & 0x80)!=0) { key &= machine().root_device().ioport("CLINE7")->read(); }
103   if ((m_keyboard_mask & 0x01)!=0) { key &= m_io_cline0->read(); }
104   if ((m_keyboard_mask & 0x02)!=0) { key &= m_io_cline1->read(); }
105   if ((m_keyboard_mask & 0x04)!=0) { key &= m_io_cline2->read(); }
106   if ((m_keyboard_mask & 0x08)!=0) { key &= m_io_cline3->read(); }
107   if ((m_keyboard_mask & 0x10)!=0) { key &= m_io_cline4->read(); }
108   if ((m_keyboard_mask & 0x20)!=0) { key &= m_io_cline5->read(); }
109   if ((m_keyboard_mask & 0x40)!=0) { key &= m_io_cline6->read(); }
110   if ((m_keyboard_mask & 0x80)!=0) { key &= m_io_cline7->read(); }
113111   key &= 0xe0;
114112   if (level <  0) {
115113      key ^= m_tape_value;
r21072r21073
130128WRITE_LINE_MEMBER(radio86_state::hrq_w)
131129{
132130   /* HACK - this should be connected to the BUSREQ line of Z80 */
133   machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, state);
131   m_maincpu->set_input_line(INPUT_LINE_HALT, state);
134132
135133   /* HACK - this should be connected to the BUSACK line of Z80 */
136   i8257_hlda_w(machine().device("dma8257"), state);
134   i8257_hlda_w(m_dma8257, state);
137135}
138136
139137static UINT8 memory_read_byte(address_space &space, offs_t address, UINT8 mem_mask) { return space.read_byte(address); }
r21072r21073
152150
153151TIMER_CALLBACK_MEMBER(radio86_state::radio86_reset)
154152{
155   membank("bank1")->set_entry(0);
153   m_bank1->set_entry(0);
156154}
157155
158156
r21072r21073
163161
164162READ8_MEMBER(radio86_state::radio_io_r)
165163{
166   return machine().device("maincpu")->memory().space(AS_PROGRAM).read_byte((offset << 8) + offset);
164   return m_maincpu->space(AS_PROGRAM).read_byte((offset << 8) + offset);
167165}
168166
169167WRITE8_MEMBER(radio86_state::radio_io_w)
170168{
171   machine().device("maincpu")->memory().space(AS_PROGRAM).write_byte((offset << 8) + offset,data);
169   m_maincpu->space(AS_PROGRAM).write_byte((offset << 8) + offset,data);
172170}
173171
174172MACHINE_RESET_MEMBER(radio86_state,radio86)
175173{
176174   machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(radio86_state::radio86_reset),this));
177   membank("bank1")->set_entry(1);
175   m_bank1->set_entry(1);
178176
179177   m_keyboard_mask = 0;
180178   m_disk_sel = 0;
r21072r21073
188186
189187READ8_MEMBER(radio86_state::radio86_romdisk_porta_r)
190188{
191   UINT8 *romdisk = memregion("maincpu")->base() + 0x10000;
189   UINT8 *romdisk = m_region_maincpu->base() + 0x10000;
192190   if ((m_disk_sel & 0x0f) ==0) {
193191      return romdisk[m_romdisk_msb*256+m_romdisk_lsb];
194192   } else {
trunk/src/mess/includes/radio86.h
r21072r21073
1010#include "machine/i8255.h"
1111#include "machine/8257dma.h"
1212#include "video/i8275.h"
13#include "imagedev/cassette.h"
1314
15
1416class radio86_state : public driver_device
1517{
1618public:
1719   radio86_state(const machine_config &mconfig, device_type type, const char *tag)
18      : driver_device(mconfig, type, tag) { }
20      : driver_device(mconfig, type, tag)
21      , m_maincpu(*this, "maincpu")
22      , m_cassette(*this, CASSETTE_TAG)
23      , m_dma8257(*this, "dma8257")
24      , m_ppi8255_1(*this, "ppi8255_1")
25      , m_ppi8255_2(*this, "ppi8255_2")
26      , m_region_maincpu(*this, "maincpu")
27      , m_bank1(*this, "bank1")
28      , m_io_line0(*this, "LINE0")
29      , m_io_line1(*this, "LINE1")
30      , m_io_line2(*this, "LINE2")
31      , m_io_line3(*this, "LINE3")
32      , m_io_line4(*this, "LINE4")
33      , m_io_line5(*this, "LINE5")
34      , m_io_line6(*this, "LINE6")
35      , m_io_line7(*this, "LINE7")
36      , m_io_line8(*this, "LINE8")
37      , m_io_cline0(*this, "CLINE0")
38      , m_io_cline1(*this, "CLINE1")
39      , m_io_cline2(*this, "CLINE2")
40      , m_io_cline3(*this, "CLINE3")
41      , m_io_cline4(*this, "CLINE4")
42      , m_io_cline5(*this, "CLINE5")
43      , m_io_cline6(*this, "CLINE6")
44      , m_io_cline7(*this, "CLINE7")
45   { }
1946
2047   virtual void video_start();
2148
r21072r21073
4673   DECLARE_WRITE8_MEMBER(radio86_romdisk_portb_w);
4774   DECLARE_WRITE8_MEMBER(radio86_romdisk_portc_w);
4875   DECLARE_WRITE8_MEMBER(mikrosha_8255_font_page_w);
76
77protected:
78   required_device<cpu_device> m_maincpu;
79   required_device<cassette_image_device> m_cassette;
80   optional_device<device_t> m_dma8257;
81   required_device<i8255_device> m_ppi8255_1;
82   optional_device<i8255_device> m_ppi8255_2;
83   required_memory_region m_region_maincpu;
84   required_memory_bank m_bank1;
85   required_ioport m_io_line0;
86   required_ioport m_io_line1;
87   required_ioport m_io_line2;
88   required_ioport m_io_line3;
89   required_ioport m_io_line4;
90   required_ioport m_io_line5;
91   required_ioport m_io_line6;
92   required_ioport m_io_line7;
93   required_ioport m_io_line8;
94   optional_ioport m_io_cline0;
95   optional_ioport m_io_cline1;
96   optional_ioport m_io_cline2;
97   optional_ioport m_io_cline3;
98   optional_ioport m_io_cline4;
99   optional_ioport m_io_cline5;
100   optional_ioport m_io_cline6;
101   optional_ioport m_io_cline7;
102
103   void radio86_init_keyboard();
49104};
50105
51106
trunk/src/mess/includes/orion.h
r21072r21073
1010#include "machine/wd_fdc.h"
1111#include "includes/radio86.h"
1212#include "machine/i8255.h"
13#include "machine/ram.h"
14#include "machine/mc146818.h"
15#include "sound/speaker.h"
1316
17
1418class orion_state : public radio86_state
1519{
1620public:
1721   orion_state(const machine_config &mconfig, device_type type, const char *tag)
18      : radio86_state(mconfig, type, tag),
19         m_fdc(*this, "fd1793")
20      { }
22      : radio86_state(mconfig, type, tag)
23      , m_fdc(*this, "fd1793")
24      , m_ram(*this, RAM_TAG)
25      , m_fd0(*this, "fd0")
26      , m_fd1(*this, "fd1")
27      , m_fd2(*this, "fd2")
28      , m_fd3(*this, "fd3")
29      , m_rtc(*this, "rtc")
30      , m_speaker(*this, SPEAKER_TAG)
31      , m_ay8912(*this, "ay8912")
32      , m_bank2(*this, "bank2")
33      , m_bank3(*this, "bank3")
34      , m_bank4(*this, "bank4")
35      , m_bank5(*this, "bank5")
36      , m_bank6(*this, "bank6")
37      , m_bank7(*this, "bank7")
38      , m_bank8(*this, "bank8")
39   { }
2140
2241   UINT8 m_orion128_video_mode;
2342   UINT8 m_orion128_video_page;
r21072r21073
2948   UINT8 m_orion128_memory_page;
3049   UINT8 m_orionz80_memory_page;
3150   UINT8 m_orionz80_dispatcher;
32   UINT8 m_speaker;
51   UINT8 m_speaker_data;
3352   UINT8 m_orionpro_ram0_segment;
3453   UINT8 m_orionpro_ram1_segment;
3554   UINT8 m_orionpro_ram2_segment;
r21072r21073
7493   DECLARE_WRITE8_MEMBER(orion_romdisk_portb_w);
7594   DECLARE_WRITE8_MEMBER(orion_romdisk_portc_w);
7695   DECLARE_FLOPPY_FORMATS( orion_floppy_formats );
96
97protected:
98   required_device<ram_device> m_ram;
99   required_device<floppy_connector> m_fd0;
100   required_device<floppy_connector> m_fd1;
101   required_device<floppy_connector> m_fd2;
102   required_device<floppy_connector> m_fd3;
103   optional_device<mc146818_device> m_rtc;
104   optional_device<device_t> m_speaker;
105   optional_device<device_t> m_ay8912;
106   required_memory_bank m_bank2;
107   optional_memory_bank m_bank3;
108   optional_memory_bank m_bank4;
109   optional_memory_bank m_bank5;
110   optional_memory_bank m_bank6;
111   optional_memory_bank m_bank7;
112   optional_memory_bank m_bank8;
113
114   void orionz80_switch_bank();
115   void orion_set_video_mode(int width);
116   void orionpro_bank_switch();
77117};
78118
79119/*----------- defined in machine/orion.c -----------*/
trunk/src/mess/video/orion.c
r21072r21073
1010
1111#include "emu.h"
1212#include "includes/orion.h"
13#include "machine/ram.h"
1413
1514VIDEO_START_MEMBER(orion_state,orion128)
1615{
r21072r21073
2423   int part1addr = (3-((m_orion128_video_page & 3) | orionproshift)) * 0x4000;
2524   int part2addr = part1addr + 0x10000;
2625   int video_mode = m_orion128_video_mode & m_video_mode_mask;
27   UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
26   UINT8 *ram = m_ram->pointer();
2827
2928   for (x = 0; x < m_orion128_video_width; x++)
3029   {
trunk/src/mess/drivers/orion.c
r21072r21073
1212#include "cpu/z80/z80.h"
1313#include "cpu/i8085/i8085.h"
1414#include "sound/ay8910.h"
15#include "sound/speaker.h"
1615#include "sound/wave.h"
17#include "machine/mc146818.h"
1816#include "imagedev/cassette.h"
1917#include "imagedev/cartslot.h"
2018#include "formats/smx_dsk.h"
2119#include "formats/rk_cas.h"
2220#include "includes/orion.h"
23#include "machine/ram.h"
2421
2522/* Address maps */
2623

Previous 199869 Revisions Next


© 1997-2024 The MAME Team