Previous 15994 Revisions Next

r2637 Friday 16th May, 2008 at 14:20:36 UTC by Curt Coder
[COMX35] Added memory refresh DMA, fixed reset time constant, added reset key, fixed CDP1871 DA/RPT line on power up, added DOS ROM mirroring.
[src/mess/drivers]comx35.c
[src/mess/includes]comx35.h
[src/mess/machine]cdp1871.c comx35.c

src/mess/includes/comx35.h
r2636r2637
3232   int cdp1802_mode;      /* CPU mode */
3333   int cdp1802_q;         /* Q flag */
3434   int cdp1802_ef4;      /* EF4 flag */
35   int iden;            /* interrupt enable */
35   int iden;            /* interrupt/DMA enable */
3636   int slot;            /* selected slot */
3737   int bank;            /* selected device bank */
38   int dma;            /* memory refresh DMA */
3839 
3940   /* video state */
4041   int pal_ntsc;         /* PAL/NTSC */
r2636r2637
5455 
5556   /* timers */
5657   emu_timer *reset_timer;   /* power on reset timer */
57   emu_timer *dma_timer;   /* memory refresh timer */
5858};
5959 
6060/* ---------- defined in machine/comx35.c ---------- */
r2636r2637
6767MACHINE_START( comx35p );
6868MACHINE_START( comx35n );
6969MACHINE_RESET( comx35 );
70INPUT_CHANGED( comx35_reset );
7071 
7172DEVICE_IMAGE_LOAD( comx35_floppy );
7273QUICKLOAD_LOAD( comx35 );
src/mess/machine/cdp1871.c
r2636r2637
305305   assert(cdp1871->intf != NULL);
306306   assert(cdp1871->intf->clock > 0);
307307 
308   /* set initial values */
309   cdp1871->next_da = 1;
310   cdp1871->next_rpt = 1;
311   change_output_lines(device);
312   
308313   /* create the timers */
309314   cdp1871->scan_timer = timer_alloc(cdp1871_scan_tick, (void *)device);
310315   timer_adjust_periodic(cdp1871->scan_timer, attotime_zero, 0, ATTOTIME_IN_HZ(cdp1871->intf->clock));
src/mess/machine/comx35.c
r2636r2637
77#include "video/cdp1869.h"
88#include "video/mc6845.h"
99#include "includes/comx35.h"
10#include "rescap.h"
1011 
1112enum
1213{
r2636r2637
3031   return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer");
3132}
3233 
34static int expansion_box_installed(void)
35{
36   return (memory_region(REGION_CPU1)[0xe800] != 0xff);
37}
38 
39static int dos_card_active(running_machine *machine)
40{
41   comx35_state *state = machine->driver_data;
42 
43   if (expansion_box_installed())
44   {
45      return (state->bank == BANK_FLOPPY);
46   }
47   else
48   {
49      return input_port_read(machine, "EXPANSION") == BANK_FLOPPY;
50   }
51}
52 
3353/* Floppy Disc Controller */
3454 
3555DEVICE_IMAGE_LOAD( comx35_floppy )
r2636r2637
241261   comx35_state *state = machine->driver_data;
242262   int bank = 0;
243263 
244   if (memory_region(REGION_CPU1)[0xe000] != 0xff)
264   if (expansion_box_installed())
245265   {
246266      // expansion box
247267 
r2636r2637
448468 
449469/* Machine Initialization */
450470 
451static TIMER_CALLBACK( dma_tick )
471static TIMER_CALLBACK( reset_tick )
452472{
453473   comx35_state *state = machine->driver_data;
454474 
455   if (!state->iden)
456   {
457   //   cpunum_set_input_line(device->machine, 0, CDP1802_INPUT_LINE_DMAOUT, ASSERT_LINE);
458   //   cpunum_set_input_line(device->machine, 0, CDP1802_INPUT_LINE_DMAOUT, CLEAR_LINE);
459   }
475   state->cdp1802_mode = CDP1802_MODE_RUN;
460476}
461477 
462static TIMER_CALLBACK( reset_tick )
478static OPBASE_HANDLER( comx35_opbase_handler )
463479{
464   comx35_state *state = machine->driver_data;
480   if (address >= 0x0dd0 && address <= 0x0ddf)
481   {
482      if (dos_card_active(machine))
483      {
484         // read opcode from DOS ROM
485         opbase->rom = opbase->ram = memory_region(REGION_USER1);
486         return ~0;
487      }
488   }
465489 
466   state->cdp1802_mode = CDP1802_MODE_RUN;
490   return address;
467491}
468492 
469493MACHINE_START( comx35p )
470494{
471495   comx35_state *state = machine->driver_data;
472496 
497   // opbase handling for DOS Card
498 
499   memory_set_opbase_handler(0, comx35_opbase_handler);
500 
473501   // card slot banking
474502 
475503   memory_configure_bank(1, 0, 1, memory_region(REGION_CPU1), 0xc000);
r2636r2637
478506 
479507   memory_set_bank(1, 0);
480508 
481   // allocate DMA timer
509   if (!expansion_box_installed())
510   {
511      state->bank = input_port_read(machine, "EXPANSION");
512   }
482513 
483   state->dma_timer = timer_alloc(dma_tick, NULL);
484   timer_adjust_periodic(state->dma_timer, attotime_zero, 0, ATTOTIME_IN_HZ(CDP1869_CPU_CLK_PAL / 8));
485 
486514   // allocate reset timer
487515   
488516   state->reset_timer = timer_alloc(reset_tick, NULL);
r2636r2637
504532   state_save_register_global(state->cdp1802_ef4);
505533   state_save_register_global(state->iden);
506534   state_save_register_global(state->slot);
507
535   state_save_register_global(state->dma);
508536   state_save_register_global(state->pal_ntsc);
509537   state_save_register_global(state->cdp1869_prd);
510538 
r2636r2637
522550 
523551   MACHINE_START_CALL(comx35p);
524552 
525   timer_adjust_periodic(state->dma_timer, attotime_zero, 0, ATTOTIME_IN_HZ(CDP1869_CPU_CLK_NTSC / 8));
526 
527553   // screen format
528554 
529555   state->pal_ntsc = CDP1869_NTSC;
r2636r2637
532558MACHINE_RESET( comx35 )
533559{
534560   comx35_state *state = machine->driver_data;
561   int t = RES_K(27) * CAP_U(1) * 1000; // t = R1 * C1
535562 
536563   state->cdp1802_mode = CDP1802_MODE_RESET;
537564   state->iden = 1;
538565 
539   timer_adjust_oneshot(state->reset_timer, ATTOTIME_IN_MSEC(200), 0);
566   timer_adjust_oneshot(state->reset_timer, ATTOTIME_IN_MSEC(t), 0);
540567}
541568 
569INPUT_CHANGED( comx35_reset )
570{
571   if (BIT(input_port_read(machine, "RESET"), 0) && BIT(input_port_read(machine, "D6"), 7))
572   {
573      MACHINE_RESET_CALL(comx35);
574   }
575}
576 
542577/* Quickload */
543578 
544579static void image_fread_memory(const device_config *image, UINT16 addr, UINT32 count)
src/mess/drivers/comx35.c
r2636r2637
22 
33   TODO:
44 
5   - empty keyboard buffer at startup
5   - enter key in F&M BASIC 3.1
6   - improve key mappings
7   - unreliable DOS commands
68   - F&M joycard detection
7   - DOS ROM mirror @ 0xdd0-0xddf
8   - DOS CAT halts after version prompt
9   - fix CDP1869 scrolling
10   - ROM_COPY only when bioses used
11   - power on reset timeout value?
12   - reset on SPACE+RESET
13   - DMA memory refresh
9   - configure bioses properly
10   - detect 70-track disk images
1411 
1512   - tape
1613   - PL-80 plotter
r2636r2637
6562#define COMX35_DEVICES \
6663   PORT_CONFSETTING( 0x00, DEF_STR( None ) ) \
6764   PORT_CONFSETTING( 0x01, "DOS Card" ) \
68   PORT_CONFSETTING( 0x02, "Standard Printer Card" ) \
69   PORT_CONFSETTING( 0x03, "Standard Printer Card (F&M)" ) \
70   PORT_CONFSETTING( 0x04, "Serial Printer Card" ) \
71   PORT_CONFSETTING( 0x05, "Thermal Printer Card" ) \
65   PORT_CONFSETTING( 0x02, "Parallel Output Interface" ) \
66   PORT_CONFSETTING( 0x03, "Parallel Output Interface (F&M)" ) \
67   PORT_CONFSETTING( 0x04, "RS-232C Serial Output Interface" ) \
68   PORT_CONFSETTING( 0x05, "Thermal Printer Interface" ) \
7269   PORT_CONFSETTING( 0x06, "F&M Joycard" ) \
73   PORT_CONFSETTING( 0x07, "80 Column Card" ) \
70   PORT_CONFSETTING( 0x07, "80-Column Card" ) \
7471   PORT_CONFSETTING( 0x08, "RAM Card" )
7572 
7673static INPUT_PORTS_START( comx35 )
r2636r2637
162159   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
163160 
164161   PORT_START_TAG("RESET")
165   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RT") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))
162   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RT") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_CHANGED(comx35_reset, NULL)
166163 
167164   PORT_START_TAG("JOY1")
168165   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )    PORT_PLAYER(1) PORT_8WAY
r2636r2637
188185   PORT_CONFSETTING( 0x03, "COMX PL-80 Plotter" )
189186 
190187   PORT_START_TAG("EXPANSION")
191   PORT_CONFNAME( 0x0f, 0x00, "Expansion (without Expansion Box)")
188   PORT_CONFNAME( 0x0f, 0x00, "Expansion Slot")
192189   COMX35_DEVICES
193190 
194191   PORT_START_TAG("SLOT1")
r2636r2637
230227        EF4     cassette in (ear)
231228    */
232229 
230   // CDP1869 predisplay
233231   if (!state->cdp1869_prd) flags -= EF1;
234232 
235233   if (state->iden)
236234   {
235      // interrupts disabled: PAL/NTSC
237236      if (!state->pal_ntsc) flags -= EF2;
238237   }
239238   else
240239   {
240      // interrupts enabled: keyboard repeat
241241      if (!state->cdp1871_efxb) flags -= EF2;
242242   }
243243 
244   // keyboard data available
244245   if (!state->cdp1871_efxa) flags -= EF3;
245246 
247   // cassette input, expansion device flag
246248   if (!state->cdp1802_ef4 || cassette_input(cassette_device_image()) > +1.0) flags -= EF4;
247249 
248250   return flags;
r2636r2637
250252 
251253static CDP1802_SC_WRITE( comx35_sc_w )
252254{
253   if (state == CDP1802_STATE_CODE_S3_INTERRUPT)
255   comx35_state *driver_state = machine->driver_data;
256 
257   switch (state)
254258   {
259   case CDP1802_STATE_CODE_S0_FETCH:
260      // not connected
261      break;
262 
263   case CDP1802_STATE_CODE_S1_EXECUTE:
264      // every other S1 triggers a DMAOUT request
265      if (driver_state->dma)
266      {
267         driver_state->dma = 0;
268 
269         if (!driver_state->iden)
270         {
271            cpunum_set_input_line(machine, 0, CDP1802_INPUT_LINE_DMAOUT, HOLD_LINE);
272         }
273      }
274      else
275      {
276         driver_state->dma = 1;
277      }
278      break;
279 
280   case CDP1802_STATE_CODE_S2_DMA:
281      // DMA acknowledge clears the DMAOUT request
282      cpunum_set_input_line(machine, 0, CDP1802_INPUT_LINE_DMAOUT, CLEAR_LINE);
283      break;
284 
285   case CDP1802_STATE_CODE_S3_INTERRUPT:
286      // interrupt acknowledge clears the INT request
255287      cpunum_set_input_line(machine, 0, CDP1802_INPUT_LINE_INT, CLEAR_LINE);
288      break;
256289   }
257290}
258291 
r2636r2637
264297 
265298   if (state->iden && level)
266299   {
300      // enable interrupts
267301      state->iden = 0;
268302   }
269303 
304   // cassette output
270305   cassette_output(cassette_device_image(), level ? -1.0 : +1.0);
271306}
272307 
r2636r2637
394429   ROM_REGION( 0x10000, REGION_CPU1, 0 )
395430   ROM_SYSTEM_BIOS( 0, "basic100", "COMX BASIC V1.00" )
396431   ROMX_LOAD( "comx_10.u21",         0x0000, 0x4000, CRC(68d0db2d) SHA1(062328361629019ceed9375afac18e2b7849ce47), ROM_BIOS(1) )
397   ROM_FILL( 0xe000, 0x2000, 0xff )
432   ROM_FILL( 0xe000, 0x1000, 0xff )
398433 
399434   ROM_SYSTEM_BIOS( 1, "default", "COMX BASIC V1.00 with Expansion Box" )
400435   ROMX_LOAD( "comx_10.u21",         0x0000, 0x4000, CRC(68d0db2d) SHA1(062328361629019ceed9375afac18e2b7849ce47), ROM_BIOS(2) )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team