src/mess/machine/msx.c
| r4653 | r4654 | |
| 1027 | 1027 | } |
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | | WRITE8_HANDLER (msx_superloadrunner_w) |
| 1030 | WRITE8_HANDLER (msx_page0_w) |
| 1031 | 1031 | { |
| 1032 | | msx1.superloadrunner_bank = data; |
| 1033 | | if (msx1.slot[2]->slot_type == SLOT_SUPERLOADRUNNER) { |
| 1034 | | msx1.slot[2]->map (space->machine, msx1.state[2], 2); |
| 1032 | if ( offset == 0 ) |
| 1033 | { |
| 1034 | msx1.superloadrunner_bank = data; |
| 1035 | if (msx1.slot[2]->slot_type == SLOT_SUPERLOADRUNNER) { |
| 1036 | msx1.slot[2]->map (space->machine, msx1.state[2], 2); |
| 1037 | } |
| 1035 | 1038 | } |
| 1036 | | msx_page0_w(space, -1, data); |
| 1037 | | } |
| 1038 | 1039 | |
| 1039 | | WRITE8_HANDLER (msx_page0_w) |
| 1040 | | { |
| 1041 | | offset++; |
| 1042 | | |
| 1043 | 1040 | switch (msx1.slot[0]->mem_type) { |
| 1044 | 1041 | case MSX_MEM_RAM: |
| 1045 | 1042 | msx1.ram_pages[0][offset] = data; |
| r4653 | r4654 | |
| 1049 | 1046 | } |
| 1050 | 1047 | } |
| 1051 | 1048 | |
| 1049 | WRITE8_HANDLER (msx_page0_1_w) |
| 1050 | { |
| 1051 | msx_page0_w( space, 0x2000 + offset, data ); |
| 1052 | } |
| 1053 | |
| 1052 | 1054 | WRITE8_HANDLER (msx_page1_w) |
| 1053 | 1055 | { |
| 1054 | 1056 | switch (msx1.slot[1]->mem_type) { |
| r4653 | r4654 | |
| 1060 | 1062 | } |
| 1061 | 1063 | } |
| 1062 | 1064 | |
| 1065 | WRITE8_HANDLER (msx_page1_1_w) |
| 1066 | { |
| 1067 | msx_page1_w( space, 0x2000 + offset, data ); |
| 1068 | } |
| 1069 | |
| 1070 | WRITE8_HANDLER (msx_page1_2_w) |
| 1071 | { |
| 1072 | msx_page1_w( space, 0x3ff8 + offset, data ); |
| 1073 | } |
| 1074 | |
| 1063 | 1075 | WRITE8_HANDLER (msx_page2_w) |
| 1064 | 1076 | { |
| 1065 | 1077 | switch (msx1.slot[2]->mem_type) { |
| r4653 | r4654 | |
| 1071 | 1083 | } |
| 1072 | 1084 | } |
| 1073 | 1085 | |
| 1086 | WRITE8_HANDLER (msx_page2_1_w) |
| 1087 | { |
| 1088 | msx_page2_w( space, 0x1800 + offset, data ); |
| 1089 | } |
| 1090 | |
| 1091 | WRITE8_HANDLER (msx_page2_2_w) |
| 1092 | { |
| 1093 | msx_page2_w( space, 0x2000 + offset, data ); |
| 1094 | } |
| 1095 | |
| 1096 | WRITE8_HANDLER (msx_page2_3_w) |
| 1097 | { |
| 1098 | msx_page2_w( space, 0x3800 + offset, data ); |
| 1099 | } |
| 1100 | |
| 1074 | 1101 | WRITE8_HANDLER (msx_page3_w) |
| 1075 | 1102 | { |
| 1076 | 1103 | switch (msx1.slot[3]->mem_type) { |
| r4653 | r4654 | |
| 1082 | 1109 | } |
| 1083 | 1110 | } |
| 1084 | 1111 | |
| 1112 | WRITE8_HANDLER (msx_page3_1_w) |
| 1113 | { |
| 1114 | msx_page3_w( space, 0x2000 + offset, data ); |
| 1115 | } |
| 1116 | |
| 1085 | 1117 | WRITE8_HANDLER (msx_sec_slot_w) |
| 1086 | 1118 | { |
| 1087 | 1119 | int slot = msx1.primary_slot >> 6; |
| r4653 | r4654 | |
| 1141 | 1173 | { |
| 1142 | 1174 | UINT8 result = 0xff; |
| 1143 | 1175 | |
| 1144 | | if (msx1.kanji_mem) |
| 1176 | if (offset && msx1.kanji_mem) |
| 1145 | 1177 | { |
| 1146 | 1178 | int latch; |
| 1147 | 1179 | UINT8 ret; |
src/mess/drivers/msx.c
| r4653 | r4654 | |
| 295 | 295 | #include "sound/k051649.h" |
| 296 | 296 | #include "sound/2413intf.h" |
| 297 | 297 | |
| 298 | | static ADDRESS_MAP_START (readmem, ADDRESS_SPACE_PROGRAM, 8) |
| 299 | | AM_RANGE( 0x0000, 0x1fff) AM_READ( SMH_BANK1 ) |
| 300 | | AM_RANGE( 0x2000, 0x3fff) AM_READ( SMH_BANK2 ) |
| 301 | | AM_RANGE( 0x4000, 0x5fff) AM_READ( SMH_BANK3 ) |
| 302 | | AM_RANGE( 0x6000, 0x7ff7) AM_READ( SMH_BANK4 ) |
| 303 | | AM_RANGE( 0x7ff8, 0x7fff) AM_READ( SMH_BANK5 ) |
| 304 | | AM_RANGE( 0x8000, 0x97ff) AM_READ( SMH_BANK6 ) |
| 305 | | AM_RANGE( 0x9800, 0x9fff) AM_READ( SMH_BANK7 ) |
| 306 | | AM_RANGE( 0xa000, 0xb7ff) AM_READ( SMH_BANK8 ) |
| 307 | | AM_RANGE( 0xb800, 0xbfff) AM_READ( SMH_BANK9 ) |
| 308 | | AM_RANGE( 0xc000, 0xdfff) AM_READ( SMH_BANK10 ) |
| 309 | | AM_RANGE( 0xe000, 0xfffe) AM_READ( SMH_BANK11 ) |
| 310 | | AM_RANGE( 0xffff, 0xffff) AM_READ( msx_sec_slot_r ) |
| 298 | static ADDRESS_MAP_START (msx_memory_map, ADDRESS_SPACE_PROGRAM, 8) |
| 299 | AM_RANGE( 0x0000, 0x1fff) AM_READWRITE( SMH_BANK1, msx_page0_w ) |
| 300 | AM_RANGE( 0x2000, 0x3fff) AM_READWRITE( SMH_BANK2, msx_page0_1_w ) |
| 301 | AM_RANGE( 0x4000, 0x5fff) AM_READWRITE( SMH_BANK3, msx_page1_w ) |
| 302 | AM_RANGE( 0x6000, 0x7ff7) AM_READWRITE( SMH_BANK4, msx_page1_1_w ) |
| 303 | AM_RANGE( 0x7ff8, 0x7fff) AM_READWRITE( SMH_BANK5, msx_page1_2_w ) |
| 304 | AM_RANGE( 0x8000, 0x97ff) AM_READWRITE( SMH_BANK6, msx_page2_w ) |
| 305 | AM_RANGE( 0x9800, 0x9fff) AM_READWRITE( SMH_BANK7, msx_page2_1_w ) |
| 306 | AM_RANGE( 0xa000, 0xb7ff) AM_READWRITE( SMH_BANK8, msx_page2_2_w ) |
| 307 | AM_RANGE( 0xb800, 0xbfff) AM_READWRITE( SMH_BANK9, msx_page2_3_w ) |
| 308 | AM_RANGE( 0xc000, 0xdfff) AM_READWRITE( SMH_BANK10, msx_page3_w ) |
| 309 | AM_RANGE( 0xe000, 0xfffe) AM_READWRITE( SMH_BANK11, msx_page3_1_w ) |
| 310 | AM_RANGE( 0xffff, 0xffff) AM_READWRITE( msx_sec_slot_r, msx_sec_slot_w ) |
| 311 | 311 | ADDRESS_MAP_END |
| 312 | 312 | |
| 313 | | static ADDRESS_MAP_START( writemem , ADDRESS_SPACE_PROGRAM, 8) |
| 314 | | AM_RANGE( 0x0000, 0x0000) AM_WRITE( msx_superloadrunner_w ) |
| 315 | | AM_RANGE( 0x0001, 0x3fff) AM_WRITE( msx_page0_w ) |
| 316 | | AM_RANGE( 0x4000, 0x7fff) AM_WRITE( msx_page1_w ) |
| 317 | | AM_RANGE( 0x8000, 0xbfff) AM_WRITE( msx_page2_w ) |
| 318 | | AM_RANGE( 0xc000, 0xfffe) AM_WRITE( msx_page3_w ) |
| 319 | | AM_RANGE( 0xffff, 0xffff) AM_WRITE( msx_sec_slot_w ) |
| 320 | | ADDRESS_MAP_END |
| 321 | 313 | |
| 314 | static WRITE8_DEVICE_HANDLER( msx_ay8910_w ) |
| 315 | { |
| 316 | if ( offset & 1 ) |
| 317 | ay8910_data_w( device, offset, data ); |
| 318 | else |
| 319 | ay8910_address_w( device, offset, data ); |
| 320 | } |
| 322 | 321 | |
| 323 | | static ADDRESS_MAP_START (readport, ADDRESS_SPACE_IO, 8) |
| 322 | |
| 323 | static ADDRESS_MAP_START (msx_io_map, ADDRESS_SPACE_IO, 8) |
| 324 | 324 | ADDRESS_MAP_UNMAP_HIGH |
| 325 | 325 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 326 | | AM_RANGE( 0x90, 0x90) AM_DEVREAD("centronics", msx_printer_status_r) |
| 327 | | AM_RANGE( 0xa0, 0xa7) AM_DEVREAD("ay8910", ay8910_r ) |
| 328 | | AM_RANGE( 0xa8, 0xab) AM_DEVREAD("ppi8255", ppi8255_r ) |
| 329 | | AM_RANGE( 0x98, 0x98) AM_READ( TMS9928A_vram_r ) |
| 330 | | AM_RANGE( 0x99, 0x99) AM_READ( TMS9928A_register_r ) |
| 331 | | AM_RANGE( 0xd9, 0xd9) AM_READ( msx_kanji_r ) |
| 332 | | ADDRESS_MAP_END |
| 333 | | |
| 334 | | static ADDRESS_MAP_START (writeport, ADDRESS_SPACE_IO, 8) |
| 335 | | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 336 | 326 | AM_RANGE( 0x77, 0x77) AM_WRITE( msx_90in1_w ) |
| 337 | 327 | AM_RANGE( 0x7c, 0x7d) AM_WRITE( msx_fmpac_w ) |
| 338 | | AM_RANGE( 0x90, 0x90) AM_DEVWRITE("centronics", msx_printer_strobe_w) |
| 328 | AM_RANGE( 0x90, 0x90) AM_DEVREADWRITE("centronics", msx_printer_status_r, msx_printer_strobe_w) |
| 339 | 329 | AM_RANGE( 0x91, 0x91) AM_DEVWRITE("centronics", msx_printer_data_w) |
| 340 | | AM_RANGE( 0xa0, 0xa0) AM_DEVWRITE("ay8910", ay8910_address_w ) AM_MIRROR(0x06) |
| 341 | | AM_RANGE( 0xa1, 0xa1) AM_DEVWRITE("ay8910", ay8910_data_w ) AM_MIRROR(0x06) |
| 342 | | AM_RANGE( 0xa8, 0xab) AM_DEVWRITE("ppi8255", ppi8255_w ) |
| 343 | | AM_RANGE( 0x98, 0x98) AM_WRITE( TMS9928A_vram_w ) |
| 344 | | AM_RANGE( 0x99, 0x99) AM_WRITE( TMS9928A_register_w ) |
| 345 | | AM_RANGE( 0xd8, 0xd9) AM_WRITE( msx_kanji_w ) |
| 330 | AM_RANGE( 0xa0, 0xa7) AM_DEVREADWRITE("ay8910", ay8910_r, msx_ay8910_w ) |
| 331 | AM_RANGE( 0xa8, 0xab) AM_DEVREADWRITE("ppi8255", ppi8255_r, ppi8255_w ) |
| 332 | AM_RANGE( 0x98, 0x98) AM_READWRITE( TMS9928A_vram_r, TMS9928A_vram_w ) |
| 333 | AM_RANGE( 0x99, 0x99) AM_READWRITE( TMS9928A_register_r, TMS9928A_register_w ) |
| 334 | AM_RANGE( 0xd8, 0xd9) AM_READWRITE( msx_kanji_r, msx_kanji_w ) |
| 346 | 335 | ADDRESS_MAP_END |
| 347 | 336 | |
| 348 | | static ADDRESS_MAP_START (readport2, ADDRESS_SPACE_IO, 8) |
| 337 | |
| 338 | static ADDRESS_MAP_START (msx2_io_map, ADDRESS_SPACE_IO, 8) |
| 349 | 339 | ADDRESS_MAP_UNMAP_HIGH |
| 350 | 340 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 351 | | AM_RANGE( 0x90, 0x90) AM_DEVREAD("centronics", msx_printer_status_r) |
| 352 | | AM_RANGE( 0xa0, 0xa7) AM_DEVREAD("ay8910", ay8910_r ) |
| 353 | | AM_RANGE( 0xa8, 0xab) AM_DEVREAD("ppi8255", ppi8255_r ) |
| 354 | | AM_RANGE( 0x98, 0x98) AM_READ( v9938_0_vram_r ) |
| 355 | | AM_RANGE( 0x99, 0x99) AM_READ( v9938_0_status_r ) |
| 356 | | AM_RANGE( 0xb5, 0xb5) AM_READ( msx_rtc_reg_r ) |
| 357 | | AM_RANGE( 0xd9, 0xd9) AM_READ( msx_kanji_r ) |
| 358 | | AM_RANGE( 0xfc, 0xff) AM_READ( msx_ram_mapper_r ) |
| 359 | | ADDRESS_MAP_END |
| 360 | | |
| 361 | | static ADDRESS_MAP_START (writeport2, ADDRESS_SPACE_IO, 8) |
| 362 | | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 363 | 341 | AM_RANGE( 0x77, 0x77) AM_WRITE( msx_90in1_w ) |
| 364 | 342 | AM_RANGE( 0x7c, 0x7d) AM_WRITE( msx_fmpac_w ) |
| 365 | | AM_RANGE( 0x90, 0x90) AM_DEVWRITE("centronics", msx_printer_strobe_w) |
| 343 | AM_RANGE( 0x90, 0x90) AM_DEVREADWRITE("centronics", msx_printer_status_r, msx_printer_strobe_w) |
| 366 | 344 | AM_RANGE( 0x91, 0x91) AM_DEVWRITE("centronics", msx_printer_data_w) |
| 367 | | AM_RANGE( 0xa0, 0xa0) AM_DEVWRITE("ay8910", ay8910_address_w ) AM_MIRROR(0x06) |
| 368 | | AM_RANGE( 0xa1, 0xa1) AM_DEVWRITE("ay8910", ay8910_data_w ) AM_MIRROR(0x06) |
| 369 | | AM_RANGE( 0xa8, 0xab) AM_DEVWRITE("ppi8255", ppi8255_w ) |
| 370 | | AM_RANGE( 0x98, 0x98) AM_WRITE( v9938_0_vram_w ) |
| 371 | | AM_RANGE( 0x99, 0x99) AM_WRITE( v9938_0_command_w ) |
| 345 | AM_RANGE( 0xa0, 0xa7) AM_DEVREADWRITE("ay8910", ay8910_r, msx_ay8910_w ) |
| 346 | AM_RANGE( 0xa8, 0xab) AM_DEVREADWRITE("ppi8255", ppi8255_r, ppi8255_w ) |
| 347 | AM_RANGE( 0x98, 0x98) AM_READWRITE( v9938_0_vram_r, v9938_0_vram_w ) |
| 348 | AM_RANGE( 0x99, 0x99) AM_READWRITE( v9938_0_status_r, v9938_0_command_w ) |
| 372 | 349 | AM_RANGE( 0x9a, 0x9a) AM_WRITE( v9938_0_palette_w ) |
| 373 | 350 | AM_RANGE( 0x9b, 0x9b) AM_WRITE( v9938_0_register_w ) |
| 374 | 351 | AM_RANGE( 0xb4, 0xb4) AM_WRITE( msx_rtc_latch_w ) |
| 375 | | AM_RANGE( 0xb5, 0xb5) AM_WRITE( msx_rtc_reg_w ) |
| 376 | | AM_RANGE( 0xd8, 0xd9) AM_WRITE( msx_kanji_w ) |
| 377 | | AM_RANGE( 0xfc, 0xff) AM_WRITE( msx_ram_mapper_w ) |
| 352 | AM_RANGE( 0xb5, 0xb5) AM_READWRITE( msx_rtc_reg_r, msx_rtc_reg_w ) |
| 353 | AM_RANGE( 0xd8, 0xd9) AM_READWRITE( msx_kanji_r, msx_kanji_w ) |
| 354 | AM_RANGE( 0xfc, 0xff) AM_READWRITE( msx_ram_mapper_r, msx_ram_mapper_w ) |
| 378 | 355 | ADDRESS_MAP_END |
| 379 | 356 | |
| 357 | |
| 380 | 358 | static INPUT_PORTS_START( msx_dips ) |
| 381 | 359 | PORT_START("JOY0") |
| 382 | 360 | PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) |
| r4653 | r4654 | |
| 1052 | 1030 | static MACHINE_DRIVER_START( msx ) |
| 1053 | 1031 | /* basic machine hardware */ |
| 1054 | 1032 | MDRV_CPU_ADD("maincpu", Z80, 3579545) /* 3.579545 MHz */ |
| 1055 | | MDRV_CPU_PROGRAM_MAP(readmem,writemem) |
| 1056 | | MDRV_CPU_IO_MAP(readport,writeport) |
| 1033 | MDRV_CPU_PROGRAM_MAP(msx_memory_map, 0) |
| 1034 | MDRV_CPU_IO_MAP(msx_io_map, 0) |
| 1057 | 1035 | MDRV_CPU_VBLANK_INT("screen", msx_interrupt) |
| 1058 | 1036 | MDRV_QUANTUM_TIME(HZ(60)) |
| 1059 | 1037 | |
| r4653 | r4654 | |
| 1111 | 1089 | static MACHINE_DRIVER_START( msx2 ) |
| 1112 | 1090 | /* basic machine hardware */ |
| 1113 | 1091 | MDRV_CPU_ADD("maincpu", Z80, 3579545) /* 3.579545 MHz */ |
| 1114 | | MDRV_CPU_PROGRAM_MAP(readmem, writemem) |
| 1115 | | MDRV_CPU_IO_MAP(readport2,writeport2) |
| 1092 | MDRV_CPU_PROGRAM_MAP(msx_memory_map, 0) |
| 1093 | MDRV_CPU_IO_MAP(msx2_io_map, 0) |
| 1116 | 1094 | MDRV_CPU_VBLANK_INT_HACK(msx2_interrupt, 262) |
| 1117 | 1095 | MDRV_QUANTUM_TIME(HZ(60)) |
| 1118 | 1096 | |