src/mess/drivers/gp2x.c
| r0 | r5722 | |
| 1 | /************************************************************************** |
| 2 | * |
| 3 | * gp2x.c - Game Park Holdings GP2X |
| 4 | * Skeleton by R. Belmont |
| 5 | * |
| 6 | * CPU: MagicEyes MP2520F SoC |
| 7 | * MP2520F consists of: |
| 8 | * ARM920T CPU core + MMU |
| 9 | * ARM940T slave CPU w/o MMU |
| 10 | * LCD controller |
| 11 | * DMA controller |
| 12 | * Interrupt controller |
| 13 | * NAND flash interface |
| 14 | * MMC/SD Card interface |
| 15 | * USB controller |
| 16 | * and more. |
| 17 | * |
| 18 | **************************************************************************/ |
| 19 | |
| 20 | #include "driver.h" |
| 21 | #include "video/generic.h" |
| 22 | #include "cpu/arm7/arm7.h" |
| 23 | |
| 24 | static UINT32 *gp2x_ram; |
| 25 | |
| 26 | static UINT16 gp2x_vidregs[0x200/2]; |
| 27 | #if 0 |
| 28 | static const char* gp2x_regnames[0x200] = |
| 29 | { |
| 30 | "DPC Control", |
| 31 | "PAD Control", |
| 32 | "PAD Polarity Control 1", |
| 33 | "PAD Polarity Control 2", |
| 34 | "PAD Polarity Control 3", |
| 35 | "PAD Enable Control 1", |
| 36 | "PAD Enable Control 2", |
| 37 | "PAD Enable Control 3", |
| 38 | "", |
| 39 | "", |
| 40 | "", |
| 41 | "Active width", |
| 42 | "Active height", |
| 43 | "HSYNC width", |
| 44 | "HSYNC start", |
| 45 | "HSYNC end", |
| 46 | "VSYNC control", // 20 |
| 47 | "VSYNC end", |
| 48 | "", |
| 49 | "DE Control", |
| 50 | "S Control", |
| 51 | "FG Control", |
| 52 | "LP Control", |
| 53 | "CLKV Control", |
| 54 | "CLKV Control 2", // 30 |
| 55 | "POL Control", |
| 56 | "CIS Sync Control", |
| 57 | "", |
| 58 | "", |
| 59 | "Luma blank level", |
| 60 | "Chroma blank level", |
| 61 | "Luma pos sync", |
| 62 | "Luma neg sync", // 40 |
| 63 | "Chroma pos sync", |
| 64 | "Chroma neg sync", |
| 65 | "Interrupt control", |
| 66 | "Clock control", |
| 67 | "", |
| 68 | "", |
| 69 | "", |
| 70 | "", // 50 |
| 71 | "", |
| 72 | "", |
| 73 | "", |
| 74 | "", |
| 75 | "", |
| 76 | "", |
| 77 | "", |
| 78 | "", // 60 |
| 79 | "", |
| 80 | "", |
| 81 | "", |
| 82 | "", |
| 83 | "", |
| 84 | "", |
| 85 | "", |
| 86 | "", // 70 |
| 87 | "", |
| 88 | "", |
| 89 | "", |
| 90 | "", |
| 91 | "", |
| 92 | "", |
| 93 | "", |
| 94 | "Overlay control", // 80 |
| 95 | "Image effect", |
| 96 | "Image control", |
| 97 | "Scale factor A top", |
| 98 | "Scale factor A bottom", |
| 99 | "Scale factor A top 2 H", |
| 100 | "Scale factor A top 2 L", |
| 101 | "Scale factor A bottom 2 H", |
| 102 | "Scale factor A bottom 2 L", // 90 |
| 103 | "Width region A top", |
| 104 | "Width region A bottom", |
| 105 | "H Offset region A", |
| 106 | "H Offset region A 2", |
| 107 | "V Start region A", |
| 108 | "V End region A top", |
| 109 | "V End region A bottom", |
| 110 | "YUV Source region A L", // a0 |
| 111 | "YUV Source region A H", |
| 112 | }; |
| 113 | #endif |
| 114 | static VIDEO_UPDATE( gp2x ) |
| 115 | { |
| 116 | // display enabled? |
| 117 | if (gp2x_vidregs[0] & 1) |
| 118 | { |
| 119 | // only support RGB still image layer for now |
| 120 | if (gp2x_vidregs[0x80/2] & 4) |
| 121 | { |
| 122 | int x, y; |
| 123 | UINT16 *vram = (UINT16 *)&gp2x_ram[0x2100000/4]; |
| 124 | |
| 125 | /* printf("RGB still image 1 enabled, bpp %d, size is %d %d %d %d\n", |
| 126 | (gp2x_vidregs[(0xda/2)]>>9)&3, |
| 127 | gp2x_vidregs[(0xe2/2)], |
| 128 | gp2x_vidregs[(0xe4/2)], |
| 129 | gp2x_vidregs[(0xe6/2)], |
| 130 | gp2x_vidregs[(0xe8/2)]);*/ |
| 131 | |
| 132 | |
| 133 | for (y = 0; y < 240; y++) |
| 134 | { |
| 135 | UINT32 *scanline = BITMAP_ADDR32(bitmap, y, 0); |
| 136 | |
| 137 | for (x = 0; x < 320; x++) |
| 138 | { |
| 139 | UINT16 pixel = vram[(320*y)+x]; |
| 140 | |
| 141 | *scanline++ = MAKE_ARGB(0xff, (pixel>>11)<<3, ((pixel>>5)&0x3f)<<2, (pixel&0x1f)<<3); |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | return 0; |
| 148 | } |
| 149 | |
| 150 | static READ32_HANDLER( gp2x_lcdc_r ) |
| 151 | { |
| 152 | return gp2x_vidregs[offset*2] | gp2x_vidregs[(offset*2)+1]<<16; |
| 153 | } |
| 154 | |
| 155 | static WRITE32_HANDLER( gp2x_lcdc_w ) |
| 156 | { |
| 157 | if (mem_mask == 0xffff) |
| 158 | { |
| 159 | gp2x_vidregs[offset*2] = data; |
| 160 | // printf("%x to video reg %x (%s)\n", data, offset*2, gp2x_regnames[offset*2]); |
| 161 | } |
| 162 | else if (mem_mask == 0xffff0000) |
| 163 | { |
| 164 | gp2x_vidregs[(offset*2)+1] = data>>16; |
| 165 | // printf("%x to video reg %x (%s)\n", data>>16, (offset*2)+1, gp2x_regnames[(offset*2)+1]); |
| 166 | } |
| 167 | else |
| 168 | { |
| 169 | logerror("GP2X LCDC: ERROR: write %x to vid reg @ %x mask %08x\n", data, offset, mem_mask); |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | static UINT32 nand_ptr = 0, nand_cmd, nand_subword_stage; |
| 174 | static UINT32 nand_stage = 0, nand_ptr_temp = 0; |
| 175 | static READ32_HANDLER(nand_r) |
| 176 | { |
| 177 | UINT32 *ROM = (UINT32 *)memory_region(space->machine, "maincpu"); |
| 178 | UINT32 ret; |
| 179 | |
| 180 | if (offset == 0) |
| 181 | { |
| 182 | switch (nand_cmd) |
| 183 | { |
| 184 | case 0: |
| 185 | if (mem_mask == 0xffffffff) |
| 186 | { |
| 187 | return ROM[nand_ptr++]; |
| 188 | } |
| 189 | else if (mem_mask == 0x000000ff) // byte-wide reads? |
| 190 | { |
| 191 | switch (nand_subword_stage++) |
| 192 | { |
| 193 | case 0: |
| 194 | return ROM[nand_ptr]; |
| 195 | case 1: |
| 196 | return ROM[nand_ptr]>>8; |
| 197 | case 2: |
| 198 | return ROM[nand_ptr]>>16; |
| 199 | case 3: |
| 200 | ret = ROM[nand_ptr]>>24; |
| 201 | nand_subword_stage = 0; |
| 202 | nand_ptr++; |
| 203 | return ret; |
| 204 | default: |
| 205 | logerror("Bad nand_subword_stage = %d\n", nand_subword_stage); |
| 206 | break; |
| 207 | } |
| 208 | } |
| 209 | break; |
| 210 | |
| 211 | case 0x50: // read out-of-band data |
| 212 | return 0xff; |
| 213 | |
| 214 | case 0x90: // read ID |
| 215 | switch (nand_stage++) |
| 216 | { |
| 217 | case 0: |
| 218 | return 0xec; // Samsung |
| 219 | case 1: |
| 220 | return 0x76; // 64MB |
| 221 | } |
| 222 | break; |
| 223 | |
| 224 | default: |
| 225 | logerror("NAND: read unk command %x (PC %x)\n", nand_cmd, cpu_get_pc(space->cpu)); |
| 226 | break; |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | // printf("Read unknown nand offset %x\n", offset); |
| 231 | |
| 232 | return 0; |
| 233 | } |
| 234 | |
| 235 | static WRITE32_HANDLER(nand_w) |
| 236 | { |
| 237 | switch (offset) |
| 238 | { |
| 239 | case 4: // command |
| 240 | nand_cmd = data; |
| 241 | // printf("NAND: command %x (PC %x0)\n", data, cpu_get_pc(space->cpu)); |
| 242 | nand_stage = 0; |
| 243 | nand_subword_stage = 0; |
| 244 | break; |
| 245 | |
| 246 | case 6: // address |
| 247 | if (nand_cmd == 0) |
| 248 | { |
| 249 | switch (nand_stage) |
| 250 | { |
| 251 | case 0: |
| 252 | nand_ptr_temp &= ~0xff; |
| 253 | nand_ptr_temp |= data; |
| 254 | break; |
| 255 | case 1: |
| 256 | nand_ptr_temp &= ~0xff00; |
| 257 | nand_ptr_temp |= data<<8; |
| 258 | break; |
| 259 | case 2: |
| 260 | nand_ptr_temp &= ~0xff0000; |
| 261 | nand_ptr_temp |= data<<16; |
| 262 | break; |
| 263 | case 3: |
| 264 | nand_ptr_temp &= ~0xff000000; |
| 265 | nand_ptr_temp |= data<<24; |
| 266 | |
| 267 | // printf("NAND: ptr now %x, /2 %x, replacing %x\n", nand_ptr_temp, nand_ptr_temp/2, nand_ptr); |
| 268 | nand_ptr = nand_ptr_temp/2; |
| 269 | break; |
| 270 | } |
| 271 | nand_stage++; |
| 272 | } |
| 273 | break; |
| 274 | |
| 275 | default: |
| 276 | logerror("nand_w: %x to unknown offset %x\n", data, offset); |
| 277 | break; |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | static READ32_HANDLER(tx_status_r) |
| 282 | { |
| 283 | return 0x6; // tx ready, tx empty |
| 284 | } |
| 285 | |
| 286 | static WRITE32_HANDLER(tx_xmit_w) |
| 287 | { |
| 288 | printf("%c", data&0xff); |
| 289 | } |
| 290 | |
| 291 | static UINT32 timer = 0; |
| 292 | static READ32_HANDLER(timer_r) |
| 293 | { |
| 294 | return timer++; |
| 295 | } |
| 296 | |
| 297 | static READ32_HANDLER(nand_ctrl_r) |
| 298 | { |
| 299 | return 0x8000<<16; // timed out |
| 300 | } |
| 301 | |
| 302 | static WRITE32_HANDLER(nand_ctrl_w) |
| 303 | { |
| 304 | // printf("%08x to nand_ctrl_w\n", data); |
| 305 | } |
| 306 | |
| 307 | static READ32_HANDLER(sdcard_r) |
| 308 | { |
| 309 | return 0xffff<<16; // at 3e146b0 - indicate timeout & CRC error |
| 310 | } |
| 311 | |
| 312 | static ADDRESS_MAP_START( gp2x_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 313 | AM_RANGE(0x00000000, 0x00007fff) AM_ROM |
| 314 | AM_RANGE(0x01000000, 0x04ffffff) AM_RAM AM_BASE(&gp2x_ram) // 64 MB of RAM |
| 315 | AM_RANGE(0x9c000000, 0x9c00001f) AM_READWRITE(nand_r, nand_w) |
| 316 | AM_RANGE(0xc0000a00, 0xc0000a03) AM_READ(timer_r) |
| 317 | AM_RANGE(0xc0001208, 0xc000120b) AM_READ(tx_status_r) |
| 318 | AM_RANGE(0xc0001210, 0xc0001213) AM_WRITE(tx_xmit_w) |
| 319 | AM_RANGE(0xc0001508, 0xc000150b) AM_READ(sdcard_r) |
| 320 | AM_RANGE(0xc0002800, 0xc00029ff) AM_READWRITE(gp2x_lcdc_r, gp2x_lcdc_w) |
| 321 | AM_RANGE(0xc0003a38, 0xc0003a3b) AM_READWRITE(nand_ctrl_r, nand_ctrl_w) |
| 322 | ADDRESS_MAP_END |
| 323 | |
| 324 | static INPUT_PORTS_START( gp2x ) |
| 325 | INPUT_PORTS_END |
| 326 | |
| 327 | static MACHINE_DRIVER_START( gp2x ) |
| 328 | MDRV_CPU_ADD("maincpu", ARM9, 80000000) |
| 329 | MDRV_CPU_PROGRAM_MAP(gp2x_map) |
| 330 | |
| 331 | MDRV_PALETTE_LENGTH(32768) |
| 332 | |
| 333 | MDRV_SCREEN_ADD("screen", RASTER) |
| 334 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 335 | MDRV_SCREEN_REFRESH_RATE(60) |
| 336 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 337 | MDRV_SCREEN_SIZE(320, 240) |
| 338 | MDRV_SCREEN_VISIBLE_AREA(0, 319, 0, 239) |
| 339 | |
| 340 | MDRV_VIDEO_UPDATE(gp2x) |
| 341 | |
| 342 | MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 343 | MACHINE_DRIVER_END |
| 344 | |
| 345 | ROM_START(gp2x) |
| 346 | ROM_REGION( 0x600000, "maincpu", 0 ) // contents of NAND flash |
| 347 | ROM_LOAD( "gp2xboot.img", 0x000000, 0x05b264, CRC(9d82937e) SHA1(9655f04c11f78526b3b8a4613897070df3119ead) ) |
| 348 | ROM_LOAD( "gp2xkernel.img", 0x080000, 0x09a899, CRC(e272eac9) SHA1(9d814ad6c27d22812ba3f101a7358698d1b035eb) ) |
| 349 | ROM_LOAD( "gp2xsound.wav", 0x1a0000, 0x03a42c, CRC(b6ac0ade) SHA1(32362ebbcd09a3b15e164ec3fbd2a8f11159bcd7) ) |
| 350 | ROM_END |
| 351 | |
| 352 | ROM_START(gp2x3) |
| 353 | ROM_REGION( 0x600000, "maincpu", ROMREGION_ERASEFF ) // contents of NAND flash |
| 354 | ROM_LOAD( "gp2xboot.img", 0x000000, 0x05b264, CRC(ab1fc556) SHA1(2ce66fec325b6e8e29f540322aefb435d8e3baf0) ) |
| 355 | ROM_LOAD( "gp2xkernel.img", 0x080000, 0x09f047, CRC(6f8922ae) SHA1(0f44204757f9251c7d68560ff31a1ce72f16698e) ) |
| 356 | ROM_LOAD( "gp2xsound.wav", 0x1a0000, 0x03a42c, CRC(b6ac0ade) SHA1(32362ebbcd09a3b15e164ec3fbd2a8f11159bcd7) ) |
| 357 | ROM_LOAD( "gp2xyaffs.img", 0x300000, 0x2ec4d0, CRC(f81a4a57) SHA1(73bb84798ad3a4e281612a47abb2da4772cbe6cd) ) |
| 358 | ROM_END |
| 359 | |
| 360 | ROM_START(gp2x4) |
| 361 | ROM_REGION( 0x600000, "maincpu", 0 ) // contents of NAND flash |
| 362 | ROM_LOAD( "gp2xboot.img", 0x000000, 0x05b264, CRC(160af379) SHA1(0940fc975960fa52f32a9258a9480cc5cb1140e2) ) |
| 363 | ROM_LOAD( "gp2xkernel.img", 0x080000, 0x0a43a8, CRC(77b1cf9c) SHA1(7e759e4581399bfbee982e1b6c3b54a10b0e9c3d) ) |
| 364 | ROM_LOAD( "gp2xsound.wav", 0x1a0000, 0x03a42c, CRC(b6ac0ade) SHA1(32362ebbcd09a3b15e164ec3fbd2a8f11159bcd7) ) |
| 365 | ROM_LOAD( "gp2xyaffs.img", 0x300000, 0x2dfed0, CRC(e77efc53) SHA1(21477ff77aacb84005bc465a03066d71031a6098) ) |
| 366 | ROM_END |
| 367 | |
| 368 | CONS(2005, gp2x, 0, 0, gp2x, gp2x, 0, 0, "Game Park Holdings", "GP2X 2.0", GAME_NOT_WORKING|GAME_NO_SOUND) |
| 369 | CONS(2005, gp2x3, gp2x, 0, gp2x, gp2x, 0, 0, "Game Park Holdings", "GP2X 3.0", GAME_NOT_WORKING|GAME_NO_SOUND) |
| 370 | CONS(2005, gp2x4, gp2x, 0, gp2x, gp2x, 0, 0, "Game Park Holdings", "GP2X 4.0", GAME_NOT_WORKING|GAME_NO_SOUND) |
| 371 | |
| 372 | |
src/mess/drivers/esq1.c
| r0 | r5722 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | drivers/esq1.c |
| 4 | |
| 5 | Ensoniq ESQ-1 and SQ-80 Digital Wave Synthesizers |
| 6 | Preliminary driver by R. Belmont |
| 7 | |
| 8 | Map for ESQ-1: |
| 9 | 0000-1fff: OS RAM |
| 10 | 2000-3fff: Cartridge |
| 11 | 4000-5fff: SEQRAM |
| 12 | 6000-63ff: ES5503 DOC |
| 13 | 6400-67ff: MC2681 DUART |
| 14 | 6800-6fff: AD7524 (CV_MUX) |
| 15 | 7000-7fff: OS ROM low (banked) |
| 16 | 8000-ffff: OS ROM high (fixed) |
| 17 | |
| 18 | Map for SQ-80: |
| 19 | 0000-1fff: OS RAM |
| 20 | 2000-3fff: Cartridge |
| 21 | 4000-5fff: DOSRAM or SEQRAM (banked) |
| 22 | 6000-63ff: ES5503 DOC |
| 23 | 6400-67ff: MC2681 DUART |
| 24 | 6800-6bff: AD7524 (CV_MUX) |
| 25 | 6c00-6dff: Mapper (bit 0 only - determines DOSRAM or SEQRAM at 4000) |
| 26 | 6e00-6fff: WD1772 FDC (not present on ESQ1) |
| 27 | 7000-7fff: OS ROM low (banked) |
| 28 | 8000-ffff: OS ROM high (fixed) |
| 29 | |
| 30 | CV_MUX area: |
| 31 | write to output goes to |
| 32 | $68f8 $00 D/A converter |
| 33 | $68f0 -$08 Filter Frequency (FF) |
| 34 | $68e8 -$10 Filter Resonance (Q) |
| 35 | $68d8 -$20 Final DCA (ENV4) |
| 36 | $68b8 -$40 Panning (PAN) |
| 37 | $6878 -$80 Floppy (Motor/LED on) |
| 38 | |
| 39 | If SEQRAM is mapped at 4000, DUART port 2 determines the 32KB "master bank" and ports 0 and 1 |
| 40 | determine which of the 4 8KB "sub banks" is visible. |
| 41 | |
| 42 | Output ports 3 to 1 determine the 4kB page which should be shown at $7000 to $7fff. |
| 43 | |
| 44 | IRQ sources are the DUART and the DRQ line from the FDC (SQ-80 only). |
| 45 | NMI is from the IRQ line on the FDC (again, SQ-80 only). |
| 46 | |
| 47 | TODO: |
| 48 | - Actual 2681 DUART emulation |
| 49 | - VFD display |
| 50 | - Keyboard |
| 51 | - Analog filters and VCA on the back end of the 5503 |
| 52 | - SQ-80 support (additional banking, FDC) |
| 53 | |
| 54 | ***************************************************************************/ |
| 55 | |
| 56 | #include "driver.h" |
| 57 | #include "cpu/m6809/m6809.h" |
| 58 | #include "sound/es5503.h" |
| 59 | |
| 60 | static UINT8 uart_regs[0x10]; |
| 61 | static UINT8 uart_outputport; |
| 62 | |
| 63 | void esq1_doc_irq(const device_config *device, int state) |
| 64 | { |
| 65 | } |
| 66 | |
| 67 | static READ8_DEVICE_HANDLER( esq1_adc_read ) |
| 68 | { |
| 69 | return 0x80; |
| 70 | } |
| 71 | |
| 72 | static const es5503_interface esq1_es5503_interface = |
| 73 | { |
| 74 | esq1_doc_irq, |
| 75 | esq1_adc_read, |
| 76 | NULL |
| 77 | }; |
| 78 | |
| 79 | static VIDEO_START( esq1 ) |
| 80 | { |
| 81 | } |
| 82 | |
| 83 | static VIDEO_UPDATE( esq1 ) |
| 84 | { |
| 85 | return 0; |
| 86 | } |
| 87 | |
| 88 | static MACHINE_RESET( esq1 ) |
| 89 | { |
| 90 | es5503_set_base(devtag_get_device(machine, "es5503"), memory_region(machine, "ensoniq")); |
| 91 | |
| 92 | // set default OSROM banking |
| 93 | memory_set_bankptr(machine, 1, memory_region(machine, "osrom") ); |
| 94 | } |
| 95 | |
| 96 | static void recalc_osrom_bank(running_machine *machine) |
| 97 | { |
| 98 | int bank = ((uart_outputport >> 1) & 0x7) ^ 7; |
| 99 | |
| 100 | // printf("bank %d => offset %x (PC=%x)\n", bank, bank * 0x1000, cpu_get_pc(machine->cpu[0])); |
| 101 | memory_set_bankptr(machine, 1, memory_region(machine, "osrom") + (bank * 0x1000) ); |
| 102 | } |
| 103 | |
| 104 | static READ8_HANDLER( uart_r ) |
| 105 | { |
| 106 | // printf("Read UART @ %x\n", offset); |
| 107 | |
| 108 | switch (offset) |
| 109 | { |
| 110 | case 5: // interrupt status |
| 111 | return 0x08; // timer/counter expire |
| 112 | break; |
| 113 | } |
| 114 | |
| 115 | return 0; |
| 116 | } |
| 117 | |
| 118 | static WRITE8_HANDLER( uart_w ) |
| 119 | { |
| 120 | uart_regs[offset] = data; |
| 121 | |
| 122 | // printf("%x to UART %x\n", data, offset); |
| 123 | |
| 124 | switch (offset) |
| 125 | { |
| 126 | case 0xb: |
| 127 | // printf("%02x to 6500\n", data); |
| 128 | break; |
| 129 | |
| 130 | case 0xe: // set output port bits |
| 131 | uart_outputport |= data; |
| 132 | recalc_osrom_bank(space->machine); |
| 133 | break; |
| 134 | |
| 135 | case 0xf: // reset output port bits |
| 136 | uart_outputport &= ~data; |
| 137 | recalc_osrom_bank(space->machine); |
| 138 | break; |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | static ADDRESS_MAP_START( esq1_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 143 | AM_RANGE(0x0000, 0x1fff) AM_RAM // OSRAM |
| 144 | AM_RANGE(0x4000, 0x5fff) AM_RAM // SEQRAM |
| 145 | AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE("es5503", es5503_r, es5503_w) |
| 146 | AM_RANGE(0x6400, 0x640f) AM_READWRITE( uart_r, uart_w ) |
| 147 | AM_RANGE(0x7000, 0x7fff) AM_ROMBANK(1) |
| 148 | AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("osrom", 0x8000) // OS "high" ROM is always mapped here |
| 149 | ADDRESS_MAP_END |
| 150 | |
| 151 | static INTERRUPT_GEN( esq1_interrupt ) |
| 152 | { |
| 153 | cputag_set_input_line(device->machine, "maincpu", 0, HOLD_LINE); |
| 154 | } |
| 155 | |
| 156 | static MACHINE_DRIVER_START( esq1 ) |
| 157 | MDRV_CPU_ADD("maincpu", M6809E, 4000000) // how fast is it? |
| 158 | MDRV_CPU_PROGRAM_MAP(esq1_map) |
| 159 | MDRV_CPU_VBLANK_INT("screen", esq1_interrupt) |
| 160 | |
| 161 | MDRV_MACHINE_RESET( esq1 ) |
| 162 | |
| 163 | MDRV_SCREEN_ADD("screen", RASTER) |
| 164 | MDRV_SCREEN_REFRESH_RATE(60) |
| 165 | MDRV_VIDEO_START(esq1) |
| 166 | MDRV_VIDEO_UPDATE(esq1) |
| 167 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 168 | MDRV_SCREEN_SIZE(320, 240) |
| 169 | MDRV_SCREEN_VISIBLE_AREA(0, 319, 1, 239) |
| 170 | |
| 171 | MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 172 | MDRV_SOUND_ADD("es5503", ES5503, 7000000) |
| 173 | MDRV_SOUND_CONFIG(esq1_es5503_interface) |
| 174 | MDRV_SOUND_ROUTE(0, "lspeaker", 1.0) |
| 175 | MDRV_SOUND_ROUTE(1, "rspeaker", 1.0) |
| 176 | MACHINE_DRIVER_END |
| 177 | |
| 178 | static INPUT_PORTS_START( esq1 ) |
| 179 | INPUT_PORTS_END |
| 180 | |
| 181 | ROM_START( esq1 ) |
| 182 | ROM_REGION(0x10000, "osrom", 0) |
| 183 | ROM_LOAD( "3p5lo.bin", 0x0000, 0x8000, CRC(ed001ad8) SHA1(14d1150bccdbc15d90567cf1812aacdb3b6ee882) ) |
| 184 | ROM_LOAD( "3p5hi.bin", 0x8000, 0x8000, CRC(332c572f) SHA1(ddb4f62807eb2ab29e5ac6b5d209d2ecc74cf806) ) |
| 185 | |
| 186 | ROM_REGION(0x20000, "ensoniq", 0) |
| 187 | ROM_LOAD( "esq1wavlo.bin", 0x0000, 0x8000, CRC(4d04ac87) SHA1(867b51229b0a82c886bf3b216aa8893748236d8b) ) |
| 188 | ROM_LOAD( "esq1wavhi.bin", 0x8000, 0x8000, CRC(94c554a3) SHA1(ed0318e5253637585559e8cf24c06d6115bd18f6) ) |
| 189 | ROM_END |
| 190 | |
| 191 | CONS( 1987, esq1, 0, 0, esq1, esq1, 0, 0, "Ensoniq", "ESQ-1", GAME_NOT_WORKING ) |
| 192 | |
| 193 | /* |
| 194 | |
| 195 | 7 to UART 6 counter/timer upper |
| 196 | d0 to UART 7 counter/timer lower |
| 197 | 60 to UART 4 aux control (C/T timer mode using external clock) |
| 198 | 20 to UART a command register B |
| 199 | 30 to UART a command register B |
| 200 | 10 to UART a command register B |
| 201 | 13 to UART 8 mode register B => 8 bits no parity |
| 202 | f to UART 8 mode register B => force odd parity, 8 bits (?) |
| 203 | ee to UART 9 clock select register B |
| 204 | 5 to UART a command register B (Enable Tx/Enable Rx) |
| 205 | e7 to UART b Tx holding register B (send E7 to display) |
| 206 | 0 to UART d output port config (all bits are output ports) |
| 207 | ab to UART 5 interrupt mask register (input port change, RxRdyB, counter ready, RxReadyA, TxReadyA) |
| 208 | |
| 209 | */ |
| 210 | |
src/mess/drivers/gp32.c
| r0 | r5722 | |
| 1 | /************************************************************************** |
| 2 | * |
| 3 | * gp32.c - Game Park GP32 |
| 4 | * Skeleton by R. Belmont |
| 5 | * |
| 6 | * CPU: Samsung S3C2400X01 SoC |
| 7 | * S3C2400X01 consists of: |
| 8 | * ARM920T CPU core + MMU |
| 9 | * LCD controller |
| 10 | * DMA controller |
| 11 | * Interrupt controller |
| 12 | * USB controller |
| 13 | * and more. |
| 14 | * |
| 15 | **************************************************************************/ |
| 16 | |
| 17 | #include "driver.h" |
| 18 | #include "video/generic.h" |
| 19 | #include "cpu/arm7/arm7.h" |
| 20 | |
| 21 | static UINT32 s3c240x_vidregs[0x400/4]; |
| 22 | |
| 23 | static UINT32 *s3c240x_ram; |
| 24 | |
| 25 | static VIDEO_UPDATE( gp32 ) |
| 26 | { |
| 27 | if (s3c240x_vidregs[0] & 1) // display enabled? |
| 28 | { |
| 29 | int x, y; |
| 30 | UINT8 *vram; |
| 31 | UINT32 vramaddr = s3c240x_vidregs[5]; |
| 32 | |
| 33 | // get offset |
| 34 | vramaddr = (vramaddr & 0x1fffff); |
| 35 | vramaddr |= (s3c240x_vidregs[5]&0xffe00000)<<1; |
| 36 | |
| 37 | vram = (UINT8 *)&s3c240x_ram[(vramaddr-0x0c000000)/4]; |
| 38 | |
| 39 | for (y = 0; y < 240; y++) |
| 40 | { |
| 41 | UINT16 *scanline = BITMAP_ADDR16(bitmap, y, 0); |
| 42 | |
| 43 | for (x = 0; x < 320; x++) |
| 44 | { |
| 45 | *scanline++ = vram[(160*y)+x]; |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | return 0; |
| 51 | } |
| 52 | |
| 53 | static READ32_HANDLER(s3c240x_vidregs_r) |
| 54 | { |
| 55 | // make sure line counter is going |
| 56 | s3c240x_vidregs[0] &= 0x3ffff; |
| 57 | s3c240x_vidregs[0] |= (240-video_screen_get_vpos(space->machine->primary_screen))<<18; |
| 58 | |
| 59 | return s3c240x_vidregs[offset]; |
| 60 | } |
| 61 | |
| 62 | static WRITE32_HANDLER(s3c240x_vidregs_w) |
| 63 | { |
| 64 | COMBINE_DATA(&s3c240x_vidregs[offset]); |
| 65 | } |
| 66 | |
| 67 | static WRITE32_HANDLER(s3c240x_palette_w) |
| 68 | { |
| 69 | if (mem_mask != 0xffffffff) |
| 70 | { |
| 71 | printf("s3c240x_palette_w: unknown mask %08x\n", mem_mask); |
| 72 | } |
| 73 | |
| 74 | palette_set_color_rgb(space->machine, offset, ((data>>11)&0x1f)<<3, ((data>>5)&0x3f)<<2, (data&0x1f)<<3); |
| 75 | } |
| 76 | |
| 77 | static UINT32 s3c240x_irq_regs[0x18/4]; |
| 78 | static READ32_HANDLER(s3c240x_irq_r) |
| 79 | { |
| 80 | return s3c240x_irq_regs[offset]; |
| 81 | } |
| 82 | |
| 83 | static WRITE32_HANDLER(s3c240x_irq_w) |
| 84 | { |
| 85 | // printf("%08x to interrupt controller @ 0x144000%02x\n", data, offset<<2); |
| 86 | |
| 87 | COMBINE_DATA(&s3c240x_irq_regs[offset]); |
| 88 | } |
| 89 | |
| 90 | #if 0 |
| 91 | static const char *timer_reg_names[] = |
| 92 | { |
| 93 | "Timer config 0", |
| 94 | "Timer config 1", |
| 95 | "Timer control", |
| 96 | "Timer count buffer 0", |
| 97 | "Timer compare buffer 0", |
| 98 | "Timer count observation 0", |
| 99 | "Timer count buffer 1", |
| 100 | "Timer compare buffer 1", |
| 101 | "Timer count observation 1", |
| 102 | "Timer count buffer 2", |
| 103 | "Timer compare buffer 2", |
| 104 | "Timer count observation 2", |
| 105 | "Timer count buffer 3", |
| 106 | "Timer compare buffer 3", |
| 107 | "Timer count observation 3", |
| 108 | "Timer count buffer 4", |
| 109 | "Timer compare buffer 4", |
| 110 | "Timer count observation 4", |
| 111 | }; |
| 112 | #endif |
| 113 | |
| 114 | static emu_timer *s3c240x_timers[5]; |
| 115 | static UINT32 s3c240x_timer_regs[0x44/4]; |
| 116 | static READ32_HANDLER(s3c240x_timer_r) |
| 117 | { |
| 118 | return s3c240x_timer_regs[offset]; |
| 119 | } |
| 120 | |
| 121 | static void s3c240x_timer_recalc(running_machine *machine, int timer, UINT32 ctrl_bits, UINT32 count_reg) |
| 122 | { |
| 123 | if (ctrl_bits & 1) // timer start? |
| 124 | { |
| 125 | // printf("starting timer %d\n", timer); |
| 126 | } |
| 127 | else // stopping is easy |
| 128 | { |
| 129 | // printf("stopping timer %d\n", timer); |
| 130 | timer_adjust_oneshot(s3c240x_timers[timer], attotime_never, 0); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | static WRITE32_HANDLER(s3c240x_timer_w) |
| 135 | { |
| 136 | UINT32 old_value = s3c240x_timer_regs[offset]; |
| 137 | |
| 138 | // printf("%08x to timer @ 0x151000%02x (%s)\n", data, offset<<2, timer_reg_names[offset]); |
| 139 | |
| 140 | COMBINE_DATA(&s3c240x_timer_regs[offset]); |
| 141 | |
| 142 | if (offset == 2) // TCON |
| 143 | { |
| 144 | if ((data & 1) != (old_value & 1)) // timer 0 status change |
| 145 | { |
| 146 | s3c240x_timer_recalc(space->machine, 0, data&0xf, 0xc); |
| 147 | } |
| 148 | |
| 149 | if ((data & 0x100) != (old_value & 0x100)) // timer 1 status change |
| 150 | { |
| 151 | s3c240x_timer_recalc(space->machine, 1, (data>>8)&0xf, 0x18); |
| 152 | } |
| 153 | |
| 154 | if ((data & 0x1000) != (old_value & 0x1000)) // timer 2 status change |
| 155 | { |
| 156 | s3c240x_timer_recalc(space->machine, 2, (data>>12)&0xf, 0x24); |
| 157 | } |
| 158 | |
| 159 | if ((data & 0x10000) != (old_value & 0x10000)) // timer 3 status change |
| 160 | { |
| 161 | s3c240x_timer_recalc(space->machine, 3, (data>>16)&0xf, 0x30); |
| 162 | } |
| 163 | |
| 164 | if ((data & 0x100000) != (old_value & 0x100000)) // timer 4 status change |
| 165 | { |
| 166 | s3c240x_timer_recalc(space->machine, 4, (data>>20)&0xf, 0x3c); |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | static TIMER_CALLBACK( s3c240x_timer_exp ) |
| 172 | { |
| 173 | int ch = param; |
| 174 | |
| 175 | timer_adjust_oneshot(s3c240x_timers[ch], attotime_never, 0); |
| 176 | } |
| 177 | |
| 178 | static void s3c240x_machine_start(running_machine *machine) |
| 179 | { |
| 180 | s3c240x_timers[0] = timer_alloc(machine, s3c240x_timer_exp, (void *)(FPTR)0); |
| 181 | s3c240x_timers[1] = timer_alloc(machine, s3c240x_timer_exp, (void *)(FPTR)1); |
| 182 | s3c240x_timers[2] = timer_alloc(machine, s3c240x_timer_exp, (void *)(FPTR)2); |
| 183 | s3c240x_timers[3] = timer_alloc(machine, s3c240x_timer_exp, (void *)(FPTR)3); |
| 184 | s3c240x_timers[4] = timer_alloc(machine, s3c240x_timer_exp, (void *)(FPTR)4); |
| 185 | } |
| 186 | |
| 187 | static UINT32 s3c240x_gpio[0x60/4]; |
| 188 | |
| 189 | static READ32_HANDLER( s3c240x_gpio_r ) |
| 190 | { |
| 191 | // printf("read GPIO @ 0x156000%02x (PC %x)\n", offset*4, cpu_get_pc(space->cpu)); |
| 192 | |
| 193 | return s3c240x_gpio[offset]; |
| 194 | } |
| 195 | |
| 196 | static WRITE32_HANDLER( s3c240x_gpio_w ) |
| 197 | { |
| 198 | COMBINE_DATA(&s3c240x_gpio[offset]); |
| 199 | |
| 200 | // printf("%08x to GPIO @ 0x156000%02x (PC %x)\n", data, offset*4, cpu_get_pc(space->cpu)); |
| 201 | |
| 202 | // if (offset == 0x30/4) printf("[%08x] %s %s\n", data, (data & 0x200) ? "SCL" : "scl", (data & 0x400) ? "SDL" : "sdl"); |
| 203 | } |
| 204 | |
| 205 | static ADDRESS_MAP_START( gp32_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 206 | AM_RANGE(0x00000000, 0x0007ffff) AM_ROM |
| 207 | AM_RANGE(0x0c000000, 0x0c7fffff) AM_RAM AM_BASE(&s3c240x_ram) |
| 208 | AM_RANGE(0x14400000, 0x14400017) AM_READWRITE(s3c240x_irq_r, s3c240x_irq_w) |
| 209 | AM_RANGE(0x14a00000, 0x14a003ff) AM_READWRITE(s3c240x_vidregs_r, s3c240x_vidregs_w) |
| 210 | AM_RANGE(0x14a00400, 0x14a007ff) AM_RAM AM_BASE(&paletteram32) AM_WRITE(s3c240x_palette_w) |
| 211 | AM_RANGE(0x15100000, 0x15100043) AM_READWRITE(s3c240x_timer_r, s3c240x_timer_w) |
| 212 | AM_RANGE(0x15600000, 0x1560005b) AM_READWRITE(s3c240x_gpio_r, s3c240x_gpio_w) |
| 213 | ADDRESS_MAP_END |
| 214 | |
| 215 | static INPUT_PORTS_START( gp32 ) |
| 216 | INPUT_PORTS_END |
| 217 | |
| 218 | static MACHINE_START( gp32 ) |
| 219 | { |
| 220 | s3c240x_machine_start(machine); |
| 221 | } |
| 222 | |
| 223 | static MACHINE_DRIVER_START( gp32 ) |
| 224 | MDRV_CPU_ADD("maincpu", ARM9, 40000000) |
| 225 | MDRV_CPU_PROGRAM_MAP(gp32_map) |
| 226 | |
| 227 | MDRV_PALETTE_LENGTH(32768) |
| 228 | |
| 229 | MDRV_SCREEN_ADD("screen", RASTER) |
| 230 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 231 | MDRV_SCREEN_REFRESH_RATE(60) |
| 232 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 233 | MDRV_SCREEN_SIZE(320, 240) |
| 234 | MDRV_SCREEN_VISIBLE_AREA(0, 319, 0, 239) |
| 235 | |
| 236 | MDRV_VIDEO_UPDATE(gp32) |
| 237 | |
| 238 | MDRV_MACHINE_START(gp32) |
| 239 | |
| 240 | MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 241 | MACHINE_DRIVER_END |
| 242 | |
| 243 | ROM_START(gp32) |
| 244 | ROM_REGION( 0x80000, "maincpu", 0 ) |
| 245 | ROM_LOAD( "gp32157e.bin", 0x000000, 0x080000, CRC(b1e35643) SHA1(1566bc2a27980602e9eb501cf8b2d62939bfd1e5) ) |
| 246 | ROM_END |
| 247 | |
| 248 | CONS(2001, gp32, 0, 0, gp32, gp32, 0, 0, "Game Park", "GP32", GAME_NOT_WORKING|GAME_NO_SOUND) |
| 249 | |