src/mess/drivers/bondwell.c
| r5073 | r5074 | |
| 1 | | /*************************************************************************** |
| 2 | | |
| 3 | | Bondwell 12/14 |
| 4 | | |
| 5 | | 12/05/2009 Skeleton driver. |
| 6 | | |
| 7 | | ****************************************************************************/ |
| 8 | | |
| 9 | | #include "driver.h" |
| 10 | | #include "cpu/z80/z80.h" |
| 11 | | #include "video/mc6845.h" |
| 12 | | #include "machine/nec765.h" |
| 13 | | #include "devices/basicdsk.h" |
| 14 | | #include "machine/6821pia.h" |
| 15 | | #include "machine/z80ctc.h" |
| 16 | | #include "machine/z80sio.h" |
| 17 | | |
| 18 | | static UINT8 *bw_videoram; |
| 19 | | |
| 20 | | static ADDRESS_MAP_START(bw12_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 21 | | ADDRESS_MAP_UNMAP_HIGH |
| 22 | | AM_RANGE(0x0000, 0x0fff) AM_ROM |
| 23 | | AM_RANGE(0x1000, 0xf7ff) AM_RAM |
| 24 | | AM_RANGE(0xf800, 0xffff) AM_RAM AM_BASE(&bw_videoram) |
| 25 | | ADDRESS_MAP_END |
| 26 | | |
| 27 | | static ADDRESS_MAP_START( bw12_io , ADDRESS_SPACE_IO, 8) |
| 28 | | ADDRESS_MAP_UNMAP_HIGH |
| 29 | | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 30 | | AM_RANGE(0x10, 0x10) AM_DEVWRITE("crtc", mc6845_address_w) |
| 31 | | AM_RANGE(0x11, 0x11) AM_DEVREADWRITE("crtc", mc6845_register_r , mc6845_register_w) |
| 32 | | AM_RANGE(0x20, 0x20) AM_DEVREAD("nec765", nec765_status_r) |
| 33 | | AM_RANGE(0x21, 0x21) AM_DEVREADWRITE("nec765", nec765_data_r, nec765_data_w) |
| 34 | | AM_RANGE(0x3c, 0x3f) AM_DEVREADWRITE("pia6821", pia6821_r, pia6821_w) |
| 35 | | AM_RANGE(0x60, 0x63) AM_DEVREADWRITE("z80ctc", z80ctc_r, z80ctc_w) |
| 36 | | AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("z80sio", z80sio_d_r, z80sio_d_w) |
| 37 | | AM_RANGE(0x41, 0x41) AM_DEVREADWRITE("z80sio", z80sio_c_r, z80sio_c_w) |
| 38 | | AM_RANGE(0x42, 0x42) AM_DEVREADWRITE("z80sio", z80sio_d_r, z80sio_d_w) |
| 39 | | AM_RANGE(0x43, 0x43) AM_DEVREADWRITE("z80sio", z80sio_c_r, z80sio_c_w) |
| 40 | | ADDRESS_MAP_END |
| 41 | | |
| 42 | | /* Input ports */ |
| 43 | | static INPUT_PORTS_START( bw12 ) |
| 44 | | INPUT_PORTS_END |
| 45 | | |
| 46 | | static MACHINE_RESET(bw12) |
| 47 | | { |
| 48 | | } |
| 49 | | |
| 50 | | static VIDEO_START( bw12 ) |
| 51 | | { |
| 52 | | } |
| 53 | | |
| 54 | | static VIDEO_UPDATE( bw12 ) |
| 55 | | { |
| 56 | | const device_config *mc6845 = devtag_get_device(screen->machine, "crtc"); |
| 57 | | mc6845_update(mc6845, bitmap, cliprect); |
| 58 | | return 0; |
| 59 | | } |
| 60 | | |
| 61 | | static MC6845_UPDATE_ROW( bw12_update_row ) |
| 62 | | { |
| 63 | | UINT8 *charrom = memory_region(device->machine, "gfx1"); |
| 64 | | |
| 65 | | int column, bit; |
| 66 | | |
| 67 | | for (column = 0; column < x_count; column++) |
| 68 | | { |
| 69 | | UINT8 code = bw_videoram[((ma + column) & 0x7ff)]; |
| 70 | | UINT16 addr = code << 4 | (ra & 0x0f); |
| 71 | | UINT8 data = charrom[addr & 0x7ff]; |
| 72 | | |
| 73 | | for (bit = 0; bit < 8; bit++) |
| 74 | | { |
| 75 | | int x = (column * 8) + bit; |
| 76 | | int color = BIT(data, 7) ? 1 : 0; |
| 77 | | |
| 78 | | *BITMAP_ADDR16(bitmap, y, x) = color; |
| 79 | | |
| 80 | | data <<= 1; |
| 81 | | } |
| 82 | | } |
| 83 | | } |
| 84 | | |
| 85 | | static const mc6845_interface bw12_crtc6845_interface = |
| 86 | | { |
| 87 | | "screen", |
| 88 | | 8 /*?*/, |
| 89 | | NULL, |
| 90 | | bw12_update_row, |
| 91 | | NULL, |
| 92 | | DEVCB_NULL, |
| 93 | | DEVCB_NULL, |
| 94 | | DEVCB_NULL, |
| 95 | | DEVCB_NULL, |
| 96 | | NULL |
| 97 | | }; |
| 98 | | |
| 99 | | static const nec765_interface bw12_nec765_interface = |
| 100 | | { |
| 101 | | NULL, |
| 102 | | NULL, |
| 103 | | NULL, |
| 104 | | NEC765_RDY_PIN_NOT_CONNECTED |
| 105 | | }; |
| 106 | | |
| 107 | | static READ8_DEVICE_HANDLER(bw12_pia_a_r) |
| 108 | | { |
| 109 | | return 0xff; |
| 110 | | } |
| 111 | | |
| 112 | | static const pia6821_interface bw12_pia_config = |
| 113 | | { |
| 114 | | DEVCB_HANDLER(bw12_pia_a_r), DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, |
| 115 | | DEVCB_NULL, DEVCB_NULL, |
| 116 | | DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL |
| 117 | | }; |
| 118 | | |
| 119 | | static void bw12_ctc_interrupt(const device_config *device, int state) |
| 120 | | { |
| 121 | | cputag_set_input_line(device->machine, "maincpu", 0, state); |
| 122 | | } |
| 123 | | |
| 124 | | static const z80ctc_interface bw12_ctc_intf = |
| 125 | | { |
| 126 | | 0, /* timer disablers */ |
| 127 | | bw12_ctc_interrupt, /* interrupt callback */ |
| 128 | | NULL, /* ZC/TO0 callback */ |
| 129 | | NULL, /* ZC/TO1 callback */ |
| 130 | | NULL /* ZC/TO2 callback */ |
| 131 | | }; |
| 132 | | |
| 133 | | |
| 134 | | static const z80sio_interface bw12_z80sio_intf = |
| 135 | | { |
| 136 | | 0, /* interrupt handler */ |
| 137 | | 0, /* DTR changed handler */ |
| 138 | | 0, /* RTS changed handler */ |
| 139 | | 0, /* BREAK changed handler */ |
| 140 | | 0, /* transmit handler - which channel is this for? */ |
| 141 | | 0 /* receive handler - which channel is this for? */ |
| 142 | | }; |
| 143 | | static MACHINE_DRIVER_START( bw12 ) |
| 144 | | /* basic machine hardware */ |
| 145 | | MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| 146 | | MDRV_CPU_PROGRAM_MAP(bw12_mem) |
| 147 | | MDRV_CPU_IO_MAP(bw12_io) |
| 148 | | |
| 149 | | MDRV_MACHINE_RESET(bw12) |
| 150 | | |
| 151 | | /* video hardware */ |
| 152 | | MDRV_SCREEN_ADD("screen", RASTER) |
| 153 | | MDRV_SCREEN_REFRESH_RATE(60) |
| 154 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 155 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 156 | | MDRV_SCREEN_SIZE(640, 200) |
| 157 | | MDRV_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 200 - 1) |
| 158 | | MDRV_PALETTE_LENGTH(2) |
| 159 | | MDRV_PALETTE_INIT(black_and_white) |
| 160 | | |
| 161 | | MDRV_MC6845_ADD("crtc", MC6845, XTAL_12_288MHz / 8, bw12_crtc6845_interface) |
| 162 | | |
| 163 | | MDRV_VIDEO_START(bw12) |
| 164 | | MDRV_VIDEO_UPDATE(bw12) |
| 165 | | |
| 166 | | /* NEC765 */ |
| 167 | | MDRV_NEC765A_ADD("nec765", bw12_nec765_interface) |
| 168 | | |
| 169 | | MDRV_PIA6821_ADD("pia6821", bw12_pia_config) |
| 170 | | |
| 171 | | MDRV_Z80CTC_ADD( "z80ctc", XTAL_4MHz, bw12_ctc_intf ) |
| 172 | | |
| 173 | | MDRV_Z80SIO_ADD( "z80sio", XTAL_4MHz, bw12_z80sio_intf ) |
| 174 | | MACHINE_DRIVER_END |
| 175 | | |
| 176 | | static DEVICE_IMAGE_LOAD( bw12_floppy ) |
| 177 | | { |
| 178 | | basicdsk_set_geometry (image, 40, 2, 8, 512, 1, 0, FALSE); |
| 179 | | return INIT_PASS; |
| 180 | | } |
| 181 | | |
| 182 | | static void bw12_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 183 | | { |
| 184 | | switch(state) |
| 185 | | { |
| 186 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 187 | | case MESS_DEVINFO_INT_COUNT: info->i = 4; break; |
| 188 | | |
| 189 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 190 | | case MESS_DEVINFO_PTR_LOAD: info->load = DEVICE_IMAGE_LOAD_NAME(bw12_floppy); break; |
| 191 | | |
| 192 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 193 | | case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "img"); break; |
| 194 | | |
| 195 | | default: legacybasicdsk_device_getinfo(devclass, state, info); break; |
| 196 | | } |
| 197 | | } |
| 198 | | |
| 199 | | static SYSTEM_CONFIG_START(bw12) |
| 200 | | CONFIG_RAM_DEFAULT(64 * 1024) |
| 201 | | CONFIG_DEVICE(bw12_floppy_getinfo) |
| 202 | | SYSTEM_CONFIG_END |
| 203 | | |
| 204 | | static SYSTEM_CONFIG_START(bw14) |
| 205 | | CONFIG_RAM_DEFAULT(128 * 1024) |
| 206 | | CONFIG_DEVICE(bw12_floppy_getinfo) |
| 207 | | SYSTEM_CONFIG_END |
| 208 | | |
| 209 | | /* ROM definition */ |
| 210 | | ROM_START( bw12 ) |
| 211 | | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 212 | | ROM_LOAD( "bw14boot.bin", 0x0000, 0x1000, CRC(782fe341) SHA1(eefe5ad6b1ef77a1caf0af743b74de5fa1c4c19d)) |
| 213 | | ROM_REGION(0x1000, "gfx1",0) |
| 214 | | ROM_LOAD( "bw14char.bin", 0x0000, 0x1000, CRC(f9dd68b5) SHA1(50132b759a6d84c22c387c39c0f57535cd380411)) |
| 215 | | ROM_END |
| 216 | | |
| 217 | | #define rom_bw14 rom_bw12 |
| 218 | | /* Driver */ |
| 219 | | |
| 220 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 221 | | COMP( 1984, bw12, 0, 0, bw12, bw12, 0, bw12, "Bondwell", "BW 12", GAME_NOT_WORKING) |
| 222 | | COMP( 1984, bw14, bw12, 0, bw12, bw12, 0, bw14, "Bondwell", "BW 14", GAME_NOT_WORKING) |
src/mess/drivers/bw12.c
| r0 | r5074 | |
| 1 | /***************************************************************************
|
| 2 |
|
| 3 | Bondwell 12/14
|
| 4 | |
| 5 | 12/05/2009 Skeleton driver.
|
| 6 | |
| 7 | - Z80A CPU 4MHz
|
| 8 | - 64KB RAM (BW 12), 128KB RAM (BW 14)
|
| 9 | - 4KB ROM System
|
| 10 | - NEC765A Floppy controller
|
| 11 | - 2 x 5.25" Floppy drives 48 tpi SSDD (BW 12), DSDD (BW 14)
|
| 12 | - MC6845 Video controller
|
| 13 | - 2KB RAM Video buffer
|
| 14 | - 4KB ROM Character set
|
| 15 | - Z80SIO Serial interface
|
| 16 | - MC6821 Parallel interface
|
| 17 | - I8253 Counter-timer |
| 18 | - MC1408 8-bit DAC sound
|
| 19 | - KB3600 PRO (AY-5-3600 PRO) Keyboard controller
|
| 20 | |
| 21 | http://www.eld.leidenuniv.nl/~moene/Home/sitemap/
|
| 22 | http://www.baltissen.org/newhtm/schemas.htm
|
| 23 | |
| 24 | ****************************************************************************/
|
| 25 | |
| 26 | #include "driver.h"
|
| 27 | #include "includes/bw12.h"
|
| 28 | #include "cpu/z80/z80.h"
|
| 29 | #include "devices/basicdsk.h"
|
| 30 | #include "machine/6821pia.h"
|
| 31 | #include "machine/ctronics.h"
|
| 32 | #include "machine/nec765.h"
|
| 33 | #include "machine/pit8253.h"
|
| 34 | #include "machine/rescap.h"
|
| 35 | #include "machine/z80sio.h"
|
| 36 | #include "video/mc6845.h"
|
| 37 | #include "sound/dac.h"
|
| 38 | |
| 39 | /*
|
| 40 | |
| 41 | TODO:
|
| 42 | |
| 43 | - nec765 access violation
|
| 44 | - keyboard
|
| 45 | |
| 46 | */
|
| 47 | |
| 48 | INLINE const device_config *get_floppy_image(running_machine *machine, int drive)
|
| 49 | {
|
| 50 | return image_from_devtype_and_index(machine, IO_FLOPPY, drive);
|
| 51 | }
|
| 52 | |
| 53 | static void bw12_bankswitch(running_machine *machine)
|
| 54 | {
|
| 55 | bw12_state *state = machine->driver_data;
|
| 56 | |
| 57 | const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM);
|
| 58 | |
| 59 | switch (state->bank)
|
| 60 | {
|
| 61 | case 0: /* ROM */
|
| 62 | memory_install_readwrite8_handler(program, 0x0000, 0x7fff, 0, 0, SMH_BANK(1), SMH_UNMAP);
|
| 63 | break;
|
| 64 | |
| 65 | case 1: /* BK0 */
|
| 66 | memory_install_readwrite8_handler(program, 0x0000, 0x7fff, 0, 0, SMH_BANK(1), SMH_BANK(1));
|
| 67 | break;
|
| 68 | |
| 69 | case 2: /* BK1 */
|
| 70 | case 3: /* BK2 */
|
| 71 | if (mess_ram_size > 64*1024)
|
| 72 | {
|
| 73 | memory_install_readwrite8_handler(program, 0x0000, 0x7fff, 0, 0, SMH_BANK(1), SMH_BANK(1));
|
| 74 | }
|
| 75 | else
|
| 76 | {
|
| 77 | memory_install_readwrite8_handler(program, 0x0000, 0x7fff, 0, 0, SMH_UNMAP, SMH_UNMAP);
|
| 78 | }
|
| 79 | break;
|
| 80 | }
|
| 81 | |
| 82 | memory_set_bank(machine, 1, state->bank);
|
| 83 | }
|
| 84 | |
| 85 | static TIMER_CALLBACK( floppy_motor_off_tick )
|
| 86 | {
|
| 87 | bw12_state *state = machine->driver_data;
|
| 88 | |
| 89 | floppy_drive_set_motor_state(get_floppy_image(machine, 0), 0);
|
| 90 | floppy_drive_set_motor_state(get_floppy_image(machine, 1), 0);
|
| 91 | floppy_drive_set_ready_state(get_floppy_image(machine, 0), 0, 1);
|
| 92 | floppy_drive_set_ready_state(get_floppy_image(machine, 1), 0, 1);
|
| 93 | |
| 94 | state->motor_on = 0;
|
| 95 | }
|
| 96 | |
| 97 | static void bw12_set_floppy_motor_off_timer(running_machine *machine)
|
| 98 | {
|
| 99 | bw12_state *state = machine->driver_data;
|
| 100 | |
| 101 | if (state->motor0 || state->motor1)
|
| 102 | {
|
| 103 | /* trigger floppy motor off NE556 timer */
|
| 104 | int t = 1100 * RES_K(100) * CAP_U(4.7); // t = 1.1 * R18 * C11
|
| 105 | |
| 106 | timer_adjust_oneshot(state->floppy_motor_off_timer, ATTOTIME_IN_MSEC(t), 0);
|
| 107 | |
| 108 | state->motor_on = 1;
|
| 109 | }
|
| 110 | }
|
| 111 | |
| 112 | static void ls259_w(running_machine *machine, int address, int data)
|
| 113 | {
|
| 114 | bw12_state *state = machine->driver_data;
|
| 115 | |
| 116 | switch (address)
|
| 117 | {
|
| 118 | case 0: /* LS138 A0 */
|
| 119 | state->bank = (state->bank & 0x02) | data;
|
| 120 | bw12_bankswitch(machine);
|
| 121 | break;
|
| 122 | |
| 123 | case 1: /* LS138 A1 */
|
| 124 | state->bank = (data << 1) | (state->bank & 0x01);
|
| 125 | bw12_bankswitch(machine);
|
| 126 | break;
|
| 127 | |
| 128 | case 2: /* not connected */
|
| 129 | break;
|
| 130 | |
| 131 | case 3: /* _INIT */
|
| 132 | break;
|
| 133 | |
| 134 | case 4: /* CAP LOCK */
|
| 135 | output_set_led_value(0, data);
|
| 136 | break;
|
| 137 | |
| 138 | case 5: /* MOTOR 0 */
|
| 139 | state->motor0 = data;
|
| 140 | |
| 141 | if (data)
|
| 142 | {
|
| 143 | floppy_drive_set_motor_state(get_floppy_image(machine, 0), 1);
|
| 144 | floppy_drive_set_ready_state(get_floppy_image(machine, 0), 1, 1);
|
| 145 | }
|
| 146 | |
| 147 | bw12_set_floppy_motor_off_timer(machine);
|
| 148 | break;
|
| 149 | |
| 150 | case 6: /* MOTOR 1 */
|
| 151 | state->motor1 = data;
|
| 152 | |
| 153 | if (data)
|
| 154 | {
|
| 155 | floppy_drive_set_motor_state(get_floppy_image(machine, 1), 1);
|
| 156 | floppy_drive_set_ready_state(get_floppy_image(machine, 1), 1, 1);
|
| 157 | }
|
| 158 | |
| 159 | bw12_set_floppy_motor_off_timer(machine);
|
| 160 | break;
|
| 161 | |
| 162 | case 7: /* FDC TC */
|
| 163 | nec765_set_tc_state(state->nec765, data);
|
| 164 | break;
|
| 165 | }
|
| 166 | }
|
| 167 | |
| 168 | static WRITE8_HANDLER( bw12_ls259_w )
|
| 169 | {
|
| 170 | int d = BIT(offset, 0);
|
| 171 | int a = (offset >> 1) & 0x07;
|
| 172 | |
| 173 | ls259_w(space->machine, a, d);
|
| 174 | }
|
| 175 | |
| 176 | static READ8_HANDLER( bw12_ls259_r )
|
| 177 | {
|
| 178 | bw12_ls259_w(space, offset, 0);
|
| 179 | |
| 180 | return 0;
|
| 181 | }
|
| 182 | |
| 183 | /* Memory Maps */
|
| 184 | |
| 185 | static ADDRESS_MAP_START( bw12_mem, ADDRESS_SPACE_PROGRAM, 8 )
|
| 186 | AM_RANGE(0x0000, 0x7fff) AM_RAMBANK(1)
|
| 187 | AM_RANGE(0x8000, 0xf7ff) AM_RAM
|
| 188 | AM_RANGE(0xf800, 0xffff) AM_RAM AM_BASE_MEMBER(bw12_state, video_ram)
|
| 189 | ADDRESS_MAP_END
|
| 190 | |
| 191 | static ADDRESS_MAP_START( bw12_io, ADDRESS_SPACE_IO, 8 )
|
| 192 | ADDRESS_MAP_GLOBAL_MASK(0xff)
|
| 193 | AM_RANGE(0x00, 0x0f) AM_READWRITE(bw12_ls259_r, bw12_ls259_w)
|
| 194 | AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_DEVWRITE(MC6845_TAG, mc6845_address_w)
|
| 195 | AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_DEVREADWRITE(MC6845_TAG, mc6845_register_r, mc6845_register_w)
|
| 196 | AM_RANGE(0x20, 0x20) AM_MIRROR(0x0e) AM_DEVREAD(NEC765_TAG, nec765_status_r)
|
| 197 | AM_RANGE(0x21, 0x21) AM_MIRROR(0x0e) AM_DEVREADWRITE(NEC765_TAG, nec765_data_r, nec765_data_w)
|
| 198 | AM_RANGE(0x30, 0x33) AM_MIRROR(0x0c) AM_DEVREADWRITE(PIA6821_TAG, pia6821_r, pia6821_w)
|
| 199 | AM_RANGE(0x40, 0x40) AM_MIRROR(0x0c) AM_DEVREADWRITE(Z80SIO_TAG, z80sio_d_r, z80sio_d_w)
|
| 200 | AM_RANGE(0x41, 0x41) AM_MIRROR(0x0c) AM_DEVREADWRITE(Z80SIO_TAG, z80sio_c_r, z80sio_c_w)
|
| 201 | AM_RANGE(0x42, 0x42) AM_MIRROR(0x0c) AM_DEVREADWRITE(Z80SIO_TAG, z80sio_d_r, z80sio_d_w)
|
| 202 | AM_RANGE(0x43, 0x43) AM_MIRROR(0x0c) AM_DEVREADWRITE(Z80SIO_TAG, z80sio_c_r, z80sio_c_w)
|
| 203 | AM_RANGE(0x50, 0x50) AM_MIRROR(0x0f) AM_DEVWRITE(MC1408_TAG, dac_w)
|
| 204 | AM_RANGE(0x60, 0x63) AM_MIRROR(0x0c) AM_DEVREADWRITE(PIT8253_TAG, pit8253_r, pit8253_w)
|
| 205 | ADDRESS_MAP_END
|
| 206 | |
| 207 | /* Input Ports */
|
| 208 | |
| 209 | static INPUT_PORTS_START( bw12 )
|
| 210 | /*
|
| 211 | |
| 212 | KB3600 PRO2 Keyboard matrix
|
| 213 | |
| 214 | | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 | Y8 | Y9 |
|
| 215 | | | | | | | | | | | |
|
| 216 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
| 217 | X0 | 7 | 8 | 9 | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
|
| 218 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
| 219 | X1 | U | I | O | P | Q | W | E | R | T | Y |
|
| 220 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
| 221 | X2 | F15 | F16 | RET | N. | SP | LOCK| F11 | F12 | F13 | F14 |
|
| 222 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
| 223 | X3 | F7 | F8 | F9 | F10 | F1 | F2 | F3 | F4 | F5 | F6 |
|
| 224 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
| 225 | X4 | LEFT|RIGHT| N3 | BS | @ | | - | ] | UP | DOWN|
|
| 226 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
| 227 | X5 | N9 | CL | N2 | LF | DEL | HT |ARROW| [ | N7 | N8 |
|
| 228 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
| 229 | X6 | M | , | . | / | Z | X | C | V | B | N |
|
| 230 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
| 231 | X7 | J | K | L | ; | A | S | D | F | G | H |
|
| 232 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
| 233 | X8 | N6 | - | N1 | N0 | ESC | | : | NRET| N4 | N5 |
|
| 234 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
| 235 | |
| 236 | */
|
| 237 | INPUT_PORTS_END
|
| 238 | |
| 239 | /* Video */
|
| 240 | |
| 241 | static PALETTE_INIT( bw12 )
|
| 242 | {
|
| 243 | palette_set_color_rgb(machine, 0, 0x00, 0x00, 0x00); /* black */
|
| 244 | palette_set_color_rgb(machine, 1, 0xf7, 0xaa, 0x00); /* amber */
|
| 245 | }
|
| 246 | |
| 247 | static MC6845_UPDATE_ROW( bw12_update_row )
|
| 248 | {
|
| 249 | bw12_state *state = device->machine->driver_data;
|
| 250 | |
| 251 | int column, bit;
|
| 252 | |
| 253 | for (column = 0; column < x_count; column++)
|
| 254 | {
|
| 255 | UINT8 code = state->video_ram[((ma + column) & BW12_VIDEORAM_MASK)];
|
| 256 | UINT16 addr = code << 4 | (ra & 0x0f);
|
| 257 | UINT8 data = state->char_rom[addr & BW12_CHARROM_MASK];
|
| 258 | |
| 259 | if (column == cursor_x)
|
| 260 | {
|
| 261 | data = 0xff;
|
| 262 | }
|
| 263 | |
| 264 | for (bit = 0; bit < 8; bit++)
|
| 265 | {
|
| 266 | int x = (column * 8) + bit;
|
| 267 | int color = BIT(data, 7);
|
| 268 | |
| 269 | *BITMAP_ADDR16(bitmap, y, x) = color;
|
| 270 | |
| 271 | data <<= 1;
|
| 272 | }
|
| 273 | }
|
| 274 | }
|
| 275 | |
| 276 | static const mc6845_interface bw12_mc6845_interface =
|
| 277 | {
|
| 278 | SCREEN_TAG,
|
| 279 | 8,
|
| 280 | NULL,
|
| 281 | bw12_update_row,
|
| 282 | NULL,
|
| 283 | DEVCB_NULL,
|
| 284 | DEVCB_NULL,
|
| 285 | DEVCB_NULL,
|
| 286 | DEVCB_NULL,
|
| 287 | NULL
|
| 288 | };
|
| 289 | |
| 290 | static VIDEO_START( bw12 )
|
| 291 | {
|
| 292 | bw12_state *state = machine->driver_data;
|
| 293 | |
| 294 | /* find devices */
|
| 295 | state->mc6845 = devtag_get_device(machine, MC6845_TAG);
|
| 296 | |
| 297 | /* find memory regions */
|
| 298 | state->char_rom = memory_region(machine, "chargen");
|
| 299 | }
|
| 300 | |
| 301 | static VIDEO_UPDATE( bw12 )
|
| 302 | {
|
| 303 | bw12_state *state = screen->machine->driver_data;
|
| 304 | |
| 305 | mc6845_update(state->mc6845, bitmap, cliprect);
|
| 306 | |
| 307 | return 0;
|
| 308 | }
|
| 309 | |
| 310 | /* NEC765 Interface */
|
| 311 | |
| 312 | static NEC765_INTERRUPT( bw12_nec765_interrupt )
|
| 313 | {
|
| 314 | bw12_state *driver_state = device->machine->driver_data;
|
| 315 | |
| 316 | driver_state->fdcint = state;
|
| 317 | }
|
| 318 | |
| 319 | static const nec765_interface bw12_nec765_interface =
|
| 320 | {
|
| 321 | bw12_nec765_interrupt, /* interrupt */
|
| 322 | NULL, /* DMA request */
|
| 323 | NULL, /* image lookup */
|
| 324 | NEC765_RDY_PIN_CONNECTED /* ready pin */
|
| 325 | };
|
| 326 | |
| 327 | /* PIA6821 Interface */
|
| 328 | |
| 329 | static WRITE_LINE_DEVICE_HANDLER( bw12_interrupt )
|
| 330 | {
|
| 331 | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_IRQ0, state);
|
| 332 | }
|
| 333 | |
| 334 | static READ8_DEVICE_HANDLER( bw12_pia6821_pa_r )
|
| 335 | {
|
| 336 | /*
|
| 337 | |
| 338 | bit description
|
| 339 | |
| 340 | PA0 Input from Centronics BUSY status
|
| 341 | PA1 Input from Centronics ERROR status
|
| 342 | PA2 Input from Centronics PAPER OUT status
|
| 343 | PA3 Input from FDC MOTOR
|
| 344 | PA4 Input from PIT OUT2
|
| 345 | PA5 Input from keyboard strobe
|
| 346 | PA6 Input from keyboard serial data
|
| 347 | PA7 Input from FDC interrupt
|
| 348 | |
| 349 | */
|
| 350 |
|
| 351 | bw12_state *state = device->machine->driver_data;
|
| 352 |
|
| 353 | UINT8 data = 0;
|
| 354 | |
| 355 | data |= centronics_busy_r(state->centronics);
|
| 356 | data |= (centronics_fault_r(state->centronics) << 1);
|
| 357 | data |= (centronics_pe_r(state->centronics) << 2);
|
| 358 | data |= (state->motor_on << 3);
|
| 359 | data |= (state->pit_out2 << 4);
|
| 360 | data |= (state->key_stb << 5);
|
| 361 | data |= (state->key_sin << 6);
|
| 362 | data |= (state->fdcint << 7);
|
| 363 | |
| 364 | return data;
|
| 365 | }
|
| 366 | |
| 367 | static READ_LINE_DEVICE_HANDLER( bw12_pia6821_ca1_r )
|
| 368 | {
|
| 369 | bw12_state *state = device->machine->driver_data;
|
| 370 | |
| 371 | return centronics_ack_r(state->centronics);
|
| 372 | }
|
| 373 | |
| 374 | static WRITE_LINE_DEVICE_HANDLER( bw12_pia6821_ca2_w )
|
| 375 | {
|
| 376 | bw12_state *driver_state = device->machine->driver_data;
|
| 377 | |
| 378 | centronics_strobe_w(driver_state->centronics, state);
|
| 379 | }
|
| 380 | |
| 381 | static READ_LINE_DEVICE_HANDLER( bw12_pia6821_cb1_r )
|
| 382 | {
|
| 383 | bw12_state *state = device->machine->driver_data;
|
| 384 | |
| 385 | return state->key_stb;
|
| 386 | }
|
| 387 | |
| 388 | static WRITE_LINE_DEVICE_HANDLER( bw12_pia6821_cb2_w )
|
| 389 | {
|
| 390 | // keyboard shift clock
|
| 391 | }
|
| 392 | |
| 393 | static const pia6821_interface bw12_pia_config =
|
| 394 | {
|
| 395 | DEVCB_HANDLER(bw12_pia6821_pa_r), /* port A input */
|
| 396 | DEVCB_NULL, /* port B input */
|
| 397 | DEVCB_LINE(bw12_pia6821_ca1_r), /* CA1 input */
|
| 398 | DEVCB_LINE(bw12_pia6821_cb1_r), /* CB1 input */
|
| 399 | DEVCB_NULL, /* CA2 input */
|
| 400 | DEVCB_NULL, /* CB2 input */
|
| 401 | DEVCB_NULL, /* port A output */
|
| 402 | DEVCB_DEVICE_HANDLER(CENTRONICS_TAG, centronics_data_w), /* port B output */
|
| 403 | DEVCB_LINE(bw12_pia6821_ca2_w), /* CA2 output */
|
| 404 | DEVCB_LINE(bw12_pia6821_cb2_w), /* CB2 output */
|
| 405 | DEVCB_LINE(bw12_interrupt), /* IRQA output */
|
| 406 | DEVCB_LINE(bw12_interrupt) /* IRQB output */
|
| 407 | };
|
| 408 | |
| 409 | /* Centronics Interface */
|
| 410 | |
| 411 | static const centronics_interface bw12_centronics_intf =
|
| 412 | {
|
| 413 | 0, /* is IBM PC? */
|
| 414 | DEVCB_DEVICE_HANDLER(PIA6821_TAG, pia6821_ca1_w), /* ACK output */
|
| 415 | DEVCB_NULL, /* BUSY output */
|
| 416 | DEVCB_NULL /* NOT BUSY output */
|
| 417 | };
|
| 418 | |
| 419 | /* Z80-SIO/0 Interface */
|
| 420 | |
| 421 | static const z80sio_interface bw12_z80sio_intf =
|
| 422 | {
|
| 423 | bw12_interrupt, /* interrupt handler */
|
| 424 | 0, /* DTR changed handler */
|
| 425 | 0, /* RTS changed handler */
|
| 426 | 0, /* BREAK changed handler */
|
| 427 | 0, /* transmit handler - which channel is this for? */
|
| 428 | 0 /* receive handler - which channel is this for? */
|
| 429 | };
|
| 430 | |
| 431 | /* PIT8253 Interface */
|
| 432 | |
| 433 | static WRITE_LINE_DEVICE_HANDLER( bw12_timer2_w )
|
| 434 | {
|
| 435 | bw12_state *driver_state = device->machine->driver_data;
|
| 436 | |
| 437 | driver_state->pit_out2 = state;
|
| 438 | }
|
| 439 | |
| 440 | static const struct pit8253_config bw12_pit8253_intf =
|
| 441 | {
|
| 442 | {
|
| 443 | {
|
| 444 | 1843200, /* Z80 SIO TXCA, RXCA */
|
| 445 | NULL,
|
| 446 | },
|
| 447 | {
|
| 448 | 1843200, /* Z80 SIO RXTXCB */
|
| 449 | NULL,
|
| 450 | },
|
| 451 | {
|
| 452 | 1843200, /* 6821 PIA PA4 */
|
| 453 | bw12_timer2_w,
|
| 454 | }
|
| 455 | }
|
| 456 | };
|
| 457 | |
| 458 | /* Machine Initialization */
|
| 459 | |
| 460 | static MACHINE_START( bw12 )
|
| 461 | {
|
| 462 | bw12_state *state = machine->driver_data;
|
| 463 | |
| 464 | /* find devices */
|
| 465 | state->nec765 = devtag_get_device(machine, NEC765_TAG);
|
| 466 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG);
|
| 467 | |
| 468 | /* allocate floppy motor off timer */
|
| 469 | state->floppy_motor_off_timer = timer_alloc(machine, floppy_motor_off_tick, NULL);
|
| 470 |
|
| 471 | /* setup memory banking */
|
| 472 | memory_configure_bank(machine, 1, 0, 1, memory_region(machine, Z80_TAG), 0);
|
| 473 | memory_configure_bank(machine, 1, 1, 1, mess_ram, 0);
|
| 474 | memory_configure_bank(machine, 1, 2, 2, mess_ram + 0x10000, 0x8000);
|
| 475 | |
| 476 | /* register for state saving */
|
| 477 | state_save_register_global(machine, state->bank);
|
| 478 | state_save_register_global(machine, state->pit_out2);
|
| 479 | state_save_register_global(machine, state->key_data);
|
| 480 | state_save_register_global(machine, state->key_sin);
|
| 481 | state_save_register_global(machine, state->key_stb);
|
| 482 | state_save_register_global(machine, state->fdcint);
|
| 483 | state_save_register_global(machine, state->motor_on);
|
| 484 | state_save_register_global(machine, state->motor0);
|
| 485 | state_save_register_global(machine, state->motor1);
|
| 486 | }
|
| 487 | |
| 488 | static MACHINE_RESET( bw12 )
|
| 489 | {
|
| 490 | int i;
|
| 491 | |
| 492 | for (i = 0; i < 8; i++)
|
| 493 | {
|
| 494 | ls259_w(machine, i, 0);
|
| 495 | }
|
| 496 | }
|
| 497 | |
| 498 | /* Machine Driver */
|
| 499 | |
| 500 | static MACHINE_DRIVER_START( bw12 )
|
| 501 | MDRV_DRIVER_DATA(bw12_state)
|
| 502 | |
| 503 | /* basic machine hardware */
|
| 504 | MDRV_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4)
|
| 505 | MDRV_CPU_PROGRAM_MAP(bw12_mem)
|
| 506 | MDRV_CPU_IO_MAP(bw12_io)
|
| 507 | |
| 508 | MDRV_MACHINE_START(bw12)
|
| 509 | MDRV_MACHINE_RESET(bw12)
|
| 510 |
|
| 511 | /* video hardware */
|
| 512 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
|
| 513 | MDRV_SCREEN_REFRESH_RATE(60)
|
| 514 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
|
| 515 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
| 516 | MDRV_SCREEN_SIZE(640, 200)
|
| 517 | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
|
| 518 | |
| 519 | MDRV_PALETTE_LENGTH(2)
|
| 520 | MDRV_PALETTE_INIT(bw12)
|
| 521 | |
| 522 | MDRV_VIDEO_START(bw12)
|
| 523 | MDRV_VIDEO_UPDATE(bw12)
|
| 524 | |
| 525 | MDRV_MC6845_ADD(MC6845_TAG, MC6845, XTAL_16MHz/8, bw12_mc6845_interface)
|
| 526 |
|
| 527 | /* sound hardware */
|
| 528 | MDRV_SPEAKER_STANDARD_MONO("mono")
|
| 529 | |
| 530 | MDRV_SOUND_ADD(MC1408_TAG, DAC, 0)
|
| 531 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
|
| 532 | |
| 533 | /* devices */
|
| 534 | MDRV_NEC765A_ADD(NEC765_TAG, bw12_nec765_interface)
|
| 535 | MDRV_PIA6821_ADD(PIA6821_TAG, bw12_pia_config)
|
| 536 | MDRV_Z80SIO_ADD(Z80SIO_TAG, XTAL_16MHz/4, bw12_z80sio_intf) /* Z80-SIO/0 */
|
| 537 | MDRV_PIT8253_ADD(PIT8253_TAG, bw12_pit8253_intf)
|
| 538 | |
| 539 | /* printer */
|
| 540 | MDRV_CENTRONICS_ADD(CENTRONICS_TAG, bw12_centronics_intf)
|
| 541 | MACHINE_DRIVER_END
|
| 542 | |
| 543 | /* ROMs */
|
| 544 | |
| 545 | ROM_START( bw12 )
|
| 546 | ROM_REGION( 0x10000, Z80_TAG, 0 )
|
| 547 | ROM_LOAD( "bw14boot.ic41", 0x0000, 0x1000, CRC(782fe341) SHA1(eefe5ad6b1ef77a1caf0af743b74de5fa1c4c19d) )
|
| 548 | |
| 549 | ROM_REGION(0x1000, "chargen", 0)
|
| 550 | ROM_LOAD( "bw14char.ic1", 0x0000, 0x1000, CRC(f9dd68b5) SHA1(50132b759a6d84c22c387c39c0f57535cd380411) )
|
| 551 | ROM_END
|
| 552 | |
| 553 | #define rom_bw14 rom_bw12
|
| 554 | |
| 555 | /* System Configurations */
|
| 556 | |
| 557 | static DEVICE_IMAGE_LOAD( bw12_floppy )
|
| 558 | {
|
| 559 | if (image_has_been_created(image))
|
| 560 | {
|
| 561 | return INIT_FAIL;
|
| 562 | }
|
| 563 | |
| 564 | switch (image_length(image))
|
| 565 | {
|
| 566 | case 40*1*18*256: /* 180KB BW 12 SSDD */
|
| 567 | basicdsk_set_geometry(image, 40, 1, 18, 256, 1, 0, FALSE);
|
| 568 | break;
|
| 569 |
|
| 570 | case 40*2*18*256: /* 360KB BW 14 DSDD */
|
| 571 | basicdsk_set_geometry(image, 40, 2, 18, 256, 1, 0, FALSE);
|
| 572 | break;
|
| 573 | |
| 574 | default:
|
| 575 | return INIT_FAIL;
|
| 576 | }
|
| 577 | |
| 578 | return device_load_basicdsk_floppy(image);
|
| 579 | }
|
| 580 | |
| 581 | static void bw12_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
|
| 582 | {
|
| 583 | switch (state)
|
| 584 | {
|
| 585 | /* --- the following bits of info are returned as 64-bit signed integers --- */
|
| 586 | case MESS_DEVINFO_INT_COUNT: info->i = 2; break;
|
| 587 | |
| 588 | /* --- the following bits of info are returned as pointers to data or functions --- */
|
| 589 | case MESS_DEVINFO_PTR_LOAD: info->load = DEVICE_IMAGE_LOAD_NAME(bw12_floppy); break;
|
| 590 | |
| 591 | /* --- the following bits of info are returned as NULL-terminated strings --- */
|
| 592 | case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "dsk"); break;
|
| 593 | |
| 594 | default: legacybasicdsk_device_getinfo(devclass, state, info); break;
|
| 595 | }
|
| 596 | }
|
| 597 | |
| 598 | static SYSTEM_CONFIG_START( bw12 )
|
| 599 | CONFIG_RAM_DEFAULT( 64 * 1024 )
|
| 600 | CONFIG_DEVICE( bw12_floppy_getinfo )
|
| 601 | SYSTEM_CONFIG_END
|
| 602 | |
| 603 | static SYSTEM_CONFIG_START( bw14 )
|
| 604 | CONFIG_RAM_DEFAULT( 128 * 1024 )
|
| 605 | CONFIG_DEVICE( bw12_floppy_getinfo )
|
| 606 | SYSTEM_CONFIG_END
|
| 607 | |
| 608 | /* System Drivers */
|
| 609 | |
| 610 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */
|
| 611 | COMP( 1984, bw12, 0, 0, bw12, bw12, 0, bw12, "Bondwell", "BW 12", GAME_NOT_WORKING )
|
| 612 | COMP( 1984, bw14, bw12, 0, bw12, bw12, 0, bw14, "Bondwell", "BW 14", GAME_NOT_WORKING )
|