src/mess/drivers/huebler.c
| r6485 | r6486 | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| 9 | /* |
| 10 | |
| 11 | TODO: |
| 12 | |
| 13 | - keyboard |
| 14 | - cassette |
| 15 | - tone generator |
| 16 | - eprom programmer |
| 17 | |
| 18 | */ |
| 19 | |
| 9 | 20 | #include "driver.h" |
| 10 | 21 | #include "includes/huebler.h" |
| 11 | 22 | #include "cpu/z80/z80.h" |
| r6485 | r6486 | |
| 16 | 27 | #include "machine/z80ctc.h" |
| 17 | 28 | #include "devices/messram.h" |
| 18 | 29 | |
| 30 | /* Keyboard */ |
| 31 | |
| 32 | static void keyboard_scan(running_machine *machine) |
| 33 | { |
| 34 | huebler_state *state = machine->driver_data; |
| 35 | // static const char *const keynames[] = { "Y0", "Y1", "Y2", "Y3", "Y4", "Y5", "Y6", "Y7", "Y8", "Y9", "Y10", "Y11", "Y12", "Y13", "Y14", "Y15" }; |
| 36 | // UINT8 data = input_port_read(machine, keynames[state->keylatch]); |
| 37 | |
| 38 | state->keylatch++; |
| 39 | |
| 40 | if (state->keylatch == 16) |
| 41 | { |
| 42 | state->keylatch = 0; |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | static TIMER_DEVICE_CALLBACK( keyboard_tick ) |
| 47 | { |
| 48 | keyboard_scan(timer->machine); |
| 49 | } |
| 50 | |
| 19 | 51 | /* Read/Write Handlers */ |
| 20 | 52 | |
| 21 | 53 | static READ8_DEVICE_HANDLER( huebler_z80sio_r ) |
| r6485 | r6486 | |
| 42 | 74 | } |
| 43 | 75 | } |
| 44 | 76 | |
| 77 | static READ8_HANDLER( keyboard_data_r ) |
| 78 | { |
| 79 | huebler_state *state = space->machine->driver_data; |
| 80 | |
| 81 | return state->keydata; |
| 82 | } |
| 83 | |
| 84 | static READ8_HANDLER( keyboard_status_r ) |
| 85 | { |
| 86 | huebler_state *state = space->machine->driver_data; |
| 87 | |
| 88 | return state->keystatus; |
| 89 | } |
| 90 | |
| 45 | 91 | /* Memory Maps */ |
| 46 | 92 | |
| 47 | 93 | static ADDRESS_MAP_START( huebler_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| r6485 | r6486 | |
| 55 | 101 | static ADDRESS_MAP_START( huebler_io, ADDRESS_SPACE_IO, 8 ) |
| 56 | 102 | ADDRESS_MAP_UNMAP_HIGH |
| 57 | 103 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 104 | // AM_RANGE(0x00, 0x00) AM_WRITE(power_off_w) |
| 105 | // AM_RANGE(0x04, 0x04) AM_WRITE(tone_off_w) |
| 106 | // AM_RANGE(0x05, 0x05) AM_WRITE(tone_on_w) |
| 107 | AM_RANGE(0x08, 0x08) AM_READ(keyboard_data_r) |
| 108 | AM_RANGE(0x09, 0x09) AM_READ(keyboard_status_r) |
| 58 | 109 | AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(Z80PIO2_TAG, z80pio_alt_r, z80pio_alt_w) |
| 59 | 110 | AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(Z80PIO1_TAG, z80pio_alt_r, z80pio_alt_w) |
| 60 | 111 | AM_RANGE(0x14, 0x17) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_r, z80ctc_w) |
| r6485 | r6486 | |
| 64 | 115 | /* Input Ports */ |
| 65 | 116 | |
| 66 | 117 | static INPUT_PORTS_START( huebler ) |
| 118 | PORT_START("Y0") |
| 119 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 120 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 121 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 122 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 123 | |
| 124 | PORT_START("Y1") |
| 125 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 126 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 127 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 128 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 129 | |
| 130 | PORT_START("Y2") |
| 131 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 132 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 133 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 134 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 135 | |
| 136 | PORT_START("Y3") |
| 137 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 138 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 139 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 140 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 141 | |
| 142 | PORT_START("Y4") |
| 143 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 144 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 145 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 146 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 147 | |
| 148 | PORT_START("Y5") |
| 149 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 150 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 151 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 152 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 153 | |
| 154 | PORT_START("Y6") |
| 155 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 156 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 157 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 158 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 159 | |
| 160 | PORT_START("Y7") |
| 161 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 162 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 163 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 164 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 165 | |
| 166 | PORT_START("Y8") |
| 167 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 168 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 169 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 170 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 171 | |
| 172 | PORT_START("Y9") |
| 173 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 174 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 175 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 176 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 177 | |
| 178 | PORT_START("Y10") |
| 179 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 180 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 181 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 182 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 183 | |
| 184 | PORT_START("Y11") |
| 185 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 186 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 187 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 188 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 189 | |
| 190 | PORT_START("Y12") |
| 191 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 192 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 193 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 194 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 195 | |
| 196 | PORT_START("Y13") |
| 197 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 198 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 199 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 200 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 201 | |
| 202 | PORT_START("Y14") |
| 203 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 204 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 205 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 206 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 207 | |
| 208 | PORT_START("Y15") |
| 209 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 210 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 211 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 212 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 67 | 213 | INPUT_PORTS_END |
| 68 | 214 | |
| 69 | 215 | /* Video */ |
| r6485 | r6486 | |
| 91 | 237 | UINT16 videoram_addr = ((y / 10) * 64) + sx; |
| 92 | 238 | UINT8 videoram_data = state->video_ram[videoram_addr & 0x7ff]; |
| 93 | 239 | |
| 94 | | UINT16 charrom_addr = (videoram_data << 3) | line; |
| 240 | UINT16 charrom_addr = ((videoram_data & 0x7f) << 3) | line; |
| 95 | 241 | UINT8 data = state->char_rom[charrom_addr & 0x3ff]; |
| 96 | 242 | |
| 97 | 243 | for (x = 0; x < 6; x++) |
| 98 | 244 | { |
| 99 | | int color = (line > 7) ? 0 : BIT(data, 7); |
| 245 | int color = ((line > 7) ? 0 : BIT(data, 7)) ^ BIT(videoram_data, 7); |
| 100 | 246 | |
| 101 | 247 | *BITMAP_ADDR16(bitmap, y, (sx * 6) + x) = color; |
| 102 | 248 | |
| r6485 | r6486 | |
| 191 | 337 | |
| 192 | 338 | /* find devices */ |
| 193 | 339 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); |
| 340 | |
| 341 | /* find memory regions */ |
| 342 | state->keyboard_rom = memory_region(machine, "keyboard"); |
| 194 | 343 | } |
| 195 | 344 | |
| 196 | 345 | /* Machine Driver */ |
| r6485 | r6486 | |
| 206 | 355 | MDRV_DRIVER_DATA(huebler_state) |
| 207 | 356 | |
| 208 | 357 | /* basic machine hardware */ |
| 209 | | MDRV_CPU_ADD(Z80_TAG, Z80, 2500000) /* U880D */ |
| 358 | MDRV_CPU_ADD(Z80_TAG, Z80, XTAL_10MHz/4) /* U880D */ |
| 210 | 359 | MDRV_CPU_PROGRAM_MAP(huebler_mem) |
| 211 | 360 | MDRV_CPU_IO_MAP(huebler_io) |
| 212 | 361 | MDRV_CPU_CONFIG(huebler_daisy_chain) |
| 213 | 362 | |
| 214 | 363 | MDRV_MACHINE_START(huebler) |
| 215 | 364 | |
| 365 | MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, HZ(1500)) |
| 366 | |
| 216 | 367 | /* video hardware */ |
| 217 | | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 218 | | MDRV_SCREEN_REFRESH_RATE(50) |
| 219 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 220 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 221 | | MDRV_SCREEN_SIZE(384, 240) |
| 222 | | MDRV_SCREEN_VISIBLE_AREA(0, 384-1, 0, 240-1) |
| 368 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 369 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 370 | MDRV_SCREEN_RAW_PARAMS(9000000, 576, 0*6, 64*6, 320, 0*10, 24*10) |
| 371 | |
| 223 | 372 | MDRV_PALETTE_LENGTH(2) |
| 224 | 373 | MDRV_PALETTE_INIT(black_and_white) |
| 225 | 374 | |
| r6485 | r6486 | |
| 227 | 376 | MDRV_VIDEO_UPDATE(huebler) |
| 228 | 377 | |
| 229 | 378 | /* devices */ |
| 230 | | MDRV_Z80CTC_ADD(Z80CTC_TAG, 2500000, ctc_intf) |
| 379 | MDRV_Z80CTC_ADD(Z80CTC_TAG, XTAL_10MHz/4, ctc_intf) |
| 231 | 380 | MDRV_Z80PIO_ADD(Z80PIO1_TAG, pio1_intf) |
| 232 | 381 | MDRV_Z80PIO_ADD(Z80PIO2_TAG, pio2_intf) |
| 233 | | MDRV_Z80SIO_ADD(Z80SIO_TAG, 2500000, sio_intf) |
| 382 | MDRV_Z80SIO_ADD(Z80SIO_TAG, XTAL_10MHz/4, sio_intf) |
| 234 | 383 | |
| 235 | 384 | MDRV_CASSETTE_ADD(CASSETTE_TAG, huebler_cassette_config) |
| 236 | 385 | |
| r6485 | r6486 | |
| 243 | 392 | |
| 244 | 393 | ROM_START( huebler ) |
| 245 | 394 | ROM_REGION( 0x10000, Z80_TAG, 0 ) |
| 246 | | ROM_LOAD( "mon21.bin", 0xf000, 0x0bdf, BAD_DUMP CRC(ba905563) SHA1(1fa0aeab5428731756bdfa74efa3c664898bf083) ) |
| 247 | | ROM_LOAD( "mon30.bin", 0xf000, 0x1000, CRC(033f8112) SHA1(0c6ae7b9d310dec093652db6e8ae84f8ebfdcd29) ) |
| 395 | ROM_DEFAULT_BIOS( "v21" ) |
| 396 | ROM_SYSTEM_BIOS( 0, "v21", "H.MON v2.1" ) |
| 397 | ROMX_LOAD( "mon21.bin", 0xf000, 0x0bdf, BAD_DUMP CRC(ba905563) SHA1(1fa0aeab5428731756bdfa74efa3c664898bf083), ROM_BIOS(1) ) |
| 398 | ROM_SYSTEM_BIOS( 1, "v30", "H.MON v3.0" ) |
| 399 | ROMX_LOAD( "mon30.bin", 0xf000, 0x1000, CRC(033f8112) SHA1(0c6ae7b9d310dec093652db6e8ae84f8ebfdcd29), ROM_BIOS(2) ) |
| 400 | |
| 401 | ROM_REGION( 0x4800, "hbasic", 0 ) |
| 248 | 402 | ROM_LOAD( "mon30p_hbasic33p.bin", 0x0000, 0x4800, CRC(c927e7be) SHA1(2d1f3ff4d882c40438a1281872c6037b2f07fdf2) ) |
| 249 | 403 | |
| 250 | | ROM_REGION( 0x0400, "chargen", 0 ) |
| 404 | ROM_REGION( 0x400, "chargen", 0 ) |
| 251 | 405 | ROM_LOAD( "hemcfont.bin", 0x0000, 0x0400, CRC(1074d103) SHA1(e558279cff5744acef4eccf30759a9508b7f8750) ) |
| 406 | |
| 407 | ROM_REGION( 0x400, "keyboard", 0 ) |
| 408 | ROM_LOAD( "keyboard.bin", 0x0000, 0x0400, BAD_DUMP CRC(daa06361) SHA1(b0299bd8d1686e05dbeeaed54f6c41ae543be20c) ) // typed in from manual |
| 252 | 409 | ROM_END |
| 253 | 410 | |
| 254 | 411 | /* System Drivers */ |