src/mess/drivers/smc777.c
| r8555 | r8556 | |
| 28 | 28 | { |
| 29 | 29 | int x,y,count; |
| 30 | 30 | static UINT8 *vram = memory_region(screen->machine, "vram"); |
| 31 | | // static UINT8 *attr = memory_region(screen->machine, "attr"); |
| 31 | static UINT8 *attr = memory_region(screen->machine, "attr"); |
| 32 | 32 | |
| 33 | 33 | count = 0x0000; |
| 34 | 34 | |
| r8555 | r8556 | |
| 36 | 36 | { |
| 37 | 37 | for(x=0;x<40;x++) |
| 38 | 38 | { |
| 39 | | int tile = vram[count] | 0x80; |
| 40 | | // int color = attr[count]; |
| 39 | int tile = vram[count]; |
| 40 | int color = attr[count] & 7; |
| 41 | 41 | |
| 42 | | drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],tile,0,0,0,x*8,y*8); |
| 42 | drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],tile,color,0,0,x*8,y*8); |
| 43 | 43 | |
| 44 | 44 | if(((cursor_addr) == count) && screen->machine->primary_screen->frame_number() & 0x10) // draw cursor |
| 45 | | drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],0x107,0,0,0,x*8,y*8,0); |
| 45 | drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],0x87,7,0,0,x*8,y*8,0); |
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | count+=2; |
| r8555 | r8556 | |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | static READ8_HANDLER( smc777_vram_r ) |
| 82 | { |
| 83 | static UINT8 *vram = memory_region(space->machine, "vram"); |
| 84 | static UINT16 vram_index; |
| 85 | |
| 86 | vram_index = cpu_get_reg(devtag_get_device(space->machine, "maincpu"), Z80_B); |
| 87 | |
| 88 | return vram[vram_index | offset*0x100]; |
| 89 | } |
| 90 | |
| 91 | static READ8_HANDLER( smc777_attr_r ) |
| 92 | { |
| 93 | static UINT8 *attr = memory_region(space->machine, "attr"); |
| 94 | static UINT16 vram_index; |
| 95 | |
| 96 | vram_index = cpu_get_reg(devtag_get_device(space->machine, "maincpu"), Z80_B); |
| 97 | |
| 98 | return attr[vram_index | offset*0x100]; |
| 99 | } |
| 100 | |
| 101 | static READ8_HANDLER( smc777_pcg_r ) |
| 102 | { |
| 103 | static UINT8 *pcg = memory_region(space->machine, "pcg"); |
| 104 | static UINT16 vram_index; |
| 105 | |
| 106 | vram_index = cpu_get_reg(devtag_get_device(space->machine, "maincpu"), Z80_B); |
| 107 | |
| 108 | return pcg[vram_index | offset*0x100]; |
| 109 | } |
| 110 | |
| 81 | 111 | static WRITE8_HANDLER( smc777_vram_w ) |
| 82 | 112 | { |
| 83 | 113 | static UINT8 *vram = memory_region(space->machine, "vram"); |
| r8555 | r8556 | |
| 98 | 128 | attr[vram_index | offset*0x100] = data; |
| 99 | 129 | } |
| 100 | 130 | |
| 131 | static WRITE8_HANDLER( smc777_pcg_w ) |
| 132 | { |
| 133 | static UINT8 *pcg = memory_region(space->machine, "pcg"); |
| 134 | static UINT16 vram_index; |
| 135 | |
| 136 | vram_index = cpu_get_reg(devtag_get_device(space->machine, "maincpu"), Z80_B); |
| 137 | |
| 138 | pcg[vram_index | offset*0x100] = data; |
| 139 | |
| 140 | gfx_element_mark_dirty(space->machine->gfx[0], vram_index >> 3); |
| 141 | } |
| 142 | |
| 143 | static READ8_HANDLER( smc777_fbuf_r ) |
| 144 | { |
| 145 | static UINT8 *fbuf = memory_region(space->machine, "fbuf"); |
| 146 | static UINT16 vram_index; |
| 147 | |
| 148 | vram_index = cpu_get_reg(devtag_get_device(space->machine, "maincpu"), Z80_B); |
| 149 | |
| 150 | return fbuf[vram_index | offset*0x100]; |
| 151 | } |
| 152 | |
| 153 | static WRITE8_HANDLER( smc777_fbuf_w ) |
| 154 | { |
| 155 | static UINT8 *fbuf = memory_region(space->machine, "fbuf"); |
| 156 | static UINT16 vram_index; |
| 157 | |
| 158 | vram_index = cpu_get_reg(devtag_get_device(space->machine, "maincpu"), Z80_B); |
| 159 | |
| 160 | fbuf[vram_index | offset*0x100] = data; |
| 161 | } |
| 162 | |
| 101 | 163 | static ADDRESS_MAP_START(smc777_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 102 | 164 | ADDRESS_MAP_UNMAP_HIGH |
| 103 | 165 | AM_RANGE(0x0000, 0x3fff) AM_ROM |
| r8555 | r8556 | |
| 107 | 169 | static ADDRESS_MAP_START( smc777_io , ADDRESS_SPACE_IO, 8) |
| 108 | 170 | ADDRESS_MAP_UNMAP_HIGH |
| 109 | 171 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 110 | | AM_RANGE(0x00, 0x07) AM_WRITE(smc777_vram_w) |
| 111 | | AM_RANGE(0x08, 0x0f) AM_WRITE(smc777_attr_w) |
| 112 | | AM_RANGE(0x10, 0x17) AM_WRITENOP //PCG data is written there, in a backwards fashion??? |
| 172 | AM_RANGE(0x00, 0x07) AM_READWRITE(smc777_vram_r,smc777_vram_w) |
| 173 | AM_RANGE(0x08, 0x0f) AM_READWRITE(smc777_attr_r,smc777_attr_w) |
| 174 | AM_RANGE(0x10, 0x17) AM_READWRITE(smc777_pcg_r, smc777_pcg_w) |
| 113 | 175 | AM_RANGE(0x18, 0x19) AM_WRITE(smc777_6845_w) |
| 114 | | AM_RANGE(0x1b, 0x1b) AM_READ(test_r) //presumably video related |
| 115 | | // AM_RANGE(0x1c, 0x1c) AM_WRITENOP //??? |
| 116 | | // AM_RANGE(0x30, 0x37) AM_NOP //fdc, wd1793? |
| 117 | | AM_RANGE(0x53, 0x53) AM_DEVWRITE("sn1", sn76496_w) |
| 118 | | // AM_RANGE(0x80, 0xff) AM_WRITENOP //cleared with the same backwards fashion as the vram / PCG data, bitmap? |
| 176 | AM_RANGE(0x1a, 0x1b) AM_READ(test_r) AM_WRITENOP//keyboard data |
| 177 | // AM_RANGE(0x1c, 0x1c) AM_WRITENOP //status and control data / Printer strobe |
| 178 | // AM_RANGE(0x1d, 0x1d) AM_WRITENOP //status and control data / Printer status / strobe |
| 179 | // AM_RANGE(0x1e, 0x1f) AM_WRITENOP //RS232C irq control |
| 180 | // AM_RANGE(0x20, 0x20) AM_WRITENOP //display mode switching |
| 181 | // AM_RANGE(0x21, 0x21) AM_WRITENOP //60 Hz irq control |
| 182 | // AM_RANGE(0x22, 0x22) AM_WRITENOP //printer output data |
| 183 | // AM_RANGE(0x23, 0x23) AM_WRITENOP //border area control |
| 184 | // AM_RANGE(0x24, 0x24) AM_WRITENOP //Timer write / specify address (RTC?) |
| 185 | // AM_RANGE(0x25, 0x25) AM_READNOP //Timer read (RTC?) |
| 186 | // AM_RANGE(0x26, 0x26) AM_WRITENOP //RS232C RX / TX |
| 187 | // AM_RANGE(0x27, 0x27) AM_WRITENOP //RS232C Mode / Command / Status |
| 188 | |
| 189 | // AM_RANGE(0x28, 0x2c) AM_NOP //fdc 2, MB8876 -> FD1791 |
| 190 | // AM_RANGE(0x2d, 0x2f) AM_NOP //rs-232c no. 2 |
| 191 | // AM_RANGE(0x30, 0x34) AM_NOP //fdc 1, MB8876 -> FD1791 |
| 192 | // AM_RANGE(0x35, 0x37) AM_NOP //rs-232c no. 3 |
| 193 | // AM_RANGE(0x38, 0x3b) AM_NOP //cache disk unit |
| 194 | // AM_RANGE(0x3c, 0x3d) AM_NOP //RGB Superimposer |
| 195 | // AM_RANGE(0x40, 0x47) AM_NOP //IEEE-488 interface unit |
| 196 | // AM_RANGE(0x48, 0x50) AM_NOP //HDD (Winchester) |
| 197 | // AM_RANGE(0x54, 0x59) AM_NOP //VTR Controller |
| 198 | AM_RANGE(0x53, 0x53) AM_DEVWRITE("sn1", sn76496_w) //not in the datasheet ... almost certainly SMC-777 specific |
| 199 | // AM_RANGE(0x5a, 0x5b) AM_WRITENOP //RAM banking |
| 200 | // AM_RANGE(0x70, 0x70) AM_NOP //Auto Start ROM |
| 201 | // AM_RANGE(0x74, 0x74) AM_NOP //IEEE-488 ROM |
| 202 | // AM_RANGE(0x75, 0x75) AM_NOP //VTR Controller ROM |
| 203 | AM_RANGE(0x80, 0xff) AM_READWRITE(smc777_fbuf_r, smc777_fbuf_w) //GRAM |
| 119 | 204 | ADDRESS_MAP_END |
| 120 | 205 | |
| 121 | 206 | /* Input ports */ |
| r8555 | r8556 | |
| 128 | 213 | } |
| 129 | 214 | |
| 130 | 215 | |
| 131 | | /* F4 Character Displayer */ |
| 132 | 216 | static const gfx_layout smc777_charlayout = |
| 133 | 217 | { |
| 134 | | 8, 8, /* 8 x 8 characters */ |
| 135 | | RGN_FRAC(1,1), /* 320 characters */ |
| 136 | | 1, /* 1 bits per pixel */ |
| 137 | | { 0 }, /* no bitplanes */ |
| 138 | | /* x offsets */ |
| 218 | 8, 8, |
| 219 | RGN_FRAC(1,1), |
| 220 | 1, |
| 221 | { 0 }, |
| 139 | 222 | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 140 | | /* y offsets */ |
| 141 | 223 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, |
| 142 | | 8*8 /* every char takes 8 bytes */ |
| 224 | 8*8 |
| 143 | 225 | }; |
| 144 | 226 | |
| 145 | 227 | static GFXDECODE_START( smc777 ) |
| 146 | | GFXDECODE_ENTRY( "maincpu", 0x0000, smc777_charlayout, 0, 1 ) |
| 228 | GFXDECODE_ENTRY( "pcg", 0x0000, smc777_charlayout, 0, 8 ) |
| 147 | 229 | GFXDECODE_END |
| 148 | 230 | |
| 149 | 231 | static const mc6845_interface mc6845_intf = |
| r8555 | r8556 | |
| 160 | 242 | NULL /* update address callback */ |
| 161 | 243 | }; |
| 162 | 244 | |
| 245 | static PALETTE_INIT( smc777 ) |
| 246 | { |
| 247 | int i; |
| 163 | 248 | |
| 249 | for (i = 0x000; i < 0x010; i++) |
| 250 | { |
| 251 | UINT8 r,g,b; |
| 252 | |
| 253 | if((i & 0x01) == 0x01) |
| 254 | { |
| 255 | r = ((i >> 2) & 1) ? 0xff : 0x00; |
| 256 | g = ((i >> 3) & 1) ? 0xff : 0x00; |
| 257 | b = ((i >> 1) & 1) ? 0xff : 0x00; |
| 258 | } |
| 259 | else { r = g = b = 0x00; } |
| 260 | |
| 261 | palette_set_color_rgb(machine, i, r,g,b); |
| 262 | } |
| 263 | } |
| 264 | |
| 164 | 265 | static MACHINE_DRIVER_START( smc777 ) |
| 165 | 266 | /* basic machine hardware */ |
| 166 | | MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| 267 | MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz) //4,028 Mhz! |
| 167 | 268 | MDRV_CPU_PROGRAM_MAP(smc777_mem) |
| 168 | 269 | MDRV_CPU_IO_MAP(smc777_io) |
| 169 | 270 | |
| r8555 | r8556 | |
| 176 | 277 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 177 | 278 | MDRV_SCREEN_SIZE(640, 200) |
| 178 | 279 | MDRV_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) |
| 179 | | MDRV_PALETTE_LENGTH(2) |
| 180 | | MDRV_PALETTE_INIT(black_and_white) |
| 280 | MDRV_PALETTE_LENGTH(0x10) |
| 281 | MDRV_PALETTE_INIT(smc777) |
| 181 | 282 | MDRV_GFXDECODE(smc777) |
| 182 | 283 | |
| 183 | 284 | MDRV_MC6845_ADD("crtc", H46505, XTAL_3_579545MHz/2, mc6845_intf) /* unknown clock, hand tuned to get ~60 fps */ |
| r8555 | r8556 | |
| 196 | 297 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 197 | 298 | ROM_LOAD( "smcrom.dat", 0x0000, 0x4000, CRC(b2520d31) SHA1(3c24b742c38bbaac85c0409652ba36e20f4687a1)) |
| 198 | 299 | |
| 199 | | ROM_REGION( 0x2000, "vram", ROMREGION_ERASE00 ) |
| 300 | ROM_REGION( 0x800, "vram", ROMREGION_ERASE00 ) |
| 200 | 301 | |
| 201 | | ROM_REGION( 0x2000, "attr", ROMREGION_ERASE00 ) |
| 302 | ROM_REGION( 0x800, "attr", ROMREGION_ERASE00 ) |
| 202 | 303 | |
| 304 | ROM_REGION( 0x800, "pcg", ROMREGION_ERASE00 ) |
| 305 | |
| 306 | ROM_REGION( 0x8000,"fbuf", ROMREGION_ERASE00 ) |
| 203 | 307 | ROM_END |
| 204 | 308 | |
| 205 | 309 | /* Driver */ |