diff --git a/TempleOSCD/0000Boot/0000Kernel.BIN.C b/TempleOSCD/0000Boot/0000Kernel.BIN.C index 9e8947e..d8c9741 100644 Binary files a/TempleOSCD/0000Boot/0000Kernel.BIN.C and b/TempleOSCD/0000Boot/0000Kernel.BIN.C differ diff --git a/TempleOSCD/Adam/ADefine.HC b/TempleOSCD/Adam/ADefine.HC index b75a14c..38b1214 100644 --- a/TempleOSCD/Adam/ADefine.HC +++ b/TempleOSCD/Adam/ADefine.HC @@ -18,7 +18,7 @@ U0 LoadDocDefines() //$LK,"DD_BOOT_HIGH_LOC_DVD",A="FF:::/Adam/Opt/Boot/BootDVD.HC,DD_BOOT_HIGH_LOC_DVD"$ $TR-C,"LineRep"$ -$ID,4$DefinePrint("DD_TEMPLEOS_LOC","120,312"); +$ID,4$DefinePrint("DD_TEMPLEOS_LOC","120,374"); DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","82,012"); $ID,-4$ DefinePrint("DD_MP_VECT","%08X",MP_VECT_ADDR); diff --git a/TempleOSCD/Compiler/Compiler.BIN b/TempleOSCD/Compiler/Compiler.BIN index 064b77e..4c01120 100644 Binary files a/TempleOSCD/Compiler/Compiler.BIN and b/TempleOSCD/Compiler/Compiler.BIN differ diff --git a/TempleOSCD/Compiler/CompilerB.HH b/TempleOSCD/Compiler/CompilerB.HH index e581d65..989e1f4 100644 --- a/TempleOSCD/Compiler/CompilerB.HH +++ b/TempleOSCD/Compiler/CompilerB.HH @@ -61,6 +61,7 @@ public extern I64 MemberMetaData(U8 *st,CMemberLst *ml); public extern CMemberLstMeta *MemberMetaFind(U8 *st,CMemberLst *ml); public extern CHashClass *OptClassFwd(CHashClass *tmpc); public extern I64 PrsKeyWord(CCmpCtrl *cc); + #help_index "Compiler;Cmd Line (Typically)" extern I64 Cmp(U8 *filename, U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0); diff --git a/TempleOSCD/Demo/AcctExample/Registry.HC b/TempleOSCD/Demo/AcctExample/Registry.HC index a2b3725..8747776 100644 --- a/TempleOSCD/Demo/AcctExample/Registry.HC +++ b/TempleOSCD/Demo/AcctExample/Registry.HC @@ -62,7 +62,7 @@ $ID,-2$$TR,"Titanium"$ $ID,2$I64 best_score=16469; $ID,-2$$TR,"TOSRegen"$ $ID,2$progress1_tf=0.000;progress2_tf=0.000; -progress3_tf=0.000;progress4_tf=192.403; +progress3_tf=0.000;progress4_tf=188.159; $ID,-2$$ID,-2$$TR,"Once"$ $ID,2$$TR,"Adam"$ $ID,2$$ID,-2$$TR,"User"$ diff --git a/TempleOSCD/Demo/Graphics/LightTable.HC b/TempleOSCD/Demo/Graphics/LightTable.HC index b623fc0..e2455c1 100644 --- a/TempleOSCD/Demo/Graphics/LightTable.HC +++ b/TempleOSCD/Demo/Graphics/LightTable.HC @@ -1,14 +1,17 @@ class Photon { Photon *next,*last; - CD3 p,v; -} p_root; + CD3 p,v,p_snell_inhibit; +} p_root[mp_cnt]; +I64 p_root_locks; +CTask *animate_tasks[mp_cnt]; CDC *map; F64 ts; +I64 photon_cnt,snell_cnt; U8 *bmp; -F64 bmp_scale; +F64 bmp_scale,bmp_scale_sqr; I64 bmp_mem,bmp_width,bmp_height,bmp_norm_radius; I64 BmpPeek(I64 x,I64 y) @@ -28,21 +31,39 @@ U0 BmpPlot(U8 *bmp,I64 x,I64 y,I64) Bts(bmp,y*bmp_width+x); } +Photon *PhotonNew() +{ + I64 num=photon_cnt++%mp_cnt; + Photon *res=CAlloc(sizeof(Photon)); + while (!LBts(&p_root_locks,num)) + Yield; + QueIns(res,p_root[num].last); + LBtr(&p_root_locks,num); + return res; +} + #define TAIL 20 U0 DrawIt(CTask *,CDC *dc) { + I64 i; Photon *tmpp; GrBlot(dc,0,0,map); dc->color=WHITE; GrPrint(dc,0,0,"Mem:0x%X %,dMeg Scale:%0.3f (%d,%d)-->(%d,%d)", bmp_mem,bmp_mem/1024/1024,bmp_scale, map->width,map->height,bmp_width,bmp_height); - tmpp=p_root.next; - while (tmpp!=&p_root) { - dc->color=LTRED; - GrLine(dc,tmpp->p.x-TAIL*tmpp->v.x,tmpp->p.y-TAIL*tmpp->v.y, - tmpp->p.x,tmpp->p.y); - tmpp=tmpp->next; + GrPrint(dc,0,FONT_HEIGHT,"PhotonCnt:%d SnellCnt:%d",photon_cnt,snell_cnt); + for (i=0;icolor=LTRED; + GrLine(dc,tmpp->p.x-TAIL*tmpp->v.x,tmpp->p.y-TAIL*tmpp->v.y, + tmpp->p.x,tmpp->p.y); + tmpp=tmpp->next; + } + LBtr(&p_root_locks,i); } } @@ -56,23 +77,20 @@ U0 RayBurst(I64 x1,I64 y1,I64 x2,I64 y2) D3Unit(&v); D3Equ(&n,v.y,-v.x); - tmpp=CAlloc(sizeof(Photon)); + tmpp=PhotonNew; D3Copy(&tmpp->p,&p); D3Copy(&tmpp->v,&v); - QueIns(tmpp,p_root.last); for (i=2;i<=9;i+=3) { D3Mul(&n2,i,&n); - tmpp=CAlloc(sizeof(Photon)); + tmpp=PhotonNew; D3Add(&tmpp->p,&p,&n2); D3Copy(&tmpp->v,&v); - QueIns(tmpp,p_root.last); - tmpp=CAlloc(sizeof(Photon)); + tmpp=PhotonNew; D3Sub(&tmpp->p,&p,&n2); D3Copy(&tmpp->v,&v); - QueIns(tmpp,p_root.last); } } @@ -82,27 +100,31 @@ U0 RandomBurst() F64 é; Photon *tmpp; for (i=0;i<256;i++) { - tmpp=CAlloc(sizeof(Photon)); + tmpp=PhotonNew; D3Equ(&tmpp->p,Fs->pix_width*Rand,Fs->pix_height*Rand); é=2*ã*Rand; D3Equ(&tmpp->v,Cos(é),Sin(é)); - QueIns(tmpp,p_root.last); } } -U0 FindNormal(Photon *tmpp,I64 last,I64,CD3 *_normal) +U0 FindNormal(Photon *tmpp,CD3 *_normal) { - CD3 p1,p2,v,s,bmp_p; + CD3 p,p1,p2,v,s; F64 é=Arg(tmpp->v.x,tmpp->v.y),è; - D3Mul(&bmp_p,bmp_scale,&tmpp->p); - while (BmpPeek(bmp_p.x,bmp_p.y)==last) - D3AddEqu(&bmp_p,&tmpp->v); + D3Copy(&tmpp->p_snell_inhibit,&tmpp->p); + D3SubEqu(&tmpp->p,&tmpp->v); + D3Mul(&p,bmp_scale,&tmpp->p); + D3Copy(&p1,&p); + while (BmpPeek(p1.x,p1.y)==BLACK && D3DistSqr(&p,&p1)v); + D3Copy(&p,&p1); + D3Div(&tmpp->p,&p,bmp_scale); for (è=0;è<ã/2;è+=ã/bmp_norm_radius) { D3Equ(&s,Cos(é+ã-ã/4-è),Sin(é+ã-ã/4-è)); D3Mul(&v,bmp_norm_radius,&s); - D3Add(&p1,&bmp_p,&v); + D3Add(&p1,&p,&v); if (BmpPeek(p1.x,p1.y)!=BLACK) break; } @@ -112,7 +134,7 @@ U0 FindNormal(Photon *tmpp,I64 last,I64,CD3 *_normal) for (è=0;è<ã/2;è+=ã/bmp_norm_radius) { D3Equ(&s,Cos(é+ã+ã/4+è),Sin(é+ã+ã/4+è)); D3Mul(&v,bmp_norm_radius,&s); - D3Add(&p2,&bmp_p,&v); + D3Add(&p2,&p,&v); if (BmpPeek(p2.x,p2.y)!=BLACK) break; } @@ -141,7 +163,7 @@ U0 SnellsLaw(Photon *tmpp,I64 last,I64 next) n2=1.5; else n2=1.0; - FindNormal(tmpp,last,next,&normal); + FindNormal(tmpp,&normal); én=Arg(normal.x,normal.y); //dot=m1m2Cos(é); é1=ACos(D3Dot(&normal,&tmpp->v)); @@ -155,43 +177,73 @@ U0 SnellsLaw(Photon *tmpp,I64 last,I64 next) else é=éb; D3Equ(&tmpp->v,Cos(é),Sin(é)); + lock {snell_cnt++;} } U0 AnimateTask(I64) { - Photon *tmpp; + Photon *tmpp,*root=&p_root[Gs->num]; I64 last,next; while (TRUE) { - tmpp=p_root.next; - while (tmpp!=&p_root) { + while (!LBts(&p_root_locks,Gs->num)) + Yield; + tmpp=root->next; + while (tmpp!=root) { last=GrPeek(map,tmpp->p.x,tmpp->p.y); D3AddEqu(&tmpp->p,&tmpp->v); - if (tmpp->p.x<=0) tmpp->v.x=-tmpp->v.x; - if (tmpp->p.x>=map->width) tmpp->v.x=-tmpp->v.x; - if (tmpp->p.y<=0) tmpp->v.y=-tmpp->v.y; - if (tmpp->p.y>=map->height) tmpp->v.y=-tmpp->v.y; + if (tmpp->p.x<0) { + tmpp->p.x=-tmpp->p.x; + tmpp->v.x=-tmpp->v.x; + } + if (tmpp->p.x>=map->width) { + tmpp->p.x-=tmpp->p.x-map->width; + tmpp->v.x=-tmpp->v.x; + } + if (tmpp->p.y<0) { + tmpp->p.y=-tmpp->p.y; + tmpp->v.y=-tmpp->v.y; + } + if (tmpp->p.y>=map->height) { + tmpp->p.y-=tmpp->p.y-map->height; + tmpp->v.y=-tmpp->v.y; + } next=GrPeek(map,tmpp->p.x,tmpp->p.y); - if (last!=next && - (last==BLACK && next==WHITE) || (last==WHITE && next==BLACK)) + if (last!=next && (last==BLACK && next==WHITE) || + (last==WHITE && next==BLACK) && + D3DistSqr(&tmpp->p_snell_inhibit,&tmpp->p)>=4.0) SnellsLaw(tmpp,last,next); tmpp=tmpp->next; } - Sleep(1000*ts); + LBtr(&p_root_locks,Gs->num); + if (ts) + Sleep(1000*ts); + else { + Yield; + Yield; //Give a more time unlocked. + } } } U0 Init() { + I64 i; ts=0.01; + photon_cnt=snell_cnt=0; map=DCNew(Fs->pix_width,Fs->pix_height); - QueInit(&p_root); - //x*y=bmp_mem*8 + for (i=0;ipix_height/Fs->pix_width)/Fs->pix_height; + bmp_scale_sqr=Sqr(bmp_scale); bmp_width =bmp_scale*Fs->pix_width; bmp_height=bmp_scale*Fs->pix_height; bmp=CAlloc(bmp_width*bmp_height/8); @@ -200,7 +252,13 @@ U0 Init() U0 CleanUp() { - QueDel(&p_root,TRUE); + I64 i; + for (i=0;idraw_it=&DrawIt; - Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs); + for (i=0;i