From 5b3f101e8ae2337fa8c3af41ddbc33c90c33dc7e Mon Sep 17 00:00:00 2001 From: The Tinkerer Date: Thu, 8 Aug 2024 21:45:14 +0000 Subject: [PATCH] TinkerOS 5.17 --- Adam/Net/Http.HC | 2 +- Adam/Opt/Utils/SethUtil.HC | 13 +- Adam/Opt/Utils/SysSurvey.HC | 24 +- Compiler/OptPass012.HC | 11 +- Demo/Math/Pi/BnPiKernel.HC | 682 ++++++++++++++++++ Demo/Math/Pi/PI100.HC | 29 + Demo/Tests/CompilerFix.HC | 18 + Doc/Baremetal/Baremetal.DD | 4 + .../Desktop/Dell/OptiPlex_755_MT/Survey.DD | 82 +++ .../Desktop/Dell/OptiPlex_9020_MT/Survey.DD | 92 +++ .../Precision_WorkStation_T7400/Survey.DD | 107 +++ .../Laptop/HP/HP_2000_Notebook_PC/Survey.DD | 85 +++ Doc/Start.DD | 2 +- Doc/TinkerOS.DD | 5 +- Doc/Web.DD | 2 +- Kernel/KGlbls.HC | 2 +- MakeHome.HC | 2 +- Misc/OSTestSuite.HC | 20 +- 18 files changed, 1159 insertions(+), 23 deletions(-) create mode 100755 Demo/Math/Pi/BnPiKernel.HC create mode 100755 Demo/Math/Pi/PI100.HC create mode 100644 Demo/Tests/CompilerFix.HC create mode 100644 Doc/Baremetal/Machines/Desktop/Dell/OptiPlex_755_MT/Survey.DD create mode 100644 Doc/Baremetal/Machines/Desktop/Dell/OptiPlex_9020_MT/Survey.DD create mode 100644 Doc/Baremetal/Machines/Desktop/Dell/Precision_WorkStation_T7400/Survey.DD create mode 100644 Doc/Baremetal/Machines/Laptop/HP/HP_2000_Notebook_PC/Survey.DD diff --git a/Adam/Net/Http.HC b/Adam/Net/Http.HC index a581146..6ae1138 100644 --- a/Adam/Net/Http.HC +++ b/Adam/Net/Http.HC @@ -9,7 +9,7 @@ #define HTTP_ECONTENTLENGTH (-106) #define HTTP_MAX_REDIRECTS 5 -#define HTTP_USER_AGENT "Adam/Net/Http ($TX+CX,"TinkerOS V5.16",D="DD_OS_NAME_VERSION"$)" +#define HTTP_USER_AGENT "Adam/Net/Http ($TX+CX,"TinkerOS V5.17",D="DD_OS_NAME_VERSION"$)" /** * @param len_out (required) requires the content length, or -1 if unspecified diff --git a/Adam/Opt/Utils/SethUtil.HC b/Adam/Opt/Utils/SethUtil.HC index 7c8f6e5..9434ba2 100644 --- a/Adam/Opt/Utils/SethUtil.HC +++ b/Adam/Opt/Utils/SethUtil.HC @@ -30,6 +30,10 @@ public U0 SethREPL(I64 cpu_num=mp_cnt-1, U8 *first_cmd=NULL, Bool exit_after_fir repl->title_src=TTS_LOCKED_CONST; StrCpy(repl->task_title,"Seth REPL"); U8 *line,*cwd,*pmpt,cpu_desc[5]; + cwd=MStrPrint("Cd(\"%s\");\n",DirCur); + TaskExe(repl,Fs,cwd,0); + TaskWait(repl); + Free(cwd); cpu_desc[0]=0; if (cpu_num) CatPrint(cpu_desc,"Seth"); else CatPrint(cpu_desc,"Adam"); @@ -119,7 +123,7 @@ U0 SethExec(U8 *include_file, I64 cpu_num=mp_cnt-1) public CTask* SethFile(U8 *include_file, I64 cpu_num=mp_cnt-1) {//Include file on a Seth core (like AdamFile) - U8 *first_cmd = MStrPrint("#include \"%s\"\n\nExit;\n", include_file); + U8 *cwd,*first_cmd = MStrPrint("#include \"%s\"\n\nExit;\n", include_file); if (cpu_num>=mp_cnt) { @@ -138,9 +142,12 @@ public CTask* SethFile(U8 *include_file, I64 cpu_num=mp_cnt-1) CTask *repl=Spawn(&SrvCmdLine,NULL,NULL,cpu_num); repl->title_src=TTS_LOCKED_CONST; - // TODO StrNCpy + cwd=MStrPrint("Cd(\"%s\");\n",DirCur); + TaskExe(repl,Fs,cwd,0); + TaskWait(repl); + Free(cwd); StrCpy(repl->task_title,include_file); TaskExe(repl,Fs,first_cmd,0); return repl; } -#help_index "" \ No newline at end of file +#help_index "" diff --git a/Adam/Opt/Utils/SysSurvey.HC b/Adam/Opt/Utils/SysSurvey.HC index d38d1de..4b77ecd 100644 --- a/Adam/Opt/Utils/SysSurvey.HC +++ b/Adam/Opt/Utils/SysSurvey.HC @@ -96,8 +96,9 @@ U0 SetDefaultResp(U8 *q, I64 resp) public U0 RunSysSurvey() { + CDrv *dv; U8 *notes=NULL, *survey_file; - Bool is_laptop,extra_notes,installed,sysrep; + Bool is_laptop,extra_notes,installed,sysrep,clonezilla; I64 have_kbd_ms,have_expresscard,have_dock,i,resp[NUM_STD_SURVEY_QUESTIONS], resp_ins[NUM_INS_SURVEY_QUESTIONS]; DocClear; @@ -116,7 +117,13 @@ public U0 RunSysSurvey() for (i=0; isize != 0x256534442) clonezilla=FALSE; + } + } + else clonezilla=FALSE; + + if (clonezilla) "It appears clonezilla was used to partition the drive.\n"; + if (installed && blkdev.boot_drv_let != 'T') survey_file=MStrPrint("%C:/Home/Survey.DD",blkdev.boot_drv_let); else diff --git a/Compiler/OptPass012.HC b/Compiler/OptPass012.HC index b90d34a..22f5ee8 100644 --- a/Compiler/OptPass012.HC +++ b/Compiler/OptPass012.HC @@ -164,16 +164,6 @@ CIntermediateCode *OptPass012(CCmpCtrl *cc) if (tmpi->ic_class->raw_type==RT_F64) tmpi->ic_flags|=ICF_USE_F64; break; - case IC_COM: - if (tmpi1->ic_code==IC_IMM_I64) - { - tmpi->ic_data=~tmpi1->ic_data; - tmpi->ic_code=IC_IMM_I64; - tmpi->ic_flags|=tmpi1->ic_flags; - OptSetNOP1(tmpi1); - } - tmpi_push->ic_class2=cmp.internal_types[RT_I64]; - break; start: case IC_NOT: if (tmpc->raw_type==RT_F64) @@ -1456,6 +1446,7 @@ end: case IC_NOBOUND_SWITCH: case IC_SWITCH: case IC_ASM: + case IC_COM: break; default: "Pass:%d Missing IC hndlr\n" diff --git a/Demo/Math/Pi/BnPiKernel.HC b/Demo/Math/Pi/BnPiKernel.HC new file mode 100755 index 0000000..70b1d18 --- /dev/null +++ b/Demo/Math/Pi/BnPiKernel.HC @@ -0,0 +1,682 @@ +// This is not the same benchmark I did when comparing TOS to Linux +// +// This is just a unit test/demo, it prints as it goes and Yields, the original did not. +// +// TODO finish adding missing BigNum functions and move to a separate library this includes + +#ifdef __GNUC__ +#include +#include +#include +typedef float F64; +typedef uint64_t U64; +typedef int64_t I64; +typedef uint32_t U32; +typedef int32_t I32; +typedef uint16_t U16; +typedef int16_t I16; +typedef uint8_t U8; +typedef int8_t I8; +typedef void U0; +#ifdef __cplusplus +#define BNType class +typedef bool Bool; +#else +#define BNType struct +typedef _Bool Bool; +#endif +#else +#define BNType class +#endif + +BNType BigNum +{ +#ifdef __cplusplus +public: +#endif + U32 *array; +}; + +#ifdef __GNUC__ +typedef struct BigNum BigNum; +#endif + +U0 BigNumAssign(BigNum *dst,BigNum *src) +{ + I64 i; + for (i = 0; i < 160; ++i) + { + dst -> array[i] = src -> array[i]; + } +} + +#define LARGER 1 +#define SMALLER -1 +#define EQUAL 0 + +I64 BigNumCmp(BigNum *a,BigNum *b) +{ + I64 i = 160; + do + { + i -= 1; + if (a -> array[i] > b -> array[i]) + { + return LARGER; + } + else if (a -> array[i] < b -> array[i]) + { + return SMALLER; + } + } + while (i != 0); + return EQUAL; +} + +I64 BigNumIsZero(BigNum *n) +{ + I64 i; + for (i = 0; i < 160; ++i) + { + if (n -> array[i]) + { + return 0; + } + } + return 1; +} + + +U0 BigNumAnd(BigNum *a,BigNum *b,BigNum *c) +{ + I64 i; + for (i = 0; i < 160; ++i) + { + c -> array[i] = (a -> array[i] & b -> array[i]); + } +} + +U0 BigNumOr(BigNum *a,BigNum *b,BigNum *c) +{ + I64 i; + for (i = 0; i < 160; ++i) + { + c -> array[i] = (a -> array[i] | b -> array[i]); + } +} + +U0 BigNumXor(BigNum *a,BigNum *b,BigNum *c) +{ + I64 i; + for (i = 0; i < 160; ++i) + { + c -> array[i] = (a -> array[i] ^ b -> array[i]); + } +} + + +U0 BigNumRShiftU32(BigNum *a,I64 nwords) +{ + I64 i; + if (nwords >= 160) + { + for (i = 0; i < 160; ++i) + { + a -> array[i] = 0; + } + return ; + } + for (i = 0; i < 160 - nwords; ++i) + { + a -> array[i] = a -> array[i + nwords]; + } + for (; i < 160; ++i) + { + a -> array[i] = 0; + } +} + +U0 BigNumLShiftU32(BigNum *a,I64 nwords) +{ + I64 i; + for (i = 160 - 1; i >= nwords; --i) + { + a -> array[i] = a -> array[i - nwords]; + } + for (; i >= 0; --i) + { + a -> array[i] = 0; + } +} + +U0 BigNumLShiftOne(BigNum *a) +{ + I64 i; + U32 tmp; + for (i = 160 - 1; i > 0; --i) + { + a -> array[i] = (a -> array[i] << 1) | (a -> array[i - 1] >> ((8 * 4) - 1)); + } + + + tmp=a->array[0] << 1; + a->array[0]=tmp; +} + +U0 BigNumRShiftOne(BigNum *a) +{ + I64 i; + U32 tmp; + for (i = 0; i < 160 - 1; ++i) + { + a -> array[i] = (a -> array[i] >> 1) | (a -> array[i + 1] << ((8 * 4) - 1)); + } + + tmp=a -> array[160 - 1] >> 1; + a->array[160 - 1]=tmp; +} + +U0 BigNumZero(BigNum *n) +{ + I64 i; + for (i = 0; i < 160; ++i) + { + n -> array[i] = 0; + } +} + +U0 BigNumInit(BigNum *n) +{ +#ifdef __GNUC__ + n->array=malloc(5*128*4); +#else + n->array=MAlloc(5*128*4); +#endif + BigNumZero(n); +} + +U0 BigNumFree(BigNum *n) +{ +#ifdef __GNUC__ + free(n->array); +#else + Free(n->array); + Yield; +#endif +} + +U0 BigNumFromU32(BigNum *n,U32 i) +{ + BigNumZero(n); + n -> array[0] = i; + n -> array[1] = 0; +} + +U0 BigNumFromU64(BigNum *n,U64 i) +{ + U64 tmp = i>>32; + BigNumZero(n); + n -> array[0] = i; + n -> array[1] = tmp; +} + +U32 BigNumToU32(BigNum *n) +{ + return n -> array[0]; +} + +U64 BigNumToU64(BigNum *n) +{ + U64 ret = n->array[1]; + ret <<= 32; + ret += n -> array[0]; + return ret; +} + +/* +U0 BigNumFromString(BigNum *n,U8 *str,I64 nbytes) +{ + BigNumZero(n); + U32 tmp; + I64 i = nbytes - 2 * 4; + I64 j = 0; + while (i >= 0){ + tmp = 0; + sscanf(&str[i],"%8x",&tmp); + n -> array[j] = tmp; + i -= 2 * 4; + j += 1; + } +} + + + +U0 BigNumToStr(BigNum *n,U8 *str,I64 nbytes) +{ + I64 j = 160 - 1; + I64 i = 0; + while (j >= 0 && nbytes > i + 1){ + str[i]=0; + CatPrint(&str[i],"%08x",n->array[j]); + + i += 2 * 4; + j -= 1; + } + j = 0; + while (str[j] == '0'){ + j += 1; + } + for (i = 0; i < nbytes - j; ++i) { + str[i] = str[i + j]; + } + str[i] = 0; +} +*/ + + +U0 BigNumDec(BigNum *n) +{ + U32 tmp; + U32 res; + I64 i; + for (i = 0; i < 160; ++i) + { + tmp = n -> array[i]; + res = tmp - 1; + n -> array[i] = res; + if (!(res > tmp)) + { + break; + } + } +} + +U0 BigNumInc(BigNum *n) +{ + U32 res; + U64 tmp; + I64 i; + for (i = 0; i < 160; ++i) + { + tmp = n -> array[i]; + res = tmp + 1; + n -> array[i] = res; + if (res > tmp) + { + break; + } + } +} + +U0 BigNumAdd(BigNum *a,BigNum *b,BigNum *c) +{ + U64 tmp; + I32 carry = 0; + I64 i; + for (i = 0; i < 160; ++i) + { + + tmp = a -> array[i]; + tmp += b -> array[i]; + tmp += carry; + + carry = (tmp > 0xFFFFFFFF); + c -> array[i] = tmp & 0xFFFFFFFF; + } +} + +U0 BigNumSub(BigNum *a,BigNum *b,BigNum *c) +{ + U64 res; + U64 tmp1; + U64 tmp2; + I32 borrow = 0; + I64 i; + for (i = 0; i < 160; ++i) + { + tmp1 = a -> array[i]; + tmp1 += 0x100000000; + + tmp2 = b -> array[i]; + tmp2 += borrow; + + res = tmp1 - tmp2; + c -> array[i] = res & 0xFFFFFFFF; + borrow = (res <= 0xFFFFFFFF); + } +} + +U0 BigNumMul(BigNum *a,BigNum *b,BigNum *c) +{ + BigNum row; + BigNum tmp; + I64 i,j; + U64 intermediate; + BigNumInit(&tmp); + BigNumInit(&row); + + BigNumZero(c); + for (i = 0; i < 160; ++i) + { + BigNumZero(&row); + for (j = 0; j < 160; ++j) + { + if (i + j < 160) + { + BigNumZero(&tmp); + intermediate = a -> array[i]; + intermediate *= b -> array[j]; + + BigNumFromU64(&tmp,intermediate); + BigNumLShiftU32(&tmp,i + j); + BigNumAdd(&tmp,&row,&row); + } + } + BigNumAdd(c,&row,c); + } + BigNumFree(&tmp); + BigNumFree(&row); +} + +U0 BigNumDiv(BigNum *a,BigNum *b,BigNum *c) +{ + BigNum current; + BigNum denom; + BigNum tmp; + + U64 half_max = 0x80000000; + Bool overflow = 0; + + BigNumInit(¤t); + BigNumInit(&denom); + BigNumInit(&tmp); + BigNumFromU32(¤t,1); + BigNumAssign(&denom,b); + BigNumAssign(&tmp,a); + + while (BigNumCmp(&denom,a) != LARGER) + { + if (denom.array[160 - 1] >= half_max) + { + overflow = 1; + break; + } + BigNumLShiftOne(¤t); + BigNumLShiftOne(&denom); + } + if (!overflow) + { + BigNumRShiftOne(&denom); + BigNumRShiftOne(¤t); + } + BigNumZero(c); + while (!BigNumIsZero(¤t)) + { + if (BigNumCmp(&tmp,&denom) != SMALLER) + { + BigNumSub(&tmp,&denom,&tmp); + BigNumOr(c,¤t,c); + } + BigNumRShiftOne(¤t); + BigNumRShiftOne(&denom); + } + + BigNumFree(¤t); + BigNumFree(&denom); + BigNumFree(&tmp); + +} + +U0 BigNumLShift(BigNum *a,BigNum *b,I64 nbits) +{ + BigNumAssign(b,a); + I64 i; + I64 nbits_pr_word = 4 * 8; + I64 nwords = nbits / nbits_pr_word; + U32 tmp; + if (nwords != 0) + { + BigNumLShiftU32(b,nwords); + nbits -= (nwords * nbits_pr_word); + } + if (nbits != 0) + { + for (i = 160 - 1; i > 0; --i) + { + b -> array[i] = (b -> array[i] << nbits) | (b -> array[i - 1] >> ((8 * 4) - nbits)); + } + + tmp = b->array[i]<array[i]=tmp; + } +} + +U0 BigNumRShift(BigNum *a,BigNum *b,I64 nbits) +{ + BigNumAssign(b,a); + I64 i; + I64 nbits_pr_word = 4 * 8; + I64 nwords = nbits / nbits_pr_word; + if (nwords != 0) + { + BigNumRShiftU32(b,nwords); + nbits -= (nwords * nbits_pr_word); + } + if (nbits != 0) + { + for (i = 0; i < 160 - 1; ++i) + { + b -> array[i] = (b -> array[i] >> nbits) | (b -> array[i + 1] << ((8 * 4) - nbits)); + } + b -> array[i] >>= nbits; + } +} + +U0 BigNumDivMod(BigNum *a,BigNum *b,BigNum *c,BigNum *d) +{ + BigNum tmp; + BigNumInit(&tmp); + BigNumDiv(a,b,c); + BigNumMul(c,b,&tmp); + BigNumSub(a,&tmp,d); + BigNumFree(&tmp); +} + +U0 BigNumMod(BigNum *a,BigNum *b,BigNum *c) +{ + BigNum tmp; + BigNumInit(&tmp); + BigNumDivMod(a,b,&tmp,c); + BigNumFree(&tmp); +} + +U0 BigNumPow(BigNum *a,BigNum *b,BigNum *c) +{ + BigNum tmp, bcopy; + + BigNumZero(c); + if (BigNumCmp(b,c) == EQUAL) + { + BigNumInc(c); + } + else + { + BigNumInit(&tmp); + BigNumInit(&bcopy); + + BigNumAssign(&bcopy,b); + BigNumAssign(&tmp,a); + BigNumDec(&bcopy); + while (!BigNumIsZero(&bcopy)) + { + BigNumMul(&tmp,a,c); + BigNumDec(&bcopy); + BigNumAssign(&tmp,c); + } + BigNumAssign(c,&tmp); + BigNumFree(&tmp); + BigNumFree(&bcopy); + } +} + +U0 BigNumIsqrt(BigNum *a,BigNum *b) +{ + BigNum low; + BigNum high; + BigNum mid; + BigNum tmp; + BigNumInit(&low); + BigNumInit(&high); + BigNumInit(&mid); + BigNumInit(&tmp); + + BigNumAssign(&high,a); + BigNumRShift(&high,&mid,1); + BigNumInc(&mid); + while (BigNumCmp(&high,&low) > 0) + { + BigNumMul(&mid,&mid,&tmp); + if (BigNumCmp(&tmp,a) > 0) + { + BigNumAssign(&high,&mid); + BigNumDec(&high); + } + else + { + BigNumAssign(&low,&mid); + } + BigNumSub(&high,&low,&mid); + BigNumRShiftOne(&mid); + BigNumAdd(&low,&mid,&mid); + BigNumInc(&mid); + } + BigNumAssign(b,&low); + + BigNumFree(&low); + BigNumFree(&high); + BigNumFree(&mid); + BigNumFree(&tmp); +} + + +U0 BnPiKernel(I64 digits, U8 *digits_out) +{ + I64 j; + U32 q = 1; + U32 r = 180; + U32 t = 60; + U32 i = 2; + + BigNum bq; + BigNum br; + BigNum bt; + BigNum bi; + BigNum bu; + BigNum by; + BigNum btmp; + BigNum btmp2; + BigNum btmp3; + + BigNumInit(&bq); + BigNumInit(&br); + BigNumInit(&bt); + BigNumInit(&bi); + BigNumInit(&bu); + BigNumInit(&by); + BigNumInit(&btmp); + BigNumInit(&btmp2); + BigNumInit(&btmp3); + + BigNumFromU32(&bq,q); + BigNumFromU32(&br,r); + BigNumFromU32(&bt,t); + BigNumFromU32(&bi,i); + + for (j = 0; j < digits; j++) + { + Yield; + BigNumLShift(&bi,&btmp3,1); + BigNumAdd(&btmp3,&bi,&btmp); + BigNumInc(&btmp); + BigNumAssign(&btmp2,&btmp); + BigNumInc(&btmp2); + BigNumMul(&btmp2,&btmp,&btmp3); + BigNumLShift(&btmp3,&btmp2,1); + BigNumAdd(&btmp3,&btmp2,&bu); + Yield; + BigNumLShift(&bi,&btmp,4); + BigNumLShift(&bi,&btmp2,3); + BigNumAdd(&btmp,&btmp2,&btmp3); + BigNumLShift(&bi,&btmp,1); + BigNumAdd(&btmp,&btmp3,&btmp2); + BigNumAdd(&btmp2,&bi,&btmp); + Yield; + BigNumDec(&btmp); + BigNumDec(&btmp); + BigNumDec(&btmp); + BigNumDec(&btmp); + BigNumDec(&btmp); + BigNumDec(&btmp); + BigNumDec(&btmp); + BigNumDec(&btmp); + BigNumDec(&btmp); + BigNumDec(&btmp); + BigNumDec(&btmp); + BigNumDec(&btmp); + Yield; + BigNumMul(&btmp,&bq,&btmp2); + BigNumLShift(&br,&btmp,2); + BigNumAdd(&br,&btmp,&btmp3); + BigNumAdd(&btmp2,&btmp3,&btmp); + BigNumLShift(&bt,&btmp2,2); + BigNumAdd(&btmp2,&bt,&btmp3); + Yield; + BigNumDiv(&btmp,&btmp3,&by); + Yield; + + *digits_out = '0'+BigNumToU32(&by)&0xff; + "%c",*digits_out++; + if (!j) + { + *digits_out = '.'; + "%c",*digits_out++; + } + Yield; + + BigNumLShift(&bi,&btmp,2); + BigNumAdd(&btmp,&bi,&btmp2); + BigNumDec(&btmp2); + BigNumDec(&btmp2); + BigNumMul(&bq,&btmp2,&btmp); + BigNumMul(&by,&bt,&btmp2); + BigNumAdd(&btmp,&br,&btmp3); + BigNumSub(&btmp3,&btmp2,&btmp); + BigNumMul(&btmp,&bu,&btmp2); + Yield; + BigNumLShift(&btmp2,&btmp,1); + BigNumLShift(&btmp2,&btmp3,3); + BigNumAdd(&btmp,&btmp3,&br); + BigNumMul(&bt,&bu,&btmp); + BigNumAssign(&bt,&btmp); + BigNumLShift(&bi,&btmp2,1); + BigNumDec(&btmp2); + Yield; + BigNumLShift(&btmp2,&btmp,1); + BigNumMul(&btmp,&bq,&btmp2); + BigNumMul(&btmp2,&bi,&btmp); + BigNumLShift(&btmp,&btmp2,2); + BigNumAdd(&btmp,&btmp2,&bq); + BigNumInc(&bi); + } + + BigNumFree(&bq); + BigNumFree(&br); + BigNumFree(&bt); + BigNumFree(&bi); + BigNumFree(&bu); + BigNumFree(&by); + BigNumFree(&btmp); + BigNumFree(&btmp2); + BigNumFree(&btmp3); + +} diff --git a/Demo/Math/Pi/PI100.HC b/Demo/Math/Pi/PI100.HC new file mode 100755 index 0000000..db313d2 --- /dev/null +++ b/Demo/Math/Pi/PI100.HC @@ -0,0 +1,29 @@ +#include "/Demo/Math/Pi/BnPiKernel" + +static U8 correct_pi_100[102]={'3','.','1','4','1','5','9','2','6','5','3','5','8','9','7','9','3','2','3','8','4','6','2','6','4','3','3','8','3','2','7','9','5','0','2','8','8','4','1','9','7','1','6','9','3','9','9','3','7','5','1','0','5','8','2','0','9','7','4','9','4','4','5','9','2','3','0','7','8','1','6','4','0','6','2','8','6','2','0','8','9','9','8','6','2','8','0','3','4','8','2','5','3','4','2','1','1','7','0','6','7',0}; + +U0 CalcPi100Test() +{ + Bool passed=TRUE; + I64 digits=100; + U8 digits_out[102]; + F64 start_time=tS; + "Calculating the first 100 digits of PI...\n\n"; + "\nPI ~ "; + Yield; + BnPiKernel(digits, digits_out); + digits_out[101]=0; + "\n\n"; + "Calculation took %1.5f (s)\n\n",tS-start_time; + + "Verifying result..."; + + for (digits=0; digits<101; digits++) + if (digits_out[digits] != correct_pi_100[digits]) passed=FALSE; + + if (passed) "result OK!\n"; + else throw('FAIL'); +} + +CalcPi100Test; +Sleep(500); diff --git a/Demo/Tests/CompilerFix.HC b/Demo/Tests/CompilerFix.HC new file mode 100644 index 0000000..93d5d64 --- /dev/null +++ b/Demo/Tests/CompilerFix.HC @@ -0,0 +1,18 @@ +I64 WorkingAndEqCmp(I64 x) +{ + x&=~1; + return x; +} + +U0 TestAndEqCmp() +{ + if (WorkingAndEqCmp(-200)!=-200) throw('FAIL'); + else + { + "Test passed!\n"; + Sleep(500); + } +} + +TestAndEqCmp; + diff --git a/Doc/Baremetal/Baremetal.DD b/Doc/Baremetal/Baremetal.DD index c074187..43c6d93 100644 --- a/Doc/Baremetal/Baremetal.DD +++ b/Doc/Baremetal/Baremetal.DD @@ -9,13 +9,17 @@ $ID,2$ $LK,"Dell OptiPlex 7010 SFF",A="FI:/Doc/Baremetal/Machines/Desktop/Dell/OptiPlex_7010_SFF/Survey.DD.Z"$ $LK,"Dell OptiPlex 7050 MFF",A="FI:/Doc/Baremetal/Machines/Desktop/Dell/OptiPlex_7050_MFF/Survey.DD.Z"$ $LK,"Dell OptiPlex 7050 SFF",A="FI:/Doc/Baremetal/Machines/Desktop/Dell/OptiPlex_7050_SFF/Survey.DD.Z"$ +$LK,"Dell OptiPlex 755 MT",A="FI:/Doc/Baremetal/Machines/Desktop/Dell/OptiPlex_755_MT/Survey.DD.Z"$ $LK,"Dell OptiPlex 9010 SFF",A="FI:/Doc/Baremetal/Machines/Desktop/Dell/OptiPlex_9010_SFF/Survey.DD.Z"$ +$LK,"Dell OptiPlex 9020 MT * w/PS/2",A="FI:/Doc/Baremetal/Machines/Desktop/Dell/OptiPlex_9020_MT/Survey.DD.Z"$ +$LK,"Dell Precision WorkStation T7400 * w/PS/2",A="FI:/Doc/Baremetal/Machines/Desktop/Dell/Precision_WorkStation_T7400/Survey.DD.Z"$ $LK,"HP Compaq Elite 8300 SFF * w/USB",A="FI:/Doc/Baremetal/Machines/Desktop/HP/Compaq_Elite_8300_SFF/Survey.DD.Z"$ $LK,"Lenovo ThinkCentre M79 * w/PS/2",A="FI:/Doc/Baremetal/Machines/Desktop/Lenovo/ThinkCentre_M79/Survey.DD.Z"$ $ID,-2$ $TR,"Laptops"$ $ID,2$ $LK,"Dell Latitude D630 * w/USB",A="FI:/Doc/Baremetal/Machines/Laptop/Dell/Latitude_D630/Survey.DD.Z"$ +$LK,"HP HP 2000 Notebook PC",A="FI:/Doc/Baremetal/Machines/Laptop/HP/HP_2000_Notebook_PC/Survey.DD.Z"$ $LK,"HP HP ProBook 655 G1",A="FI:/Doc/Baremetal/Machines/Laptop/HP/HP_ProBook_655_G1/Survey.DD.Z"$ $LK,"Lenovo Lenovo IdeaPad Yoga 11S",A="FI:/Doc/Baremetal/Machines/Laptop/Lenovo/Lenovo_IdeaPad_Yoga_11S/Survey.DD.Z"$ $LK,"Lenovo ThinkPad T420 * w/USB",A="FI:/Doc/Baremetal/Machines/Laptop/Lenovo/ThinkPad_T420/Survey.DD.Z"$ diff --git a/Doc/Baremetal/Machines/Desktop/Dell/OptiPlex_755_MT/Survey.DD b/Doc/Baremetal/Machines/Desktop/Dell/OptiPlex_755_MT/Survey.DD new file mode 100644 index 0000000..665eabb --- /dev/null +++ b/Doc/Baremetal/Machines/Desktop/Dell/OptiPlex_755_MT/Survey.DD @@ -0,0 +1,82 @@ +$WW+H,1$Survey and System Results: + +OS: TinkerOS V5.160 07/29/24 04:14:42 + +Current graphics mode: 640 x 480 (640 by 480 framebuffer) + +Current disk mode: AHCI + +Current boot drive: C + +Laptop: No + +Is AHCI mode supported in BIOS: Yes + +Is Legacy/IDE mode supported in BIOS: Yes + +Does PS/2 emulation of USB both keyboard and mouse work in TinkerOS: No + +Does your system have a PS/2 mouse or combo port: Yes + +Does your system have a serial port: Yes + +Does your system have a parallel port: Yes + +Can you install and run TinkerOS bare metal: Yes + +Can you install and run TempleOS bare metal: Yes + +Does PS/2 emulation of USB both keyboard and mouse work in TempleOS: No + +Is this a custom built PC / motherboard you installed: No + +Did the automatic installer work: No + +Did you manually partition and format the drive: Yes + +Did you manually have to enter IO port numbers: No + +Results from SysRepSurvey: + +SMBIOS version 2.5 (80 entries) +$TR-C,"System"$ +$FD,3$$ID,3$Operating system:$FG,0$TinkerOS V5.160$FG$ +Manufacturer:$FG,0$Dell Inc.$FG$ +Product Name:$FG,0$OptiPlex 755 MT $FG$ +Version:$FG,0$None$FG$ +$ID,-3$$TR-C,"Processor"$ +$FD,3$$ID,3$Socket Name:$FG,0$CPU$FG$ +Processor Type:$FG,0$Central Processor$FG$ +Status:$FG,0$Socket Populated, CPU Enabled$FG$ +Core Count:$FG,0$2$FG$ +Cores Enabled:$FG,0$2$FG$ +Manufacturer:$FG,0$Intel$FG$ +Name:$FG,0$None$FG$ +Family:$FG,0$6$FG$ +Model:$FG,0$240$FG$ +Stepping:$FG,0$11$FG$ +Current Speed:$FG,0$2.3 GHz$FG$ +Max Speed:$FG,0$5.2 GHz$FG$ +Socket:$FG,0$LGA775$FG$ +Voltage:$FG,0$1.3V$FG$ +External Clock:$FG,0$1333 MHz$FG$ +$ID,-3$$TR-C,"Memory Array"$ +$FD,3$$ID,3$Location:$FG,0$Motherboard$FG$ +Use:$FG,0$System Memory$FG$ +Error Correction:$FG,0$None$FG$ +Max Capacity:$FG,0$8192 MB$FG$ +Mem Device Count:$FG,0$4$FG$ +$ID,-3$$FD,1$ +Hypervisor present: 0 + +Detected resolution options: + + 848x480 + 1600x1200 + 1280x1024 + 1024x768 + 640x480 + 800x600 + + + diff --git a/Doc/Baremetal/Machines/Desktop/Dell/OptiPlex_9020_MT/Survey.DD b/Doc/Baremetal/Machines/Desktop/Dell/OptiPlex_9020_MT/Survey.DD new file mode 100644 index 0000000..96f9266 --- /dev/null +++ b/Doc/Baremetal/Machines/Desktop/Dell/OptiPlex_9020_MT/Survey.DD @@ -0,0 +1,92 @@ +$WW+H,1$Survey and System Results: + +OS: TinkerOS V5.160 08/07/24 13:40:24 + +Current graphics mode: 640 x 480 (640 by 480 framebuffer) + +Current disk mode: IDE/Legacy + +Current boot drive: D + +Laptop: No + +Is AHCI mode supported in BIOS: Yes + +Is Legacy/IDE mode supported in BIOS: Yes + +Does PS/2 emulation of USB both keyboard and mouse work in TinkerOS: No + +Does your system have a PS/2 mouse or combo port: Yes + +Does your system have a serial port: Yes + +Does your system have a parallel port: No + +Can you install and run TinkerOS bare metal: Yes + +Can you install and run TempleOS bare metal: Yes + +Does PS/2 emulation of USB both keyboard and mouse work in TempleOS: No + +Is this a custom built PC / motherboard you installed: No + +Did the automatic installer work: No + +Did you manually partition and format the drive: Yes + +Did you manually have to enter IO port numbers: No + +Boot drive D IO port info: + +Base 0: 0xf090 +Base 1: 0xf080 +Unit : 0 + +Results from SysRepSurvey: + +SMBIOS version 2.7 (93 entries) +$TR-C,"System"$ +$FD,3$$ID,3$Operating system:$FG,0$TinkerOS V5.160$FG$ +Manufacturer:$FG,0$Dell Inc.$FG$ +Product Name:$FG,0$OptiPlex 9020 MT$FG$ +Version:$FG,0$00$FG$ +$ID,-3$$TR-C,"Processor"$ +$FD,3$$ID,3$Socket Name:$FG,0$SOCKET 0$FG$ +Processor Type:$FG,0$Central Processor$FG$ +Status:$FG,0$Socket Populated, CPU Enabled$FG$ +Core Count:$FG,0$4$FG$ +Cores Enabled:$FG,0$4$FG$ +Manufacturer:$FG,0$Intel$FG$ +Name:$FG,0$Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz$FG$ +Family:$FG,0$6$FG$ +Model:$FG,0$12$FG$ +Stepping:$FG,0$3$FG$ +Current Speed:$FG,0$3.6 GHz$FG$ +Max Speed:$FG,0$3.8 GHz$FG$ +Socket:$FG,0$Other$FG$ +Voltage:$FG,0$1.2V$FG$ +External Clock:$FG,0$100 MHz$FG$ +$ID,-3$$TR-C,"Memory Array"$ +$FD,3$$ID,3$Location:$FG,0$Motherboard$FG$ +Use:$FG,0$System Memory$FG$ +Error Correction:$FG,0$None$FG$ +Max Capacity:$FG,0$32768 MB$FG$ +Mem Device Count:$FG,0$4$FG$ +$ID,-3$$FD,1$ +Hypervisor present: 0 + +Detected resolution options: + + 320x200 + 640x480 + 800x600 + 1024x768 + 1280x1024 + 320x400 + 320x240 + 640x400 + 1920x1080 + 1280x800 + + + diff --git a/Doc/Baremetal/Machines/Desktop/Dell/Precision_WorkStation_T7400/Survey.DD b/Doc/Baremetal/Machines/Desktop/Dell/Precision_WorkStation_T7400/Survey.DD new file mode 100644 index 0000000..e77a3e2 --- /dev/null +++ b/Doc/Baremetal/Machines/Desktop/Dell/Precision_WorkStation_T7400/Survey.DD @@ -0,0 +1,107 @@ +Survey and System Results: + +OS: TinkerOS V5.160 07/29/24 04:14:42 + +Current graphics mode: 640 x 480 (640 by 480 framebuffer) + +Current disk mode: IDE/Legacy + +Current boot drive: C + +Laptop: No + +Is AHCI mode supported in BIOS: Yes + +Is Legacy/IDE mode supported in BIOS: Yes + +Does PS/2 emulation of USB both keyboard and mouse work in TinkerOS: No + +Does your system have a PS/2 mouse or combo port: Yes + +Does your system have a serial port: Yes + +Does your system have a parallel port: Yes + +Can you install and run TinkerOS bare metal: Yes + +Can you install and run TempleOS bare metal: Yes + +Does PS/2 emulation of USB both keyboard and mouse work in TempleOS: No + +Is this a custom built PC / motherboard you installed: No + +Did the automatic installer work: No + +Did you manually partition and format the drive: Yes + +Did you manually have to enter IO port numbers: No + +Boot drive C IO port info: + +Base 0: 0xfe00 +Base 1: 0xfe10 +Unit : 1 + +Results from SysRepSurvey: + +SMBIOS version 2.5 (123 entries) +$TR-C,"System"$ +$FD,3$$ID,3$Operating system:$FG,0$TinkerOS V5.160$FG$ +Manufacturer:$FG,0$Dell Inc.$FG$ +Product Name:$FG,0$Precision WorkStation T7400 $FG$ +Version:$FG,0$None$FG$ +$ID,-3$$TR-C,"Processor"$ +$FD,3$$ID,3$Socket Name:$FG,0$CPU$FG$ +Processor Type:$FG,0$Central Processor$FG$ +Status:$FG,0$Socket Populated, CPU Enabled$FG$ +Core Count:$FG,0$4$FG$ +Cores Enabled:$FG,0$4$FG$ +Manufacturer:$FG,0$Intel$FG$ +Name:$FG,0$None$FG$ +Family:$FG,0$6$FG$ +Model:$FG,0$7$FG$ +Stepping:$FG,0$10$FG$ +Current Speed:$FG,0$2.8 GHz$FG$ +Max Speed:$FG,0$3.8 GHz$FG$ +Socket:$FG,0$LGA771$FG$ +Voltage:$FG,0$1.1V$FG$ +External Clock:$FG,0$1333 MHz$FG$ +$ID,-3$$TR-C,"Processor"$ +$FD,3$$ID,3$Socket Name:$FG,0$CPU$FG$ +Processor Type:$FG,0$Central Processor$FG$ +Status:$FG,0$Socket Populated, CPU Idle, Waiting to be Enabled$FG$ +Core Count:$FG,0$4$FG$ +Cores Enabled:$FG,0$4$FG$ +Manufacturer:$FG,0$Intel$FG$ +Name:$FG,0$None$FG$ +Family:$FG,0$6$FG$ +Model:$FG,0$7$FG$ +Stepping:$FG,0$10$FG$ +Current Speed:$FG,0$2.8 GHz$FG$ +Max Speed:$FG,0$3.8 GHz$FG$ +Socket:$FG,0$LGA771$FG$ +Voltage:$FG,0$1.1V$FG$ +External Clock:$FG,0$1333 MHz$FG$ +$ID,-3$$TR-C,"Memory Array"$ +$FD,3$$ID,3$Location:$FG,0$Motherboard$FG$ +Use:$FG,0$System Memory$FG$ +Error Correction:$FG,0$None$FG$ +Max Capacity:$FG,0$65536 MB$FG$ +Mem Device Count:$FG,0$8$FG$ +$ID,-3$$FD,1$ +Hypervisor present: 0 + +Detected resolution options: + + 320x200 + 640x480 + 800x600 + 1024x768 + 1280x1024 + 320x400 + 320x240 + 640x400 + 1600x1200 + + + \ No newline at end of file diff --git a/Doc/Baremetal/Machines/Laptop/HP/HP_2000_Notebook_PC/Survey.DD b/Doc/Baremetal/Machines/Laptop/HP/HP_2000_Notebook_PC/Survey.DD new file mode 100644 index 0000000..00fd4d9 --- /dev/null +++ b/Doc/Baremetal/Machines/Laptop/HP/HP_2000_Notebook_PC/Survey.DD @@ -0,0 +1,85 @@ +$WW+H,1$Survey and System Results: + +OS: TinkerOS V5.160 08/03/24 08:43:22 + +Current graphics mode: 640 x 480 (640 by 480 framebuffer) + +Current disk mode: AHCI + +Current boot drive: C + +Laptop: Yes + +Dock with useful ports available: No + +Expresscard slot available: No + +Do laptop keyboard and trackpad both work: Yes + +Is AHCI mode supported in BIOS: Yes + +Is Legacy/IDE mode supported in BIOS: No + +Does PS/2 emulation of USB both keyboard and mouse work in TinkerOS: No + +Does your system have a PS/2 mouse or combo port: No + +Does your system have a serial port: No + +Does your system have a parallel port: No + +Can you install and run TinkerOS bare metal: Yes + +Can you install and run TempleOS bare metal: No + +Does PS/2 emulation of USB both keyboard and mouse work in TempleOS: No + +Is this a custom built PC / motherboard you installed: No + +Did the automatic installer work: No + +Did you manually partition and format the drive: Yes + +Did you manually have to enter IO port numbers: No + +Results from SysRepSurvey: + +SMBIOS version 2.6 (33 entries) +$TR-C,"System"$ +$FD,3$$ID,3$Operating system:$FG,0$TinkerOS V5.160$FG$ +Manufacturer:$FG,0$Hewlett-Packard$FG$ +Product Name:$FG,0$HP 2000 Notebook PC $FG$ +Version:$FG,0$0587100000204A10002620100$FG$ +$ID,-3$$TR-C,"Memory Array"$ +$FD,3$$ID,3$Location:$FG,0$Motherboard$FG$ +Use:$FG,0$System Memory$FG$ +Error Correction:$FG,0$None$FG$ +Max Capacity:$FG,0$8192 MB$FG$ +Mem Device Count:$FG,0$2$FG$ +$ID,-3$$TR-C,"Processor"$ +$FD,3$$ID,3$Socket Name:$FG,0$CPU$FG$ +Processor Type:$FG,0$Central Processor$FG$ +Status:$FG,0$Socket Populated, CPU Enabled$FG$ +Core Count:$FG,0$2$FG$ +Cores Enabled:$FG,0$2$FG$ +Manufacturer:$FG,0$Intel(R) Corporation$FG$ +Name:$FG,0$Intel(R) Pentium(R) CPU P6200 @ 2.13GHz$FG$ +Family:$FG,0$6$FG$ +Model:$FG,0$5$FG$ +Stepping:$FG,0$5$FG$ +Current Speed:$FG,0$2.1 GHz$FG$ +Max Speed:$FG,0$2.1 GHz$FG$ +Socket:$FG,0$ZIF Socket$FG$ +Voltage:$FG,0$0.0V$FG$ +External Clock:$FG,0$1066 MHz$FG$ +$ID,-3$$FD,1$ +Hypervisor present: 0 + +Detected resolution options: + + 1024x768 + 640x480 + 800x600 + + + \ No newline at end of file diff --git a/Doc/Start.DD b/Doc/Start.DD index 37214d2..f9706e0 100644 --- a/Doc/Start.DD +++ b/Doc/Start.DD @@ -1,4 +1,4 @@ -$WW+H,1$$FG,5$$TX+CX,"TinkerOS V5.16",D="DD_OS_NAME_VERSION"$$FG$ +$WW+H,1$$FG,5$$TX+CX,"TinkerOS V5.17",D="DD_OS_NAME_VERSION"$$FG$ $TX+CX,"Public Domain Operating System"$ diff --git a/Doc/TinkerOS.DD b/Doc/TinkerOS.DD index 9f57ff1..318abaf 100644 --- a/Doc/TinkerOS.DD +++ b/Doc/TinkerOS.DD @@ -15,11 +15,12 @@ New key shortcuts: Additional Games included: - $FG,4$After Egypt + $FG,4$After Egypt (from Sup1) CF2 (expanded Castle Frankenstein) + Chess (from Sup1, fixed) Cube Oregon Trail - SpyHunt (improved Titanium) + SpyHunt (improved Titanium, doesn't crash) Sudoku Wordle$FG$ diff --git a/Doc/Web.DD b/Doc/Web.DD index 3138e96..4d75065 100644 --- a/Doc/Web.DD +++ b/Doc/Web.DD @@ -1,4 +1,4 @@ -$WW+H,1$$FG,5$$TX+CX,"TinkerOS V5.16",D="DD_OS_NAME_VERSION"$$FG$ +$WW+H,1$$FG,5$$TX+CX,"TinkerOS V5.17",D="DD_OS_NAME_VERSION"$$FG$ $TX+CX,"Public Domain Operating System"$ diff --git a/Kernel/KGlbls.HC b/Kernel/KGlbls.HC index f255c5e..de52306 100644 --- a/Kernel/KGlbls.HC +++ b/Kernel/KGlbls.HC @@ -22,7 +22,7 @@ U8 *rev_bits_table, //Table with U8 bits revd *set_bits_table; //Table with count of set bits in a U8 CDate local_time_offset; F64 *pow10_I64, - sys_os_version=5.160; + sys_os_version=5.170; CAutoCompleteDictGlbls acd; CAutoCompleteGlbls ac; diff --git a/MakeHome.HC b/MakeHome.HC index 1736a4f..908f4c2 100644 --- a/MakeHome.HC +++ b/MakeHome.HC @@ -23,7 +23,7 @@ SethFile("/Adam/AutoComplete/DoACInit",-1); // Misc helper functions U0 AutoHome() { - MountAuto; + MountAuto(1); Cdd("C:/Home"); } diff --git a/Misc/OSTestSuite.HC b/Misc/OSTestSuite.HC index d106538..ff631ed 100644 --- a/Misc/OSTestSuite.HC +++ b/Misc/OSTestSuite.HC @@ -28,7 +28,7 @@ U0 TS(U8 *desc) (PROGRESS_DESC_LEN-StrLen(st))>>1,CH_SPACE,st); Free(st); progress4=ts_i++; - progress4_max=181; + progress4_max=183; progress4_t0=ts_t0; *progress4_desc=0; RegExe("TempleOS/OSTestSuite"); @@ -226,6 +226,20 @@ U0 DoRandDemo() DeathWait(&task,TRUE); } +U0 DoPI100() +{ + CTask *task=User; + XTalkWait(task,"#include \"::/Demo/Math/Pi/PI100\";\n"); + DeathWait(&task,TRUE); +} + +U0 DoCompilerFixCheck() +{ + CTask *task=User; + XTalkWait(task,"#include \"::/Demo/Tests/CompilerFix\";\n"); + DeathWait(&task,TRUE); +} + U0 DoLowPassFilter() { CTask *task=User; @@ -2191,6 +2205,10 @@ U0 OSTestSuite() TS("SysRepLite"); XTalkWait(task,"SysRepLite;Sleep(750);\n"); DeathWait(&task,TRUE); + TS("Calculate digits of PI"); + DoPI100; + TS("Test compiler bugfix"); + DoCompilerFixCheck; ProgressBarsRst("TinkerOS/OSTestSuite"); "Elapsed Time:%5.3f\n" ,tS-ts_t0;