From 79b78b5345f3f2d52c11acd2840635a634b36c7f Mon Sep 17 00:00:00 2001 From: lephe Date: Tue, 11 Jul 2017 13:51:56 +0200 Subject: [PATCH] Hopefully the last adjustments before the first release. --- TODO | 7 +- configure | 6 +- demo/asm_syscalls.s | 56 ------- demo/gintdemo.c | 267 +++++++++------------------------- demo/perf_bopti.c | 179 +++++++++++++++++++++++ demo/resources/opt_bitmap.bmp | Bin 3194 -> 3194 bytes demo/resources/opt_gray.bmp | Bin 3194 -> 3194 bytes demo/resources/opt_menu.bmp | Bin 3194 -> 3194 bytes demo/resources/screen.bmp | Bin 32906 -> 13570 bytes demo/resources/town.bmp | Bin 0 -> 105770 bytes demo/test_bopti.c | 61 +++++--- demo/test_gray.c | 49 ++++--- gscreen.bmp | Bin 0 -> 1150 bytes gscreend.bmp | Bin 0 -> 1150 bytes gscreenl.bmp | Bin 0 -> 1150 bytes include/bfile.h | 74 ++++++++++ include/internals/syscalls.h | 3 + include/keyboard.h | 3 + include/modules/interrupts.h | 6 +- src/core/syscalls.s | 64 ++++++++ src/gray/grect.c | 2 +- src/init/crt0.c | 4 +- src/keyboard/getkey.c | 12 +- version | 2 +- 24 files changed, 480 insertions(+), 315 deletions(-) delete mode 100644 demo/asm_syscalls.s create mode 100644 demo/perf_bopti.c create mode 100644 demo/resources/town.bmp create mode 100644 gscreen.bmp create mode 100644 gscreend.bmp create mode 100644 gscreenl.bmp create mode 100644 include/bfile.h diff --git a/TODO b/TODO index ee2bab3..47e0637 100644 --- a/TODO +++ b/TODO @@ -14,11 +14,14 @@ Things to do before 1.0: Things to do later: - bopti: Implement blending modes for monochrome bitmaps +- clock: Only measure if requires as option, otherwise trust {FTune} - clock: Handle overclock (relaunch clocks when overclocking) +- clock: Split code into several files, change clock_config_t type - core: Change interrupt priority using the gint API - core: Register more interrupts (and understand their parameters) - core: Remove redundant code linked to environment saves - core: Review interrupt system (again) - this one is too slow +- display: Try to make this module lighter (lots of code in text section) - errno: Introduce errno and use it more or less everywhere - esper: Cleaner playback, synthesizing - events: Allow customization of keyboard event system (option to return @@ -26,10 +29,12 @@ Things to do later: - events: Generate keyboard events on-the-fly by reading state arrays, | allowing both a faster interrupt and avoiding supressing other | events inside getkey() and multigetkey() +- gray: Same as display, it's quite heavy - serial: Implement a driver -- stdio: More serious formatted printing functions +- stdio: More serious formatted printing functions and headers - string: Use cmp/str to implement memchr() (assembler examples) - string: Do some tests for memcmp() and memcpy() +- string: Lighter functions? - usb: Implement a driver Things to investigate: diff --git a/configure b/configure index 83c842f..bb6ae65 100755 --- a/configure +++ b/configure @@ -52,11 +52,11 @@ Options that affect the behavior of the library: use this option when using both the gray engine and --no-syscalls. Options that customize size limits: - $Cr--atexit-max$C0=$Cy$Cg [default:$Cp 16$Cg]$C0 + $Cr--atexit-max=$Cy$Cg [default:$Cp 16$Cg]$C0 Number of exit handlers that can be registered by atexit(). - $Cr--timer-slots$C0=$Cy$Cg [default:$Cp 16$Cg]$C0 + $Cr--timer-slots=$Cy$Cg [default:$Cp 16$Cg]$C0 Number of virtual timers that may be registered at the same time. - $Cr--events-queue-size$C0=$Cy$Cg [default:$Cp 64$Cg]$C0 + $Cr--events-queue-size=$Cy$Cg [default:$Cp 64$Cg]$C0 Number of events simultaneously stored in the event queue. EOF diff --git a/demo/asm_syscalls.s b/demo/asm_syscalls.s deleted file mode 100644 index 69b4f10..0000000 --- a/demo/asm_syscalls.s +++ /dev/null @@ -1,56 +0,0 @@ - - # int BFile_Remove(const uint16_t *file) - .global _BFile_Remove - -_BFile_Remove: - mov.l 1f, r0 - mov.l 2f, r1 - jmp @r1 - mov #0, r5 -1: .long 0x0439 - - # int BFile_Create(const uint16_t *file, enum { file = 1, folder = 5 }, - # int *size) - .global _BFile_Create - -_BFile_Create: - mov.l 1f, r0 - mov.l 2f, r1 - jmp @r1 - nop -1: .long 0x0434 - - # int BFile_Open(const uint16_t *file, int mode) - .global _BFile_Open - -_BFile_Open: - mov.l 1f, r0 - mov.l 2f, r1 - jmp @r1 - mov #0, r6 -1: .long 0x042c - - # int BFile_Close(int handle) - .global _BFile_Close - -_BFile_Close: - mov.l 1f, r0 - mov.l 2f, r1 - jmp @r1 - nop -1: .long 0x042d - - # int BFile_Write(int handle, void *ram_buffer, int even_size) - .global _BFile_Write - -_BFile_Write: - mov.l 1f, r0 - mov.l 2f, r1 - jmp @r1 - nop -1: .long 0x0435 - - .align 4 - -# Syscall branch address -2: .long 0x80010070 diff --git a/demo/gintdemo.c b/demo/gintdemo.c index 4655bf6..16ffaf5 100644 --- a/demo/gintdemo.c +++ b/demo/gintdemo.c @@ -54,154 +54,6 @@ void printf_test(void) } */ -/* -static const unsigned char screen[1024] = { -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0, 0, 0, 0, 0, 0, 0, 7, 159, 0, 0, 1, 192, 0, 0, 0, 0, 0, 121, 240, 0, 0, 0, -31, 191, 192, 0, 3, 224, 27, 216, 0, 0, 1, 251, 252, 0, 0, 0, 57, 247, 222, -30, 7, 240, 36, 36, 62, 25, 131, 159, 24, 255, 129, 224, 0, 227, 142, 126, 1, -192, 45, 172, 127, 127, 192, 14, 1, 255, 199, 224, 0, 227, 140, 240, 1, 192, -26, 88, 115, 127, 224, 14, 57, 221, 207, 0, 0, 227, 13, 192, 1, 192, 34, 68, -120, 30, 0, 14, 25, 156, 220, 0, 0, 227, 253, 252, 1, 192, 36, 36, 126, 28, -0, 14, 219, 156, 223, 192, 0, 227, 253, 252, 1, 192, 36, 36, 31, 12, 0, 46, -27, 140, 223, 192, 0, 227, 141, 193, 193, 192, 40, 20, 7, 140, 0, 206, 25, 140, -220, 28, 0, 227, 140, 225, 129, 199, 24, 24, 99, 156, 1, 14, 25, 204, 206, 24, -0, 227, 142, 127, 1, 195, 39, 228, 255, 156, 2, 14, 24, 237, 199, 240, 1, 247, -222, 62, 1, 198, 44, 44, 223, 30, 2, 31, 28, 237, 131, 224, 1, 224, 0, 0, 3, -254, 27, 216, 0, 0, 4, 30, 0, 0, 0, 0, 3, 192, 0, 0, 7, 252, 0, 0, 0, 0, 4, -60, 1, 249, 240, 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, 4, 0, 97, 240, 56, 0, 0, -0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 1, 224, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, 0, 47, 192, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 32, 255, 128, 63, 128, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 32, 255, 0, 48, 78, 0, 0, 0, 0, 0, 0, 0, 0, -0, 0, 15, 176, 255, 0, 112, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 8, 56, 255, 0, -96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 98, 8, 60, 255, 0, 224, 0, 0, 0, 0, 0, 0, -0, 0, 0, 0, 130, 56, 126, 255, 3, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 192, -62, 255, 15, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 14, 191, 255, 192, 0, -0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 6, 129, 255, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 6, 0, 255, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 7, 128, 63, 192, -0, 0, 96, 1, 224, 1, 0, 0, 0, 2, 0, 0, 7, 0, 31, 192, 0, 0, 95, 1, 11, 68, 88, -0, 0, 4, 0, 0, 7, 128, 31, 192, 0, 1, 192, 129, 204, 85, 100, 0, 0, 8, 0, 0, -15, 128, 63, 224, 0, 0, 95, 1, 8, 85, 68, 0, 1, 144, 0, 0, 31, 128, 143, 224, -64, 0, 96, 1, 232, 41, 68, 0, 2, 96, 0, 31, 255, 129, 7, 248, 96, 0, 0, 0, 0, -0, 0, 0, 4, 0, 0, 96, 254, 129, 7, 254, 96, 0, 0, 0, 0, 0, 0, 0, 4, 0, 1, 128, -254, 131, 135, 255, 224, 0, 0, 1, 192, 64, 16, 0, 8, 0, 7, 0, 254, 131, 255, -63, 224, 0, 0, 1, 38, 113, 208, 0, 8, 0, 13, 0, 222, 147, 254, 31, 224, 0, 0, -1, 41, 74, 80, 0, 8, 0, 25, 0, 222, 67, 254, 31, 160, 0, 0, 1, 41, 74, 80, 0, -12, 0, 49, 0, 222, 19, 254, 62, 48, 0, 0, 1, 198, 113, 208, 0, 2, 0, 32, 128, -222, 195, 255, 252, 56, 0, 0, 0, 0, 0, 0, 0, 2, 0, 124, 64, 220, 151, 135, 248, -127, 0, 0, 0, 0, 0, 0, 0, 2, 0, 66, 32, 221, 223, 7, 240, 255, 0, 0, 0, 0, 0, -0, 0, 2, 0, 129, 23, 93, 159, 15, 241, 131, 0, 0, 0, 0, 0, 0, 0, 4, 0, 128, -136, 217, 95, 3, 226, 9, 0, 0, 1, 240, 0, 0, 0, 4, 0, 128, 72, 89, 95, 129, -228, 18, 0, 0, 0, 0, 0, 0, 0, 4, 1, 0, 72, 73, 127, 128, 224, 36, 0, 0, 0, 0, -0, 0, 0, 28, 1, 0, 76, 129, 127, 192, 96, 8, 0, 0, 0, 0, 0, 0, 0, 16, 1, 0, -231, 203, 124, 96, 64, 0, 0, 0, 0, 0, 0, 0, 0, 16, 1, 1, 28, 123, 240, 12, 64, -1, 0, 0, 0, 0, 0, 0, 0, 16, 1, 2, 28, 143, 128, 15, 192, 7, 0, 0, 0, 0, 0, 0, -0, 16, 1, 4, 17, 143, 24, 15, 192, 14, 0, 0, 0, 0, 0, 0, 0, 28, 1, 4, 1, 135, -24, 31, 192, 24, 0, 0, 0, 0, 0, 0, 0, 18, 1, 62, 1, 135, 248, 63, 224, 192, -0, 0, 0, 0, 0, 0, 0, 35, 1, 195, 1, 135, 128, 254, 126, 1, 0, 0, 0, 0, 0, 0, -0, 35, 193, 131, 195, 135, 255, 248, 112, 1, 0, 0, 0, 0, 0, 0, 0, 67, 241, 131, -14, 207, 255, 192, 224, 3, 0, 0, 0, 0, 0, 0, 3, 67, 15, 143, 56, 255, 7, 1, -224, 7, 0, 0, 0, 0, 0, 0, 28, 130, 7, 255, 112, 204, 7, 131, 224, 31, 0, 0, -0, 0, 0, 0, 32, 134, 30, 29, 120, 156, 7, 255, 224, 127, 0, 0, 0, 0, 0, 63, -197, 206, 60, 56, 192, 248, 15, 255, 248, 255, 0, 0, 0, 0, 0, 120, 5, 227, 248, -56, 195, 248, 127, 191, 254, 63, 0, 0, 0, 0, 7, 254, 255, 193, 255, 15, 193, -255, 15, 31, 252, 31 }; - -void ML_bmp_or_cl(const unsigned char *bmp, int x, int y, int width, int height) -{ - unsigned short line; - char shift, *screen, *p; - int i, j, real_width, begin_x, end_x, begin_y, end_y; - char bool1=1, bool2=1, bool3; - if(!bmp || x<1-width || x>127 || y<1-height || y>63 || height<1 || width<1) return; - p = (char*)&line; - real_width = (width-1>>3<<3)+8; - if(y < 0) begin_y = -y; - else begin_y = 0; - if(y+height > 64) end_y = 64-y; - else end_y = height; - shift = 8-(x&7); - if(x<0) - { - begin_x = -x>>3; - if(shift != 8) bool1 = 0; - } else begin_x = 0; - if(x+real_width > 128) end_x = 15-(x>>3), bool2 = 0; - else end_x = real_width-1>>3; - bool3 = (end_x == real_width-1>>3); - screen = display_getCurrentVRAM()+(y+begin_y<<4)+(x>>3); - - for(i=begin_y ; i>3)+begin_x] << shift; - if(bool1) screen[begin_x] |= *p; - if(shift!=8) screen[begin_x+1] |= *(p+1); - for(j=begin_x+1 ; j>3)+j] << shift; - screen[j] |= *p; - if(shift!=8) screen[j+1] |= *(p+1); - } - } - line = bmp[i*(real_width>>3)+end_x]; - if(bool3) line &= -1< -void debug(void) -{ - extern Image res_screen_start; - struct mod_tmu *timer; - int time1, time2; - int i; - - timer_get(TIMER_USER, &timer, NULL); - - dclear(); - ML_bmp_or_cl(screen, 1, 1, 128, 64); - dupdate(); - getkey(); - - dclear(); - dimage(&res_screen_start, 1, 1); - dupdate(); - getkey(); - - dclear(); - dtext("ML...", 2, 2); - dupdate(); - - timer_start2(TIMER_USER, 0x0fffffff, TIMER_Po_4, NULL, 0); - for(i = 0; i < 1000; i++) ML_bmp_or_cl(screen, 1, 1, 128, 64); - time1 = timer->TCNT; - timer_stop(TIMER_USER); - time1 = 0x0fffffff - time1; - - dclear(); - dtext("gint...", 2, 2); - dupdate(); - - timer_start2(TIMER_USER, 0x0fffffff, TIMER_Po_4, NULL, 0); - for(i = 0; i < 1000; i++) dimage(&res_screen_start, 1, 1); - time2 = timer->TCNT; - timer_stop(TIMER_USER); - time2 = 0x0fffffff - time2; - - dclear(); - print_hex(time1, 2, 2); - print_hex(time2, 2, 9); - dupdate(); - while(getkey() != KEY_EXIT); -} -*/ - /* tlb_debug() Displays the TLB contents and some information. Only available for @@ -311,15 +163,13 @@ void main_menu(int *category, int *app) "Clocks and timers", NULL }; +/* const char *list_perfs[] = { "Image rendering", "Text rendering", NULL }; - const char *list_debug[] = { - "View TLB (SH3 only)", - NULL - }; +*/ const char **list = NULL; int list_len = 0; @@ -367,22 +217,17 @@ void main_menu(int *category, int *app) locate(1, 1, "Test list"); list = list_tests; break; - +/* case 2: locate(1, 1, "Performance"); list = list_perfs; break; - - case 3: - locate(1, 1, "Debug"); - list = list_debug; - break; - +*/ default: print(1, 1, "Tab %d", tab); break; } - dimage(0, 56, &res_opt_menu); + dimage_part(0, 56, &res_opt_menu, 0, 0, 42, 8); if(list) { @@ -422,22 +267,17 @@ void main_menu(int *category, int *app) index = 0; scroll = 0; break; - case KEY_F3: +/* case KEY_F3: + *category = 2; + *app = 1; + return; +*/ +/* case KEY_F3: if(tab == 2) break; tab = 2; index = 0; scroll = 0; break; - case KEY_F4: - if(tab == 3) break; - tab = 3; - index = 0; - scroll = 0; - break; -/* case KEY_F6:; - void screen(void); - screen(); - break; */ case KEY_UP: if(list && list_len > 1) @@ -514,36 +354,18 @@ int main(void) case 0x0105: test_rtc(); break; case 0x0106: test_timer(); break; - case 0x0201: /* perf_bopti(); */ break; + case 0x0201: perf_bopti(); break; case 0x0202: /* perf_tales(); */ break; - - case 0x0301: /* if(isSH3()) debug_tlb(); */ break; } } return 0; } -static void crash(void) +/* +#include +void screen(void) { - __asm__( - "mov #0, r0 \n\t" - "ldc r0, vbr \n\t" - "trapa #1 " - ); -} - -static void screen(void) -{ - enum { File = 1, Folder = 5 }; - enum { Read = 0x01, Write = 0x02, ReadWrite = Read | Write }; - - int BFile_Remove(const uint16_t *file); - int BFile_Create(const uint16_t *file, int type, int *size); - int BFile_Open(const uint16_t *file, int mode); - int BFile_Close(int handle); - int BFile_Write(int handle, const void *ram_buffer, int even_size); - const uint8_t bmp_header[0x7e] = { 0x42, 0x4d, 0x7e, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6c, 0x00, @@ -567,8 +389,8 @@ static void screen(void) int size = 0x7e + 1024; BFile_Remove(file); - BFile_Create(file, File, &size); - int handle = BFile_Open(file, Write); + BFile_Create(file, BFile_File, &size); + int handle = BFile_Open(file, BFile_WriteOnly); BFile_Write(handle, bmp_header, 0x7e); void *vram = (void *)display_getCurrentVRAM() + 1024; for(int i = 1; i <= 64; i++) @@ -577,3 +399,58 @@ static void screen(void) } BFile_Close(handle); } +void screengray(void) +{ + const uint8_t bmp_header[0x7e] = { + 0x42, 0x4d, 0x7e, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6c, 0x00, + 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x40, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x13, 0x0b, + 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x42, 0x47, + 0x52, 0x73, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, + }; + uint16_t file[] = { '\\', '\\', 'f', 'l', 's', '0', '\\', 'g', 's', + 'c', 'r', 'e', 'e', 'n', '#', '.', 'b', 'm', 'p', 0x00 }; + int size = 0x7e + 1024; + void *vram; + int handle; + + gupdate(); + + file[14] = 'l'; + BFile_Remove(file); + BFile_Create(file, BFile_File, &size); + handle = BFile_Open(file, BFile_WriteOnly); + BFile_Write(handle, bmp_header, 0x7e); + vram = (void *)gray_lightVRAM() + 1024; + for(int i = 1; i <= 64; i++) + { + BFile_Write(handle, vram - 16 * i, 16); + } + BFile_Close(handle); + + file[14] = 'd'; + BFile_Remove(file); + BFile_Create(file, BFile_File, &size); + handle = BFile_Open(file, BFile_WriteOnly); + BFile_Write(handle, bmp_header, 0x7e); + vram = (void *)gray_darkVRAM() + 1024; + for(int i = 1; i <= 64; i++) + { + BFile_Write(handle, vram - 16 * i, 16); + } + BFile_Close(handle); + + gupdate(); +} +*/ diff --git a/demo/perf_bopti.c b/demo/perf_bopti.c new file mode 100644 index 0000000..94a9907 --- /dev/null +++ b/demo/perf_bopti.c @@ -0,0 +1,179 @@ +#include +#include +#include +#include +#include + +/* +static const uint8_t screen[1024] = { +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 7, 159, 0, 0, 1, 192, 0, 0, 0, 0, 0, 121, 240, 0, 0, 0, +31, 191, 192, 0, 3, 224, 27, 216, 0, 0, 1, 251, 252, 0, 0, 0, 57, 247, 222, +30, 7, 240, 36, 36, 62, 25, 131, 159, 24, 255, 129, 224, 0, 227, 142, 126, 1, +192, 45, 172, 127, 127, 192, 14, 1, 255, 199, 224, 0, 227, 140, 240, 1, 192, +26, 88, 115, 127, 224, 14, 57, 221, 207, 0, 0, 227, 13, 192, 1, 192, 34, 68, +120, 30, 0, 14, 25, 156, 220, 0, 0, 227, 253, 252, 1, 192, 36, 36, 126, 28, +0, 14, 219, 156, 223, 192, 0, 227, 253, 252, 1, 192, 36, 36, 31, 12, 0, 46, +27, 140, 223, 192, 0, 227, 141, 193, 193, 192, 40, 20, 7, 140, 0, 206, 25, 140, +220, 28, 0, 227, 140, 225, 129, 199, 24, 24, 99, 156, 1, 14, 25, 204, 206, 24, +0, 227, 142, 127, 1, 195, 39, 228, 255, 156, 2, 14, 24, 237, 199, 240, 1, 247, +222, 62, 1, 198, 44, 44, 223, 30, 2, 31, 28, 237, 131, 224, 1, 224, 0, 0, 3, +254, 27, 216, 0, 0, 4, 30, 0, 0, 0, 0, 3, 192, 0, 0, 7, 252, 0, 0, 0, 0, 4, +60, 1, 249, 240, 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, 4, 0, 97, 240, 56, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 1, 224, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +4, 0, 47, 192, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 32, 255, 128, 63, 128, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 32, 255, 0, 48, 78, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 15, 176, 255, 0, 112, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 8, 56, 255, 0, +96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 98, 8, 60, 255, 0, 224, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 130, 56, 126, 255, 3, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 192, +62, 255, 15, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 14, 191, 255, 192, 0, +0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 6, 129, 255, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, +1, 0, 0, 6, 0, 255, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 7, 128, 63, 192, +0, 0, 96, 1, 224, 1, 0, 0, 0, 2, 0, 0, 7, 0, 31, 192, 0, 0, 95, 1, 11, 68, 88, +0, 0, 4, 0, 0, 7, 128, 31, 192, 0, 1, 192, 129, 204, 85, 100, 0, 0, 8, 0, 0, +15, 128, 63, 224, 0, 0, 95, 1, 8, 85, 68, 0, 1, 144, 0, 0, 31, 128, 143, 224, +64, 0, 96, 1, 232, 41, 68, 0, 2, 96, 0, 31, 255, 129, 7, 248, 96, 0, 0, 0, 0, +0, 0, 0, 4, 0, 0, 96, 254, 129, 7, 254, 96, 0, 0, 0, 0, 0, 0, 0, 4, 0, 1, 128, +254, 131, 135, 255, 224, 0, 0, 1, 192, 64, 16, 0, 8, 0, 7, 0, 254, 131, 255, +63, 224, 0, 0, 1, 38, 113, 208, 0, 8, 0, 13, 0, 222, 147, 254, 31, 224, 0, 0, +1, 41, 74, 80, 0, 8, 0, 25, 0, 222, 67, 254, 31, 160, 0, 0, 1, 41, 74, 80, 0, +12, 0, 49, 0, 222, 19, 254, 62, 48, 0, 0, 1, 198, 113, 208, 0, 2, 0, 32, 128, +222, 195, 255, 252, 56, 0, 0, 0, 0, 0, 0, 0, 2, 0, 124, 64, 220, 151, 135, 248, +127, 0, 0, 0, 0, 0, 0, 0, 2, 0, 66, 32, 221, 223, 7, 240, 255, 0, 0, 0, 0, 0, +0, 0, 2, 0, 129, 23, 93, 159, 15, 241, 131, 0, 0, 0, 0, 0, 0, 0, 4, 0, 128, +136, 217, 95, 3, 226, 9, 0, 0, 1, 240, 0, 0, 0, 4, 0, 128, 72, 89, 95, 129, +228, 18, 0, 0, 0, 0, 0, 0, 0, 4, 1, 0, 72, 73, 127, 128, 224, 36, 0, 0, 0, 0, +0, 0, 0, 28, 1, 0, 76, 129, 127, 192, 96, 8, 0, 0, 0, 0, 0, 0, 0, 16, 1, 0, +231, 203, 124, 96, 64, 0, 0, 0, 0, 0, 0, 0, 0, 16, 1, 1, 28, 123, 240, 12, 64, +1, 0, 0, 0, 0, 0, 0, 0, 16, 1, 2, 28, 143, 128, 15, 192, 7, 0, 0, 0, 0, 0, 0, +0, 16, 1, 4, 17, 143, 24, 15, 192, 14, 0, 0, 0, 0, 0, 0, 0, 28, 1, 4, 1, 135, +24, 31, 192, 24, 0, 0, 0, 0, 0, 0, 0, 18, 1, 62, 1, 135, 248, 63, 224, 192, +0, 0, 0, 0, 0, 0, 0, 35, 1, 195, 1, 135, 128, 254, 126, 1, 0, 0, 0, 0, 0, 0, +0, 35, 193, 131, 195, 135, 255, 248, 112, 1, 0, 0, 0, 0, 0, 0, 0, 67, 241, 131, +14, 207, 255, 192, 224, 3, 0, 0, 0, 0, 0, 0, 3, 67, 15, 143, 56, 255, 7, 1, +224, 7, 0, 0, 0, 0, 0, 0, 28, 130, 7, 255, 112, 204, 7, 131, 224, 31, 0, 0, +0, 0, 0, 0, 32, 134, 30, 29, 120, 156, 7, 255, 224, 127, 0, 0, 0, 0, 0, 63, +197, 206, 60, 56, 192, 248, 15, 255, 248, 255, 0, 0, 0, 0, 0, 120, 5, 227, 248, +56, 195, 248, 127, 191, 254, 63, 0, 0, 0, 0, 7, 254, 255, 193, 255, 15, 193, +255, 15, 31, 252, 31 }; +*/ + +static const uint8_t town[4464] = { 4, 0, 0, 16, 2, 115, 130, 6, 243, 130, 6, 243, 130, 6, 243, 130, 4, 0, 0, 16, 2, 115, 130, 6, 243, 130, 6, 243, 130, 6, 243, 130, 4, 0, 0, 16, 255, 255, 255, 240, 3, 255, 198, 15, 127, 198, 15, 127, 198, 15, 127, 198, 255, 255, 255, 240, 3, 255, 198, 15, 127, 198, 15, 127, 198, 15, 127, 198, 255, 255, 255, 240, 0, 144, 3, 192, 0, 112, 255, 30, 112, 255, 30, 112, 255, 30, 112, 255, 0, 144, 3, 192, 0, 112, 255, 30, 112, 255, 30, 112, 255, 30, 112, 255, 0, 144, 3, 192, 0, 144, 2, 192, 15, 240, 195, 255, 240, 195, 255, 240, 195, 255, 240, 195, 0, 144, 2, 192, 15, 240, 195, 255, 240, 195, 255, 240, 195, 255, 240, 195, 0, 144, 2, 192, 0, 144, 2, 64, 112, 15, 129, 240, 15, 129, 240, 15, 129, 240, 15, 129, 0, 144, 2, 64, 112, 15, 129, 240, 15, 129, 240, 15, 129, 240, 15, 129, 0, 144, 2, 64, 0, 208, 3, 64, 128, 1, 193, 128, 1, 193, 128, 1, 193, 128, 1, 193, 0, 208, 3, 64, 128, 1, 193, 128, 1, 193, 128, 1, 193, 128, 1, 193, 0, 208, 3, 64, 255, 223, 255, 67, 0, 0, 227, 0, 0, 227, 0, 0, 227, 0, 0, 227, 255, 223, 255, 67, 0, 0, 227, 0, 0, 227, 0, 0, 227, 0, 0, 227, 255, 223, 255, 64, 112, 195, 129, 194, 0, 0, 126, 0, 0, 126, 0, 0, 126, 0, 0, 126, 112, 195, 129, 194, 0, 0, 126, 0, 0, 126, 0, 0, 126, 0, 0, 126, 112, 195, 129, 192, 247, 255, 254, 195, 128, 0, 195, 128, 0, 195, 128, 0, 195, 128, 0, 195, 247, 255, 254, 195, 128, 0, 195, 128, 0, 195, 128, 0, 195, 128, 0, 195, 247, 255, 254, 192, 72, 0, 2, 98, 240, 113, 202, 240, 113, 202, 240, 113, 202, 240, 113, 202, 72, 0, 2, 98, 240, 113, 202, 240, 113, 202, 240, 113, 202, 240, 113, 202, 72, 0, 2, 96, 240, 0, 2, 70, 25, 255, 46, 25, 255, 46, 25, 255, 46, 25, 255, 46, 240, 0, 2, 70, 25, 255, 46, 25, 255, 46, 25, 255, 46, 25, 255, 46, 240, 0, 2, 64, 96, 1, 226, 198, 30, 48, 110, 30, 48, 110, 30, 48, 110, 30, 48, 110, 96, 1, 226, 198, 30, 48, 110, 30, 48, 110, 30, 48, 110, 30, 48, 110, 96, 1, 226, 192, 64, 2, 19, 199, 56, 32, 111, 56, 32, 111, 56, 32, 111, 56, 32, 111, 64, 2, 19, 199, 56, 32, 111, 56, 32, 111, 56, 32, 111, 56, 32, 111, 64, 2, 19, 192, 128, 2, 19, 71, 252, 96, 247, 252, 96, 247, 252, 96, 247, 252, 96, 247, 128, 2, 19, 71, 252, 96, 247, 252, 96, 247, 252, 96, 247, 252, 96, 247, 128, 2, 19, 64, 0, 2, 19, 71, 15, 241, 231, 15, 241, 231, 15, 241, 231, 15, 241, 231, 0, 2, 19, 71, 15, 241, 231, 15, 241, 231, 15, 241, 231, 15, 241, 231, 0, 2, 19, 64, 3, 194, 18, 71, 12, 63, 255, 12, 63, 231, 12, 63, 231, 12, 63, 255, 3, 194, 18, 71, 12, 63, +255, 12, 63, 231, 12, 63, 231, 12, 63, 255, 3, 194, 18, 64, 6, 99, 242, 195, 152, 31, 0, 248, 31, 195, 152, 31, 195, 152, 31, 0, 6, 99, 242, 195, 152, 31, 0, 248, 31, 195, 152, 31, 195, 152, 31, 0, 6, 99, 242, 192, 10, 84, 10, 193, 252, 24, 0, 28, 31, 129, 252, 31, 129, 252, 24, 0, 10, 84, 10, 193, 252, 24, 0, 28, 31, 129, 252, 31, 129, 252, 24, 0, 10, 84, 10, 192, 10, 87, 251, 192, 126, 48, 0, 14, 62, 0, 126, 62, 0, 126, 48, 0, 10, 87, 251, 192, 126, 48, 0, 14, 62, 0, 126, 62, 0, 126, 48, 0, 10, 87, 251, 192, 10, 80, 3, 192, 31, 224, 0, 7, 252, 3, 255, 255, 255, 255, 224, 0, 10, 80, 3, 192, 31, 224, 0, 7, 252, 3, 255, 255, 255, 255, 224, 0, 10, 80, 3, 192, 10, 208, 3, 64, 12, 56, 0, 12, 32, 6, 16, 64, 0, 2, 56, 0, 10, 208, 3, 64, 12, 56, 0, 12, 32, 6, 16, 64, 0, 2, 56, 0, 10, 208, 3, 64, 250, 95, 254, 64, 56, 175, 7, 28, 144, 7, 255, 252, 0, 2, 175, 7, 250, 95, 254, 64, 56, 175, 7, 28, 144, 7, 255, 252, 0, 2, 175, 7, 250, 95, 254, 64, 106, 86, 219, 64, 34, 225, 159, 242, 200, 4, 130, 8, 0, 2, 225, 159, 106, 86, 219, 64, 34, 225, 159, 242, 200, 4, 130, 8, 0, 2, 225, 159, 106, 86, 219, 64, 10, 80, 3, 64, 62, 225, 227, 6, 228, 15, 255, 240, 0, 1, 225, 227, 10, 80, 3, 64, 62, 225, 227, 6, 228, 15, 255, 240, 0, 1, 225, 227, 10, 80, 3, 64, 255, 255, 255, 192, 4, 243, 130, 6, 156, 10, 16, 64, 0, 1, 243, 130, 255, 255, 255, 192, 4, 243, 130, 6, 156, 10, 16, 64, 0, 1, 243, 130, 255, 255, 255, 192, 0, 0, 3, 192, 7, 127, 198, 15, 0, 15, 255, 255, 255, 255, 127, 198, 0, 0, 3, 192, 7, 127, 198, 15, 0, 15, 255, 255, 255, 255, 127, 198, 0, 0, 3, 192, 0, 0, 0, 0, 0, 112, 255, 30, 0, 3, 192, 0, 0, 60, 112, 255, 0, 0, 0, 0, 0, 112, 255, 30, 0, 3, 192, 0, 0, 60, 112, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 195, 254, 0, 2, 198, 0, 220, 44, 112, 195, 0, 0, 0, 0, 0, 112, 195, 254, 0, 2, 198, 0, 220, 44, 112, 195, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57, 129, 252, 0, 2, 69, 0, 168, 36, 57, 129, 0, 0, 0, 0, 0, 57, 129, 252, 0, 2, 69, 0, 168, 36, 57, 129, 0, 0, 0, 0, 0, 0, 0, 0, 128, 31, 193, 248, 0, 3, 117, 62, 87, 244, 31, 193, 0, 0, 0, 0, 128, 31, 193, 248, 0, 3, 117, 62, 87, 244, 31, 193, 0, 0, 0, 0, 0, 0, 0, 2, 160, 7, 227, 224, 0, 3, 72, 128, 168, 52, 7, 227, 0, 0, 0, 2, 160, 7, 227, 224, 0, 3, 72, 128, 168, 52, 7, 227, 0, 0, 0, 0, 0, 0, 0, 1, 64, 1, 255, 192, 0, 3, 232, 246, 245, 252, 1, 254, 0, 0, 0, 1, 64, 1, 255, 192, 0, 3, 232, 246, 245, 252, 1, 254, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 194, 0, 16, 2, 199, 40, 138, 44, 0, 195, 0, 0, 0, 128, 0, 0, 194, 0, 16, 2, 199, 40, 138, 44, 0, 195, 0, 0, 0, 128, 0, 0, 2, 160, 0, 3, 137, 0, 40, 2, 64, 24, 6, 36, 3, 138, 0, 0, 2, 160, 0, 3, 137, 0, 40, 2, 64, 24, 6, 36, 3, 138, 0, 0, 2, 160, 0, 0, 1, 64, 0, 2, 44, 128, 40, 2, 64, 0, 0, 36, 2, 46, 0, 0, 1, 64, 0, 2, 44, 128, 40, 2, 64, 0, 0, 36, 2, 46, 0, 0, 1, 64, 0, 0, 0, 0, 0, 3, 238, 64, 68, 2, 192, 0, 0, 44, 3, 238, 0, 0, 0, 0, 0, 3, 238, 64, 68, 2, 192, 0, 0, 44, 3, 238, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 192, 68, 3, 192, 63, 192, 60, 0, 79, 0, 0, 0, 0, 0, 0, 73, 192, 68, 3, 192, 63, 192, 60, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 0, 56, 3, 64, 124, 32, 52, 0, 119, 0, 0, 0, 0, 0, 0, 112, 0, 56, 3, 64, 124, 32, 52, 0, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 3, 64, 80, 32, 52, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 16, 3, 64, 80, 32, 52, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 2, 64, 248, 16, 36, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 16, 2, 64, 248, 16, 36, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 2, 192, 192, 16, 44, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 2, 192, 192, 16, 44, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 2, 192, 255, 240, 44, 8, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 2, 192, 255, 240, 44, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 3, 192, 41, 64, 60, 48, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 3, 192, 41, 64, 60, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 3, 192, 41, 64, 60, 32, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 3, 192, 41, 64, 60, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 8, 16, 3, 64, 47, 64, 52, 56, 0, 0, 0, 0, 0, 8, 0, 0, 8, 16, 3, 64, 47, 64, 52, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 42, 40, 2, 127, 224, 127, 230, 47, 7, 0, 0, 0, 0, 42, 0, 0, 42, 40, 2, 127, 224, 127, 230, 47, 7, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 20, 40, 3, 118, 227, 109, 180, 97, 159, 0, 0, 0, 0, 20, 0, 0, 20, 40, 3, 118, 227, 109, 180, 97, 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 3, 64, 32, 64, 52, 97, 227, 0, 0, 0, 0, 0, 0, 0, 0, 68, 3, 64, 32, 64, 52, 97, 227, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 124, 3, 255, 255, 255, 252, 115, 130, 0, 0, 0, 0, 0, 0, 0, 0, 124, 3, 255, 255, 255, 252, 115, 130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 192, 0, 0, 60, 127, 198, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 192, 0, 0, 60, 127, 198, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252, 0, 0, 112, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252, 0, 0, 112, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 132, 0, 0, 112, 195, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 132, 0, 0, 112, 195, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 126, 0, 0, 120, 0, 0, 57, 129, 0, 0, 0, 0, 0, 0, 0, 40, 126, 0, 0, 120, 0, 0, 57, 129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 252, 0, 0, 3, 240, 0, 31, 193, 0, 0, 0, 0, 0, 0, 0, 43, 252, 0, 0, 3, 240, 0, 31, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 134, 0, 0, 2, 16, 0, 7, 227, 0, 0, 0, 0, 0, 0, 0, 21, 134, 0, 0, 2, 16, 0, 7, 227, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 6, 0, 0, 1, 224, 0, 1, 254, 0, 0, 0, 0, 0, 0, 0, 23, 6, 0, 0, 1, 224, 0, 1, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 62, 0, 0, 252, 0, 0, 0, 195, 0, 0, 0, 0, 0, 0, 0, 15, 62, 0, 0, 252, 0, 0, 0, 195, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 250, 0, 0, 132, 0, 0, 3, 138, 0, 0, 0, 0, 0, 0, 0, 14, 250, 0, 0, 132, 0, 0, 3, 138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 190, 0, 0, 120, 0, 0, 2, 46, 0, 0, 0, 0, 0, 0, 0, 6, 190, 0, 0, 120, 0, 0, 2, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 156, 0, 0, 3, 240, 0, 3, 238, 0, 0, 0, 0, 0, 0, 0, 3, 156, 0, 0, 3, 240, 0, 3, 238, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 36, 0, 0, 2, 16, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 1, 36, 0, 0, 2, 16, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 216, 0, 0, 1, 224, 0, 0, 119, 0, 0, 0, 0, 0, 0, 0, 0, 216, 0, 0, 1, 224, 0, 0, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 4, 0, 0, 16, 2, 115, 130, 6, 243, 130, 6, 243, 130, 6, 243, 130, 4, 0, 0, 16, 2, 115, 130, 6, 243, 130, 6, 243, 130, 6, 243, 130, 4, 0, 0, 16, 255, 255, 255, 240, 3, 255, 198, 15, 127, 198, 15, 127, 198, 15, 127, 198, 255, 255, 255, 240, 3, 255, 198, 15, 127, 198, 15, 127, 198, 15, 127, 198, 255, 255, 255, 240, 0, 144, 3, 192, 0, 112, 255, 30, 112, 255, 30, 112, 255, 30, 112, 255, 0, 144, 3, 192, 0, 112, 255, 30, 112, 255, 30, 112, 255, 30, 112, 255, 0, 144, 3, 192, 0, 144, 2, 192, 15, 240, 195, 255, 240, 195, 255, 240, 195, 255, 240, 195, 0, 144, 2, 192, 15, 240, 195, 255, 240, 195, 255, 240, 195, 255, 240, 195, 0, 144, 2, 192, 0, 144, 2, 64, 112, 15, 129, 240, 15, 129, 240, 15, 129, 240, 15, 129, 0, 144, 2, 64, 112, 15, 129, 240, 15, 129, 240, 15, 129, 240, 15, 129, 0, 144, 2, 64, 0, 208, 3, 64, 128, 1, 193, 128, 1, 193, 128, 1, 193, 128, 1, 193, 0, 208, 3, 64, 128, 1, 193, 128, 1, 193, 128, 1, 193, 128, 1, 193, 0, 208, 3, 64, 255, 223, 255, 67, 0, 0, 227, 0, 0, 227, 0, 0, 227, 0, 0, 227, 255, 223, 255, 67, 0, 0, 227, 0, 0, 227, 0, 0, 227, 0, 0, 227, 255, 223, 255, 64, 112, 195, 129, 194, 0, 0, 126, 0, 0, 126, 0, 0, 126, 0, 0, 126, 112, 195, 129, 194, 0, 0, 126, 0, 0, 126, 0, 0, 126, 0, 0, 126, 112, 195, 129, 192, 247, 255, 254, 195, 128, 0, 195, 128, 0, 195, 128, 0, 195, 128, 0, 195, 247, 255, 254, 195, 128, 0, 195, 128, 0, 195, 128, 0, 195, 128, 0, 195, 247, 255, 254, 192, 72, 0, 2, 98, 240, 113, 202, 240, 113, 202, 240, 113, 202, 240, 113, 202, 72, 0, 2, 98, 240, 113, 202, 240, 113, 202, 240, 113, 202, 240, 113, 202, 72, 0, 2, 96, 240, 0, 2, 70, 25, 255, 46, 25, 255, 46, 25, 255, 46, 25, 255, 46, 240, 0, 2, 70, 25, 255, 46, 25, 255, 46, 25, 255, 46, 25, 255, 46, 240, 0, 2, 64, 96, 1, 226, 198, 30, 48, 110, 30, 48, 110, 30, 48, 110, 30, 48, 110, 96, 1, 226, 198, 30, 48, 110, 30, 48, 110, 30, 48, 110, 30, 48, 110, 96, 1, 226, 192, 64, 2, 19, 199, 56, 32, 111, 56, 32, 111, 56, 32, 111, 56, 32, 111, 64, 2, 19, 199, 56, 32, 111, 56, 32, 111, 56, 32, 111, 56, 32, 111, 64, 2, 19, 192, 128, 2, 19, 71, 252, 96, 247, 252, 96, 247, 252, 96, 247, 252, 96, 247, 128, 2, 19, 71, 252, 96, 247, 252, 96, 247, 252, 96, 247, 252, 96, 247, 128, 2, 19, 64, 0, 2, 19, 71, 15, 241, 231, 15, 241, 231, 15, 241, 231, 15, 241, 231, 0, 2, 19, 71, 15, 241, 231, 15, 241, 231, 15, 241, 231, 15, 241, 231, 0, 2, 19, 64, 3, 194, 18, 71, 12, 63, 255, 12, 63, 231, 12, 63, 231, 12, 63, 255, 3, 194, 18, 71, 12, 63, 255, 12, 63, 231, 12, 63, 231, 12, 63, 255, 3, 194, 18, 64, 6, 99, 242, 195, 152, 31, 0, 248, 31, 195, 152, 31, 195, 152, 31, 0, 6, 99, 242, 195, 152, 31, 0, 248, 31, 195, 152, 31, 195, 152, 31, 0, 6, 99, 242, 192, 10, 84, 10, 193, 252, 24, 0, 28, 31, 129, 252, 31, 129, 252, 24, 0, 10, 84, 10, 193, 252, 24, 0, 28, 31, 129, 252, 31, 129, 252, 24, 0, 10, 84, 10, 192, 10, 87, 251, 192, 126, 48, 0, 14, 62, 0, 126, 62, 0, 126, 48, 0, 10, 87, 251, 192, 126, 48, 0, 14, 62, 0, 126, 62, 0, 126, 48, 0, 10, 87, 251, 192, 10, 80, 3, 192, 31, 224, 0, 7, 252, 3, 255, 255, 255, 255, 224, 0, 10, 80, 3, 192, 31, 224, 0, 7, 252, 3, 255, 255, 255, 255, 224, 0, 10, 80, 3, 192, 10, 208, 3, 64, 12, 56, 0, 12, 32, 6, 16, 64, 0, 2, 56, 0, 10, 208, 3, 64, 12, 56, 0, 12, 32, 6, 16, 64, 0, 2, 56, 0, 10, 208, 3, 64, 250, 95, 254, 64, 56, 175, 7, 28, 144, 7, 255, 252, 0, 2, 175, 7, 250, 95, 254, 64, 56, 175, 7, 28, 144, 7, 255, 252, 0, 2, 175, 7, 250, 95, 254, 64, 106, 86, 219, 64, 34, 225, 159, 242, 200, 4, 130, 8, 0, 2, 225, 159, 106, 86, 219, 64, 34, 225, 159, 242, 200, 4, 130, 8, 0, 2, 225, 159, 106, 86, 219, 64, 10, 80, 3, 64, 62, 225, 227, 6, 228, 15, 255, 240, 0, 1, 225, 227, 10, 80, 3, 64, 62, 225, 227, 6, 228, 15, 255, 240, 0, 1, 225, 227, 10, 80, 3, 64, 255, 255, 255, 192, 4, 243, 130, 6, 156, 10, 16, 64, 0, 1, 243, 130, 255, 255, 255, 192, 4, 243, 130, 6, 156, 10, 16, 64, 0, 1, 243, 130, 255, 255, 255, 192, 0, 0, 3, 192, 7, 127, 198, 15, 0, 15, 255, 255, 255, 255, 127, 198, 0, 0, 3, 192, 7, 127, 198, 15, 0, 15, 255, 255, 255, 255, 127, 198, 0, 0, 3, 192, 0, 0, 0, 0, 0, 112, 255, 30, 0, 3, 192, 0, 0, 60, 112, 255, 0, 0, 0, 0, 0, 112, 255, 30, 0, 3, 192, 0, 0, 60, 112, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 195, 254, 0, 2, 198, 0, 220, 44, 112, 195, 0, 0, 0, 0, 0, 112, 195, 254, 0, 2, 198, 0, 220, 44, 112, 195, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57, 129, 252, 0, 2, 69, 0, 168, 36, 57, 129, 0, 0, 0, 0, 0, 57, 129, 252, 0, 2, 69, 0, 168, 36, 57, 129, 0, 0, 0, 0, 0, 0, 0, 0, 128, 31, 193, 248, 0, 3, 117, 62, 87, 244, 31, 193, 0, 0, 0, 0, 128, 31, 193, 248, 0, 3, 117, 62, 87, 244, 31, 193, 0, 0, 0, 0, 0, 0, 0, 2, 160, 7, 227, 224, 0, 3, 72, 128, 168, 52, 7, 227, 0, 0, 0, 2, 160, 7, 227, 224, 0, 3, 72, 128, 168, 52, 7, 227, 0, 0, 0, 0, 0, 0, 0, 1, 64, 1, 255, 192, 0, 3, 232, 246, 245, 252, 1, 254, 0, 0, 0, 1, 64, 1, 255, 192, 0, 3, 232, 246, 245, 252, 1, 254, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 194, 0, 16, 2, 199, 40, 138, 44, 0, 195, 0, 0, 0, 128, 0, 0, 194, 0, 16, 2, 199, 40, 138, 44, 0, 195, 0, 0, 0, 128, 0, 0, 2, 160, 0, 3, 137, 0, 40, 2, 64, 24, 6, 36, 3, 138, 0, 0, 2, 160, 0, 3, 137, 0, 40, 2, 64, 24, 6, 36, 3, 138, 0, 0, 2, 160, 0, 0, 1, 64, 0, 2, 44, 128, 40, 2, 64, 0, 0, 36, 2, 46, 0, 0, 1, 64, 0, 2, 44, 128, 40, 2, 64, 0, 0, 36, 2, 46, 0, 0, 1, 64, 0, 0, 0, 0, 0, 3, 238, 64, 68, 2, 192, 0, 0, 44, 3, 238, 0, 0, 0, 0, 0, 3, 238, 64, 68, 2, 192, 0, 0, 44, 3, 238, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 192, 68, 3, 192, 63, 192, 60, 0, 79, 0, 0, 0, 0, 0, 0, 73, 192, 68, 3, 192, 63, 192, 60, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 0, 56, 3, 64, 124, 32, 52, 0, 119, 0, 0, 0, 0, 0, 0, 112, 0, 56, 3, 64, 124, 32, 52, 0, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 3, 64, 80, 32, 52, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 16, 3, 64, 80, 32, 52, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 2, 64, 248, 16, 36, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 16, 2, 64, 248, 16, 36, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 2, 192, 192, 16, 44, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 2, 192, 192, 16, 44, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 2, 192, 255, 240, 44, 8, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 2, 192, 255, 240, 44, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 3, 192, 41, 64, 60, 48, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 3, 192, 41, 64, 60, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 3, 192, 41, 64, 60, 32, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 3, 192, 41, 64, 60, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 8, 16, 3, 64, 47, 64, 52, 56, 0, 0, 0, 0, 0, 8, 0, 0, 8, 16, 3, 64, 47, 64, 52, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 42, 40, 2, 127, 224, 127, 230, 47, 7, 0, 0, 0, 0, 42, 0, 0, 42, 40, 2, 127, 224, 127, 230, 47, 7, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 20, 40, 3, 118, 227, 109, 180, 97, 159, 0, 0, 0, 0, 20, 0, 0, 20, 40, 3, 118, 227, 109, 180, 97, 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 3, 64, 32, 64, 52, 97, 227, 0, 0, 0, 0, 0, 0, 0, 0, 68, 3, 64, 32, 64, 52, 97, 227, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 124, 3, 255, 255, 255, 252, 115, 130, 0, 0, 0, 0, 0, 0, 0, 0, 124, 3, 255, 255, 255, 252, 115, 130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 192, 0, 0, 60, 127, 198, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 192, 0, 0, 60, 127, 198, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252, 0, 0, 112, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252, 0, 0, 112, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 132, 0, 0, 112, 195, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 132, 0, 0, 112, 195, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 126, 0, 0, 120, 0, 0, 57, 129, 0, 0, 0, 0, 0, 0, 0, 40, 126, 0, 0, 120, 0, 0, 57, 129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 252, 0, 0, 3, 240, 0, 31, 193, 0, 0, 0, 0, 0, 0, 0, 43, 252, 0, 0, 3, 240, 0, 31, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 134, 0, 0, 2, 16, 0, 7, 227, 0, 0, 0, 0, 0, 0, 0, 21, 134, 0, 0, 2, 16, 0, 7, 227, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 6, 0, 0, 1, 224, 0, 1, 254, 0, 0, 0, 0, 0, 0, 0, 23, 6, 0, 0, 1, 224, 0, 1, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 62, 0, 0, 252, 0, 0, 0, 195, 0, 0, 0, 0, 0, 0, 0, 15, 62, 0, 0, 252, 0, 0, 0, 195, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 250, 0, 0, 132, 0, 0, 3, 138, 0, 0, 0, 0, 0, 0, 0, 14, 250, 0, 0, 132, 0, 0, 3, 138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 190, 0, 0, 120, 0, 0, 2, 46, 0, 0, 0, 0, 0, 0, 0, 6, 190, 0, 0, 120, 0, 0, 2, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 156, 0, 0, 3, 240, 0, 3, 238, 0, 0, 0, 0, 0, 0, 0, 3, 156, 0, 0, 3, 240, 0, 3, 238, 0, 0, 0, 0 }; + +static const uint8_t screen[460] = { 0, 0, 0, 2, 0, 23, 224, 15, 0, 0, 0, 0, 0, 2, 16, 127, 192, 31, 192, 0, 0, 0, 0, 1, 144, 127, 128, 24, 39, 0, 0, 0, 0, 7, 216, 127, 128, 56, 24, 128, 0, 0, 14, 4, 28, 127, 128, 48, 0, 0, 0, 0, 49, 4, 30, 127, 128, 112, 0, 0, 0, 0, 65, 28, 63, 127, 129, 240, 0, 0, 0, 0, 128, 224, 31, 127, 135, 240, 0, 0, 0, 1, 0, 0, 7, 95, 255, 224, 0, 0, 0, 1, 0, 0, 3, 64, 255, 224, 0, 0, 0, 0, 128, 0, 3, 0, 127, 224, 0, 0, 0, 0, 128, 0, 3, 192, 31, 224, 0, 0, 0, 1, 0, 0, 3, 128, 15, 224, 0, 0, 0, 2, 0, 0, 3, 192, 15, 224, 0, 0, 0, 4, 0, 0, 7, 192, 31, 240, 0, 0, 0, 200, 0, 0, 15, 192, 71, 240, 32, 0, 1, 48, 0, 15, 255, 192, 131, 252, 48, 0, 2, 0, 0, 48, 127, 64, 131, 255, 48, 0, 2, 0, 0, 192, 127, 65, 195, 255, 240, 0, 4, 0, 3, 128, 127, 65, 255, 159, 240, 0, 4, 0, 6, 128, 111, 73, 255, 15, 240, 0, 4, 0, 12, 128, 111, 33, 255, 15, 208, 0, 6, 0, 24, 128, 111, 9, 255, 31, 24, 0, 1, 0, 16, 64, 111, 97, 255, 254, 28, 0, 1, 0, 62, 32, 110, 75, 195, 252, 63, 128, 1, 0, 33, 16, 110, 239, 131, 248, 127, 128, 1, 0, 64, 139, 174, 207, 135, 248, 193, 128, 2, 0, 64, 68, 108, 175, 129, 241, 4, 128, 2, 0, 64, 36, 44, 175, 192, 242, 9, 0, 2, 0, 128, 36, 36, 191, 192, 112, 18, 0, 14, 0, 128, 38, 64, 191, 224, 48, 4, 0, 8, 0, 128, 115, 229, 190, 48, 32, 0, 0, 8, 0, 128, 142, 61, 248, 6, 32, 0, 128, 8, 0, 129, 14, 71, 192, 7, 224, 3, 128, 8, 0, 130, 8, 199, 140, 7, 224, 7, 0, 14, 0, 130, 0, 195, 140, 15, 224, 12, 0, 9, 0, 159, 0, 195, 252, 31, 240, 96, 0, 17, 128, 225, 128, 195, 192, 127, 63, 0, 128, 17, 224, 193, 225, 195, 255, 252, 56, 0, 128, 33, 248, 193, 135, 103, 255, 224, 112, 1, 128, 161, 135, 199, 156, 127, 131, 128, 240, 3, 128, 65, 3, 255, 184, 102, 3, 193, 240, 15, 128, 67, 15, 14, 188, 78, 3, 255, 240, 63, 128, 231, 30, 28, 96, 124, 7, 255, 252, 127, 128, 241, 252, 28, 97, 252, 63, 223, 255, 31, 128, 224, 255, 135, 224, 255, 135, 143, 254, 15, 128 }; + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wparentheses" +#pragma GCC diagnostic ignored "-Wshift-negative-value" +#pragma GCC push_options +#pragma GCC optimize 0 + +#define ML_vram_adress display_getCurrentVRAM +__attribute__((optimize("0"))) +void ML_bmp_or_cl(const unsigned char *bmp, int x, int y, int width, int height) +{ + uint16_t line; + char shift, *screen; + uint8_t *p; + int i, j, real_width, begin_x, end_x, begin_y, end_y; + int bool1=1, bool2=1, bool3; + if(!bmp || x<1-width || x>127 || y<1-height || y>63 || height<1 + || width<1) return; + p = (uint8_t *)&line; + real_width = (width-1>>3<<3)+8; + if(y < 0) begin_y = -y; + else begin_y = 0; + if(y+height > 64) end_y = 64-y; + else end_y = height; + shift = 8-(x&7); + if(x<0) + { + begin_x = -x>>3; + if(shift != 8) bool1 = 0; + } else begin_x = 0; + if(x+real_width > 128) end_x = 15-(x>>3), bool2 = 0; + else end_x = real_width-1>>3; + bool3 = (end_x == real_width-1>>3); + screen = (char *)ML_vram_adress()+(y+begin_y<<4)+(x>>3); + + for(i=begin_y ; i>3)+begin_x] << shift; + if(bool1) screen[begin_x] |= *p; + if(shift!=8) screen[begin_x+1] |= *(p+1); + for(j=begin_x+1 ; j>3)+j] << shift; + screen[j] |= *p; + if(shift!=8) screen[j+1] |= *(p+1); + } + } + line = bmp[i*(real_width>>3)+end_x]; + if(bool3) line &= -1<TCNT; + timer_stop(t); + time1 = 0xffffffff - time1; + + dclear(); + dtext(2, 2, "gint..."); + dupdate(); + + t = htimer_setup(timer_user, 0xffffffff, timer_Po_4, 1); + timer_start(t); + for(i = 0; i < 1000; i++) dimage(x, y, img); + time2 = TMU.timers[timer_user]->TCNT; + timer_stop(t); + time2 = 0xffffffff - time2; + + dclear(); + print(1, 1, " ML: %08x", time1); + print(1, 2, "gint: %08x", time2); + print(1, 3, ">> \x04%d", time1 / time2); + dupdate(); + getkey(); +} diff --git a/demo/resources/opt_bitmap.bmp b/demo/resources/opt_bitmap.bmp index c776021b3647f47a5038217020d133593164f535..d8107170fec8ce5d1c9fd0c222710acad8248e15 100644 GIT binary patch literal 3194 zcmd6ju@1s83`7GH5^OAdPZuT@zJrae6Cc=rf-9#!SxJQmVTh%)=d*o@Z@7$y^o~*A zo6bXLr?W{XeHE%7_dX_48qU}Ig1`N5%f@G0l!Bj`^0w*MK5mFXRRMYBegjgG zU;)Rf@=~1tG(eV2Y;&~-_uAjUrd0qp3`ixCF|ib{5KnkYX&fh|%?u*#yZ4~LI#mEG za4A|BF`b#dc*6ZkZ5JcBRmP|(C^Ee?Q;T&XSj(l@d@)J+3*$*rOtXtZ4O?6FmjZZJ<$Kh7z z^tXJMeEWR6;h3Jv{OQ04F$|~Y*Y{8S-QS0?@Y+{n!)2y#+h5&Y&ODy}R*pDh1@IVB z96(Jj%}B8_0V6bAuXxgM6Vg;Bhw;cm=!*NJYUMgT8%Cu9K$U%oBcK|S&5ucy47E3} zGqxH)XL3!nZDPo)Y&I&GyC@Hco@#uyJtmSlCvnXTuFQ|av#YL#(OkjY3iZ`w4r8nN zoag`ZKGSS4c6px0k!ep_9RMELf^$e}a#2R|;DwG4-COqn7BVNEvB3?~lb^l)4(4xw oQC(5rBDp#6f2i>)<{@;%OgodiVl8m*+KcLSxCdaWwV*Tn2U6elvj6}9 diff --git a/demo/resources/opt_gray.bmp b/demo/resources/opt_gray.bmp index 6d60c629e12bd18b8ed326cf8b6053caad073652..80e5c36689700cd2f51ee19e19572b287b034678 100644 GIT binary patch delta 360 zcmZvYv1$TA5Qf>k+dXI9u;Jk3AP-<;AwrsvLaq`5M_xcHTfr`nO2UC43b*_(Vj-jw z?+F5VgH&nLUzIscKtqa!-TC*Qf4-^HI^7NhUPOl4^f4E)FMGZ;sH8^6IE41@#KO3=}8o^7aTI0qfwRvd8e#Ey30)5y*~ksy>jDbCm)kAIG@r^o5~ zPO|U%KJ^{+-A&K3ddfdN_;X;IjxTQ?Klr!*`%e7&+v|ekNbff0_w0WtoY%fS%%X_4 zGan$=n8>V4m!yGHL_t3Xg{d{@*}^G=lBE~=CS+CTxHWd|`Ohe<1MC8jPR?JpAWJ*Q zq+CLL)}`E4N$xsUfQgGpZvi>g61yV`JGsB7N}Dqqm&ub%N}yo7*YLMtcl)^6vGCIs zri8d_opLZaU7742?q9~XTV}>(a;ivqapD8lA||+;D%@M;X3i=g0J&5T=0R#ZqW+%e79)rskkrDaJ6KC8t_qlTq0G{!FqIaEG!HakjRyX(gMr;LaQ? ckTsAkQV_cGhWBTfMWF1ssMh3NDQtEB3%4y6QUCw| diff --git a/demo/resources/opt_menu.bmp b/demo/resources/opt_menu.bmp index 4d682e41f8ba32f159a4d11eed322f74220e798b..09fd37d17ac8c7d8a6219ed15f477fe9819ab291 100644 GIT binary patch delta 78 ucmew*@k?TZ1LNc-MyJh9jCK$P6El?2!~zpxgNd-iL^xq0To4A(hzbDZIT$zq delta 274 zcmaLTF$%&!5Cu>+*&Q=+L0AxS1_cpM5K>xs0k0xk*eDiG{xNJkLJlO@rwDFLLSkd_ zndb3lm^!PoXRf3<%XKGrjZ;KrRJ8-13A5DU%?_)`Ay>tS;NuESOt_H4jTRw{R~(d{ zsM3Tg!#(KGF|pzam61TF N@OQ&$UZ6|=fe*(LUB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+2RjaJ*E(7gLzG3#9CPFmk{O{{U3&gK#(uHA%d*i*on?C6fan z1jA6~6h<#usgRV!yviy>Gb@x>GD-km4pzxSFSVOM1H?ZeUFl589#vAVT9rc{0#&)} z&|#Fi^VeslY9o8 zjj`Zstjg*I5Y7sHnVCjzt^_Yi7AeX*m{oPL6_m+eLu~oHyScNw&M~rKR^x@l6B86 zlhQR5hB!1kG8`PZ54=c)E^r=kmyvS)p-&eK8E@yf#PkKop+d4lPqJYs-b-ZVJdB$} ziECV@c8mA4j|y@A(|wpkz~_lkOW@gA2oI>L!urCY$jKW_;Lbu?#$;c*kw-=RPx zVl)LH1E6vKMn23x1htg&gj%*z&bV@cDUpV-d&*yYe`!G>OcX{KR#e^Hheg())^q_O z>%){x>er}=kY z3ISSKwNCE1MOBr%gYXCU`xBm|;Df2KQoNC!RjEW`X>jnANK8Bh8698YqrU3cM`Dr% zpi0xCWLojaT+mCLQ3`%Aow9r=aT+g-OZOh#EbiIYR(9=2`FR?3Sqhiro=82o;h^o z4uczDr>bix2XxI2Lpflls%t0*NE4xxZZed)xCEj1a39kMuwUy+$^o9;$CLy1Yh6h> zK-mbL9F{xj;_`_QX9uP6aDk2oAzO7FTd`ZaGL$K3=!neH}6Bh7|BJ@;Ys@N+8mxOc?@V=4S3=bU;Fh8xuL?iUh zqr?OmjOz;{a9(0%qcB3MUhPApb6_~0TOo)ABcud9OaX}jgwD8Ld@zUs@8Hvie2A$P F{vUZB$Z!Av literal 0 HcmV?d00001 diff --git a/demo/test_bopti.c b/demo/test_bopti.c index 9b137c8..de1c083 100644 --- a/demo/test_bopti.c +++ b/demo/test_bopti.c @@ -19,7 +19,7 @@ --------------------------------------------------------- zelda.bmp 86 * 280 Mono - isometric.bmp 37 * 27 Mono Full - Mono Greater + - - Mono Greater --------------------------------------------------------- */ @@ -60,6 +60,7 @@ static image_t *select(image_t *current) res_swords, res_zelda, res_isometric; + extern image_t res_screen; struct { image_t *img; @@ -71,6 +72,7 @@ static image_t *select(image_t *current) { &res_swords, "Swords", "Gray Alpha" }, { &res_zelda, "Zelda", "Mono" }, { &res_isometric, "Isometric", "Mono Alpha" }, + { &res_screen, "TLT", "Mono" }, { NULL, NULL, NULL } }; @@ -81,6 +83,7 @@ static image_t *select(image_t *current) while(images[items].img) items++; + keyboard_setRepeatRate(625, 125); gray_start(); while(1) @@ -141,8 +144,10 @@ void test_bopti(void) int black_bg = 0; int x = 0, y = 0; + while(1) { + keyboard_setRepeatRate(25, 25); if(img && (img->format & channel_light)) { gray_start(); @@ -152,8 +157,7 @@ void test_bopti(void) if(img) gimage(x, y, img); grect(0, 55, 127, 63, color_white); - gimage(0, 56, &res_opt_bitmap); - gupdate(); + gimage_part(0, 56, &res_opt_bitmap, 0, 0, 96, 8); } else if(img) { @@ -164,8 +168,7 @@ void test_bopti(void) if(img) dimage(x, y, img); drect(0, 55, 127, 63, color_white); - dimage(0, 56, &res_opt_bitmap); - dupdate(); + dimage_part(0, 56, &res_opt_bitmap, 0, 0, 96, 8); } else { @@ -174,10 +177,36 @@ void test_bopti(void) dclear(); locate(3, 3, "No image selected"); - dimage(0, 56, &res_opt_bitmap); + dimage_part(0, 56, &res_opt_bitmap, 0, 0, 96, 8); dupdate(); } + if(img) + { + int width, height; + getwh(img, &width, &height); + + if(x < 0) print(1, 4, "\x01"); + if(x + width > 128) print(21, 4, "\x02"); + + if(img->format & channel_light) + { + if(y < 0) gimage_part(61, 0, &res_opt_bitmap, + 122, 0, 6, 8); + if(y + height > 64) gimage_part(61, 48, + &res_opt_bitmap, 116, 0, 6, 8); + gupdate(); + } + else + { + if(y < 0) dimage_part(61, 0, &res_opt_bitmap, + 122, 0, 6, 8); + if(y + height > 64) dimage_part(61, 48, + &res_opt_bitmap, 116, 0, 6, 8); + dupdate(); + } + } + do { leave = 1; @@ -185,6 +214,7 @@ void test_bopti(void) switch(getkey()) { case KEY_EXIT: + keyboard_setRepeatRate(625, 125); gray_stop(); return; @@ -192,22 +222,14 @@ void test_bopti(void) img = select(img); getxy(img, &x, &y); break; - case KEY_F5: + case KEY_F2: black_bg = !black_bg; break; - case KEY_UP: - y--; - break; - case KEY_DOWN: - y++; - break; - case KEY_LEFT: - x--; - break; - case KEY_RIGHT: - x++; - break; + case KEY_UP: y++; break; + case KEY_DOWN: y--; break; + case KEY_LEFT: x++; break; + case KEY_RIGHT: x--; break; default: leave = 0; @@ -216,6 +238,7 @@ void test_bopti(void) while(!leave); } + keyboard_setRepeatRate(625, 125); gray_stop(); return; } diff --git a/demo/test_gray.c b/demo/test_gray.c index 894aa93..86d7f35 100644 --- a/demo/test_gray.c +++ b/demo/test_gray.c @@ -8,10 +8,9 @@ Lets the user set the gray delays and see the results. */ -static void draw(int delay1, int delay2, int selected) +static void draw(int delay1, int delay2, int selected, int gran) { extern image_t res_opt_gray; - extern font_t res_font_modern; uint32_t *vl = gray_lightVRAM(); uint32_t *vd = gray_darkVRAM(); @@ -25,15 +24,16 @@ static void draw(int delay1, int delay2, int selected) vd[offset] = -(i < 32); } - text_configure(&res_font_modern, color_black); - gtext(13, 17, "light"); - gtext(13, 31, "dark"); + print(2, 3, "light %d", delay1); + print(2, 4, " dark %d", delay2); + print(2, 6, "Mode: \x04%d", gran); - text_configure(NULL, color_black); - print(4, 4, "%d", delay1); - print(4, 6, "%d", delay2); - - locate(3, selected ? 6 : 4, "\x02"); + int lengths[2] = { + 4 - (delay1 < 1000), + 4 - (delay2 < 1000) + }; + print(8, 3 + selected, "\x01"); + print(9 + lengths[selected], 3 + selected, "\x02"); gimage(0, 56, &res_opt_gray); gupdate(); @@ -44,6 +44,7 @@ void test_gray(void) int delays[2]; // { light, dark } int key, changed = 1; int selected = 0; + int gran = 1; gray_getDelays(delays, delays + 1); gray_start(); @@ -53,11 +54,11 @@ void test_gray(void) if(changed) { gray_setDelays(delays[0], delays[1]); - draw(delays[0], delays[1], selected); + draw(delays[0], delays[1], selected, gran); } changed = 0; - key = getkey_opt(getkey_repeat_arrow_keys, 25); + key = getkey_opt(getkey_default, 25); if(key == KEY_EXIT) break; changed = 1; @@ -65,31 +66,33 @@ void test_gray(void) switch(key) { case KEY_F1: - selected = !selected; - break; - case KEY_F2: delays[0] = 912; delays[1] = 1343; break; - case KEY_F3: + case KEY_F2: delays[0] = 993; delays[1] = 1609; break; - case KEY_F4: + case KEY_F3: delays[0] = 860; delays[1] = 1298; break; + case KEY_F5: + if(gran >= 100) gran = 1; + else gran *= 10; case KEY_UP: - delays[selected] += 10; + selected = 0; break; case KEY_DOWN: - if(delays[selected] >= 110) delays[selected] -= 10; - break; - case KEY_RIGHT: - delays[selected]++; + selected = 1; break; case KEY_LEFT: - if(delays[selected] >= 101) delays[selected]--; + if(delays[selected] - gran >= 100) + delays[selected] -= gran; + break; + case KEY_RIGHT: + if(delays[selected] + gran < 10000) + delays[selected] += gran; break; default: changed = 0; diff --git a/gscreen.bmp b/gscreen.bmp new file mode 100644 index 0000000000000000000000000000000000000000..4665fe5e4194ebc789476010d2b7dfa864babd78 GIT binary patch literal 1150 zcmeH_L2DC16vyA|jAqxCx=WW-F<>P181T4f$L~<#5kopazvK6l>RrDZ^@68HgPaZw^cHd)v^PfMn^JeNN7bMtNpn8Qe zp;VMej}6i%M)Twm&ib)4*K_gj>&T9&#u!>lnD2YdaM}#4`rygpg&U*Y=atg=oS)8I zTXp*{tFv>KANFT1uXZ0VS7+xfKO+5RxBseo;9EZb#p2bk%)j&mMkoXdsz>__oqM~VqN+{46x;wMcW@*F2;cV{<4&=XZa)P z+r_eYYyHxd>+H)94q!~S6&!ZUw5C?F&I_Qw2ke!Wz74>$rNrcx7ZbX#hU%UJFzAdE8bz^voW;Kv0wU*eh>I8#sLxg<B<>v%J-Z8i90OO&6OOdIjC2zx-$c8WgqV*}H<}nUcYRSuho`uk j(b^JbOQ9U-Lds_bP(mnyRGRw1s2l_bL=qO(xr;vmxEO@6 literal 0 HcmV?d00001 diff --git a/gscreend.bmp b/gscreend.bmp new file mode 100644 index 0000000000000000000000000000000000000000..2a4f7c913571047f9d0b215096599188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vEyhtAoGjFRd_;ribn8n}uNFu%P9jmX z$7vEr`t2}n0#= 0, it is considered as the absolute location (in + bytes) of the requested data in the file; + - If `whence` == -1, BFile_Read() reads from the current virtual + position in the file. +*/ +int BFile_Read(int handle, void *ram_buffer, int size, int whence); + +#endif // _BFILE_H diff --git a/include/internals/syscalls.h b/include/internals/syscalls.h index ae05b78..594c50b 100644 --- a/include/internals/syscalls.h +++ b/include/internals/syscalls.h @@ -1,6 +1,9 @@ //--- +// // gint core module: syscalls +// // Some of the functionality still requires interacting with the system. +// //--- #ifndef _INTERNALS_SYSCALLS_H diff --git a/include/keyboard.h b/include/keyboard.h index ea5cd7f..4acb419 100644 --- a/include/keyboard.h +++ b/include/keyboard.h @@ -177,6 +177,9 @@ typedef enum // Shorthand for the four previous properties. getkey_repeat_all_keys = 0xf0, + // Default combination of getkey(). + getkey_default = 0x1f, + } getkey_option_t; /* diff --git a/include/modules/interrupts.h b/include/modules/interrupts.h index 54b172e..3ffd9d1 100644 --- a/include/modules/interrupts.h +++ b/include/modules/interrupts.h @@ -1,5 +1,5 @@ -#ifndef _MODULES_INTERRUPTS -#define _MODULES_INTERRUPTS +#ifndef _MODULES_INTERRUPTS_H +#define _MODULES_INTERRUPTS_H #include #include @@ -685,4 +685,4 @@ typedef union // Here's what you'll need to use. extern mod_intc_t INTC; -#endif // _MODULE_INTERRUPTS +#endif // _MODULE_INTERRUPTS_H diff --git a/src/core/syscalls.s b/src/core/syscalls.s index ad7f984..0ebf0d2 100644 --- a/src/core/syscalls.s +++ b/src/core/syscalls.s @@ -22,8 +22,18 @@ /* Return to menu */ .global ___system_menu + /* Storage memory filesystem */ + .global _BFile_Remove + .global _BFile_Create + .global _BFile_Open + .global _BFile_Close + .global _BFile_Write + .global _BFile_Read + +/* Dynamic memory allocation */ + ___malloc: mov.l syscall_table, r2 mov.l 1f, r0 @@ -45,6 +55,8 @@ ___realloc: nop 1: .long 0xe6d +/* OS version access */ + ___get_os_version: mov.l syscall_table, r2 mov.l 1f, r0 @@ -126,6 +138,58 @@ ___system_menu: .memcpy: .long _memcpy +/* BFile driver */ + + +# int BFile_Remove(const uint16_t *file) +_BFile_Remove: + mov.l 1f, r0 + mov.l syscall_table, r1 + jmp @r1 + mov #0, r5 +1: .long 0x0439 + +# int BFile_Create(const uint16_t *file, enum { file = 1, folder = 5 }, +# int *size) +_BFile_Create: + mov.l 1f, r0 + mov.l syscall_table, r1 + jmp @r1 + nop +1: .long 0x0434 + +# int BFile_Open(const uint16_t *file, int mode) +_BFile_Open: + mov.l 1f, r0 + mov.l syscall_table, r1 + jmp @r1 + mov #0, r6 +1: .long 0x042c + +# int BFile_Close(int handle) +_BFile_Close: + mov.l 1f, r0 + mov.l syscall_table, r1 + jmp @r1 + nop +1: .long 0x042d + +# int BFile_Write(int handle, const void *ram_buffer, int even_size) +_BFile_Write: + mov.l 1f, r0 + mov.l syscall_table, r1 + jmp @r1 + nop +1: .long 0x0435 + +# int BFile_Read(int handle, void *ram_buffer, int size, int whence) +_BFile_Read: + mov.l 1f, r0 + mov.l syscall_table, r1 + jmp @r1 + nop +1: .long 0x0432 + .align 4 diff --git a/src/gray/grect.c b/src/gray/grect.c index 0edfb1d..a123d94 100644 --- a/src/gray/grect.c +++ b/src/gray/grect.c @@ -20,7 +20,7 @@ void grect(int x1, int y1, int x2, int y2, color_t operator) // Doing things in this order will be slower, but man, I can't stand // writing that many lines of code for such a simple task. It will be // terribly heavy in the binary file... - while(lvideo > lbase) for(int i = 0; i < 4; i++) switch(operator) + while(lvideo > lbase) for(int i = 3; i >= 0; i--) switch(operator) { case color_white: *--lvideo &= ~masks[i]; diff --git a/src/init/crt0.c b/src/init/crt0.c index 92ccc69..712fd3c 100644 --- a/src/init/crt0.c +++ b/src/init/crt0.c @@ -8,6 +8,7 @@ #include #include #include +#include /* We need some more functionality to generate these */ #ifdef GINT_STARTUP_LOG @@ -15,7 +16,6 @@ #include #include #include - #include #ifndef GINT_NO_SYSCALLS #include @@ -226,7 +226,7 @@ __attribute__((section(".pretext.entry"))) int start(void) init(); #ifdef GINT_STARTUP_LOG - /* Keep this visible for a second or so */ + /* Keep this visible if a key is kept pressed */ keyboard_interrupt(); if(pollevent().type != event_none) getkey(); #endif diff --git a/src/keyboard/getkey.c b/src/keyboard/getkey.c index f75d086..9b1f38b 100644 --- a/src/keyboard/getkey.c +++ b/src/keyboard/getkey.c @@ -12,17 +12,7 @@ */ int getkey(void) { - return getkey_opt( - getkey_shift_modifier | - getkey_alpha_modifier | - getkey_manage_backlight | -#ifndef GINT_NO_SYSCALLS - getkey_task_switch | -#endif - getkey_repeat_arrow_keys, - - 0 - ); + return getkey_opt(getkey_default, 0); } /* diff --git a/version b/version index 8cc1a27..6b8dc6a 100644 --- a/version +++ b/version @@ -1 +1 @@ -beta-0.9-581 +beta-0.9-584