branches/kale/src/mess/drivers/c65.c
| r243079 | r243080 | |
| 6 | 6 | |
| 7 | 7 | Attempt at rewriting the driver ... |
| 8 | 8 | |
| 9 | Note: |
| 10 | - VIC-4567 will be eventually be added via compile switch, once that I |
| 11 | get the hang of the system (and checking where the old code fails |
| 12 | eventually) |
| 13 | |
| 9 | 14 | ***************************************************************************/ |
| 10 | 15 | |
| 11 | 16 | |
| 12 | 17 | #include "emu.h" |
| 13 | 18 | #include "cpu/m6502/m4510.h" |
| 14 | 19 | |
| 15 | | #define MAIN_CLOCK XTAL_8MHz |
| 20 | #define MAIN_CLOCK XTAL_3_5MHz |
| 16 | 21 | |
| 17 | 22 | class c65_state : public driver_device |
| 18 | 23 | { |
| 19 | 24 | public: |
| 20 | 25 | c65_state(const machine_config &mconfig, device_type type, const char *tag) |
| 21 | 26 | : driver_device(mconfig, type, tag), |
| 22 | | m_maincpu(*this, "maincpu") |
| 27 | m_maincpu(*this, "maincpu"), |
| 28 | m_screen(*this, "screen") |
| 23 | 29 | { } |
| 24 | 30 | |
| 25 | 31 | // devices |
| 26 | 32 | required_device<cpu_device> m_maincpu; |
| 33 | required_device<screen_device> m_screen; |
| 34 | DECLARE_READ8_MEMBER(vic4567_dummy_r); |
| 35 | DECLARE_WRITE8_MEMBER(vic4567_dummy_w); |
| 27 | 36 | |
| 28 | 37 | // screen updates |
| 29 | 38 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| r243079 | r243080 | |
| 47 | 56 | return 0; |
| 48 | 57 | } |
| 49 | 58 | |
| 59 | READ8_MEMBER(c65_state::vic4567_dummy_r) |
| 60 | { |
| 61 | UINT8 res; |
| 62 | |
| 63 | res=0xff; |
| 64 | switch(offset) |
| 65 | { |
| 66 | case 0x11: |
| 67 | res = (m_screen->vpos() & 0x100) >> 1; |
| 68 | return res; |
| 69 | case 0x12: |
| 70 | res = (m_screen->vpos() & 0xff); |
| 71 | return res; |
| 72 | } |
| 73 | |
| 74 | printf("%02x\n",offset); // TODO: PC |
| 75 | return res; |
| 76 | } |
| 77 | |
| 78 | WRITE8_MEMBER(c65_state::vic4567_dummy_w) |
| 79 | { |
| 80 | switch(offset) |
| 81 | { |
| 82 | /* KEY register, handles vic-iii and vic-ii modes via two consecutive writes |
| 83 | 0xa5 -> 0x96 vic-iii mode |
| 84 | any other write vic-ii mode |
| 85 | */ |
| 86 | //case 0x2f: break; |
| 87 | default: printf("%02x %02x\n",offset,data); break; |
| 88 | } |
| 89 | |
| 90 | } |
| 91 | |
| 50 | 92 | static ADDRESS_MAP_START( c65_map, AS_PROGRAM, 8, c65_state ) |
| 51 | 93 | AM_RANGE(0x00000, 0x01fff) AM_RAM // TODO: bank |
| 52 | 94 | AM_RANGE(0x0c800, 0x0cfff) AM_ROM AM_REGION("maincpu", 0xc800) |
| 95 | AM_RANGE(0x0d000, 0x0d07f) AM_READWRITE(vic4567_dummy_r,vic4567_dummy_w) |
| 53 | 96 | // 0x0d000, 0x0d07f VIC-4567 |
| 54 | 97 | // 0x0d080, 0x0d09f FDC |
| 55 | 98 | // 0x0d0a0, 0x0d0ff Ram Expansion Control (REC) |
| r243079 | r243080 | |
| 143 | 186 | static MACHINE_CONFIG_START( c65, c65_state ) |
| 144 | 187 | |
| 145 | 188 | /* basic machine hardware */ |
| 146 | | MCFG_CPU_ADD("maincpu",M4510,MAIN_CLOCK/2) |
| 189 | MCFG_CPU_ADD("maincpu",M4510,MAIN_CLOCK) |
| 147 | 190 | MCFG_CPU_PROGRAM_MAP(c65_map) |
| 148 | 191 | |
| 149 | 192 | /* video hardware */ |
| r243079 | r243080 | |
| 153 | 196 | MCFG_SCREEN_UPDATE_DRIVER(c65_state, screen_update) |
| 154 | 197 | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 155 | 198 | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) |
| 156 | | MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK/2, 442, 0, 320, 264, 0, 240) /* generic NTSC video timing, change accordingly */ |
| 199 | MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK, 525, 0, 320, 525, 0, 240) // mods needed |
| 157 | 200 | MCFG_SCREEN_PALETTE("palette") |
| 158 | 201 | |
| 159 | 202 | MCFG_PALETTE_ADD("palette", 0x100) |