BESM6: Translated comments in besm6_panel.c

This commit is contained in:
Leo Broukhis 2015-01-07 20:58:06 -08:00
parent 8dea6828fe
commit 1787947299

View file

@ -79,9 +79,9 @@ static const int regnum[] = {
static SDL_Surface *screen; static SDL_Surface *screen;
/* /*
* Рисование текста в кодировке UTF-8, с антиалиасингом. * Drawing antialiased text in UTF-8 encoding.
* Параметр halign задаёт выравнивание по горизонтали. * The halign parameter controls horizontal alignment.
* Цвета заданы глобальными переменными foreground и background. * Foreground/background colors are taken from global variables.
*/ */
static void render_utf8 (TTF_Font *font, int x, int y, int halign, char *message) static void render_utf8 (TTF_Font *font, int x, int y, int halign, char *message)
{ {
@ -134,7 +134,7 @@ static SDL_Surface *sprite_from_data (int width, int height,
} }
/* /*
* Рисуем неонку. * Drawing a neon light.
*/ */
static void draw_lamp (int left, int top, int on) static void draw_lamp (int left, int top, int on)
{ {
@ -189,7 +189,7 @@ static void draw_lamp (int left, int top, int on)
} }
/* /*
* Отрисовка лампочек БРЗ. * Drawing index (modifier) registers. They form two groups.
*/ */
static void draw_modifiers_periodic (int group, int left, int top) static void draw_modifiers_periodic (int group, int left, int top)
{ {
@ -208,7 +208,7 @@ static void draw_modifiers_periodic (int group, int left, int top)
} }
/* /*
* Отрисовка лампочек ГРП и МГРП. * Drawing the main interrupt register and its mask.
*/ */
static void draw_grp_periodic (int top) static void draw_grp_periodic (int top)
{ {
@ -227,7 +227,7 @@ static void draw_grp_periodic (int top)
} }
/* /*
* Отрисовка лампочек БРЗ. * Drawing the data cache registers.
*/ */
static void draw_brz_periodic (int top) static void draw_brz_periodic (int top)
{ {
@ -246,7 +246,7 @@ static void draw_brz_periodic (int top)
} }
/* /*
* Отрисовка статичной части регистров-модификаторов. * Drawing the static part of the modifier register area.
*/ */
static void draw_modifiers_static (int group, int left, int top) static void draw_modifiers_static (int group, int left, int top)
{ {
@ -257,7 +257,7 @@ static void draw_modifiers_static (int group, int left, int top)
background = black; background = black;
foreground = cyan; foreground = cyan;
/* Оттеняем группы разрядов. */ /* Visually separating groups of bits */
color = grey.r << 16 | grey.g << 8 | grey.b; color = grey.r << 16 | grey.g << 8 | grey.b;
for (x=3; x<15; x+=3) { for (x=3; x<15; x+=3) {
area.x = left + 74 + x*STEPX; area.x = left + 74 + x*STEPX;
@ -266,14 +266,14 @@ static void draw_modifiers_static (int group, int left, int top)
area.h = 8*STEPY + 2; area.h = 8*STEPY + 2;
SDL_FillRect (screen, &area, color); SDL_FillRect (screen, &area, color);
} }
/* Названия регистров. */ /* Register names */
for (y=0; y<8; ++y) { for (y=0; y<8; ++y) {
reg = regnum [y + group*8]; reg = regnum [y + group*8];
sprintf (message, "М%2o", reg); sprintf (message, "М%2o", reg);
render_utf8 (font_big, left, top + 24 + y*STEPY, 1, message); render_utf8 (font_big, left, top + 24 + y*STEPY, 1, message);
old_M [reg] = ~0; old_M [reg] = ~0;
} }
/* Номера битов. */ /* Bit numbers */
for (x=0; x<15; ++x) { for (x=0; x<15; ++x) {
sprintf (message, "%d", 15-x); sprintf (message, "%d", 15-x);
render_utf8 (font_small, left+82 + x*STEPX, render_utf8 (font_small, left+82 + x*STEPX,
@ -282,7 +282,7 @@ static void draw_modifiers_static (int group, int left, int top)
} }
/* /*
* Отрисовка статичной части регистров ГРП и МГРП. * Drawing the static part of the interrupt register area.
*/ */
static void draw_grp_static (int top) static void draw_grp_static (int top)
{ {
@ -293,7 +293,7 @@ static void draw_grp_static (int top)
background = black; background = black;
foreground = cyan; foreground = cyan;
/* Оттеняем группы разрядов. */ /* Visually separating groups of bits */
color = grey.r << 16 | grey.g << 8 | grey.b; color = grey.r << 16 | grey.g << 8 | grey.b;
for (x=3; x<48; x+=3) { for (x=3; x<48; x+=3) {
area.x = 98 + x*STEPX; area.x = 98 + x*STEPX;
@ -302,12 +302,12 @@ static void draw_grp_static (int top)
area.h = 2*STEPY + 2; area.h = 2*STEPY + 2;
SDL_FillRect (screen, &area, color); SDL_FillRect (screen, &area, color);
} }
/* Названия регистров. */ /* Register names */
for (y=0; y<2; ++y) { for (y=0; y<2; ++y) {
render_utf8 (font_big, 24, top + 24 + y*STEPY, 1, y ? "МГРП" : "ГРП"); render_utf8 (font_big, 24, top + 24 + y*STEPY, 1, y ? "МГРП" : "ГРП");
old_GRP[y] = ~0; old_GRP[y] = ~0;
} }
/* Номера битов. */ /* Bit numbers */
for (x=0; x<48; ++x) { for (x=0; x<48; ++x) {
sprintf (message, "%d", 48-x); sprintf (message, "%d", 48-x);
render_utf8 (font_small, 106 + x*STEPX, render_utf8 (font_small, 106 + x*STEPX,
@ -316,7 +316,7 @@ static void draw_grp_static (int top)
} }
/* /*
* Отрисовка статичной части регистров БРЗ. * Drawing the static part of the cache register area
*/ */
static void draw_brz_static (int top) static void draw_brz_static (int top)
{ {
@ -327,7 +327,7 @@ static void draw_brz_static (int top)
background = black; background = black;
foreground = cyan; foreground = cyan;
/* Оттеняем группы разрядов. */ /* Visually separating groups of bits */
color = grey.r << 16 | grey.g << 8 | grey.b; color = grey.r << 16 | grey.g << 8 | grey.b;
for (x=3; x<48; x+=3) { for (x=3; x<48; x+=3) {
area.x = 98 + x*STEPX; area.x = 98 + x*STEPX;
@ -336,7 +336,7 @@ static void draw_brz_static (int top)
area.h = 8*STEPY + 2; area.h = 8*STEPY + 2;
SDL_FillRect (screen, &area, color); SDL_FillRect (screen, &area, color);
} }
/* Названия регистров. */ /* Register names */
for (y=7; y>=0; --y) { for (y=7; y>=0; --y) {
sprintf (message, "БРЗ %d", 7-y); sprintf (message, "БРЗ %d", 7-y);
render_utf8 (font_big, 24, top + 24 + y*STEPY, 1, message); render_utf8 (font_big, 24, top + 24 + y*STEPY, 1, message);
@ -345,7 +345,7 @@ static void draw_brz_static (int top)
} }
/* /*
* Закрываем графическое окно. * Closing the graphical window.
*/ */
void besm6_close_panel (void) void besm6_close_panel (void)
{ {
@ -364,7 +364,7 @@ static SDL_Texture *sdlTexture;
/* /*
* Начальная инициализация графического окна и шрифтов. * Initializing of the graphical window and the fonts.
*/ */
static void init_panel (void) static void init_panel (void)
{ {
@ -422,7 +422,7 @@ static void init_panel (void)
SDL_TEXTUREACCESS_STATIC, SDL_TEXTUREACCESS_STATIC,
WIDTH, HEIGHT); WIDTH, HEIGHT);
/* Отрисовка статичной части панели БЭСМ-6. */ /* Drawing the static part of the BESM-6 panel */
draw_modifiers_static (0, 24, 10); draw_modifiers_static (0, 24, 10);
draw_modifiers_static (1, 400, 10); draw_modifiers_static (1, 400, 10);
draw_grp_static (180); draw_grp_static (180);
@ -438,7 +438,7 @@ static void init_panel (void)
void (*sim_vm_init)() = init_panel; void (*sim_vm_init)() = init_panel;
/* /*
* Обновляем графическое окно. * Refreshing the window.
*/ */
void besm6_draw_panel (void) void besm6_draw_panel (void)
{ {
@ -447,7 +447,7 @@ void besm6_draw_panel (void)
if (! screen) if (! screen)
return; return;
/* Периодическая отрисовка: мигание лампочек. */ /* Do the blinkenlights */
draw_modifiers_periodic (0, 24, 10); draw_modifiers_periodic (0, 24, 10);
draw_modifiers_periodic (1, 400, 10); draw_modifiers_periodic (1, 400, 10);
draw_grp_periodic (180); draw_grp_periodic (180);
@ -467,7 +467,7 @@ void besm6_draw_panel (void)
#else #else
/* /*
* Начальная инициализация графического окна и шрифтов. * Initializing of the graphical window and the fonts.
*/ */
static void init_panel (void) static void init_panel (void)
{ {
@ -506,7 +506,7 @@ static void init_panel (void)
} }
atexit (besm6_close_panel); atexit (besm6_close_panel);
/* Отрисовка статичной части панели БЭСМ-6. */ /* Drawing the static part of the BESM-6 panel */
draw_modifiers_static (0, 24, 10); draw_modifiers_static (0, 24, 10);
draw_modifiers_static (1, 400, 10); draw_modifiers_static (1, 400, 10);
draw_grp_static (180); draw_grp_static (180);
@ -519,14 +519,14 @@ static void init_panel (void)
void (*sim_vm_init)() = init_panel; void (*sim_vm_init)() = init_panel;
/* /*
* Обновляем графическое окно. * Refreshing the window
*/ */
void besm6_draw_panel () void besm6_draw_panel ()
{ {
if (! screen) if (! screen)
return; return;
/* Периодическая отрисовка: мигание лампочек. */ /* Do the blinkenlights */
draw_modifiers_periodic (0, 24, 10); draw_modifiers_periodic (0, 24, 10);
draw_modifiers_periodic (1, 400, 10); draw_modifiers_periodic (1, 400, 10);
draw_grp_periodic (180); draw_grp_periodic (180);