src/mame/drivers/astrocdh.c
| r11527 | r11528 | |
| 1 | | /**************************************************************************** |
| 2 | | |
| 3 | | Bally Astrocade consumer hardware |
| 4 | | driver by Nicola Salmoria, Mike Coates, Frank Palazzolo, Aaron Giles, |
| 5 | | Dirk Best |
| 6 | | |
| 7 | | ****************************************************************************/ |
| 8 | | |
| 9 | | #include "emu.h" |
| 10 | | #include "cpu/z80/z80.h" |
| 11 | | #include "includes/astrocde.h" |
| 12 | | #include "sound/astrocde.h" |
| 13 | | #include "imagedev/cartslot.h" |
| 14 | | #include "machine/ram.h" |
| 15 | | |
| 16 | | MACHINE_RESET( astrocde ); |
| 17 | | void get_ram_expansion_settings(address_space *space, int &ram_expansion_installed, int &write_protect_on, int &expansion_ram_start, int &expansion_ram_end, int &shadow_ram_end); |
| 18 | | |
| 19 | | /************************************* |
| 20 | | * |
| 21 | | * Memory maps |
| 22 | | * |
| 23 | | * $0000 to $1FFF: 8K on-board ROM (could be one of three available BIOS dumps) |
| 24 | | * $2000 to $3FFF: 8K cartridge ROM |
| 25 | | * $4000 to $4FFF: 4K screen RAM |
| 26 | | * $5000 to $FFFF: 44K address space not available in standard machine. With a |
| 27 | | * sufficiently large RAM expansion, all of this RAM can be added, and accessed |
| 28 | | * by an extended BASIC program. Bally and Astrocade BASIC can access from |
| 29 | | * $5000 to $7FFF if available. |
| 30 | | * |
| 31 | | * RAM Expansions |
| 32 | | * |
| 33 | | * Several third party RAM expansions have been made for the Astrocade. These |
| 34 | | * allow access to various ranges of the expansion memory ($5000 to $FFFF). |
| 35 | | * A RAM expansion is required to use extended BASIC programs like Blue RAM BASIC |
| 36 | | * and VIPERSoft BASIC. All of the expansions also have a RAM protect switch, which |
| 37 | | * can be flipped at any time to make the RAM act like ROM. Extended BASIC |
| 38 | | * programs need access to the RAM and won't work with RAM protect enabled, but |
| 39 | | * this can be useful with Bally and Astrocade BASIC. They also have a range switch |
| 40 | | * (not implemented). The default position is 6K, but it can be switched to |
| 41 | | * 2K. This means that the expanded memory starting at $6000 will instead be |
| 42 | | * mapped to the cartridge memory starting at $2000. So it would be possible to |
| 43 | | * load a cartridge program from tape into the expansion memory, then flip the range |
| 44 | | * switch and run it as a cartridge. This is useful for cartridge development. |
| 45 | | * |
| 46 | | * NOTE: If you have any trouble running cartridges with a RAM expansion installed, hit reset. |
| 47 | | * |
| 48 | | * Blue RAM -- available in 4K, 16K, and 32K. These also use an INS8154 chip, |
| 49 | | * (not yet implemented) which has an additional $80 bytes of RAM mapped |
| 50 | | * immediately after the end of the expansion address space. This memory |
| 51 | | * can't be write protected. The INS8154 has I/O features needed for loading |
| 52 | | * tape programs into Blue RAM BASIC, as well as running the Blue RAM Utility cart. |
| 53 | | * 4K: $6000 to $6FFF (can't run VIPERSoft BASIC, because this program needs memory |
| 54 | | * past this range) |
| 55 | | * 16K: $6000 to $9FFF |
| 56 | | * 32K: $6000 to $DFFF |
| 57 | | * |
| 58 | | * VIPER System 1 -- This is available in 16K only. It also includes a keyboard (not implemented). |
| 59 | | * 16K: $6000 to $9FFF |
| 60 | | * |
| 61 | | * Lil' WHITE RAM -- This is available in 32K only. Attempts to read and write |
| 62 | | * to memory outside of its address range ($D000 to $FFFF) are mapped to the expansion |
| 63 | | * memory $5000 to $7FFF. The current implementation won't allow the shadow RAM area |
| 64 | | * to be accessed when RAM protect is on, but there is no known software that will |
| 65 | | * access the upper range of the expansion RAM when RAM protect is enabled. |
| 66 | | * 32K: $5000 to $CFFF |
| 67 | | * |
| 68 | | * R&L 64K RAM Board -- This is a highly configurable kit. RAM can be installed in |
| 69 | | * 2K increments. So, the entire 44K expansion memory can be filled. It is also |
| 70 | | * possible to override the rest of the memory map with RAM (not implemented). |
| 71 | | * There are 32 switches allowing users to activate and deactivate each 2K block (not implemented). |
| 72 | | * RAM write protection can be implemented in three ranges through jumpers or by |
| 73 | | * installing switches. The ranges are $0000 to $0FFF (first 4K), $0000 to $3FFF (first 16K), |
| 74 | | * and $0000 to $FFFF (all 64K). The current implementation is for 44K expansion memory mapped from |
| 75 | | * $5000 to $FFFF, with only a single write protect covering this entire range. |
| 76 | | * |
| 77 | | *************************************/ |
| 78 | | |
| 79 | | static ADDRESS_MAP_START( astrocade_mem, AS_PROGRAM, 8 ) |
| 80 | | AM_RANGE(0x0000, 0x0fff) AM_ROM AM_WRITE(astrocade_funcgen_w) |
| 81 | | AM_RANGE(0x1000, 0x3fff) AM_ROM /* Star Fortress writes in here?? */ |
| 82 | | AM_RANGE(0x4000, 0x4fff) AM_RAM AM_BASE_MEMBER(astrocde_state, m_videoram) /* ASG */ |
| 83 | | ADDRESS_MAP_END |
| 84 | | |
| 85 | | |
| 86 | | static ADDRESS_MAP_START( astrocade_io, AS_IO, 8 ) |
| 87 | | AM_RANGE(0x00, 0x1f) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(astrocade_data_chip_register_r, astrocade_data_chip_register_w) |
| 88 | | ADDRESS_MAP_END |
| 89 | | |
| 90 | | static INPUT_CHANGED( set_write_protect ) // run when RAM expansion write protect switch is changed |
| 91 | | { |
| 92 | | int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0; |
| 93 | | address_space *space = field.machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 94 | | UINT8 *expram = ram_get_ptr(field.machine().device("ram_tag")); |
| 95 | | |
| 96 | | get_ram_expansion_settings(space, ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end); // passing by reference |
| 97 | | |
| 98 | | if (ram_expansion_installed == 1) |
| 99 | | { |
| 100 | | if (write_protect_on == 0) // write protect off, so install memory normally |
| 101 | | { |
| 102 | | space->install_ram(expansion_ram_start, expansion_ram_end, expram); |
| 103 | | if (shadow_ram_end > expansion_ram_end) |
| 104 | | space->install_ram(expansion_ram_end + 1, shadow_ram_end, expram); |
| 105 | | } |
| 106 | | else // write protect on, so make memory read only |
| 107 | | { |
| 108 | | space->nop_write(expansion_ram_start, expansion_ram_end); |
| 109 | | } |
| 110 | | } |
| 111 | | } |
| 112 | | |
| 113 | | /************************************* |
| 114 | | * |
| 115 | | * Input ports |
| 116 | | * |
| 117 | | * |
| 118 | | * The Astrocade has ports for four hand controllers. Each controller has a |
| 119 | | * knob on top that can be simultaneously pushed as an eight-way joystick and |
| 120 | | * twisted as a paddle, in addition to a trigger button. The knob can twist |
| 121 | | * through about 270 degrees, registering 256 unique positions. It does not |
| 122 | | * autocenter. When selecting options on the menu, twisting the knob to the |
| 123 | | * right gives lower numbers, and twisting to the left gives larger numbers. |
| 124 | | * Paddle games like Clowns have more intuitive behavior -- twisting to the |
| 125 | | * right moves the character right. |
| 126 | | * |
| 127 | | * There is a 24-key keypad on the system itself (6 rows, 4 columns). It is |
| 128 | | * labeled for the built-in calculator, but overlays were released for other |
| 129 | | * programs, the most popular being the BASIC cartridges, which allowed a |
| 130 | | * large number of inputs by making the bottom row shift buttons. The labels |
| 131 | | * below first list the calculator key, then the BASIC keys in the order of no |
| 132 | | * shift, GREEN shift, RED shift, BLUE shift, WORDS shift. |
| 133 | | * |
| 134 | | *************************************/ |
| 135 | | |
| 136 | | static INPUT_PORTS_START( astrocde ) |
| 137 | | PORT_START("P1HANDLE") |
| 138 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_8WAY |
| 139 | | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY |
| 140 | | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY |
| 141 | | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY |
| 142 | | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) |
| 143 | | PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 144 | | |
| 145 | | PORT_START("P2HANDLE") |
| 146 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_8WAY |
| 147 | | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_8WAY |
| 148 | | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_8WAY |
| 149 | | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY |
| 150 | | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) |
| 151 | | PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 152 | | |
| 153 | | PORT_START("P3HANDLE") |
| 154 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(3) PORT_8WAY |
| 155 | | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(3) PORT_8WAY |
| 156 | | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(3) PORT_8WAY |
| 157 | | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(3) PORT_8WAY |
| 158 | | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(3) |
| 159 | | PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 160 | | |
| 161 | | PORT_START("P4HANDLE") |
| 162 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(4) PORT_8WAY |
| 163 | | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(4) PORT_8WAY |
| 164 | | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(4) PORT_8WAY |
| 165 | | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(4) PORT_8WAY |
| 166 | | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(4) |
| 167 | | PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 168 | | |
| 169 | | PORT_START("KEYPAD0") |
| 170 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("% \xC3\xB7 [ ] LIST") PORT_CODE(KEYCODE_O) |
| 171 | | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("/ x J K L NEXT") PORT_CODE(KEYCODE_SLASH_PAD) |
| 172 | | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("x - V W X IF") PORT_CODE(KEYCODE_ASTERISK) |
| 173 | | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("- + & @ * GOTO") PORT_CODE(KEYCODE_MINUS_PAD) |
| 174 | | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("+ = # % : PRINT") PORT_CODE(KEYCODE_PLUS_PAD) |
| 175 | | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("= WORDS Shift") PORT_CODE(KEYCODE_ENTER_PAD) |
| 176 | | PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 177 | | |
| 178 | | PORT_START("KEYPAD1") |
| 179 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("\xE2\x86\x93 HALT RUN") PORT_CODE(KEYCODE_PGDN) |
| 180 | | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CH 9 G H I STEP") PORT_CODE(KEYCODE_H) |
| 181 | | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("9 6 S T U RND") PORT_CODE(KEYCODE_9) |
| 182 | | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("6 3 \xE2\x86\x91 . \xE2\x86\x93 BOX") PORT_CODE(KEYCODE_6) |
| 183 | | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("3 ERASE ( ; )") PORT_CODE(KEYCODE_3) |
| 184 | | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME(". BLUE Shift") PORT_CODE(KEYCODE_STOP) |
| 185 | | PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 186 | | |
| 187 | | PORT_START("KEYPAD2") |
| 188 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("\xE2\x86\x91 PAUSE / \\") PORT_CODE(KEYCODE_PGUP) |
| 189 | | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("MS 8 D E F TO") PORT_CODE(KEYCODE_S) |
| 190 | | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("8 5 P Q R RETN") PORT_CODE(KEYCODE_8) |
| 191 | | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("5 2 \xE2\x86\x90 ' \xE2\x86\x92 LINE") PORT_CODE(KEYCODE_5) |
| 192 | | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("2 0 < \" > INPUT") PORT_CODE(KEYCODE_2) |
| 193 | | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("0 RED Shift") PORT_CODE(KEYCODE_0) |
| 194 | | PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 195 | | |
| 196 | | PORT_START("KEYPAD3") |
| 197 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C GO +10") PORT_CODE(KEYCODE_C) |
| 198 | | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("MR 7 A B C FOR") PORT_CODE(KEYCODE_R) |
| 199 | | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("7 4 M N O GOSB") PORT_CODE(KEYCODE_7) |
| 200 | | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("4 1 Y Z ! CLEAR") PORT_CODE(KEYCODE_4) |
| 201 | | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("1 SPACE $ , ?") PORT_CODE(KEYCODE_1) |
| 202 | | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CE GREEN Shift") PORT_CODE(KEYCODE_E) |
| 203 | | PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 204 | | |
| 205 | | PORT_START("P1_KNOB") |
| 206 | | PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_PLAYER(1) |
| 207 | | |
| 208 | | PORT_START("P2_KNOB") |
| 209 | | PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) PORT_PLAYER(2) |
| 210 | | |
| 211 | | PORT_START("P3_KNOB") |
| 212 | | PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Q) PORT_CODE_INC(KEYCODE_W) PORT_PLAYER(3) |
| 213 | | |
| 214 | | PORT_START("P4_KNOB") |
| 215 | | PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Y) PORT_CODE_INC(KEYCODE_U) PORT_PLAYER(4) |
| 216 | | |
| 217 | | PORT_START("CFG") /* machine config */ |
| 218 | | PORT_DIPNAME( 0x3f, 0x00, "RAM Expansion") |
| 219 | | PORT_DIPSETTING( 0x00, "No RAM Expansion") |
| 220 | | PORT_DIPSETTING( 0x01, "16KB Viper System 1 RAM Expansion") |
| 221 | | PORT_DIPSETTING( 0x02, "32KB Lil' WHITE RAM Expansion") |
| 222 | | PORT_DIPSETTING( 0x04, "R&L 64K RAM Board (44K installed)") |
| 223 | | PORT_DIPSETTING( 0x08, "4KB Blue RAM Expansion") |
| 224 | | PORT_DIPSETTING( 0x10, "16KB Blue RAM Expansion") |
| 225 | | PORT_DIPSETTING( 0x20, "32KB Blue RAM Expansion") |
| 226 | | |
| 227 | | PORT_START("PROTECT") /* Write protect RAM */ |
| 228 | | PORT_DIPNAME( 0x01, 0x00, "Write Protect RAM") PORT_CHANGED(set_write_protect, 0) |
| 229 | | PORT_DIPSETTING( 0x00, "Write Protect Off") |
| 230 | | PORT_DIPSETTING( 0x01, "Write Protect On") |
| 231 | | INPUT_PORTS_END |
| 232 | | |
| 233 | | |
| 234 | | /************************************* |
| 235 | | * |
| 236 | | * Machine drivers |
| 237 | | * |
| 238 | | *************************************/ |
| 239 | | |
| 240 | | static MACHINE_CONFIG_START( astrocde, astrocde_state ) |
| 241 | | /* basic machine hardware */ |
| 242 | | MCFG_CPU_ADD("maincpu", Z80, ASTROCADE_CLOCK/4) /* 1.789 MHz */ |
| 243 | | MCFG_CPU_PROGRAM_MAP(astrocade_mem) |
| 244 | | MCFG_CPU_IO_MAP(astrocade_io) |
| 245 | | |
| 246 | | MCFG_MACHINE_RESET( astrocde ) |
| 247 | | |
| 248 | | /* video hardware */ |
| 249 | | MCFG_SCREEN_ADD("screen", RASTER) |
| 250 | | MCFG_SCREEN_RAW_PARAMS(ASTROCADE_CLOCK, 455, 0, 352, 262, 0, 240) |
| 251 | | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 252 | | MCFG_SCREEN_UPDATE(astrocde) |
| 253 | | |
| 254 | | MCFG_PALETTE_LENGTH(512) |
| 255 | | MCFG_PALETTE_INIT(astrocde) |
| 256 | | |
| 257 | | MCFG_VIDEO_START(astrocde) |
| 258 | | |
| 259 | | /* sound hardware */ |
| 260 | | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 261 | | MCFG_SOUND_ADD("astrocade1", ASTROCADE, ASTROCADE_CLOCK/4) |
| 262 | | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 263 | | |
| 264 | | /* optional expansion ram (installed in MACHINE_RESET)*/ |
| 265 | | MCFG_RAM_ADD("ram_tag") |
| 266 | | MCFG_RAM_DEFAULT_SIZE("32k") |
| 267 | | |
| 268 | | /* cartridge */ |
| 269 | | MCFG_CARTSLOT_ADD("cart") |
| 270 | | MCFG_CARTSLOT_EXTENSION_LIST("bin") |
| 271 | | MCFG_CARTSLOT_INTERFACE("astrocde_cart") |
| 272 | | |
| 273 | | /* Software lists */ |
| 274 | | MCFG_SOFTWARE_LIST_ADD("cart_list","astrocde") |
| 275 | | MACHINE_CONFIG_END |
| 276 | | |
| 277 | | |
| 278 | | /************************************* |
| 279 | | * |
| 280 | | * ROM definitions |
| 281 | | * |
| 282 | | *************************************/ |
| 283 | | |
| 284 | | ROM_START( astrocde ) |
| 285 | | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 286 | | ROM_LOAD( "astro.bin", 0x0000, 0x2000, CRC(ebc77f3a) SHA1(b902c941997c9d150a560435bf517c6a28137ecc) ) |
| 287 | | ROM_CART_LOAD( "cart", 0x2000, 0x8000, 0 ) |
| 288 | | ROM_END |
| 289 | | |
| 290 | | ROM_START( astrocdl ) |
| 291 | | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 292 | | ROM_LOAD( "ballyhlc.bin", 0x0000, 0x2000, CRC(d7c517ba) SHA1(6b2bef5d970e54ed204549f58ba6d197a8bfd3cc) ) |
| 293 | | ROM_CART_LOAD( "cart", 0x2000, 0x8000, 0 ) |
| 294 | | ROM_END |
| 295 | | |
| 296 | | ROM_START( astrocdw ) |
| 297 | | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 298 | | ROM_LOAD( "bioswhit.bin", 0x0000, 0x2000, CRC(6eb53e79) SHA1(d84341feec1a0a0e8aa6151b649bc3cf6ef69fbf) ) |
| 299 | | ROM_CART_LOAD( "cart", 0x2000, 0x8000, 0 ) |
| 300 | | ROM_END |
| 301 | | |
| 302 | | /************************************* |
| 303 | | * |
| 304 | | * Driver initialization |
| 305 | | * |
| 306 | | *************************************/ |
| 307 | | |
| 308 | | static DRIVER_INIT( astrocde ) |
| 309 | | { |
| 310 | | astrocde_state *state = machine.driver_data<astrocde_state>(); |
| 311 | | state->m_video_config = AC_SOUND_PRESENT | AC_LIGHTPEN_INTS; |
| 312 | | } |
| 313 | | |
| 314 | | MACHINE_RESET( astrocde ) |
| 315 | | { |
| 316 | | int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0; |
| 317 | | address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM); |
| 318 | | UINT8 *expram = ram_get_ptr(machine.device("ram_tag")); |
| 319 | | space->unmap_readwrite(0x5000, 0xffff); // unmap any previously installed expansion RAM |
| 320 | | |
| 321 | | get_ram_expansion_settings(space, ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end); // passing by reference |
| 322 | | |
| 323 | | if (ram_expansion_installed == 1) |
| 324 | | { |
| 325 | | if (write_protect_on == 0) // write protect off, so install memory normally |
| 326 | | { |
| 327 | | space->install_ram(expansion_ram_start, expansion_ram_end, expram); |
| 328 | | if (shadow_ram_end > expansion_ram_end) |
| 329 | | space->install_ram(expansion_ram_end + 1, shadow_ram_end, expram); |
| 330 | | } |
| 331 | | else // write protect on, so make memory read only |
| 332 | | { |
| 333 | | space->nop_write(expansion_ram_start, expansion_ram_end); |
| 334 | | } |
| 335 | | } |
| 336 | | } |
| 337 | | |
| 338 | | void get_ram_expansion_settings(address_space *space, int &ram_expansion_installed, int &write_protect_on, int &expansion_ram_start, int &expansion_ram_end, int &shadow_ram_end) |
| 339 | | { |
| 340 | | if (input_port_read(space->machine(), "PROTECT") == 0x01) |
| 341 | | write_protect_on = 1; |
| 342 | | else |
| 343 | | write_protect_on = 0; |
| 344 | | |
| 345 | | ram_expansion_installed = 1; |
| 346 | | |
| 347 | | switch(input_port_read(space->machine(), "CFG")) // check RAM expansion configuration and set address ranges |
| 348 | | { |
| 349 | | case 0x00: // No RAM Expansion |
| 350 | | ram_expansion_installed = 0; |
| 351 | | break; |
| 352 | | case 0x01: // 16KB Viper System 1 RAM Expansion |
| 353 | | expansion_ram_start = 0x6000; |
| 354 | | expansion_ram_end = 0x9fff; |
| 355 | | shadow_ram_end = 0; |
| 356 | | break; |
| 357 | | case 0x02: // "32KB Lil' WHITE RAM Expansion |
| 358 | | expansion_ram_start = 0x5000; |
| 359 | | expansion_ram_end = 0xcfff; |
| 360 | | shadow_ram_end = 0xffff; |
| 361 | | break; |
| 362 | | case 0x04: // R&L 64K RAM Board (44KB installed) |
| 363 | | expansion_ram_start = 0x5000; |
| 364 | | expansion_ram_end = 0xffff; |
| 365 | | shadow_ram_end = 0; |
| 366 | | break; |
| 367 | | case 0x08: // 4KB Blue RAM Expansion |
| 368 | | expansion_ram_start = 0x6000; |
| 369 | | expansion_ram_end = 0x6fff; |
| 370 | | shadow_ram_end = 0; |
| 371 | | break; |
| 372 | | case 0x10: // 16KB Blue RAM Expansion |
| 373 | | expansion_ram_start = 0x6000; |
| 374 | | expansion_ram_end = 0x9fff; |
| 375 | | shadow_ram_end = 0; |
| 376 | | break; |
| 377 | | case 0x20: // 32KB Blue RAM Expansion |
| 378 | | expansion_ram_start = 0x6000; |
| 379 | | expansion_ram_end = 0xdfff; |
| 380 | | shadow_ram_end = 0; |
| 381 | | break; |
| 382 | | default: |
| 383 | | break; |
| 384 | | } |
| 385 | | } |
| 386 | | |
| 387 | | |
| 388 | | /************************************* |
| 389 | | * |
| 390 | | * Driver definitions |
| 391 | | * |
| 392 | | *************************************/ |
| 393 | | |
| 394 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 395 | | CONS( 1978, astrocde, 0, 0, astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Professional Arcade", GAME_SUPPORTS_SAVE ) |
| 396 | | CONS( 1977, astrocdl, astrocde, 0, astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Home Library Computer", GAME_SUPPORTS_SAVE ) |
| 397 | | CONS( 1977, astrocdw, astrocde, 0, astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Computer System", GAME_SUPPORTS_SAVE ) |
src/mess/drivers/astrocde.c
| r0 | r11528 | |
| 1 | /**************************************************************************** |
| 2 | |
| 3 | Bally Astrocade consumer hardware |
| 4 | driver by Nicola Salmoria, Mike Coates, Frank Palazzolo, Aaron Giles, |
| 5 | Dirk Best |
| 6 | |
| 7 | ****************************************************************************/ |
| 8 | |
| 9 | #include "emu.h" |
| 10 | #include "cpu/z80/z80.h" |
| 11 | #include "includes/astrocde.h" |
| 12 | #include "sound/astrocde.h" |
| 13 | #include "imagedev/cartslot.h" |
| 14 | #include "machine/ram.h" |
| 15 | |
| 16 | MACHINE_RESET( astrocde ); |
| 17 | void get_ram_expansion_settings(address_space *space, int &ram_expansion_installed, int &write_protect_on, int &expansion_ram_start, int &expansion_ram_end, int &shadow_ram_end); |
| 18 | |
| 19 | /************************************* |
| 20 | * |
| 21 | * Memory maps |
| 22 | * |
| 23 | * $0000 to $1FFF: 8K on-board ROM (could be one of three available BIOS dumps) |
| 24 | * $2000 to $3FFF: 8K cartridge ROM |
| 25 | * $4000 to $4FFF: 4K screen RAM |
| 26 | * $5000 to $FFFF: 44K address space not available in standard machine. With a |
| 27 | * sufficiently large RAM expansion, all of this RAM can be added, and accessed |
| 28 | * by an extended BASIC program. Bally and Astrocade BASIC can access from |
| 29 | * $5000 to $7FFF if available. |
| 30 | * |
| 31 | * RAM Expansions |
| 32 | * |
| 33 | * Several third party RAM expansions have been made for the Astrocade. These |
| 34 | * allow access to various ranges of the expansion memory ($5000 to $FFFF). |
| 35 | * A RAM expansion is required to use extended BASIC programs like Blue RAM BASIC |
| 36 | * and VIPERSoft BASIC. All of the expansions also have a RAM protect switch, which |
| 37 | * can be flipped at any time to make the RAM act like ROM. Extended BASIC |
| 38 | * programs need access to the RAM and won't work with RAM protect enabled, but |
| 39 | * this can be useful with Bally and Astrocade BASIC. They also have a range switch |
| 40 | * (not implemented). The default position is 6K, but it can be switched to |
| 41 | * 2K. This means that the expanded memory starting at $6000 will instead be |
| 42 | * mapped to the cartridge memory starting at $2000. So it would be possible to |
| 43 | * load a cartridge program from tape into the expansion memory, then flip the range |
| 44 | * switch and run it as a cartridge. This is useful for cartridge development. |
| 45 | * |
| 46 | * NOTE: If you have any trouble running cartridges with a RAM expansion installed, hit reset. |
| 47 | * |
| 48 | * Blue RAM -- available in 4K, 16K, and 32K. These also use an INS8154 chip, |
| 49 | * (not yet implemented) which has an additional $80 bytes of RAM mapped |
| 50 | * immediately after the end of the expansion address space. This memory |
| 51 | * can't be write protected. The INS8154 has I/O features needed for loading |
| 52 | * tape programs into Blue RAM BASIC, as well as running the Blue RAM Utility cart. |
| 53 | * 4K: $6000 to $6FFF (can't run VIPERSoft BASIC, because this program needs memory |
| 54 | * past this range) |
| 55 | * 16K: $6000 to $9FFF |
| 56 | * 32K: $6000 to $DFFF |
| 57 | * |
| 58 | * VIPER System 1 -- This is available in 16K only. It also includes a keyboard (not implemented). |
| 59 | * 16K: $6000 to $9FFF |
| 60 | * |
| 61 | * Lil' WHITE RAM -- This is available in 32K only. Attempts to read and write |
| 62 | * to memory outside of its address range ($D000 to $FFFF) are mapped to the expansion |
| 63 | * memory $5000 to $7FFF. The current implementation won't allow the shadow RAM area |
| 64 | * to be accessed when RAM protect is on, but there is no known software that will |
| 65 | * access the upper range of the expansion RAM when RAM protect is enabled. |
| 66 | * 32K: $5000 to $CFFF |
| 67 | * |
| 68 | * R&L 64K RAM Board -- This is a highly configurable kit. RAM can be installed in |
| 69 | * 2K increments. So, the entire 44K expansion memory can be filled. It is also |
| 70 | * possible to override the rest of the memory map with RAM (not implemented). |
| 71 | * There are 32 switches allowing users to activate and deactivate each 2K block (not implemented). |
| 72 | * RAM write protection can be implemented in three ranges through jumpers or by |
| 73 | * installing switches. The ranges are $0000 to $0FFF (first 4K), $0000 to $3FFF (first 16K), |
| 74 | * and $0000 to $FFFF (all 64K). The current implementation is for 44K expansion memory mapped from |
| 75 | * $5000 to $FFFF, with only a single write protect covering this entire range. |
| 76 | * |
| 77 | *************************************/ |
| 78 | |
| 79 | static ADDRESS_MAP_START( astrocade_mem, AS_PROGRAM, 8 ) |
| 80 | AM_RANGE(0x0000, 0x0fff) AM_ROM AM_WRITE(astrocade_funcgen_w) |
| 81 | AM_RANGE(0x1000, 0x3fff) AM_ROM /* Star Fortress writes in here?? */ |
| 82 | AM_RANGE(0x4000, 0x4fff) AM_RAM AM_BASE_MEMBER(astrocde_state, m_videoram) /* ASG */ |
| 83 | ADDRESS_MAP_END |
| 84 | |
| 85 | |
| 86 | static ADDRESS_MAP_START( astrocade_io, AS_IO, 8 ) |
| 87 | AM_RANGE(0x00, 0x1f) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(astrocade_data_chip_register_r, astrocade_data_chip_register_w) |
| 88 | ADDRESS_MAP_END |
| 89 | |
| 90 | static INPUT_CHANGED( set_write_protect ) // run when RAM expansion write protect switch is changed |
| 91 | { |
| 92 | int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0; |
| 93 | address_space *space = field.machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 94 | UINT8 *expram = ram_get_ptr(field.machine().device("ram_tag")); |
| 95 | |
| 96 | get_ram_expansion_settings(space, ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end); // passing by reference |
| 97 | |
| 98 | if (ram_expansion_installed == 1) |
| 99 | { |
| 100 | if (write_protect_on == 0) // write protect off, so install memory normally |
| 101 | { |
| 102 | space->install_ram(expansion_ram_start, expansion_ram_end, expram); |
| 103 | if (shadow_ram_end > expansion_ram_end) |
| 104 | space->install_ram(expansion_ram_end + 1, shadow_ram_end, expram); |
| 105 | } |
| 106 | else // write protect on, so make memory read only |
| 107 | { |
| 108 | space->nop_write(expansion_ram_start, expansion_ram_end); |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | /************************************* |
| 114 | * |
| 115 | * Input ports |
| 116 | * |
| 117 | * |
| 118 | * The Astrocade has ports for four hand controllers. Each controller has a |
| 119 | * knob on top that can be simultaneously pushed as an eight-way joystick and |
| 120 | * twisted as a paddle, in addition to a trigger button. The knob can twist |
| 121 | * through about 270 degrees, registering 256 unique positions. It does not |
| 122 | * autocenter. When selecting options on the menu, twisting the knob to the |
| 123 | * right gives lower numbers, and twisting to the left gives larger numbers. |
| 124 | * Paddle games like Clowns have more intuitive behavior -- twisting to the |
| 125 | * right moves the character right. |
| 126 | * |
| 127 | * There is a 24-key keypad on the system itself (6 rows, 4 columns). It is |
| 128 | * labeled for the built-in calculator, but overlays were released for other |
| 129 | * programs, the most popular being the BASIC cartridges, which allowed a |
| 130 | * large number of inputs by making the bottom row shift buttons. The labels |
| 131 | * below first list the calculator key, then the BASIC keys in the order of no |
| 132 | * shift, GREEN shift, RED shift, BLUE shift, WORDS shift. |
| 133 | * |
| 134 | *************************************/ |
| 135 | |
| 136 | static INPUT_PORTS_START( astrocde ) |
| 137 | PORT_START("P1HANDLE") |
| 138 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_8WAY |
| 139 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY |
| 140 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY |
| 141 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY |
| 142 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) |
| 143 | PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 144 | |
| 145 | PORT_START("P2HANDLE") |
| 146 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_8WAY |
| 147 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_8WAY |
| 148 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_8WAY |
| 149 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY |
| 150 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) |
| 151 | PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 152 | |
| 153 | PORT_START("P3HANDLE") |
| 154 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(3) PORT_8WAY |
| 155 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(3) PORT_8WAY |
| 156 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(3) PORT_8WAY |
| 157 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(3) PORT_8WAY |
| 158 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(3) |
| 159 | PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 160 | |
| 161 | PORT_START("P4HANDLE") |
| 162 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(4) PORT_8WAY |
| 163 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(4) PORT_8WAY |
| 164 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(4) PORT_8WAY |
| 165 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(4) PORT_8WAY |
| 166 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(4) |
| 167 | PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 168 | |
| 169 | PORT_START("KEYPAD0") |
| 170 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("% \xC3\xB7 [ ] LIST") PORT_CODE(KEYCODE_O) |
| 171 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("/ x J K L NEXT") PORT_CODE(KEYCODE_SLASH_PAD) |
| 172 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("x - V W X IF") PORT_CODE(KEYCODE_ASTERISK) |
| 173 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("- + & @ * GOTO") PORT_CODE(KEYCODE_MINUS_PAD) |
| 174 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("+ = # % : PRINT") PORT_CODE(KEYCODE_PLUS_PAD) |
| 175 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("= WORDS Shift") PORT_CODE(KEYCODE_ENTER_PAD) |
| 176 | PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 177 | |
| 178 | PORT_START("KEYPAD1") |
| 179 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("\xE2\x86\x93 HALT RUN") PORT_CODE(KEYCODE_PGDN) |
| 180 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CH 9 G H I STEP") PORT_CODE(KEYCODE_H) |
| 181 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("9 6 S T U RND") PORT_CODE(KEYCODE_9) |
| 182 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("6 3 \xE2\x86\x91 . \xE2\x86\x93 BOX") PORT_CODE(KEYCODE_6) |
| 183 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("3 ERASE ( ; )") PORT_CODE(KEYCODE_3) |
| 184 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME(". BLUE Shift") PORT_CODE(KEYCODE_STOP) |
| 185 | PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 186 | |
| 187 | PORT_START("KEYPAD2") |
| 188 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("\xE2\x86\x91 PAUSE / \\") PORT_CODE(KEYCODE_PGUP) |
| 189 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("MS 8 D E F TO") PORT_CODE(KEYCODE_S) |
| 190 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("8 5 P Q R RETN") PORT_CODE(KEYCODE_8) |
| 191 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("5 2 \xE2\x86\x90 ' \xE2\x86\x92 LINE") PORT_CODE(KEYCODE_5) |
| 192 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("2 0 < \" > INPUT") PORT_CODE(KEYCODE_2) |
| 193 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("0 RED Shift") PORT_CODE(KEYCODE_0) |
| 194 | PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 195 | |
| 196 | PORT_START("KEYPAD3") |
| 197 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C GO +10") PORT_CODE(KEYCODE_C) |
| 198 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("MR 7 A B C FOR") PORT_CODE(KEYCODE_R) |
| 199 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("7 4 M N O GOSB") PORT_CODE(KEYCODE_7) |
| 200 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("4 1 Y Z ! CLEAR") PORT_CODE(KEYCODE_4) |
| 201 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("1 SPACE $ , ?") PORT_CODE(KEYCODE_1) |
| 202 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CE GREEN Shift") PORT_CODE(KEYCODE_E) |
| 203 | PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 204 | |
| 205 | PORT_START("P1_KNOB") |
| 206 | PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_PLAYER(1) |
| 207 | |
| 208 | PORT_START("P2_KNOB") |
| 209 | PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) PORT_PLAYER(2) |
| 210 | |
| 211 | PORT_START("P3_KNOB") |
| 212 | PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Q) PORT_CODE_INC(KEYCODE_W) PORT_PLAYER(3) |
| 213 | |
| 214 | PORT_START("P4_KNOB") |
| 215 | PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Y) PORT_CODE_INC(KEYCODE_U) PORT_PLAYER(4) |
| 216 | |
| 217 | PORT_START("CFG") /* machine config */ |
| 218 | PORT_DIPNAME( 0x3f, 0x00, "RAM Expansion") |
| 219 | PORT_DIPSETTING( 0x00, "No RAM Expansion") |
| 220 | PORT_DIPSETTING( 0x01, "16KB Viper System 1 RAM Expansion") |
| 221 | PORT_DIPSETTING( 0x02, "32KB Lil' WHITE RAM Expansion") |
| 222 | PORT_DIPSETTING( 0x04, "R&L 64K RAM Board (44K installed)") |
| 223 | PORT_DIPSETTING( 0x08, "4KB Blue RAM Expansion") |
| 224 | PORT_DIPSETTING( 0x10, "16KB Blue RAM Expansion") |
| 225 | PORT_DIPSETTING( 0x20, "32KB Blue RAM Expansion") |
| 226 | |
| 227 | PORT_START("PROTECT") /* Write protect RAM */ |
| 228 | PORT_DIPNAME( 0x01, 0x00, "Write Protect RAM") PORT_CHANGED(set_write_protect, 0) |
| 229 | PORT_DIPSETTING( 0x00, "Write Protect Off") |
| 230 | PORT_DIPSETTING( 0x01, "Write Protect On") |
| 231 | INPUT_PORTS_END |
| 232 | |
| 233 | |
| 234 | /************************************* |
| 235 | * |
| 236 | * Machine drivers |
| 237 | * |
| 238 | *************************************/ |
| 239 | |
| 240 | static MACHINE_CONFIG_START( astrocde, astrocde_state ) |
| 241 | /* basic machine hardware */ |
| 242 | MCFG_CPU_ADD("maincpu", Z80, ASTROCADE_CLOCK/4) /* 1.789 MHz */ |
| 243 | MCFG_CPU_PROGRAM_MAP(astrocade_mem) |
| 244 | MCFG_CPU_IO_MAP(astrocade_io) |
| 245 | |
| 246 | MCFG_MACHINE_RESET( astrocde ) |
| 247 | |
| 248 | /* video hardware */ |
| 249 | MCFG_SCREEN_ADD("screen", RASTER) |
| 250 | MCFG_SCREEN_RAW_PARAMS(ASTROCADE_CLOCK, 455, 0, 352, 262, 0, 240) |
| 251 | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 252 | MCFG_SCREEN_UPDATE(astrocde) |
| 253 | |
| 254 | MCFG_PALETTE_LENGTH(512) |
| 255 | MCFG_PALETTE_INIT(astrocde) |
| 256 | |
| 257 | MCFG_VIDEO_START(astrocde) |
| 258 | |
| 259 | /* sound hardware */ |
| 260 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 261 | MCFG_SOUND_ADD("astrocade1", ASTROCADE, ASTROCADE_CLOCK/4) |
| 262 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 263 | |
| 264 | /* optional expansion ram (installed in MACHINE_RESET)*/ |
| 265 | MCFG_RAM_ADD("ram_tag") |
| 266 | MCFG_RAM_DEFAULT_SIZE("32k") |
| 267 | |
| 268 | /* cartridge */ |
| 269 | MCFG_CARTSLOT_ADD("cart") |
| 270 | MCFG_CARTSLOT_EXTENSION_LIST("bin") |
| 271 | MCFG_CARTSLOT_INTERFACE("astrocde_cart") |
| 272 | |
| 273 | /* Software lists */ |
| 274 | MCFG_SOFTWARE_LIST_ADD("cart_list","astrocde") |
| 275 | MACHINE_CONFIG_END |
| 276 | |
| 277 | |
| 278 | /************************************* |
| 279 | * |
| 280 | * ROM definitions |
| 281 | * |
| 282 | *************************************/ |
| 283 | |
| 284 | ROM_START( astrocde ) |
| 285 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 286 | ROM_LOAD( "astro.bin", 0x0000, 0x2000, CRC(ebc77f3a) SHA1(b902c941997c9d150a560435bf517c6a28137ecc) ) |
| 287 | ROM_CART_LOAD( "cart", 0x2000, 0x8000, 0 ) |
| 288 | ROM_END |
| 289 | |
| 290 | ROM_START( astrocdl ) |
| 291 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 292 | ROM_LOAD( "ballyhlc.bin", 0x0000, 0x2000, CRC(d7c517ba) SHA1(6b2bef5d970e54ed204549f58ba6d197a8bfd3cc) ) |
| 293 | ROM_CART_LOAD( "cart", 0x2000, 0x8000, 0 ) |
| 294 | ROM_END |
| 295 | |
| 296 | ROM_START( astrocdw ) |
| 297 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 298 | ROM_LOAD( "bioswhit.bin", 0x0000, 0x2000, CRC(6eb53e79) SHA1(d84341feec1a0a0e8aa6151b649bc3cf6ef69fbf) ) |
| 299 | ROM_CART_LOAD( "cart", 0x2000, 0x8000, 0 ) |
| 300 | ROM_END |
| 301 | |
| 302 | /************************************* |
| 303 | * |
| 304 | * Driver initialization |
| 305 | * |
| 306 | *************************************/ |
| 307 | |
| 308 | static DRIVER_INIT( astrocde ) |
| 309 | { |
| 310 | astrocde_state *state = machine.driver_data<astrocde_state>(); |
| 311 | state->m_video_config = AC_SOUND_PRESENT | AC_LIGHTPEN_INTS; |
| 312 | } |
| 313 | |
| 314 | MACHINE_RESET( astrocde ) |
| 315 | { |
| 316 | int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0; |
| 317 | address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM); |
| 318 | UINT8 *expram = ram_get_ptr(machine.device("ram_tag")); |
| 319 | space->unmap_readwrite(0x5000, 0xffff); // unmap any previously installed expansion RAM |
| 320 | |
| 321 | get_ram_expansion_settings(space, ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end); // passing by reference |
| 322 | |
| 323 | if (ram_expansion_installed == 1) |
| 324 | { |
| 325 | if (write_protect_on == 0) // write protect off, so install memory normally |
| 326 | { |
| 327 | space->install_ram(expansion_ram_start, expansion_ram_end, expram); |
| 328 | if (shadow_ram_end > expansion_ram_end) |
| 329 | space->install_ram(expansion_ram_end + 1, shadow_ram_end, expram); |
| 330 | } |
| 331 | else // write protect on, so make memory read only |
| 332 | { |
| 333 | space->nop_write(expansion_ram_start, expansion_ram_end); |
| 334 | } |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | void get_ram_expansion_settings(address_space *space, int &ram_expansion_installed, int &write_protect_on, int &expansion_ram_start, int &expansion_ram_end, int &shadow_ram_end) |
| 339 | { |
| 340 | if (input_port_read(space->machine(), "PROTECT") == 0x01) |
| 341 | write_protect_on = 1; |
| 342 | else |
| 343 | write_protect_on = 0; |
| 344 | |
| 345 | ram_expansion_installed = 1; |
| 346 | |
| 347 | switch(input_port_read(space->machine(), "CFG")) // check RAM expansion configuration and set address ranges |
| 348 | { |
| 349 | case 0x00: // No RAM Expansion |
| 350 | ram_expansion_installed = 0; |
| 351 | break; |
| 352 | case 0x01: // 16KB Viper System 1 RAM Expansion |
| 353 | expansion_ram_start = 0x6000; |
| 354 | expansion_ram_end = 0x9fff; |
| 355 | shadow_ram_end = 0; |
| 356 | break; |
| 357 | case 0x02: // "32KB Lil' WHITE RAM Expansion |
| 358 | expansion_ram_start = 0x5000; |
| 359 | expansion_ram_end = 0xcfff; |
| 360 | shadow_ram_end = 0xffff; |
| 361 | break; |
| 362 | case 0x04: // R&L 64K RAM Board (44KB installed) |
| 363 | expansion_ram_start = 0x5000; |
| 364 | expansion_ram_end = 0xffff; |
| 365 | shadow_ram_end = 0; |
| 366 | break; |
| 367 | case 0x08: // 4KB Blue RAM Expansion |
| 368 | expansion_ram_start = 0x6000; |
| 369 | expansion_ram_end = 0x6fff; |
| 370 | shadow_ram_end = 0; |
| 371 | break; |
| 372 | case 0x10: // 16KB Blue RAM Expansion |
| 373 | expansion_ram_start = 0x6000; |
| 374 | expansion_ram_end = 0x9fff; |
| 375 | shadow_ram_end = 0; |
| 376 | break; |
| 377 | case 0x20: // 32KB Blue RAM Expansion |
| 378 | expansion_ram_start = 0x6000; |
| 379 | expansion_ram_end = 0xdfff; |
| 380 | shadow_ram_end = 0; |
| 381 | break; |
| 382 | default: |
| 383 | break; |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | |
| 388 | /************************************* |
| 389 | * |
| 390 | * Driver definitions |
| 391 | * |
| 392 | *************************************/ |
| 393 | |
| 394 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 395 | CONS( 1978, astrocde, 0, 0, astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Professional Arcade", GAME_SUPPORTS_SAVE ) |
| 396 | CONS( 1977, astrocdl, astrocde, 0, astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Home Library Computer", GAME_SUPPORTS_SAVE ) |
| 397 | CONS( 1977, astrocdw, astrocde, 0, astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Computer System", GAME_SUPPORTS_SAVE ) |