BESM6: Implemented SET CPU PANEL/NOPANEL.
This commit is contained in:
parent
c5cb826d00
commit
793227f060
3 changed files with 45 additions and 48 deletions
|
@ -134,6 +134,8 @@ MTAB cpu_mod[] = {
|
||||||
{ MTAB_XTD|MTAB_VDV, 0, "IDLE", "IDLE", &sim_set_idle, &sim_show_idle, NULL, "Display idle detection mode" },
|
{ MTAB_XTD|MTAB_VDV, 0, "IDLE", "IDLE", &sim_set_idle, &sim_show_idle, NULL, "Display idle detection mode" },
|
||||||
{ MTAB_XTD|MTAB_VDV, 0, NULL, "NOIDLE", &sim_clr_idle, NULL, NULL, "Disables idle detection" },
|
{ MTAB_XTD|MTAB_VDV, 0, NULL, "NOIDLE", &sim_clr_idle, NULL, NULL, "Disables idle detection" },
|
||||||
{ MTAB_XTD|MTAB_VDV, 0, NULL, "REQ", &cpu_req, NULL, NULL, "Sends a request interrupt" },
|
{ MTAB_XTD|MTAB_VDV, 0, NULL, "REQ", &cpu_req, NULL, NULL, "Sends a request interrupt" },
|
||||||
|
{ MTAB_XTD|MTAB_VDV, 0, "PANEL", "PANEL", &besm6_init_panel, NULL, NULL, "Displays graphical panel" },
|
||||||
|
{ MTAB_XTD|MTAB_VDV, 0, NULL, "NOPANEL", &besm6_close_panel, NULL, NULL, "Closes graphical panel" },
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -356,7 +356,9 @@ void besm6_debug (const char *fmt, ...);
|
||||||
t_stat fprint_sym (FILE *of, t_addr addr, t_value *val,
|
t_stat fprint_sym (FILE *of, t_addr addr, t_value *val,
|
||||||
UNIT *uptr, int32 sw);
|
UNIT *uptr, int32 sw);
|
||||||
void besm6_draw_panel (void);
|
void besm6_draw_panel (void);
|
||||||
|
t_stat besm6_init_panel (UNIT *u, int32 val, char *cptr, void *desc);
|
||||||
|
t_stat besm6_close_panel (UNIT *u, int32 val, char *cptr, void *desc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Арифметика.
|
* Арифметика.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -347,13 +347,14 @@ static void draw_brz_static (int top)
|
||||||
/*
|
/*
|
||||||
* Closing the graphical window.
|
* Closing the graphical window.
|
||||||
*/
|
*/
|
||||||
void besm6_close_panel (void)
|
t_stat besm6_close_panel (UNIT *u, int32 val, char *cptr, void *desc)
|
||||||
{
|
{
|
||||||
if (! screen)
|
if (! screen)
|
||||||
return;
|
return SCPE_NOTATT;
|
||||||
TTF_Quit();
|
TTF_Quit();
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
screen = 0;
|
screen = 0;
|
||||||
|
return SCPE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SDL_MAJOR_VERSION == 2
|
#if SDL_MAJOR_VERSION == 2
|
||||||
|
@ -366,25 +367,22 @@ static SDL_Texture *sdlTexture;
|
||||||
/*
|
/*
|
||||||
* Initializing of the graphical window and the fonts.
|
* Initializing of the graphical window and the fonts.
|
||||||
*/
|
*/
|
||||||
static void init_panel (void)
|
t_stat besm6_init_panel (UNIT *u, int32 val, char *cptr, void *desc)
|
||||||
{
|
{
|
||||||
if (sim_switches & SWMASK('Q'))
|
if (screen)
|
||||||
return;
|
return SCPE_ALATT;
|
||||||
|
|
||||||
/* Initialize SDL subsystems - in this case, only video. */
|
/* Initialize SDL subsystems - in this case, only video. */
|
||||||
if (SDL_Init (SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init (SDL_INIT_VIDEO) < 0) {
|
||||||
fprintf (stderr, "SDL: unable to init: %s\n",
|
return sim_messagef (SCPE_OPENERR, "SDL: unable to init: %s\n",
|
||||||
SDL_GetError ());
|
SDL_GetError ());
|
||||||
exit (1);
|
|
||||||
}
|
}
|
||||||
sdlWindow = SDL_CreateWindow ("BESM-6 panel",
|
sdlWindow = SDL_CreateWindow ("BESM-6 panel",
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_UNDEFINED,
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_UNDEFINED,
|
||||||
WIDTH, HEIGHT, 0 /* regular window */);
|
WIDTH, HEIGHT, 0 /* regular window */);
|
||||||
if (! sdlWindow) {
|
if (! sdlWindow) {
|
||||||
fprintf (stderr, "SDL: unable to set %dx%dx%d mode: %s\n",
|
return sim_messagef (SCPE_OPENERR, "SDL: unable to set %dx%dx%d mode: %s\n",
|
||||||
WIDTH, HEIGHT, DEPTH, SDL_GetError ());
|
WIDTH, HEIGHT, DEPTH, SDL_GetError ());
|
||||||
exit (1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, 0);
|
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, 0);
|
||||||
|
@ -394,22 +392,21 @@ static void init_panel (void)
|
||||||
|
|
||||||
/* Initialize the TTF library */
|
/* Initialize the TTF library */
|
||||||
if (TTF_Init() < 0) {
|
if (TTF_Init() < 0) {
|
||||||
fprintf (stderr, "SDL: couldn't initialize TTF: %s\n",
|
t_stat ret = sim_messagef(SCPE_OPENERR, "SDL: couldn't initialize TTF: %s\n",
|
||||||
SDL_GetError());
|
SDL_GetError());
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
exit (1);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open the font file with the requested point size */
|
/* Open the font file with the requested point size */
|
||||||
font_big = TTF_OpenFont (QUOTE(FONTFILE), 16);
|
font_big = TTF_OpenFont (QUOTE(FONTFILE), 16);
|
||||||
font_small = TTF_OpenFont (QUOTE(FONTFILE), 9);
|
font_small = TTF_OpenFont (QUOTE(FONTFILE), 9);
|
||||||
if (! font_big || ! font_small) {
|
if (! font_big || ! font_small) {
|
||||||
fprintf(stderr, "SDL: couldn't load font %s: %s\n",
|
t_stat ret = sim_messagef(SCPE_OPENERR, "SDL: couldn't load font %s: %s\n",
|
||||||
QUOTE(FONTFILE), SDL_GetError());
|
QUOTE(FONTFILE), SDL_GetError());
|
||||||
besm6_close_panel();
|
besm6_close_panel(u, val, cptr, desc);
|
||||||
exit (1);
|
return ret;
|
||||||
}
|
}
|
||||||
atexit (besm6_close_panel);
|
|
||||||
|
|
||||||
screen = SDL_CreateRGBSurface(0, WIDTH, HEIGHT, 32,
|
screen = SDL_CreateRGBSurface(0, WIDTH, HEIGHT, 32,
|
||||||
0x00FF0000,
|
0x00FF0000,
|
||||||
|
@ -428,6 +425,8 @@ static void init_panel (void)
|
||||||
draw_grp_static (180);
|
draw_grp_static (180);
|
||||||
draw_brz_static (230);
|
draw_brz_static (230);
|
||||||
|
|
||||||
|
besm6_draw_panel();
|
||||||
|
|
||||||
/* Tell SDL to update the whole screen */
|
/* Tell SDL to update the whole screen */
|
||||||
SDL_UpdateTexture(sdlTexture, NULL, screen->pixels, screen->pitch);
|
SDL_UpdateTexture(sdlTexture, NULL, screen->pixels, screen->pitch);
|
||||||
SDL_RenderClear(sdlRenderer);
|
SDL_RenderClear(sdlRenderer);
|
||||||
|
@ -435,8 +434,6 @@ static void init_panel (void)
|
||||||
SDL_RenderPresent (sdlRenderer);
|
SDL_RenderPresent (sdlRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void (*sim_vm_init)() = init_panel;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Refreshing the window.
|
* Refreshing the window.
|
||||||
*/
|
*/
|
||||||
|
@ -459,9 +456,9 @@ void besm6_draw_panel (void)
|
||||||
SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, NULL);
|
SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, NULL);
|
||||||
SDL_RenderPresent (sdlRenderer);
|
SDL_RenderPresent (sdlRenderer);
|
||||||
|
|
||||||
/* Exit SIMH when window closed.*/
|
/* Close the panel window */
|
||||||
if (SDL_PollEvent (&event) && event.type == SDL_QUIT)
|
if (SDL_PollEvent (&event) && event.type == SDL_QUIT)
|
||||||
longjmp (cpu_halt, SCPE_STOP);
|
besm6_close_panel(&cpu_unit, 0, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -469,42 +466,38 @@ void besm6_draw_panel (void)
|
||||||
/*
|
/*
|
||||||
* Initializing of the graphical window and the fonts.
|
* Initializing of the graphical window and the fonts.
|
||||||
*/
|
*/
|
||||||
static void init_panel (void)
|
t_stat besm6_init_panel (UNIT *u, int32 val, char *cptr, void *desc)
|
||||||
{
|
{
|
||||||
if (sim_switches & SWMASK('Q'))
|
if (screen)
|
||||||
return;
|
return SCPE_ALATT;
|
||||||
|
|
||||||
/* Initialize SDL subsystems - in this case, only video. */
|
/* Initialize SDL subsystems - in this case, only video. */
|
||||||
if (SDL_Init (SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init (SDL_INIT_VIDEO) < 0) {
|
||||||
fprintf (stderr, "SDL: unable to init: %s\n",
|
return sim_messagef (SCPE_OPENERR, "SDL: unable to init: %s\n",
|
||||||
SDL_GetError ());
|
SDL_GetError ());
|
||||||
exit (1);
|
|
||||||
}
|
}
|
||||||
screen = SDL_SetVideoMode (WIDTH, HEIGHT, DEPTH, SDL_SWSURFACE);
|
screen = SDL_SetVideoMode (WIDTH, HEIGHT, DEPTH, SDL_SWSURFACE);
|
||||||
if (! screen) {
|
if (! screen) {
|
||||||
fprintf (stderr, "SDL: unable to set %dx%dx%d mode: %s\n",
|
return sim_messagef (SCPE_OPENERR, "SDL: unable to set %dx%dx%d mode: %s\n",
|
||||||
WIDTH, HEIGHT, DEPTH, SDL_GetError ());
|
WIDTH, HEIGHT, DEPTH, SDL_GetError ());
|
||||||
exit (1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the TTF library */
|
/* Initialize the TTF library */
|
||||||
if (TTF_Init() < 0) {
|
if (TTF_Init() < 0) {
|
||||||
fprintf (stderr, "SDL: couldn't initialize TTF: %s\n",
|
t_stat ret = sim_messagef(SCPE_OPENERR, "SDL: couldn't initialize TTF: %s\n",
|
||||||
SDL_GetError());
|
SDL_GetError());
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
exit (1);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open the font file with the requested point size */
|
/* Open the font file with the requested point size */
|
||||||
font_big = TTF_OpenFont (QUOTE(FONTFILE), 16);
|
font_big = TTF_OpenFont (QUOTE(FONTFILE), 16);
|
||||||
font_small = TTF_OpenFont (QUOTE(FONTFILE), 9);
|
font_small = TTF_OpenFont (QUOTE(FONTFILE), 9);
|
||||||
if (! font_big || ! font_small) {
|
if (! font_big || ! font_small) {
|
||||||
fprintf(stderr, "SDL: couldn't load font %s: %s\n",
|
t_stat ret = sim_messagef(SCPE_OPENERR, "SDL: couldn't load font %s: %s\n",
|
||||||
QUOTE(FONTFILE), TTF_GetError());
|
QUOTE(FONTFILE), SDL_GetError());
|
||||||
besm6_close_panel();
|
besm6_close_panel(u, val, cptr, desc);
|
||||||
exit (1);
|
return ret;
|
||||||
}
|
}
|
||||||
atexit (besm6_close_panel);
|
|
||||||
|
|
||||||
/* Drawing the static part of the BESM-6 panel */
|
/* Drawing the static part of the BESM-6 panel */
|
||||||
draw_modifiers_static (0, 24, 10);
|
draw_modifiers_static (0, 24, 10);
|
||||||
|
@ -512,17 +505,18 @@ static void init_panel (void)
|
||||||
draw_grp_static (180);
|
draw_grp_static (180);
|
||||||
draw_brz_static (230);
|
draw_brz_static (230);
|
||||||
|
|
||||||
|
besm6_draw_panel();
|
||||||
|
|
||||||
/* Tell SDL to update the whole screen */
|
/* Tell SDL to update the whole screen */
|
||||||
SDL_UpdateRect (screen, 0, 0, WIDTH, HEIGHT);
|
SDL_UpdateRect (screen, 0, 0, WIDTH, HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void (*sim_vm_init)() = init_panel;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Refreshing the window
|
* Refreshing the window
|
||||||
*/
|
*/
|
||||||
void besm6_draw_panel ()
|
void besm6_draw_panel ()
|
||||||
{
|
{
|
||||||
|
SDL_Event event;
|
||||||
if (! screen)
|
if (! screen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -535,10 +529,9 @@ void besm6_draw_panel ()
|
||||||
/* Tell SDL to update the whole screen */
|
/* Tell SDL to update the whole screen */
|
||||||
SDL_UpdateRect (screen, 0, 0, WIDTH, HEIGHT);
|
SDL_UpdateRect (screen, 0, 0, WIDTH, HEIGHT);
|
||||||
|
|
||||||
/* Exit SIMH when window closed.*/
|
/* Close the panel window */
|
||||||
SDL_Event event;
|
|
||||||
if (SDL_PollEvent (&event) && event.type == SDL_QUIT)
|
if (SDL_PollEvent (&event) && event.type == SDL_QUIT)
|
||||||
longjmp (cpu_halt, SCPE_STOP);
|
besm6_close_panel(&cpu_unit, 0, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SDL_MAJOR_VERSION */
|
#endif /* SDL_MAJOR_VERSION */
|
||||||
|
|
Loading…
Add table
Reference in a new issue