src/mess/machine/ace.c
| r9951 | r9952 | |
| 1 | | /*************************************************************************** |
| 2 | | |
| 3 | | machine.c |
| 4 | | |
| 5 | | Functions to emulate general aspects of the machine (RAM, ROM, interrupts, |
| 6 | | I/O ports) |
| 7 | | |
| 8 | | ***************************************************************************/ |
| 9 | | |
| 10 | | #include "emu.h" |
| 11 | | #include "cpu/z80/z80.h" |
| 12 | | #include "imagedev/snapquik.h" |
| 13 | | #include "includes/ace.h" |
| 14 | | |
| 15 | | |
| 16 | | |
| 17 | | /* Load in .ace files. These are memory images of 0x2000 to 0x7fff |
| 18 | | and compressed as follows: |
| 19 | | |
| 20 | | ED 00 : End marker |
| 21 | | ED <cnt> <byt> : repeat <byt> count <cnt:1-240> times |
| 22 | | <byt> : <byt> |
| 23 | | */ |
| 24 | | |
| 25 | | |
| 26 | | /****************************************************************************** |
| 27 | | Snapshot Handling |
| 28 | | ******************************************************************************/ |
| 29 | | |
| 30 | | SNAPSHOT_LOAD(ace) |
| 31 | | { |
| 32 | | UINT8 *RAM = image.device().machine->region(Z80_TAG)->base(); |
| 33 | | device_t *cpu = image.device().machine->device(Z80_TAG); |
| 34 | | address_space *space = cputag_get_address_space(image.device().machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); |
| 35 | | unsigned char ace_repeat, ace_byte, loop; |
| 36 | | int done=0, ace_index=0x2000; |
| 37 | | |
| 38 | | if (ram_get_size(image.device().machine->device(RAM_TAG)) < 16*1024) |
| 39 | | { |
| 40 | | image.seterror(IMAGE_ERROR_INVALIDIMAGE, "At least 16KB RAM expansion required"); |
| 41 | | image.message("At least 16KB RAM expansion required"); |
| 42 | | return IMAGE_INIT_FAIL; |
| 43 | | } |
| 44 | | |
| 45 | | logerror("Loading file %s.\r\n", image.filename()); |
| 46 | | while (!done && (ace_index < 0x8001)) |
| 47 | | { |
| 48 | | image.fread( &ace_byte, 1); |
| 49 | | if (ace_byte == 0xed) |
| 50 | | { |
| 51 | | image.fread(&ace_byte, 1); |
| 52 | | switch (ace_byte) |
| 53 | | { |
| 54 | | case 0x00: |
| 55 | | logerror("File loaded!\r\n"); |
| 56 | | done = 1; |
| 57 | | break; |
| 58 | | case 0x01: |
| 59 | | image.fread(&ace_byte, 1); |
| 60 | | RAM[ace_index++] = ace_byte; |
| 61 | | break; |
| 62 | | default: |
| 63 | | image.fread(&ace_repeat, 1); |
| 64 | | for (loop = 0; loop < ace_byte; loop++) |
| 65 | | RAM[ace_index++] = ace_repeat; |
| 66 | | break; |
| 67 | | } |
| 68 | | } |
| 69 | | else |
| 70 | | RAM[ace_index++] = ace_byte; |
| 71 | | } |
| 72 | | |
| 73 | | logerror("Decoded %X bytes.\r\n", ace_index-0x2000); |
| 74 | | |
| 75 | | if (!done) |
| 76 | | { |
| 77 | | image.seterror(IMAGE_ERROR_INVALIDIMAGE, "EOF marker not found"); |
| 78 | | image.message("EOF marker not found"); |
| 79 | | return IMAGE_INIT_FAIL; |
| 80 | | } |
| 81 | | |
| 82 | | // patch CPU registers |
| 83 | | // Some games do not follow the standard, and have rubbish in the CPU area. So, |
| 84 | | // we check that some other bytes are correct. |
| 85 | | // 2080 = memory size of original machine, should be 0000 or 8000 or C000. |
| 86 | | // 2118 = new stack pointer, do not use if between 8000 and FF00. |
| 87 | | |
| 88 | | ace_index = RAM[0x2080] | (RAM[0x2081] << 8); |
| 89 | | |
| 90 | | if ((ace_index & 0x3FFF)==0) |
| 91 | | { |
| 92 | | cpu_set_reg(cpu, Z80_AF, RAM[0x2100] | (RAM[0x2101] << 8)); |
| 93 | | cpu_set_reg(cpu, Z80_BC, RAM[0x2104] | (RAM[0x2105] << 8)); |
| 94 | | cpu_set_reg(cpu, Z80_DE, RAM[0x2108] | (RAM[0x2109] << 8)); |
| 95 | | cpu_set_reg(cpu, Z80_HL, RAM[0x210c] | (RAM[0x210d] << 8)); |
| 96 | | cpu_set_reg(cpu, Z80_IX, RAM[0x2110] | (RAM[0x2111] << 8)); |
| 97 | | cpu_set_reg(cpu, Z80_IY, RAM[0x2114] | (RAM[0x2115] << 8)); |
| 98 | | cpu_set_reg(cpu, STATE_GENPC, RAM[0x211c] | (RAM[0x211d] << 8)); |
| 99 | | cpu_set_reg(cpu, Z80_AF2, RAM[0x2120] | (RAM[0x2121] << 8)); |
| 100 | | cpu_set_reg(cpu, Z80_BC2, RAM[0x2124] | (RAM[0x2125] << 8)); |
| 101 | | cpu_set_reg(cpu, Z80_DE2, RAM[0x2128] | (RAM[0x2129] << 8)); |
| 102 | | cpu_set_reg(cpu, Z80_HL2, RAM[0x212c] | (RAM[0x212d] << 8)); |
| 103 | | cpu_set_reg(cpu, Z80_IM, RAM[0x2130]); |
| 104 | | cpu_set_reg(cpu, Z80_IFF1, RAM[0x2134]); |
| 105 | | cpu_set_reg(cpu, Z80_IFF2, RAM[0x2138]); |
| 106 | | cpu_set_reg(cpu, Z80_I, RAM[0x213c]); |
| 107 | | cpu_set_reg(cpu, Z80_R, RAM[0x2140]); |
| 108 | | |
| 109 | | if ((RAM[0x2119] < 0x80) || !ace_index) |
| 110 | | cpu_set_reg(cpu, STATE_GENSP, RAM[0x2118] | (RAM[0x2119] << 8)); |
| 111 | | } |
| 112 | | |
| 113 | | /* Copy data to the address space */ |
| 114 | | for (ace_index = 0x2000; ace_index < 0x8000; ace_index++) |
| 115 | | space->write_byte(ace_index, RAM[ace_index]); |
| 116 | | |
| 117 | | return IMAGE_INIT_PASS; |
| 118 | | } |
src/mess/formats/ace_ace.c
| r0 | r9952 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | ace_ace.c |
| 4 | |
| 5 | Format code for Jupiter Ace snapshot files |
| 6 | |
| 7 | *********************************************************************/ |
| 8 | |
| 9 | #include "emu.h" |
| 10 | #include "ace_ace.h" |
| 11 | #include "cpu/z80/z80.h" |
| 12 | #include "machine/ram.h" |
| 13 | |
| 14 | /* Load in .ace files. These are memory images of 0x2000 to 0x7fff |
| 15 | and compressed as follows: |
| 16 | |
| 17 | ED 00 : End marker |
| 18 | ED <cnt> <byt> : repeat <byt> count <cnt:1-240> times |
| 19 | <byt> : <byt> |
| 20 | */ |
| 21 | |
| 22 | /****************************************************************************** |
| 23 | Snapshot Handling |
| 24 | ******************************************************************************/ |
| 25 | |
| 26 | SNAPSHOT_LOAD( ace ) |
| 27 | { |
| 28 | cpu_device *cpu = image.device().machine->firstcpu; |
| 29 | UINT8 *RAM = image.device().machine->region(cpu->tag())->base(); |
| 30 | address_space *space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM); |
| 31 | unsigned char ace_repeat, ace_byte, loop; |
| 32 | int done=0, ace_index=0x2000; |
| 33 | |
| 34 | if (ram_get_size(image.device().machine->device(RAM_TAG)) < 16*1024) |
| 35 | { |
| 36 | image.seterror(IMAGE_ERROR_INVALIDIMAGE, "At least 16KB RAM expansion required"); |
| 37 | image.message("At least 16KB RAM expansion required"); |
| 38 | return IMAGE_INIT_FAIL; |
| 39 | } |
| 40 | |
| 41 | logerror("Loading file %s.\r\n", image.filename()); |
| 42 | while (!done && (ace_index < 0x8001)) |
| 43 | { |
| 44 | image.fread( &ace_byte, 1); |
| 45 | if (ace_byte == 0xed) |
| 46 | { |
| 47 | image.fread(&ace_byte, 1); |
| 48 | switch (ace_byte) |
| 49 | { |
| 50 | case 0x00: |
| 51 | logerror("File loaded!\r\n"); |
| 52 | done = 1; |
| 53 | break; |
| 54 | case 0x01: |
| 55 | image.fread(&ace_byte, 1); |
| 56 | RAM[ace_index++] = ace_byte; |
| 57 | break; |
| 58 | default: |
| 59 | image.fread(&ace_repeat, 1); |
| 60 | for (loop = 0; loop < ace_byte; loop++) |
| 61 | RAM[ace_index++] = ace_repeat; |
| 62 | break; |
| 63 | } |
| 64 | } |
| 65 | else |
| 66 | RAM[ace_index++] = ace_byte; |
| 67 | } |
| 68 | |
| 69 | logerror("Decoded %X bytes.\r\n", ace_index-0x2000); |
| 70 | |
| 71 | if (!done) |
| 72 | { |
| 73 | image.seterror(IMAGE_ERROR_INVALIDIMAGE, "EOF marker not found"); |
| 74 | image.message("EOF marker not found"); |
| 75 | return IMAGE_INIT_FAIL; |
| 76 | } |
| 77 | |
| 78 | // patch CPU registers |
| 79 | // Some games do not follow the standard, and have rubbish in the CPU area. So, |
| 80 | // we check that some other bytes are correct. |
| 81 | // 2080 = memory size of original machine, should be 0000 or 8000 or C000. |
| 82 | // 2118 = new stack pointer, do not use if between 8000 and FF00. |
| 83 | |
| 84 | ace_index = RAM[0x2080] | (RAM[0x2081] << 8); |
| 85 | |
| 86 | if ((ace_index & 0x3FFF)==0) |
| 87 | { |
| 88 | cpu_set_reg(cpu, Z80_AF, RAM[0x2100] | (RAM[0x2101] << 8)); |
| 89 | cpu_set_reg(cpu, Z80_BC, RAM[0x2104] | (RAM[0x2105] << 8)); |
| 90 | cpu_set_reg(cpu, Z80_DE, RAM[0x2108] | (RAM[0x2109] << 8)); |
| 91 | cpu_set_reg(cpu, Z80_HL, RAM[0x210c] | (RAM[0x210d] << 8)); |
| 92 | cpu_set_reg(cpu, Z80_IX, RAM[0x2110] | (RAM[0x2111] << 8)); |
| 93 | cpu_set_reg(cpu, Z80_IY, RAM[0x2114] | (RAM[0x2115] << 8)); |
| 94 | cpu_set_reg(cpu, STATE_GENPC, RAM[0x211c] | (RAM[0x211d] << 8)); |
| 95 | cpu_set_reg(cpu, Z80_AF2, RAM[0x2120] | (RAM[0x2121] << 8)); |
| 96 | cpu_set_reg(cpu, Z80_BC2, RAM[0x2124] | (RAM[0x2125] << 8)); |
| 97 | cpu_set_reg(cpu, Z80_DE2, RAM[0x2128] | (RAM[0x2129] << 8)); |
| 98 | cpu_set_reg(cpu, Z80_HL2, RAM[0x212c] | (RAM[0x212d] << 8)); |
| 99 | cpu_set_reg(cpu, Z80_IM, RAM[0x2130]); |
| 100 | cpu_set_reg(cpu, Z80_IFF1, RAM[0x2134]); |
| 101 | cpu_set_reg(cpu, Z80_IFF2, RAM[0x2138]); |
| 102 | cpu_set_reg(cpu, Z80_I, RAM[0x213c]); |
| 103 | cpu_set_reg(cpu, Z80_R, RAM[0x2140]); |
| 104 | |
| 105 | if ((RAM[0x2119] < 0x80) || !ace_index) |
| 106 | cpu_set_reg(cpu, STATE_GENSP, RAM[0x2118] | (RAM[0x2119] << 8)); |
| 107 | } |
| 108 | |
| 109 | /* Copy data to the address space */ |
| 110 | for (ace_index = 0x2000; ace_index < 0x8000; ace_index++) |
| 111 | space->write_byte(ace_index, RAM[ace_index]); |
| 112 | |
| 113 | return IMAGE_INIT_PASS; |
| 114 | } |
src/mess/drivers/ace.c
| r9951 | r9952 | |
| 33 | 33 | |
| 34 | 34 | TODO: |
| 35 | 35 | |
| 36 | | - printer |
| 37 | | - Big Mouth speech unit (SP0256-AL1) |
| 36 | - Ace Colour Board |
| 37 | - 96K ram expansion |
| 38 | 38 | - Deep Thought disc interface (6850, 6821) |
| 39 | 39 | |
| 40 | 40 | */ |
| r9951 | r9952 | |
| 43 | 43 | |
| 44 | 44 | #include "emu.h" |
| 45 | 45 | #include "cpu/z80/z80.h" |
| 46 | #include "formats/ace_ace.h" |
| 47 | #include "formats/ace_tap.h" |
| 46 | 48 | #include "imagedev/cassette.h" |
| 47 | 49 | #include "imagedev/snapquik.h" |
| 50 | #include "machine/ctronics.h" |
| 51 | #include "machine/i8255a.h" |
| 52 | #include "machine/ram.h" |
| 53 | #include "machine/z80pio.h" |
| 48 | 54 | #include "sound/ay8910.h" |
| 55 | #include "sound/sp0256.h" |
| 49 | 56 | #include "sound/speaker.h" |
| 50 | 57 | #include "sound/wave.h" |
| 51 | | #include "formats/ace_tap.h" |
| 52 | 58 | #include "includes/ace.h" |
| 53 | 59 | |
| 54 | 60 | |
| r9951 | r9952 | |
| 101 | 107 | } |
| 102 | 108 | |
| 103 | 109 | |
| 110 | //------------------------------------------------- |
| 111 | // ppi_r - |
| 112 | //------------------------------------------------- |
| 104 | 113 | |
| 114 | static READ8_DEVICE_HANDLER( ppi_pa_r ) |
| 115 | { |
| 116 | return i8255a_r(device, 0); |
| 117 | } |
| 118 | |
| 119 | static READ8_DEVICE_HANDLER( ppi_pb_r ) |
| 120 | { |
| 121 | return i8255a_r(device, 1); |
| 122 | } |
| 123 | |
| 124 | static READ8_DEVICE_HANDLER( ppi_pc_r ) |
| 125 | { |
| 126 | return i8255a_r(device, 2); |
| 127 | } |
| 128 | |
| 129 | static READ8_DEVICE_HANDLER( ppi_control_r ) |
| 130 | { |
| 131 | return i8255a_r(device, 3); |
| 132 | } |
| 133 | |
| 134 | |
| 135 | //------------------------------------------------- |
| 136 | // ppi_w - |
| 137 | //------------------------------------------------- |
| 138 | |
| 139 | static WRITE8_DEVICE_HANDLER( ppi_pa_w ) |
| 140 | { |
| 141 | i8255a_w(device, 0, data); |
| 142 | } |
| 143 | |
| 144 | static WRITE8_DEVICE_HANDLER( ppi_pb_w ) |
| 145 | { |
| 146 | i8255a_w(device, 1, data); |
| 147 | } |
| 148 | |
| 149 | static WRITE8_DEVICE_HANDLER( ppi_pc_w ) |
| 150 | { |
| 151 | i8255a_w(device, 2, data); |
| 152 | } |
| 153 | |
| 154 | static WRITE8_DEVICE_HANDLER( ppi_control_w ) |
| 155 | { |
| 156 | i8255a_w(device, 3, data); |
| 157 | } |
| 158 | |
| 159 | |
| 160 | //------------------------------------------------- |
| 161 | // pio_r - |
| 162 | //------------------------------------------------- |
| 163 | |
| 164 | static READ8_DEVICE_HANDLER( pio_ad_r ) |
| 165 | { |
| 166 | return z80pio_d_r(device, 0); |
| 167 | } |
| 168 | |
| 169 | static READ8_DEVICE_HANDLER( pio_bd_r ) |
| 170 | { |
| 171 | return z80pio_d_r(device, 1); |
| 172 | } |
| 173 | |
| 174 | static READ8_DEVICE_HANDLER( pio_ac_r ) |
| 175 | { |
| 176 | return z80pio_c_r(device, 0); |
| 177 | } |
| 178 | |
| 179 | static READ8_DEVICE_HANDLER( pio_bc_r ) |
| 180 | { |
| 181 | return z80pio_c_r(device, 1); |
| 182 | } |
| 183 | |
| 184 | |
| 185 | //------------------------------------------------- |
| 186 | // pio_w - |
| 187 | //------------------------------------------------- |
| 188 | |
| 189 | static WRITE8_DEVICE_HANDLER( pio_ad_w ) |
| 190 | { |
| 191 | z80pio_d_w(device, 0, data); |
| 192 | } |
| 193 | |
| 194 | static WRITE8_DEVICE_HANDLER( pio_bd_w ) |
| 195 | { |
| 196 | z80pio_d_w(device, 1, data); |
| 197 | } |
| 198 | |
| 199 | static WRITE8_DEVICE_HANDLER( pio_ac_w ) |
| 200 | { |
| 201 | z80pio_c_w(device, 0, data); |
| 202 | } |
| 203 | |
| 204 | static WRITE8_DEVICE_HANDLER( pio_bc_w ) |
| 205 | { |
| 206 | z80pio_c_w(device, 1, data); |
| 207 | } |
| 208 | |
| 209 | |
| 210 | |
| 105 | 211 | //************************************************************************** |
| 106 | 212 | // ADDRESS MAPS |
| 107 | 213 | //************************************************************************** |
| r9951 | r9952 | |
| 112 | 218 | |
| 113 | 219 | static ADDRESS_MAP_START( ace_mem, ADDRESS_SPACE_PROGRAM, 8, ace_state ) |
| 114 | 220 | AM_RANGE(0x0000, 0x1fff) AM_ROM |
| 115 | | AM_RANGE(0x2400, 0x27ff) AM_MIRROR(0x0400) AM_RAM AM_BASE(m_video_ram) |
| 116 | | AM_RANGE(0x2c00, 0x2fff) AM_MIRROR(0x0400) AM_RAM AM_BASE(m_char_ram) AM_REGION(Z80_TAG, 0xfc00) |
| 117 | | AM_RANGE(0x3c00, 0x3fff) AM_MIRROR(0x0c00) AM_RAM |
| 221 | AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0400) AM_RAM AM_BASE(m_video_ram) |
| 222 | AM_RANGE(0x2800, 0x2bff) AM_MIRROR(0x0400) AM_RAM AM_BASE(m_char_ram) AM_REGION(Z80_TAG, 0xfc00) |
| 223 | AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM |
| 118 | 224 | AM_RANGE(0x4000, 0xffff) AM_RAM |
| 119 | 225 | ADDRESS_MAP_END |
| 120 | 226 | |
| r9951 | r9952 | |
| 126 | 232 | static ADDRESS_MAP_START( ace_io, ADDRESS_SPACE_IO, 8, ace_state ) |
| 127 | 233 | AM_RANGE(0x00, 0x00) AM_MIRROR(0xfffe) AM_MASK(0xff00) AM_READWRITE(io_r, io_w) |
| 128 | 234 | AM_RANGE(0x01, 0x01) AM_MIRROR(0xff00) AM_READ_PORT("JOY") |
| 235 | AM_RANGE(0x41, 0x41) AM_MIRROR(0xff80) AM_DEVREADWRITE_LEGACY(I8255_TAG, ppi_pa_r, ppi_pa_w) |
| 236 | AM_RANGE(0x43, 0x43) AM_MIRROR(0xff80) AM_DEVREADWRITE_LEGACY(I8255_TAG, ppi_pb_r, ppi_pb_w) |
| 237 | AM_RANGE(0x45, 0x45) AM_MIRROR(0xff80) AM_DEVREADWRITE_LEGACY(I8255_TAG, ppi_pc_r, ppi_pc_w) |
| 238 | AM_RANGE(0x47, 0x47) AM_MIRROR(0xff80) AM_DEVREADWRITE_LEGACY(I8255_TAG, ppi_control_r, ppi_control_w) |
| 239 | AM_RANGE(0x81, 0x81) AM_MIRROR(0xff38) AM_DEVREADWRITE_LEGACY(Z80PIO_TAG, pio_ad_r, pio_ad_w) |
| 240 | AM_RANGE(0x83, 0x83) AM_MIRROR(0xff38) AM_DEVREADWRITE_LEGACY(Z80PIO_TAG, pio_bd_r, pio_bd_w) |
| 241 | AM_RANGE(0x85, 0x85) AM_MIRROR(0xff38) AM_DEVREADWRITE_LEGACY(Z80PIO_TAG, pio_ac_r, pio_ac_w) |
| 242 | AM_RANGE(0x87, 0x87) AM_MIRROR(0xff38) AM_DEVREADWRITE_LEGACY(Z80PIO_TAG, pio_bc_r, pio_bc_w) |
| 129 | 243 | AM_RANGE(0xfd, 0xfd) AM_MIRROR(0xff00) AM_DEVWRITE_LEGACY(AY8910_TAG, ay8910_address_w) |
| 130 | 244 | AM_RANGE(0xff, 0xff) AM_MIRROR(0xff00) AM_DEVREADWRITE_LEGACY(AY8910_TAG, ay8910_r, ay8910_data_w) |
| 131 | 245 | ADDRESS_MAP_END |
| r9951 | r9952 | |
| 137 | 251 | //************************************************************************** |
| 138 | 252 | |
| 139 | 253 | //------------------------------------------------- |
| 140 | | // INPUT_PORTS( bullet ) |
| 254 | // INPUT_PORTS( ace ) |
| 141 | 255 | //------------------------------------------------- |
| 142 | 256 | |
| 143 | | static INPUT_PORTS_START (ace) |
| 257 | static INPUT_PORTS_START( ace ) |
| 144 | 258 | PORT_START("A8") |
| 145 | 259 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 146 | 260 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Symbol Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_2) |
| r9951 | r9952 | |
| 228 | 342 | |
| 229 | 343 | static const gfx_layout ace_charlayout = |
| 230 | 344 | { |
| 231 | | 8, 8, /* 8x8 characters */ |
| 232 | | 128, /* 128 characters */ |
| 233 | | 1, /* 1 bits per pixel */ |
| 234 | | {0}, /* no bitplanes; 1 bit per pixel */ |
| 235 | | {0, 1, 2, 3, 4, 5, 6, 7}, |
| 236 | | {0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, |
| 237 | | 8*8 /* each character takes 8 consecutive bytes */ |
| 345 | 8,8, |
| 346 | 128, |
| 347 | 1, |
| 348 | { RGN_FRAC(0,1) }, |
| 349 | { STEP8(0,1) }, |
| 350 | { STEP8(0,8) }, |
| 351 | 8*8 |
| 238 | 352 | }; |
| 239 | 353 | |
| 240 | 354 | |
| r9951 | r9952 | |
| 274 | 388 | bool ace_state::video_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect) |
| 275 | 389 | { |
| 276 | 390 | UINT8 y,ra,chr,gfx; |
| 277 | | UINT16 sy=0,ma=0,x; |
| 391 | UINT16 sy=56,ma=0,x; |
| 278 | 392 | |
| 279 | 393 | for (y = 0; y < 24; y++) |
| 280 | 394 | { |
| 281 | 395 | for (ra = 0; ra < 8; ra++) |
| 282 | 396 | { |
| 283 | | UINT16 *p = BITMAP_ADDR16(&bitmap, sy++, 0); |
| 397 | UINT16 *p = BITMAP_ADDR16(&bitmap, sy++, 40); |
| 284 | 398 | |
| 285 | 399 | for (x = ma; x < ma+32; x++) |
| 286 | 400 | { |
| r9951 | r9952 | |
| 335 | 449 | DEVCB_NULL, |
| 336 | 450 | DEVCB_NULL, |
| 337 | 451 | DEVCB_NULL, |
| 452 | DEVCB_NULL |
| 453 | }; |
| 454 | |
| 455 | |
| 456 | //------------------------------------------------- |
| 457 | // sp0256_interface sp0256_intf |
| 458 | //------------------------------------------------- |
| 459 | |
| 460 | static const sp0256_interface sp0256_intf = |
| 461 | { |
| 338 | 462 | DEVCB_NULL, |
| 463 | DEVCB_NULL |
| 339 | 464 | }; |
| 340 | 465 | |
| 341 | 466 | |
| 467 | //------------------------------------------------- |
| 468 | // I8255A_INTERFACE( ppi_intf ) |
| 469 | //------------------------------------------------- |
| 342 | 470 | |
| 471 | static READ8_DEVICE_HANDLER( sby_r ) |
| 472 | { |
| 473 | /* |
| 474 | |
| 475 | bit description |
| 476 | |
| 477 | PC0 SP0256 SBY |
| 478 | PC1 |
| 479 | PC2 |
| 480 | PC3 |
| 481 | PC4 |
| 482 | PC5 |
| 483 | PC6 |
| 484 | PC7 |
| 485 | |
| 486 | */ |
| 487 | |
| 488 | return sp0256_sby_r(device); |
| 489 | } |
| 490 | |
| 491 | static WRITE8_DEVICE_HANDLER( ald_w ) |
| 492 | { |
| 493 | /* |
| 494 | |
| 495 | bit description |
| 496 | |
| 497 | PA0 SP0256 A1 |
| 498 | PA1 SP0256 A2 |
| 499 | PA2 SP0256 A3 |
| 500 | PA3 SP0256 A4 |
| 501 | PA4 SP0256 A5 |
| 502 | PA5 SP0256 A6 |
| 503 | PA6 SP0256 _ALD |
| 504 | PA7 |
| 505 | |
| 506 | */ |
| 507 | |
| 508 | if (!BIT(data, 6)) |
| 509 | { |
| 510 | sp0256_ALD_w(device, 0, data & 0x3f); |
| 511 | } |
| 512 | } |
| 513 | |
| 514 | static I8255A_INTERFACE( ppi_intf ) |
| 515 | { |
| 516 | DEVCB_NULL, |
| 517 | DEVCB_NULL, |
| 518 | DEVCB_DEVICE_HANDLER(SP0256AL2_TAG, sby_r), |
| 519 | DEVCB_DEVICE_HANDLER(SP0256AL2_TAG, ald_w), |
| 520 | DEVCB_NULL, |
| 521 | DEVCB_NULL |
| 522 | }; |
| 523 | |
| 524 | |
| 525 | //------------------------------------------------- |
| 526 | // Z80PIO_INTERFACE( pio_intf ) |
| 527 | //------------------------------------------------- |
| 528 | |
| 529 | READ8_MEMBER( ace_state::pio_pa_r ) |
| 530 | { |
| 531 | /* |
| 532 | |
| 533 | bit description |
| 534 | |
| 535 | PA0 |
| 536 | PA1 RxD |
| 537 | PA2 |
| 538 | PA3 |
| 539 | PA4 |
| 540 | PA5 |
| 541 | PA6 |
| 542 | PA7 |
| 543 | |
| 544 | */ |
| 545 | |
| 546 | return 0; |
| 547 | }; |
| 548 | |
| 549 | WRITE8_MEMBER( ace_state::pio_pa_w ) |
| 550 | { |
| 551 | /* |
| 552 | |
| 553 | bit description |
| 554 | |
| 555 | PA0 RTS |
| 556 | PA1 |
| 557 | PA2 CTS |
| 558 | PA3 TxD |
| 559 | PA4 |
| 560 | PA5 |
| 561 | PA6 STB |
| 562 | PA7 |
| 563 | |
| 564 | */ |
| 565 | |
| 566 | // centronics strobe |
| 567 | centronics_strobe_w(m_centronics, !BIT(data, 6)); |
| 568 | }; |
| 569 | |
| 570 | static Z80PIO_INTERFACE( pio_intf ) |
| 571 | { |
| 572 | DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0), |
| 573 | DEVCB_DRIVER_MEMBER(ace_state, pio_pa_r), |
| 574 | DEVCB_DRIVER_MEMBER(ace_state, pio_pa_w), |
| 575 | DEVCB_NULL, |
| 576 | DEVCB_NULL, |
| 577 | DEVCB_DEVICE_HANDLER(CENTRONICS_TAG, centronics_data_w), |
| 578 | DEVCB_NULL |
| 579 | }; |
| 580 | |
| 581 | |
| 582 | |
| 343 | 583 | //************************************************************************** |
| 344 | 584 | // MACHINE INITIALIZATION |
| 345 | 585 | //************************************************************************** |
| r9951 | r9952 | |
| 362 | 602 | case 16*1024: |
| 363 | 603 | memory_unmap_readwrite(program, 0x8000, 0xffff, 0, 0); |
| 364 | 604 | break; |
| 605 | |
| 606 | case 32*1024: |
| 607 | memory_unmap_readwrite(program, 0xc000, 0xffff, 0, 0); |
| 608 | break; |
| 365 | 609 | } |
| 366 | 610 | } |
| 367 | 611 | |
| r9951 | r9952 | |
| 376 | 620 | //------------------------------------------------- |
| 377 | 621 | |
| 378 | 622 | static MACHINE_CONFIG_START( ace, ace_state ) |
| 379 | | /* basic machine hardware */ |
| 623 | // basic machine hardware |
| 380 | 624 | MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_6_5MHz/2) |
| 381 | 625 | MCFG_CPU_PROGRAM_MAP(ace_mem) |
| 382 | 626 | MCFG_CPU_IO_MAP(ace_io) |
| 383 | 627 | MCFG_QUANTUM_TIME(HZ(60)) |
| 384 | 628 | |
| 385 | | /* video hardware */ |
| 629 | // video hardware |
| 386 | 630 | MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 387 | 631 | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 388 | | MCFG_SCREEN_RAW_PARAMS(XTAL_6_5MHz, 416, 0, 256, 264, 0, 192) |
| 632 | MCFG_SCREEN_RAW_PARAMS(XTAL_6_5MHz, 416, 0, 336, 312, 0, 304) |
| 389 | 633 | MCFG_TIMER_ADD_SCANLINE("set_irq", set_irq, SCREEN_TAG, 31*8, 264) |
| 390 | 634 | MCFG_TIMER_ADD_SCANLINE("clear_irq", clear_irq, SCREEN_TAG, 32*8, 264) |
| 391 | 635 | |
| 392 | | MCFG_GFXDECODE( ace ) |
| 393 | 636 | MCFG_PALETTE_LENGTH(2) |
| 394 | 637 | MCFG_PALETTE_INIT(black_and_white) |
| 395 | 638 | |
| 396 | | /* sound hardware */ |
| 639 | MCFG_GFXDECODE(ace) |
| 640 | |
| 641 | // sound hardware |
| 397 | 642 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 398 | 643 | MCFG_SOUND_WAVE_ADD("wave", CASSETTE_TAG) |
| 399 | 644 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| r9951 | r9952 | |
| 404 | 649 | MCFG_SOUND_CONFIG(psg_intf) |
| 405 | 650 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 406 | 651 | |
| 407 | | /* Devices */ |
| 652 | MCFG_SOUND_ADD(SP0256AL2_TAG, SP0256, XTAL_3MHz) |
| 653 | MCFG_SOUND_CONFIG(sp0256_intf) |
| 654 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 655 | |
| 656 | // devices |
| 408 | 657 | MCFG_CASSETTE_ADD(CASSETTE_TAG, ace_cassette_config) |
| 409 | 658 | MCFG_SNAPSHOT_ADD("snapshot", ace, "ace", 1) |
| 659 | MCFG_I8255A_ADD(I8255_TAG, ppi_intf) |
| 660 | MCFG_Z80PIO_ADD(Z80PIO_TAG, XTAL_6_5MHz/2, pio_intf) |
| 661 | MCFG_CENTRONICS_ADD(CENTRONICS_TAG, standard_centronics) |
| 410 | 662 | |
| 411 | | /* internal ram */ |
| 663 | // internal ram |
| 412 | 664 | MCFG_RAM_ADD(RAM_TAG) |
| 413 | 665 | MCFG_RAM_DEFAULT_SIZE("1K") |
| 414 | | MCFG_RAM_EXTRA_OPTIONS("16K,48K") |
| 666 | MCFG_RAM_EXTRA_OPTIONS("16K,32K,48K") |
| 415 | 667 | MACHINE_CONFIG_END |
| 416 | 668 | |
| 417 | 669 | |
| r9951 | r9952 | |
| 425 | 677 | //------------------------------------------------- |
| 426 | 678 | |
| 427 | 679 | ROM_START( ace ) |
| 428 | | ROM_REGION( 0x10000, Z80_TAG,0 ) |
| 680 | ROM_REGION( 0x10000, Z80_TAG, 0 ) |
| 429 | 681 | ROM_LOAD( "rom-a.z1", 0x0000, 0x1000, CRC(dc8438a5) SHA1(8fa97eb71e5dd17c7d190c6587ee3840f839347c) ) |
| 430 | 682 | ROM_LOAD( "rom-b.z2", 0x1000, 0x1000, CRC(4009f636) SHA1(98c5d4bcd74bcf014268cf4c00b2007ea5cc21f3) ) |
| 431 | 683 | |
| 432 | 684 | ROM_REGION( 0x1000, "fdc", 0 ) // Deep Thought disc interface |
| 433 | 685 | ROM_LOAD( "dos 4.bin", 0x0000, 0x1000, CRC(04c70448) SHA1(53ddcced6ae2feafd687a3b55864726656b71412) ) |
| 686 | |
| 687 | ROM_REGION( 0x10000, SP0256AL2_TAG, 0 ) |
| 688 | ROM_LOAD( "sp0256-al2.ic1", 0x000, 0x800, CRC(df8de0b0) SHA1(86fb6d9fef955ac0bc76e0c45c66585946d278a1) ) |
| 434 | 689 | ROM_END |
| 435 | 690 | |
| 436 | 691 | |