src/mess/drivers/huebler.c
| r5159 | r5160 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | Hubler/Everts |
| 3 | Hubler/Everts |
| 4 | 4 | |
| 5 | | 12/05/2009 Skeleton driver. |
| 5 | 12/05/2009 Skeleton driver. |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "includes/huebler.h" |
| 10 | 11 | #include "cpu/z80/z80.h" |
| 12 | #include "cpu/z80/z80daisy.h" |
| 13 | #include "devices/cassette.h" |
| 14 | #include "machine/z80pio.h" |
| 15 | #include "machine/z80sio.h" |
| 16 | #include "machine/z80ctc.h" |
| 11 | 17 | |
| 12 | | static ADDRESS_MAP_START(huebler_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 18 | /* Read/Write Handlers */ |
| 19 | |
| 20 | static READ8_DEVICE_HANDLER( huebler_z80sio_r ) |
| 21 | { |
| 22 | switch (offset) |
| 23 | { |
| 24 | case 0: return z80sio_d_r(device, 0); |
| 25 | case 1: return z80sio_c_r(device, 0); |
| 26 | case 2: return z80sio_d_r(device, 1); |
| 27 | case 3: return z80sio_c_r(device, 1); |
| 28 | } |
| 29 | |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | static WRITE8_DEVICE_HANDLER( huebler_z80sio_w ) |
| 34 | { |
| 35 | switch (offset) |
| 36 | { |
| 37 | case 0: z80sio_d_w(device, 0, data); break; |
| 38 | case 1: z80sio_c_w(device, 0, data); break; |
| 39 | case 2: z80sio_d_w(device, 1, data); break; |
| 40 | case 3: z80sio_c_w(device, 1, data); break; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | /* Memory Maps */ |
| 45 | |
| 46 | static ADDRESS_MAP_START( huebler_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 13 | 47 | ADDRESS_MAP_UNMAP_HIGH |
| 48 | AM_RANGE(0x0000, 0xe7ff) AM_RAM |
| 49 | AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_MEMBER(huebler_state, video_ram) |
| 50 | AM_RANGE(0xf000, 0xfbff) AM_ROM |
| 51 | AM_RANGE(0xfc00, 0xffff) AM_RAM |
| 14 | 52 | ADDRESS_MAP_END |
| 15 | 53 | |
| 16 | | static ADDRESS_MAP_START( huebler_io , ADDRESS_SPACE_IO, 8) |
| 54 | static ADDRESS_MAP_START( huebler_io, ADDRESS_SPACE_IO, 8 ) |
| 17 | 55 | ADDRESS_MAP_UNMAP_HIGH |
| 56 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 57 | AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(Z80PIO2_TAG, z80pio_alt_r, z80pio_alt_w) |
| 58 | AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(Z80PIO1_TAG, z80pio_alt_r, z80pio_alt_w) |
| 59 | AM_RANGE(0x14, 0x17) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_r, z80ctc_w) |
| 60 | AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE(Z80SIO_TAG, huebler_z80sio_r, huebler_z80sio_w) |
| 18 | 61 | ADDRESS_MAP_END |
| 19 | 62 | |
| 20 | | /* Input ports */ |
| 63 | /* Input Ports */ |
| 64 | |
| 21 | 65 | static INPUT_PORTS_START( huebler ) |
| 22 | 66 | INPUT_PORTS_END |
| 23 | 67 | |
| 68 | /* Video */ |
| 24 | 69 | |
| 25 | | static MACHINE_RESET(huebler) |
| 70 | static VIDEO_START( huebler ) |
| 26 | 71 | { |
| 27 | | } |
| 72 | huebler_state *state = machine->driver_data; |
| 28 | 73 | |
| 29 | | static VIDEO_START( huebler ) |
| 30 | | { |
| 74 | /* find memory regions */ |
| 75 | state->char_rom = memory_region(machine, "chargen"); |
| 31 | 76 | } |
| 32 | 77 | |
| 33 | 78 | static VIDEO_UPDATE( huebler ) |
| 34 | 79 | { |
| 80 | huebler_state *state = screen->machine->driver_data; |
| 81 | |
| 82 | int y, sx, x, line; |
| 83 | |
| 84 | for (y = 0; y < 240; y++) |
| 85 | { |
| 86 | line = y % 10; |
| 87 | |
| 88 | for (sx = 0; sx < 64; sx++) |
| 89 | { |
| 90 | UINT16 videoram_addr = ((y / 10) * 64) + sx; |
| 91 | UINT8 videoram_data = state->video_ram[videoram_addr & 0x7ff]; |
| 92 | |
| 93 | UINT16 charrom_addr = (videoram_data << 3) | line; |
| 94 | UINT8 data = state->char_rom[charrom_addr & 0x3ff]; |
| 95 | |
| 96 | for (x = 0; x < 6; x++) |
| 97 | { |
| 98 | int color = (line > 7) ? 0 : BIT(data, 7); |
| 99 | |
| 100 | *BITMAP_ADDR16(bitmap, y, (sx * 6) + x) = color; |
| 101 | |
| 102 | data <<= 1; |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | |
| 35 | 107 | return 0; |
| 36 | 108 | } |
| 37 | 109 | |
| 110 | /* Z80-CTC Interface */ |
| 111 | |
| 112 | static void z80daisy_interrupt(const device_config *device, int state) |
| 113 | { |
| 114 | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_IRQ0, state); |
| 115 | } |
| 116 | |
| 117 | static WRITE8_DEVICE_HANDLER( ctc_z0_w ) |
| 118 | { |
| 119 | } |
| 120 | |
| 121 | static WRITE8_DEVICE_HANDLER( ctc_z1_w ) |
| 122 | { |
| 123 | } |
| 124 | |
| 125 | static WRITE8_DEVICE_HANDLER( ctc_z2_w ) |
| 126 | { |
| 127 | } |
| 128 | |
| 129 | static const z80ctc_interface ctc_intf = |
| 130 | { |
| 131 | 0, /* timer disables */ |
| 132 | z80daisy_interrupt, /* interrupt handler */ |
| 133 | ctc_z0_w, /* ZC/TO0 callback */ |
| 134 | ctc_z1_w, /* ZC/TO1 callback */ |
| 135 | ctc_z2_w /* ZC/TO2 callback */ |
| 136 | }; |
| 137 | |
| 138 | /* Z80-PIO Interface */ |
| 139 | |
| 140 | static const z80pio_interface pio1_intf = |
| 141 | { |
| 142 | DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0), /* callback when change interrupt status */ |
| 143 | DEVCB_NULL, /* port A read callback */ |
| 144 | DEVCB_NULL, /* port B read callback */ |
| 145 | DEVCB_NULL, /* port A write callback */ |
| 146 | DEVCB_NULL, /* port B write callback */ |
| 147 | DEVCB_NULL, /* portA ready active callback */ |
| 148 | DEVCB_NULL /* portB ready active callback */ |
| 149 | }; |
| 150 | |
| 151 | static const z80pio_interface pio2_intf = |
| 152 | { |
| 153 | DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0), /* callback when change interrupt status */ |
| 154 | DEVCB_NULL, /* port A read callback */ |
| 155 | DEVCB_NULL, /* port B read callback */ |
| 156 | DEVCB_NULL, /* port A write callback */ |
| 157 | DEVCB_NULL, /* port B write callback */ |
| 158 | DEVCB_NULL, /* portA ready active callback */ |
| 159 | DEVCB_NULL /* portB ready active callback */ |
| 160 | }; |
| 161 | |
| 162 | /* Z80-PIO Interface */ |
| 163 | |
| 164 | static const z80sio_interface sio_intf = |
| 165 | { |
| 166 | z80daisy_interrupt, /* interrupt handler */ |
| 167 | NULL, /* DTR changed handler */ |
| 168 | NULL, /* RTS changed handler */ |
| 169 | NULL, /* BREAK changed handler */ |
| 170 | NULL, /* transmit handler */ |
| 171 | NULL /* receive handler */ |
| 172 | }; |
| 173 | |
| 174 | /* Z80 Daisy Chain */ |
| 175 | |
| 176 | static const z80_daisy_chain huebler_daisy_chain[] = |
| 177 | { |
| 178 | { Z80CTC_TAG }, |
| 179 | { Z80SIO_TAG }, |
| 180 | { Z80PIO1_TAG }, |
| 181 | { Z80PIO2_TAG }, |
| 182 | { NULL } |
| 183 | }; |
| 184 | |
| 185 | /* Machine Initialization */ |
| 186 | |
| 187 | static MACHINE_START(huebler) |
| 188 | { |
| 189 | } |
| 190 | |
| 191 | /* Machine Driver */ |
| 192 | |
| 193 | static const cassette_config huebler_cassette_config = |
| 194 | { |
| 195 | cassette_default_formats, |
| 196 | NULL, |
| 197 | CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED |
| 198 | }; |
| 199 | |
| 38 | 200 | static MACHINE_DRIVER_START( huebler ) |
| 39 | | /* basic machine hardware */ |
| 40 | | MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| 201 | MDRV_DRIVER_DATA(huebler_state) |
| 202 | |
| 203 | /* basic machine hardware */ |
| 204 | MDRV_CPU_ADD(Z80_TAG, Z80, 2500000) /* U880D */ |
| 41 | 205 | MDRV_CPU_PROGRAM_MAP(huebler_mem) |
| 42 | 206 | MDRV_CPU_IO_MAP(huebler_io) |
| 207 | MDRV_CPU_CONFIG(huebler_daisy_chain) |
| 43 | 208 | |
| 44 | | MDRV_MACHINE_RESET(huebler) |
| 209 | MDRV_MACHINE_START(huebler) |
| 45 | 210 | |
| 46 | 211 | /* video hardware */ |
| 47 | | MDRV_SCREEN_ADD("screen", RASTER) |
| 212 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 48 | 213 | MDRV_SCREEN_REFRESH_RATE(50) |
| 49 | 214 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 50 | 215 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 51 | | MDRV_SCREEN_SIZE(640, 480) |
| 52 | | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 216 | MDRV_SCREEN_SIZE(384, 240) |
| 217 | MDRV_SCREEN_VISIBLE_AREA(0, 384-1, 0, 240-1) |
| 53 | 218 | MDRV_PALETTE_LENGTH(2) |
| 54 | 219 | MDRV_PALETTE_INIT(black_and_white) |
| 55 | 220 | |
| 56 | 221 | MDRV_VIDEO_START(huebler) |
| 57 | 222 | MDRV_VIDEO_UPDATE(huebler) |
| 223 | |
| 224 | /* devices */ |
| 225 | MDRV_Z80CTC_ADD(Z80CTC_TAG, 2500000, ctc_intf) |
| 226 | MDRV_Z80PIO_ADD(Z80PIO1_TAG, pio1_intf) |
| 227 | MDRV_Z80PIO_ADD(Z80PIO2_TAG, pio2_intf) |
| 228 | MDRV_Z80SIO_ADD(Z80SIO_TAG, 2500000, sio_intf) |
| 229 | |
| 230 | MDRV_CASSETTE_ADD(CASSETTE_TAG, huebler_cassette_config) |
| 58 | 231 | MACHINE_DRIVER_END |
| 59 | 232 | |
| 60 | | static SYSTEM_CONFIG_START(huebler) |
| 61 | | SYSTEM_CONFIG_END |
| 233 | /* ROMs */ |
| 62 | 234 | |
| 63 | | /* ROM definition */ |
| 64 | 235 | ROM_START( huebler ) |
| 65 | | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 66 | | /* Various bioses here, load address of each is shown */ |
| 67 | | ROM_LOAD( "mon21.bin", 0xf000, 0x0bdf, CRC(ba905563) SHA1(1fa0aeab5428731756bdfa74efa3c664898bf083)) |
| 68 | | ROM_LOAD( "mon30.bin", 0x0000, 0x1000, CRC(033f8112) SHA1(0c6ae7b9d310dec093652db6e8ae84f8ebfdcd29)) |
| 69 | | ROM_LOAD( "mon30p_hbasic33p.bin", 0x0000, 0x4800, CRC(c927e7be) SHA1(2d1f3ff4d882c40438a1281872c6037b2f07fdf2)) |
| 236 | ROM_REGION( 0x10000, Z80_TAG, 0 ) |
| 237 | ROM_LOAD( "mon21.bin", 0xf000, 0x0bdf, BAD_DUMP CRC(ba905563) SHA1(1fa0aeab5428731756bdfa74efa3c664898bf083) ) |
| 238 | ROM_LOAD( "mon30.bin", 0x0000, 0x1000, CRC(033f8112) SHA1(0c6ae7b9d310dec093652db6e8ae84f8ebfdcd29) ) |
| 239 | ROM_LOAD( "mon30p_hbasic33p.bin", 0x0000, 0x4800, CRC(c927e7be) SHA1(2d1f3ff4d882c40438a1281872c6037b2f07fdf2) ) |
| 70 | 240 | |
| 71 | | ROM_REGION( 0x0400, "gfx1", ROMREGION_ERASEFF ) |
| 72 | | ROM_LOAD( "hemcfont.bin", 0x0000, 0x0400, CRC(1074d103) SHA1(e558279cff5744acef4eccf30759a9508b7f8750)) |
| 241 | ROM_REGION( 0x0400, "chargen", 0 ) |
| 242 | ROM_LOAD( "hemcfont.bin", 0x0000, 0x0400, CRC(1074d103) SHA1(e558279cff5744acef4eccf30759a9508b7f8750) ) |
| 73 | 243 | ROM_END |
| 74 | 244 | |
| 75 | | /* Driver */ |
| 245 | /* System Configuration */ |
| 76 | 246 | |
| 77 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 78 | | COMP( ????, huebler, 0, 0, huebler, huebler, 0, huebler, "Bernd Hubler, Klaus-Peter Evert", "Hubler/Everts", GAME_NOT_WORKING) |
| 247 | static SYSTEM_CONFIG_START( huebler ) |
| 248 | CONFIG_RAM_DEFAULT( 59 * 1024 ) |
| 249 | SYSTEM_CONFIG_END |
| 79 | 250 | |
| 251 | /* System Drivers */ |
| 252 | |
| 253 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 254 | COMP( 1985, huebler, 0, 0, huebler, huebler, 0, huebler, "Bernd Hubler, Klaus-Peter Evert", "Hubler/Everts", GAME_NOT_WORKING ) |