From 5f04b9fe50e5ef5b95bc0ca15ae866b2562bbb75 Mon Sep 17 00:00:00 2001 From: GutPuncher Date: Wed, 3 Apr 2024 01:13:41 -0400 Subject: [PATCH] upstream branch of example of personal Zeal customization and scripting --- src/Home/.ZC | 3 + src/Home/AFF.ZC | 60 ++++++++++++++ src/Home/F.ZC | 1 + src/Home/GRZ.ZC | 72 +++++++++++++++++ src/Home/MakeHome.ZC | 22 ++++++ src/Home/NestedEq.ZC | 10 +++ src/Home/Net/Programs/FTPClient.ZC | 4 +- src/Home/Z.ZC | 11 +++ src/Home/skip.ZC | 112 +++++++++++++++++++++++++++ src/Home/z_UfGrCalc.ZC | 4 + src/Home/zz.ZC | 45 +++++++++++ src/Home/zzz.ZC | 44 +++++++++++ src/Kernel/Display.ZC | 2 +- src/Kernel/KStart16.ZC | 4 +- src/Kernel/KernelA.HH | 1 + src/System/Utils/ConversionScript.ZC | 3 + 16 files changed, 394 insertions(+), 4 deletions(-) create mode 100755 src/Home/.ZC create mode 100755 src/Home/AFF.ZC create mode 100755 src/Home/F.ZC create mode 100755 src/Home/GRZ.ZC create mode 100755 src/Home/MakeHome.ZC create mode 100755 src/Home/NestedEq.ZC create mode 100755 src/Home/Z.ZC create mode 100755 src/Home/skip.ZC create mode 100755 src/Home/z_UfGrCalc.ZC create mode 100755 src/Home/zz.ZC create mode 100755 src/Home/zzz.ZC diff --git a/src/Home/.ZC b/src/Home/.ZC new file mode 100755 index 00000000..a57392fe --- /dev/null +++ b/src/Home/.ZC @@ -0,0 +1,3 @@ +In("CC\n1\n\n\n\n\n"); +BootHDIns('c'); +//Reboot; \ No newline at end of file diff --git a/src/Home/AFF.ZC b/src/Home/AFF.ZC new file mode 100755 index 00000000..233e1e0e --- /dev/null +++ b/src/Home/AFF.ZC @@ -0,0 +1,60 @@ + + +U0 zz() +{ + U16 *screen, *last_screen = gr.screen_cache; + U64 i, *src = text.raw_screen, *dst = text.fb_alias, diffs_size = GR_WIDTH * GR_HEIGHT / 2; +/* + + if (gr.screen_zoom == 1) + screen = gr.dc2->body; + else + screen = gr.zoomed_dc->body; +*/ + + for (i = 0; i < diffs_size; i++) + { + if (screen[i] != last_screen[i]) + dst[i] = src[i]; + } + +// MemCopy(gr.screen_cache, screen, diffs_size * 2); + +} + +U0 zzz() +{ + U16 *screen, *last_screen = gr.screen_cache; + U64 i, *src = text.raw_screen, *dst = text.fb_alias, diffs_size = GR_WIDTH * GR_HEIGHT / 2; +/* + + if (gr.screen_zoom == 1) + screen = gr.dc2->body; + else + screen = gr.zoomed_dc->body; +*/ + + + for (i = 0; i < diffs_size; i++) + { + if (*(screen + i) != *(last_screen + i)) + *(dst + i) = *(src + i); + } + +// MemCopy(gr.screen_cache, screen, diffs_size * 2); + +} + +"\n\n\n"; +Uf("zz"); +"\n\n\n"; +Uf("zzz");"\n\n\n"; + + + +/* + + The only way to make this faster, + is to force usage of XMM into this ? ? + +*/ diff --git a/src/Home/F.ZC b/src/Home/F.ZC new file mode 100755 index 00000000..b38294a3 --- /dev/null +++ b/src/Home/F.ZC @@ -0,0 +1 @@ +Spawn(&CtrlAltF);; \ No newline at end of file diff --git a/src/Home/GRZ.ZC b/src/Home/GRZ.ZC new file mode 100755 index 00000000..3225d658 --- /dev/null +++ b/src/Home/GRZ.ZC @@ -0,0 +1,72 @@ +U0 GrZoomInScreen1() +{ + I64 i, j, k, l; + U8 *src, *src2, *dst; + + GrFixZoomScale; + + src = gr.dc2->body + gr.sx + gr.sy * gr.dc2->width_internal; + dst = gr.zoomed_dc->body; + + for (i = 0; i < GR_HEIGHT / gr.screen_zoom; i++) + { + k = gr.screen_zoom; + while (k--) + { + src2 = src; + for (l = 0; l < GR_WIDTH / gr.screen_zoom; l++) + { + for (j = 0; j < gr.screen_zoom - 1; j++) + *dst++ = *src2; + + *dst++ = *src2++; + } + } + src += GR_WIDTH; + } +} + + + + + +U0 GrZoomInScreen2() +{ + I64 i, j, k, l, + bobus = GR_HEIGHT / gr.screen_zoom, + beebus = GR_WIDTH / gr.screen_zoom, + sprinkle = gr.screen_zoom - 1; + U8 *src, *src2, *dst; + + GrFixZoomScale; + + src = gr.dc2->body + gr.sx + gr.sy * gr.dc2->width_internal; + dst = gr.zoomed_dc->body; + + for (i = 0; i < bobus; i++) + { + k = gr.screen_zoom; + while (k--) + { + src2 = src; + for (l = 0; l < beebus; l++) + { + for (j = 0; j < sprinkle; j++) + *dst++ = *src2; + + *dst++ = *src2++; + } + } + src += GR_WIDTH; + } +} + + +Uf "GrZoomInScreen1"; + +"\n\n"; + +Uf "GrZoomInScreen2"; + +"\n"; + diff --git a/src/Home/MakeHome.ZC b/src/Home/MakeHome.ZC new file mode 100755 index 00000000..1ac62325 --- /dev/null +++ b/src/Home/MakeHome.ZC @@ -0,0 +1,22 @@ +Cd(__DIR__);; + +//If these are not present in /Home, it uses the version in the root dir. You +//can make your own, modified, version of these files in your /Home directory. +#include "~/HomeLocalize" +#include "/System/Boot/MakeBoot" +#include "/System/Utils/MakeUtils" +#include "~/HomeWrappers" +MapFileLoad("::/Kernel/Kernel"); +MapFileLoad("::/Compiler/Compiler"); +#include "~/HomeKeyPlugIns" +#include "~/HomeSys" +Cd("..");; +Sys("#include \"C:/Home/PaletteEditor/Palettes/Amicus.ZC\";;;PaletteSetAmicus;;"); +//Sys("SwapI64(&text.font, &text.aux_font);;"); +Sys("U0 Z(){Spawn(&MouseHardDriverInstall);};;;"); +Sys("U0 MouseFix(){ Spawn(&MouseHardDriverInstall);; } ;; "); +Sys("#include \"C:/Home/PaletteEditor/Palettes/Vapor.ZC\";;;PaletteSetVapor;;;" ); + +Sys("PaletteSetAmicus;;;"); + +Sys("mouse_hard.scale.x = mouse_hard.scale.y = mouse_hard.scale.z = 2.0;;;;"); diff --git a/src/Home/NestedEq.ZC b/src/Home/NestedEq.ZC new file mode 100755 index 00000000..b215d949 --- /dev/null +++ b/src/Home/NestedEq.ZC @@ -0,0 +1,10 @@ + +U64 x = 3; + +"\nx: %d\n", x; + +U64 y = (x <<= 2) * 2; + +"\ny: %d\n", y; + +"\nx: %d\n", x; diff --git a/src/Home/Net/Programs/FTPClient.ZC b/src/Home/Net/Programs/FTPClient.ZC index feb1f5ed..3abe132f 100755 --- a/src/Home/Net/Programs/FTPClient.ZC +++ b/src/Home/Net/Programs/FTPClient.ZC @@ -41,7 +41,7 @@ I64 FTPReplyPassiveParse(CTCPSocket *message_socket, CSocketAddressIPV4 *dest_ad recv_sum += recv; } str = StrNew(buf); - cc = CompCtrlNew(str); + cc = CompCtrlNew(str, CCF_NO_CHAR_CONST); while ((tk = Lex(cc))) { @@ -91,6 +91,8 @@ parse_done: } CompCtrlDel(cc); + if (res < 0) // error on parse + "\n[FTPReplyPassiveParse]: buf='%s'\n", buf; return res; } diff --git a/src/Home/Z.ZC b/src/Home/Z.ZC new file mode 100755 index 00000000..f681364a --- /dev/null +++ b/src/Home/Z.ZC @@ -0,0 +1,11 @@ +/* + F("sys_os_v"); + "\n\n\n"; + F("DD_OS_"); +*/ + I64 line_count = LineRep("/*", "-r") + LineRep("/System/*") + LineRep("/Compiler/*", "-S+$$") + LineRep("/Kernel/*"); + + DocTreeFWrite("/System/Define.ZC", "LineRep", "DefinePrint(\"DD_ZEALOS_LOC\",\"%,d\");\n", line_count); + DefinePrint("DD_ZEALOS_LOC", "%,d", line_count); + + "Total LOC:%12,d\n\n", line_count; diff --git a/src/Home/skip.ZC b/src/Home/skip.ZC new file mode 100755 index 00000000..bef7b163 --- /dev/null +++ b/src/Home/skip.ZC @@ -0,0 +1,112 @@ +/* + +U8 skip = 0; + +while (TRUE) +{ + "skip %d\n", skip; + "skip and 3... %d\n", skip & 3; + "skip and 7... %d\n", skip & 7; + "skip and 15... %d\n", skip & 15; + + + + if (skip > 4 * 15) + skip = 0; + + + + + + +skip++; +} + +*/ + + +U0 GrCalcScreenUpdates1() +{ + U64 *screen, *last_screen = gr.screen_cache, i, ii, *src = text.raw_screen, *dst = text.fb_alias, diffs_size = GR_WIDTH * GR_HEIGHT / 8; + + U8 skip = gr.screen_cache[0]; // use 1st U8 of cache as flag to skip cache MemCopy every-other call. + U8 skip_inactives = 2, skip_chunks = 7; + + + if (gr.screen_zoom == 1) + screen = gr.dc2->body; + else + screen = gr.zoomed_dc->body; + + for (i = 0; i < diffs_size; i++) + if (screen[i] != last_screen[i]) + { + ii = i * 4; + dst[ii] = src[ii++]; + dst[ii] = src[ii++]; + dst[ii] = src[ii++]; + dst[ii] = src[ii]; + } + + if (skip < skip_chunks * skip_inactives) + { + if (skip % skip_inactives == 0) + { + MemCopy(dst + ((skip/skip_inactives)*text.buffer_size / skip_chunks / 8), + src + ((skip/skip_inactives)*text.buffer_size / skip_chunks / 8), + text.buffer_size / skip_chunks); + MemCopy(gr.screen_cache + ((skip/skip_inactives)*diffs_size * 8 / skip_chunks), screen + ((skip/skip_inactives)*diffs_size * 8 / skip_chunks / 8), diffs_size * 8 / skip_chunks); + } + } + else + skip = -1; + + gr.screen_cache[0] = ++skip; +} + +U0 GrCalcScreenUpdates2() +{ + U64 *screen, *last_screen = gr.screen_cache, i, ii, *src = text.raw_screen, *dst = text.fb_alias, diffs_size = GR_WIDTH * GR_HEIGHT / 8, + skip = gr.screen_cache[0], // use 1st U8 of cache as flag to skip cache MemCopy every-other call. + skip_inactives = 2, skip_chunks = 7, skip_size64 = skip / skip_inactives * text.buffer_size / skip_chunks / 8, skip_diff = diffs_size * 8 / skip_chunks, skip_size8 = skip / skip_inactives * skip_diff; + + + if (gr.screen_zoom == 1) + screen = gr.dc2->body; + else + screen = gr.zoomed_dc->body; + + for (i = 0; i < diffs_size; i++) + if (screen[i] != last_screen[i]) + { + ii = i * 4; + dst[ii] = src[ii++]; + dst[ii] = src[ii++]; + dst[ii] = src[ii++]; + dst[ii] = src[ii]; + } + + if (skip < skip_chunks * skip_inactives) + { + if (skip % skip_inactives == 0) + { + MemCopy(dst + skip_size64, + src + skip_size64, + text.buffer_size / skip_chunks); + MemCopy(gr.screen_cache + skip_size8, screen(U8 *) + skip_size8, skip_diff); + } + } + else + skip = -1; + + gr.screen_cache[0] = ++skip; +} + +Uf "GrCalcScreenUpdates1"; + +"\n\n"; + +Uf "GrCalcScreenUpdates2"; + +"\n"; + diff --git a/src/Home/z_UfGrCalc.ZC b/src/Home/z_UfGrCalc.ZC new file mode 100755 index 00000000..76a75497 --- /dev/null +++ b/src/Home/z_UfGrCalc.ZC @@ -0,0 +1,4 @@ +Uf "GrCalcScreenUpdates"; + + +In("\n\nMan(\"GrCalcScreenUpdates\");"); \ No newline at end of file diff --git a/src/Home/zz.ZC b/src/Home/zz.ZC new file mode 100755 index 00000000..5dd503c4 --- /dev/null +++ b/src/Home/zz.ZC @@ -0,0 +1,45 @@ + + +//In("B\n2*1024*1024\n\n");Mount; + +// See BlkDevRep +I64 i, dst_blks; +CBlkDev *b = blkdev.blkdevs; +U8 *dst_disk, dst_let, got = FALSE; + +for (i = 0; i < BLKDEVS_NUM; i++) +{ // look for a RAM Disk + if (b[i].bd_signature == BD_SIGNATURE_VAL) + { + if (b[i].RAM_disk) + { + dst_disk = b[i].RAM_disk; + dst_let = b[i].first_drive_let; + dst_blks = b[i].max_blk; + "\tRAM disk address:\t0x%X\n", dst_disk; + "\tDrive Letter:\t%C\n", dst_let; + "\tDrive Max Block:\t0x%X\n", dst_blks; + got = TRUE; + break; + } + } +} + +if (!got) + Break; + +U8 *dst_str = MStrPrint("%C:/", dst_let); +U8 *dst_disk_str = MStrPrint("0x%0X", dst_disk); +U8 *dst_blks_str = MStrPrint("%d", dst_blks); + +//CopyTree("::/", dst_str); +Drive(dst_let); +In("BB"); +In(dst_disk_str); +In("\n"); +In(dst_blks_str); +In("\n\n\n\n"); +MakeAll; +Cd("Kernel"); +Sleep(3333); +BootRAM("Kernel.ZXE"); diff --git a/src/Home/zzz.ZC b/src/Home/zzz.ZC new file mode 100755 index 00000000..a70793f0 --- /dev/null +++ b/src/Home/zzz.ZC @@ -0,0 +1,44 @@ + +In("B\n2*1024*1024\n\n");Mount; + +// See BlkDevRep +I64 i, dst_blks; +CBlkDev *b = blkdev.blkdevs; +U8 *dst_disk, dst_let, got = FALSE; + +for (i = 0; i < BLKDEVS_NUM; i++) +{ // look for a RAM Disk + if (b[i].bd_signature == BD_SIGNATURE_VAL) + { + if (b[i].RAM_disk) + { + dst_disk = b[i].RAM_disk; + dst_let = b[i].first_drive_let; + dst_blks = b[i].max_blk; + "\tRAM disk address:\t0x%X\n", dst_disk; + "\tDrive Letter:\t%C\n", dst_let; + "\tDrive Max Block:\t0x%X\n", dst_blks; + got = TRUE; + break; + } + } +} + +if (!got) + Break; + +U8 *dst_str = MStrPrint("%C:/", dst_let); +U8 *dst_disk_str = MStrPrint("0x%0X", dst_disk); +U8 *dst_blks_str = MStrPrint("%d", dst_blks); +//"%s %s %s \n\n", dst_str, dst_disk_str, dst_blks_str; +CopyTree("::/", dst_str); +Drive(dst_let); +In("BB"); +In(dst_disk_str); +In("\n"); +In(dst_blks_str); +In("\n\n\n\n"); +MakeAll; +Cd("Kernel"); +Sleep(3333); +BootRAM("Kernel.ZXE"); diff --git a/src/Kernel/Display.ZC b/src/Kernel/Display.ZC index ef89e85f..5d1a62d8 100755 --- a/src/Kernel/Display.ZC +++ b/src/Kernel/Display.ZC @@ -79,7 +79,7 @@ See also $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$(). if (ch_bitmap & 1) *framebuffer++ = WHITE32; else - *framebuffer++ = BLACK32; + *framebuffer++ = RED32; if (i & (FONT_WIDTH - 1) == FONT_WIDTH - 1) framebuffer += sys_framebuffer_width - FONT_WIDTH; ch_bitmap >>= 1; diff --git a/src/Kernel/KStart16.ZC b/src/Kernel/KStart16.ZC index 13fef09e..e642556f 100755 --- a/src/Kernel/KStart16.ZC +++ b/src/Kernel/KStart16.ZC @@ -70,8 +70,8 @@ SYS_FRAMEBUFFER_LIST:: DU8 sizeof(CVideoInfo) * VBE_MODES_NUM DUP(0); #assert $$ - SYS_KERNEL == sizeof(CKernel) - sizeof(CZXE) -REQUESTED_SCREEN_WIDTH: DU16 1024; -REQUESTED_SCREEN_HEIGHT: DU16 768; +REQUESTED_SCREEN_WIDTH: DU16 1920; +REQUESTED_SCREEN_HEIGHT: DU16 1080; VBE_TEMP_MODE: DU8 sizeof(CVBEMode) DUP(0); VBE_INFO: DU8 sizeof(CVBEInfo) DUP(0); diff --git a/src/Kernel/KernelA.HH b/src/Kernel/KernelA.HH index c29354a6..addcf9fa 100755 --- a/src/Kernel/KernelA.HH +++ b/src/Kernel/KernelA.HH @@ -498,6 +498,7 @@ class CPatchTableAbsAddr #define BLACK32 0x000000 #define WHITE32 0xFFFFFF +#define RED32 0xFF0000 #define VBE_MODES_NUM 32 class CVBEInfo diff --git a/src/System/Utils/ConversionScript.ZC b/src/System/Utils/ConversionScript.ZC index 91373bf9..5ba0bcf9 100755 --- a/src/System/Utils/ConversionScript.ZC +++ b/src/System/Utils/ConversionScript.ZC @@ -119,3 +119,6 @@ U0 Cvt(U8 *ff_mask="*", U8 *fu_flags="+r+l-i+S") } //Cvt("Sup1/*"); + +//TODO add flushmessages +// TODO D( --> Dump( \ No newline at end of file