src/mess/drivers/bondwell.c
| r5013 | r5014 | |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | 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" |
| 11 | 17 | |
| 12 | 18 | static UINT8 *bw_videoram; |
| 13 | 19 | |
| r5013 | r5014 | |
| 20 | 26 | |
| 21 | 27 | static ADDRESS_MAP_START( bw12_io , ADDRESS_SPACE_IO, 8) |
| 22 | 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) |
| 23 | 40 | ADDRESS_MAP_END |
| 24 | 41 | |
| 25 | 42 | /* Input ports */ |
| 26 | 43 | static INPUT_PORTS_START( bw12 ) |
| 27 | 44 | INPUT_PORTS_END |
| 28 | 45 | |
| 29 | | |
| 30 | 46 | static MACHINE_RESET(bw12) |
| 31 | 47 | { |
| 32 | 48 | } |
| r5013 | r5014 | |
| 37 | 53 | |
| 38 | 54 | static VIDEO_UPDATE( bw12 ) |
| 39 | 55 | { |
| 40 | | UINT8 *gfx = memory_region(screen->machine, "gfx1"); |
| 41 | | int x,y,b; |
| 56 | const device_config *mc6845 = devtag_get_device(screen->machine, "crtc"); |
| 57 | mc6845_update(mc6845, bitmap, cliprect); |
| 58 | return 0; |
| 59 | } |
| 42 | 60 | |
| 43 | | for(y = 0; y < 25*8; y++ ) |
| 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++) |
| 44 | 68 | { |
| 45 | | for(x = 0; x < 80; x++ ) |
| 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++) |
| 46 | 74 | { |
| 47 | | int addr = x + (y / 8)*80; |
| 48 | | UINT8 code = gfx[bw_videoram [addr]*16+ (y % 8)]; |
| 49 | | for (b = 7; b >= 0; b--) |
| 50 | | { |
| 51 | | UINT8 col = (code >> b) & 0x01; |
| 52 | | *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) = col; |
| 53 | | } |
| 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; |
| 54 | 81 | } |
| 55 | 82 | } |
| 83 | } |
| 56 | 84 | |
| 57 | | return 0; |
| 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; |
| 58 | 110 | } |
| 59 | 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 | 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 | }; |
| 60 | 143 | static MACHINE_DRIVER_START( bw12 ) |
| 61 | 144 | /* basic machine hardware */ |
| 62 | 145 | MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| r5013 | r5014 | |
| 66 | 149 | MDRV_MACHINE_RESET(bw12) |
| 67 | 150 | |
| 68 | 151 | /* video hardware */ |
| 69 | | MDRV_SCREEN_ADD("screen", RASTER) |
| 70 | | MDRV_SCREEN_REFRESH_RATE(50) |
| 71 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 72 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 73 | | MDRV_SCREEN_SIZE(80*8, 25*8) |
| 74 | | MDRV_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 25*8-1) |
| 75 | | MDRV_PALETTE_LENGTH(2) |
| 76 | | MDRV_PALETTE_INIT(black_and_white) |
| 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) |
| 77 | 160 | |
| 161 | MDRV_MC6845_ADD("crtc", MC6845, XTAL_12_288MHz / 8, bw12_crtc6845_interface) |
| 162 | |
| 78 | 163 | MDRV_VIDEO_START(bw12) |
| 79 | 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 ) |
| 80 | 174 | MACHINE_DRIVER_END |
| 81 | 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 | |
| 82 | 199 | static SYSTEM_CONFIG_START(bw12) |
| 83 | 200 | CONFIG_RAM_DEFAULT(64 * 1024) |
| 201 | CONFIG_DEVICE(bw12_floppy_getinfo) |
| 84 | 202 | SYSTEM_CONFIG_END |
| 85 | 203 | |
| 86 | 204 | static SYSTEM_CONFIG_START(bw14) |
| 87 | 205 | CONFIG_RAM_DEFAULT(128 * 1024) |
| 206 | CONFIG_DEVICE(bw12_floppy_getinfo) |
| 88 | 207 | SYSTEM_CONFIG_END |
| 89 | 208 | |
| 90 | 209 | /* ROM definition */ |