src/mess/machine/msx_slot.c
| r12408 | r12409 | |
| 138 | 138 | MSX_SLOT_INIT(rammm) |
| 139 | 139 | { |
| 140 | 140 | int i, mask, nsize; |
| 141 | | #ifdef MONMSX |
| 142 | | FILE *f; |
| 143 | | #endif |
| 144 | 141 | |
| 145 | 142 | nsize = 0x10000; /* 64 kb */ |
| 146 | 143 | mask = 3; |
| r12408 | r12409 | |
| 162 | 159 | state->m_mem = auto_alloc_array(machine, UINT8, size); |
| 163 | 160 | memset (state->m_mem, 0, size); |
| 164 | 161 | |
| 165 | | #ifdef MONMSX |
| 166 | | f = fopen ("/home/sean/msx/hack/monmsx.bin", "r"); |
| 167 | | if (f) |
| 168 | | { |
| 169 | | fseek (f, 6L, SEEK_SET); |
| 170 | | fread (state->m_mem, 1, 6151 - 6, f); |
| 171 | | fclose (f); |
| 172 | | } |
| 173 | | #endif |
| 174 | | |
| 175 | 162 | state->m_type = SLOT_RAM_MM; |
| 176 | 163 | state->m_start_page = page; |
| 177 | 164 | state->m_size = size; |
src/mess/machine/msx.c
| r12408 | r12409 | |
| 175 | 175 | /* mapper type 0 always needs 64kB */ |
| 176 | 176 | if (!type && size_aligned != 0x10000) |
| 177 | 177 | { |
| 178 | UINT8 *old_mem = mem; |
| 179 | int old_size_aligned = size_aligned; |
| 180 | |
| 178 | 181 | size_aligned = 0x10000; |
| 179 | | auto_free(image.device().machine(),mem); |
| 180 | 182 | mem = auto_alloc_array(image.device().machine(),UINT8, 0x10000); |
| 181 | 183 | if (!mem) { |
| 184 | auto_free(image.device().machine(),old_mem); |
| 182 | 185 | logerror ("cart #%d: error: cannot allocate memory\n", id); |
| 183 | 186 | return IMAGE_INIT_FAIL; |
| 184 | 187 | } |
| r12408 | r12409 | |
| 192 | 195 | |
| 193 | 196 | size = 0x10000; |
| 194 | 197 | } |
| 198 | /* Copy old contents to newly claimed memory */ |
| 199 | memcpy(mem,old_mem,old_size_aligned); |
| 200 | auto_free(image.device().machine(),old_mem); |
| 195 | 201 | } |
| 196 | 202 | |
| 197 | 203 | /* mapper type 0 (ROM) might need moving around a bit */ |
| r12408 | r12409 | |
| 515 | 521 | READ8_HANDLER ( msx_psg_port_a_r ) |
| 516 | 522 | { |
| 517 | 523 | msx_state *state = space->machine().driver_data<msx_state>(); |
| 518 | | int data, inp; |
| 524 | UINT8 data; |
| 519 | 525 | |
| 520 | 526 | data = (cassette_device_image(space->machine())->input() > 0.0038 ? 0x80 : 0); |
| 521 | 527 | |
| 522 | 528 | if ( (state->m_psg_b ^ input_port_read(space->machine(), "DSW") ) & 0x40) |
| 523 | | { |
| 529 | { |
| 524 | 530 | /* game port 2 */ |
| 525 | | inp = input_port_read(space->machine(), "JOY1") & 0x7f; |
| 526 | | #if 0 |
| 531 | UINT8 inp = input_port_read(space->machine(), "JOY1"); |
| 527 | 532 | if ( !(inp & 0x80) ) |
| 528 | | { |
| 529 | | #endif |
| 533 | { |
| 530 | 534 | /* joystick */ |
| 531 | | return (inp & 0x7f) | data; |
| 532 | | #if 0 |
| 533 | | } |
| 535 | data |= ( inp & 0x7f ); |
| 536 | } |
| 534 | 537 | else |
| 535 | | { |
| 538 | { |
| 536 | 539 | /* mouse */ |
| 537 | | data |= inp & 0x70; |
| 540 | data |= ( inp & 0x70 ); |
| 538 | 541 | if (state->m_mouse_stat[1] < 0) |
| 539 | | inp = 0xf; |
| 542 | data |= 0xf; |
| 540 | 543 | else |
| 541 | | inp = ~(state->m_mouse[1] >> (4*state->m_mouse_stat[1]) ) & 15; |
| 542 | | |
| 543 | | return data | inp; |
| 544 | | } |
| 545 | | #endif |
| 544 | data |= ~(state->m_mouse[1] >> (4*state->m_mouse_stat[1]) ) & 15; |
| 546 | 545 | } |
| 546 | } |
| 547 | 547 | else |
| 548 | | { |
| 548 | { |
| 549 | 549 | /* game port 1 */ |
| 550 | | inp = input_port_read(space->machine(), "JOY0") & 0x7f; |
| 551 | | #if 0 |
| 550 | UINT8 inp = input_port_read(space->machine(), "JOY0"); |
| 552 | 551 | if ( !(inp & 0x80) ) |
| 553 | | { |
| 554 | | #endif |
| 552 | { |
| 555 | 553 | /* joystick */ |
| 556 | | return (inp & 0x7f) | data; |
| 557 | | #if 0 |
| 558 | | } |
| 554 | data |= ( inp & 0x7f ); |
| 555 | } |
| 559 | 556 | else |
| 560 | | { |
| 557 | { |
| 561 | 558 | /* mouse */ |
| 562 | | data |= inp & 0x70; |
| 559 | data |= ( inp & 0x70 ); |
| 563 | 560 | if (state->m_mouse_stat[0] < 0) |
| 564 | | inp = 0xf; |
| 561 | data |= 0xf; |
| 565 | 562 | else |
| 566 | | inp = ~(state->m_mouse[0] >> (4*state->m_mouse_stat[0]) ) & 15; |
| 567 | | |
| 568 | | return data | inp; |
| 569 | | } |
| 570 | | #endif |
| 563 | data |= ~(state->m_mouse[0] >> (4*state->m_mouse_stat[0]) ) & 15; |
| 571 | 564 | } |
| 565 | } |
| 572 | 566 | |
| 573 | | return 0; |
| 567 | return data; |
| 574 | 568 | } |
| 575 | 569 | |
| 576 | 570 | READ8_HANDLER ( msx_psg_port_b_r ) |