diff --git a/README.md b/README.md index e19308f5..96326874 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,13 @@ [![Discord](https://img.shields.io/discord/934200098144022609?color=7289DA&label=Discord&logo=discord&logoColor=white)](https://discord.gg/rK6U3xdr7D) [![](https://img.shields.io/badge/wiki-documentation-forestgreen)](https://github.com/Zeal-Operating-System/ZealOS/wiki) -The Zeal Operating System is a modernized, professional fork of the 64-bit Temple Operating System. Guiding principles of development include transparency, full user control, and adherence to public-domain/open-source implementations. +The Zeal Operating System is a modernized fork of the 64-bit Temple Operating System. Guiding principles of development include transparency, full user control, and adherence to public-domain/open-source implementations. ![](/screenshots/screenshot2.png) ZealOS strives to be simple, documented, and require as little of a knowledge gap as possible. One person should be able to comprehend the entire system in at least a semi-detailed way within a few days of study. -Simplify, don't complicate; make accessible, don't obfuscate. -> The CIA encourages code obfuscation. They make it more complicated than necessary.\ -—Terry A. Davis +**Simplify, don't complicate; make accessible, don't obfuscate.** Features in development include: - [32-bit color VBE graphics](https://github.com/TempleProgramming/HolyGL) diff --git a/src/Demo/Games/CastleFrankenstein.ZC b/src/Demo/Games/CastleFrankenstein.ZC index c5eed11b..306a912c 100755 --- a/src/Demo/Games/CastleFrankenstein.ZC +++ b/src/Demo/Games/CastleFrankenstein.ZC @@ -578,6 +578,29 @@ U0 RotateMan(F64 d) } } +CTask *mouse_task = NULL; +CTask *game_task = Fs; +F64 mouse_scale = 32.0; + +U0 MouseHandler() +{ + Bool button; + I64 x; + while (TRUE) + { + button = mouse_hard.raw_bttns[0]; + x = mouse_hard.raw_data.x; + if (button || x!=0) + MouseRawReset; // Mark mouse data as consumed + if (button) + MessagePostWait(game_task,MESSAGE_KEY_DOWN_UP,CH_SPACE,0); + if (x != 0) { + man_é += (x/mouse_scale)/MICRO_STEPS; + } + Sleep(10); + } +} + U0 CastleFrankenstein() { I64 sc; @@ -618,6 +641,26 @@ U0 CastleFrankenstein() Fire; break; + case 'm': + if (!mouse_task) { + MouseRaw(TRUE); + mouse_task=Spawn(&MouseHandler,NULL); + } + else { + Kill(mouse_task); + mouse_task=NULL; + MouseRaw(FALSE); + } + break; + + case '+': + mouse_scale *= 0.9; + break; + + case '-': + mouse_scale *= 1.1; + break; + case '\n': Init; break; @@ -663,7 +706,11 @@ fs_done: RegWrite("ZealOS/CastleFrankenstein", "F64 best_score=%5.4f;\n", best_score); } +MouseRaw(TRUE); +mouse_task=Spawn(&MouseHandler,NULL); CastleFrankenstein; +if (mouse_task) Kill(mouse_task); +MouseRaw(FALSE); &     diff --git a/src/Doc/ChangeLog.DD b/src/Doc/ChangeLog.DD index 2cb3cad5..20ba825f 100755 --- a/src/Doc/ChangeLog.DD +++ b/src/Doc/ChangeLog.DD @@ -1,4 +1,18 @@ $WW,1$$FG,5$$TX+CX,"ChangeLog"$$FG$ +$IV,1$----03/14/23 03:23:46----$IV,0$ +* Created %o Bool $LK+PU,"StrPrint",A="FF:::/Kernel/StrPrint.ZC,'o':"$ format code, updated $LK+PU,"Print.DD",A="FI:::/Doc/Print.DD"$ with new %o code and previously undocumented format codes. + +$IV,1$----03/13/23 18:06:09----$IV,0$ +* Raised version number to 2.02. + +$IV,1$----02/25/23 16:35:04----$IV,0$ +* Created $LK+PU,"MouseRaw",A="MN:MouseRaw"$ and $LK+PU,"MouseRawReset",A="MN:MouseRawReset"$, externs added to $LK+PU,"KernelC.HH",A="FF:::/Kernel/KernelC.HH,MouseRaw("$, functions used in $MA-X+PU,"Mouse.ZC",LM="Find(\"MouseRawReset;\", \"::/Kernel/SerialDev/Mouse.ZC\");View;"$. +* Added members to $LK+PU,"CMouseHardStateGlobals",A="MN:CMouseHardStateGlobals"$ and used in $MA-X+PU,"Mouse.ZC",LM="Find(\"raw_data\", \"::/Kernel/SerialDev/Mouse.ZC\");Find(\"raw_mode\", \"::/Kernel/SerialDev/Mouse.ZC\");Find(\"raw_bttns\", \"::/Kernel/SerialDev/Mouse.ZC\");View;"$: + - CD3I64 raw_data + - Bool raw_bttns[5] + - Bool raw_mode +* $MA-X+PU,"Update CastleFrankenstein to use new MouseRaw functionality.",LM="Find(\"mouse_task\", \"::/Demo/Games/CastleFrankenstein.ZC\");Find(\"MouseHandler\", \"::/Demo/Games/CastleFrankenstein.ZC\");Find(\"MouseRaw\", \"::/Demo/Games/CastleFrankenstein.ZC\");View;"$ + $IV,1$----12/21/22 03:38:35----$IV,0$ * Raised version number to 2.01. * Created $LK+PU,"FreeAll",A="MN:FreeAll"$ method to /Kernel/Memory/MAllocFree.ZC and extern to $LK+PU,"/Kernel/KernelC.HH",A="FF:::/Kernel/KernelC.HH,FreeAll"$. diff --git a/src/Doc/Print.DD b/src/Doc/Print.DD index d9a6609c..76d75ae4 100755 --- a/src/Doc/Print.DD +++ b/src/Doc/Print.DD @@ -21,6 +21,16 @@ For $FG,2$"%c"$FG$ or $FG,2$"%C"$FG$, the repeats the char that $ID,2$$FG,2$"%n"$FG$ floating point in engineering notation, exponents being multiples of three. If it has a code, it will display scientific units letters. +$FG,2$"%e"$FG$ floating point in engineering notation, exponents not restricted to multiples of three. + +$FG,2$"%d"$FG$ Whole number. + +$FG,2$"%u"$FG$ Unsigned whole number. + +$FG,2$"%f"$FG$ Floating point number. + +$FG,2$"%g"$FG$ Right-aligned rounded-up integer of floating point number. + $FG,2$"%S"$FG$ $LK,"Define",A="MN:Define"$() entry. $FG,2$"%C"$FG$ $LK,"ToUpper",A="MN:ToUpper"$() character. @@ -52,6 +62,12 @@ $FG,2$"%Z"$FG$ $LK,"DefineListLoad",A="MN:DefineListLoad"$() subentry. Pass sub_ $FG,2$"%Q"$FG$ convert "\" to "\\" and quote to backslash quote. (For use in creating strs in strs.) $FG,2$"%q"$FG$ rev a $FG,2$"%Q"$FG$. + +$FG,2$"%x"$FG$ Hex number. + +$FG,2$"%b"$FG$ Binary number$FG$. + +$FG,2$"%o"$FG$ Bool$FG$. $ID,-2$ $FG,5$$TX+CX,"Print Family"$$FG$ diff --git a/src/Home/Net/Drivers/PCNet.ZC b/src/Home/Net/Drivers/PCNet.ZC old mode 100644 new mode 100755 diff --git a/src/Home/PaletteEditor/Palettes/SandyBeach.ZC b/src/Home/PaletteEditor/Palettes/SandyBeach.ZC new file mode 100755 index 00000000..029b81a1 --- /dev/null +++ b/src/Home/PaletteEditor/Palettes/SandyBeach.ZC @@ -0,0 +1,10 @@ +public CBGR24 gr_palette_sandy_beach[COLORS_NUM] = { +0x000000, 0x000088, 0x008800, 0x006060, 0x002288, 0x4B0082, 0xA52A2A, 0xAAAAAA, 0x444444, 0x4169E1, 0xADFF2F, 0x00AAAA, 0xFF8888, 0x9932CC, 0xC09020, 0xFFF8DF +}; +public U0 PaletteSetSandyBeach(Bool persistent=TRUE) +{ + GrPaletteSet(gr_palette_sandy_beach); + LFBFlush; + if (persistent) + fp_set_std_palette = &PaletteSetSandyBeach; +} diff --git a/src/Kernel/KGlobals.ZC b/src/Kernel/KGlobals.ZC index 3ccd954e..d240802b 100755 --- a/src/Kernel/KGlobals.ZC +++ b/src/Kernel/KGlobals.ZC @@ -13,7 +13,7 @@ CTask *sys_winmgr_task, U8 *rev_bits_table; //Table with U8 bits reversed CDate local_time_offset; F64 *pow10_I64, - sys_os_version = 2.01; + sys_os_version = 2.02; CAutoCompleteDictGlobals acd; CAutoCompleteGlobals ac; diff --git a/src/Kernel/KernelA.HH b/src/Kernel/KernelA.HH index 2f22b54f..15bc09fb 100755 --- a/src/Kernel/KernelA.HH +++ b/src/Kernel/KernelA.HH @@ -3718,7 +3718,8 @@ public class CKbdStateGlobals public class CMouseHardStateGlobals { CD3I64 pos, //Position in pixels - prescale; + prescale, + raw_data; CD3 scale; F64 speed; //Output: How fast the user is moving it. I64 timestamp, //Output: TSCGet when event. @@ -3726,6 +3727,8 @@ public class CMouseHardStateGlobals pkt_size; //Private CFifoU8 *fifo, *fifo2; //Private Bool bttns[5], + raw_bttns[5], + raw_mode, has_wheel, has_ext_bttns, enabled, diff --git a/src/Kernel/KernelC.HH b/src/Kernel/KernelC.HH index f050d7ee..72a04628 100755 --- a/src/Kernel/KernelC.HH +++ b/src/Kernel/KernelC.HH @@ -503,6 +503,8 @@ extern I64 KbdMessagesQueue(); public extern U0 KbdTypeMatic(U8 delay); extern Bool MouseHardDriverInstall(); public extern Bool MouseHardEnable(Bool val=TRUE); +public extern Bool MouseRaw(Bool val); +public extern U0 MouseRawReset(Bool val=TRUE); public extern I64 PressAKey(); public extern I64 CharScan(); public extern Bool KeyScan(I64 *_ch=NULL, I64 *_scan_code=NULL, Bool echo=FALSE); diff --git a/src/Kernel/SerialDev/Mouse.ZC b/src/Kernel/SerialDev/Mouse.ZC index 756aaedf..be578c4c 100755 --- a/src/Kernel/SerialDev/Mouse.ZC +++ b/src/Kernel/SerialDev/Mouse.ZC @@ -44,6 +44,28 @@ U0 MouseUpdate(I64 x, I64 y, I64 z, Bool l, Bool r) LBEqual(&kbd.scan_code, SCf_MS_R_DOWN, mouse.rb); } +public U0 MouseRawReset() +{ + mouse_hard.raw_data.x = 0; + mouse_hard.raw_data.y = 0; + mouse_hard.raw_data.z = 0; + mouse_hard.raw_bttns[0] = FALSE; + mouse_hard.raw_bttns[1] = FALSE; + mouse_hard.raw_bttns[2] = FALSE; + mouse_hard.raw_bttns[3] = FALSE; + mouse_hard.raw_bttns[4] = FALSE; +} + +public Bool MouseRaw(Bool val) +{ // Places mouse in "raw" mode, button presses will not go to windows manager when true + Bool old_val = mouse_hard.raw_mode; + + mouse_hard.raw_mode = val; + mouse.show = !val; + + return old_val; +} + U0 MouseSet(I64 x=I64_MAX, I64 y=I64_MAX, I64 z=I64_MAX, I64 l=I64_MAX, I64 r=I64_MAX) {//Note: Generates a message. See $LK,"MouseSet",A="FF:::/Demo/Games/Zing.ZC,MouseSet"$(). if (!(0 <= x < sys_framebuffer_width)) @@ -78,6 +100,7 @@ U0 MouseInit() mouse.timestamp = TSCGet; mouse.dbl_time = 0.175; GridInit; + MouseRawReset; } U0 MouseHardPacketRead() @@ -194,6 +217,7 @@ Bool MouseHardReset() catch Fs->catch_except = TRUE; + MouseRawReset; return res; } @@ -256,18 +280,15 @@ U0 MouseHardHandler() I64 i, dx, dy, dz; U8 mouse_buf[4]; - MouseHardSetPre; + if (!mouse_hard.raw_mode) + MouseHardSetPre; + for (i = 0; i < 4; i++) mouse_buf[i] = 0; for (i = 0; i < mouse_hard.pkt_size; i++) if (!FifoU8Remove(mouse_hard.fifo2, &mouse_buf[i])) mouse_buf[i] = 0; - mouse_hard.bttns[0] = mouse_buf[0] & 1; - mouse_hard.bttns[1] = (mouse_buf[0] & 2) >> 1; - mouse_hard.bttns[2] = (mouse_buf[0] & 4) >> 2; - mouse_hard.bttns[3] = (mouse_buf[3] & 0x10) >> 4; - mouse_hard.bttns[4] = (mouse_buf[3] & 0x20) >> 5; if (mouse_buf[0] & 0x10) dx = mouse_buf[1]-256; else @@ -281,11 +302,32 @@ U0 MouseHardHandler() else dz = mouse_buf[3] & 7; - mouse_hard.prescale.x += dx; - mouse_hard.prescale.y += dy; - mouse_hard.prescale.z += dz; - - MouseHardSetPost; + if (mouse_hard.raw_mode) + { + // buttons / position data need to by consumed by app + // buttons stay down, positions keep accumulating until + // consumed by app and reset with MouseRawReset + mouse_hard.raw_bttns[0] |= mouse_buf[0] & 1; + mouse_hard.raw_bttns[1] |= (mouse_buf[0] & 2) >> 1; + mouse_hard.raw_bttns[2] |= (mouse_buf[0] & 4) >> 2; + mouse_hard.raw_bttns[3] |= (mouse_buf[3] & 0x10) >> 4; + mouse_hard.raw_bttns[4] |= (mouse_buf[3] & 0x20) >> 5; + mouse_hard.raw_data.x += dx; + mouse_hard.raw_data.y += dy; + mouse_hard.raw_data.z += dz; + } + else + { + mouse_hard.bttns[0] = mouse_buf[0] & 1; + mouse_hard.bttns[1] = (mouse_buf[0] & 2) >> 1; + mouse_hard.bttns[2] = (mouse_buf[0] & 4) >> 2; + mouse_hard.bttns[3] = (mouse_buf[3] & 0x10) >> 4; + mouse_hard.bttns[4] = (mouse_buf[3] & 0x20) >> 5; + mouse_hard.prescale.x += dx; + mouse_hard.prescale.y += dy; + mouse_hard.prescale.z += dz; + MouseHardSetPost; + } } U0 MouseHardSet(I64 x, I64 y, I64 z, I64 l, I64 r) diff --git a/src/Kernel/StrPrint.ZC b/src/Kernel/StrPrint.ZC index ba8f61af..7be89766 100755 --- a/src/Kernel/StrPrint.ZC +++ b/src/Kernel/StrPrint.ZC @@ -439,6 +439,12 @@ to avoid this. ptr = argv[cur_arg++]; break; + case 'o': // Bool + if (cur_arg >= argc) + throw('StrPrint'); + ptr = DefineSub(ToBool(argv[cur_arg++]), "ST_FALSE_TRUE"); + break; + case 'S': if (cur_arg >= argc) throw('StrPrint'); @@ -656,7 +662,7 @@ sp_out_inf: break; } - sp_out_f: +sp_out_f: if (dec_len < 0) dec_len = 0; n = Log10(d); diff --git a/src/System/Define.ZC b/src/System/Define.ZC index bf8e7bcd..707e21d0 100755 --- a/src/System/Define.ZC +++ b/src/System/Define.ZC @@ -15,7 +15,7 @@ U0 LoadDocDefines() //$LK,"DD_BOOT_HIGH_LOC_DVD",A="FF:::/System/Boot/BootDVD.ZC,DD_BOOT_HIGH_LOC_DVD"$ $TR,"LineRep"$ -$ID,2$DefinePrint("DD_ZEALOS_LOC","98,709"); +$ID,2$DefinePrint("DD_ZEALOS_LOC","98,756"); $ID,-2$ DefinePrint("DD_MP_VECT", "%08X", MP_VECT_ADDR); DefinePrint("DD_MP_VECT_END", "%08X", MP_VECT_ADDR + COREAP_16BIT_INIT_END - COREAP_16BIT_INIT - 1); diff --git a/src/System/Gr/GrPalette.ZC b/src/System/Gr/GrPalette.ZC index 75ea2c50..a9d0ee93 100755 --- a/src/System/Gr/GrPalette.ZC +++ b/src/System/Gr/GrPalette.ZC @@ -54,6 +54,7 @@ public U0 PaletteSetDark(Bool persistent=TRUE) //*(drv_text_attr(U8 *) + 1) = BROWN; } //******************************************************************************** + public CBGR24 gr_palette_light[COLORS_NUM] = { 0x000000, 0x0148A4, 0x3B7901, 0x057C7E, 0xBB2020, 0x9E42AE, 0xB57901, 0xB2B6AF, 0x555753, 0x678FBB, 0x82BC49, 0x0097A2, 0xE26A6A, 0xC671BC, 0xC7AB00, 0xFEF1F0 diff --git a/src/System/Gr/GrScreen.ZC b/src/System/Gr/GrScreen.ZC index dcfd93a9..1c8e64e6 100755 --- a/src/System/Gr/GrScreen.ZC +++ b/src/System/Gr/GrScreen.ZC @@ -395,6 +395,7 @@ U0 GrUpdateScreen32() while (src < size) //draw 2 pixels at a time *dst++ = gr_palette[*src++ & 0xFF] | gr_palette[*src++ & 0xFF] << 32; + GrCalcScreenUpdates; if (LBtr(&sys_semas[SEMA_FLUSH_VBE_IMAGE], 0)) diff --git a/src/System/Utils/ConversionScript.ZC b/src/System/Utils/ConversionScript.ZC index e3436b86..8289fea9 100755 --- a/src/System/Utils/ConversionScript.ZC +++ b/src/System/Utils/ConversionScript.ZC @@ -41,7 +41,7 @@ U0 Cvt(U8 *ff_mask="*", U8 *fu_flags="+r+l-i+S") Find("ExtDft", ff_mask, fu_flags, "ExtDefault"); Find("ExtChg", ff_mask, fu_flags, "ExtChange"); Find("RegDft", ff_mask, fu_flags, "RegDefault"); - Find("\"HC\"", ff_mask, fu_flags, "\"CC\""); + Find("\"HC\"", ff_mask, fu_flags, "\"ZC\""); Find("CDrv", ff_mask, fu_flags, "CDrive"); Find("CDbgInfo", ff_mask, fu_flags, "CDebugInfo"); Find("dbg_info", ff_mask, fu_flags, "debug_info");