-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbgi_compat.cpp
More file actions
1073 lines (1018 loc) · 49.1 KB
/
Copy pathbgi_compat.cpp
File metadata and controls
1073 lines (1018 loc) · 49.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// BGI compatibility layer — drawing primitives, fonts, text, value display, screen save/restore
#include "bgi_compat.h"
#include "strings.h"
// =====================================================================
// BGI 16-color palette definition
// =====================================================================
const Color bgi_palette[16] = {
{ 0, 0, 0}, // 0 BLACK
{ 0, 0, 170}, // 1 BLUE
{ 0, 170, 0}, // 2 GREEN
{ 0, 170, 170}, // 3 CYAN
{170, 0, 0}, // 4 RED
{170, 0, 170}, // 5 MAGENTA
{170, 85, 0}, // 6 BROWN
{170, 170, 170}, // 7 LIGHTGRAY
{ 85, 85, 85}, // 8 DARKGRAY
{ 85, 85, 255}, // 9 LIGHTBLUE
{ 85, 255, 85}, // 10 LIGHTGREEN
{ 85, 255, 255}, // 11 LIGHTCYAN
{255, 85, 85}, // 12 LIGHTRED
{255, 85, 255}, // 13 LIGHTMAGENTA
{255, 255, 85}, // 14 YELLOW
{255, 255, 255}, // 15 WHITE
};
// =====================================================================
// BGI drawing state definitions
// =====================================================================
int g_color = 15;
int g_fill_color = 0;
int g_fill_pattern = 1;
int g_bk_color = 0;
int g_text_font = 0;
int g_text_dir = 0;
int g_text_size = 1;
int g_user_mult_x = 1, g_user_div_x = 1;
int g_user_mult_y = 1, g_user_div_y = 1;
int g_cp_x = 0, g_cp_y = 0;
// =====================================================================
// HZK16 font globals definitions
// =====================================================================
unsigned char *gFontData = nullptr;
int gFontSize = 0;
// =====================================================================
// BGI drawing state setters/getters
// =====================================================================
void set_render_color(int bgi_c) {
const Color &c = bgi_palette[bgi_c & 15];
SDL_SetRenderDrawColor(gRenderer, c.r, c.g, c.b, 255);
}
void setcolor(int c) { g_color = c & 15; }
void setfillstyle(int p, int c) { g_fill_pattern = p; g_fill_color = c & 15; }
void setbkcolor(int c) { g_bk_color = c & 15; }
int getcolor() { return g_color; }
int getmaxx() { return WIN_W - 1; }
int getmaxy() { return WIN_H - 1; }
void moveto(int x, int y) { g_cp_x = x; g_cp_y = y; }
void settextstyle(int font, int dir, int size) {
g_text_font = font; g_text_dir = dir; g_text_size = size;
}
void setusercharsize(int mx, int dx, int my, int dy) {
g_user_mult_x = mx; g_user_div_x = dx;
g_user_mult_y = my; g_user_div_y = dy;
}
// =====================================================================
// Drawing primitives
// =====================================================================
void putpixel(int x, int y, int c) {
if (x < 0 || x >= WIN_W || y < 0 || y >= WIN_H) return;
set_render_color(c);
SDL_RenderDrawPoint(gRenderer, x, y);
}
void line(int x1, int y1, int x2, int y2) {
set_render_color(g_color);
SDL_RenderDrawLine(gRenderer, x1, y1, x2, y2);
}
void bar(int x1, int y1, int x2, int y2) {
if (x1 > x2) std::swap(x1, x2);
if (y1 > y2) std::swap(y1, y2);
set_render_color(g_fill_color);
SDL_Rect r = {x1, y1, x2 - x1 + 1, y2 - y1 + 1};
SDL_RenderFillRect(gRenderer, &r);
}
void rectangle(int x1, int y1, int x2, int y2) {
set_render_color(g_color);
SDL_Rect r = {x1, y1, x2 - x1 + 1, y2 - y1 + 1};
SDL_RenderDrawRect(gRenderer, &r);
}
// Midpoint circle — outline only
void circle(int cx, int cy, int r) {
set_render_color(g_color);
int x = 0, y = r, d = 1 - r;
auto plot8 = [&](int px, int py) {
SDL_RenderDrawPoint(gRenderer, cx+px, cy+py);
SDL_RenderDrawPoint(gRenderer, cx-px, cy+py);
SDL_RenderDrawPoint(gRenderer, cx+px, cy-py);
SDL_RenderDrawPoint(gRenderer, cx-px, cy-py);
SDL_RenderDrawPoint(gRenderer, cx+py, cy+px);
SDL_RenderDrawPoint(gRenderer, cx-py, cy+px);
SDL_RenderDrawPoint(gRenderer, cx+py, cy-px);
SDL_RenderDrawPoint(gRenderer, cx-py, cy-px);
};
while (x <= y) {
plot8(x, y);
if (d < 0) { d += 2*x + 3; }
else { d += 2*(x-y) + 5; y--; }
x++;
}
}
// Filled ellipse using horizontal scanlines, with outline in current line color
void fillellipse(int cx, int cy, int rx, int ry) {
if (rx <= 0 || ry <= 0) return;
// Fill
set_render_color(g_fill_color);
for (int y = -ry; y <= ry; y++) {
int w = (int)(rx * sqrt(1.0 - (double)(y*y) / (double)(ry*ry)));
SDL_RenderDrawLine(gRenderer, cx - w, cy + y, cx + w, cy + y);
}
// Outline in current drawing color
set_render_color(g_color);
for (int a = 0; a < 360; a++) {
double rad = a * PI / 180.0;
int px = cx + (int)(rx * cos(rad));
int py = cy + (int)(ry * sin(rad));
if (px >= 0 && px < WIN_W && py >= 0 && py < WIN_H)
SDL_RenderDrawPoint(gRenderer, px, py);
}
}
// Arc — draws outline pixels from start_angle to end_angle (degrees, CCW, 0=right)
void arc(int cx, int cy, int start_angle, int end_angle, int r) {
if (r <= 0) return;
set_render_color(g_color);
double sa = start_angle;
double ea = end_angle;
if (ea < sa) ea += 360;
double step = 0.5;
for (double a = sa; a <= ea; a += step) {
double rad = a * PI / 180.0;
int px = cx + (int)(r * cos(rad));
int py = cy - (int)(r * sin(rad));
if (px >= 0 && px < WIN_W && py >= 0 && py < WIN_H)
SDL_RenderDrawPoint(gRenderer, px, py);
}
}
// Pieslice — filled pie wedge in current fill color with outline in current color
void pieslice(int cx, int cy, int start_angle, int end_angle, int r) {
if (r <= 0) return;
double sa = start_angle;
double ea = end_angle;
if (ea < sa) ea += 360;
if (g_fill_pattern == 9) {
// INTERLEAVE_FILL: checkerboard pattern — fill pixel by pixel
const Color &fc = bgi_palette[g_fill_color & 15];
int x_min = cx - r, x_max = cx + r;
int y_min = cy - r, y_max = cy + r;
if (x_min < 0) x_min = 0;
if (x_max >= WIN_W) x_max = WIN_W - 1;
if (y_min < 0) y_min = 0;
if (y_max >= WIN_H) y_max = WIN_H - 1;
for (int py = y_min; py <= y_max; py++) {
for (int px = x_min; px <= x_max; px++) {
int dx = px - cx, dy = cy - py;
double dist = sqrt((double)(dx*dx + dy*dy));
if (dist > r) continue;
double angle_rad = atan2((double)dy, (double)dx);
double angle_deg = angle_rad * 180.0 / PI;
if (angle_deg < 0) angle_deg += 360;
bool in_wedge;
if (sa <= ea) in_wedge = (angle_deg >= sa && angle_deg <= ea);
else in_wedge = (angle_deg >= sa || angle_deg <= ea);
if (!in_wedge) {
double a2 = angle_deg + 360;
in_wedge = (a2 >= sa && a2 <= ea);
}
if (in_wedge && ((px + py) % 2 == 0)) {
SDL_SetRenderDrawColor(gRenderer, fc.r, fc.g, fc.b, 255);
SDL_RenderDrawPoint(gRenderer, px, py);
}
}
}
} else {
// Solid fill: draw lines from center to each arc point
set_render_color(g_fill_color);
double step = 0.3;
for (double a = sa; a <= ea; a += step) {
double rad = a * PI / 180.0;
int px = cx + (int)(r * cos(rad));
int py = cy - (int)(r * sin(rad));
SDL_RenderDrawLine(gRenderer, cx, cy, px, py);
}
}
// Outline: arc + two lines from center to endpoints
set_render_color(g_color);
for (double a = sa; a <= ea; a += 0.5) {
double rad = a * PI / 180.0;
int px = cx + (int)(r * cos(rad));
int py = cy - (int)(r * sin(rad));
if (px >= 0 && px < WIN_W && py >= 0 && py < WIN_H)
SDL_RenderDrawPoint(gRenderer, px, py);
}
double rad_s = sa * PI / 180.0;
double rad_e = ea * PI / 180.0;
SDL_RenderDrawLine(gRenderer, cx, cy, cx + (int)(r*cos(rad_s)), cy - (int)(r*sin(rad_s)));
SDL_RenderDrawLine(gRenderer, cx, cy, cx + (int)(r*cos(rad_e)), cy - (int)(r*sin(rad_e)));
}
// Floodfill — stack-based scanline fill using texture readback
void floodfill(int sx, int sy, int border_bgi_color) {
if (sx < 0 || sx >= WIN_W || sy < 0 || sy >= WIN_H) return;
int rw, rh;
SDL_GetRendererOutputSize(gRenderer, &rw, &rh);
float scale_x = (float)rw / WIN_W;
float scale_y = (float)rh / WIN_H;
int psx = (int)(sx * scale_x);
int psy = (int)(sy * scale_y);
if (psx >= rw) psx = rw - 1;
if (psy >= rh) psy = rh - 1;
Uint32 *pixels = new Uint32[rw * rh];
SDL_RenderReadPixels(gRenderer, nullptr, SDL_PIXELFORMAT_ARGB8888, pixels, rw * 4);
const Color &bc = bgi_palette[border_bgi_color & 15];
Uint32 border_pix = 0xFF000000 | ((Uint32)bc.r << 16) | ((Uint32)bc.g << 8) | bc.b;
const Color &fc = bgi_palette[g_fill_color & 15];
Uint32 fill_pix = 0xFF000000 | ((Uint32)fc.r << 16) | ((Uint32)fc.g << 8) | fc.b;
Uint32 seed_pix = pixels[psy * rw + psx];
if (seed_pix == border_pix || seed_pix == fill_pix) {
delete[] pixels;
return;
}
std::stack<std::pair<int,int>> stk;
stk.push({psx, psy});
while (!stk.empty()) {
auto [x, y] = stk.top(); stk.pop();
if (x < 0 || x >= rw || y < 0 || y >= rh) continue;
Uint32 cur = pixels[y * rw + x];
if (cur == border_pix || cur == fill_pix) continue;
int left = x;
while (left > 0 && pixels[y * rw + left - 1] != border_pix &&
pixels[y * rw + left - 1] != fill_pix) left--;
int right = x;
while (right < rw - 1 && pixels[y * rw + right + 1] != border_pix &&
pixels[y * rw + right + 1] != fill_pix) right++;
for (int i = left; i <= right; i++)
pixels[y * rw + i] = fill_pix;
for (int i = left; i <= right; i++) {
if (y > 0) {
Uint32 above = pixels[(y-1) * rw + i];
if (above != border_pix && above != fill_pix)
stk.push({i, y-1});
}
if (y < rh - 1) {
Uint32 below = pixels[(y+1) * rw + i];
if (below != border_pix && below != fill_pix)
stk.push({i, y+1});
}
}
}
SDL_Texture *tex = SDL_CreateTexture(gRenderer, SDL_PIXELFORMAT_ARGB8888,
SDL_TEXTUREACCESS_STATIC, rw, rh);
SDL_UpdateTexture(tex, nullptr, pixels, rw * 4);
SDL_RenderSetLogicalSize(gRenderer, 0, 0);
SDL_RenderCopy(gRenderer, tex, nullptr, nullptr);
SDL_RenderSetLogicalSize(gRenderer, WIN_W, WIN_H);
SDL_DestroyTexture(tex);
delete[] pixels;
}
// =====================================================================
// ASCII 16x16 bitmap font for English localization (file-local)
// Each glyph is 16 rows x 2 bytes/row = 32 bytes, same layout as HZK16.
// Covers printable ASCII 32-126 (95 characters).
// =====================================================================
static const unsigned char font16x16[][32] = {
// 32 ' ' (space)
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 33 '!'
{0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,
0x03,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00},
// 34 '"'
{0x00,0x00,0x0E,0x70,0x0E,0x70,0x0E,0x70,0x04,0x20,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 35 '#'
{0x00,0x00,0x06,0x60,0x06,0x60,0x06,0x60,0x1F,0xF8,0x1F,0xF8,0x06,0x60,0x06,0x60,
0x06,0x60,0x1F,0xF8,0x1F,0xF8,0x06,0x60,0x06,0x60,0x06,0x60,0x00,0x00,0x00,0x00},
// 36 '$'
{0x01,0x00,0x07,0xF0,0x0D,0x00,0x0D,0x00,0x0D,0x00,0x07,0x80,0x03,0xC0,0x01,0xE0,
0x01,0x60,0x01,0x60,0x01,0x60,0x0F,0xC0,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00},
// 37 '%'
{0x00,0x00,0x0E,0x10,0x0E,0x20,0x0E,0x40,0x00,0x80,0x01,0x00,0x01,0x00,0x02,0x00,
0x02,0x00,0x04,0x00,0x04,0xE0,0x08,0xE0,0x10,0xE0,0x00,0x00,0x00,0x00,0x00,0x00},
// 38 '&'
{0x00,0x00,0x07,0x00,0x0D,0x80,0x0D,0x80,0x0D,0x80,0x07,0x00,0x07,0x00,0x0F,0x30,
0x1D,0xB0,0x18,0xE0,0x18,0xE0,0x0F,0xB0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 39 '''
{0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 40 '('
{0x00,0x00,0x01,0xC0,0x03,0x80,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,
0x07,0x00,0x07,0x00,0x07,0x00,0x03,0x80,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,0x00},
// 41 ')'
{0x00,0x00,0x07,0x00,0x03,0x80,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,
0x01,0xC0,0x01,0xC0,0x01,0xC0,0x03,0x80,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 42 '*'
{0x00,0x00,0x01,0x00,0x09,0x20,0x07,0xC0,0x03,0x80,0x0F,0xE0,0x03,0x80,0x07,0xC0,
0x09,0x20,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 43 '+'
{0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x0F,0xF0,0x0F,0xF0,0x01,0x80,
0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 44 ','
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x00,0x06,0x00,0x00,0x00,0x00,0x00},
// 45 '-'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF0,0x0F,0xF0,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 46 '.'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 47 '/'
{0x00,0x00,0x00,0x30,0x00,0x60,0x00,0xC0,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,
0x06,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 48 '0'
{0x00,0x00,0x07,0xC0,0x0C,0x60,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,
0x18,0x30,0x18,0x30,0x0C,0x60,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 49 '1'
{0x00,0x00,0x01,0x80,0x07,0x80,0x0D,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,
0x01,0x80,0x01,0x80,0x01,0x80,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 50 '2'
{0x00,0x00,0x07,0xC0,0x0C,0x60,0x18,0x30,0x00,0x30,0x00,0x60,0x00,0xC0,0x01,0x80,
0x03,0x00,0x06,0x00,0x0C,0x00,0x1F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 51 '3'
{0x00,0x00,0x07,0xC0,0x0C,0x60,0x00,0x30,0x00,0x30,0x03,0xC0,0x03,0xC0,0x00,0x30,
0x00,0x30,0x00,0x30,0x0C,0x60,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 52 '4'
{0x00,0x00,0x00,0xC0,0x01,0xC0,0x03,0xC0,0x06,0xC0,0x0C,0xC0,0x18,0xC0,0x1F,0xF0,
0x1F,0xF0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 53 '5'
{0x00,0x00,0x1F,0xF0,0x18,0x00,0x18,0x00,0x1F,0xC0,0x0F,0xE0,0x00,0x30,0x00,0x30,
0x00,0x30,0x00,0x30,0x0C,0x60,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 54 '6'
{0x00,0x00,0x03,0xC0,0x06,0x00,0x0C,0x00,0x18,0x00,0x1F,0xC0,0x18,0x60,0x18,0x30,
0x18,0x30,0x18,0x30,0x0C,0x60,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 55 '7'
{0x00,0x00,0x1F,0xF0,0x00,0x30,0x00,0x60,0x00,0xC0,0x01,0x80,0x01,0x80,0x03,0x00,
0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 56 '8'
{0x00,0x00,0x07,0xC0,0x0C,0x60,0x18,0x30,0x0C,0x60,0x07,0xC0,0x07,0xC0,0x0C,0x60,
0x18,0x30,0x18,0x30,0x0C,0x60,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 57 '9'
{0x00,0x00,0x07,0xC0,0x0C,0x60,0x18,0x30,0x18,0x30,0x18,0x30,0x0C,0x70,0x07,0xF0,
0x00,0x30,0x00,0x60,0x00,0xC0,0x07,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 58 ':'
{0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 59 ';'
{0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x03,0x80,0x03,0x80,0x03,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 60 '<'
{0x00,0x00,0x00,0x60,0x00,0xC0,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x06,0x00,
0x03,0x00,0x01,0x80,0x00,0xC0,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 61 '='
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF0,0x1F,0xF0,0x00,0x00,0x00,0x00,
0x1F,0xF0,0x1F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 62 '>'
{0x00,0x00,0x0C,0x00,0x06,0x00,0x03,0x00,0x01,0x80,0x00,0xC0,0x00,0x60,0x00,0xC0,
0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 63 '?'
{0x00,0x00,0x07,0xC0,0x0C,0x60,0x18,0x30,0x00,0x30,0x00,0x60,0x01,0xC0,0x03,0x80,
0x03,0x80,0x00,0x00,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 64 '@'
{0x00,0x00,0x07,0xC0,0x0C,0x60,0x18,0x30,0x19,0xF0,0x1B,0x30,0x1B,0x30,0x1B,0x30,
0x19,0xF0,0x18,0x00,0x0C,0x00,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 65 'A'
{0x00,0x00,0x03,0x80,0x03,0x80,0x06,0xC0,0x06,0xC0,0x0C,0x60,0x0C,0x60,0x1F,0xF0,
0x1F,0xF0,0x18,0x30,0x18,0x30,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 66 'B'
{0x00,0x00,0x1F,0xC0,0x18,0x60,0x18,0x30,0x18,0x30,0x18,0x60,0x1F,0xC0,0x18,0x60,
0x18,0x30,0x18,0x30,0x18,0x60,0x1F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 67 'C'
{0x00,0x00,0x07,0xC0,0x0C,0x60,0x18,0x30,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,
0x18,0x00,0x18,0x30,0x0C,0x60,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 68 'D'
{0x00,0x00,0x1F,0x80,0x18,0xC0,0x18,0x60,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,
0x18,0x30,0x18,0x60,0x18,0xC0,0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 69 'E'
{0x00,0x00,0x1F,0xF0,0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xC0,0x1F,0xC0,0x18,0x00,
0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 70 'F'
{0x00,0x00,0x1F,0xF0,0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xC0,0x1F,0xC0,0x18,0x00,
0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 71 'G'
{0x00,0x00,0x07,0xC0,0x0C,0x60,0x18,0x30,0x18,0x00,0x18,0x00,0x18,0xF0,0x18,0x30,
0x18,0x30,0x18,0x30,0x0C,0x60,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 72 'H'
{0x00,0x00,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x1F,0xF0,0x1F,0xF0,0x18,0x30,
0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 73 'I'
{0x00,0x00,0x0F,0xF0,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,
0x03,0x80,0x03,0x80,0x03,0x80,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 74 'J'
{0x00,0x00,0x03,0xF0,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,
0x18,0x60,0x18,0x60,0x0C,0xC0,0x07,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 75 'K'
{0x00,0x00,0x18,0x60,0x18,0xC0,0x19,0x80,0x1B,0x00,0x1E,0x00,0x1E,0x00,0x1B,0x00,
0x19,0x80,0x18,0xC0,0x18,0x60,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 76 'L'
{0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,
0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 77 'M'
{0x00,0x00,0x18,0x30,0x1C,0x70,0x1E,0xF0,0x1B,0xB0,0x19,0x30,0x18,0x30,0x18,0x30,
0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 78 'N'
{0x00,0x00,0x18,0x30,0x1C,0x30,0x1E,0x30,0x1F,0x30,0x1B,0xB0,0x19,0xF0,0x18,0xF0,
0x18,0x70,0x18,0x30,0x18,0x30,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 79 'O'
{0x00,0x00,0x07,0xC0,0x0C,0x60,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,
0x18,0x30,0x18,0x30,0x0C,0x60,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 80 'P'
{0x00,0x00,0x1F,0xC0,0x18,0x60,0x18,0x30,0x18,0x30,0x18,0x60,0x1F,0xC0,0x18,0x00,
0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 81 'Q'
{0x00,0x00,0x07,0xC0,0x0C,0x60,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,
0x19,0xB0,0x18,0xE0,0x0C,0x70,0x07,0xD8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 82 'R'
{0x00,0x00,0x1F,0xC0,0x18,0x60,0x18,0x30,0x18,0x30,0x18,0x60,0x1F,0xC0,0x1B,0x00,
0x19,0x80,0x18,0xC0,0x18,0x60,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 83 'S'
{0x00,0x00,0x07,0xC0,0x0C,0x60,0x18,0x00,0x18,0x00,0x0C,0x00,0x07,0xC0,0x00,0x60,
0x00,0x30,0x00,0x30,0x0C,0x60,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 84 'T'
{0x00,0x00,0x1F,0xF0,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,
0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 85 'U'
{0x00,0x00,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,
0x18,0x30,0x18,0x30,0x0C,0x60,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 86 'V'
{0x00,0x00,0x18,0x30,0x18,0x30,0x18,0x30,0x0C,0x60,0x0C,0x60,0x06,0xC0,0x06,0xC0,
0x03,0x80,0x03,0x80,0x03,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 87 'W'
{0x00,0x00,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x19,0x30,0x1B,0xB0,
0x1B,0xB0,0x0E,0xE0,0x0C,0x60,0x0C,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 88 'X'
{0x00,0x00,0x18,0x30,0x18,0x30,0x0C,0x60,0x06,0xC0,0x03,0x80,0x03,0x80,0x06,0xC0,
0x0C,0x60,0x18,0x30,0x18,0x30,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 89 'Y'
{0x00,0x00,0x18,0x30,0x18,0x30,0x0C,0x60,0x06,0xC0,0x03,0x80,0x03,0x80,0x03,0x80,
0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 90 'Z'
{0x00,0x00,0x1F,0xF0,0x00,0x30,0x00,0x60,0x00,0xC0,0x01,0x80,0x03,0x00,0x06,0x00,
0x0C,0x00,0x18,0x00,0x18,0x00,0x1F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 91 '['
{0x00,0x00,0x07,0xC0,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,
0x06,0x00,0x06,0x00,0x06,0x00,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 92 '\'
{0x00,0x00,0x18,0x00,0x0C,0x00,0x06,0x00,0x03,0x00,0x03,0x00,0x01,0x80,0x01,0x80,
0x00,0xC0,0x00,0x60,0x00,0x60,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 93 ']'
{0x00,0x00,0x07,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,
0x00,0xC0,0x00,0xC0,0x00,0xC0,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 94 '^'
{0x00,0x00,0x01,0x00,0x03,0x80,0x06,0xC0,0x0C,0x60,0x18,0x30,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 95 '_'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00},
// 96 '`'
{0x00,0x00,0x06,0x00,0x03,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 97 'a'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x0C,0x60,0x00,0x60,0x07,0xE0,
0x0C,0x60,0x18,0x60,0x18,0x60,0x0F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 98 'b'
{0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xC0,0x18,0x60,0x18,0x30,0x18,0x30,
0x18,0x30,0x18,0x30,0x18,0x60,0x1F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 99 'c'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x0C,0x00,0x18,0x00,0x18,0x00,
0x18,0x00,0x18,0x00,0x0C,0x00,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 100 'd'
{0x00,0x00,0x00,0x30,0x00,0x30,0x00,0x30,0x07,0xF0,0x0C,0x30,0x18,0x30,0x18,0x30,
0x18,0x30,0x18,0x30,0x0C,0x30,0x07,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 101 'e'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x0C,0x60,0x18,0x30,0x1F,0xF0,
0x18,0x00,0x18,0x00,0x0C,0x00,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 102 'f'
{0x00,0x00,0x01,0xE0,0x03,0x00,0x03,0x00,0x0F,0xC0,0x03,0x00,0x03,0x00,0x03,0x00,
0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 103 'g'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xF0,0x0C,0x30,0x18,0x30,0x18,0x30,
0x18,0x30,0x0C,0x30,0x07,0xF0,0x00,0x30,0x00,0x60,0x07,0xC0,0x00,0x00,0x00,0x00},
// 104 'h'
{0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xC0,0x18,0x60,0x18,0x30,0x18,0x30,
0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 105 'i'
{0x00,0x00,0x03,0x80,0x03,0x80,0x00,0x00,0x07,0x80,0x03,0x80,0x03,0x80,0x03,0x80,
0x03,0x80,0x03,0x80,0x03,0x80,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 106 'j'
{0x00,0x00,0x00,0xC0,0x00,0xC0,0x00,0x00,0x01,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,
0x00,0xC0,0x00,0xC0,0x00,0xC0,0x18,0xC0,0x0D,0x80,0x07,0x00,0x00,0x00,0x00,0x00},
// 107 'k'
{0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x60,0x18,0xC0,0x19,0x80,0x1F,0x00,
0x1B,0x00,0x19,0x80,0x18,0xC0,0x18,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 108 'l'
{0x00,0x00,0x07,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,
0x03,0x80,0x03,0x80,0x03,0x80,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 109 'm'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1D,0xB0,0x1F,0xF0,0x1B,0x30,0x1B,0x30,
0x1B,0x30,0x1B,0x30,0x1B,0x30,0x1B,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 110 'n'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xC0,0x18,0x60,0x18,0x30,0x18,0x30,
0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 111 'o'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x0C,0x60,0x18,0x30,0x18,0x30,
0x18,0x30,0x18,0x30,0x0C,0x60,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 112 'p'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xC0,0x18,0x60,0x18,0x30,0x18,0x30,
0x18,0x30,0x18,0x60,0x1F,0xC0,0x18,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00},
// 113 'q'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xF0,0x0C,0x30,0x18,0x30,0x18,0x30,
0x18,0x30,0x0C,0x30,0x07,0xF0,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x00},
// 114 'r'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1B,0xC0,0x1C,0x60,0x18,0x00,0x18,0x00,
0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 115 's'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x0C,0x00,0x0C,0x00,0x07,0xC0,
0x00,0x60,0x00,0x60,0x00,0x60,0x0F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 116 't'
{0x00,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x0F,0xE0,0x03,0x00,0x03,0x00,0x03,0x00,
0x03,0x00,0x03,0x00,0x03,0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 117 'u'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,
0x18,0x30,0x18,0x30,0x0C,0x70,0x07,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 118 'v'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x30,0x18,0x30,0x0C,0x60,0x0C,0x60,
0x06,0xC0,0x06,0xC0,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 119 'w'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x30,0x18,0x30,0x18,0x30,0x1B,0x30,
0x1B,0xB0,0x1F,0xF0,0x0E,0xE0,0x0C,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 120 'x'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x30,0x0C,0x60,0x06,0xC0,0x03,0x80,
0x03,0x80,0x06,0xC0,0x0C,0x60,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 121 'y'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x30,0x18,0x30,0x0C,0x60,0x06,0xC0,
0x03,0x80,0x03,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x00,0x00,0x00,0x00},
// 122 'z'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF0,0x00,0x60,0x00,0xC0,0x01,0x80,
0x03,0x00,0x06,0x00,0x0C,0x00,0x1F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 123 '{'
{0x00,0x00,0x01,0xC0,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x03,0x00,
0x03,0x00,0x03,0x00,0x03,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 124 '|'
{0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,
0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00},
// 125 '}'
{0x00,0x00,0x07,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0xC0,0x01,0x80,
0x01,0x80,0x01,0x80,0x01,0x80,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// 126 '~'
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x30,0x1B,0x30,0x19,0xB0,
0x18,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
};
// =====================================================================
// ASCII 8x8 bitmap font (file-local)
// =====================================================================
static const unsigned char font8x8[][8] = {
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 32 ' '
{0x18,0x18,0x18,0x18,0x18,0x00,0x18,0x00}, // 33 '!'
{0x6C,0x6C,0x24,0x00,0x00,0x00,0x00,0x00}, // 34 '"'
{0x24,0x7E,0x24,0x24,0x7E,0x24,0x00,0x00}, // 35 '#'
{0x18,0x3E,0x58,0x3C,0x1A,0x7C,0x18,0x00}, // 36 '$'
{0x62,0x64,0x08,0x10,0x26,0x46,0x00,0x00}, // 37 '%'
{0x30,0x48,0x30,0x56,0x48,0x34,0x00,0x00}, // 38 '&'
{0x18,0x18,0x10,0x00,0x00,0x00,0x00,0x00}, // 39 '''
{0x08,0x10,0x20,0x20,0x20,0x10,0x08,0x00}, // 40 '('
{0x20,0x10,0x08,0x08,0x08,0x10,0x20,0x00}, // 41 ')'
{0x00,0x24,0x18,0x7E,0x18,0x24,0x00,0x00}, // 42 '*'
{0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00}, // 43 '+'
{0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x10}, // 44 ','
{0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00}, // 45 '-'
{0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00}, // 46 '.'
{0x02,0x04,0x08,0x10,0x20,0x40,0x00,0x00}, // 47 '/'
{0x3C,0x46,0x4A,0x52,0x62,0x3C,0x00,0x00}, // 48 '0'
{0x18,0x38,0x18,0x18,0x18,0x3C,0x00,0x00}, // 49 '1'
{0x3C,0x42,0x02,0x1C,0x20,0x7E,0x00,0x00}, // 50 '2'
{0x3C,0x42,0x0C,0x02,0x42,0x3C,0x00,0x00}, // 51 '3'
{0x0C,0x14,0x24,0x7E,0x04,0x04,0x00,0x00}, // 52 '4'
{0x7E,0x40,0x7C,0x02,0x42,0x3C,0x00,0x00}, // 53 '5'
{0x1C,0x20,0x7C,0x42,0x42,0x3C,0x00,0x00}, // 54 '6'
{0x7E,0x02,0x04,0x08,0x10,0x10,0x00,0x00}, // 55 '7'
{0x3C,0x42,0x3C,0x42,0x42,0x3C,0x00,0x00}, // 56 '8'
{0x3C,0x42,0x42,0x3E,0x04,0x38,0x00,0x00}, // 57 '9'
{0x00,0x18,0x18,0x00,0x18,0x18,0x00,0x00}, // 58 ':'
{0x00,0x18,0x18,0x00,0x18,0x18,0x10,0x00}, // 59 ';'
{0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x00}, // 60 '<'
{0x00,0x00,0x7E,0x00,0x7E,0x00,0x00,0x00}, // 61 '='
{0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x00}, // 62 '>'
{0x3C,0x42,0x04,0x08,0x00,0x08,0x00,0x00}, // 63 '?'
{0x3C,0x42,0x5E,0x56,0x5E,0x40,0x3C,0x00}, // 64 '@'
{0x18,0x24,0x42,0x7E,0x42,0x42,0x00,0x00}, // 65 'A'
{0x7C,0x42,0x7C,0x42,0x42,0x7C,0x00,0x00}, // 66 'B'
{0x3C,0x42,0x40,0x40,0x42,0x3C,0x00,0x00}, // 67 'C'
{0x78,0x44,0x42,0x42,0x44,0x78,0x00,0x00}, // 68 'D'
{0x7E,0x40,0x7C,0x40,0x40,0x7E,0x00,0x00}, // 69 'E'
{0x7E,0x40,0x7C,0x40,0x40,0x40,0x00,0x00}, // 70 'F'
{0x3C,0x42,0x40,0x4E,0x42,0x3C,0x00,0x00}, // 71 'G'
{0x42,0x42,0x7E,0x42,0x42,0x42,0x00,0x00}, // 72 'H'
{0x3C,0x18,0x18,0x18,0x18,0x3C,0x00,0x00}, // 73 'I'
{0x1E,0x06,0x06,0x06,0x46,0x3C,0x00,0x00}, // 74 'J'
{0x44,0x48,0x70,0x48,0x44,0x42,0x00,0x00}, // 75 'K'
{0x40,0x40,0x40,0x40,0x40,0x7E,0x00,0x00}, // 76 'L'
{0x42,0x66,0x5A,0x42,0x42,0x42,0x00,0x00}, // 77 'M'
{0x42,0x62,0x52,0x4A,0x46,0x42,0x00,0x00}, // 78 'N'
{0x3C,0x42,0x42,0x42,0x42,0x3C,0x00,0x00}, // 79 'O'
{0x7C,0x42,0x42,0x7C,0x40,0x40,0x00,0x00}, // 80 'P'
{0x3C,0x42,0x42,0x4A,0x44,0x3A,0x00,0x00}, // 81 'Q'
{0x7C,0x42,0x42,0x7C,0x44,0x42,0x00,0x00}, // 82 'R'
{0x3C,0x40,0x3C,0x02,0x42,0x3C,0x00,0x00}, // 83 'S'
{0x7E,0x18,0x18,0x18,0x18,0x18,0x00,0x00}, // 84 'T'
{0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00}, // 85 'U'
{0x42,0x42,0x42,0x24,0x24,0x18,0x00,0x00}, // 86 'V'
{0x42,0x42,0x42,0x5A,0x66,0x42,0x00,0x00}, // 87 'W'
{0x42,0x24,0x18,0x18,0x24,0x42,0x00,0x00}, // 88 'X'
{0x42,0x42,0x24,0x18,0x18,0x18,0x00,0x00}, // 89 'Y'
{0x7E,0x04,0x08,0x10,0x20,0x7E,0x00,0x00}, // 90 'Z'
{0x3C,0x30,0x30,0x30,0x30,0x3C,0x00,0x00}, // 91 '['
{0x40,0x20,0x10,0x08,0x04,0x02,0x00,0x00}, // 92 '\'
{0x3C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00,0x00}, // 93 ']'
{0x18,0x24,0x00,0x00,0x00,0x00,0x00,0x00}, // 94 '^'
{0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00}, // 95 '_'
{0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00}, // 96 '`'
{0x00,0x00,0x3C,0x02,0x3E,0x42,0x3E,0x00}, // 97 'a'
{0x40,0x40,0x7C,0x42,0x42,0x42,0x7C,0x00}, // 98 'b'
{0x00,0x00,0x3C,0x40,0x40,0x40,0x3C,0x00}, // 99 'c'
{0x02,0x02,0x3E,0x42,0x42,0x42,0x3E,0x00}, // 100 'd'
{0x00,0x00,0x3C,0x42,0x7E,0x40,0x3C,0x00}, // 101 'e'
{0x0C,0x10,0x3C,0x10,0x10,0x10,0x10,0x00}, // 102 'f'
{0x00,0x00,0x3E,0x42,0x42,0x3E,0x02,0x3C}, // 103 'g'
{0x40,0x40,0x7C,0x42,0x42,0x42,0x42,0x00}, // 104 'h'
{0x18,0x00,0x38,0x18,0x18,0x18,0x3C,0x00}, // 105 'i'
{0x06,0x00,0x06,0x06,0x06,0x06,0x46,0x3C}, // 106 'j'
{0x40,0x40,0x44,0x48,0x70,0x48,0x44,0x00}, // 107 'k'
{0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00}, // 108 'l'
{0x00,0x00,0x64,0x5A,0x42,0x42,0x42,0x00}, // 109 'm'
{0x00,0x00,0x7C,0x42,0x42,0x42,0x42,0x00}, // 110 'n'
{0x00,0x00,0x3C,0x42,0x42,0x42,0x3C,0x00}, // 111 'o'
{0x00,0x00,0x7C,0x42,0x42,0x7C,0x40,0x40}, // 112 'p'
{0x00,0x00,0x3E,0x42,0x42,0x3E,0x02,0x02}, // 113 'q'
{0x00,0x00,0x5C,0x62,0x40,0x40,0x40,0x00}, // 114 'r'
{0x00,0x00,0x3E,0x40,0x3C,0x02,0x7C,0x00}, // 115 's'
{0x10,0x10,0x3C,0x10,0x10,0x10,0x0C,0x00}, // 116 't'
{0x00,0x00,0x42,0x42,0x42,0x42,0x3E,0x00}, // 117 'u'
{0x00,0x00,0x42,0x42,0x24,0x24,0x18,0x00}, // 118 'v'
{0x00,0x00,0x42,0x42,0x42,0x5A,0x24,0x00}, // 119 'w'
{0x00,0x00,0x42,0x24,0x18,0x24,0x42,0x00}, // 120 'x'
{0x00,0x00,0x42,0x42,0x42,0x3E,0x02,0x3C}, // 121 'y'
{0x00,0x00,0x7E,0x04,0x18,0x20,0x7E,0x00}, // 122 'z'
{0x0C,0x10,0x10,0x20,0x10,0x10,0x0C,0x00}, // 123 '{'
{0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00}, // 124 '|'
{0x30,0x08,0x08,0x04,0x08,0x08,0x30,0x00}, // 125 '}'
{0x00,0x32,0x4C,0x00,0x00,0x00,0x00,0x00}, // 126 '~'
};
// =====================================================================
// ASCII text rendering
// =====================================================================
void outtextxy(int x, int y, const char *text) {
// BGI font 2 (SMALL_FONT) scaling: our 8x8 font is larger than SMALL_FONT base.
// For large setusercharsize multipliers (>=1), scale down with base=0.6 to fit in boxes.
// For small multipliers (<1, e.g. gauge labels), use the multiplier directly on 8x8.
float mx = (g_user_mult_x > 0 && g_user_div_x > 0)
? (float)g_user_mult_x / (float)g_user_div_x : 1.0f;
float my = (g_user_mult_y > 0 && g_user_div_y > 0)
? (float)g_user_mult_y / (float)g_user_div_y : 1.0f;
if (g_text_font == 2) {
// Scale down our 8x8 font to approximate BGI SMALL_FONT:
// - multiplier > 1 (e.g. 3/2=1.5): large text for display boxes → base 0.6
// - multiplier == 1 exactly (e.g. 3/3): normal text → base 0.6
// - multiplier < 1 (e.g. 2/3=0.667): small text for labels → no base reduction
float base = 0.6f;
if (mx >= 1.0f) mx *= base;
if (my >= 1.0f) my *= base;
}
float fsx = mx;
float fsy = my;
set_render_color(g_color);
float cx = (float)x;
while (*text) {
int idx = (int)(unsigned char)*text - 32;
if (idx >= 0 && idx <= 94) {
const unsigned char *glyph = font8x8[idx];
for (int row = 0; row < 8; row++) {
unsigned char bits = glyph[row];
for (int col = 0; col < 8; col++) {
if (bits & (0x80 >> col)) {
int px = (int)(cx + col * fsx);
int py = (int)(y + row * fsy);
SDL_RenderDrawPoint(gRenderer, px, py);
}
}
}
}
cx += 8.0f * fsx;
text++;
}
}
// =====================================================================
// 16x16 ASCII text rendering (matches outhzxy3 interface)
// Renders English text using font16x16[] with same size/space/fat/
// direction/color parameters as outhzxy3(), so English glyphs have
// comparable visual weight to Chinese HZK16 glyphs.
// =====================================================================
void out_en16(int x, int y, const char *text, float size, float space,
float fat, int direction, int color) {
int old_color = g_color;
setcolor(color);
setfillstyle(1, color);
while (*text) {
unsigned char ch = (unsigned char)*text;
if (ch >= 32 && ch <= 126) {
const unsigned char *buf = font16x16[ch - 32];
int radiumX = (int)(size / 2 + fat);
int radiumY = (int)(size / 2);
if (fat < 0) { radiumX = (int)(size/2 + fat); radiumY = (int)(size/2 + fat); }
if (direction == 1) { // VERT_DIR
float gx;
int i;
for (i = 0, gx = (float)x; i < 31; i += 2, gx += size) {
unsigned char mark;
float j;
for (mark = 0x80, j = 0; mark > 0; mark >>= 1, j++) {
if (buf[i] & mark) {
bar((int)(gx + size/2), (int)(y - j*size - size/2),
(int)(gx + size/2 + radiumX), (int)(y - j*size - size/2 + radiumY));
}
if (buf[i+1] & mark) {
bar((int)(gx + size/2), (int)(y - (j+8)*size - size/2),
(int)(gx + size/2 + radiumX), (int)(y - (j+8)*size - size/2 + radiumY));
}
}
}
} else { // HORIZ_DIR (default)
float gy;
int i;
for (i = 0, gy = (float)y; i < 31; i += 2, gy += size) {
unsigned char mark;
float j;
for (mark = 0x80, j = 0; mark > 0; mark >>= 1, j++) {
if (buf[i] & mark) {
bar((int)(x + j*size + size/2), (int)(gy + size/2),
(int)(x + j*size + size/2 + radiumX), (int)(gy + size/2 + radiumY));
}
if (buf[i+1] & mark) {
bar((int)(x + (j+8)*size + size/2), (int)(gy + size/2),
(int)(x + (j+8)*size + size/2 + radiumX), (int)(gy + size/2 + radiumY));
}
}
}
}
}
// Advance position — tight spacing for English ASCII
if (direction == 0) x += (int)(size * 8 + space * 2);
else y -= (int)(size * 8 + 1);
moveto(x, y);
text++;
}
setcolor(old_color);
}
// =====================================================================
// HZK16 Chinese text rendering (ported from _OUTPUTHZ.CPP)
// =====================================================================
bool load_hzk16(const char *path) {
FILE *f = fopen(path, "rb");
if (!f) return false;
fseek(f, 0, SEEK_END);
gFontSize = (int)ftell(f);
fseek(f, 0, SEEK_SET);
gFontData = (unsigned char *)malloc(gFontSize);
if (!gFontData) { fclose(f); return false; }
if ((int)fread(gFontData, 1, gFontSize, f) != gFontSize) {
free(gFontData); gFontData = nullptr; fclose(f); return false;
}
fclose(f);
return true;
}
static int disp_hz3(int left, int top, unsigned char byte1, unsigned char byte2,
float size, float fat, int direction) {
if (!gFontData) return 0;
if (byte1 < 0xa1 || byte1 > 0xfe || byte2 < 0xa1 || byte2 > 0xfe) return 0;
long p = (byte1 - 0xa1) * 0x5e + byte2 - 0xa1;
p *= 32;
if (p + 32 > gFontSize) return 0;
const unsigned char *buf = gFontData + p;
int radiumX = (int)(size / 2 + fat);
int radiumY = (int)(size / 2);
if (fat < 0) { radiumX = (int)(size/2 + fat); radiumY = (int)(size/2 + fat); }
if (direction == 1) { // VERT_DIR
float x;
int i;
for (i = 0, x = (float)left; i < 31; i += 2, x += size) {
unsigned char mark;
float j;
for (mark = 0x80, j = 0; mark > 0; mark >>= 1, j++) {
if (buf[i] & mark) {
bar((int)(x + size/2), (int)(top - j*size - size/2),
(int)(x + size/2 + radiumX), (int)(top - j*size - size/2 + radiumY));
}
if (buf[i+1] & mark) {
bar((int)(x + size/2), (int)(top - (j+8)*size - size/2),
(int)(x + size/2 + radiumX), (int)(top - (j+8)*size - size/2 + radiumY));
}
}
}
return 0;
}
// HORIZ_DIR (default)
float y;
int i;
for (i = 0, y = (float)top; i < 31; i += 2, y += size) {
unsigned char mark;
float j;
for (mark = 0x80, j = 0; mark > 0; mark >>= 1, j++) {
if (buf[i] & mark) {
bar((int)(left + j*size + size/2), (int)(y + size/2),
(int)(left + j*size + size/2 + radiumX), (int)(y + size/2 + radiumY));
}
if (buf[i+1] & mark) {
bar((int)(left + (j+8)*size + size/2), (int)(y + size/2),
(int)(left + (j+8)*size + size/2 + radiumX), (int)(y + size/2 + radiumY));
}
}
}
return 1;
}
void outhzxy3(int x, int y, const char *p, float size, float space,
float fat, int direction, int color) {
int old_color = g_color;
setcolor(color);
setfillstyle(1, color);
float sp = space * 8;
while (*p) {
unsigned char b1 = (unsigned char)*p;
unsigned char b2 = (unsigned char)*(p+1);
if (b1 >= 0xa1 && b1 <= 0xfe && b2 >= 0xa1 && b2 <= 0xfe) {
disp_hz3(x, y, b1, b2, size, fat, direction);
p += 2;
if (direction == 0) x += (int)(size * 16 + sp);
else y -= (int)(size * 14 + 2);
moveto(x, y);
} else {
if (g_language == LANG_EN && b1 >= 32 && b1 <= 126) {
// English mode: render ASCII using 16x16 font at same scale as Chinese
const unsigned char *buf = font16x16[b1 - 32];
int radiumX = (int)(size / 2 + fat);
int radiumY = (int)(size / 2);
if (fat < 0) { radiumX = (int)(size/2 + fat); radiumY = (int)(size/2 + fat); }
if (direction == 1) { // VERT_DIR
float gx;
int i;
for (i = 0, gx = (float)x; i < 31; i += 2, gx += size) {
unsigned char mark;
float j;
for (mark = 0x80, j = 0; mark > 0; mark >>= 1, j++) {
if (buf[i] & mark)
bar((int)(gx + size/2), (int)(y - j*size - size/2),
(int)(gx + size/2 + radiumX), (int)(y - j*size - size/2 + radiumY));
if (buf[i+1] & mark)
bar((int)(gx + size/2), (int)(y - (j+8)*size - size/2),
(int)(gx + size/2 + radiumX), (int)(y - (j+8)*size - size/2 + radiumY));
}
}
} else { // HORIZ_DIR
float gy;
int i;
for (i = 0, gy = (float)y; i < 31; i += 2, gy += size) {
unsigned char mark;
float j;
for (mark = 0x80, j = 0; mark > 0; mark >>= 1, j++) {
if (buf[i] & mark)
bar((int)(x + j*size + size/2), (int)(gy + size/2),
(int)(x + j*size + size/2 + radiumX), (int)(gy + size/2 + radiumY));
if (buf[i+1] & mark)
bar((int)(x + (j+8)*size + size/2), (int)(gy + size/2),
(int)(x + (j+8)*size + size/2 + radiumX), (int)(gy + size/2 + radiumY));
}
}
}
// Advance — tight spacing for English ASCII
if (direction == 0) x += (int)(size * 8 + space * 2);
else y -= (int)(size * 8 + 1);
moveto(x, y);
} else {
// Chinese mode or non-printable: use 8x8 fallback
char q[2] = {*p, '\0'};
outtextxy(x, y + 4, q);
x += 8;
}
p++;
}
}
setcolor(old_color);
}
// =====================================================================
// Sound functions — square-wave audio via SDL2
// =====================================================================
void Sound(int freq) {
g_audio_freq.store(freq, std::memory_order_relaxed);
if (g_audio_device != 0) {
g_audio_enabled.store(true, std::memory_order_relaxed);
SDL_PauseAudioDevice(g_audio_device, 0);
}
}
void Nosound() {
g_audio_enabled.store(false, std::memory_order_relaxed);
if (g_audio_device != 0) {
SDL_PauseAudioDevice(g_audio_device, 1);
}
}
void Delay(int clicks) {
SDL_Delay(clicks * 55);
}
void Sound_All(int freq, int clicks) {
Sound(freq);
Delay(clicks);
Nosound();
}
// =====================================================================
// Value display functions (from _PUT_OUT.CPP)
// =====================================================================
static const float temp_display_table[70] = {
0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,22,24,26,28,
30,32,34,35,38,41,44,47,50,53,56,59,62,65,68,71,75,79,83,87,
91,95,99,100,103,106,109,112,115,118,121,124,127,130,133,136,139,142,143,144,
145,146,147,148,149,150,151,153,157,160
};
static const int fire_pct_table[23] = {
0,4,9,14,18,23,28,33,38,43,48,53,58,63,68,73,78,83,88,91,94,97,100
};
void putout_level(int x, int y, int t) {
setfillstyle(1, 0); bar(x+26, y+25, x+78, y+43);
setfillstyle(1, 15); bar(x+25, y+25, x+77, y+42);
setfillstyle(1, 12); bar(x+26, y+26, x+76, y+41);
setcolor(15);
settextstyle(2, 0, 4);
setusercharsize(3, 2, 3, 2);
char buf[16];
snprintf(buf, sizeof(buf), "%d", t);
int xoff = (t < 10) ? x+36 : (t < 100) ? x+32 : x+27;
outtextxy(xoff, y+30, buf);
settextstyle(0, 0, 0);
outhzxy3(x+53, y+28, get_string(STR_CM_UNIT_DISPLAY), 0.7, 0, 0, 0, 15); // 厘米 (cm)
}
void putout_temp(int x, int y, int t) {
setfillstyle(1, 12); bar(x+21, y+26, x+60, y+41);
setcolor(15);
settextstyle(2, 0, 4);
setusercharsize(4, 3, 4, 3);