1 /************************************************************************/
2 /* */
3 /* ���̤�ɽ�� */
4 /* */
5 /************************************************************************/
6
7 #include <string.h>
8
9 #include "quasi88.h"
10 #include "initval.h"
11 #include "screen.h"
12 #include "screen-func.h"
13 #include "graph.h"
14
15 #include "crtcdmac.h"
16 #include "pc88main.h"
17
18 #include "status.h"
19 #include "suspend.h"
20
21 #include "intr.h"
22 #include "q8tk.h"
23
24 #include "pause.h" /* pause_event_focus_in_when_pause() */
25
26
27
28 PC88_PALETTE_T vram_bg_palette; /* OUT[52/54-5B] */
29 PC88_PALETTE_T vram_palette[8]; /* �Ƽ�ѥ�å� */
30
31 byte sys_ctrl; /* OUT[30] SystemCtrl */
32 byte grph_ctrl; /* OUT[31] GraphCtrl */
33 byte grph_pile; /* OUT[53] �Ť�碌 */
34
35
36
37 char screen_dirty_flag[ 0x4000*2 ]; /* �ᥤ���ΰ� ��ʬ���� */
38 int screen_dirty_all = TRUE; /* �ᥤ���ΰ� ���蹹�� */
39 int screen_dirty_palette = TRUE; /* ������ ���� */
40 int screen_dirty_status = FALSE; /* ���ơ������ΰ� ���� */
41 int screen_dirty_status_hide = FALSE; /* ���ơ������ΰ� �õ� */
42 int screen_dirty_status_show = FALSE; /* ���ơ������ΰ� �����*/
43 int screen_dirty_frame = TRUE; /* ���ΰ� ���� */
44
45
46
47 int frameskip_rate = DEFAULT_FRAMESKIP; /* ����ɽ���ι����ֳ� */
48 int monitor_analog = TRUE; /* ���ʥ���˥��� */
49 int use_auto_skip = TRUE; /* ��ư�ե졼�ॹ���å� */
50
51
52 static int do_skip_draw = FALSE; /* �����åפ��뤫? */
53 static int already_skip_draw = FALSE; /* �����åפ�����? */
54
55 static int skip_counter = 0; /* Ϣ³�����åפ����� */
56 static int skip_count_max = 15; /* ����ʾ�Ϣ³�����åפ�����
57 ��ö������Ū�����褹�� */
58
59 static int frame_counter = 0; /* �ե졼�ॹ���å��ѤΥ����� */
60
61
62
63 static int blink_ctrl_cycle = 1; /* ��������ɽ���ѤΥ����� */
64 static int blink_ctrl_counter = 0; /* �� */
65
66
67
68
69
70 /*CFG*/ int hide_mouse = FALSE; /* �ޥ��������ɤ��� */
71 /*CFG*/ int grab_mouse = FALSE; /* ����֤��뤫�ɤ��� */
72
73 /*CFG*/ int use_swcursor = FALSE; /* ��˥塼���ѥ�������ɽ��̵ͭ */
74 int now_swcursor; /* �������ѥ�������ɽ����? */
75
76
77
78
79 /*CFG*/ int use_interlace = 0; /* �����졼��ɽ�� */
80
81 static int enable_half_interp = FALSE; /* HALF��������ֲ�ǽ���ݤ� */
82 /*CFG*/ int use_half_interp = TRUE; /* HALF��������֤��� */
83 static int now_half_interp = FALSE; /* ���ߡ����䴰��ʤ鿿 */
84
85
86
87 typedef struct{ /* ���̥������Υꥹ�� */
88 int w, h;
89 } SCREEN_SIZE_TABLE;
90
91 static const SCREEN_SIZE_TABLE screen_size_tbl[ SCREEN_SIZE_END ] =
92 {
93 /* w h */
94 { 320, 200, }, /* SCREEN_SIZE_HALF 320x200 */
95 { 640, 400, }, /* SCREEN_SIZE_FULL 640x400 */
96 #ifdef SUPPORT_DOUBLE
97 { 1280, 800, }, /* SCREEN_SIZE_DOUBLE 1280x800*/
98 #endif
99 };
100
101
102 static int screen_size_max = SCREEN_SIZE_END - 1; /*�ѹ���ǽ�ʺ��祵����*/
103 static int screen_size_min = SCREEN_SIZE_HALF; /*�ѹ���ǽ�ʺǾ�������*/
104 /*CFG*/ int screen_size = SCREEN_SIZE_FULL; /*���̥��������� */
105 static int now_screen_size; /*�ºݤΡ����̥����� */
106
107
108 static int enable_fullscreen = 0; /* ������ɽ����ǽ���ɤ��� */
109 /*CFG*/ int use_fullscreen = FALSE; /* ������ɽ������ */
110 static int now_fullscreen = FALSE; /* ���ߡ�������ɽ����ʤ鿿 */
111
112
113 /*CFG*/ double mon_aspect = 0.0; /* ��˥����Υ����ڥ����� */
114
115
116 int WIDTH = 0; /* ����Хåե��������� */
117 int HEIGHT = 0; /* ����Хåե��ĥ����� */
118 int DEPTH = 8; /* ���ӥåȿ� (8 or 16 or 32) */
119 int SCREEN_W = 0; /* ���̲������� (320/640/1280) */
120 int SCREEN_H = 0; /* ���̽ĥ����� (200/400/800) */
121
122 int SCREEN_DX = 0; /* ������ɥ�����ȡ� */
123 int SCREEN_DY = 0; /* ���̥��ꥢ����ȤΥ��ե��å� */
124
125 char *screen_buf; /* ����Хåե���Ƭ */
126 char *screen_start; /* ������Ƭ */
127
128 static int screen_bx; /* �ܡ�����(��)���� x (�ɥå�) */
129 static int screen_by; /* �� y (�ɥå�) */
130
131
132
133 /*CFG*/ int status_fg = 0x000000; /* ���ơ��������ʿ� */
134 /*CFG*/ int status_bg = 0xd6d6d6; /* ���ơ������طʿ� */
135
136 static int enable_status = TRUE; /* ���ơ�����ɽ����ǽ���ɤ��� */
137 /*CFG*/ int show_status = TRUE; /* ���ơ�����ɽ��̵ͭ */
138 static int now_status = FALSE; /* ���ߡ����ơ�����ɽ����ʤ鿿 */
139
140 char *status_buf; /* ���ơ��������� ��Ƭ */
141 char *status_start[3]; /* ���ơ��������� ��Ƭ */
142 int status_sx[3]; /* ���ơ��������襵���� */
143 int status_sy[3];
144
145
146 Ulong color_pixel[16]; /* �������� */
147 Ulong color_half_pixel[16][16]; /* ���䴰���ο������� */
148 Ulong black_pixel; /* ��������� */
149 Ulong status_pixel[ STATUS_COLOR_END ]; /* ���ơ������ο������� */
150
151
152
153 static int screen_write_only; /* ���̥Хåե��ɽ��ԲĤʤ顢�� */
154
155 static void (*draw_start)(void); /* �������Υ�����Хå��ؿ� */
156 static void (*draw_finish)(void); /* �����Υ�����Хå��ؿ� */
157 static int dont_frameskip; /* �ե졼�ॹ���åػߤʤ顢�� */
158
159
160
161 static int drawn_count; /* fps���Ѥ������������� */
162
163 static int broken_mouse; /* �����ƥ�Υޥ���ɽ�����۾� */
164 static int auto_mouse; /* ���ǡ��ޥ�����ư�DZ����⡼�� */
165 static int auto_mouse_timer; /* ��ư�DZ����ޤǤλĤ���֥����ޡ� */
166 static int auto_grab; /* ���ǡ��ޥ�����ư����֥⡼�� */
167
168
169 enum {
170 SETUP_START,
171 SETUP_MOVE,
172 SETUP_TIMEUP,
173 SETUP_CLICK
174 };
175 static void screen_attr_setup(int stat);
176
177 static void check_half_interp(void);
178 static void trans_palette(PC88_PALETTE_T syspal[]);
179 static void set_vram2screen_list(void);
180 static void clear_all_screen(void);
181 static void put_image_all(void);
182
183 /***********************************************************************
184 * ���̽����ν��������λ
185 ************************************************************************/
186 static const T_GRAPH_SPEC *spec;
187
188 static int open_window(void);
189 static void open_window_or_exit(void);
190
screen_init(void)191 int screen_init(void)
192 {
193 int i;
194 int w, h, max, min;
195
196 status_init(); /* ���ơ�����ɽ���Υ������� */
197
198 spec = graph_init();
199 if (spec == NULL) {
200 return FALSE;
201 }
202
203
204 /* spec �ˤ�äơ�������ɥ��κ��硦�Ǿ������������ */
205
206 min = -1;
207 for (i = 0; i < SCREEN_SIZE_END; i++) {
208 if (i == SCREEN_SIZE_HALF && spec->forbid_half) { continue; }
209
210 if (spec->window_max_width >= screen_size_tbl[ i ].w &&
211 spec->window_max_height >= screen_size_tbl[ i ].h) {
212 min = i;
213 break;
214 }
215 }
216 max = -1;
217 for (i = SCREEN_SIZE_END - 1; i >= 0; i--) {
218 if (spec->window_max_width >= screen_size_tbl[ i ].w &&
219 spec->window_max_height >= screen_size_tbl[ i ].h) {
220 max = i;
221 break;
222 }
223 }
224 if (min < 0 || max < 0 || max < min) {
225 if (verbose_proc) printf(" Not found drawable window size (bug?)\n");
226 return FALSE;
227 }
228 screen_size_max = max;
229 screen_size_min = min;
230
231
232 /* spec �ˤ�äơ������̲�ǽ���ɤ�������� */
233
234 if (spec->forbid_half) { i = SCREEN_SIZE_FULL; }
235 else { i = SCREEN_SIZE_HALF; }
236
237 if (spec->fullscreen_max_width >= screen_size_tbl[ i ].w &&
238 spec->fullscreen_max_height >= screen_size_tbl[ i ].h) {
239 enable_fullscreen = TRUE;
240 } else {
241 enable_fullscreen = FALSE;
242 }
243
244
245
246 /* screen_size, WIDTH, HEIGHT �˥��ޥ�ɥ饤��ǻ��ꤷ��������ɥ���������
247 ���åȺѤߤʤΤǡ�������Ȥ˥ܡ�����(��)�Υ������Ф��� */
248
249 w = screen_size_tbl[ screen_size ].w;
250 h = screen_size_tbl[ screen_size ].h;
251
252 screen_bx = ((MAX(WIDTH, w) - w) / 2) & ~7; /* 8���ܿ� */
253 screen_by = ((MAX(HEIGHT, h) - h) / 2);
254
255 if (open_window()) {
256 clear_all_screen();
257 put_image_all();
258 return TRUE;
259 } else {
260 return FALSE;
261 }
262 }
263
264
screen_exit(void)265 void screen_exit(void)
266 {
267 graph_exit();
268 }
269
270
271
272 /*----------------------------------------------------------------------
273 * ������ɥ�������
274 *----------------------------------------------------------------------*/
275 static int added_color;
276 static unsigned long added_pixel[120+16];
277
278 #define SET_N_COLOR(n, rgb) \
279 color[ n ].red = ((rgb) >> 16) & 0xff; \
280 color[ n ].green = ((rgb) >> 8) & 0xff; \
281 color[ n ].blue = ((rgb) ) & 0xff; \
282
283 /*
284 �ʲ����ѿ��˴�Ť������̤����������ʲ����ѿ��åȤ���
285 use_fullscreen, enable_fullscreen �� now_fullscreen
286 screen_size , screen_size_max, screen_size_min
287 show_status �� now_status
288 screen_bx , screen_by
289 */
290
open_window(void)291 static int open_window(void)
292 {
293 int i, size, found = FALSE;
294 int w = 0, h = 0, status_displayable = FALSE;
295 const T_GRAPH_INFO *info;
296
297
298 added_color = 0;
299
300 if (enable_fullscreen == FALSE) { /* �������ԲĤʤ顢�����̻ؼ��ϵѲ� */
301 use_fullscreen = FALSE;
302 }
303
304
305 /* �ե륹�����ɽ������ǽ�ʥ��������礭���ۤ�����õ���Ф� */
306
307 if (use_fullscreen) {
308 for (size = screen_size; size >= screen_size_min; size--) {
309
310 for (i = 0; i < 3; i++) { /* 3�ѥ�����Υ������ˤƳ�ǧ */
311
312 w = screen_size_tbl[ size ].w;
313 h = screen_size_tbl[ size ].h;
314
315 switch (i) {
316 case 0: /* ���ꥵ���� (���ơ������ԲĤ���) */
317 if (screen_bx == 0 && screen_by == 0) { continue; }
318 w += screen_bx * 2;
319 h += screen_by * 2;
320 status_displayable = FALSE;
321 break;
322
323 case 1: /* ��Ŭ������ + ���ơ����� */
324 if (spec->forbid_status) { continue; }
325 w += (0) * 2;
326 h += STATUS_HEIGHT * 2;
327 status_displayable = TRUE;
328 break;
329
330 case 2: /* ��Ŭ������ (���ơ������Բ�) */
331 status_displayable = FALSE;
332 break;
333 }
334
335 if (w <= spec->fullscreen_max_width &&
336 h <= spec->fullscreen_max_height) {
337 found = TRUE;
338 break;
339 }
340 }
341 if (found) break;
342 }
343
344 if (found == FALSE) { /* ɽ����ǽ������̵���ʤ��������Բ� */
345 use_fullscreen = FALSE;
346 }
347 }
348
349
350 /* ������ɥ�ɽ����ɽ���ʲ�ǽ���������礭���ۤ�����õ���Ф� */
351
352 if (use_fullscreen == FALSE) {
353 for (size = screen_size; size >= screen_size_min; size--) {
354
355 for (i = 0; i < 4; i++) { /* 4�ѥ�����Υ������ˤƳ�ǧ */
356
357 w = screen_size_tbl[ size ].w;
358 h = screen_size_tbl[ size ].h;
359
360 switch (i) {
361 case 0: /* ���ꥵ���� + ���ơ����� */
362 if (screen_bx == 0 && screen_by == 0) { continue; }
363 w += screen_bx * 2;
364 h += screen_by * 2 + STATUS_HEIGHT;
365 status_displayable = TRUE;
366 break;
367
368 case 1: /* ���ꥵ���� (���ơ������Բ�) */
369 if (screen_bx == 0 && screen_by == 0) { continue; }
370 w += screen_bx * 2;
371 h += screen_by * 2;
372 status_displayable = FALSE;
373 break;
374
375 case 2: /* ��Ŭ������ + ���ơ����� */
376 w += 0;
377 h += STATUS_HEIGHT;
378 status_displayable = TRUE;
379 break;
380
381 case 3: /* ��Ŭ������ (���ơ������Բ�) */
382 status_displayable = FALSE;
383 break;
384 }
385
386 if (w <= spec->window_max_width &&
387 h <= spec->window_max_height) {
388 found = TRUE;
389 break;
390 }
391 }
392 if (found) break;
393 }
394
395 /* ���ơ�����ɽ������ǽ�ʥ����������Ĥ��ä����Ǥ⡢
396 ���ơ�����ɽ�����ʤ��ʤ�С�����ʬ�Υ������餷�Ƥ��� */
397 if (status_displayable) {
398 if (spec->forbid_status || show_status == FALSE) {
399 h -= STATUS_HEIGHT;
400 }
401 }
402 }
403
404
405 /* ����������ޤä��Τǡ����褤����̤��������� */
406
407 if (found == FALSE) { /* ����Ϥ��ꤨ�ʤ��ϥ�������ǰ�Τ���� */
408 size = screen_size_min;
409 w = screen_size_tbl[ size ].w;
410 h = screen_size_tbl[ size ].h;
411 status_displayable = FALSE;
412 }
413 now_screen_size = size;
414
415 info = graph_setup(w, h, use_fullscreen, (float)mon_aspect);
416
417 if (info) {
418
419 /* �ե륹�����ǡ����ơ�����ɽ������ǽ�ʥ����������ݤǤ�������ǧ */
420 if ((info->fullscreen) &&
421 (info->height >= screen_size_tbl[ size ].h + STATUS_HEIGHT * 2)) {
422 status_displayable = TRUE;
423 }
424
425 /* �����˥��ơ�����ɽ������ǽ���ɤ����ǽ�Ƚ�� */
426 if (status_displayable && (spec->forbid_status == FALSE)) {
427 enable_status = TRUE;
428 /* show_status �ϸ����ͤΤޤ� */
429 } else {
430 enable_status = FALSE;
431 show_status = FALSE;
432 }
433
434 /* ������������ */
435 WIDTH = info->byte_per_line / info->byte_per_pixel;
436 if (info->fullscreen) {
437 HEIGHT = info->height;
438 } else {
439 HEIGHT = info->height - ((show_status) ? STATUS_HEIGHT : 0);
440 }
441
442 SCREEN_W = screen_size_tbl[ size ].w;
443 SCREEN_H = screen_size_tbl[ size ].h;
444 SCREEN_DX = (info->width - SCREEN_W) / 2;
445 SCREEN_DY = (HEIGHT - SCREEN_H) / 2;
446
447 if (info->fullscreen) {
448 if (enable_status) {
449 HEIGHT -= STATUS_HEIGHT;
450 }
451 now_fullscreen = TRUE;
452 } else {
453 now_fullscreen = FALSE;
454 }
455
456 DEPTH = info->byte_per_pixel * 8;
457
458
459 /* �Ȥ��뿧�ο�������å� */
460 if (info->nr_color >= 144) { /* ���äѤ��Ȥ��� */
461 enable_half_interp = TRUE;
462
463 } else if (info->nr_color >= 24) { /* Ⱦʬ�⡼�ɤο���֤Ϥ��� */
464 enable_half_interp = FALSE;
465
466 } else if (info->nr_color >= 16) { /* ���ơ�����ɽ����ޤޤʤ��*/
467 enable_half_interp = FALSE;
468
469 } else { /* ������ʤ� */
470 return FALSE;
471 }
472
473 /* HALF���������ο��䴰̵ͭ������ */
474 check_half_interp();
475
476
477 /* �������Хåե��Ρ����賫�ϰ��֤����� */
478 screen_buf = (char *)info->buffer;
479 screen_start = &screen_buf[ (WIDTH*SCREEN_DY + SCREEN_DX)
480 * info->byte_per_pixel ];
481
482 /* ���ơ������ѤΥХåե��ʤɤ� */
483 status_sx[0] = info->width / 5;
484 status_sx[1] = info->width - status_sx[0]*2;
485 status_sx[2] = info->width / 5;
486
487 status_sy[0] =
488 status_sy[1] =
489 status_sy[2] = STATUS_HEIGHT - 2;
490
491 status_buf = &screen_buf[ WIDTH * HEIGHT * info->byte_per_pixel ];
492
493 /* ���ơ����������賫�ϰ��֤ϡ��Хåե��� 2�饤�� */
494 status_start[0]= status_buf + 2*(WIDTH * info->byte_per_pixel);
495 status_start[1]= status_start[0] + (status_sx[0]*info->byte_per_pixel);
496 status_start[2]= status_start[1] + (status_sx[1]*info->byte_per_pixel);
497
498
499 /* ���ơ������Ѥο��ԥ��������� */
500 if (info->nr_color >= 24) {
501 PC88_PALETTE_T color[8];
502 unsigned long pixel[8];
503
504 SET_N_COLOR( STATUS_BG, status_bg);
505 SET_N_COLOR( STATUS_FG, status_fg);
506 SET_N_COLOR( STATUS_BLACK, 0x000000 );
507 SET_N_COLOR( STATUS_WHITE, 0xffffff );
508 SET_N_COLOR( STATUS_RED, 0xff0000 );
509 SET_N_COLOR( STATUS_GREEN, 0x00ff00 );
510 SET_N_COLOR( 6, 0x000000 );
511 SET_N_COLOR( 7, 0xffffff );
512
513 graph_add_color(color, 8, pixel);
514
515 status_pixel[STATUS_BG ] = pixel[0];
516 status_pixel[STATUS_FG ] = pixel[1];
517 status_pixel[STATUS_BLACK] = pixel[2];
518 status_pixel[STATUS_WHITE] = pixel[3];
519 status_pixel[STATUS_RED ] = pixel[4];
520 status_pixel[STATUS_GREEN] = pixel[5];
521 black_pixel = pixel[6];
522
523 } else {
524 PC88_PALETTE_T syspal[16];
525 unsigned long black, white;
526
527 /* syspal[0]��[14] �Ϲ��� syspal[15] ���� */
528 memset(&syspal[0], 0x00, sizeof(PC88_PALETTE_T) * 15);
529 memset(&syspal[15], 0xff, sizeof(PC88_PALETTE_T));
530
531 /* ���ơ������Ѥο������ݤǤ��ʤ��Τǡ��Ȥꤢ����Ŭ���˿������ */
532 /* syspal[8] �ϥƥ����Ȥι��� syspal[15] �ϥƥ����Ȥ�������� */
533 trans_palette(syspal);
534
535 black = color_pixel[ 8];
536 white = color_pixel[15];
537
538 status_pixel[STATUS_BG ] = black;
539 status_pixel[STATUS_FG ] = white;
540 status_pixel[STATUS_BLACK] = black;
541 status_pixel[STATUS_WHITE] = white;
542 status_pixel[STATUS_RED ] = white;
543 status_pixel[STATUS_GREEN] = white;
544
545 black_pixel = black;
546 }
547
548 now_status = show_status;
549
550 screen_write_only = info->write_only;
551
552 draw_start = info->draw_start;
553 draw_finish = info->draw_finish;
554 dont_frameskip = info->dont_frameskip;
555
556
557 /* ž����ɽ���ؿ��Υꥹ�Ȥ����� */
558 set_vram2screen_list();
559
560
561 /* �����ƥ�Υޥ���ɽ������ */
562 broken_mouse = info->broken_mouse;
563
564 screen_switch();
565
566 /* ���ơ����������� */
567 status_setup(now_status);
568
569 return TRUE;
570 } else {
571 return FALSE;
572 }
573 }
574
575 /*
576 * ������ɥ��κ����������Ԥ����� exit
577 */
open_window_or_exit(void)578 static void open_window_or_exit(void)
579 {
580 if (open_window() == FALSE) {
581 fprintf(stderr,"Sorry : Graphic System Fatal Error !!!\n");
582
583 quasi88_exit(1);
584 }
585 }
586
587
588
589 /*----------------------------------------------------------------------
590 * HALF����������֤�̵ͭ���������
591 *----------------------------------------------------------------------*/
check_half_interp(void)592 static void check_half_interp(void)
593 {
594 if (now_screen_size == SCREEN_SIZE_HALF && /* ���� HALF�������� */
595 enable_half_interp && /* �ե��륿���ǽ�� */
596 use_half_interp) { /* ���䴰���Ƥ���ʤ� */
597
598 now_half_interp = TRUE;
599
600 } else {
601 now_half_interp = FALSE;
602 }
603 }
604
605
606
607
608
609
610
611 /***********************************************************************
612 * �⡼���ڤ��ؤ����Ρ��Ƽ������
613 ************************************************************************/
screen_switch(void)614 void screen_switch(void)
615 {
616 char *title;
617
618 /* �����ꥢ��������ν��� */
619
620 screen_set_dirty_frame(); /* ���ΰ� �����(==����) */
621 screen_set_dirty_palette(); /* ������ �����(==����) */
622
623 if (now_status) { /* ���ơ�����ɽ�� */
624
625 screen_set_dirty_status_show(); /* ���ơ������ΰ� ����� */
626
627 } else { /* ���ơ�������ɽ�� */
628
629 if (now_fullscreen && enable_status) { /* �����̤ʤ� */
630 screen_set_dirty_status_hide(); /* ���ơ������ΰ� �õ� */
631 } /* ������ɥ��ʤ�����ʤ� */
632
633 }
634
635 frameskip_counter_reset(); /* �������� */
636
637
638 /* �ޥ�����������ԡ��Ȥ����� */
639
640 screen_attr_setup(SETUP_START);
641
642
643 /* �����ƥ�Υޥ���ɽ�����۾�ޤ��ϥ�˥塼���ѥ���������Ѥξ�� */
644
645 if ((broken_mouse) ||
646 (! quasi88_is_exec() && /*now_fullscreen &&*/ use_swcursor)) {
647 now_swcursor = TRUE;
648 } else {
649 now_swcursor = FALSE;
650 }
651
652
653 /* ������ɥ������ȥ��ɽ�� */
654
655 if (quasi88_is_exec()) title = Q_TITLE " ver " Q_VERSION;
656 else if (quasi88_is_menu()) title = Q_TITLE " ver " Q_VERSION;
657 else if (quasi88_is_pause()) title = Q_TITLE " (PAUSE)";
658 else if (quasi88_is_monitor()) title = Q_TITLE " (MONITOR)";
659 else title = "";
660
661 graph_set_window_title(title);
662
663
664 /*
665 SDL���
666
667 �ե륹������������ (Win�ˤ�ȯ��)
668 ���֥�Хåե��ξ�硢�ޥ����������ɽ������ʤ���
669 ����Хåե��ǥϡ��ɥ����������ե����ξ�硢
670 �ޥ�����ON�ˤ����ִ֡��ޥ�����ɽ�����٤����֤˥��ߤ��Ĥ롩
671
672 ��
673 ��˥塼�������ܤ���������ʤΤǡ����եȥ�������������Ǥ��ޤ�����
674 */
675 }
676
677 /*-----------------------------------------------------------------------------
678 �ޥ���ɽ��������֡�������ԡ��Ȥ����ꤹ�롣
679
680 EMU MENU/PAUSE
681 �ޥ���ɽ�� �� ����ˤ�� ����
682 ����� �� ����ˤ�� ���ʤ�
683 ������ԡ��� ���� ����
684
685 �� EMU �ˤ����롢�ޥ���ɽ��������֤ϰʲ��Τ褦�ˤʤ롣
686
687 A �� ����֤��ʤ����ޥ���ɽ������
688 B �� ����֤��ʤ����ޥ���ɽ�����ʤ�
689 C �� ����֤��� ���ޥ���ɽ�����ʤ�
690
691 D �� ����֤��ʤ����ޥ���ɽ���ϡ���ư��Ƚ��
692
693 ������ɥ���
694 |�ޥ���ɽ������|�ޥ���ɽ�����ʤ�||�ޥ�����ưɽ��
695 ------------+--------------+----------------++--------------
696 ����֤��ʤ�| A | B || D
697 ------------+--------------+----------------++--------------
698 ����֤��� | C �� | C || C
699
700 �� ����֤��롿�ޥ���ɽ������ ���ȹ礻��̵��
701 ������ɥ�ü�ǥޥ�������ߤ���Τ��������ޤ����Ω�������ˤʤ���
702
703 �ե륹������
704 |�ޥ���ɽ������|�ޥ���ɽ�����ʤ�||�ޥ�����ưɽ��
705 ------------+--------------+----------------++--------------
706 ����֤��ʤ�| A �� | C �� || C
707 ------------+--------------+----------------++--------------
708 ����֤��� | C �� | C || C
709
710 �� ����֤��롿�ޥ���ɽ������ ���ȹ礻��̵��
711 ����ü�ǥޥ�������ߤ���Τ��������ޤ����Ω�������ˤʤ���
712 �� ����֤��ʤ����ޥ���ɽ������ ���ȹ礻�ϡ�ͭ��
713 ����ü�ǥޥ�������ߤ���Τ�����Win+SDL �ǥޥ���ǥ����ץ쥤�ξ��
714 �ޥ�������ߤ������٤Υǥ����ץ쥤�˰�ư���뤳�Ȥ�����餷����
715 �� ����֤��ʤ����ޥ���ɽ�����ʤ� ���ȹ礻��̵��
716 ����ü�ǥޥ�������ߤ��뤬���ޥ�����ɽ������ʤ��Τǡ��狼��ˤ���
717
718 -----------------------------------------------------------------------------*/
719
720 /*#define DEBUG_ALL_MOUSE_PATTERN*/ /* �ǥХå�(���ޥ���������ȹ礻��) */
721
722 #ifdef DEBUG_ALL_MOUSE_PATTERN
screen_attr_mouse_debug(void)723 int screen_attr_mouse_debug(void) { return TRUE; }
724 #else
screen_attr_mouse_debug(void)725 int screen_attr_mouse_debug(void) { return FALSE; }
726 #endif
727
728
729 #define AUTO_MOUSE_TIMEOUT (2 * 60)
730
731 /* �ޥ�����ư������ƤӽФ���� */
screen_attr_mouse_move(void)732 void screen_attr_mouse_move(void)
733 {
734 if (auto_mouse) {
735 if (auto_mouse_timer == 0) {
736 screen_attr_setup(SETUP_MOVE);
737 } else {
738 auto_mouse_timer = AUTO_MOUSE_TIMEOUT;
739 }
740 }
741 }
742
743 /* �ޥ����Υ���å����˸ƤӽФ���� */
screen_attr_mouse_click(void)744 void screen_attr_mouse_click(void)
745 {
746 if (auto_grab) {
747 screen_attr_setup(SETUP_CLICK);
748 auto_grab = FALSE;
749 }
750 }
751
752 /* 1/60sec��˸ƤӽФ���� */
screen_attr_update(void)753 static void screen_attr_update(void)
754 {
755 if (auto_mouse) {
756 if (auto_mouse_timer > 0) {
757 if (--auto_mouse_timer == 0) {
758 screen_attr_setup(SETUP_TIMEUP);
759 }
760 }
761 }
762 }
763
764 /* �ޥ���ɽ��������֡�������ԡ��Ȥ����ꤹ�� */
screen_attr_setup(int stat)765 static void screen_attr_setup(int stat)
766 {
767 int repeat; /* �����ȥ�ԡ��Ȥ�̵ͭ */
768 int mouse; /* �ޥ���ɽ����̵ͭ */
769 int grab; /* ����֤�̵ͭ */
770
771 if (stat == SETUP_START) {
772 auto_mouse = FALSE;
773 auto_mouse_timer = 0;
774 auto_grab = FALSE;
775 }
776
777
778 if (quasi88_is_exec()) {
779
780 repeat = FALSE;
781
782 #ifdef DEBUG_ALL_MOUSE_PATTERN /* �ǥХå���:���ƤΥޥ���������ȹ礻�� */
783 if (grab_mouse == UNGRAB_MOUSE){ grab = FALSE; }
784 else if (grab_mouse == GRAB_MOUSE) { grab = TRUE; }
785 else {
786 if (stat == SETUP_START) { grab = FALSE; auto_grab = TRUE; }
787 else if (stat == SETUP_CLICK) { grab = TRUE; auto_grab = FALSE;}
788 else {
789 if (auto_grab) { grab = FALSE; }
790 else { grab = TRUE; }
791 }
792 }
793 goto DEBUG;
794 #endif
795
796 if (now_fullscreen) { /* ������ɽ���ξ�� -------- */
797
798 if (grab_mouse == UNGRAB_MOUSE &&
799 hide_mouse == SHOW_MOUSE) {
800
801 /* ����֤ʤ� && �ޥ������� �ξ��Τߡ������̤�ˤ��� */
802 mouse = TRUE;
803 grab = FALSE;
804
805 } else {
806
807 /* ����֤���or��ư || �ޥ����ʤ�or��ư �ʤ�С��ʲ��Ǹ��� */
808 mouse = FALSE;
809 grab = TRUE;
810
811 }
812
813 } else { /* ������ɥ�ɽ���ξ�� -------- */
814
815 if (grab_mouse == GRAB_MOUSE) {
816
817 /* ����֤���ʤ顢�ޥ����Ͼä� */
818 grab = TRUE;
819 mouse = FALSE;
820
821 } else {
822
823 if (grab_mouse == AUTO_MOUSE &&
824 stat == SETUP_CLICK) {
825
826 /* ��ư����֤ǡ��ܥ���å����ϡ��ޥ����ä� */
827 grab = TRUE;
828 mouse = FALSE;
829
830 /* �ʲ��ϥ��ꥢ */
831 auto_mouse = FALSE;
832 auto_mouse_timer = 0;
833 auto_grab = FALSE;
834
835 } else {
836
837 /* ����֤ʤ��ʤ顢�ޥ�����̵ͭ������ˤ�� */
838 if (grab_mouse == AUTO_MOUSE) {
839 auto_grab = TRUE;
840 }
841
842 grab = FALSE;
843
844 DEBUG:
845 switch (hide_mouse) {
846 case AUTO_MOUSE:
847 auto_mouse = TRUE;
848 if (stat == SETUP_START ||
849 stat == SETUP_MOVE) {
850 auto_mouse_timer = AUTO_MOUSE_TIMEOUT;
851 mouse = TRUE;
852 } else {
853 auto_mouse_timer = 0;
854 mouse = FALSE;
855 }
856 break;
857
858 case SHOW_MOUSE:
859 mouse = TRUE;
860 break;
861
862 case HIDE_MOUSE:
863 default:
864 mouse = FALSE;
865 break;
866 }
867 }
868 }
869 }
870
871 } else {
872
873 repeat = TRUE;
874 mouse = TRUE;
875 grab = FALSE;
876
877 /* �����̥⡼�ɤǡ����եȥ��������������Ȥ��ʤ顢�ޥ����Ͼä� */
878 if (/*now_fullscreen &&*/ use_swcursor) mouse = FALSE;
879 }
880
881 graph_set_attribute(mouse, grab, repeat);
882 }
883
884
885
886
887
888
889 /***********************************************************************
890 * HALF���������ο��䴰��ͭ����̵����Ϣ�δؿ�
891 ***********************************************************************/
892
893 /* ���䴰�β��ݤ��֤� */
quasi88_cfg_can_interp(void)894 int quasi88_cfg_can_interp(void) { return enable_half_interp; }
895
896 /* ���䴰�θ��߾��֤��֤� */
quasi88_cfg_now_interp(void)897 int quasi88_cfg_now_interp(void) { return use_half_interp; }
898
899 /* ���䴰��̵ͭ�����ꤹ�� */
quasi88_cfg_set_interp(int enable)900 void quasi88_cfg_set_interp(int enable)
901 {
902 use_half_interp = enable;
903 check_half_interp();
904 set_vram2screen_list();
905 screen_set_dirty_all(); /* �ᥤ���ΰ� �����(==����) */
906 frameskip_counter_reset(); /* �������� */
907 }
908
909
910
911 /***********************************************************************
912 * INTERLACE�������Ϣ�δؿ�
913 ***********************************************************************/
914
915 /* ���ߤΥ��졼�����֤��֤� */
quasi88_cfg_now_interlace(void)916 int quasi88_cfg_now_interlace(void) { return use_interlace; }
917
918 /* ���졼�����֤����ꤹ�� */
quasi88_cfg_set_interlace(int interlace_mode)919 void quasi88_cfg_set_interlace(int interlace_mode)
920 {
921 use_interlace = interlace_mode;
922 set_vram2screen_list();
923 screen_set_dirty_frame(); /* ���ΰ� �����(==����) */
924 frameskip_counter_reset(); /* �������� */
925 }
926
927
928
929 /***********************************************************************
930 * ���ơ�����ɽ�������Ϣ�δؿ�
931 ***********************************************************************/
932
933 /* ���ơ�����ɽ���β��ݤ��֤� */
quasi88_cfg_can_showstatus(void)934 int quasi88_cfg_can_showstatus(void) { return enable_status; }
935
936 /* ���ơ�����ɽ���θ��߾��֤��֤� */
quasi88_cfg_now_showstatus(void)937 int quasi88_cfg_now_showstatus(void) { return now_status; }
938
939 /* ���ơ�������ɽ�������ꤹ�� */
quasi88_cfg_set_showstatus(int show)940 void quasi88_cfg_set_showstatus(int show)
941 {
942 if (now_status != show) { /* ���ơ�����ɽ��̵ͭ���Ѥ�ä� */
943 show_status = show;
944
945 if (now_fullscreen == FALSE) { /* ������ɥ��ξ�硦���� */
946
947 open_window_or_exit(); /* ���̥��������� */
948
949 } else { /* �����̤ξ�硦���� */
950
951 now_status = show_status;
952
953 if (now_status) {
954 screen_set_dirty_status_show(); /* ���ơ������ΰ� ����� */
955 screen_set_dirty_status(); /* ���ơ������ΰ� ���� */
956 } else {
957 screen_set_dirty_status_hide(); /* ���ơ������ΰ� �õ� */
958 }
959
960 }
961
962 status_setup(now_status); /* ���ơ������ѿ�������� */
963 }
964 }
965
966
967
968 /***********************************************************************
969 * ���������ꡦ���̥����������Ϣ�δؿ�
970 ***********************************************************************/
971
972 /* �����̤β��ݤ��֤� */
quasi88_cfg_can_fullscreen(void)973 int quasi88_cfg_can_fullscreen(void) { return enable_fullscreen; }
974
975 /* �����̤θ��߾��֤��֤� */
quasi88_cfg_now_fullscreen(void)976 int quasi88_cfg_now_fullscreen(void) { return now_fullscreen; }
977
978 /* �����̤����ؤ����ꤹ�� */
quasi88_cfg_set_fullscreen(int fullscreen)979 void quasi88_cfg_set_fullscreen(int fullscreen)
980 {
981 use_fullscreen = fullscreen;
982
983 if (now_fullscreen != use_fullscreen) {
984 open_window_or_exit(); /* ���̥��������� */
985 }
986 }
987
988 /* ���̥������κ�����֤� */
quasi88_cfg_max_size(void)989 int quasi88_cfg_max_size(void) { return screen_size_max; }
990
991 /* ���̥������κǾ����֤� */
quasi88_cfg_min_size(void)992 int quasi88_cfg_min_size(void) { return screen_size_min; }
993
994 /* ���̥������θ��߾��֤��֤� */
quasi88_cfg_now_size(void)995 int quasi88_cfg_now_size(void) { return now_screen_size; }
996
997 /* ���̥����������ꤹ�� */
quasi88_cfg_set_size(int new_size)998 void quasi88_cfg_set_size(int new_size)
999 {
1000 screen_size = new_size;
1001
1002 if (now_screen_size != screen_size) {
1003 open_window_or_exit(); /* ���̥��������� */
1004 }
1005 }
1006
1007 /* ���̥��������礭������ */
quasi88_cfg_set_size_large(void)1008 void quasi88_cfg_set_size_large(void)
1009 {
1010 if (++screen_size > screen_size_max) screen_size = screen_size_min;
1011
1012 open_window_or_exit(); /* ���̥��������� */
1013 }
1014
1015 /* ���̥������������� */
quasi88_cfg_set_size_small(void)1016 void quasi88_cfg_set_size_small(void)
1017 {
1018 if (--screen_size < screen_size_min) screen_size = screen_size_max;
1019
1020 open_window_or_exit(); /* ���̥��������� */
1021 }
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035 /*----------------------------------------------------------------------
1036 * �ѥ�å�����
1037 *----------------------------------------------------------------------*/
trans_palette(PC88_PALETTE_T syspal[])1038 static void trans_palette(PC88_PALETTE_T syspal[])
1039 {
1040 PC88_PALETTE_T color[120+16];
1041 int i, j, num;
1042
1043 if (added_color) {
1044 graph_remove_color(added_color, added_pixel);
1045 added_color = 0;
1046 }
1047
1048 /* 88�Υѥ�å�16��ʬ������ */
1049
1050 for (i = 0; i < 16; i++) {
1051 color[i].red = syspal[i].red;
1052 color[i].green = syspal[i].green;
1053 color[i].blue = syspal[i].blue;
1054 }
1055 num = 16;
1056
1057 /* HALF�������ե��륿���ǽ���ϥե��륿�ѥ�å��ͤ�� */
1058 /* (�ե��륿����Ѥˤϡ�120��������) */
1059
1060 if (now_half_interp) {
1061 for (i = 0; i < 16; i++) {
1062 for (j = i+1; j < 16; j++) {
1063 color[num].red = (color[i].red >>1) + (color[j].red >>1);
1064 color[num].green = (color[i].green>>1) + (color[j].green>>1);
1065 color[num].blue = (color[i].blue >>1) + (color[j].blue >>1);
1066 num++;
1067 }
1068 }
1069 }
1070
1071 graph_add_color(color, num, added_pixel);
1072 added_color = num;
1073
1074 for (i = 0; i < 16; i++) {
1075 color_pixel[i] = added_pixel[i];
1076 }
1077
1078 if (now_half_interp) {
1079 for (i = 0; i < 16; i++) {
1080 color_half_pixel[i][i] = color_pixel[i];
1081 }
1082 num = 16;
1083 for (i = 0; i < 16; i++) {
1084 for (j = i+1; j < 16; j++) {
1085 color_half_pixel[i][j] = added_pixel[num];
1086 color_half_pixel[j][i] = color_half_pixel[i][j];
1087 num++;
1088 }
1089 }
1090 }
1091 }
1092
1093
1094 /*----------------------------------------------------------------------
1095 * GVRAM/TVRAM������Хåե���ž������ؿ��Ρ��ꥹ�Ȥ����
1096 * ���δؿ��ϡ� bpp �� ������ �� ���ե����� ���ѹ����˸ƤӽФ���
1097 *----------------------------------------------------------------------*/
1098 static int (*vram2screen_list[4][4][2])(void);
1099 static void (*screen_buf_init_p)(void);
1100
1101 static int (*menu2screen_p)(void);
1102
1103 static void (*status2screen_p)(int kind, byte pixmap[], int w, int h);
1104 /*static void (*status_buf_init_p)(void);*/
1105 static void (*status_buf_clear_p)(void);
1106
set_vram2screen_list(void)1107 static void set_vram2screen_list(void)
1108 {
1109 typedef int (*V2S_FUNC_TYPE)(void);
1110 typedef V2S_FUNC_TYPE V2S_FUNC_LIST[4][4][2];
1111 V2S_FUNC_LIST *list = NULL;
1112
1113
1114 if (DEPTH <= 8) { /* ----------------------------------------- */
1115
1116 #ifdef SUPPORT_8BPP
1117 switch (now_screen_size) {
1118 case SCREEN_SIZE_FULL:
1119 if (use_interlace == 0) {
1120 if (screen_write_only) { list = &vram2screen_list_F_N__8_d; }
1121 else { list = &vram2screen_list_F_N__8; }
1122 }
1123 else if (use_interlace > 0) { list = &vram2screen_list_F_I__8; }
1124 else { list = &vram2screen_list_F_S__8; }
1125 menu2screen_p = menu2screen_F_N__8;
1126 break;
1127 case SCREEN_SIZE_HALF:
1128 if (now_half_interp) { list = &vram2screen_list_H_P__8;
1129 menu2screen_p = menu2screen_H_P__8; }
1130 else { list = &vram2screen_list_H_N__8;
1131 menu2screen_p = menu2screen_H_N__8; }
1132 break;
1133 #ifdef SUPPORT_DOUBLE
1134 case SCREEN_SIZE_DOUBLE:
1135 if (screen_write_only) {
1136 if (use_interlace == 0) { list=&vram2screen_list_D_N__8_d; }
1137 else if (use_interlace > 0) { list=&vram2screen_list_D_I__8_d; }
1138 else { list=&vram2screen_list_D_S__8_d; }
1139 } else {
1140 if (use_interlace == 0) { list=&vram2screen_list_D_N__8; }
1141 else if (use_interlace > 0) { list=&vram2screen_list_D_I__8; }
1142 else { list=&vram2screen_list_D_S__8; }
1143 }
1144 menu2screen_p = menu2screen_D_N__8;
1145 break;
1146 #endif
1147 }
1148 screen_buf_init_p = screen_buf_init__8;
1149 status2screen_p = status2screen__8;
1150 /* status_buf_init_p = status_buf_init__8;*/
1151 status_buf_clear_p = status_buf_clear__8;
1152 #else
1153 fprintf(stderr, "Error! This version is not support %dbpp !\n", DEPTH);
1154 exit(1);
1155 #endif
1156
1157 } else if (DEPTH <= 16) { /* ----------------------------------------- */
1158
1159 #ifdef SUPPORT_16BPP
1160 switch (now_screen_size) {
1161 case SCREEN_SIZE_FULL:
1162 if (use_interlace == 0) {
1163 if (screen_write_only) { list = &vram2screen_list_F_N_16_d; }
1164 else { list = &vram2screen_list_F_N_16; }
1165 }
1166 else if (use_interlace > 0) { list = &vram2screen_list_F_I_16; }
1167 else { list = &vram2screen_list_F_S_16; }
1168 menu2screen_p = menu2screen_F_N_16;
1169 break;
1170 case SCREEN_SIZE_HALF:
1171 if (now_half_interp) { list = &vram2screen_list_H_P_16;
1172 menu2screen_p = menu2screen_H_P_16; }
1173 else { list = &vram2screen_list_H_N_16;
1174 menu2screen_p = menu2screen_H_N_16; }
1175 break;
1176 #ifdef SUPPORT_DOUBLE
1177 case SCREEN_SIZE_DOUBLE:
1178 if (screen_write_only) {
1179 if (use_interlace == 0) { list=&vram2screen_list_D_N_16_d; }
1180 else if (use_interlace > 0) { list=&vram2screen_list_D_I_16_d; }
1181 else { list=&vram2screen_list_D_S_16_d; }
1182 } else {
1183 if (use_interlace == 0) { list=&vram2screen_list_D_N_16; }
1184 else if (use_interlace > 0) { list=&vram2screen_list_D_I_16; }
1185 else { list=&vram2screen_list_D_S_16; }
1186 }
1187 menu2screen_p = menu2screen_D_N_16;
1188 break;
1189 #endif
1190 }
1191 screen_buf_init_p = screen_buf_init_16;
1192 status2screen_p = status2screen_16;
1193 /* status_buf_init_p = status_buf_init_16;*/
1194 status_buf_clear_p = status_buf_clear_16;
1195 #else
1196 fprintf(stderr, "Error! This version is not support %dbpp !\n", DEPTH);
1197 exit(1);
1198 #endif
1199
1200 } else if (DEPTH <= 32) { /* ----------------------------------------- */
1201
1202 #ifdef SUPPORT_32BPP
1203 switch (now_screen_size) {
1204 case SCREEN_SIZE_FULL:
1205 if (use_interlace == 0) {
1206 if (screen_write_only) { list = &vram2screen_list_F_N_32_d; }
1207 else { list = &vram2screen_list_F_N_32; }
1208 }
1209 else if (use_interlace > 0) { list = &vram2screen_list_F_I_32; }
1210 else { list = &vram2screen_list_F_S_32; }
1211 menu2screen_p = menu2screen_F_N_32;
1212 break;
1213 case SCREEN_SIZE_HALF:
1214 if (now_half_interp) { list = &vram2screen_list_H_P_32;
1215 menu2screen_p = menu2screen_H_P_32; }
1216 else { list = &vram2screen_list_H_N_32;
1217 menu2screen_p = menu2screen_H_N_32; }
1218 break;
1219 #ifdef SUPPORT_DOUBLE
1220 case SCREEN_SIZE_DOUBLE:
1221 if (screen_write_only) {
1222 if (use_interlace == 0) { list=&vram2screen_list_D_N_32_d; }
1223 else if (use_interlace > 0) { list=&vram2screen_list_D_I_32_d; }
1224 else { list=&vram2screen_list_D_S_32_d; }
1225 } else {
1226 if (use_interlace == 0) { list=&vram2screen_list_D_N_32; }
1227 else if (use_interlace > 0) { list=&vram2screen_list_D_I_32; }
1228 else { list=&vram2screen_list_D_S_32; }
1229 }
1230 menu2screen_p = menu2screen_D_N_32;
1231 break;
1232 #endif
1233 }
1234 screen_buf_init_p = screen_buf_init_32;
1235 status2screen_p = status2screen_32;
1236 /* status_buf_init_p = status_buf_init_32;*/
1237 status_buf_clear_p = status_buf_clear_32;
1238 #else
1239 fprintf(stderr, "Error! This version is not support %dbpp !\n", DEPTH);
1240 exit(1);
1241 #endif
1242
1243 }
1244
1245 memcpy(vram2screen_list, list, sizeof(vram2screen_list));
1246 }
1247
1248
clear_all_screen(void)1249 static void clear_all_screen(void)
1250 {
1251 if (draw_start) { (draw_start)(); } /* �����ƥ��¸������������ */
1252
1253 (screen_buf_init_p)(); /* ���������ꥢ(�ܡ�������) */
1254 if (now_status) {
1255 (status_buf_clear_p)(); /* ���ơ������ΰ� �õ� */
1256 }
1257
1258 if (draw_finish) { (draw_finish)(); } /* �����ƥ��¸���������� */
1259 }
1260
1261
1262
1263 /*----------------------------------------------------------------------
1264 * GVRAM/TVRAM �� screen_buf ��ž������
1265 *
1266 * int method == V_DIF �� screen_dirty_flag �˴�Ť�����ʬ������ž��
1267 * == V_ALL �� ���̤��٤Ƥ�ž��
1268 *
1269 * ����� == -1 �� ž���ʤ� (���̤��Ѳ��ʤ�)
1270 * != -1 �� ��̤��� 8�ӥåȤ��Ĥˡ�x0, y0, x1, y1 ��
1271 * 4�Ĥ� unsigned �ͤ����åȤ���롣�����ǡ�
1272 * (x0 * 8, y0 * 2) - (x1 * 8, y1 * 2)
1273 * ��ɽ������ϰϤ���ž�������ΰ�Ȥʤ롣
1274 *
1275 * ͽ�ᡢ set_vram2screen_list �Ǵؿ��ꥹ�Ȥ��������Ƥ�������
1276 *----------------------------------------------------------------------*/
vram2screen(int method)1277 static int vram2screen(int method)
1278 {
1279 int vram_mode, text_mode;
1280
1281 if (sys_ctrl & SYS_CTRL_80) { /* �ƥ����Ȥιԡ��� */
1282 if (CRTC_SZ_LINES == 25) { text_mode = V_80x25; }
1283 else { text_mode = V_80x20; }
1284 } else {
1285 if (CRTC_SZ_LINES == 25) { text_mode = V_40x25; }
1286 else { text_mode = V_40x20; }
1287 }
1288
1289 if (grph_ctrl & GRPH_CTRL_VDISP) { /* VRAM ɽ������ */
1290
1291 if (grph_ctrl & GRPH_CTRL_COLOR) { /* ���顼 */
1292 vram_mode = V_COLOR;
1293 } else {
1294 if (grph_ctrl & GRPH_CTRL_200) { /* ��� */
1295 vram_mode = V_MONO;
1296 } else { /* 400�饤�� */
1297 vram_mode = V_HIRESO;
1298 }
1299 }
1300
1301 } else { /* VRAM ɽ�����ʤ� */
1302
1303 vram_mode = V_UNDISP;
1304 }
1305
1306 #if 0
1307 { /*���ߤɤΥ⡼�ɤ�ɽ����? */
1308 static int vram_mode0=-1, text_mode0=-1;
1309 if (text_mode0 != text_mode) {
1310 if (text_mode==V_80x25) printf(" 80x25\n");
1311 else if (text_mode==V_80x20) printf(" 80x20\n");
1312 else if (text_mode==V_40x25) printf(" 40x25\n");
1313 else if (text_mode==V_40x20) printf(" 40x20\n");
1314 text_mode0 = text_mode;
1315 }
1316 if (vram_mode0 != vram_mode) {
1317 if (vram_mode==V_COLOR) printf("COLOR\n");
1318 else if (vram_mode==V_MONO) printf("mono \n");
1319 else if (vram_mode==V_HIRESO) printf("H=400\n");
1320 else if (vram_mode==V_UNDISP) printf("-----\n");
1321 vram_mode0 = vram_mode;
1322 }
1323 }
1324 #endif
1325
1326 return (vram2screen_list[ vram_mode ][ text_mode ][ method ])();
1327 }
1328
1329
1330
1331 /*----------------------------------------------------------------------
1332 * ����ɽ�� �ܡ�����(��)�ΰ衢�ᥤ���ΰ衢���ơ������ΰ�����Ƥ�ɽ��
1333 *----------------------------------------------------------------------*/
put_image_all(void)1334 static void put_image_all(void)
1335 {
1336 T_GRAPH_RECT rect[1];
1337
1338 rect[0].x = 0;
1339 rect[0].y = 0;
1340 rect[0].width = WIDTH;
1341 rect[0].height = HEIGHT + ((now_status || now_fullscreen) ? STATUS_HEIGHT
1342 : 0);
1343
1344 graph_update(1, &rect[0]);
1345 }
1346
1347
1348 /*----------------------------------------------------------------------
1349 * ����ɽ�� �ᥤ���ΰ�� (x0,y0)-(x1,y1) �� ���ꤵ�줿���ơ������ΰ��ɽ��
1350 *----------------------------------------------------------------------*/
put_image(int x0,int y0,int x1,int y1,int st0,int st1,int st2)1351 static void put_image(int x0, int y0, int x1, int y1,
1352 int st0, int st1, int st2)
1353 {
1354 int n = 0;
1355 T_GRAPH_RECT rect[4];
1356
1357 if (x0 >= 0) {
1358 if (now_screen_size == SCREEN_SIZE_FULL) {
1359 ;
1360 } else if (now_screen_size == SCREEN_SIZE_HALF) {
1361 x0 /= 2; x1 /= 2; y0 /= 2; y1 /= 2;
1362 } else /* now_screen_size == SCREEN_SIZE_DOUBLE */ {
1363 x0 *= 2; x1 *= 2; y0 *= 2; y1 *= 2;
1364 }
1365
1366 rect[n].x = SCREEN_DX + x0;
1367 rect[n].y = SCREEN_DY + y0;
1368 rect[n].width = x1 - x0;
1369 rect[n].height = y1 - y0;
1370 n ++;
1371 }
1372
1373 if (now_status || now_fullscreen ){ /* �����̻��ϡ����ơ������õ���� */
1374 if (st0) {
1375 rect[n].x = 0;
1376 rect[n].y = HEIGHT;
1377 rect[n].width = status_sx[0];
1378 rect[n].height = STATUS_HEIGHT;
1379 n ++;
1380 }
1381 if (st1) {
1382 rect[n].x = status_sx[0];
1383 rect[n].y = HEIGHT;
1384 rect[n].width = status_sx[1];
1385 rect[n].height = STATUS_HEIGHT;
1386 n ++;
1387 }
1388 if (st2) {
1389 rect[n].x = status_sx[0] + status_sx[1];
1390 rect[n].y = HEIGHT;
1391 rect[n].width = status_sx[2];
1392 rect[n].height = STATUS_HEIGHT;
1393 n ++;
1394 }
1395 }
1396
1397 graph_update(n, &rect[0]);
1398 }
1399
1400
1401
1402
1403
1404
1405
1406
1407 /***********************************************************************
1408 * ����κݤ˻��Ѥ��롢�ºݤΥѥ�åȾ������� syspal �˥��åȤ���
1409 ************************************************************************/
screen_get_emu_palette(PC88_PALETTE_T pal[16])1410 void screen_get_emu_palette(PC88_PALETTE_T pal[16])
1411 {
1412 int i;
1413
1414 /* VRAM �� ���顼�ѥ�å����� pal[0]��[7] */
1415
1416 if (grph_ctrl & GRPH_CTRL_COLOR) { /* VRAM ���顼 */
1417
1418 if (monitor_analog) {
1419 for (i = 0; i < 8; i++) {
1420 pal[i].red = vram_palette[i].red * 73 / 2;
1421 pal[i].green = vram_palette[i].green * 73 / 2;
1422 pal[i].blue = vram_palette[i].blue * 73 / 2;
1423 }
1424 } else {
1425 for (i = 0; i < 8; i++) {
1426 pal[i].red = vram_palette[i].red ? 0xff : 0;
1427 pal[i].green = vram_palette[i].green ? 0xff : 0;
1428 pal[i].blue = vram_palette[i].blue ? 0xff : 0;
1429 }
1430 }
1431
1432 } else { /* VRAM ��� */
1433
1434 if (monitor_analog) {
1435 pal[0].red = vram_bg_palette.red * 73 / 2;
1436 pal[0].green = vram_bg_palette.green * 73 / 2;
1437 pal[0].blue = vram_bg_palette.blue * 73 / 2;
1438 } else {
1439 pal[0].red = vram_bg_palette.red ? 0xff : 0;
1440 pal[0].green = vram_bg_palette.green ? 0xff : 0;
1441 pal[0].blue = vram_bg_palette.blue ? 0xff : 0;
1442 }
1443 for (i = 1; i < 8; i++) {
1444 pal[i].red = 0;
1445 pal[i].green = 0;
1446 pal[i].blue = 0;
1447 }
1448
1449 }
1450
1451
1452 /* TEXT �� ���顼�ѥ�å����� pal[8]��[15] */
1453
1454 if (grph_ctrl & GRPH_CTRL_COLOR) { /* VRAM ���顼 */
1455
1456 for (i = 8; i < 16; i++) { /* TEXT ������ */
1457 pal[i].red = (i & 0x02) ? 0xff : 0; /* ��=[8],��=[15] �� */
1458 pal[i].green = (i & 0x04) ? 0xff : 0; /* �Ȥ��Τ�����ʤ� */
1459 pal[i].blue = (i & 0x01) ? 0xff : 0;
1460 }
1461
1462 } else { /* VRAM ��� */
1463
1464 if (misc_ctrl & MISC_CTRL_ANALOG) { /* ���ʥ��ѥ�åȻ�*/
1465
1466 if (monitor_analog) {
1467 for (i = 8; i < 16; i++) {
1468 pal[i].red = vram_palette[i & 0x7].red * 73 / 2;
1469 pal[i].green = vram_palette[i & 0x7].green * 73 / 2;
1470 pal[i].blue = vram_palette[i & 0x7].blue * 73 / 2;
1471 }
1472 } else {
1473 for (i = 8; i < 16; i++) {
1474 pal[i].red = vram_palette[i & 0x7].red ? 0xff : 0;
1475 pal[i].green = vram_palette[i & 0x7].green ? 0xff : 0;
1476 pal[i].blue = vram_palette[i & 0x7].blue ? 0xff : 0;
1477 }
1478 }
1479
1480 } else { /* �ǥ�����ѥ�åȻ�*/
1481 for (i = 8; i < 16; i++) {
1482 pal[i].red = (i & 0x02) ? 0xff : 0;
1483 pal[i].green = (i & 0x04) ? 0xff : 0;
1484 pal[i].blue = (i & 0x01) ? 0xff : 0;
1485 }
1486 }
1487
1488 }
1489 }
1490
1491
1492
1493 /***********************************************************************
1494 * �����ž�� (ɽ��)
1495 *
1496 * ���δؿ��ϡ�ɽ�������ߥ� (�� 1/60����) �˸ƤӽФ���롣
1497 ************************************************************************/
screen_update(void)1498 void screen_update(void)
1499 {
1500 int i;
1501 int skip = FALSE;
1502 int all_area = FALSE; /* �����ꥢž���ե饰 */
1503 int rect = -1; /* ����ž���ե饰 */
1504 int flag = 0; /* ���ơ�����ž���ե饰 */
1505 PC88_PALETTE_T syspal[16];
1506 int is_exec = (quasi88_is_exec()) ? TRUE : FALSE;
1507
1508
1509 screen_attr_update(); /* �ޥ�����ư�DZ����ĸƤӽФ���꤬���ޤ��� */
1510
1511
1512 if (is_exec) {
1513 profiler_lapse( PROF_LAPSE_BLIT );
1514 }
1515
1516 status_update(); /* ���ơ������ΰ�β����ǡ����� */
1517
1518
1519 /* �ᥤ���ΰ�ϡ�������åפ����礬����Τǡ��ʲ���Ƚ�� */
1520 /* (��˥塼�ʤɤϡ���� frame_counter==0 �ʤΤǡ��������) */
1521
1522 if ((frame_counter % frameskip_rate) == 0) { /* ����λ����褿�� */
1523 /* �ʲ��Τ����줫�ʤ����� */
1524 if (no_wait || /* �������Ȥʤ������ */
1525 use_auto_skip == FALSE || /* ��ư�����åפʤ������ */
1526 do_skip_draw == FALSE) { /* �����å��оݤǤʤ� */
1527
1528 skip = FALSE;
1529
1530 } else { /* �ʳ��ϥ����å� */
1531
1532 skip = TRUE;
1533
1534 /* ���西���ߥʤΤ˥����åפ������ϡ����Τ��Ȥ�Ф��Ƥ��� */
1535 already_skip_draw = TRUE;
1536 }
1537
1538 /* �����������ǤΥ������ */
1539 if (is_exec) {
1540 if (--blink_ctrl_counter == 0) {
1541 blink_ctrl_counter = blink_ctrl_cycle;
1542 blink_counter ++;
1543 }
1544 }
1545 } else {
1546 skip = TRUE;
1547 }
1548
1549
1550 /* �ᥤ���ΰ�����褹�� (�����åפ��ʤ�) ���ν��� */
1551
1552 if (skip == FALSE) {
1553
1554 /* ��ž�� */
1555
1556 if (screen_dirty_palette) { /* �����ƥ��ž�� */
1557 if (quasi88_is_menu()) {
1558 screen_get_menu_palette(syspal);
1559 } else {
1560 screen_get_emu_palette(syspal);
1561 }
1562 trans_palette(syspal);
1563 }
1564
1565 /* ɬ�פ˱����ơ��ե饰�å� */
1566
1567 if (screen_dirty_frame) {
1568 screen_set_dirty_all();
1569 screen_set_dirty_status();
1570 all_area = TRUE;
1571 }
1572
1573 if (screen_dirty_palette) {
1574 screen_set_dirty_all();
1575 screen_dirty_palette = FALSE;
1576 }
1577
1578 /* �ե饰�˱����ơ����� */
1579
1580 if (draw_start) { (draw_start)(); } /* �����ƥ��¸������������ */
1581
1582 if (screen_dirty_frame) {
1583 (screen_buf_init_p)(); /* ���������ꥢ(�ܡ�������) */
1584 screen_dirty_frame = FALSE;
1585 /* �ܡ��������Ϲ����ꡣ���ѹ��ĤȤ���ʤ顢��˿�ž����ɬ�ס� */
1586 }
1587
1588 /* VRAMž�� */
1589
1590 if (quasi88_is_menu()) {
1591
1592 if (screen_dirty_all ||
1593 screen_dirty_flag[0]) {
1594
1595 if (screen_dirty_all) {
1596 /* ���̤ꥢ������Ǻ�ʬ�������ˤʤ� */
1597 memset(&menu_screen[menu_screen_current^1],
1598 0,
1599 sizeof(menu_screen[0]));
1600 }
1601
1602 rect = (menu2screen_p)();
1603
1604 /* ɽ���̤����̤���פ����Ƥ����ʤ��Ȥ��������ʤ�� */
1605 memcpy(&menu_screen[menu_screen_current^1],
1606 &menu_screen[menu_screen_current],
1607 sizeof(menu_screen[0]));
1608
1609 menu_screen_current ^= 1;
1610 screen_dirty_flag[0] = 0;
1611 screen_dirty_all = FALSE;
1612 }
1613
1614 } else {
1615
1616 /* VRAM�����ե饰 screen_dirty_flag ���㳰���� */
1617 /* VRAM��ɽ���ξ�硢�����ե饰�ϰ�̵̣���Τǥ��ꥢ���� */
1618 /* 400�饤��ξ�硢�����ե饰����̲�Ⱦʬ�ˤ��ĥ���� */
1619
1620 if (screen_dirty_all == FALSE) {
1621 if (! (grph_ctrl & GRPH_CTRL_VDISP)) {
1622 /* ��ɽ�� */
1623 memset(screen_dirty_flag, 0, sizeof(screen_dirty_flag) / 2);
1624 }
1625 if (! (grph_ctrl & (GRPH_CTRL_COLOR|GRPH_CTRL_200))) {
1626 /* 400�饤�� */
1627 memcpy(&screen_dirty_flag[80*200], screen_dirty_flag, 80*200);
1628 }
1629 }
1630
1631 crtc_make_text_attr(); /* TVRAM �� °���������� */
1632 /* VRAM/TEXT �� screen_buf ž�� */
1633 rect = vram2screen(screen_dirty_all ? V_ALL : V_DIF);
1634
1635 text_attr_flipflop ^= 1;
1636 memset(screen_dirty_flag, 0, sizeof(screen_dirty_flag));
1637 screen_dirty_all = FALSE;
1638 }
1639
1640 if (draw_finish) { (draw_finish)(); } /* �����ƥ��¸���������� */
1641 }
1642
1643
1644 /* ���ơ��������ꥢ�ν��� (���ơ������ϡ�ɽ������¤ꥹ���åפ��ʤ�) */
1645
1646 if (draw_start) { (draw_start)(); } /* �����ƥ��¸������������ */
1647
1648 if (screen_dirty_status_hide) {
1649 (status_buf_clear_p)(); /* ���ơ������ΰ� �õ� */
1650 screen_dirty_status_hide = FALSE;
1651 all_area = TRUE;
1652 }
1653
1654 if (screen_dirty_status_show) {
1655 (status_buf_clear_p)(); /* ���ơ������ΰ� ����� */
1656 screen_dirty_status_show = FALSE;
1657 all_area = TRUE;
1658 }
1659
1660 if (now_status) {
1661 if (screen_dirty_status) {
1662 flag = screen_dirty_status;
1663 for (i = 0; i < 3; i++) {
1664 if (flag & (1 << i)) {
1665 (status2screen_p)(i, status_info[i].pixmap,
1666 status_info[i].w, status_info[i].h);
1667 }
1668 }
1669 screen_dirty_status = 0;
1670 }
1671 }
1672
1673 if (draw_finish) { (draw_finish)(); } /* �����ƥ��¸���������� */
1674
1675 if (is_exec) {
1676 profiler_video_output(((frame_counter % frameskip_rate) == 0),
1677 skip, (all_area || rect != -1));
1678 }
1679
1680
1681 if ((is_exec) && (dont_frameskip == FALSE)) {
1682 ++ frame_counter;
1683 } else { /* menu,pause,monitor */
1684 frame_counter = 0;
1685 }
1686
1687 if (is_exec) {
1688 profiler_lapse( PROF_LAPSE_VIDEO );
1689 }
1690
1691 if (all_area) {
1692
1693 put_image_all();
1694 drawn_count ++;
1695
1696 } else {
1697 if (rect != -1) {
1698 put_image(((rect >> 24) ) * 8, ((rect >> 16) & 0xff) * 2,
1699 ((rect >> 8) & 0xff) * 8, ((rect ) & 0xff) * 2,
1700 (flag & 1), (flag & 2), (flag & 4));
1701 drawn_count ++;
1702 }
1703 else if (flag) {
1704 put_image(-1, -1, -1, -1,
1705 (flag & 1), (flag & 2), (flag & 4));
1706 }
1707 }
1708 }
1709
screen_update_immidiate(void)1710 void screen_update_immidiate(void)
1711 {
1712 screen_set_dirty_frame(); /* ���ΰ� ���� */
1713 frameskip_counter_reset(); /* �������� */
1714
1715 screen_update(); /* ������� */
1716 }
1717
quasi88_info_draw_count(void)1718 int quasi88_info_draw_count(void)
1719 {
1720 return drawn_count;
1721 }
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735 /***********************************************************************
1736 * �����ƥ।�٥�Ƚ��� EXPOSE / FOCUS-IN / FOCUS-OUT
1737 ***********************************************************************/
1738
1739 /*======================================================================
1740 *
1741 *======================================================================*/
quasi88_expose(void)1742 void quasi88_expose(void)
1743 {
1744 screen_set_dirty_frame(); /* ���ΰ� ���� */
1745
1746 frameskip_counter_reset(); /* �������� */
1747 }
1748
1749
1750 /*======================================================================
1751 *
1752 *======================================================================*/
quasi88_focus_in(void)1753 void quasi88_focus_in(void)
1754 {
1755 if (quasi88_is_pause()) {
1756
1757 pause_event_focus_in_when_pause();
1758
1759 }
1760 }
1761
quasi88_focus_out(void)1762 void quasi88_focus_out(void)
1763 {
1764 if (quasi88_is_exec()) {
1765
1766 pause_event_focus_out_when_exec();
1767
1768 }
1769 }
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783 /***********************************************************************
1784 * �ƥ��������� (�������뤪��ӡ�ʸ��°��������) �����Υ������
1785 * CRTC �� frameskip_rate, blink_cycle ���ѹ�����뤿�Ӥ˸ƤӽФ�
1786 ************************************************************************/
frameskip_blink_reset(void)1787 void frameskip_blink_reset(void)
1788 {
1789 int wk;
1790
1791 wk = blink_cycle / frameskip_rate;
1792
1793 if (wk == 0 ||
1794 ! (blink_cycle-wk*frameskip_rate < (wk+1)*frameskip_rate-blink_cycle))
1795 wk++;
1796
1797 blink_ctrl_cycle = wk;
1798 blink_ctrl_counter = blink_ctrl_cycle;
1799 }
1800
1801
1802
1803 /***********************************************************************
1804 * �ե졼�५�������
1805 * ���ե졼��ϡ�ɬ��ɽ������롣(�����åפ���ʤ�)
1806 ************************************************************************/
frameskip_counter_reset(void)1807 void frameskip_counter_reset(void)
1808 {
1809 frame_counter = 0;
1810 do_skip_draw = FALSE;
1811 already_skip_draw = FALSE;
1812 }
1813
1814
1815
1816 /***********************************************************************
1817 * ��ư�ե졼�ॹ���å��� ( by floi, thanks ! )
1818 ************************************************************************/
frameskip_check(int on_time)1819 void frameskip_check(int on_time)
1820 {
1821 if (use_auto_skip) {
1822
1823 if (on_time) { /* ������˽����Ǥ��� */
1824
1825 skip_counter = 0;
1826 do_skip_draw = FALSE; /* ��������Ȥ��� */
1827
1828 if (already_skip_draw) { /* ����������������åפ��Ƥ��� */
1829 frameskip_counter_reset(); /* ����VSYNC�Ƕ������� */
1830 }
1831
1832 } else { /* ������˽����Ǥ��Ƥ��ʤ� */
1833
1834 do_skip_draw = TRUE; /* �������襹���å� */
1835
1836 skip_counter++; /* â���������åפ������ʤ� */
1837 if (skip_counter >= skip_count_max) {
1838 frameskip_counter_reset(); /* ����VSYNC�Ƕ������� */
1839 }
1840 }
1841 }
1842 }
1843
1844
1845
1846 /***********************************************************************
1847 * �ե졼�ॹ���åץ졼�Ȥμ���������
1848 ************************************************************************/
quasi88_cfg_now_frameskip_rate(void)1849 int quasi88_cfg_now_frameskip_rate(void)
1850 {
1851 return frameskip_rate;
1852 }
quasi88_cfg_set_frameskip_rate(int rate)1853 void quasi88_cfg_set_frameskip_rate(int rate)
1854 {
1855 char str[32];
1856
1857 if (rate <= 0) rate = 1;
1858
1859 if (rate != frameskip_rate) {
1860 frameskip_rate = rate;
1861
1862 frameskip_blink_reset();
1863 frameskip_counter_reset();
1864
1865 sprintf(str, "FRAME RATE = %2d/sec", 60/rate);
1866 status_message(1, STATUS_INFO_TIME, str);
1867 /* �ѹ�������ϡ����Ф餯���̤˥ե졼��졼�Ȥ�ɽ�������� */
1868 }
1869 }
1870
1871
1872
1873
1874
1875 /***********************************************************************
1876 * ���ơ��ȥ��ɡ����ơ��ȥ�����
1877 ************************************************************************/
1878
1879 #define SID "SCRN"
1880
1881 static T_SUSPEND_W suspend_screen_work[]=
1882 {
1883 { TYPE_CHAR, &vram_bg_palette.blue, },
1884 { TYPE_CHAR, &vram_bg_palette.red, },
1885 { TYPE_CHAR, &vram_bg_palette.green, },
1886
1887 { TYPE_CHAR, &vram_palette[0].blue, },
1888 { TYPE_CHAR, &vram_palette[0].red, },
1889 { TYPE_CHAR, &vram_palette[0].green, },
1890 { TYPE_CHAR, &vram_palette[1].blue, },
1891 { TYPE_CHAR, &vram_palette[1].red, },
1892 { TYPE_CHAR, &vram_palette[1].green, },
1893 { TYPE_CHAR, &vram_palette[2].blue, },
1894 { TYPE_CHAR, &vram_palette[2].red, },
1895 { TYPE_CHAR, &vram_palette[2].green, },
1896 { TYPE_CHAR, &vram_palette[3].blue, },
1897 { TYPE_CHAR, &vram_palette[3].red, },
1898 { TYPE_CHAR, &vram_palette[3].green, },
1899 { TYPE_CHAR, &vram_palette[4].blue, },
1900 { TYPE_CHAR, &vram_palette[4].red, },
1901 { TYPE_CHAR, &vram_palette[4].green, },
1902 { TYPE_CHAR, &vram_palette[5].blue, },
1903 { TYPE_CHAR, &vram_palette[5].red, },
1904 { TYPE_CHAR, &vram_palette[5].green, },
1905 { TYPE_CHAR, &vram_palette[6].blue, },
1906 { TYPE_CHAR, &vram_palette[6].red, },
1907 { TYPE_CHAR, &vram_palette[6].green, },
1908 { TYPE_CHAR, &vram_palette[7].blue, },
1909 { TYPE_CHAR, &vram_palette[7].red, },
1910 { TYPE_CHAR, &vram_palette[7].green, },
1911
1912 { TYPE_BYTE, &sys_ctrl, },
1913 { TYPE_BYTE, &grph_ctrl, },
1914 { TYPE_BYTE, &grph_pile, },
1915
1916 { TYPE_INT, &frameskip_rate, },
1917 { TYPE_INT, &monitor_analog, },
1918 { TYPE_INT, &use_auto_skip, },
1919 /* { TYPE_INT, &frame_counter, }, ����ͤǤ�����ʤ����� */
1920 /* { TYPE_INT, &blink_ctrl_cycle, }, ����ͤǤ�����ʤ����� */
1921 /* { TYPE_INT, &blink_ctrl_counter, }, ����ͤǤ�����ʤ����� */
1922
1923 { TYPE_INT, &use_interlace, },
1924 { TYPE_INT, &use_half_interp, },
1925
1926 { TYPE_END, 0 },
1927 };
1928
1929
statesave_screen(void)1930 int statesave_screen(void)
1931 {
1932 if (statesave_table(SID, suspend_screen_work) == STATE_OK) return TRUE;
1933 else return FALSE;
1934 }
1935
stateload_screen(void)1936 int stateload_screen(void)
1937 {
1938 if (stateload_table(SID, suspend_screen_work) == STATE_OK) return TRUE;
1939 else return FALSE;
1940 }
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965 /* �ǥХå��Ѥδؿ� */
attr_misc(int line)1966 void attr_misc(int line)
1967 {
1968 int i;
1969
1970 text_attr_flipflop ^= 1;
1971 for(i=0;i<80;i++){
1972 printf("%02X[%02X] ",
1973 text_attr_buf[text_attr_flipflop][line*80+i]>>8,
1974 text_attr_buf[text_attr_flipflop][line*80+i]&0xff );
1975 }
1976 return;
1977 for(i=0;i<80;i++){
1978 printf("%c[%02X] ",
1979 text_attr_buf[text_attr_flipflop][9*80+i]>>8,
1980 text_attr_buf[text_attr_flipflop][9*80+i]&0xff );
1981 }
1982 for(i=0;i<80;i++){
1983 printf("%c[%02X] ",
1984 text_attr_buf[text_attr_flipflop][10*80+i]>>8,
1985 text_attr_buf[text_attr_flipflop][10*80+i]&0xff );
1986 }
1987 for(i=0;i<80;i++){
1988 printf("%c[%02X] ",
1989 text_attr_buf[text_attr_flipflop][11*80+i]>>8,
1990 text_attr_buf[text_attr_flipflop][11*80+i]&0xff );
1991 }
1992 printf("\n");
1993 for(i=0;i<80;i++){
1994 printf("%c[%02X] ",
1995 text_attr_buf[text_attr_flipflop][12*80+i]>>8,
1996 text_attr_buf[text_attr_flipflop][12*80+i]&0xff );
1997 }
1998 printf("\n");
1999 for(i=0;i<80;i++){
2000 printf("%c[%02X] ",
2001 text_attr_buf[text_attr_flipflop][13*80+i]>>8,
2002 text_attr_buf[text_attr_flipflop][13*80+i]&0xff );
2003 }
2004 printf("\n");
2005 for(i=0;i<80;i++){
2006 printf("%c[%02X] ",
2007 text_attr_buf[text_attr_flipflop][14*80+i]>>8,
2008 text_attr_buf[text_attr_flipflop][14*80+i]&0xff );
2009 }
2010 #if 0
2011 for(i=0;i<80;i++){
2012 printf("%c[%02X] ",
2013 text_attr_buf[0][15*80+i]>>8,
2014 text_attr_buf[0][15*80+i]&0xff );
2015 }
2016 printf("\n");
2017 for(i=0;i<80;i++){
2018 printf("%c[%02X] ",
2019 text_attr_buf[0][16*80+i]>>8,
2020 text_attr_buf[0][16*80+i]&0xff );
2021 }
2022 printf("\n");
2023 for(i=0;i<80;i++){
2024 printf("%c[%02X] ",
2025 text_attr_buf[0][17*80+i]>>8,
2026 text_attr_buf[0][17*80+i]&0xff );
2027 }
2028 printf("\n");
2029 for(i=0;i<80;i++){
2030 printf("%c[%02X] ",
2031 text_attr_buf[0][18*80+i]>>8,
2032 text_attr_buf[0][18*80+i]&0xff );
2033 }
2034 printf("\n");
2035 for(i=0;i<80;i++){
2036 printf("%c[%02X] ",
2037 text_attr_buf[0][19*80+i]>>8,
2038 text_attr_buf[0][19*80+i]&0xff );
2039 }
2040 printf("\n");
2041 #endif
2042 }
2043