trunk/src/mess/drivers/c65.c
| r243219 | r243220 | |
| 51 | 51 | required_shared_ptr<UINT8> m_cram; |
| 52 | 52 | required_device<gfxdecode_device> m_gfxdecode; |
| 53 | 53 | |
| 54 | UINT8 *m_iplrom; |
| 55 | |
| 56 | |
| 54 | 57 | DECLARE_READ8_MEMBER(vic4567_dummy_r); |
| 55 | 58 | DECLARE_WRITE8_MEMBER(vic4567_dummy_w); |
| 56 | 59 | DECLARE_WRITE8_MEMBER(PalRed_w); |
| r243219 | r243220 | |
| 80 | 83 | UINT8 m_VIC3_ControlA,m_VIC3_ControlB; |
| 81 | 84 | void PalEntryFlush(UINT8 offset); |
| 82 | 85 | void DMAgicExecute(address_space &space,UINT32 address); |
| 86 | int inner_x_char(int xoffs); |
| 87 | int inner_y_char(int yoffs); |
| 83 | 88 | }; |
| 84 | 89 | |
| 85 | 90 | void c65_state::video_start() |
| 86 | 91 | { |
| 87 | 92 | } |
| 88 | 93 | |
| 94 | // TODO: inline? |
| 95 | int c65_state::inner_x_char(int xoffs) |
| 96 | { |
| 97 | return xoffs>>3; |
| 98 | } |
| 99 | |
| 100 | int c65_state::inner_y_char(int yoffs) |
| 101 | { |
| 102 | return yoffs>>3; |
| 103 | } |
| 104 | |
| 89 | 105 | UINT32 c65_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 90 | 106 | { |
| 91 | 107 | int y,x; |
| 92 | | gfx_element *gfx = m_gfxdecode->gfx(0); |
| 93 | | |
| 94 | | for(y=0;y<25;y++) |
| 108 | |
| 109 | // TODO: border area |
| 110 | for(y=0;y<m_screen->height();y++) |
| 95 | 111 | { |
| 96 | | for(x=0;x<80;x++) |
| 112 | for(x=0;x<m_screen->width();x++) |
| 97 | 113 | { |
| 98 | | UINT8 tile = m_workram[x+y*80+0x800]; |
| 99 | | gfx->opaque(bitmap,cliprect,tile,0,0,0,x*8,y*8); |
| 114 | //int, xi,yi,xm,ym,dot_x; |
| 115 | int xi = inner_x_char(x); |
| 116 | int yi = inner_y_char(y); |
| 117 | int xm = 7 - (x & 7); |
| 118 | int ym = (y & 7); |
| 119 | UINT8 tile = m_workram[xi+yi*80+0x800]; |
| 120 | UINT8 attr = m_cram[xi+yi*80]; |
| 121 | int enable_dot = ((m_iplrom[(tile<<3)+ym+0xd000] >> xm) & 1); |
| 122 | |
| 123 | //if(cliprect.contains(x, y)) |
| 124 | |
| 125 | bitmap.pix16(y, x) = m_palette->pen((enable_dot) ? attr & 0xf : 0); |
| 126 | |
| 127 | |
| 128 | //gfx->opaque(bitmap,cliprect,tile,0,0,0,x*8,y*8); |
| 100 | 129 | } |
| 101 | 130 | } |
| 102 | 131 | |
| r243219 | r243220 | |
| 261 | 290 | return m_cram[offset]; |
| 262 | 291 | else |
| 263 | 292 | { |
| 264 | | // CIA |
| 293 | // CIA at 0xdc00 |
| 265 | 294 | } |
| 266 | 295 | |
| 267 | 296 | return 0xff; |
| r243219 | r243220 | |
| 273 | 302 | m_cram[offset] = data; |
| 274 | 303 | else |
| 275 | 304 | { |
| 276 | | // CIA |
| 305 | // CIA at 0xdc00 |
| 277 | 306 | } |
| 278 | 307 | |
| 279 | 308 | } |
| r243219 | r243220 | |
| 298 | 327 | AM_RANGE(0x0d700, 0x0d702) AM_WRITE(DMAgic_w) AM_SHARE("dmalist") // 0x0d700, 0x0d7** DMAgic |
| 299 | 328 | //AM_RANGE(0x0d703, 0x0d703) AM_READ(DMAgic_r) |
| 300 | 329 | // 0x0d800, 0x0d8** Color matrix |
| 301 | | AM_RANGE(0x0dc00, 0x0dfff) AM_READWRITE(CIASelect_r,CIASelect_w) AM_SHARE("cram") |
| 330 | AM_RANGE(0x0d800, 0x0dfff) AM_READWRITE(CIASelect_r,CIASelect_w) AM_SHARE("cram") |
| 302 | 331 | // 0x0dc00, 0x0dc** CIA-1 |
| 303 | 332 | // 0x0dd00, 0x0dd** CIA-2 |
| 304 | 333 | // 0x0de00, 0x0de** Ext I/O Select 1 |
| r243219 | r243220 | |
| 370 | 399 | |
| 371 | 400 | void c65_state::machine_start() |
| 372 | 401 | { |
| 402 | m_iplrom = memregion("maincpu")->base(); |
| 403 | |
| 404 | save_pointer(NAME(m_cram.target()), 0x800); |
| 373 | 405 | } |
| 374 | 406 | |
| 375 | 407 | void c65_state::machine_reset() |
| r243219 | r243220 | |
| 394 | 426 | }; |
| 395 | 427 | |
| 396 | 428 | static GFXDECODE_START( c65 ) |
| 397 | | GFXDECODE_ENTRY( "maincpu", 0xd000, charlayout, 0, 1 ) // another identical copy is at 0x9000 |
| 429 | GFXDECODE_ENTRY( "maincpu", 0xd000, charlayout, 0, 16 ) // another identical copy is at 0x9000 |
| 398 | 430 | GFXDECODE_END |
| 399 | 431 | |
| 400 | 432 | INTERRUPT_GEN_MEMBER(c65_state::vic3_vblank_irq) |