src/mess/machine/mikro80.c
| r3592 | r3593 | |
| 21 | 21 | /* set initialy ROM to be visible on first bank */ |
| 22 | 22 | UINT8 *RAM = memory_region(machine, "main"); |
| 23 | 23 | memset(RAM,0x0000,0x0800); // make frist page empty by default |
| 24 | | memory_configure_bank(1, 1, 2, RAM, 0x0000); |
| 25 | | memory_configure_bank(1, 0, 2, RAM, 0xf800); |
| 24 | memory_configure_bank(machine, 1, 1, 2, RAM, 0x0000); |
| 25 | memory_configure_bank(machine, 1, 0, 2, RAM, 0xf800); |
| 26 | 26 | mikro80_key_mask = 0x7f; |
| 27 | 27 | } |
| 28 | 28 | |
| r3592 | r3593 | |
| 35 | 35 | READ8_HANDLER (mikro80_8255_portb_r ) |
| 36 | 36 | { |
| 37 | 37 | UINT8 key = 0xff; |
| 38 | | if ((mikro80_keyboard_mask & 0x01)!=0) { key &= input_port_read(machine,"LINE0"); } |
| 39 | | if ((mikro80_keyboard_mask & 0x02)!=0) { key &= input_port_read(machine,"LINE1"); } |
| 40 | | if ((mikro80_keyboard_mask & 0x04)!=0) { key &= input_port_read(machine,"LINE2"); } |
| 41 | | if ((mikro80_keyboard_mask & 0x08)!=0) { key &= input_port_read(machine,"LINE3"); } |
| 42 | | if ((mikro80_keyboard_mask & 0x10)!=0) { key &= input_port_read(machine,"LINE4"); } |
| 43 | | if ((mikro80_keyboard_mask & 0x20)!=0) { key &= input_port_read(machine,"LINE5"); } |
| 44 | | if ((mikro80_keyboard_mask & 0x40)!=0) { key &= input_port_read(machine,"LINE6"); } |
| 45 | | if ((mikro80_keyboard_mask & 0x80)!=0) { key &= input_port_read(machine,"LINE7"); } |
| 38 | if ((mikro80_keyboard_mask & 0x01)!=0) { key &= input_port_read(space->machine,"LINE0"); } |
| 39 | if ((mikro80_keyboard_mask & 0x02)!=0) { key &= input_port_read(space->machine,"LINE1"); } |
| 40 | if ((mikro80_keyboard_mask & 0x04)!=0) { key &= input_port_read(space->machine,"LINE2"); } |
| 41 | if ((mikro80_keyboard_mask & 0x08)!=0) { key &= input_port_read(space->machine,"LINE3"); } |
| 42 | if ((mikro80_keyboard_mask & 0x10)!=0) { key &= input_port_read(space->machine,"LINE4"); } |
| 43 | if ((mikro80_keyboard_mask & 0x20)!=0) { key &= input_port_read(space->machine,"LINE5"); } |
| 44 | if ((mikro80_keyboard_mask & 0x40)!=0) { key &= input_port_read(space->machine,"LINE6"); } |
| 45 | if ((mikro80_keyboard_mask & 0x80)!=0) { key &= input_port_read(space->machine,"LINE7"); } |
| 46 | 46 | return key & mikro80_key_mask; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | READ8_HANDLER (mikro80_8255_portc_r ) |
| 50 | 50 | { |
| 51 | | return input_port_read(machine, "LINE8"); |
| 51 | return input_port_read(space->machine, "LINE8"); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | WRITE8_HANDLER (mikro80_8255_porta_w ) |
| r3592 | r3593 | |
| 60 | 60 | { |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | | static READ8_DEVICE_HANDLER( mikro80_8255_portb_device_r ) { return mikro80_8255_portb_r(device->machine, offset); } |
| 64 | | static READ8_DEVICE_HANDLER( mikro80_8255_portc_device_r ) { return mikro80_8255_portc_r(device->machine, offset); } |
| 65 | | static WRITE8_DEVICE_HANDLER( mikro80_8255_porta_device_w ) { mikro80_8255_porta_w(device->machine, offset, data); } |
| 63 | static READ8_DEVICE_HANDLER( mikro80_8255_portb_device_r ) { return mikro80_8255_portb_r(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), offset); } |
| 64 | static READ8_DEVICE_HANDLER( mikro80_8255_portc_device_r ) { return mikro80_8255_portc_r(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), offset); } |
| 65 | static WRITE8_DEVICE_HANDLER( mikro80_8255_porta_device_w ) { mikro80_8255_porta_w(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), offset, data); } |
| 66 | 66 | |
| 67 | 67 | const ppi8255_interface mikro80_ppi8255_interface = |
| 68 | 68 | { |
| r3592 | r3593 | |
| 77 | 77 | |
| 78 | 78 | static TIMER_CALLBACK( mikro80_reset ) |
| 79 | 79 | { |
| 80 | | memory_set_bank(1, 0); |
| 80 | memory_set_bank(machine,1, 0); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | MACHINE_RESET( mikro80 ) |
| 84 | 84 | { |
| 85 | 85 | timer_set(ATTOTIME_IN_USEC(10), NULL, 0, mikro80_reset); |
| 86 | | memory_set_bank(1, 1); |
| 86 | memory_set_bank(machine, 1, 1); |
| 87 | 87 | mikro80_keyboard_mask = 0; |
| 88 | 88 | } |
| 89 | 89 | |
| r3592 | r3593 | |
| 101 | 101 | |
| 102 | 102 | WRITE8_HANDLER( mikro80_tape_w ) |
| 103 | 103 | { |
| 104 | | cassette_output(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ),data & 0x01 ? 1 : -1); |
| 104 | cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ),data & 0x01 ? 1 : -1); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | READ8_HANDLER( mikro80_tape_r ) |
| 109 | 109 | { |
| 110 | | double level = cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" )); |
| 110 | double level = cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )); |
| 111 | 111 | if (level < 0) { |
| 112 | 112 | return 0x00; |
| 113 | 113 | } |
src/mess/machine/ut88.c
| r3592 | r3593 | |
| 22 | 22 | /* set initialy ROM to be visible on first bank */ |
| 23 | 23 | UINT8 *RAM = memory_region(machine, "main"); |
| 24 | 24 | memset(RAM,0x0000,0x0800); // make frist page empty by default |
| 25 | | memory_configure_bank(1, 1, 2, RAM, 0x0000); |
| 26 | | memory_configure_bank(1, 0, 2, RAM, 0xf800); |
| 25 | memory_configure_bank(machine, 1, 1, 2, RAM, 0x0000); |
| 26 | memory_configure_bank(machine, 1, 0, 2, RAM, 0xf800); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | static READ8_DEVICE_HANDLER (ut88_8255_portb_r ) |
| r3592 | r3593 | |
| 62 | 62 | |
| 63 | 63 | static TIMER_CALLBACK( ut88_reset ) |
| 64 | 64 | { |
| 65 | | memory_set_bank(1, 0); |
| 65 | memory_set_bank(machine, 1, 0); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | MACHINE_RESET( ut88 ) |
| 69 | 69 | { |
| 70 | 70 | timer_set(ATTOTIME_IN_USEC(10), NULL, 0, ut88_reset); |
| 71 | | memory_set_bank(1, 1); |
| 71 | memory_set_bank(machine, 1, 1); |
| 72 | 72 | ut88_keyboard_mask = 0; |
| 73 | 73 | } |
| 74 | 74 | |
| r3592 | r3593 | |
| 87 | 87 | WRITE8_HANDLER( ut88_sound_w ) |
| 88 | 88 | { |
| 89 | 89 | dac_data_w(0,data); //beeper |
| 90 | | cassette_output(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ),data & 0x01 ? 1 : -1); |
| 90 | cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ),data & 0x01 ? 1 : -1); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | READ8_HANDLER( ut88_tape_r ) |
| 95 | 95 | { |
| 96 | | double level = cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" )); |
| 96 | double level = cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )); |
| 97 | 97 | if (level < 0) { |
| 98 | 98 | return 0x00; |
| 99 | 99 | } |
| r3592 | r3593 | |
| 103 | 103 | READ8_HANDLER( ut88mini_keyboard_r ) |
| 104 | 104 | { |
| 105 | 105 | // This is real keyboard implementation |
| 106 | | UINT8 *keyrom1 = memory_region(machine, "main")+ 0x10000; |
| 107 | | UINT8 *keyrom2 = memory_region(machine, "main")+ 0x10100; |
| 106 | UINT8 *keyrom1 = memory_region(space->machine, "main")+ 0x10000; |
| 107 | UINT8 *keyrom2 = memory_region(space->machine, "main")+ 0x10100; |
| 108 | 108 | |
| 109 | | UINT8 key = keyrom2[input_port_read(machine, "LINE1")]; |
| 109 | UINT8 key = keyrom2[input_port_read(space->machine, "LINE1")]; |
| 110 | 110 | // if keyboard 2nd part returned 0 on 4th bit output from |
| 111 | 111 | // first part is used |
| 112 | 112 | if ((key & 0x08) ==0x00) { |
| 113 | | key = keyrom1[input_port_read(machine, "LINE0")]; |
| 113 | key = keyrom1[input_port_read(space->machine, "LINE0")]; |
| 114 | 114 | } |
| 115 | 115 | // for delete key there is special key producing code 0x80 |
| 116 | | key = (input_port_read(machine, "LINE2") & 0x80)==0x80 ? key : 0x80; |
| 116 | key = (input_port_read(space->machine, "LINE2") & 0x80)==0x80 ? key : 0x80; |
| 117 | 117 | // If key 0 is pressed it value is 0x10 this is done by additional |
| 118 | 118 | // discrete logic |
| 119 | | key = (input_port_read(machine, "LINE0") & 0x01)==0x01 ? key : 0x10; |
| 119 | key = (input_port_read(space->machine, "LINE0") & 0x01)==0x01 ? key : 0x10; |
| 120 | 120 | return key; |
| 121 | 121 | } |
| 122 | 122 | |