src/mess/drivers/smc777.c
| r8553 | r8554 | |
| 1 | 1 | /*************************************************************************** |
| 2 | | |
| 3 | | Sony SMC-777 |
| 4 | 2 | |
| 5 | | 13/07/2010 Skeleton driver. |
| 3 | SMC-777 (c) 1983 Sony |
| 6 | 4 | |
| 5 | preliminary driver by Angelo Salese |
| 6 | |
| 7 | TODO: |
| 8 | - no documentation, the entire driver is just a bunch of educated |
| 9 | guesses ... |
| 10 | - video emulation is just hacked up together to show something simple, |
| 11 | dunno yet how it really works. |
| 12 | |
| 7 | 13 | ****************************************************************************/ |
| 8 | 14 | |
| 9 | 15 | #include "emu.h" |
| 10 | 16 | #include "cpu/z80/z80.h" |
| 17 | #include "sound/sn76496.h" |
| 18 | #include "video/mc6845.h" |
| 11 | 19 | |
| 20 | static UINT16 cursor_addr; |
| 21 | |
| 22 | static VIDEO_START( smc777 ) |
| 23 | { |
| 24 | } |
| 25 | |
| 26 | static VIDEO_UPDATE( smc777 ) |
| 27 | { |
| 28 | int x,y,count; |
| 29 | static UINT8 *vram = memory_region(screen->machine, "vram"); |
| 30 | // static UINT8 *attr = memory_region(screen->machine, "attr"); |
| 31 | |
| 32 | count = 0x0000; |
| 33 | |
| 34 | for(y=0;y<25;y++) |
| 35 | { |
| 36 | for(x=0;x<40;x++) |
| 37 | { |
| 38 | int tile = vram[count] | 0x80; |
| 39 | // int color = attr[count]; |
| 40 | |
| 41 | drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],tile,0,0,0,x*8,y*8); |
| 42 | |
| 43 | if(((cursor_addr) == count) && screen->machine->primary_screen->frame_number() & 0x10) // draw cursor |
| 44 | drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],0x107,0,0,0,x*8,y*8,0); |
| 45 | |
| 46 | |
| 47 | count+=2; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | return 0; |
| 52 | } |
| 53 | |
| 54 | static READ8_HANDLER( test_r ) |
| 55 | { |
| 56 | return mame_rand(space->machine); |
| 57 | } |
| 58 | |
| 59 | static WRITE8_HANDLER( smc777_6845_w ) |
| 60 | { |
| 61 | static int addr_latch; |
| 62 | |
| 63 | if(offset == 0) |
| 64 | { |
| 65 | addr_latch = data; |
| 66 | mc6845_address_w(devtag_get_device(space->machine, "crtc"), 0,data); |
| 67 | } |
| 68 | else |
| 69 | { |
| 70 | /* FIXME: this should be inside the MC6845 core! */ |
| 71 | if(addr_latch == 0x0e) |
| 72 | cursor_addr = ((data<<8) & 0x3f00) | (cursor_addr & 0xff); |
| 73 | else if(addr_latch == 0x0f) |
| 74 | cursor_addr = (cursor_addr & 0x3f00) | (data & 0xff); |
| 75 | |
| 76 | mc6845_register_w(devtag_get_device(space->machine, "crtc"), 0,data); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | static WRITE8_HANDLER( smc777_vram_w ) |
| 81 | { |
| 82 | static UINT8 *vram = memory_region(space->machine, "vram"); |
| 83 | |
| 84 | vram[cursor_addr] = data; |
| 85 | } |
| 86 | |
| 87 | static WRITE8_HANDLER( smc777_attr_w ) |
| 88 | { |
| 89 | static UINT8 *attr = memory_region(space->machine, "attr"); |
| 90 | |
| 91 | attr[cursor_addr] = data; |
| 92 | } |
| 93 | |
| 12 | 94 | static ADDRESS_MAP_START(smc777_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 13 | 95 | ADDRESS_MAP_UNMAP_HIGH |
| 14 | 96 | AM_RANGE(0x0000, 0x3fff) AM_ROM |
| r8553 | r8554 | |
| 17 | 99 | |
| 18 | 100 | static ADDRESS_MAP_START( smc777_io , ADDRESS_SPACE_IO, 8) |
| 19 | 101 | ADDRESS_MAP_UNMAP_HIGH |
| 102 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 103 | AM_RANGE(0x00, 0x07) AM_WRITE(smc777_vram_w) |
| 104 | AM_RANGE(0x08, 0x0f) AM_WRITE(smc777_attr_w) |
| 105 | AM_RANGE(0x10, 0x17) AM_WRITENOP //PCG data is written there, in a backwards fashion??? |
| 106 | AM_RANGE(0x18, 0x19) AM_WRITE(smc777_6845_w) |
| 107 | AM_RANGE(0x1b, 0x1b) AM_READ(test_r) //presumably video related |
| 108 | // AM_RANGE(0x1c, 0x1c) AM_WRITENOP //??? |
| 109 | // AM_RANGE(0x30, 0x37) AM_NOP //fdc, wd1793? |
| 110 | AM_RANGE(0x53, 0x53) AM_DEVWRITE("sn1", sn76496_w) |
| 111 | // AM_RANGE(0x80, 0xff) AM_WRITENOP //cleared with the same backwards fashion as the vram / PCG data, bitmap? |
| 20 | 112 | ADDRESS_MAP_END |
| 21 | 113 | |
| 22 | 114 | /* Input ports */ |
| r8553 | r8554 | |
| 24 | 116 | INPUT_PORTS_END |
| 25 | 117 | |
| 26 | 118 | |
| 27 | | static MACHINE_RESET(smc777) |
| 28 | | { |
| 29 | | } |
| 30 | | |
| 31 | | static VIDEO_START( smc777 ) |
| 119 | static MACHINE_RESET(smc777) |
| 32 | 120 | { |
| 33 | 121 | } |
| 34 | 122 | |
| 35 | | static VIDEO_UPDATE( smc777 ) |
| 36 | | { |
| 37 | | return 0; |
| 38 | | } |
| 39 | 123 | |
| 40 | 124 | /* F4 Character Displayer */ |
| 41 | 125 | static const gfx_layout smc777_charlayout = |
| 42 | 126 | { |
| 43 | 127 | 8, 8, /* 8 x 8 characters */ |
| 44 | | 320, /* 320 characters */ |
| 128 | RGN_FRAC(1,1), /* 320 characters */ |
| 45 | 129 | 1, /* 1 bits per pixel */ |
| 46 | 130 | { 0 }, /* no bitplanes */ |
| 47 | 131 | /* x offsets */ |
| r8553 | r8554 | |
| 52 | 136 | }; |
| 53 | 137 | |
| 54 | 138 | static GFXDECODE_START( smc777 ) |
| 55 | | GFXDECODE_ENTRY( "maincpu", 0x0200, smc777_charlayout, 0, 1 ) |
| 139 | GFXDECODE_ENTRY( "maincpu", 0x0000, smc777_charlayout, 0, 1 ) |
| 56 | 140 | GFXDECODE_END |
| 57 | 141 | |
| 142 | static const mc6845_interface mc6845_intf = |
| 143 | { |
| 144 | "screen", /* screen we are acting on */ |
| 145 | 8, /* number of pixels per video memory address */ |
| 146 | NULL, /* before pixel update callback */ |
| 147 | NULL, /* row update callback */ |
| 148 | NULL, /* after pixel update callback */ |
| 149 | DEVCB_NULL, /* callback for display state changes */ |
| 150 | DEVCB_NULL, /* callback for cursor state changes */ |
| 151 | DEVCB_NULL, /* HSYNC callback */ |
| 152 | DEVCB_NULL, /* VSYNC callback */ |
| 153 | NULL /* update address callback */ |
| 154 | }; |
| 155 | |
| 156 | |
| 58 | 157 | static MACHINE_DRIVER_START( smc777 ) |
| 59 | 158 | /* basic machine hardware */ |
| 60 | 159 | MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| 61 | 160 | MDRV_CPU_PROGRAM_MAP(smc777_mem) |
| 62 | | MDRV_CPU_IO_MAP(smc777_io) |
| 161 | MDRV_CPU_IO_MAP(smc777_io) |
| 63 | 162 | |
| 64 | 163 | MDRV_MACHINE_RESET(smc777) |
| 65 | | |
| 164 | |
| 66 | 165 | /* video hardware */ |
| 67 | 166 | MDRV_SCREEN_ADD("screen", RASTER) |
| 68 | 167 | MDRV_SCREEN_REFRESH_RATE(50) |
| r8553 | r8554 | |
| 74 | 173 | MDRV_PALETTE_INIT(black_and_white) |
| 75 | 174 | MDRV_GFXDECODE(smc777) |
| 76 | 175 | |
| 176 | MDRV_MC6845_ADD("crtc", H46505, XTAL_3_579545MHz/2, mc6845_intf) /* unknown clock, hand tuned to get ~60 fps */ |
| 177 | |
| 77 | 178 | MDRV_VIDEO_START(smc777) |
| 78 | 179 | MDRV_VIDEO_UPDATE(smc777) |
| 180 | |
| 181 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 182 | |
| 183 | MDRV_SOUND_ADD("sn1", SN76489A, 1996800) // unknown clock / divider |
| 184 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 79 | 185 | MACHINE_DRIVER_END |
| 80 | 186 | |
| 81 | 187 | /* ROM definition */ |
| 82 | 188 | ROM_START( smc777 ) |
| 83 | 189 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 84 | 190 | ROM_LOAD( "smcrom.dat", 0x0000, 0x4000, CRC(b2520d31) SHA1(3c24b742c38bbaac85c0409652ba36e20f4687a1)) |
| 191 | |
| 192 | ROM_REGION( 0x2000, "vram", ROMREGION_ERASE00 ) |
| 193 | |
| 194 | ROM_REGION( 0x2000, "attr", ROMREGION_ERASE00 ) |
| 195 | |
| 85 | 196 | ROM_END |
| 86 | 197 | |
| 87 | 198 | /* Driver */ |