src/mess/osd/windows/menu.c
| r1981 | r1982 | |
| 123 | 123 | // customize_input |
| 124 | 124 | //============================================================ |
| 125 | 125 | |
| 126 | | static void customize_input(HWND wnd, const char *title, artwork_cust_type cust_type, int player, int inputclass, const char *section) |
| 126 | static void customize_input(running_machine *machine, HWND wnd, const char *title, artwork_cust_type cust_type, int player, int inputclass, const char *section) |
| 127 | 127 | { |
| 128 | 128 | dialog_box *dlg; |
| 129 | 129 | input_port_entry *in; |
| r1981 | r1982 | |
| 157 | 157 | win_dialog_add_separator(dlg); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | | in = Machine->input_ports; |
| 160 | in = machine->input_ports; |
| 161 | 161 | while(in->type != IPT_END) |
| 162 | 162 | { |
| 163 | 163 | this_inputclass = input_classify_port(in); |
| r1981 | r1982 | |
| 234 | 234 | // customize_joystick |
| 235 | 235 | //============================================================ |
| 236 | 236 | |
| 237 | | static void customize_joystick(HWND wnd, int joystick_num) |
| 237 | static void customize_joystick(running_machine *machine, HWND wnd, int joystick_num) |
| 238 | 238 | { |
| 239 | | customize_input(wnd, "Joysticks/Controllers", ARTWORK_CUSTTYPE_JOYSTICK, joystick_num, INPUT_CLASS_CONTROLLER, NULL); |
| 239 | customize_input(machine, wnd, "Joysticks/Controllers", ARTWORK_CUSTTYPE_JOYSTICK, joystick_num, INPUT_CLASS_CONTROLLER, NULL); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
| r1981 | r1982 | |
| 245 | 245 | // customize_keyboard |
| 246 | 246 | //============================================================ |
| 247 | 247 | |
| 248 | | static void customize_keyboard(HWND wnd) |
| 248 | static void customize_keyboard(running_machine *machine, HWND wnd) |
| 249 | 249 | { |
| 250 | | customize_input(wnd, "Emulated Keyboard", ARTWORK_CUSTTYPE_KEYBOARD, 0, INPUT_CLASS_KEYBOARD, NULL); |
| 250 | customize_input(machine, wnd, "Emulated Keyboard", ARTWORK_CUSTTYPE_KEYBOARD, 0, INPUT_CLASS_KEYBOARD, NULL); |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
| r1981 | r1982 | |
| 256 | 256 | // customize_miscinput |
| 257 | 257 | //============================================================ |
| 258 | 258 | |
| 259 | | static void customize_miscinput(HWND wnd) |
| 259 | static void customize_miscinput(running_machine *machine, HWND wnd) |
| 260 | 260 | { |
| 261 | | customize_input(wnd, "Miscellaneous Input", ARTWORK_CUSTTYPE_MISC, 0, INPUT_CLASS_MISC, NULL); |
| 261 | customize_input(machine, wnd, "Miscellaneous Input", ARTWORK_CUSTTYPE_MISC, 0, INPUT_CLASS_MISC, NULL); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | |
| r1981 | r1982 | |
| 267 | 267 | // customize_categorizedinput |
| 268 | 268 | //============================================================ |
| 269 | 269 | |
| 270 | | static void customize_categorizedinput(HWND wnd, const char *section, int category) |
| 270 | static void customize_categorizedinput(running_machine *machine, HWND wnd, const char *section, int category) |
| 271 | 271 | { |
| 272 | 272 | assert(category > 0); |
| 273 | | customize_input(wnd, "Input", ARTWORK_CUSTTYPE_JOYSTICK, category, INPUT_CLASS_CATEGORIZED, section); |
| 273 | customize_input(machine, wnd, "Input", ARTWORK_CUSTTYPE_JOYSTICK, category, INPUT_CLASS_CATEGORIZED, section); |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | |
| r1981 | r1982 | |
| 291 | 291 | // customize_switches |
| 292 | 292 | //============================================================ |
| 293 | 293 | |
| 294 | | static void customize_switches(HWND wnd, int title_string_num, UINT32 ipt_name, UINT32 ipt_setting) |
| 294 | static void customize_switches(running_machine *machine, HWND wnd, int title_string_num, UINT32 ipt_name, UINT32 ipt_setting) |
| 295 | 295 | { |
| 296 | 296 | dialog_box *dlg; |
| 297 | 297 | input_port_entry *in; |
| r1981 | r1982 | |
| 302 | 302 | if (!dlg) |
| 303 | 303 | goto done; |
| 304 | 304 | |
| 305 | | for (in = Machine->input_ports; in->type != IPT_END; in++) |
| 305 | for (in = machine->input_ports; in->type != IPT_END; in++) |
| 306 | 306 | { |
| 307 | 307 | type = in->type; |
| 308 | 308 | |
| r1981 | r1982 | |
| 345 | 345 | // customize_dipswitches |
| 346 | 346 | //============================================================ |
| 347 | 347 | |
| 348 | | static void customize_dipswitches(HWND wnd) |
| 348 | static void customize_dipswitches(running_machine *machine, HWND wnd) |
| 349 | 349 | { |
| 350 | | customize_switches(wnd, UI_dipswitches, IPT_DIPSWITCH_NAME, IPT_DIPSWITCH_SETTING); |
| 350 | customize_switches(machine, wnd, UI_dipswitches, IPT_DIPSWITCH_NAME, IPT_DIPSWITCH_SETTING); |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | |
| r1981 | r1982 | |
| 356 | 356 | // customize_configuration |
| 357 | 357 | //============================================================ |
| 358 | 358 | |
| 359 | | static void customize_configuration(HWND wnd) |
| 359 | static void customize_configuration(running_machine *machine, HWND wnd) |
| 360 | 360 | { |
| 361 | | customize_switches(wnd, UI_configuration, IPT_CONFIG_NAME, IPT_CONFIG_SETTING); |
| 361 | customize_switches(machine, wnd, UI_configuration, IPT_CONFIG_NAME, IPT_CONFIG_SETTING); |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | |
| r1981 | r1982 | |
| 395 | 395 | |
| 396 | 396 | |
| 397 | 397 | |
| 398 | | static void customize_analogcontrols(HWND wnd) |
| 398 | static void customize_analogcontrols(running_machine *machine, HWND wnd) |
| 399 | 399 | { |
| 400 | 400 | dialog_box *dlg; |
| 401 | 401 | input_port_entry *in; |
| r1981 | r1982 | |
| 407 | 407 | if (!dlg) |
| 408 | 408 | goto done; |
| 409 | 409 | |
| 410 | | in = Machine->input_ports; |
| 410 | in = machine->input_ports; |
| 411 | 411 | |
| 412 | 412 | while (in->type != IPT_END) |
| 413 | 413 | { |
| r1981 | r1982 | |
| 1091 | 1091 | // setup_joystick_menu |
| 1092 | 1092 | //============================================================ |
| 1093 | 1093 | |
| 1094 | | static void setup_joystick_menu(HMENU menu_bar) |
| 1094 | static void setup_joystick_menu(running_machine *machine, HMENU menu_bar) |
| 1095 | 1095 | { |
| 1096 | 1096 | int joystick_count = 0; |
| 1097 | 1097 | HMENU joystick_menu; |
| r1981 | r1982 | |
| 1102 | 1102 | char buf[256]; |
| 1103 | 1103 | int child_count = 0; |
| 1104 | 1104 | |
| 1105 | | in = Machine->input_ports; |
| 1105 | in = machine->input_ports; |
| 1106 | 1106 | use_input_categories = 0; |
| 1107 | 1107 | while(in->type != IPT_END) |
| 1108 | 1108 | { |
| r1981 | r1982 | |
| 1121 | 1121 | if (use_input_categories) |
| 1122 | 1122 | { |
| 1123 | 1123 | // using input categories |
| 1124 | | for (i = 0; Machine->input_ports[i].type != IPT_END; i++) |
| 1124 | for (i = 0; machine->input_ports[i].type != IPT_END; i++) |
| 1125 | 1125 | { |
| 1126 | | in = &Machine->input_ports[i]; |
| 1126 | in = &machine->input_ports[i]; |
| 1127 | 1127 | if ((in->type) == IPT_CATEGORY_NAME) |
| 1128 | 1128 | { |
| 1129 | 1129 | submenu = CreateMenu(); |
| r1981 | r1982 | |
| 1131 | 1131 | return; |
| 1132 | 1132 | |
| 1133 | 1133 | // append all of the category settings |
| 1134 | | for (j = i + 1; (Machine->input_ports[j].type) == IPT_CATEGORY_SETTING; j++) |
| 1134 | for (j = i + 1; (machine->input_ports[j].type) == IPT_CATEGORY_SETTING; j++) |
| 1135 | 1135 | { |
| 1136 | | in_setting = &Machine->input_ports[j]; |
| 1136 | in_setting = &machine->input_ports[j]; |
| 1137 | 1137 | append_menu_utf8(submenu, MF_STRING, ID_INPUT_0 + j, in_setting->name); |
| 1138 | 1138 | } |
| 1139 | 1139 | |
| r1981 | r1982 | |
| 1203 | 1203 | // prepare_menus |
| 1204 | 1204 | //============================================================ |
| 1205 | 1205 | |
| 1206 | | static void prepare_menus(HWND wnd) |
| 1206 | static void prepare_menus(running_machine *machine, HWND wnd) |
| 1207 | 1207 | { |
| 1208 | 1208 | int i; |
| 1209 | 1209 | const struct IODevice *dev; |
| r1981 | r1982 | |
| 1236 | 1236 | |
| 1237 | 1237 | if (!joystick_menu_setup) |
| 1238 | 1238 | { |
| 1239 | | setup_joystick_menu(menu_bar); |
| 1239 | setup_joystick_menu(machine, menu_bar); |
| 1240 | 1240 | joystick_menu_setup = 1; |
| 1241 | 1241 | } |
| 1242 | 1242 | |
| r1981 | r1982 | |
| 1252 | 1252 | has_misc = input_has_input_class(INPUT_CLASS_MISC); |
| 1253 | 1253 | |
| 1254 | 1254 | has_analog = 0; |
| 1255 | | for (in = Machine->input_ports; in->type != IPT_END; in++) |
| 1255 | for (in = machine->input_ports; in->type != IPT_END; in++) |
| 1256 | 1256 | { |
| 1257 | 1257 | if (port_type_is_analog(in->type)) |
| 1258 | 1258 | { |
| r1981 | r1982 | |
| 1305 | 1305 | // if we are using categorized input, we need to properly checkmark the categories |
| 1306 | 1306 | if (use_input_categories) |
| 1307 | 1307 | { |
| 1308 | | for (i = 0; Machine->input_ports[i].type != IPT_END; i++) |
| 1308 | for (i = 0; machine->input_ports[i].type != IPT_END; i++) |
| 1309 | 1309 | { |
| 1310 | | in = &Machine->input_ports[i]; |
| 1310 | in = &machine->input_ports[i]; |
| 1311 | 1311 | switch(in->type) { |
| 1312 | 1312 | case IPT_CATEGORY_NAME: |
| 1313 | 1313 | in_cat_value = in->default_value; |
| r1981 | r1982 | |
| 1345 | 1345 | remove_menu_items(device_menu); |
| 1346 | 1346 | |
| 1347 | 1347 | // then set up the actual devices |
| 1348 | | for (dev = Machine->devices; dev->type < IO_COUNT; dev++) |
| 1348 | for (dev = machine->devices; dev->type < IO_COUNT; dev++) |
| 1349 | 1349 | { |
| 1350 | 1350 | for (i = 0; i < dev->count; i++) |
| 1351 | 1351 | { |
| r1981 | r1982 | |
| 1586 | 1586 | // help_about_thissystem |
| 1587 | 1587 | //============================================================ |
| 1588 | 1588 | |
| 1589 | | static void help_about_thissystem(HWND wnd) |
| 1589 | static void help_about_thissystem(running_machine *machine, HWND wnd) |
| 1590 | 1590 | { |
| 1591 | 1591 | char buf[256]; |
| 1592 | | snprintf(buf, sizeof(buf) / sizeof(buf[0]), "mess.chm::/sysinfo/%s.htm", Machine->gamedrv->name); |
| 1592 | snprintf(buf, sizeof(buf) / sizeof(buf[0]), "mess.chm::/sysinfo/%s.htm", machine->gamedrv->name); |
| 1593 | 1593 | help_display(wnd, buf); |
| 1594 | 1594 | } |
| 1595 | 1595 | |
| r1981 | r1982 | |
| 1645 | 1645 | // invoke_command |
| 1646 | 1646 | //============================================================ |
| 1647 | 1647 | |
| 1648 | | static int invoke_command(HWND wnd, UINT command) |
| 1648 | static int invoke_command(running_machine *machine, HWND wnd, UINT command) |
| 1649 | 1649 | { |
| 1650 | 1650 | int handled = 1; |
| 1651 | 1651 | int dev_command, i; |
| r1981 | r1982 | |
| 1664 | 1664 | switch(command) |
| 1665 | 1665 | { |
| 1666 | 1666 | case ID_FILE_LOADSTATE: |
| 1667 | | state_load(wnd, Machine); |
| 1667 | state_load(wnd, machine); |
| 1668 | 1668 | break; |
| 1669 | 1669 | |
| 1670 | 1670 | case ID_FILE_SAVESTATE: |
| 1671 | | state_save(Machine); |
| 1671 | state_save(machine); |
| 1672 | 1672 | break; |
| 1673 | 1673 | |
| 1674 | 1674 | case ID_FILE_SAVESTATE_AS: |
| 1675 | | state_save_as(wnd, Machine); |
| 1675 | state_save_as(wnd, machine); |
| 1676 | 1676 | break; |
| 1677 | 1677 | |
| 1678 | 1678 | case ID_FILE_SAVESCREENSHOT: |
| 1679 | | video_save_active_screen_snapshots(Machine); |
| 1679 | video_save_active_screen_snapshots(machine); |
| 1680 | 1680 | break; |
| 1681 | 1681 | |
| 1682 | 1682 | case ID_FILE_EXIT: |
| 1683 | | mame_schedule_exit(Machine); |
| 1683 | mame_schedule_exit(machine); |
| 1684 | 1684 | break; |
| 1685 | 1685 | |
| 1686 | 1686 | case ID_EDIT_PASTE: |
| r1981 | r1982 | |
| 1696 | 1696 | break; |
| 1697 | 1697 | |
| 1698 | 1698 | case ID_KEYBOARD_CUSTOMIZE: |
| 1699 | | customize_keyboard(wnd); |
| 1699 | customize_keyboard(machine, wnd); |
| 1700 | 1700 | break; |
| 1701 | 1701 | |
| 1702 | 1702 | case ID_VIDEO_ROTATE_0: |
| r1981 | r1982 | |
| 1716 | 1716 | break; |
| 1717 | 1717 | |
| 1718 | 1718 | case ID_OPTIONS_PAUSE: |
| 1719 | | pause(Machine); |
| 1719 | pause(machine); |
| 1720 | 1720 | break; |
| 1721 | 1721 | |
| 1722 | 1722 | case ID_OPTIONS_HARDRESET: |
| 1723 | | mame_schedule_hard_reset(Machine); |
| 1723 | mame_schedule_hard_reset(machine); |
| 1724 | 1724 | break; |
| 1725 | 1725 | |
| 1726 | 1726 | case ID_OPTIONS_SOFTRESET: |
| 1727 | | mame_schedule_soft_reset(Machine); |
| 1727 | mame_schedule_soft_reset(machine); |
| 1728 | 1728 | break; |
| 1729 | 1729 | |
| 1730 | 1730 | #if HAS_PROFILER |
| r1981 | r1982 | |
| 1740 | 1740 | #endif // HAS_DEBUGGER |
| 1741 | 1741 | |
| 1742 | 1742 | case ID_OPTIONS_CONFIGURATION: |
| 1743 | | customize_configuration(wnd); |
| 1743 | customize_configuration(machine, wnd); |
| 1744 | 1744 | break; |
| 1745 | 1745 | |
| 1746 | 1746 | case ID_OPTIONS_DIPSWITCHES: |
| 1747 | | customize_dipswitches(wnd); |
| 1747 | customize_dipswitches(machine, wnd); |
| 1748 | 1748 | break; |
| 1749 | 1749 | |
| 1750 | 1750 | case ID_OPTIONS_MISCINPUT: |
| 1751 | | customize_miscinput(wnd); |
| 1751 | customize_miscinput(machine, wnd); |
| 1752 | 1752 | break; |
| 1753 | 1753 | |
| 1754 | 1754 | case ID_OPTIONS_ANALOGCONTROLS: |
| 1755 | | customize_analogcontrols(wnd); |
| 1755 | customize_analogcontrols(machine, wnd); |
| 1756 | 1756 | break; |
| 1757 | 1757 | |
| 1758 | 1758 | #if HAS_TOGGLEFULLSCREEN |
| r1981 | r1982 | |
| 1788 | 1788 | break; |
| 1789 | 1789 | |
| 1790 | 1790 | case ID_HELP_ABOUTSYSTEM: |
| 1791 | | help_about_thissystem(wnd); |
| 1791 | help_about_thissystem(machine, wnd); |
| 1792 | 1792 | break; |
| 1793 | 1793 | |
| 1794 | 1794 | case ID_THROTTLE_50: |
| r1981 | r1982 | |
| 1819 | 1819 | // quickly come up with a port count, so we can upper bound commands |
| 1820 | 1820 | // near ID_INPUT_0 |
| 1821 | 1821 | port_count = 0; |
| 1822 | | while(Machine->input_ports[port_count].type != IPT_END) |
| 1822 | while(machine->input_ports[port_count].type != IPT_END) |
| 1823 | 1823 | port_count++; |
| 1824 | 1824 | |
| 1825 | 1825 | if ((command >= ID_FRAMESKIP_0) && (command < ID_FRAMESKIP_0 + frameskip_level_count())) |
| r1981 | r1982 | |
| 1836 | 1836 | else if ((command >= ID_JOYSTICK_0) && (command < ID_JOYSTICK_0 + MAX_JOYSTICKS)) |
| 1837 | 1837 | { |
| 1838 | 1838 | // customize joystick |
| 1839 | | customize_joystick(wnd, command - ID_JOYSTICK_0); |
| 1839 | customize_joystick(machine, wnd, command - ID_JOYSTICK_0); |
| 1840 | 1840 | } |
| 1841 | 1841 | else if ((command >= ID_VIDEO_VIEW_0) && (command < ID_VIDEO_VIEW_0 + 1000)) |
| 1842 | 1842 | { |
| r1981 | r1982 | |
| 1846 | 1846 | else if ((command >= ID_INPUT_0) && (command < ID_INPUT_0 + port_count)) |
| 1847 | 1847 | { |
| 1848 | 1848 | // customize categorized input |
| 1849 | | in = &Machine->input_ports[command - ID_INPUT_0]; |
| 1849 | in = &machine->input_ports[command - ID_INPUT_0]; |
| 1850 | 1850 | switch(in->type) { |
| 1851 | 1851 | case IPT_CATEGORY_NAME: |
| 1852 | 1852 | // customize the input type |
| r1981 | r1982 | |
| 1860 | 1860 | section = in[i].name; |
| 1861 | 1861 | } |
| 1862 | 1862 | } |
| 1863 | | customize_categorizedinput(wnd, section, category); |
| 1863 | customize_categorizedinput(machine, wnd, section, category); |
| 1864 | 1864 | break; |
| 1865 | 1865 | |
| 1866 | 1866 | case IPT_CATEGORY_SETTING: |
| r1981 | r1982 | |
| 1923 | 1923 | // win_setup_menus |
| 1924 | 1924 | //============================================================ |
| 1925 | 1925 | |
| 1926 | | int win_setup_menus(HMODULE module, HMENU menu_bar) |
| 1926 | int win_setup_menus(running_machine *machine, HMODULE module, HMENU menu_bar) |
| 1927 | 1927 | { |
| 1928 | 1928 | HMENU frameskip_menu; |
| 1929 | 1929 | char buf[256]; |
| r1981 | r1982 | |
| 1958 | 1958 | DeleteMenu(menu_bar, ID_OPTIONS_PROFILER, MF_BYCOMMAND); |
| 1959 | 1959 | #endif |
| 1960 | 1960 | |
| 1961 | | if (!HAS_DEBUGGER || !Machine->debug_mode) |
| 1961 | if (!HAS_DEBUGGER || !machine->debug_mode) |
| 1962 | 1962 | DeleteMenu(menu_bar, ID_OPTIONS_DEBUGGER, MF_BYCOMMAND); |
| 1963 | 1963 | |
| 1964 | 1964 | #if !HAS_TOGGLEFULLSCREEN |
| r1981 | r1982 | |
| 1980 | 1980 | } |
| 1981 | 1981 | |
| 1982 | 1982 | // set the help menu to refer to this machine |
| 1983 | | snprintf(buf, sizeof(buf) / sizeof(buf[0]), "About %s (%s)...", Machine->gamedrv->description, Machine->gamedrv->name); |
| 1983 | snprintf(buf, sizeof(buf) / sizeof(buf[0]), "About %s (%s)...", machine->gamedrv->description, machine->gamedrv->name); |
| 1984 | 1984 | set_menu_text(menu_bar, ID_HELP_ABOUTSYSTEM, buf); |
| 1985 | 1985 | return 0; |
| 1986 | 1986 | } |
| r1981 | r1982 | |
| 2015 | 2015 | // win_create_menu |
| 2016 | 2016 | //============================================================ |
| 2017 | 2017 | |
| 2018 | | #ifndef UNDER_CE |
| 2019 | | int win_create_menu(HMENU *menus) |
| 2018 | #ifdef HAS_WINDOW_MENU |
| 2019 | int win_create_menu(running_machine *machine, HMENU *menus) |
| 2020 | 2020 | { |
| 2021 | 2021 | HMENU menu_bar = NULL; |
| 2022 | 2022 | HMODULE module; |
| r1981 | r1982 | |
| 2031 | 2031 | if (!menu_bar) |
| 2032 | 2032 | goto error; |
| 2033 | 2033 | |
| 2034 | | if (win_setup_menus(module, menu_bar)) |
| 2034 | if (win_setup_menus(machine, module, menu_bar)) |
| 2035 | 2035 | goto error; |
| 2036 | 2036 | } |
| 2037 | 2037 | |
| r1981 | r1982 | |
| 2043 | 2043 | DestroyMenu(menu_bar); |
| 2044 | 2044 | return 1; |
| 2045 | 2045 | } |
| 2046 | | #endif /* UNDER_CE */ |
| 2046 | #endif /* HAS_WINDOW_MENU */ |
| 2047 | 2047 | |
| 2048 | 2048 | |
| 2049 | 2049 | |
| r1981 | r1982 | |
| 2123 | 2123 | switch(message) |
| 2124 | 2124 | { |
| 2125 | 2125 | case WM_INITMENU: |
| 2126 | | prepare_menus(wnd); |
| 2126 | prepare_menus(Machine, wnd); |
| 2127 | 2127 | break; |
| 2128 | 2128 | |
| 2129 | 2129 | case WM_CHAR: |
| r1981 | r1982 | |
| 2132 | 2132 | break; |
| 2133 | 2133 | |
| 2134 | 2134 | case WM_COMMAND: |
| 2135 | | if (invoke_command(wnd, wparam)) |
| 2135 | if (invoke_command(Machine, wnd, wparam)) |
| 2136 | 2136 | break; |
| 2137 | 2137 | /* fall through */ |
| 2138 | 2138 | |
src/mess/drivers/nc.c
| r1981 | r1982 | |
| 295 | 295 | static int nc_irq_latch_mask; |
| 296 | 296 | static int nc_sound_channel_periods[2]; |
| 297 | 297 | |
| 298 | | static void nc_update_interrupts(void) |
| 298 | static void nc_update_interrupts(running_machine *machine) |
| 299 | 299 | { |
| 300 | 300 | nc_irq_status &= ~nc_irq_latch_mask; |
| 301 | 301 | nc_irq_status |= nc_irq_latch; |
| r1981 | r1982 | |
| 307 | 307 | { |
| 308 | 308 | logerror("int set %02x\n",nc_irq_status & nc_irq_mask); |
| 309 | 309 | /* set int */ |
| 310 | | cpunum_set_input_line(Machine, 0, 0, HOLD_LINE); |
| 310 | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| 311 | 311 | } |
| 312 | 312 | else |
| 313 | 313 | { |
| 314 | 314 | /* clear int */ |
| 315 | | cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE); |
| 315 | cpunum_set_input_line(machine, 0, 0, CLEAR_LINE); |
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | |
| r1981 | r1982 | |
| 324 | 324 | nc_irq_status |= (1<<3); |
| 325 | 325 | |
| 326 | 326 | /* update ints */ |
| 327 | | nc_update_interrupts(); |
| 327 | nc_update_interrupts(machine); |
| 328 | 328 | |
| 329 | 329 | /* don't trigger again, but don't free it */ |
| 330 | 330 | timer_reset(nc_keyboard_timer, attotime_never); |
| r1981 | r1982 | |
| 483 | 483 | mame_fwrite(file, mess_ram, mess_ram_size); |
| 484 | 484 | } |
| 485 | 485 | |
| 486 | | static void nc_common_open_stream_for_reading(void) |
| 486 | static void nc_common_open_stream_for_reading(running_machine *machine) |
| 487 | 487 | { |
| 488 | 488 | char filename[MAX_DRIVER_NAME_CHARS + 5]; |
| 489 | 489 | |
| 490 | | sprintf(filename,"%s.nv", Machine->gamedrv->name); |
| 490 | sprintf(filename,"%s.nv", machine->gamedrv->name); |
| 491 | 491 | |
| 492 | 492 | mame_fopen(SEARCHPATH_MEMCARD, filename, OPEN_FLAG_READ, &file); |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | | static void nc_common_open_stream_for_writing(void) |
| 495 | static void nc_common_open_stream_for_writing(running_machine *machine) |
| 496 | 496 | { |
| 497 | 497 | char filename[MAX_DRIVER_NAME_CHARS + 5]; |
| 498 | 498 | |
| 499 | | sprintf(filename,"%s.nv", Machine->gamedrv->name); |
| 499 | sprintf(filename,"%s.nv", machine->gamedrv->name); |
| 500 | 500 | |
| 501 | 501 | mame_fopen(SEARCHPATH_MEMCARD, filename, OPEN_FLAG_WRITE, &file); |
| 502 | 502 | } |
| r1981 | r1982 | |
| 540 | 540 | case NC_TYPE_200: |
| 541 | 541 | { |
| 542 | 542 | nc_irq_status |=(1<<4); |
| 543 | | nc_update_interrupts(); |
| 543 | nc_update_interrupts(machine); |
| 544 | 544 | } |
| 545 | 545 | break; |
| 546 | 546 | } |
| r1981 | r1982 | |
| 559 | 559 | |
| 560 | 560 | static TIMER_CALLBACK(nc_serial_timer_callback); |
| 561 | 561 | |
| 562 | | static void nc_common_init_machine(void) |
| 562 | static void nc_common_init_machine(running_machine *machine) |
| 563 | 563 | { |
| 564 | 564 | /* setup reset state */ |
| 565 | 565 | nc_display_memory_start = 0; |
| r1981 | r1982 | |
| 588 | 588 | nc_poweroff_control = 1; |
| 589 | 589 | |
| 590 | 590 | nc_refresh_memory_config(); |
| 591 | | nc_update_interrupts(); |
| 591 | nc_update_interrupts(machine); |
| 592 | 592 | |
| 593 | 593 | /* keyboard timer */ |
| 594 | 594 | nc_keyboard_timer = timer_alloc(nc_keyboard_timer_callback, NULL); |
| r1981 | r1982 | |
| 633 | 633 | /* writing mask clears ints that are to be masked? */ |
| 634 | 634 | nc_irq_mask = data; |
| 635 | 635 | |
| 636 | | nc_update_interrupts(); |
| 636 | nc_update_interrupts(machine); |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | static WRITE8_HANDLER(nc_irq_status_w) |
| r1981 | r1982 | |
| 650 | 650 | /* set timer to occur again */ |
| 651 | 651 | timer_reset(nc_keyboard_timer, ATTOTIME_IN_MSEC(10)); |
| 652 | 652 | |
| 653 | | nc_update_interrupts(); |
| 653 | nc_update_interrupts(machine); |
| 654 | 654 | } |
| 655 | 655 | } |
| 656 | 656 | |
| r1981 | r1982 | |
| 670 | 670 | #endif |
| 671 | 671 | nc_irq_status &=~data; |
| 672 | 672 | |
| 673 | | nc_update_interrupts(); |
| 673 | nc_update_interrupts(machine); |
| 674 | 674 | } |
| 675 | 675 | |
| 676 | | static READ8_HANDLER(nc_irq_status_r) |
| 676 | static READ8_HANDLER(nc_irq_status_r) |
| 677 | 677 | { |
| 678 | 678 | return ~((nc_irq_status & (~nc_irq_latch_mask)) | nc_irq_latch); |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | |
| 682 | | static READ8_HANDLER(nc_key_data_in_r) |
| 682 | static READ8_HANDLER(nc_key_data_in_r) |
| 683 | 683 | { |
| 684 | 684 | if (offset==9) |
| 685 | 685 | { |
| r1981 | r1982 | |
| 689 | 689 | /* set timer to occur again */ |
| 690 | 690 | timer_reset(nc_keyboard_timer, ATTOTIME_IN_MSEC(10)); |
| 691 | 691 | |
| 692 | | nc_update_interrupts(); |
| 692 | nc_update_interrupts(machine); |
| 693 | 693 | } |
| 694 | 694 | return readinputport(offset); |
| 695 | 695 | } |
| r1981 | r1982 | |
| 855 | 855 | // { |
| 856 | 856 | // /* clear latched irq's */ |
| 857 | 857 | // nc_irq_latch &= ~3; |
| 858 | | // nc_update_interrupts(); |
| 858 | // nc_update_interrupts(machine); |
| 859 | 859 | // } |
| 860 | 860 | } |
| 861 | 861 | |
| r1981 | r1982 | |
| 895 | 895 | } |
| 896 | 896 | } |
| 897 | 897 | |
| 898 | | nc_update_interrupts(); |
| 898 | nc_update_interrupts(Machine); |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | 901 | static void nc100_rxrdy_callback(int state) |
| r1981 | r1982 | |
| 911 | 911 | } |
| 912 | 912 | } |
| 913 | 913 | |
| 914 | | nc_update_interrupts(); |
| 914 | nc_update_interrupts(Machine); |
| 915 | 915 | } |
| 916 | 916 | |
| 917 | 917 | |
| r1981 | r1982 | |
| 939 | 939 | } |
| 940 | 940 | } |
| 941 | 941 | /* trigger an int if the irq is set */ |
| 942 | | nc_update_interrupts(); |
| 942 | nc_update_interrupts(Machine); |
| 943 | 943 | } |
| 944 | 944 | |
| 945 | 945 | static const CENTRONICS_CONFIG nc100_cent_config[1]={ |
| r1981 | r1982 | |
| 958 | 958 | |
| 959 | 959 | nc_membank_card_ram_mask = 0x03f; |
| 960 | 960 | |
| 961 | | nc_common_init_machine(); |
| 961 | nc_common_init_machine(machine); |
| 962 | 962 | |
| 963 | 963 | tc8521_init(&nc100_tc8521_interface); |
| 964 | 964 | |
| r1981 | r1982 | |
| 968 | 968 | /* assumption: select is tied low */ |
| 969 | 969 | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 970 | 970 | |
| 971 | | nc_common_open_stream_for_reading(); |
| 971 | nc_common_open_stream_for_reading(machine); |
| 972 | 972 | tc8521_load_stream(file); |
| 973 | 973 | |
| 974 | 974 | nc_common_restore_memory_from_stream(); |
| r1981 | r1982 | |
| 981 | 981 | |
| 982 | 982 | static void nc100_machine_stop(running_machine *machine) |
| 983 | 983 | { |
| 984 | | nc_common_open_stream_for_writing(); |
| 984 | nc_common_open_stream_for_writing(machine); |
| 985 | 985 | tc8521_save_stream(file); |
| 986 | 986 | nc_common_store_memory_to_stream(); |
| 987 | 987 | nc_common_close_stream(); |
| r1981 | r1982 | |
| 1205 | 1205 | |
| 1206 | 1206 | nc_membank_card_ram_mask = 0x03f; |
| 1207 | 1207 | |
| 1208 | | nc_common_init_machine(); |
| 1208 | nc_common_init_machine(Machine); |
| 1209 | 1209 | } |
| 1210 | 1210 | #endif |
| 1211 | 1211 | |
| r1981 | r1982 | |
| 1239 | 1239 | } |
| 1240 | 1240 | } |
| 1241 | 1241 | /* trigger an int if the irq is set */ |
| 1242 | | nc_update_interrupts(); |
| 1242 | nc_update_interrupts(Machine); |
| 1243 | 1243 | } |
| 1244 | 1244 | |
| 1245 | 1245 | static const CENTRONICS_CONFIG nc200_cent_config[1]={ |
| r1981 | r1982 | |
| 1255 | 1255 | together with a or to generate a single interrupt */ |
| 1256 | 1256 | static UINT8 nc200_uart_interrupt_irq; |
| 1257 | 1257 | |
| 1258 | | static void nc200_refresh_uart_interrupt(void) |
| 1258 | static void nc200_refresh_uart_interrupt(running_machine *machine) |
| 1259 | 1259 | { |
| 1260 | 1260 | nc_irq_latch &=~(1<<2); |
| 1261 | 1261 | |
| r1981 | r1982 | |
| 1267 | 1267 | nc_irq_latch |= (1<<2); |
| 1268 | 1268 | } |
| 1269 | 1269 | } |
| 1270 | | nc_update_interrupts(); |
| 1270 | nc_update_interrupts(machine); |
| 1271 | 1271 | } |
| 1272 | 1272 | |
| 1273 | 1273 | static void nc200_txrdy_callback(int state) |
| r1981 | r1982 | |
| 1279 | 1279 | // nc200_uart_interrupt_irq |=(1<<0); |
| 1280 | 1280 | // } |
| 1281 | 1281 | // |
| 1282 | | // nc200_refresh_uart_interrupt(); |
| 1282 | // nc200_refresh_uart_interrupt(Machine); |
| 1283 | 1283 | } |
| 1284 | 1284 | |
| 1285 | 1285 | static void nc200_rxrdy_callback(int state) |
| r1981 | r1982 | |
| 1291 | 1291 | nc200_uart_interrupt_irq |=(1<<1); |
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | | nc200_refresh_uart_interrupt(); |
| 1294 | nc200_refresh_uart_interrupt(Machine); |
| 1295 | 1295 | } |
| 1296 | 1296 | |
| 1297 | 1297 | static const struct msm8251_interface nc200_uart_interface= |
| r1981 | r1982 | |
| 1319 | 1319 | nc_irq_status |=(1<<5); |
| 1320 | 1320 | } |
| 1321 | 1321 | |
| 1322 | | nc_update_interrupts(); |
| 1322 | nc_update_interrupts(Machine); |
| 1323 | 1323 | } |
| 1324 | 1324 | |
| 1325 | 1325 | static const struct nec765_interface nc200_nec765_interface= |
| r1981 | r1982 | |
| 1334 | 1334 | LOG_DEBUG(("nc200 index pulse\n")); |
| 1335 | 1335 | // nc_irq_status |= (1<<4); |
| 1336 | 1336 | |
| 1337 | | // nc_update_interrupts(); |
| 1337 | // nc_update_interrupts(Machine); |
| 1338 | 1338 | } |
| 1339 | 1339 | #endif |
| 1340 | 1340 | |
| r1981 | r1982 | |
| 1347 | 1347 | |
| 1348 | 1348 | nc_membank_card_ram_mask = 0x03f; |
| 1349 | 1349 | |
| 1350 | | nc_common_init_machine(); |
| 1350 | nc_common_init_machine(machine); |
| 1351 | 1351 | |
| 1352 | 1352 | nec765_init(&nc200_nec765_interface, NEC765A); |
| 1353 | 1353 | /* double sided, 80 track drive */ |
| r1981 | r1982 | |
| 1363 | 1363 | /* assumption: select is tied low */ |
| 1364 | 1364 | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 1365 | 1365 | |
| 1366 | | nc_common_open_stream_for_reading(); |
| 1366 | nc_common_open_stream_for_reading(machine); |
| 1367 | 1367 | if (file) |
| 1368 | 1368 | { |
| 1369 | 1369 | mc146818_load_stream(file); |
| r1981 | r1982 | |
| 1379 | 1379 | |
| 1380 | 1380 | static void nc200_machine_stop(running_machine *machine) |
| 1381 | 1381 | { |
| 1382 | | nc_common_open_stream_for_writing(); |
| 1382 | nc_common_open_stream_for_writing(machine); |
| 1383 | 1383 | if (file) |
| 1384 | 1384 | { |
| 1385 | 1385 | mc146818_save_stream(file); |
| r1981 | r1982 | |
| 1478 | 1478 | { |
| 1479 | 1479 | nc200_uart_interrupt_irq &=~3; |
| 1480 | 1480 | |
| 1481 | | nc200_refresh_uart_interrupt(); |
| 1481 | nc200_refresh_uart_interrupt(machine); |
| 1482 | 1482 | } |
| 1483 | 1483 | |
| 1484 | 1484 | /* bit 5 is used in disk interface */ |
src/mess/drivers/pcw16.c
| r1981 | r1982 | |
| 128 | 128 | static int pcw16_system_status; |
| 129 | 129 | |
| 130 | 130 | // debugging - write ram as seen by cpu |
| 131 | | static void pcw16_refresh_ints(void) |
| 131 | static void pcw16_refresh_ints(running_machine *machine) |
| 132 | 132 | { |
| 133 | 133 | /* any bits set excluding vsync */ |
| 134 | 134 | if ((pcw16_system_status & (~0x04))!=0) |
| 135 | 135 | { |
| 136 | | cpunum_set_input_line(Machine, 0, 0, HOLD_LINE); |
| 136 | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| 137 | 137 | } |
| 138 | 138 | else |
| 139 | 139 | { |
| 140 | | cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE); |
| 140 | cpunum_set_input_line(machine, 0, 0, CLEAR_LINE); |
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | |
| r1981 | r1982 | |
| 154 | 154 | |
| 155 | 155 | if (pcw16_interrupt_counter!=0) |
| 156 | 156 | { |
| 157 | | pcw16_refresh_ints(); |
| 157 | pcw16_refresh_ints(machine); |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
| r1981 | r1982 | |
| 551 | 551 | static int pcw16_keyboard_state = 0; |
| 552 | 552 | static int pcw16_keyboard_previous_state=0; |
| 553 | 553 | static void pcw16_keyboard_reset(void); |
| 554 | | static void pcw16_keyboard_int(int); |
| 554 | static void pcw16_keyboard_int(running_machine *, int); |
| 555 | 555 | |
| 556 | | static void pcw16_keyboard_init(void) |
| 556 | static void pcw16_keyboard_init(running_machine *machine) |
| 557 | 557 | { |
| 558 | 558 | int i; |
| 559 | 559 | int b; |
| r1981 | r1982 | |
| 580 | 580 | |
| 581 | 581 | |
| 582 | 582 | /* clear int */ |
| 583 | | pcw16_keyboard_int(0); |
| 583 | pcw16_keyboard_int(machine, 0); |
| 584 | 584 | /* reset state */ |
| 585 | 585 | pcw16_keyboard_state = 0; |
| 586 | 586 | /* reset ready for transmit */ |
| r1981 | r1982 | |
| 611 | 611 | pcw16_keyboard_refresh_outputs(); |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | | static void pcw16_keyboard_int(int state) |
| 614 | static void pcw16_keyboard_int(running_machine *machine, int state) |
| 615 | 615 | { |
| 616 | 616 | pcw16_system_status &= ~(1<<1); |
| 617 | 617 | |
| r1981 | r1982 | |
| 620 | 620 | pcw16_system_status |= (1<<1); |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | | pcw16_refresh_ints(); |
| 623 | pcw16_refresh_ints(machine); |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | static void pcw16_keyboard_reset(void) |
| r1981 | r1982 | |
| 635 | 635 | //logerror("keyboard data shift r: %02x\n", pcw16_keyboard_data_shift); |
| 636 | 636 | pcw16_keyboard_state &= ~(PCW16_KEYBOARD_BUSY_STATUS); |
| 637 | 637 | |
| 638 | | pcw16_keyboard_int(0); |
| 638 | pcw16_keyboard_int(machine, 0); |
| 639 | 639 | /* reset for reception */ |
| 640 | 640 | pcw16_keyboard_reset(); |
| 641 | 641 | |
| r1981 | r1982 | |
| 659 | 659 | #endif |
| 660 | 660 | |
| 661 | 661 | /* signal a code has been received */ |
| 662 | | static void pcw16_keyboard_signal_byte_received(int data) |
| 662 | static void pcw16_keyboard_signal_byte_received(running_machine *machine, int data) |
| 663 | 663 | { |
| 664 | | |
| 665 | 664 | /* clear clock */ |
| 666 | 665 | pcw16_keyboard_set_clock_state(0); |
| 667 | 666 | |
| r1981 | r1982 | |
| 684 | 683 | if ((pcw16_keyboard_parity_table[data])==0) |
| 685 | 684 | pcw16_keyboard_state |= PCW16_KEYBOARD_PARITY_MASK; |
| 686 | 685 | |
| 687 | | pcw16_keyboard_int(1); |
| 686 | pcw16_keyboard_int(machine, 1); |
| 688 | 687 | } |
| 689 | 688 | |
| 690 | 689 | |
| r1981 | r1982 | |
| 757 | 756 | /* set clock low - no furthur transmissions */ |
| 758 | 757 | pcw16_keyboard_set_clock_state(0); |
| 759 | 758 | /* set int */ |
| 760 | | pcw16_keyboard_int(1); |
| 759 | pcw16_keyboard_int(machine, 1); |
| 761 | 760 | } |
| 762 | 761 | } |
| 763 | 762 | |
| r1981 | r1982 | |
| 770 | 769 | { |
| 771 | 770 | if ((pcw16_system_status & (1<<1))!=0) |
| 772 | 771 | { |
| 773 | | pcw16_keyboard_int(0); |
| 772 | pcw16_keyboard_int(machine, 0); |
| 774 | 773 | } |
| 775 | 774 | } |
| 776 | 775 | } |
| r1981 | r1982 | |
| 795 | 794 | // pcw16_dump_cpu_ram(); |
| 796 | 795 | // } |
| 797 | 796 | |
| 798 | | pcw16_keyboard_signal_byte_received(data); |
| 797 | pcw16_keyboard_signal_byte_received(machine, data); |
| 799 | 798 | } |
| 800 | 799 | } |
| 801 | 800 | } |
| r1981 | r1982 | |
| 991 | 990 | |
| 992 | 991 | static int previous_fdc_int_state; |
| 993 | 992 | |
| 994 | | static void pcw16_trigger_fdc_int(void) |
| 993 | static void pcw16_trigger_fdc_int(running_machine *machine) |
| 995 | 994 | { |
| 996 | 995 | int state; |
| 997 | 996 | |
| r1981 | r1982 | |
| 1014 | 1013 | { |
| 1015 | 1014 | /* I'll pulse it because if I used hold-line I'm not sure |
| 1016 | 1015 | it would clear - to be checked */ |
| 1017 | | cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 1016 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 1018 | 1017 | } |
| 1019 | 1018 | } |
| 1020 | 1019 | } |
| r1981 | r1982 | |
| 1023 | 1022 | /* attach fdc to int */ |
| 1024 | 1023 | case 1: |
| 1025 | 1024 | { |
| 1026 | | pcw16_refresh_ints(); |
| 1025 | pcw16_refresh_ints(machine); |
| 1027 | 1026 | } |
| 1028 | 1027 | break; |
| 1029 | 1028 | |
| r1981 | r1982 | |
| 1035 | 1034 | previous_fdc_int_state = state; |
| 1036 | 1035 | } |
| 1037 | 1036 | |
| 1038 | | static READ8_HANDLER(pcw16_system_status_r) |
| 1037 | static READ8_HANDLER(pcw16_system_status_r) |
| 1039 | 1038 | { |
| 1040 | 1039 | // logerror("system status r: \n"); |
| 1041 | 1040 | |
| 1042 | 1041 | return pcw16_system_status | (readinputport(0) & 0x04); |
| 1043 | 1042 | } |
| 1044 | 1043 | |
| 1045 | | static READ8_HANDLER(pcw16_timer_interrupt_counter_r) |
| 1044 | static READ8_HANDLER(pcw16_timer_interrupt_counter_r) |
| 1046 | 1045 | { |
| 1047 | 1046 | int data; |
| 1048 | 1047 | |
| r1981 | r1982 | |
| 1052 | 1051 | /* clear display int */ |
| 1053 | 1052 | pcw16_system_status &= ~(1<<0); |
| 1054 | 1053 | |
| 1055 | | pcw16_refresh_ints(); |
| 1054 | pcw16_refresh_ints(machine); |
| 1056 | 1055 | |
| 1057 | 1056 | return data; |
| 1058 | 1057 | } |
| r1981 | r1982 | |
| 1202 | 1201 | pcw16_system_status |= (1<<6); |
| 1203 | 1202 | } |
| 1204 | 1203 | |
| 1205 | | pcw16_trigger_fdc_int(); |
| 1204 | pcw16_trigger_fdc_int(Machine); |
| 1206 | 1205 | } |
| 1207 | 1206 | |
| 1208 | 1207 | static const struct pc_fdc_interface pcw16_fdc_interface= |
| r1981 | r1982 | |
| 1222 | 1221 | pcw16_system_status |= (1<<irq[nr]); |
| 1223 | 1222 | } |
| 1224 | 1223 | |
| 1225 | | pcw16_refresh_ints(); |
| 1224 | pcw16_refresh_ints(Machine); |
| 1226 | 1225 | } |
| 1227 | 1226 | |
| 1228 | 1227 | static void pcw16_com_refresh_connected(int serial_port_id) |
| r1981 | r1982 | |
| 1303 | 1302 | ADDRESS_MAP_END |
| 1304 | 1303 | |
| 1305 | 1304 | |
| 1306 | | static void pcw16_reset(void) |
| 1305 | static void pcw16_reset(running_machine *machine) |
| 1307 | 1306 | { |
| 1308 | 1307 | /* initialise defaults */ |
| 1309 | 1308 | pcw16_fdc_int_code = 2; |
| r1981 | r1982 | |
| 1324 | 1323 | rtc_control = 1; |
| 1325 | 1324 | rtc_256ths_seconds = 0; |
| 1326 | 1325 | |
| 1327 | | pcw16_keyboard_init(); |
| 1326 | pcw16_keyboard_init(machine); |
| 1328 | 1327 | uart8250_reset(0); |
| 1329 | 1328 | uart8250_reset(1); |
| 1330 | 1329 | } |
| r1981 | r1982 | |
| 1372 | 1371 | at_keyboard_init(AT_KEYBOARD_TYPE_AT); |
| 1373 | 1372 | at_keyboard_set_scan_code_set(3); |
| 1374 | 1373 | |
| 1375 | | pcw16_reset(); |
| 1374 | pcw16_reset(machine); |
| 1376 | 1375 | |
| 1377 | 1376 | beep_set_state(0,0); |
| 1378 | 1377 | beep_set_frequency(0,3750); |
src/mess/drivers/apexc.c
| r1981 | r1982 | |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | 10 | #include "cpu/apexc/apexc.h" |
| 11 | | #include "deprecat.h" |
| 12 | 11 | |
| 13 | 12 | |
| 14 | | |
| 15 | 13 | static void apexc_teletyper_init(void); |
| 16 | | static void apexc_teletyper_putchar(int character); |
| 14 | static void apexc_teletyper_putchar(running_machine *machine, int character); |
| 17 | 15 | |
| 18 | 16 | |
| 19 | 17 | static MACHINE_START(apexc) |
| r1981 | r1982 | |
| 209 | 207 | if (apexc_tapes[1].fd) |
| 210 | 208 | image_fwrite(apexc_tapes[1].fd, & data5, 1); |
| 211 | 209 | |
| 212 | | apexc_teletyper_putchar(data & 0x1f); /* display on screen */ |
| 210 | apexc_teletyper_putchar(machine, data & 0x1f); /* display on screen */ |
| 213 | 211 | } |
| 214 | 212 | |
| 215 | 213 | /* |
| r1981 | r1982 | |
| 494 | 492 | } |
| 495 | 493 | |
| 496 | 494 | /* draw a small 8*8 LED (well, there were no LEDs at the time, so let's call this a lamp ;-) ) */ |
| 497 | | static void apexc_draw_led(bitmap_t *bitmap, int x, int y, int state) |
| 495 | static void apexc_draw_led(running_machine *machine, bitmap_t *bitmap, int x, int y, int state) |
| 498 | 496 | { |
| 499 | 497 | int xx, yy; |
| 500 | 498 | |
| 501 | 499 | for (yy=1; yy<7; yy++) |
| 502 | 500 | for (xx=1; xx<7; xx++) |
| 503 | | *BITMAP_ADDR16(bitmap, y+yy, x+xx) = Machine->pens[state ? 2 : 3]; |
| 501 | *BITMAP_ADDR16(bitmap, y+yy, x+xx) = machine->pens[state ? 2 : 3]; |
| 504 | 502 | } |
| 505 | 503 | |
| 506 | 504 | /* write a single char on screen */ |
| 507 | | static void apexc_draw_char(bitmap_t *bitmap, char character, int x, int y, int color) |
| 505 | static void apexc_draw_char(running_machine *machine, bitmap_t *bitmap, char character, int x, int y, int color) |
| 508 | 506 | { |
| 509 | | drawgfx(bitmap, Machine->gfx[0], character-32, color, 0, 0, |
| 510 | | x+1, y, &Machine->screen[0].visarea, TRANSPARENCY_PEN, 0); |
| 507 | drawgfx(bitmap, machine->gfx[0], character-32, color, 0, 0, |
| 508 | x+1, y, &machine->screen[0].visarea, TRANSPARENCY_PEN, 0); |
| 511 | 509 | } |
| 512 | 510 | |
| 513 | 511 | /* write a string on screen */ |
| 514 | | static void apexc_draw_string(bitmap_t *bitmap, const char *buf, int x, int y, int color) |
| 512 | static void apexc_draw_string(running_machine *machine, bitmap_t *bitmap, const char *buf, int x, int y, int color) |
| 515 | 513 | { |
| 516 | 514 | while (* buf) |
| 517 | 515 | { |
| 518 | | apexc_draw_char(bitmap, *buf, x, y, color); |
| 516 | apexc_draw_char(machine, bitmap, *buf, x, y, color); |
| 519 | 517 | |
| 520 | 518 | x += 8; |
| 521 | 519 | buf++; |
| r1981 | r1982 | |
| 532 | 530 | /*if (full_refresh)*/ |
| 533 | 531 | { |
| 534 | 532 | fillbitmap(bitmap, machine->pens[0], &/*machine->visible_area*/panel_window); |
| 535 | | apexc_draw_string(bitmap, "power", 8, 0, 0); |
| 536 | | apexc_draw_string(bitmap, "running", 8, 8, 0); |
| 537 | | apexc_draw_string(bitmap, "data :", 0, 24, 0); |
| 533 | apexc_draw_string(machine, bitmap, "power", 8, 0, 0); |
| 534 | apexc_draw_string(machine, bitmap, "running", 8, 8, 0); |
| 535 | apexc_draw_string(machine, bitmap, "data :", 0, 24, 0); |
| 538 | 536 | } |
| 539 | 537 | |
| 540 | 538 | copybitmap(bitmap, apexc_bitmap, 0, 0, 0, 0, &teletyper_window); |
| 541 | 539 | |
| 542 | 540 | |
| 543 | | apexc_draw_led(bitmap, 0, 0, 1); |
| 541 | apexc_draw_led(machine, bitmap, 0, 0, 1); |
| 544 | 542 | |
| 545 | | apexc_draw_led(bitmap, 0, 8, cpunum_get_reg(0, APEXC_STATE)); |
| 543 | apexc_draw_led(machine, bitmap, 0, 8, cpunum_get_reg(0, APEXC_STATE)); |
| 546 | 544 | |
| 547 | 545 | for (i=0; i<32; i++) |
| 548 | 546 | { |
| 549 | | apexc_draw_led(bitmap, i*8, 32, (panel_data_reg << i) & 0x80000000UL); |
| 547 | apexc_draw_led(machine, bitmap, i*8, 32, (panel_data_reg << i) & 0x80000000UL); |
| 550 | 548 | the_char = '0' + ((i + 1) % 10); |
| 551 | | apexc_draw_char(bitmap, the_char, i*8, 40, 0); |
| 549 | apexc_draw_char(machine, bitmap, the_char, i*8, 40, 0); |
| 552 | 550 | if (((i + 1) % 10) == 0) |
| 553 | 551 | { |
| 554 | 552 | the_char = '0' + ((i + 1) / 10); |
| 555 | | apexc_draw_char(bitmap, the_char, i*8, 48, 0); |
| 553 | apexc_draw_char(machine, bitmap, the_char, i*8, 48, 0); |
| 556 | 554 | } |
| 557 | 555 | } |
| 558 | 556 | return 0; |
| r1981 | r1982 | |
| 567 | 565 | pos = 0; |
| 568 | 566 | } |
| 569 | 567 | |
| 570 | | static void apexc_teletyper_linefeed(void) |
| 568 | static void apexc_teletyper_linefeed(running_machine *machine) |
| 571 | 569 | { |
| 572 | 570 | UINT8 buf[teletyper_window_width]; |
| 573 | 571 | int y; |
| r1981 | r1982 | |
| 575 | 573 | for (y=teletyper_window_offset_y; y<teletyper_window_offset_y+teletyper_window_height-teletyper_scroll_step; y++) |
| 576 | 574 | { |
| 577 | 575 | extract_scanline8(apexc_bitmap, teletyper_window_offset_x, y+teletyper_scroll_step, teletyper_window_width, buf); |
| 578 | | draw_scanline8(apexc_bitmap, teletyper_window_offset_x, y, teletyper_window_width, buf, Machine->pens, -1); |
| 576 | draw_scanline8(apexc_bitmap, teletyper_window_offset_x, y, teletyper_window_width, buf, machine->pens, -1); |
| 579 | 577 | } |
| 580 | 578 | |
| 581 | | fillbitmap(apexc_bitmap, Machine->pens[0], &teletyper_scroll_clear_window); |
| 579 | fillbitmap(apexc_bitmap, machine->pens[0], &teletyper_scroll_clear_window); |
| 582 | 580 | } |
| 583 | 581 | |
| 584 | | static void apexc_teletyper_putchar(int character) |
| 582 | static void apexc_teletyper_putchar(running_machine *machine, int character) |
| 585 | 583 | { |
| 586 | 584 | static const char ascii_table[2][32] = |
| 587 | 585 | { |
| r1981 | r1982 | |
| 615 | 613 | { |
| 616 | 614 | case 19: |
| 617 | 615 | /* Line Space */ |
| 618 | | apexc_teletyper_linefeed(); |
| 616 | apexc_teletyper_linefeed(machine); |
| 619 | 617 | break; |
| 620 | 618 | |
| 621 | 619 | case 24: |
| r1981 | r1982 | |
| 638 | 636 | |
| 639 | 637 | if (pos >= 32) |
| 640 | 638 | { /* if past right border, wrap around */ |
| 641 | | apexc_teletyper_linefeed(); /* next line */ |
| 639 | apexc_teletyper_linefeed(machine); /* next line */ |
| 642 | 640 | pos = 0; /* return to start of line */ |
| 643 | 641 | } |
| 644 | 642 | |
| 645 | 643 | /* print character */ |
| 646 | 644 | buffer[0] = ascii_table[letters][character]; /* lookup ASCII equivalent in table */ |
| 647 | 645 | buffer[1] = '\0'; /* terminate string */ |
| 648 | | apexc_draw_string(apexc_bitmap, buffer, 8*pos, 176, 0); /* print char */ |
| 646 | apexc_draw_string(machine, apexc_bitmap, buffer, 8*pos, 176, 0); /* print char */ |
| 649 | 647 | pos++; /* step carriage forward */ |
| 650 | 648 | |
| 651 | 649 | break; |
src/mess/drivers/saturn.c
| r1981 | r1982 | |
| 233 | 233 | scu_size_1, /* lv 1*/ |
| 234 | 234 | scu_size_2; /* lv 2*/ |
| 235 | 235 | |
| 236 | | static void dma_direct_lv0(void); /*DMA level 0 direct transfer function*/ |
| 237 | | static void dma_direct_lv1(void); /*DMA level 1 direct transfer function*/ |
| 238 | | static void dma_direct_lv2(void); /*DMA level 2 direct transfer function*/ |
| 239 | | static void dma_indirect_lv0(void); /*DMA level 0 indirect transfer function*/ |
| 240 | | static void dma_indirect_lv1(void); /*DMA level 1 indirect transfer function*/ |
| 241 | | static void dma_indirect_lv2(void); /*DMA level 2 indirect transfer function*/ |
| 236 | static void dma_direct_lv0(running_machine *machine); /*DMA level 0 direct transfer function*/ |
| 237 | static void dma_direct_lv1(running_machine *machine); /*DMA level 1 direct transfer function*/ |
| 238 | static void dma_direct_lv2(running_machine *machine); /*DMA level 2 direct transfer function*/ |
| 239 | static void dma_indirect_lv0(running_machine *machine); /*DMA level 0 indirect transfer function*/ |
| 240 | static void dma_indirect_lv1(running_machine *machine); /*DMA level 1 indirect transfer function*/ |
| 241 | static void dma_indirect_lv2(running_machine *machine); /*DMA level 2 indirect transfer function*/ |
| 242 | 242 | |
| 243 | 243 | |
| 244 | 244 | static int minit_boost,sinit_boost; |
| r1981 | r1982 | |
| 246 | 246 | |
| 247 | 247 | static int scanline; |
| 248 | 248 | |
| 249 | | |
| 249 | #if 0 |
| 250 | 250 | /*A-Bus IRQ checks,where they could be located these?*/ |
| 251 | 251 | #define ABUSIRQ(_irq_,_vector_,_mask_) \ |
| 252 | 252 | if(!(stv_scu[40] & _mask_)) { cpunum_set_input_line_and_vector(Machine, 0, _irq_, HOLD_LINE , _vector_); } |
| 253 | | #if 0 |
| 253 | |
| 254 | 254 | if(stv_scu[42] & 1)//IRQ ACK |
| 255 | 255 | { |
| 256 | 256 | ABUSIRQ(7,0x50,0x00010000); |
| r1981 | r1982 | |
| 516 | 516 | return return_data; |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | | static void stv_SMPC_w8 (int offset, UINT8 data) |
| 519 | static void stv_SMPC_w8 (running_machine *machine, int offset, UINT8 data) |
| 520 | 520 | { |
| 521 | 521 | mame_system_time systime; |
| 522 | 522 | UINT8 last; |
| 523 | 523 | |
| 524 | 524 | /* get the current date/time from the core */ |
| 525 | | mame_get_current_datetime(Machine, &systime); |
| 525 | mame_get_current_datetime(machine, &systime); |
| 526 | 526 | |
| 527 | 527 | // if (LOG_SMPC) logerror ("8-bit SMPC Write to Offset %02x (reg %d) with Data %02x (prev %02x)\n", offset, offset>>1, data, smpc_ram[offset]); |
| 528 | 528 | |
| r1981 | r1982 | |
| 538 | 538 | intback_stage = 2; |
| 539 | 539 | } |
| 540 | 540 | smpc_intbackhelper(); |
| 541 | | cpunum_set_input_line_and_vector(Machine, 0, 8, HOLD_LINE , 0x47); |
| 541 | cpunum_set_input_line_and_vector(machine, 0, 8, HOLD_LINE , 0x47); |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | if ((offset == 1) && (data & 0x40)) |
| r1981 | r1982 | |
| 582 | 582 | if(!(stv_scu[40] & 0x0100)) /*Pad irq*/ |
| 583 | 583 | { |
| 584 | 584 | if(LOG_SMPC) logerror ("Interrupt: PAD irq at scanline %04x, Vector 0x48 Level 0x08\n",scanline); |
| 585 | | cpunum_set_input_line_and_vector(Machine, 0, 8, HOLD_LINE , 0x48); |
| 585 | cpunum_set_input_line_and_vector(machine, 0, 8, HOLD_LINE , 0x48); |
| 586 | 586 | } |
| 587 | 587 | } |
| 588 | 588 | |
| r1981 | r1982 | |
| 599 | 599 | if(LOG_SMPC) logerror ("SMPC: Slave ON\n"); |
| 600 | 600 | smpc_ram[0x5f]=0x02; |
| 601 | 601 | stv_enable_slave_sh2 = 1; |
| 602 | | cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, CLEAR_LINE); |
| 602 | cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, CLEAR_LINE); |
| 603 | 603 | break; |
| 604 | 604 | case 0x03: |
| 605 | 605 | if(LOG_SMPC) logerror ("SMPC: Slave OFF\n"); |
| 606 | 606 | smpc_ram[0x5f]=0x03; |
| 607 | 607 | stv_enable_slave_sh2 = 0; |
| 608 | | cpu_trigger(Machine, 1000); |
| 609 | | cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, ASSERT_LINE); |
| 608 | cpu_trigger(machine, 1000); |
| 609 | cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, ASSERT_LINE); |
| 610 | 610 | break; |
| 611 | 611 | case 0x06: |
| 612 | 612 | if(LOG_SMPC) logerror ("SMPC: Sound ON\n"); |
| 613 | 613 | /* wrong? */ |
| 614 | 614 | smpc_ram[0x5f]=0x06; |
| 615 | | cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, CLEAR_LINE); |
| 615 | cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, CLEAR_LINE); |
| 616 | 616 | en_68k = 1; |
| 617 | 617 | break; |
| 618 | 618 | case 0x07: |
| 619 | 619 | if(LOG_SMPC) logerror ("SMPC: Sound OFF\n"); |
| 620 | | cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, ASSERT_LINE); |
| 620 | cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, ASSERT_LINE); |
| 621 | 621 | en_68k = 0; |
| 622 | 622 | smpc_ram[0x5f]=0x07; |
| 623 | 623 | break; |
| r1981 | r1982 | |
| 627 | 627 | case 0x0d: |
| 628 | 628 | if(LOG_SMPC) logerror ("SMPC: System Reset\n"); |
| 629 | 629 | smpc_ram[0x5f]=0x0d; |
| 630 | | cpunum_set_input_line(Machine, 0, INPUT_LINE_RESET, PULSE_LINE); |
| 630 | cpunum_set_input_line(machine, 0, INPUT_LINE_RESET, PULSE_LINE); |
| 631 | 631 | system_reset(); |
| 632 | 632 | break; |
| 633 | 633 | case 0x0e: |
| 634 | 634 | if(LOG_SMPC) logerror ("SMPC: Change Clock to 352\n"); |
| 635 | 635 | smpc_ram[0x5f]=0x0e; |
| 636 | | cpunum_set_clock(Machine, 0, MASTER_CLOCK_352/2); |
| 637 | | cpunum_set_clock(Machine, 1, MASTER_CLOCK_352/2); |
| 638 | | cpunum_set_clock(Machine, 2, MASTER_CLOCK_352/5); |
| 639 | | cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, PULSE_LINE); // ff said this causes nmi, should we set a timer then nmi? |
| 636 | cpunum_set_clock(machine, 0, MASTER_CLOCK_352/2); |
| 637 | cpunum_set_clock(machine, 1, MASTER_CLOCK_352/2); |
| 638 | cpunum_set_clock(machine, 2, MASTER_CLOCK_352/5); |
| 639 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); // ff said this causes nmi, should we set a timer then nmi? |
| 640 | 640 | break; |
| 641 | 641 | case 0x0f: |
| 642 | 642 | if(LOG_SMPC) logerror ("SMPC: Change Clock to 320\n"); |
| 643 | 643 | smpc_ram[0x5f]=0x0f; |
| 644 | | cpunum_set_clock(Machine, 0, MASTER_CLOCK_320/2); |
| 645 | | cpunum_set_clock(Machine, 1, MASTER_CLOCK_320/2); |
| 646 | | cpunum_set_clock(Machine, 2, MASTER_CLOCK_320/5); |
| 647 | | cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, PULSE_LINE); // ff said this causes nmi, should we set a timer then nmi? |
| 644 | cpunum_set_clock(machine, 0, MASTER_CLOCK_320/2); |
| 645 | cpunum_set_clock(machine, 1, MASTER_CLOCK_320/2); |
| 646 | cpunum_set_clock(machine, 2, MASTER_CLOCK_320/5); |
| 647 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); // ff said this causes nmi, should we set a timer then nmi? |
| 648 | 648 | break; |
| 649 | 649 | /*"Interrupt Back"*/ |
| 650 | 650 | case 0x10: |
| r1981 | r1982 | |
| 696 | 696 | { |
| 697 | 697 | // if(LOG_SMPC) logerror ("Interrupt: System Manager (SMPC) at scanline %04x, Vector 0x47 Level 0x08\n",scanline); |
| 698 | 698 | smpc_intbackhelper(); |
| 699 | | cpunum_set_input_line_and_vector(Machine, 0, 8, HOLD_LINE , 0x47); |
| 699 | cpunum_set_input_line_and_vector(machine, 0, 8, HOLD_LINE , 0x47); |
| 700 | 700 | } |
| 701 | 701 | break; |
| 702 | 702 | /* RTC write*/ |
| r1981 | r1982 | |
| 725 | 725 | if(LOG_SMPC) logerror ("SMPC: NMI request\n"); |
| 726 | 726 | smpc_ram[0x5f]=0x18; |
| 727 | 727 | /*NMI is unconditionally requested?*/ |
| 728 | | cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 728 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 729 | 729 | break; |
| 730 | 730 | case 0x19: |
| 731 | 731 | if(LOG_SMPC) logerror ("SMPC: NMI Enable\n"); |
| r1981 | r1982 | |
| 783 | 783 | |
| 784 | 784 | offset += byte; |
| 785 | 785 | |
| 786 | | stv_SMPC_w8(offset,writedata); |
| 786 | stv_SMPC_w8(machine, offset,writedata); |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | |
| r1981 | r1982 | |
| 1099 | 1099 | */ |
| 1100 | 1100 | if(stv_scu[4] & 1 && ((stv_scu[5] & 7) == 7) && stv_scu[4] & 0x100) |
| 1101 | 1101 | { |
| 1102 | | if(DIRECT_MODE(0)) { dma_direct_lv0(); } |
| 1103 | | else { dma_indirect_lv0(); } |
| 1102 | if(DIRECT_MODE(0)) { dma_direct_lv0(machine); } |
| 1103 | else { dma_indirect_lv0(machine); } |
| 1104 | 1104 | |
| 1105 | 1105 | stv_scu[4]^=1;//disable starting bit. |
| 1106 | 1106 | |
| r1981 | r1982 | |
| 1160 | 1160 | case 12: |
| 1161 | 1161 | if(stv_scu[12] & 1 && ((stv_scu[13] & 7) == 7) && stv_scu[12] & 0x100) |
| 1162 | 1162 | { |
| 1163 | | if(DIRECT_MODE(1)) { dma_direct_lv1(); } |
| 1164 | | else { dma_indirect_lv1(); } |
| 1163 | if(DIRECT_MODE(1)) { dma_direct_lv1(machine); } |
| 1164 | else { dma_indirect_lv1(machine); } |
| 1165 | 1165 | |
| 1166 | 1166 | stv_scu[12]^=1; |
| 1167 | 1167 | |
| r1981 | r1982 | |
| 1210 | 1210 | case 20: |
| 1211 | 1211 | if(stv_scu[20] & 1 && ((stv_scu[21] & 7) == 7) && stv_scu[20] & 0x100) |
| 1212 | 1212 | { |
| 1213 | | if(DIRECT_MODE(2)) { dma_direct_lv2(); } |
| 1214 | | else { dma_indirect_lv2(); } |
| 1213 | if(DIRECT_MODE(2)) { dma_direct_lv2(machine); } |
| 1214 | else { dma_indirect_lv2(machine); } |
| 1215 | 1215 | |
| 1216 | 1216 | stv_scu[20]^=1; |
| 1217 | 1217 | |
| r1981 | r1982 | |
| 1299 | 1299 | } |
| 1300 | 1300 | } |
| 1301 | 1301 | |
| 1302 | | static void dma_direct_lv0() |
| 1302 | static void dma_direct_lv0(running_machine *machine) |
| 1303 | 1303 | { |
| 1304 | 1304 | static UINT32 tmp_src,tmp_dst,tmp_size; |
| 1305 | 1305 | if(LOG_SCU) logerror("DMA lv 0 transfer START\n" |
| r1981 | r1982 | |
| 1397 | 1397 | |
| 1398 | 1398 | if(LOG_SCU) logerror("DMA transfer END\n"); |
| 1399 | 1399 | if(!(stv_scu[40] & 0x800))/*Lv 0 DMA end irq*/ |
| 1400 | | cpunum_set_input_line_and_vector(Machine, 0, 5, HOLD_LINE , 0x4b); |
| 1400 | cpunum_set_input_line_and_vector(machine, 0, 5, HOLD_LINE , 0x4b); |
| 1401 | 1401 | |
| 1402 | 1402 | if(scu_add_tmp & 0x80000000) |
| 1403 | 1403 | { |
| r1981 | r1982 | |
| 1409 | 1409 | D0MV_0; |
| 1410 | 1410 | } |
| 1411 | 1411 | |
| 1412 | | static void dma_direct_lv1() |
| 1412 | static void dma_direct_lv1(running_machine *machine) |
| 1413 | 1413 | { |
| 1414 | 1414 | static UINT32 tmp_src,tmp_dst,tmp_size; |
| 1415 | 1415 | if(LOG_SCU) logerror("DMA lv 1 transfer START\n" |
| r1981 | r1982 | |
| 1500 | 1500 | |
| 1501 | 1501 | if(LOG_SCU) logerror("DMA transfer END\n"); |
| 1502 | 1502 | if(!(stv_scu[40] & 0x400))/*Lv 1 DMA end irq*/ |
| 1503 | | cpunum_set_input_line_and_vector(Machine, 0, 6, HOLD_LINE , 0x4a); |
| 1503 | cpunum_set_input_line_and_vector(machine, 0, 6, HOLD_LINE , 0x4a); |
| 1504 | 1504 | |
| 1505 | 1505 | if(scu_add_tmp & 0x80000000) |
| 1506 | 1506 | { |
| r1981 | r1982 | |
| 1512 | 1512 | D1MV_0; |
| 1513 | 1513 | } |
| 1514 | 1514 | |
| 1515 | | static void dma_direct_lv2() |
| 1515 | static void dma_direct_lv2(running_machine *machine) |
| 1516 | 1516 | { |
| 1517 | 1517 | static UINT32 tmp_src,tmp_dst,tmp_size; |
| 1518 | 1518 | if(LOG_SCU) logerror("DMA lv 2 transfer START\n" |
| r1981 | r1982 | |
| 1603 | 1603 | |
| 1604 | 1604 | if(LOG_SCU) logerror("DMA transfer END\n"); |
| 1605 | 1605 | if(!(stv_scu[40] & 0x200))/*Lv 2 DMA end irq*/ |
| 1606 | | cpunum_set_input_line_and_vector(Machine, 0, 6, HOLD_LINE , 0x49); |
| 1606 | cpunum_set_input_line_and_vector(machine, 0, 6, HOLD_LINE , 0x49); |
| 1607 | 1607 | |
| 1608 | 1608 | if(scu_add_tmp & 0x80000000) |
| 1609 | 1609 | { |
| r1981 | r1982 | |
| 1615 | 1615 | D2MV_0; |
| 1616 | 1616 | } |
| 1617 | 1617 | |
| 1618 | | static void dma_indirect_lv0() |
| 1618 | static void dma_indirect_lv0(running_machine *machine) |
| 1619 | 1619 | { |
| 1620 | 1620 | /*Helper to get out of the cycle*/ |
| 1621 | 1621 | UINT8 job_done = 0; |
| r1981 | r1982 | |
| 1681 | 1681 | }while(job_done == 0); |
| 1682 | 1682 | |
| 1683 | 1683 | if(!(stv_scu[40] & 0x800))/*Lv 0 DMA end irq*/ |
| 1684 | | cpunum_set_input_line_and_vector(Machine, 0, 5, HOLD_LINE , 0x4b); |
| 1684 | cpunum_set_input_line_and_vector(machine, 0, 5, HOLD_LINE , 0x4b); |
| 1685 | 1685 | |
| 1686 | 1686 | D0MV_0; |
| 1687 | 1687 | } |
| 1688 | 1688 | |
| 1689 | | static void dma_indirect_lv1() |
| 1689 | static void dma_indirect_lv1(running_machine *machine) |
| 1690 | 1690 | { |
| 1691 | 1691 | /*Helper to get out of the cycle*/ |
| 1692 | 1692 | UINT8 job_done = 0; |
| r1981 | r1982 | |
| 1753 | 1753 | }while(job_done == 0); |
| 1754 | 1754 | |
| 1755 | 1755 | if(!(stv_scu[40] & 0x400))/*Lv 1 DMA end irq*/ |
| 1756 | | cpunum_set_input_line_and_vector(Machine, 0, 6, HOLD_LINE , 0x4a); |
| 1756 | cpunum_set_input_line_and_vector(machine, 0, 6, HOLD_LINE , 0x4a); |
| 1757 | 1757 | |
| 1758 | 1758 | D1MV_0; |
| 1759 | 1759 | } |
| 1760 | 1760 | |
| 1761 | | static void dma_indirect_lv2() |
| 1761 | static void dma_indirect_lv2(running_machine *machine) |
| 1762 | 1762 | { |
| 1763 | 1763 | /*Helper to get out of the cycle*/ |
| 1764 | 1764 | UINT8 job_done = 0; |
| r1981 | r1982 | |
| 1824 | 1824 | }while(job_done == 0); |
| 1825 | 1825 | |
| 1826 | 1826 | if(!(stv_scu[40] & 0x200))/*Lv 2 DMA end irq*/ |
| 1827 | | cpunum_set_input_line_and_vector(Machine, 0, 6, HOLD_LINE , 0x49); |
| 1827 | cpunum_set_input_line_and_vector(machine, 0, 6, HOLD_LINE , 0x49); |
| 1828 | 1828 | |
| 1829 | 1829 | D2MV_0; |
| 1830 | 1830 | } |
| r1981 | r1982 | |
| 2057 | 2057 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("P2 R") PORT_PLAYER(2) // R |
| 2058 | 2058 | INPUT_PORTS_END |
| 2059 | 2059 | |
| 2060 | | static void saturn_init_driver(int rgn) |
| 2060 | static void saturn_init_driver(running_machine *machine, int rgn) |
| 2061 | 2061 | { |
| 2062 | 2062 | mame_system_time systime; |
| 2063 | 2063 | |
| 2064 | 2064 | saturn_region = rgn; |
| 2065 | 2065 | |
| 2066 | 2066 | /* get the current date/time from the core */ |
| 2067 | | mame_get_current_datetime(Machine, &systime); |
| 2067 | mame_get_current_datetime(machine, &systime); |
| 2068 | 2068 | |
| 2069 | 2069 | /* amount of time to boost interleave for on MINIT / SINIT, needed for communication to work */ |
| 2070 | 2070 | minit_boost = 400; |
| r1981 | r1982 | |
| 2091 | 2091 | #ifdef UNUSED_FUNCTION |
| 2092 | 2092 | DRIVER_INIT( saturn ) |
| 2093 | 2093 | { |
| 2094 | | saturn_init_driver(0); |
| 2094 | saturn_init_driver(machine, 0); |
| 2095 | 2095 | } |
| 2096 | 2096 | #endif |
| 2097 | 2097 | |
| 2098 | 2098 | static DRIVER_INIT( saturnus ) |
| 2099 | 2099 | { |
| 2100 | | saturn_init_driver(4); |
| 2100 | saturn_init_driver(machine, 4); |
| 2101 | 2101 | } |
| 2102 | 2102 | |
| 2103 | 2103 | static DRIVER_INIT( saturneu ) |
| 2104 | 2104 | { |
| 2105 | | saturn_init_driver(12); |
| 2105 | saturn_init_driver(machine, 12); |
| 2106 | 2106 | } |
| 2107 | 2107 | |
| 2108 | 2108 | static DRIVER_INIT( saturnjp ) |
| 2109 | 2109 | { |
| 2110 | | saturn_init_driver(1); |
| 2110 | saturn_init_driver(machine, 1); |
| 2111 | 2111 | } |
| 2112 | 2112 | |
| 2113 | 2113 | |
src/mess/drivers/einstein.c
| r1981 | r1982 | |
| 349 | 349 | einstein_keyboard_data = data; |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | | static void einstein_update_interrupts(void) |
| 352 | static void einstein_update_interrupts(running_machine *machine) |
| 353 | 353 | { |
| 354 | 354 | /* NPW 21-Jul-2005 - Not sure how to update this for MAME 0.98u2 */ |
| 355 | 355 | /* |
| 356 | 356 | if (einstein_int & einstein_int_mask & EINSTEIN_KEY_INT) |
| 357 | | cpunum_set_input_line(Machine, 0, Z80_INT_REQ, PULSE_LINE); |
| 357 | cpunum_set_input_line(machine, 0, Z80_INT_REQ, PULSE_LINE); |
| 358 | 358 | else |
| 359 | | cpunum_set_input_line(Machine, 0, Z80_INT_IEO, PULSE_LINE); |
| 359 | cpunum_set_input_line(machine, 0, Z80_INT_IEO, PULSE_LINE); |
| 360 | 360 | |
| 361 | 361 | if (einstein_int & einstein_int_mask & EINSTEIN_ADC_INT) |
| 362 | | cpunum_set_input_line(Machine, 0, Z80_INT_REQ, PULSE_LINE); |
| 362 | cpunum_set_input_line(machine, 0, Z80_INT_REQ, PULSE_LINE); |
| 363 | 363 | else |
| 364 | | cpunum_set_input_line(Machine, 0, Z80_INT_IEO, PULSE_LINE); |
| 364 | cpunum_set_input_line(machine, 0, Z80_INT_IEO, PULSE_LINE); |
| 365 | 365 | |
| 366 | 366 | if (einstein_int & einstein_int_mask & EINSTEIN_FIRE_INT) |
| 367 | | cpunum_set_input_line(Machine, 0, Z80_INT_REQ, PULSE_LINE); |
| 367 | cpunum_set_input_line(machine, 0, Z80_INT_REQ, PULSE_LINE); |
| 368 | 368 | else |
| 369 | | cpunum_set_input_line(Machine, 0, Z80_INT_IEO, PULSE_LINE); |
| 369 | cpunum_set_input_line(machine, 0, Z80_INT_IEO, PULSE_LINE); |
| 370 | 370 | */ |
| 371 | 371 | } |
| 372 | 372 | |
| r1981 | r1982 | |
| 395 | 395 | einstein_int &= ~EINSTEIN_KEY_INT; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | | einstein_update_interrupts(); |
| 398 | einstein_update_interrupts(machine); |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | |
| r1981 | r1982 | |
| 459 | 459 | { |
| 460 | 460 | einstein_int_mask &= ~EINSTEIN_KEY_INT; |
| 461 | 461 | |
| 462 | | einstein_update_interrupts(); |
| 462 | einstein_update_interrupts(Machine); |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | |
| r1981 | r1982 | |
| 468 | 468 | { |
| 469 | 469 | einstein_int_mask &= ~EINSTEIN_ADC_INT; |
| 470 | 470 | |
| 471 | | einstein_update_interrupts(); |
| 471 | einstein_update_interrupts(Machine); |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | #ifdef UNUSED_FUNCTION |
| r1981 | r1982 | |
| 477 | 477 | { |
| 478 | 478 | einstein_int_mask &= ~EINSTEIN_FIRE_INT; |
| 479 | 479 | |
| 480 | | einstein_update_interrupts(); |
| 480 | einstein_update_interrupts(Machine); |
| 481 | 481 | } |
| 482 | 482 | #endif |
| 483 | 483 | |
| r1981 | r1982 | |
| 845 | 845 | einstein_page_rom(); |
| 846 | 846 | } |
| 847 | 847 | |
| 848 | | static READ8_HANDLER(einstein_key_int_r) |
| 848 | static READ8_HANDLER(einstein_key_int_r) |
| 849 | 849 | { |
| 850 | 850 | int centronics_handshake; |
| 851 | 851 | int data; |
| r1981 | r1982 | |
| 853 | 853 | /* clear key int. a read of this I/O port will do this or a reset */ |
| 854 | 854 | einstein_int &= ~EINSTEIN_KEY_INT; |
| 855 | 855 | |
| 856 | | einstein_update_interrupts(); |
| 856 | einstein_update_interrupts(machine); |
| 857 | 857 | |
| 858 | 858 | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 859 | 859 | centronics_handshake = centronics_read_handshake(0); |
| r1981 | r1982 | |
| 916 | 916 | einstein_int_mask |= EINSTEIN_KEY_INT; |
| 917 | 917 | } |
| 918 | 918 | |
| 919 | | einstein_update_interrupts(); |
| 919 | einstein_update_interrupts(machine); |
| 920 | 920 | } |
| 921 | 921 | |
| 922 | 922 | static WRITE8_HANDLER(einstein_adc_int_w) |
| r1981 | r1982 | |
| 936 | 936 | einstein_int_mask |= EINSTEIN_ADC_INT; |
| 937 | 937 | } |
| 938 | 938 | |
| 939 | | einstein_update_interrupts(); |
| 939 | einstein_update_interrupts(machine); |
| 940 | 940 | } |
| 941 | 941 | |
| 942 | 942 | static WRITE8_HANDLER(einstein_fire_int_w) |
| r1981 | r1982 | |
| 957 | 957 | einstein_int_mask |= EINSTEIN_FIRE_INT; |
| 958 | 958 | } |
| 959 | 959 | |
| 960 | | einstein_update_interrupts(); |
| 960 | einstein_update_interrupts(machine); |
| 961 | 961 | } |
| 962 | 962 | |
| 963 | 963 | |
src/mess/drivers/exelv.c
| r1981 | r1982 | |
| 178 | 178 | static int io_ack; |
| 179 | 179 | static int mailbox_out; |
| 180 | 180 | |
| 181 | | static void io_iterate(void); |
| 181 | static void io_iterate(running_machine *machine); |
| 182 | 182 | |
| 183 | 183 | static void io_reset(void) |
| 184 | 184 | { |
| r1981 | r1982 | |
| 195 | 195 | io_reset(); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | | static void io_iterate(void) |
| 198 | static void io_iterate(running_machine *machine) |
| 199 | 199 | { |
| 200 | 200 | if (/*io_hsk &&*/ (mailbox_out == 0) && (! io_command_ack)) |
| 201 | 201 | { |
| r1981 | r1982 | |
| 205 | 205 | break; |
| 206 | 206 | case IOS_INIT: |
| 207 | 207 | mailbox_out = 0x08; |
| 208 | | cpunum_set_input_line(Machine, 0, TMS7000_IRQ1_LINE, PULSE_LINE); |
| 208 | cpunum_set_input_line(machine, 0, TMS7000_IRQ1_LINE, PULSE_LINE); |
| 209 | 209 | io_state = IOS_NOP; |
| 210 | 210 | break; |
| 211 | 211 | case IOS_RESET: |
| r1981 | r1982 | |
| 221 | 221 | break; |
| 222 | 222 | case IOS_CHARDEF1: |
| 223 | 223 | mailbox_out = 0x07; |
| 224 | | cpunum_set_input_line(Machine, 0, TMS7000_IRQ1_LINE, PULSE_LINE); |
| 224 | cpunum_set_input_line(machine, 0, TMS7000_IRQ1_LINE, PULSE_LINE); |
| 225 | 225 | io_state = IOS_CHARDEF2; |
| 226 | 226 | break; |
| 227 | 227 | case IOS_CHARDEF2: |
| 228 | 228 | mailbox_out = 0x04; |
| 229 | | cpunum_set_input_line(Machine, 0, TMS7000_IRQ1_LINE, PULSE_LINE); |
| 229 | cpunum_set_input_line(machine, 0, TMS7000_IRQ1_LINE, PULSE_LINE); |
| 230 | 230 | io_state = IOS_CHARDEF3; |
| 231 | 231 | break; |
| 232 | 232 | case IOS_CHARDEF3: |
| 233 | 233 | mailbox_out = 0xF5; |
| 234 | | cpunum_set_input_line(Machine, 0, TMS7000_IRQ1_LINE, PULSE_LINE); |
| 234 | cpunum_set_input_line(machine, 0, TMS7000_IRQ1_LINE, PULSE_LINE); |
| 235 | 235 | io_state = IOS_CHARDEF4; |
| 236 | 236 | io_counter = 0; |
| 237 | 237 | break; |
| r1981 | r1982 | |
| 370 | 370 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 371 | 371 | }; |
| 372 | 372 | mailbox_out = fontdata[io_counter+9-2*(io_counter%10)] >> 2; |
| 373 | | cpunum_set_input_line(Machine, 0, TMS7000_IRQ1_LINE, PULSE_LINE); |
| 373 | cpunum_set_input_line(machine, 0, TMS7000_IRQ1_LINE, PULSE_LINE); |
| 374 | 374 | io_counter++; |
| 375 | 375 | if (io_counter == 127*10) |
| 376 | 376 | io_state = IOS_NOP; |
| r1981 | r1982 | |
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | | static void set_io_hsk(int state) |
| 383 | static void set_io_hsk(running_machine *machine, int state) |
| 384 | 384 | { |
| 385 | 385 | if (state != io_hsk) |
| 386 | 386 | { |
| r1981 | r1982 | |
| 388 | 388 | if (io_command_ack) |
| 389 | 389 | { |
| 390 | 390 | if (io_hsk) |
| 391 | | cpunum_set_input_line(Machine, 0, TMS7000_IRQ1_LINE, PULSE_LINE); |
| 391 | cpunum_set_input_line(machine, 0, TMS7000_IRQ1_LINE, PULSE_LINE); |
| 392 | 392 | else |
| 393 | 393 | { |
| 394 | 394 | io_command_ack = 0; |
| 395 | | io_iterate(); |
| 395 | io_iterate(machine); |
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 | } |
| r1981 | r1982 | |
| 415 | 415 | mailbox_out = 0x00; |
| 416 | 416 | |
| 417 | 417 | /* see if there are other messages to post */ |
| 418 | | io_iterate(); |
| 418 | io_iterate(machine); |
| 419 | 419 | |
| 420 | 420 | return reply; |
| 421 | 421 | } |
| r1981 | r1982 | |
| 478 | 478 | |
| 479 | 479 | static WRITE8_HANDLER(exelv_portb_w) |
| 480 | 480 | { |
| 481 | | set_io_hsk((data & 0x1) != 0); |
| 481 | set_io_hsk(machine, (data & 0x1) != 0); |
| 482 | 482 | set_io_ack((data & 0x2) != 0); |
| 483 | 483 | } |
| 484 | 484 | |