src/mess/drivers/dim68k.c
| r9905 | r9906 | |
| 5 | 5 | 28/12/2011 Skeleton driver. |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | //#define ADDRESS_MAP_MODERN |
| 8 | 9 | |
| 9 | 10 | #include "emu.h" |
| 10 | 11 | #include "cpu/m68000/m68000.h" |
| 12 | #include "sound/speaker.h" |
| 13 | #include "video/mc6845.h" |
| 11 | 14 | |
| 12 | 15 | class dim68k_state : public driver_device |
| 13 | 16 | { |
| 14 | 17 | public: |
| 15 | 18 | dim68k_state(running_machine &machine, const driver_device_config_base &config) |
| 16 | | : driver_device(machine, config) { } |
| 19 | : driver_device(machine, config), |
| 20 | m_maincpu(*this, "maincpu"), |
| 21 | m_crtc(*this, "crtc"), |
| 22 | m_speaker(*this, "speaker") |
| 23 | { } |
| 17 | 24 | |
| 25 | required_device<cpu_device> m_maincpu; |
| 26 | required_device<device_t> m_crtc; |
| 27 | required_device<device_t> m_speaker; |
| 28 | //DECLARE_READ16_MEMBER( dim68k_speaker_r ); |
| 29 | //DECLARE_WRITE16_MEMBER( dim68k_speaker_w ); |
| 30 | //DECLARE_READ16_MEMBER( dim68k_fdc_r ); |
| 31 | //DECLARE_WRITE16_MEMBER( dim68k_fdc_w ); |
| 18 | 32 | UINT16* ram; |
| 19 | 33 | UINT8 *FNT; |
| 34 | UINT8 m_speaker_bit; |
| 20 | 35 | }; |
| 21 | 36 | |
| 22 | | static ADDRESS_MAP_START(dim68k_mem, ADDRESS_SPACE_PROGRAM, 16) |
| 37 | static READ16_HANDLER( dim68k_speaker_r ) |
| 38 | { |
| 39 | dim68k_state *state = space->machine->driver_data<dim68k_state>(); |
| 40 | state->m_speaker_bit ^= 1; |
| 41 | speaker_level_w(state->m_speaker, state->m_speaker_bit); |
| 42 | return 0; |
| 43 | } |
| 44 | |
| 45 | static WRITE16_HANDLER( dim68k_speaker_w ) |
| 46 | { |
| 47 | dim68k_state *state = space->machine->driver_data<dim68k_state>(); |
| 48 | state->m_speaker_bit ^= 1; |
| 49 | speaker_level_w(state->m_speaker, state->m_speaker_bit); |
| 50 | } |
| 51 | |
| 52 | static READ16_HANDLER( dim68k_fdc_r ) |
| 53 | { |
| 54 | return 0; |
| 55 | } |
| 56 | |
| 57 | static WRITE16_HANDLER( dim68k_fdc_w ) |
| 58 | { |
| 59 | } |
| 60 | |
| 61 | static ADDRESS_MAP_START(dim68k_mem, ADDRESS_SPACE_PROGRAM, 16)//, dim68k_state) |
| 23 | 62 | ADDRESS_MAP_UNMAP_HIGH |
| 24 | 63 | AM_RANGE(0x00000000, 0x00feffff) AM_RAM AM_BASE_MEMBER(dim68k_state, ram) // 16MB RAM / ROM at boot |
| 25 | 64 | AM_RANGE(0x00ff0000, 0x00ff1fff) AM_ROM AM_REGION("user1",0) |
| 26 | | AM_RANGE(0x00ff2000, 0x00ff7fff) AM_RAM // Video RAM |
| 27 | | AM_RANGE(0x00ff8000, 0x00ffffff) AM_RAM // I/O Region |
| 65 | AM_RANGE(0x00ff2000, 0x00ff7fff) AM_RAM // Graphics Video RAM |
| 66 | AM_RANGE(0x00ff8000, 0x00ff8001) AM_DEVREADWRITE8("crtc", mc6845_status_r, mc6845_address_w, 0xffff) |
| 67 | AM_RANGE(0x00ff8002, 0x00ff8003) AM_DEVREADWRITE8("crtc", mc6845_register_r, mc6845_register_w, 0xffff) |
| 68 | AM_RANGE(0x00ffc800, 0x00ffc801) AM_READWRITE(dim68k_speaker_r,dim68k_speaker_w) |
| 69 | AM_RANGE(0x00ffd000, 0x00ffd005) AM_READWRITE(dim68k_fdc_r,dim68k_fdc_w) |
| 70 | //AM_RANGE(0x00ff8000, 0x00ffffff) AM_RAM // I/O Region |
| 28 | 71 | ADDRESS_MAP_END |
| 29 | 72 | |
| 30 | 73 | /* Input ports */ |
| r9905 | r9906 | |
| 48 | 91 | state->FNT = machine->region("chargen")->base(); |
| 49 | 92 | } |
| 50 | 93 | |
| 51 | | // Please note: This is NOT how the real video works. It is a sample, until the driver is rewritten. |
| 52 | 94 | static VIDEO_UPDATE( dim68k ) |
| 53 | 95 | { |
| 54 | 96 | dim68k_state *state = screen->machine->driver_data<dim68k_state>(); |
| 55 | | UINT8 y,ra,chr,gfx; |
| 56 | | UINT16 sy=0,ma=0x100,x,dchr; |
| 97 | mc6845_update(state->m_crtc, bitmap, cliprect); |
| 98 | return 0; |
| 99 | } |
| 57 | 100 | |
| 58 | | for (y = 0; y < 25; y++) |
| 59 | | { |
| 60 | | for (ra = 0; ra < 10; ra++) |
| 61 | | { |
| 62 | | UINT16 *p = BITMAP_ADDR16(bitmap, sy++, 0); |
| 101 | // Text-only; graphics isn't emulated yet |
| 102 | MC6845_UPDATE_ROW( dim68k_update_row ) |
| 103 | { |
| 104 | dim68k_state *state = device->machine->driver_data<dim68k_state>(); |
| 105 | UINT8 chr,gfx,x,xx,inv; |
| 106 | UINT16 dchr; |
| 63 | 107 | |
| 64 | | for (x = ma; x < ma+40; x++) |
| 65 | | { |
| 66 | | dchr = state->ram[x]; // reads 2 characters |
| 67 | | chr = dchr>>8; |
| 108 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 68 | 109 | |
| 69 | | gfx = state->FNT[(chr<<4) | ra] ^ ((chr & 0x80) ? 0xff : 0); |
| 110 | // need to divide everything in half to cater for 16-bit reads |
| 111 | x_count /= 2; |
| 112 | ma /= 2; |
| 113 | xx = 0; |
| 70 | 114 | |
| 71 | | *p++ = ( gfx & 0x80 ) ? 1 : 0; |
| 72 | | *p++ = ( gfx & 0x40 ) ? 1 : 0; |
| 73 | | *p++ = ( gfx & 0x20 ) ? 1 : 0; |
| 74 | | *p++ = ( gfx & 0x10 ) ? 1 : 0; |
| 75 | | *p++ = ( gfx & 0x08 ) ? 1 : 0; |
| 76 | | *p++ = ( gfx & 0x04 ) ? 1 : 0; |
| 77 | | *p++ = ( gfx & 0x02 ) ? 1 : 0; |
| 78 | | *p++ = ( gfx & 0x01 ) ? 1 : 0; |
| 115 | for (x = 0; x < x_count; x++) |
| 116 | { |
| 117 | dchr = state->ram[ma+x]; // reads 2 characters |
| 79 | 118 | |
| 80 | | chr = dchr; |
| 119 | inv=0; |
| 120 | if (xx == cursor_x) inv=0xff; |
| 121 | xx++; |
| 81 | 122 | |
| 82 | | gfx = state->FNT[(chr<<4) | ra] ^ ((chr & 0x80) ? 0xff : 0); |
| 123 | chr = dchr>>8; |
| 124 | gfx = state->FNT[(chr<<4) | ra] ^ inv ^ ((chr & 0x80) ? 0xff : 0); |
| 125 | *p++ = ( gfx & 0x80 ) ? 1 : 0; |
| 126 | *p++ = ( gfx & 0x40 ) ? 1 : 0; |
| 127 | *p++ = ( gfx & 0x20 ) ? 1 : 0; |
| 128 | *p++ = ( gfx & 0x10 ) ? 1 : 0; |
| 129 | *p++ = ( gfx & 0x08 ) ? 1 : 0; |
| 130 | *p++ = ( gfx & 0x04 ) ? 1 : 0; |
| 131 | *p++ = ( gfx & 0x02 ) ? 1 : 0; |
| 132 | *p++ = ( gfx & 0x01 ) ? 1 : 0; |
| 83 | 133 | |
| 84 | | *p++ = ( gfx & 0x80 ) ? 1 : 0; |
| 85 | | *p++ = ( gfx & 0x40 ) ? 1 : 0; |
| 86 | | *p++ = ( gfx & 0x20 ) ? 1 : 0; |
| 87 | | *p++ = ( gfx & 0x10 ) ? 1 : 0; |
| 88 | | *p++ = ( gfx & 0x08 ) ? 1 : 0; |
| 89 | | *p++ = ( gfx & 0x04 ) ? 1 : 0; |
| 90 | | *p++ = ( gfx & 0x02 ) ? 1 : 0; |
| 91 | | *p++ = ( gfx & 0x01 ) ? 1 : 0; |
| 92 | | } |
| 93 | | } |
| 94 | | ma+=40; |
| 134 | inv = 0; |
| 135 | if (xx == cursor_x) inv=0xff; |
| 136 | xx++; |
| 137 | |
| 138 | chr = dchr; |
| 139 | gfx = state->FNT[(chr<<4) | ra] ^ inv ^ ((chr & 0x80) ? 0xff : 0); |
| 140 | *p++ = ( gfx & 0x80 ) ? 1 : 0; |
| 141 | *p++ = ( gfx & 0x40 ) ? 1 : 0; |
| 142 | *p++ = ( gfx & 0x20 ) ? 1 : 0; |
| 143 | *p++ = ( gfx & 0x10 ) ? 1 : 0; |
| 144 | *p++ = ( gfx & 0x08 ) ? 1 : 0; |
| 145 | *p++ = ( gfx & 0x04 ) ? 1 : 0; |
| 146 | *p++ = ( gfx & 0x02 ) ? 1 : 0; |
| 147 | *p++ = ( gfx & 0x01 ) ? 1 : 0; |
| 95 | 148 | } |
| 96 | | return 0; |
| 97 | 149 | } |
| 98 | 150 | |
| 99 | 151 | /* F4 Character Displayer */ |
| r9905 | r9906 | |
| 114 | 166 | GFXDECODE_ENTRY( "chargen", 0x0000, dim68k_charlayout, 0, 1 ) |
| 115 | 167 | GFXDECODE_END |
| 116 | 168 | |
| 169 | static const mc6845_interface dim68k_crtc = { |
| 170 | "screen", /* name of screen */ |
| 171 | 8, /* number of dots per character - switchable 7 or 8 */ |
| 172 | NULL, |
| 173 | dim68k_update_row, /* handler to display a scanline */ |
| 174 | NULL, |
| 175 | DEVCB_NULL, |
| 176 | DEVCB_NULL, |
| 177 | DEVCB_NULL, |
| 178 | DEVCB_NULL, |
| 179 | NULL |
| 180 | }; |
| 181 | |
| 117 | 182 | static MACHINE_CONFIG_START( dim68k, dim68k_state ) |
| 118 | 183 | /* basic machine hardware */ |
| 119 | 184 | MCFG_CPU_ADD("maincpu", M68000, XTAL_10MHz) |
| r9905 | r9906 | |
| 134 | 199 | |
| 135 | 200 | MCFG_VIDEO_START(dim68k) |
| 136 | 201 | MCFG_VIDEO_UPDATE(dim68k) |
| 202 | MCFG_MC6845_ADD("crtc", MC6845, 1790000, dim68k_crtc) |
| 203 | |
| 204 | /* sound hardware */ |
| 205 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 206 | MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) |
| 207 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 137 | 208 | MACHINE_CONFIG_END |
| 138 | 209 | |
| 139 | 210 | /* |
| r9905 | r9906 | |
| 193 | 264 | /* Driver */ |
| 194 | 265 | |
| 195 | 266 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 196 | | COMP( 1984, dim68k, 0, 0, dim68k, dim68k, 0, "Micro Craft", "Dimension 68000", GAME_NOT_WORKING | GAME_NO_SOUND) |
| 267 | COMP( 1984, dim68k, 0, 0, dim68k, dim68k, 0, "Micro Craft", "Dimension 68000", GAME_NOT_WORKING | GAME_NO_SOUND) |
| 197 | 268 | |