void tm990189_state::tm990_189(machine_config &config) { /* basic machine hardware */ TMS9980A(config, m_tms9980a, 8_MHz_XTAL); // clock divided by 4 internally m_tms9980a->set_addrmap(AS_PROGRAM, &tm990189_state::tm990_189_memmap); m_tms9980a->set_addrmap(AS_IO, &tm990189_state::tm990_189_cru_map); m_tms9980a->extop_cb().set(FUNC(tm990189_state::external_operation)); MCFG_MACHINE_START_OVERRIDE(tm990189_state, tm990_189 ) MCFG_MACHINE_RESET_OVERRIDE(tm990189_state, tm990_189 ) /* Video hardware */ config.set_default_layout(layout_tm990189); /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.50); /* Devices */ CASSETTE(config, "cassette", 0).add_route(ALL_OUTPUTS, "mono", 0.25); TMS9901(config, m_tms9901_usr, 8_MHz_XTAL / 4); m_tms9901_usr->p_out_cb(0).set(FUNC(tm990189_state::usr9901_led0_w)); m_tms9901_usr->p_out_cb(1).set(FUNC(tm990189_state::usr9901_led1_w)); m_tms9901_usr->p_out_cb(2).set(FUNC(tm990189_state::usr9901_led2_w)); m_tms9901_usr->p_out_cb(3).set(FUNC(tm990189_state::usr9901_led3_w)); m_tms9901_usr->intlevel_cb().set(FUNC(tm990189_state::usr9901_interrupt_callback)); TMS9901(config, m_tms9901_sys, 8_MHz_XTAL / 4); m_tms9901_sys->read_cb().set(FUNC(tm990189_state::sys9901_r)); m_tms9901_sys->p_out_cb(0).set(FUNC(tm990189_state::sys9901_digitsel0_w)); m_tms9901_sys->p_out_cb(1).set(FUNC(tm990189_state::sys9901_digitsel1_w)); m_tms9901_sys->p_out_cb(2).set(FUNC(tm990189_state::sys9901_digitsel2_w)); m_tms9901_sys->p_out_cb(3).set(FUNC(tm990189_state::sys9901_digitsel3_w)); m_tms9901_sys->p_out_cb(4).set(FUNC(tm990189_state::sys9901_segment0_w)); m_tms9901_sys->p_out_cb(5).set(FUNC(tm990189_state::sys9901_segment1_w)); m_tms9901_sys->p_out_cb(6).set(FUNC(tm990189_state::sys9901_segment2_w)); m_tms9901_sys->p_out_cb(7).set(FUNC(tm990189_state::sys9901_segment3_w)); m_tms9901_sys->p_out_cb(8).set(FUNC(tm990189_state::sys9901_segment4_w)); m_tms9901_sys->p_out_cb(9).set(FUNC(tm990189_state::sys9901_segment5_w)); m_tms9901_sys->p_out_cb(10).set(FUNC(tm990189_state::sys9901_segment6_w)); m_tms9901_sys->p_out_cb(11).set(FUNC(tm990189_state::sys9901_segment7_w)); m_tms9901_sys->p_out_cb(12).set(FUNC(tm990189_state::sys9901_dsplytrgr_w)); m_tms9901_sys->p_out_cb(13).set(FUNC(tm990189_state::sys9901_shiftlight_w)); m_tms9901_sys->p_out_cb(14).set(FUNC(tm990189_state::sys9901_spkrdrive_w)); m_tms9901_sys->p_out_cb(15).set(FUNC(tm990189_state::sys9901_tapewdata_w)); m_tms9901_sys->intlevel_cb().set(FUNC(tm990189_state::sys9901_interrupt_callback)); TMS9902(config, m_tms9902, 8_MHz_XTAL / 4); m_tms9902->xmit_cb().set(FUNC(tm990189_state::xmit_callback)); // called when a character is transmitted TM990_189_RS232(config, "rs232", 0, m_tms9902); timer_device &display_timer(TIMER(config, "display_timer")); display_timer.configure_periodic(FUNC(tm990189_state::display_callback), attotime::from_hz(30)); // Need to delay the timer, or it will spoil the initial LOAD // TODO: Fix this, probably inside CPU display_timer.set_start_delay(attotime::from_msec(150)); }
static int display_misc_handler(window_info *win) { const int scaled_5 = (int)(0.5 + win->current_scale * 5); const int scaled_28 = (int)(0.5 + win->current_scale * 28); int base_y_start = win->len_y; const float compass_u_start = (float)32/256; const float compass_v_start = (float)193/256; const float compass_u_end = (float)95/256; const float compass_v_end = 1.0f; const float needle_u_start = (float)4/256; const float needle_v_start = (float)201/256; const float needle_u_end = (float)14/256; const float needle_v_end = (float)247/256; #ifdef OPENGL_TRACE CHECK_GL_ERRORS(); #endif //OPENGL_TRACE bind_texture(hud_text); // allow for transparency glEnable(GL_ALPHA_TEST);//enable alpha filtering, so we have some alpha key glAlphaFunc(GL_GREATER, 0.09f); //draw the compass base_y_start -= compass_size; glBegin(GL_QUADS); draw_2d_thing(compass_u_start, compass_v_start, compass_u_end, compass_v_end, 0, base_y_start, compass_size, base_y_start + compass_size); glEnd(); //draw the compass needle glPushMatrix(); glTranslatef(compass_size/2, base_y_start + compass_size/2, 0); glRotatef(rz, 0.0f, 0.0f, 1.0f); glBegin(GL_QUADS); draw_2d_thing(needle_u_start, needle_v_start, needle_u_end, needle_v_end, -scaled_5, -scaled_28, scaled_5, scaled_28); glEnd(); glPopMatrix(); //draw the clock if(view_analog_clock > 0) { const int scaled_4 = (int)(0.5 + win->current_scale * 4); const int scaled_6 = (int)(0.5 + win->current_scale * 6); const float clock_u_start = 0.0f; const float clock_v_start = (float)128/256; const float clock_u_end = (float)63/256; const float clock_v_end = (float)191/256; const float clock_needle_u_start = (float)21/256; const float clock_needle_v_start = (float)193/256; const float clock_needle_u_end = (float)31/256; const float clock_needle_v_end = (float)223/256; const int scaled_24 = (int)(0.5 + win->current_scale * 24); base_y_start -= analog_clock_size; // draw the clock face glBegin(GL_QUADS); draw_2d_thing(clock_u_start, clock_v_start, clock_u_end, clock_v_end,0, base_y_start, analog_clock_size, base_y_start + analog_clock_size); glEnd(); //draw the clock needle glAlphaFunc(GL_GREATER, 0.05f); glPushMatrix(); glTranslatef(analog_clock_size/2, base_y_start + analog_clock_size/2, 0); glRotatef(real_game_minute, 0.0f, 0.0f, 1.0f); glBegin(GL_QUADS); draw_2d_thing(clock_needle_u_start, clock_needle_v_start, clock_needle_u_end, clock_needle_v_end, -scaled_4, -scaled_24, scaled_6, scaled_6); glEnd(); glPopMatrix(); glDisable(GL_ALPHA_TEST); } #ifdef OPENGL_TRACE CHECK_GL_ERRORS(); #endif //OPENGL_TRACE //Digital Clock if(view_digital_clock > 0) { const int scaled_6 = (int)(0.5 + win->current_scale * 6); char str[10]; if (show_game_seconds) safe_snprintf(str, sizeof(str), "%1d:%02d:%02d", real_game_minute/60, real_game_minute%60, real_game_second); else safe_snprintf(str, sizeof(str), " %1d:%02d ", real_game_minute/60, real_game_minute%60); base_y_start -= digital_clock_height; draw_string_shadowed_width(scaled_6/2, scaled_6/2 + base_y_start, (unsigned char*)str, win->len_x-scaled_6, 1,0.77f, 0.57f, 0.39f,0.0f,0.0f,0.0f); } /* if mouse over the either of the clocks - display the time & date */ if (mouse_over_clock) { char str[20]; const char *the_date = get_date(NULL); int centre_y = (view_analog_clock) ?win->len_y - compass_size - analog_clock_size/2 : base_y_start + digital_clock_height/2; safe_snprintf(str, sizeof(str), "%1d:%02d:%02d", real_game_minute/60, real_game_minute%60, real_game_second); draw_string_small_shadowed_zoomed(-win->small_font_len_x*(strlen(str)+0.5), centre_y-win->small_font_len_y, (unsigned char*)str, 1, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, win->current_scale); if (the_date != NULL) { safe_snprintf(str, sizeof(str), "%s", the_date); draw_string_small_shadowed_zoomed(-win->small_font_len_x*(strlen(str)+0.5), centre_y, (unsigned char*)str, 1, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, win->current_scale); } mouse_over_clock = 0; } /* if mouse over the compass - display the coords */ if (mouse_over_compass) { char str[12]; actor *me = get_our_actor (); if (me != NULL) { safe_snprintf(str, sizeof(str), "%d,%d", me->x_tile_pos, me->y_tile_pos); draw_string_small_shadowed_zoomed(-win->small_font_len_x*(strlen(str)+0.5), win->len_y-compass_size, (unsigned char*)str, 1, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, win->current_scale); } mouse_over_compass = 0; } /* if the knowledge bar is enabled, show progress in bar and ETA as hover over */ if (view_knowledge_bar) { char str[20]; char *use_str = idle_str; int percentage_done = 0; int x = (int)(0.5 + win->current_scale * 3); int y = base_y_start - side_stats_bar_height - ((knowledge_bar_height - side_stats_bar_height) / 2); int off = 0; if (is_researching()) { percentage_done = (int)(100 * get_research_fraction()); safe_snprintf(str, sizeof(str), "%d%%", percentage_done); use_str = str; } off = ((win->len_x - x - 1) - (win->small_font_len_x * strlen(use_str))) / 2; draw_side_stats_bar(win, x, y, 0, percentage_done, 100, 1); draw_string_small_shadowed_zoomed(x+off+gx_adjust, y+gy_adjust, (unsigned char *)use_str, 1,1.0f,1.0f,1.0f,0.0f,0.0f,0.0f, win->current_scale); if (mouse_over_knowledge_bar) { use_str = (is_researching()) ?get_research_eta_str(str, sizeof(str)) : not_researching_str; draw_string_small_shadowed_zoomed(-win->small_font_len_x* (strlen(use_str)+0.5), y+gy_adjust, (unsigned char*)use_str, 1,1.0f,1.0f,1.0f,0.0f,0.0f,0.0f, win->current_scale); mouse_over_knowledge_bar = 0; } base_y_start -= knowledge_bar_height; } /* if the timer is visible, draw it */ base_y_start -= display_timer(win, base_y_start); /* Optionally display the stats bar. If the current window size does not provide enough room, display only some skills and allow scrolling to view the rest */ if(show_stats_in_hud && have_stats) { char str[20]; int box_x = (int)(0.5 + win->current_scale * 3); int text_x = box_x + ((win->len_x - box_x - 1) - (7 * win->small_font_len_x))/2; int thestat; int y = 0; int skill_modifier; // trade the number of quickbar slots if there is not enough space for the minimum stats calc_statbar_shown(base_y_start + win->pos_y); #ifdef OPENGL_TRACE CHECK_GL_ERRORS(); #endif //OPENGL_TRACE for (thestat=0; thestat<NUM_WATCH_STAT-1; thestat++) { int hover_offset = 0; /* skill skills until we have the skill displayed first */ if (thestat < first_disp_stat) continue; /* end now if we have display all we can */ if (thestat > (first_disp_stat+num_disp_stat-1)) break; if (show_statbars_in_hud) draw_side_stats_bar(win, box_x, y+1, statsinfo[thestat].skillattr->base, *statsinfo[thestat].exp, *statsinfo[thestat].next_lev, 0); safe_snprintf(str,sizeof(str),"%-3s %3i", statsinfo[thestat].skillnames->shortname, statsinfo[thestat].skillattr->base ); if (statsinfo[thestat].is_selected == 1) draw_string_small_shadowed_zoomed(text_x+gx_adjust, y+gy_adjust, (unsigned char*)str, 1,0.77f, 0.57f, 0.39f,0.0f,0.0f,0.0f, win->current_scale); else draw_string_small_shadowed_zoomed(text_x+gx_adjust, y+gy_adjust, (unsigned char*)str, 1,1.0f,1.0f,1.0f,0.0f,0.0f,0.0f, win->current_scale); if((thestat!=NUM_WATCH_STAT-2) && floatingmessages_enabled && (skill_modifier = statsinfo[thestat].skillattr->cur - statsinfo[thestat].skillattr->base) != 0){ safe_snprintf(str,sizeof(str),"%+i",skill_modifier); hover_offset = strlen(str)+1; if(skill_modifier > 0){ draw_string_small_shadowed_zoomed(-win->small_font_len_x * (strlen(str)+0.5), y+gy_adjust, (unsigned char*)str, 1,0.3f, 1.0f, 0.3f,0.0f,0.0f,0.0f, win->current_scale); } else { draw_string_small_shadowed_zoomed(-win->small_font_len_x * (strlen(str)+0.5), y+gy_adjust, (unsigned char*)str, 1,1.0f, 0.1f, 0.2f,0.0f,0.0f,0.0f, win->current_scale); } } /* if the mouse is over the stat bar, draw the XP remaining */ if (stat_mouse_is_over == thestat) { safe_snprintf(str,sizeof(str),"%li",(*statsinfo[thestat].next_lev - *statsinfo[thestat].exp)); draw_string_small_shadowed_zoomed(-win->small_font_len_x*(strlen(str)+0.5+hover_offset), y+gy_adjust, (unsigned char*)str, 1,1.0f,1.0f,1.0f,0.0f,0.0f,0.0f, win->current_scale); stat_mouse_is_over = -1; } y+=side_stats_bar_height; } base_y_start -= y; } // check if we need to resize the window if (base_y_start != 0) init_misc_display(); { static int last_window_width = -1; static int last_window_height = -1; static int last_hud_x = -1; if (window_width != last_window_width || window_height != last_window_height || last_hud_x != hud_x) { reset_cm_regions(); last_window_width = window_width; last_window_height = window_height; last_hud_x = hud_x; } } #ifdef OPENGL_TRACE CHECK_GL_ERRORS(); #endif //OPENGL_TRACE return 1; }
void tm990189_state::tm990_189_v(machine_config &config) { /* basic machine hardware */ TMS9980A(config, m_tms9980a, 8_MHz_XTAL); m_tms9980a->set_addrmap(AS_PROGRAM, &tm990189_state::tm990_189_v_memmap); m_tms9980a->set_addrmap(AS_IO, &tm990189_state::tm990_189_cru_map); m_tms9980a->extop_cb().set(FUNC(tm990189_state::external_operation)); MCFG_MACHINE_START_OVERRIDE(tm990189_state, tm990_189_v ) MCFG_MACHINE_RESET_OVERRIDE(tm990189_state, tm990_189_v ) /* video hardware */ tms9918_device &vdp(TMS9918(config, "tms9918", XTAL(10'738'635))); vdp.set_screen("screen"); vdp.set_vram_size(0x4000); SCREEN(config, "screen", SCREEN_TYPE_RASTER); config.set_default_layout(layout_tm990189v); /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.50); /* one two-level buzzer */ /* Devices */ CASSETTE(config, "cassette", 0).add_route(ALL_OUTPUTS, "mono", 0.25); TMS9901(config, m_tms9901_usr, 8_MHz_XTAL / 4); m_tms9901_usr->p_out_cb(0).set(FUNC(tm990189_state::usr9901_led0_w)); m_tms9901_usr->p_out_cb(1).set(FUNC(tm990189_state::usr9901_led1_w)); m_tms9901_usr->p_out_cb(2).set(FUNC(tm990189_state::usr9901_led2_w)); m_tms9901_usr->p_out_cb(3).set(FUNC(tm990189_state::usr9901_led3_w)); m_tms9901_usr->intlevel_cb().set(FUNC(tm990189_state::usr9901_interrupt_callback)); TMS9901(config, m_tms9901_sys, 8_MHz_XTAL / 4); m_tms9901_sys->read_cb().set(FUNC(tm990189_state::sys9901_r)); m_tms9901_sys->p_out_cb(0).set(FUNC(tm990189_state::sys9901_digitsel0_w)); m_tms9901_sys->p_out_cb(1).set(FUNC(tm990189_state::sys9901_digitsel1_w)); m_tms9901_sys->p_out_cb(2).set(FUNC(tm990189_state::sys9901_digitsel2_w)); m_tms9901_sys->p_out_cb(3).set(FUNC(tm990189_state::sys9901_digitsel3_w)); m_tms9901_sys->p_out_cb(4).set(FUNC(tm990189_state::sys9901_segment0_w)); m_tms9901_sys->p_out_cb(5).set(FUNC(tm990189_state::sys9901_segment1_w)); m_tms9901_sys->p_out_cb(6).set(FUNC(tm990189_state::sys9901_segment2_w)); m_tms9901_sys->p_out_cb(7).set(FUNC(tm990189_state::sys9901_segment3_w)); m_tms9901_sys->p_out_cb(8).set(FUNC(tm990189_state::sys9901_segment4_w)); m_tms9901_sys->p_out_cb(9).set(FUNC(tm990189_state::sys9901_segment5_w)); m_tms9901_sys->p_out_cb(10).set(FUNC(tm990189_state::sys9901_segment6_w)); m_tms9901_sys->p_out_cb(11).set(FUNC(tm990189_state::sys9901_segment7_w)); m_tms9901_sys->p_out_cb(12).set(FUNC(tm990189_state::sys9901_dsplytrgr_w)); m_tms9901_sys->p_out_cb(13).set(FUNC(tm990189_state::sys9901_shiftlight_w)); m_tms9901_sys->p_out_cb(14).set(FUNC(tm990189_state::sys9901_spkrdrive_w)); m_tms9901_sys->p_out_cb(15).set(FUNC(tm990189_state::sys9901_tapewdata_w)); m_tms9901_sys->intlevel_cb().set(FUNC(tm990189_state::sys9901_interrupt_callback)); TMS9902(config, m_tms9902, 8_MHz_XTAL / 4); m_tms9902->xmit_cb().set(FUNC(tm990189_state::xmit_callback)); // called when a character is transmitted; TM990_189_RS232(config, "rs232", 0, m_tms9902); timer_device &display_timer(TIMER(config, "display_timer")); display_timer.configure_periodic(FUNC(tm990189_state::display_callback), attotime::from_hz(30)); display_timer.set_start_delay(attotime::from_msec(150)); }