Previous 15994 Revisions Next

r10487 Thursday 17th February, 2011 at 23:28:57 UTC by Angelo Salese
[QX-10]: Hooked up the upd7220 device (other one being a joke), fixed a divide by zero bug in the latter
[src/mess/drivers]qx10.c
[src/mess/video]upd7220.c

src/mess/video/upd7220.c
r10486r10487
417417   int horiz_pix_total = (upd7220->hs + upd7220->hbp + upd7220->aw + upd7220->hfp) * 16;
418418   int vert_pix_total = upd7220->vs + upd7220->vbp + upd7220->al + upd7220->vfp;
419419
420   if(horiz_pix_total == 0 || vert_pix_total == 0) //bail out if screen params aren't valid
421      return;
422
420423   attoseconds_t refresh = HZ_TO_ATTOSECONDS(device->clock() * 8) * horiz_pix_total * vert_pix_total;
421424
422425   rectangle visarea;
src/mess/drivers/qx10.c
r10486r10487
2323#include "machine/mc146818.h"
2424#include "machine/i8255a.h"
2525#include "machine/8237dma.h"
26#include "video/i82720.h"
26#include "video/upd7220.h"
2727#include "machine/upd765.h"
2828#include "machine/ram.h"
2929
r10486r10487
3737{
3838public:
3939   qx10_state(running_machine &machine, const driver_device_config_base &config)
40      : driver_device(machine, config) { }
40      : driver_device(machine, config),
41         m_hgdc(*this, "upd7220")
42      { }
4143
44   required_device<device_t> m_hgdc;
45
46   virtual void video_start();
47   virtual bool video_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect);
48   UINT8 *m_char_rom;
49
4250   int      mc146818_offset;
4351
4452   /* FDD */
r10486r10487
426434   AM_RANGE(0x30, 0x30) AM_READWRITE(qx10_30_r, fdd_motor_w)
427435   AM_RANGE(0x34, 0x34) AM_DEVREAD("upd765", upd765_status_r)
428436   AM_RANGE(0x35, 0x35) AM_DEVREADWRITE("upd765", upd765_data_r, upd765_data_w)
429   AM_RANGE(0x38, 0x39) AM_READWRITE(compis_gdc_r, compis_gdc_w)
437   AM_RANGE(0x38, 0x39) AM_DEVREADWRITE("upd7220", upd7220_r, upd7220_w)
430438   AM_RANGE(0x3c, 0x3c) AM_READWRITE(mc146818_data_r, mc146818_data_w)
431439   AM_RANGE(0x3d, 0x3d) AM_WRITE(mc146818_offset_w)
432440   AM_RANGE(0x40, 0x4f) AM_DEVREADWRITE("8237dma_1", i8237_r, i8237_w)
r10486r10487
442450   PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED)
443451INPUT_PORTS_END
444452
445/*
446    Video
447*/
448static const compis_gdc_interface i82720_interface =
449{
450   GDC_MODE_HRG,
451   0x8000
452};
453453
454454static MACHINE_START(qx10)
455455{
r10486r10487
457457
458458   cpu_set_irq_callback(machine->device("maincpu"), irq_callback);
459459
460   compis_init( &i82720_interface );
461
462460   // find devices
463461   state->pic8259_master = machine->device("pic8259_master");
464462   state->pic8259_slave = machine->device("pic8259_slave");
r10486r10487
497495   GFXDECODE_ENTRY( "chargen", 0x0000, qx10_charlayout, 1, 7 )
498496GFXDECODE_END
499497
498void qx10_state::video_start()
499{
500   // find memory regions
501   m_char_rom = machine->region("chargen")->base();
500502
503   VIDEO_START_CALL(generic_bitmapped);
504}
505
506bool qx10_state::video_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect)
507{
508   /* graphics */
509   upd7220_update(m_hgdc, &bitmap, &cliprect);
510
511   return 0;
512}
513
514static ADDRESS_MAP_START( qx10_upd7220_map, 0, 16 )
515   AM_RANGE(0x00000, 0x3ffff) AM_RAM
516ADDRESS_MAP_END
517
518static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
519{
520   int i;
521
522   for (i = 0; i < 16; i++)
523   {
524      if (BIT(data, i)) *BITMAP_ADDR16(bitmap, y, x + i) = 1;
525   }
526}
527
528static UPD7220_INTERFACE( hgdc_intf )
529{
530   "screen",
531   hgdc_display_pixels,
532   DEVCB_NULL,
533   DEVCB_NULL,
534   DEVCB_NULL,
535   DEVCB_NULL
536};
537
538/* TODO: this is just a c&p code */
539static PALETTE_INIT( gdc )
540{
541   int i;
542   int r,g,b;
543
544   for ( i = 0; i < 16; i++ )
545   {
546      r = i & 4 ? ((i & 8) ? 0xaa : 0xff) : 0x00;
547      g = i & 2 ? ((i & 8) ? 0xaa : 0xff) : 0x00;
548      b = i & 1 ? ((i & 8) ? 0xaa : 0xff) : 0x00;
549
550      palette_set_color(machine, i, MAKE_RGB(r,g,b));
551   }
552}
553
554
501555static MACHINE_CONFIG_START( qx10, qx10_state )
502556   /* basic machine hardware */
503557   MCFG_CPU_ADD("maincpu",Z80, MAIN_CLK / 4)
r10486r10487
526580   MCFG_SCREEN_SIZE(640, 480)
527581   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
528582   MCFG_GFXDECODE(qx10)
529   MCFG_PALETTE_LENGTH(COMPIS_PALETTE_SIZE)
530   MCFG_PALETTE_INIT(compis_gdc)
583   MCFG_PALETTE_LENGTH(16)
584   MCFG_PALETTE_INIT(gdc)
531585
532   MCFG_VIDEO_START(compis_gdc)
533   MCFG_VIDEO_UPDATE(compis_gdc)
586   MCFG_UPD7220_ADD("upd7220", MAIN_CLK/4, hgdc_intf, qx10_upd7220_map)
534587
535588   MCFG_MC146818_ADD( "rtc", MC146818_STANDARD )
536589

Previous 15994 Revisions Next


© 1998-2018 The MESS Team