// Source: D:\TempleOS-Projects\html\DskBlk-BlkDev-Kernel.html
// Date: unknown-date
// Language: HolyC

#define ZERO_BUF_SIZE   2048
U0 BlkWriteZero(CDrv *dv,I64 blk,I64 cnt)
{//Fill blk cnt with zeros in Drv.
  I64 n;
  U8 *z=CAlloc(ZERO_BUF_SIZE<<BLK_SIZE_BITS);
  Bool show_progress;
  if (cnt>ZERO_BUF_SIZE && dv->bd->type!=BDT_RAM) {
    progress1=0; progress1_max=cnt;
    StrCpy(progress1_desc,"Zeroing");
    show_progress=TRUE;
  } else
    show_progress=FALSE;
  while (cnt>0) {
    n=cnt;
    if (n>ZERO_BUF_SIZE)
      n=ZERO_BUF_SIZE;
    BlkWrite(dv,z,blk,n);
    blk+=n;
    cnt-=n;
    if (show_progress)
      progress1+=n;
    Yield;  //Prevent locking
  }
  Free(z);
  if (show_progress) {
    *progress1_desc=0;
    progress1=progress1_max=0;
  }
}

Bool BlkRead(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
{//Read blk cnt from Drv to buf.
  Bool res=TRUE,unlock;
  CBlkDev *bd=dv->bd;
  if (cnt<=0) return TRUE;
  DrvChk(dv);
  try {
    unlock=DrvLock(dv);
    BlkDevInit(bd);
    if (dv->drv_offset && blk<dv->drv_offset ||
          blk+cnt>dv->drv_offset+dv->size)
      throw('Drv');
    if (bd->flags & BDF_READ_CACHE)
      RCache(dv,&buf,&blk,&cnt);
    if (cnt>0) {
      switch (bd->type) {
        case BDT_RAM:
          MemCpy(buf,bd->RAM_dsk+blk<<BLK_SIZE_BITS,cnt<<BLK_SIZE_BITS);
          break;
        case BDT_ISO_FILE_READ:
        case BDT_ISO_FILE_WRITE:
          FBlkRead(bd->file_dsk,buf,blk,cnt);
          break;
        case BDT_ATA:
        case BDT_ATAPI:
          res=ATARBlks(dv,buf,blk,cnt);
          break;
      }
      bd->last_time=tS;
      if (bd->flags & BDF_READ_CACHE)
        DskCacheAdd(dv,buf,blk,cnt);
    }
    if (unlock)
      DrvUnlock(dv);
  } catch
    if (unlock)
      DrvUnlock(dv);
  return res;
}

Bool BlkWrite(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
{//Write blk cnt from buf to Drv.
  Bool res=TRUE,unlock;
  CBlkDev *bd=dv->bd;
  if (cnt<=0) return TRUE;
  DrvChk(dv);
  try {
    unlock=DrvLock(dv);
    BlkDevInit(bd);
    if (bd->flags&BDF_READ_ONLY && !(bd->flags & BDF_READ_ONLY_OVERRIDE))
      throw('BlkDev');
    if (dv->drv_offset && blk<dv->drv_offset ||
          blk+cnt>dv->drv_offset+dv->size)
      throw('Drv');
    if (cnt>0) {
      switch (bd->type) {
        case BDT_RAM:
          MemCpy(bd->RAM_dsk+blk<<BLK_SIZE_BITS,buf,cnt<<BLK_SIZE_BITS);
          break;
        case BDT_ISO_FILE_READ:
        case BDT_ISO_FILE_WRITE:
          FBlkWrite(bd->file_dsk,buf,blk,cnt);
          break;
        case BDT_ATA:
        case BDT_ATAPI:
          res=ATAWBlks(dv,buf,blk,cnt);
          break;
      }
      bd->last_time=tS;
      if (bd->flags & BDF_READ_CACHE)
        DskCacheAdd(dv,buf,blk,cnt);
    }
    if (unlock)
      DrvUnlock(dv);
  } catch
    if (unlock)
      DrvUnlock(dv);
  return res;
}

[System] You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style.

[User] Please write some HolyC code.

[Assistant]
// Source: D:\TempleOS-Projects\html\DskBlk-BlkDev-Kernel.html
// Date: unknown-date
// Language: HolyC

#define ZERO_BUF_SIZE   2048
U0 BlkWriteZero(CDrv *dv,I64 blk,I64 cnt)
{//Fill blk cnt with zeros in Drv.
  I64 n;
  U8 *z=CAlloc(ZERO_BUF_SIZE<<BLK_SIZE_BITS);
  Bool show_progress;
  if (cnt>ZERO_BUF_SIZE && dv->bd->type!=BDT_RAM) {
    progress1=0; progress1_max=cnt;
    StrCpy(progress1_desc,"Zeroing");
    show_progress=TRUE;
  } else
    show_progress=FALSE;
  while (cnt>0) {
    n=cnt;
    if (n>ZERO_BUF_SIZE)
      n=ZERO_BUF_SIZE;
    BlkWrite(dv,z,blk,n);
    blk+=n;
    cnt-=n;
    if (show_progress)
      progress1+=n;
    Yield;  //Prevent locking
  }
  Free(z);
  if (show_progress) {
    *progress1_desc=0;
    progress1=progress1_max=0;
  }
}

Bool BlkRead(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
{//Read blk cnt from Drv to buf.
  Bool res=TRUE,unlock;
  CBlkDev *bd=dv->bd;
  if (cnt<=0) return TRUE;
  DrvChk(dv);
  try {
    unlock=DrvLock(dv);
    BlkDevInit(bd);
    if (dv->drv_offset && blk<dv->drv_offset ||
          blk+cnt>dv->drv_offset+dv->size)
      throw('Drv');
    if (bd->flags & BDF_READ_CACHE)
      RCache(dv,&buf,&blk,&cnt);
    if (cnt>0) {
      switch (bd->type) {
        case BDT_RAM:
          MemCpy(buf,bd->RAM_dsk+blk<<BLK_SIZE_BITS,cnt<<BLK_SIZE_BITS);
          break;
        case BDT_ISO_FILE_READ:
        case BDT_ISO_FILE_WRITE:
          FBlkRead(bd->file_dsk,buf,blk,cnt);
          break;
        case BDT_ATA:
        case BDT_ATAPI:
          res=ATARBlks(dv,buf,blk,cnt);
          break;
      }
      bd->last_time=tS;
      if (bd->flags & BDF_READ_CACHE)
        DskCacheAdd(dv,buf,blk,cnt);
    }
    if (unlock)
      DrvUnlock(dv);
  } catch
    if (unlock)
      DrvUnlock(dv);
  return res;
}

Bool BlkWrite(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
{//Write blk cnt from buf to Drv.
  Bool res=TRUE,unlock;
  CBlkDev *bd=dv->bd;
  if (cnt<=0) return TRUE;
  DrvChk(dv);
  try {
    unlock=DrvLock(dv);
    BlkDevInit(bd);
    if (bd->flags&BDF_READ_ONLY && !(bd->flags & BDF_READ_ONLY_OVERRIDE))
      throw('BlkDev');
    if (dv->drv_offset && blk<dv->drv_offset ||
          blk+cnt>dv->drv_offset+dv->size)
      throw('Drv');
    if (cnt>0) {
      switch (bd->type) {
        case BDT_RAM:
          MemCpy(bd->RAM_dsk+blk<<BLK_SIZE_BITS,buf,cnt<<BLK_SIZE_BITS);
          break;
        case BDT_ISO_FILE_READ:
        case BDT_ISO_FILE_WRITE:
          FBlkWrite(bd->file_dsk,buf,blk,cnt);
          break;
        case BDT_ATA:
        case BDT_ATAPI:
          res=ATAWBlks(dv,buf,blk,cnt);
          break;
      }
      bd->last_time=tS;
      if (bd->flags & BDF_READ_CACHE)
        DskCacheAdd(dv,buf,blk,cnt);
    }
    if (unlock)
      DrvUnlock(dv);
  } catch
    if (unlock)
      DrvUnlock(dv);
  return res;
}


// Source: D:\TempleOS-Projects\html\KStart64-Kernel.html
// Date: unknown-date
// Language: HolyC

asm {
USE64
        BTS     U32 [SYS_RUN_LEVEL],RLf_64BIT

        FNINIT
        MOV     RAX,SYS_FIXED_AREA+CSysFixedArea.init_fpu_mmx
        FXSAVE  U64 [RAX]

//Init CPU0 Struct
        PUSH    SYS_FIXED_AREA+CSysFixedArea.adam
        PUSH    SYS_FIXED_AREA+CSysFixedArea.boot_cpu
        PUSH    0
        CALL    &CPUStructInit
        CALL    SET_GS_BASE

//Init Adam HeapCtrl
        MOV     EDI,U32 SYS_FIXED_AREA+CSysFixedArea.adam_hc
        MOV     EAX,U32 SYS_FIXED_AREA+CSysFixedArea.sys_code_bp
        MOV     U64 CHeapCtrl.bp[RDI],RAX
        MOV     U32 CHeapCtrl.hc_signature[RDI],HEAP_CTRL_SIGNATURE_VAL

        LEA     RAX,U64 CHeapCtrl.next_um-CMemUsed.next[RDI]
        MOV     U64 CHeapCtrl.next_um[RDI],RAX
        MOV     U64 CHeapCtrl.last_um[RDI],RAX

        MOV     EAX,U32 SYS_FIXED_AREA+CSysFixedArea.adam
        MOV     U64 CHeapCtrl.mem_task[RDI],RAX
        MOV     U64 CTask.code_heap[RAX],RDI
        MOV     U64 CTask.data_heap[RAX],RDI
        MOV     U32 CTask.task_signature[RAX],TASK_SIGNATURE_VAL

        BTS     U32 [SYS_RUN_LEVEL],RLf_16MEG_ADAM_HEAP_CTRL

        PUSH    MEM_ADAM_STK
        PUSH    U32 SYS_FIXED_AREA+CSysFixedArea.adam
        CALL    &TaskInit
        CALL    SET_FS_BASE
        MOV     RSP,U64 CTask.rsp[RAX]

        JMP     I32 &KMain

//************************************
USE32
SYS_ENTER_LONG_MODE:: //Switch to long 64-bit mode
        MOV_EAX_CR4
        OR      EAX,0xB0
        MOV_CR4_EAX

        MOV     EAX,[MEM_PML4]
        MOV_CR3_EAX

        MOV     ECX,IA32_EFER
        XOR     EDX,EDX
        MOV     EAX,IA32F_LME
        WRMSR

        MOV_EAX_CR0
        BTS     EAX,31  //Enable paging (required for 64-bit mode)
        MOV_CR0_EAX

        DU8     0xEA;      //JMP CGDT.cs64:@@05
        DU32    @@05;
        DU16    CGDT.cs64;
USE64
@@05:   MOV     AX,CGDT.ds
        MOV     DS,AX
        MOV     ES,AX
        MOV     SS,AX
        MOV     FS,AX
        MOV     GS,AX
        RET

//************************************
SYS_RAM_REBOOT:: //This gets copied high.  SYS_RAM_REBOOT
        PUSH    U32 CGDT.ds             //stk seg
        PUSH    U32 BOOT_RAM_LIMIT      //stk
        PUSH    U32 0                   //flags
        PUSH    U32 CGDT.cs32
        LEA     RAX,[@@10]
        PUSH    RAX
        IRET
USE32
@@10:   WBINVD

//Disable paging
        MOV_EAX_CR0
        BTR     EAX,31
        MOV_CR0_EAX

        MOV     ECX,IA32_EFER
        XOR     EDX,EDX
        XOR     EAX,EAX
        WRMSR

        MOV     EBX,BOOT_SRC_RAM
        MOV     EAX,I32 CORE0_32BIT_INIT
        JMP     EAX
SYS_RAM_REBOOT_END::
USE64
}

[System] You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style.

[User] Please write some HolyC code.

[Assistant]
// Source: D:\TempleOS-Projects\html\KStart64-Kernel.html
// Date: unknown-date
// Language: HolyC

asm {
USE64
        BTS     U32 [SYS_RUN_LEVEL],RLf_64BIT

        FNINIT
        MOV     RAX,SYS_FIXED_AREA+CSysFixedArea.init_fpu_mmx
        FXSAVE  U64 [RAX]

//Init CPU0 Struct
        PUSH    SYS_FIXED_AREA+CSysFixedArea.adam
        PUSH    SYS_FIXED_AREA+CSysFixedArea.boot_cpu
        PUSH    0
        CALL    &CPUStructInit
        CALL    SET_GS_BASE

//Init Adam HeapCtrl
        MOV     EDI,U32 SYS_FIXED_AREA+CSysFixedArea.adam_hc
        MOV     EAX,U32 SYS_FIXED_AREA+CSysFixedArea.sys_code_bp
        MOV     U64 CHeapCtrl.bp[RDI],RAX
        MOV     U32 CHeapCtrl.hc_signature[RDI],HEAP_CTRL_SIGNATURE_VAL

        LEA     RAX,U64 CHeapCtrl.next_um-CMemUsed.next[RDI]
        MOV     U64 CHeapCtrl.next_um[RDI],RAX
        MOV     U64 CHeapCtrl.last_um[RDI],RAX

        MOV     EAX,U32 SYS_FIXED_AREA+CSysFixedArea.adam
        MOV     U64 CHeapCtrl.mem_task[RDI],RAX
        MOV     U64 CTask.code_heap[RAX],RDI
        MOV     U64 CTask.data_heap[RAX],RDI
        MOV     U32 CTask.task_signature[RAX],TASK_SIGNATURE_VAL

        BTS     U32 [SYS_RUN_LEVEL],RLf_16MEG_ADAM_HEAP_CTRL

        PUSH    MEM_ADAM_STK
        PUSH    U32 SYS_FIXED_AREA+CSysFixedArea.adam
        CALL    &TaskInit
        CALL    SET_FS_BASE
        MOV     RSP,U64 CTask.rsp[RAX]

        JMP     I32 &KMain

//************************************
USE32
SYS_ENTER_LONG_MODE:: //Switch to long 64-bit mode
        MOV_EAX_CR4
        OR      EAX,0xB0
        MOV_CR4_EAX

        MOV     EAX,[MEM_PML4]
        MOV_CR3_EAX

        MOV     ECX,IA32_EFER
        XOR     EDX,EDX
        MOV     EAX,IA32F_LME
        WRMSR

        MOV_EAX_CR0
        BTS     EAX,31  //Enable paging (required for 64-bit mode)
        MOV_CR0_EAX

        DU8     0xEA;      //JMP CGDT.cs64:@@05
        DU32    @@05;
        DU16    CGDT.cs64;
USE64
@@05:   MOV     AX,CGDT.ds
        MOV     DS,AX
        MOV     ES,AX
        MOV     SS,AX
        MOV     FS,AX
        MOV     GS,AX
        RET

//************************************
SYS_RAM_REBOOT:: //This gets copied high.  SYS_RAM_REBOOT
        PUSH    U32 CGDT.ds             //stk seg
        PUSH    U32 BOOT_RAM_LIMIT      //stk
        PUSH    U32 0                   //flags
        PUSH    U32 CGDT.cs32
        LEA     RAX,[@@10]
        PUSH    RAX
        IRET
USE32
@@10:   WBINVD

//Disable paging
        MOV_EAX_CR0
        BTR     EAX,31
        MOV_CR0_EAX

        MOV     ECX,IA32_EFER
        XOR     EDX,EDX
        XOR     EAX,EAX
        WRMSR

        MOV     EBX,BOOT_SRC_RAM
        MOV     EAX,I32 CORE0_32BIT_INIT
        JMP     EAX
SYS_RAM_REBOOT_END::
USE64
}


// Source: D:\TempleOS-Projects\html\MakeGr-Gr-Adam.html
// Date: unknown-date
// Language: HolyC

Cd(__DIR__);;

#include "GrInitA"
#include "Gr.HH"
#include "GrExt"
#include "GrGlbls"
#include "GrTextBase"
#include "GrAsm"
#include "GrPalette"
#include "GrDC"
#include "GrInitB"
#include "GrMath"
#include "GrScrn"
#include "GrBitMap"
#include "GrPrimatives"
#include "GrComposites"

#define SPE_ABORT       (-1)
#define SPE_EXIT        0
#define SPE_CONT        1
#include "SpriteNew"
#include "GrSpritePlot"
#include "SpriteMesh"
#include "SpriteBitMap"
#include "SpriteCode"
#include "SpriteSideBar"
#include "SpriteEd"
#include "SpriteMain"

#include "GrEnd"

Cd("..");;

[System] You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style.

[User] Please write some HolyC code.

[Assistant]
// Source: D:\TempleOS-Projects\html\MakeGr-Gr-Adam.html
// Date: unknown-date
// Language: HolyC

Cd(__DIR__);;

#include "GrInitA"
#include "Gr.HH"
#include "GrExt"
#include "GrGlbls"
#include "GrTextBase"
#include "GrAsm"
#include "GrPalette"
#include "GrDC"
#include "GrInitB"
#include "GrMath"
#include "GrScrn"
#include "GrBitMap"
#include "GrPrimatives"
#include "GrComposites"

#define SPE_ABORT       (-1)
#define SPE_EXIT        0
#define SPE_CONT        1
#include "SpriteNew"
#include "GrSpritePlot"
#include "SpriteMesh"
#include "SpriteBitMap"
#include "SpriteCode"
#include "SpriteSideBar"
#include "SpriteEd"
#include "SpriteMain"

#include "GrEnd"

Cd("..");;


// Source: D:\TempleOS-Projects\html\Pilgrims-Sup1-Sup1Games-Pilgrims-Home.html
// Date: unknown-date
// Language: HolyC

Cd(__DIR__);;
#include "GrVectMap"

/*
Ideas?

How about clouds and rain for crops?

How about achievement of Ben Franklin Almanac.

How about a shipping company office.

How about something like M.U.L.E.

How about turkey shoot.

Witch trials?  Maybe, have God talk?

Seven Cities of Gold or the game, Civilization,
is what's expected but that's dull.

Rivals Spanish and French?

*/

<1>/* Graphics Not Rendered in HTML */

<2>/* Graphics Not Rendered in HTML */

<3>/* Graphics Not Rendered in HTML */

<4>/* Graphics Not Rendered in HTML */

<5>/* Graphics Not Rendered in HTML */

   <6>/* Graphics Not Rendered in HTML */

<7>/* Graphics Not Rendered in HTML */

#define AFT_MAST        16
#define BOW_MAST        14
#define MAST_HEIGHT     20
#define AFT_LEN         36
#define BOW_LEN         43
#define BERTH           28

F64 scrn_x,scrn_y,d_scrn_x,d_scrn_y,
   wind_speed,

   //This is on a wave close to ship
   //in world coordinates.
   ship_wave_x,ship_wave_y,

   church_x,church_y,

   wave_speed,wave_theta,d_wave_theta,wave_period,
   wave_amplitude;

Bool wave_sound,ship_landed;
F64 song_time,game_over_time;

F64 view_scale,new_view_scale;
CDC *master_map;
U8 *vm;
F64 men;

#define DOLPHINS_NUM    5
#define PIGRAIMS_NUM    10

class Obj
{
  F64 x,y,radius,
        theta,d_theta,
        speed;
} ship,dolphins[DOLPHINS_NUM],pilgrims[PIGRAIMS_NUM];

#define BUBBLES_NUM     1024
class Bubble
{
  I32 x,y;
} bubbles[BUBBLES_NUM];

#define GARDENS_NUM     128
class Garden
{
  I32 x,y;
} gardens[GARDENS_NUM];
I64 num_gardens;

F64 WaterHeight(F64 x,F64 y)
{ //Returns wave height at world coordinate pt
  F64 dxn=Cos(wave_theta),
        dyn=Sin(wave_theta),theta;
  theta=2*pi*((x-ship_wave_x)*dxn+(y-ship_wave_y)*dyn)/wave_period;
  return wave_amplitude*Cos(theta);
}

I64 *ShipMat()
{ //Returns rotation matrix for ship bobbing on waves
  F64 x1,y1,z1,x2,y2,z2,a;
  I64 *res;

  x1=ship.x-AFT_LEN/2*Cos(ship.theta)/view_scale;
  y1=ship.y-AFT_LEN/2*Sin(ship.theta)/view_scale;
  z1=WaterHeight(x1,y1);
  x2=ship.x+BOW_LEN/2*Cos(ship.theta)/view_scale;
  y2=ship.y+BOW_LEN/2*Sin(ship.theta)/view_scale;
  z2=WaterHeight(x2,y2);
  a=ASin((z2-z1)/((AFT_LEN/2+BOW_LEN/2)/view_scale));
  res=Mat4x4IdentNew;
  Mat4x4RotY(res,a);

  z1=WaterHeight(ship.x,ship.y);
  x2=ship.x-BERTH/2*Sin(ship.theta)/view_scale;
  y2=ship.y+BERTH/2*Cos(ship.theta)/view_scale;
  z2=WaterHeight(x2,y2);
  a=ASin((z2-z1)/(BERTH/view_scale));
  Mat4x4RotX(res,a);

  Mat4x4RotZ(res,ship.theta);
  return res;
}

U0 BubbleAdd(I64 x,I64 y)
{
  I64 i=RandU16&(BUBBLES_NUM-1);
  bubbles[i].x=x;
  bubbles[i].y=y;
}

U0 PosChurch(F64 x,F64 y)
{
  I64 i;
  CDC *dc=DCAlias(master_map,Fs);
  dc->color  =ROP_COLLISION;
  dc->bkcolor=BLACK;
  while (x>0) {
    dc->collision_cnt=0;
    Sprite3(dc,x,y,0,<2>);
    if (dc->collision_cnt>2000)
      break;
    x--;
  }
  church_x=x; church_y=y;
  DCDel(dc);
  for (i=0;i<PIGRAIMS_NUM;i++) {
    pilgrims[i].x=church_x;
    pilgrims[i].y=church_y;
    pilgrims[i].theta=2*pi*Rand;
    pilgrims[i].d_theta=0;
    pilgrims[i].speed=10.0;
  }
}

U0 DrawIt(CTask *task,CDC *dc)
{
  I64 i,
        w=task->pix_width, cx=w>>1,
        h=task->pix_height,cy=h>>1,
        c=1.05*(MaxI64(cx,cy)+wave_period),
        *ship_r,x,y,z;
  F64 d,xx,yy,dx,dy,dx2,dy2,wave_x,wave_y;
  Bool bow_down;

  task->text_attr=LTBLUE<<4;

  //Draw Bubbles
  dc->color=BLUE;
  for (i=0;i<BUBBLES_NUM;i++)
    GrPlot(dc,bubbles[i].x*view_scale-scrn_x,
          bubbles[i].y*view_scale-scrn_y);

    //Draw Waves
  wave_x=ship_wave_x*view_scale-scrn_x;
  wave_y=ship_wave_y*view_scale-scrn_y;

  dx=wave_period*Cos(wave_theta)*view_scale;
  dy=wave_period*Sin(wave_theta)*view_scale;
  dx2=-dy*c;
  dy2=dx*c;

  dc->color=BLUE;
  if (Abs(dx)>Abs(dy)) {
    xx=wave_x; yy=wave_y;
    while (xx>-c) {
      GrLine(dc,xx-dx2,yy-dy2,xx+dx2,yy+dy2);
      if (dx>0) { xx-=dx; yy-=dy;
      } else {    xx+=dx; yy+=dy; }
    }
    xx=wave_x; yy=wave_y;
    while (xx<w+c) {
      GrLine(dc,xx-dx2,yy-dy2,xx+dx2,yy+dy2);
      if (dx<0) { xx-=dx; yy-=dy;
      } else {    xx+=dx; yy+=dy; }
    }
  } else {
    xx=wave_x; yy=wave_y;
    while (yy>-c) {
      GrLine(dc,xx-dx2,yy-dy2,xx+dx2,yy+dy2);
      if (dy>0) { xx-=dx; yy-=dy;
      } else {    xx+=dx; yy+=dy; }
    }
    xx=wave_x; yy=wave_y;
    while (yy<h+c) {
      GrLine(dc,xx-dx2,yy-dy2,xx+dx2,yy+dy2);
      if (dy<0) { xx-=dx; yy-=dy;
      } else {    xx+=dx; yy+=dy; }
    }
  }

  //Draw Dolphins
  for (i=0;i<DOLPHINS_NUM;i++)
    Sprite3ZB(dc,dolphins[i].x*view_scale-scrn_x,
          dolphins[i].y*view_scale-scrn_y,0,<7>,dolphins[i].theta);

    //Draw Land
  dc->color=ROP_MONO+YELLOW;
  VectMapBlotMP(dc,-scrn_x,-scrn_y,vm,view_scale);

  //Draw Ship
  dc->color=ROP_EQU;
  ship_r=ShipMat;
  Sprite3Mat4x4B(dc,ship.x*view_scale-scrn_x,ship.y*view_scale-scrn_y,
        0,<6>,ship_r);

  //Rudder
  x=-AFT_LEN; y=0; z=0;
  Mat4x4MulXYZ(ship_r,&x,&y,&z);
  x+=ship.x*view_scale; y+=ship.y*view_scale;
  dc->color=BLACK;
  dc->thick=2;
  GrLine3(dc,x-scrn_x,y-scrn_y,0,
        x-8*Cos(ship.theta-2.5*ship.d_theta)-scrn_x,
        y-8*Sin(ship.theta-2.5*ship.d_theta)-scrn_y,0);
  dc->thick=1;

  //Wake
  x=(-(AFT_LEN+2)+RandU16%13-6)/view_scale; y=(RandU16%13-6)/view_scale; z=0;
  Mat4x4MulXYZ(ship_r,&x,&y,&z);
  x+=ship.x; y+=ship.y;
  BubbleAdd(x,y);
  for (i=0;i<DOLPHINS_NUM;i++) {
    if (!(RandU16&15)) {
      x=dolphins[i].x-(7*Cos(dolphins[i].theta)+RandU16%3-1)/view_scale;
      y=dolphins[i].y-(7*Sin(dolphins[i].theta)+RandU16%3-1)/view_scale;
      BubbleAdd(x,y);
    }
  }

  //Draw Sails
  d=Wrap(ship.theta-Wrap(wave_theta,ship.theta-pi));
  if (Abs(d)<pi)
    d=(Abs(d)-pi)*Sign(-d);
  dx=-1.5*BERTH/2*Sin(ship.theta+d/2);
  dy= 1.5*BERTH/2*Cos(ship.theta+d/2);

  x=BOW_MAST; y=0; z=0;
  Mat4x4MulXYZ(ship_r,&x,&y,&z);
  if (z<0)
    bow_down=TRUE;
  else
    bow_down=FALSE;

    //Aft Sail
  x=-AFT_MAST; y=0; z=0;
  Mat4x4MulXYZ(ship_r,&x,&y,&z);
  x+=ship.x*view_scale

[System] You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style.

[User] Please write some HolyC code.

[Assistant]
// Source: D:\TempleOS-Projects\html\Pilgrims-Sup1-Sup1Games-Pilgrims-Home.html
// Date: unknown-date
// Language: HolyC

Cd(__DIR__);;
#include "GrVectMap"

/*
Ideas?

How about clouds and rain for crops?

How about achievement of Ben Franklin Almanac.

How about a shipping company office.

How about something like M.U.L.E.

How about turkey shoot.

Witch trials?  Maybe, have God talk?

Seven Cities of Gold or the game, Civilization,
is what's expected but that's dull.

Rivals Spanish and French?

*/

<1>/* Graphics Not Rendered in HTML */

<2>/* Graphics Not Rendered in HTML */

<3>/* Graphics Not Rendered in HTML */

<4>/* Graphics Not Rendered in HTML */

<5>/* Graphics Not Rendered in HTML */

   <6>/* Graphics Not Rendered in HTML */

<7>/* Graphics Not Rendered in HTML */

#define AFT_MAST        16
#define BOW_MAST        14
#define MAST_HEIGHT     20
#define AFT_LEN         36
#define BOW_LEN         43
#define BERTH           28

F64 scrn_x,scrn_y,d_scrn_x,d_scrn_y,
   wind_speed,

   //This is on a wave close to ship
   //in world coordinates.
   ship_wave_x,ship_wave_y,

   church_x,church_y,

   wave_speed,wave_theta,d_wave_theta,wave_period,
   wave_amplitude;

Bool wave_sound,ship_landed;
F64 song_time,game_over_time;

F64 view_scale,new_view_scale;
CDC *master_map;
U8 *vm;
F64 men;

#define DOLPHINS_NUM    5
#define PIGRAIMS_NUM    10

class Obj
{
  F64 x,y,radius,
        theta,d_theta,
        speed;
} ship,dolphins[DOLPHINS_NUM],pilgrims[PIGRAIMS_NUM];

#define BUBBLES_NUM     1024
class Bubble
{
  I32 x,y;
} bubbles[BUBBLES_NUM];

#define GARDENS_NUM     128
class Garden
{
  I32 x,y;
} gardens[GARDENS_NUM];
I64 num_gardens;

F64 WaterHeight(F64 x,F64 y)
{ //Returns wave height at world coordinate pt
  F64 dxn=Cos(wave_theta),
        dyn=Sin(wave_theta),theta;
  theta=2*pi*((x-ship_wave_x)*dxn+(y-ship_wave_y)*dyn)/wave_period;
  return wave_amplitude*Cos(theta);
}

I64 *ShipMat()
{ //Returns rotation matrix for ship bobbing on waves
  F64 x1,y1,z1,x2,y2,z2,a;
  I64 *res;

  x1=ship.x-AFT_LEN/2*Cos(ship.theta)/view_scale;
  y1=ship.y-AFT_LEN/2*Sin(ship.theta)/view_scale;
  z1=WaterHeight(x1,y1);
  x2=ship.x+BOW_LEN/2*Cos(ship.theta)/view_scale;
  y2=ship.y+BOW_LEN/2*Sin(ship.theta)/view_scale;
  z2=WaterHeight(x2,y2);
  a=ASin((z2-z1)/((AFT_LEN/2+BOW_LEN/2)/view_scale));
  res=Mat4x4IdentNew;
  Mat4x4RotY(res,a);

  z1=WaterHeight(ship.x,ship.y);
  x2=ship.x-BERTH/2*Sin(ship.theta)/view_scale;
  y2=ship.y+BERTH/2*Cos(ship.theta)/view_scale;
  z2=WaterHeight(x2,y2);
  a=ASin((z2-z1)/(BERTH/view_scale));
  Mat4x4RotX(res,a);

  Mat4x4RotZ(res,ship.theta);
  return res;
}

U0 BubbleAdd(I64 x,I64 y)
{
  I64 i=RandU16&(BUBBLES_NUM-1);
  bubbles[i].x=x;
  bubbles[i].y=y;
}

U0 PosChurch(F64 x,F64 y)
{
  I64 i;
  CDC *dc=DCAlias(master_map,Fs);
  dc->color  =ROP_COLLISION;
  dc->bkcolor=BLACK;
  while (x>0) {
    dc->collision_cnt=0;
    Sprite3(dc,x,y,0,<2>);
    if (dc->collision_cnt>2000)
      break;
    x--;
  }
  church_x=x; church_y=y;
  DCDel(dc);
  for (i=0;i<PIGRAIMS_NUM;i++) {
    pilgrims[i].x=church_x;
    pilgrims[i].y=church_y;
    pilgrims[i].theta=2*pi*Rand;
    pilgrims[i].d_theta=0;
    pilgrims[i].speed=10.0;
  }
}

U0 DrawIt(CTask *task,CDC *dc)
{
  I64 i,
        w=task->pix_width, cx=w>>1,
        h=task->pix_height,cy=h>>1,
        c=1.05*(MaxI64(cx,cy)+wave_period),
        *ship_r,x,y,z;
  F64 d,xx,yy,dx,dy,dx2,dy2,wave_x,wave_y;
  Bool bow_down;

  task->text_attr=LTBLUE<<4;

  //Draw Bubbles
  dc->color=BLUE;
  for (i=0;i<BUBBLES_NUM;i++)
    GrPlot(dc,bubbles[i].x*view_scale-scrn_x,
          bubbles[i].y*view_scale-scrn_y);

    //Draw Waves
  wave_x=ship_wave_x*view_scale-scrn_x;
  wave_y=ship_wave_y*view_scale-scrn_y;

  dx=wave_period*Cos(wave_theta)*view_scale;
  dy=wave_period*Sin(wave_theta)*view_scale;
  dx2=-dy*c;
  dy2=dx*c;

  dc->color=BLUE;
  if (Abs(dx)>Abs(dy)) {
    xx=wave_x; yy=wave_y;
    while (xx>-c) {
      GrLine(dc,xx-dx2,yy-dy2,xx+dx2,yy+dy2);
      if (dx>0) { xx-=dx; yy-=dy;
      } else {    xx+=dx; yy+=dy; }
    }
    xx=wave_x; yy=wave_y;
    while (xx<w+c) {
      GrLine(dc,xx-dx2,yy-dy2,xx+dx2,yy+dy2);
      if (dx<0) { xx-=dx; yy-=dy;
      } else {    xx+=dx; yy+=dy; }
    }
  } else {
    xx=wave_x; yy=wave_y;
    while (yy>-c) {
      GrLine(dc,xx-dx2,yy-dy2,xx+dx2,yy+dy2);
      if (dy>0) { xx-=dx; yy-=dy;
      } else {    xx+=dx; yy+=dy; }
    }
    xx=wave_x; yy=wave_y;
    while (yy<h+c) {
      GrLine(dc,xx-dx2,yy-dy2,xx+dx2,yy+dy2);
      if (dy<0) { xx-=dx; yy-=dy;
      } else {    xx+=dx; yy+=dy; }
    }
  }

  //Draw Dolphins
  for (i=0;i<DOLPHINS_NUM;i++)
    Sprite3ZB(dc,dolphins[i].x*view_scale-scrn_x,
          dolphins[i].y*view_scale-scrn_y,0,<7>,dolphins[i].theta);

    //Draw Land
  dc->color=ROP_MONO+YELLOW;
  VectMapBlotMP(dc,-scrn_x,-scrn_y,vm,view_scale);

  //Draw Ship
  dc->color=ROP_EQU;
  ship_r=ShipMat;
  Sprite3Mat4x4B(dc,ship.x*view_scale-scrn_x,ship.y*view_scale-scrn_y,
        0,<6>,ship_r);

  //Rudder
  x=-AFT_LEN; y=0; z=0;
  Mat4x4MulXYZ(ship_r,&x,&y,&z);
  x+=ship.x*view_scale; y+=ship.y*view_scale;
  dc->color=BLACK;
  dc->thick=2;
  GrLine3(dc,x-scrn_x,y-scrn_y,0,
        x-8*Cos(ship.theta-2.5*ship.d_theta)-scrn_x,
        y-8*Sin(ship.theta-2.5*ship.d_theta)-scrn_y,0);
  dc->thick=1;

  //Wake
  x=(-(AFT_LEN+2)+RandU16%13-6)/view_scale; y=(RandU16%13-6)/view_scale; z=0;
  Mat4x4MulXYZ(ship_r,&x,&y,&z);
  x+=ship.x; y+=ship.y;
  BubbleAdd(x,y);
  for (i=0;i<DOLPHINS_NUM;i++) {
    if (!(RandU16&15)) {
      x=dolphins[i].x-(7*Cos(dolphins[i].theta)+RandU16%3-1)/view_scale;
      y=dolphins[i].y-(7*Sin(dolphins[i].theta)+RandU16%3-1)/view_scale;
      BubbleAdd(x,y);
    }
  }

  //Draw Sails
  d=Wrap(ship.theta-Wrap(wave_theta,ship.theta-pi));
  if (Abs(d)<pi)
    d=(Abs(d)-pi)*Sign(-d);
  dx=-1.5*BERTH/2*Sin(ship.theta+d/2);
  dy= 1.5*BERTH/2*Cos(ship.theta+d/2);

  x=BOW_MAST; y=0; z=0;
  Mat4x4MulXYZ(ship_r,&x,&y,&z);
  if (z<0)
    bow_down=TRUE;
  else
    bow_down=FALSE;

    //Aft Sail
  x=-AFT_MAST; y=0; z=0;
  Mat4x4MulXYZ(ship_r,&x,&y,&z);
  x+=ship.x*view_scale


// Source: D:\TempleOS-Projects\html\BgtMain-Budget-Apps.html
// Date: unknown-date
// Language: HolyC

extern U0 BgtRegen();

Bool BgtPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
{//ch=ASCII; sc=scan_code
  no_warn sc;
  CBgtEntry *tmpb,*tmpb1;
  CBgtTemplate *tmpt,*tmpt1;
  CDocEntry *doc_ce;
  U8 *st;
  switch (ch) {
    case '\n':
      if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
            doc_ce->type_u8==DOCT_MENU_VAL) {
        tmpb=doc_ce->user_data;
        if (tmpt=tmpb->template) {
          if (tmpt1=BgtTemplatePmt(tmpt)) {
            QueRem(tmpt);
            BgtTemplatePurge(tmpt);
            BgtEntryDel2(&tmpt->b);
            Free(tmpt);
            QueIns(tmpt1,t_head.last);
            BgtTemplateExpand(tmpt1);
            BgtRegen;
          }
        } else {
          if (tmpb1=BgtEntryPmt(tmpb)) {
            QueRem(tmpb);
            BgtEntryDel(tmpb);
            BgtIns(tmpb1);
            BgtRegen;
          }
        }
      }
      return TRUE;
    case CH_CTRLY:
      if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
            doc_ce->type_u8==DOCT_MENU_VAL) {
        tmpb=doc_ce->user_data;
        if (tmpt=tmpb->template) {
          QueRem(tmpt);
          BgtTemplateDel(tmpt);
        } else {
          QueRem(tmpb);
          BgtEntryDel(tmpb);
        }
        BgtRegen;
      }
      return TRUE;
    case 'a':
      PopUpOk(  "Set the name and color of your accounts.\n"
            "To delete accounts, manually edit\n"
            "$GREEN$~/Budget/Accts.DD.Z$FG$.");
      if (PopUpEd(bgt_accts_file,Fs)) {
        BgtAcctsRead;
        BgtRegen;
      }
      return TRUE;
    case 'v':
      if ((st=BgtPopUpAcct("View Acct\n\n",view_acct))>=0) {
        StrCpy(view_acct,st);
        BgtRegen;
      }
      return TRUE;
    case 'n':
      if (tmpb1=BgtEntryPmt) {
        BgtIns(tmpb1);
        BgtRegen;
      }
      return TRUE;
    case 't':
      if (tmpt1=BgtTemplatePmt) {
        QueIns(tmpt1,t_head.last);
        BgtTemplateExpand(tmpt1);
        BgtRegen;
      }
      return TRUE;
    case 'c':
      if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
            doc_ce->type_u8==DOCT_MENU_VAL)
        tmpb=doc_ce->user_data;
      else
        tmpb=NULL;
      if (tmpb1=BgtEntryPmt(tmpb)) {
        BgtIns(tmpb1);
        BgtRegen;
      }
      return TRUE;
    case 'p':
      if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
            doc_ce->type_u8==DOCT_MENU_VAL) {
        tmpb=doc_ce->user_data;
        if (tmpt1=BgtTemplatePmt(,tmpb)) {
          BgtTemplateExpand(tmpt1,TRUE);
          BgtTemplateDel(tmpt1);
          BgtRegen;
        }
      }
      return TRUE;
  }
  return FALSE;
}

U0 BgtRegen()
{
  I64 timeout_jiffy,c,color=COLOR_INVALID;
  F64 balance=0;
  CDoc *doc,*pdoc,*ddoc;
  CDocEntry *doc_ce;
  CBgtEntry *tmpb=b_head.next,*tmpb_ce;
  doc=DocNew;
  doc->flags|=DOCF_FORM;
  while (tmpb!=&b_head) {
    if (!StrCmp(view_acct,tmpb->credit))
      balance-=tmpb->amount;
    if (!StrCmp(view_acct,tmpb->debit))
      balance+=tmpb->amount;
    c=BgtAcctColor(tmpb->credit);
    if (c!=color) {
      color=c;
      DocPrint(doc,"$FG,%d$",color);
    }
    tmpb->doc_e=DocPrint(doc,
          "$MU-UL,\"%D %8ts %8ts:%8.2f %8.2f:%$Q\",U=0x%X$\n",
          tmpb->date,tmpb->credit,tmpb->debit,balance,
          tmpb->amount,tmpb->desc,tmpb);
    tmpb=tmpb->next;
  }
  DocRecalc(doc);

  if (pdoc=Fs->put_doc) {
    DocLock(pdoc);
//Now, we want to preserve old position in doc, using ugly brute force.
    //It's tricky -- can't use old line num because of editor filters.

    //The price we pay for using the standard document editor is this kludge.
    //When I originally wrote my budget program, I did not have separate budget
    //and line entries, so we never had to resync.

    doc_ce=pdoc->cur_entry;
    timeout_jiffy=cnts.jiffies+JIFFY_FREQ; //Max one second.
    while (doc_ce!=pdoc && cnts.jiffies<timeout_jiffy) {
      while (doc_ce->type_u8!=DOCT_MENU_VAL || !(tmpb_ce=doc_ce->user_data)) {
        doc_ce=doc_ce->next;
        if (doc_ce==pdoc) goto br_cont;
      }
      tmpb=b_head.next;
      while (tmpb!=&b_head) {
        if (tmpb==tmpb_ce) {
          doc->cur_entry=tmpb->doc_e;
          doc->cur_col=0;
          DocCenter(doc);
          goto br_cont;
        }
        tmpb=tmpb->next;
      }
      doc_ce=doc_ce->next;
    }
  }

  br_cont:
  ddoc=Fs->display_doc;
  Fs->put_doc    =doc;
  Fs->display_doc=doc;
  DocDel(pdoc);
  if (pdoc!=ddoc)
    DocDel(ddoc);
  doc->user_put_key=&BgtPutKey;
}

U0 Budget(U8 *dirname="~/Budget")
{
  CDoc *pdoc,*ddoc,*old_put,*old_display;

  Cd(dirname);
  bgt_string_file       =FileNameAbs("Strs.DD.Z");
  bgt_accts_file        =FileNameAbs("Accts.DD.Z");
  bgt_data_file         =FileNameAbs("Bgt.DATA.Z");

  BgtAcctsRead;
  BgtDataRead;
  CBgtTemplatesExpand;
  SettingsPush; //See SettingsPush
  AutoComplete;
  WinBorder;
  WinMax;
  MenuPush(
        "File {"
        "  Abort(,CH_SHIFT_ESC);"
        "  Exit(,CH_ESC);"
        "}"
        "Edit {"
        "  NewEntry(,'n');"
        "  CopyEntry(,'c');"
        "  PeriodicEntry(,'p');"
        "  EditEntry(,'\n');"
        "  DeleteEntry(,CH_CTRLY);"
        "  NewTemplate(,'t');"
        "  AcctsFile(,'a');"
        "}"
        "View {"
        "  ViewAcct(,'v');"
        "}"
        );
  StrCpy(view_acct,"BANK");
  DocMax;
  old_put        =Fs->put_doc;
  old_display    =Fs->display_doc;
  Fs->put_doc    =NULL;
  Fs->display_doc=NULL;
  BgtRegen;
  try
    if (View) {
      BgtDataWrite;
      BgtAcctsWrite;
    }
  catch
    PutExcept;

  pdoc=Fs->put_doc;
  ddoc=Fs->display_doc;
  Fs->put_doc    =old_put;
  Fs->display_doc=old_display;
  DocDel(pdoc);
  if (pdoc!=ddoc)
    DocDel(ddoc);

  SettingsPop;
  BgtDel;
  MenuPop;
}

[System] You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style.

[User] Please write some HolyC code.

[Assistant]
// Source: D:\TempleOS-Projects\html\BgtMain-Budget-Apps.html
// Date: unknown-date
// Language: HolyC

extern U0 BgtRegen();

Bool BgtPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
{//ch=ASCII; sc=scan_code
  no_warn sc;
  CBgtEntry *tmpb,*tmpb1;
  CBgtTemplate *tmpt,*tmpt1;
  CDocEntry *doc_ce;
  U8 *st;
  switch (ch) {
    case '\n':
      if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
            doc_ce->type_u8==DOCT_MENU_VAL) {
        tmpb=doc_ce->user_data;
        if (tmpt=tmpb->template) {
          if (tmpt1=BgtTemplatePmt(tmpt)) {
            QueRem(tmpt);
            BgtTemplatePurge(tmpt);
            BgtEntryDel2(&tmpt->b);
            Free(tmpt);
            QueIns(tmpt1,t_head.last);
            BgtTemplateExpand(tmpt1);
            BgtRegen;
          }
        } else {
          if (tmpb1=BgtEntryPmt(tmpb)) {
            QueRem(tmpb);
            BgtEntryDel(tmpb);
            BgtIns(tmpb1);
            BgtRegen;
          }
        }
      }
      return TRUE;
    case CH_CTRLY:
      if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
            doc_ce->type_u8==DOCT_MENU_VAL) {
        tmpb=doc_ce->user_data;
        if (tmpt=tmpb->template) {
          QueRem(tmpt);
          BgtTemplateDel(tmpt);
        } else {
          QueRem(tmpb);
          BgtEntryDel(tmpb);
        }
        BgtRegen;
      }
      return TRUE;
    case 'a':
      PopUpOk(  "Set the name and color of your accounts.\n"
            "To delete accounts, manually edit\n"
            "$GREEN$~/Budget/Accts.DD.Z$FG$.");
      if (PopUpEd(bgt_accts_file,Fs)) {
        BgtAcctsRead;
        BgtRegen;
      }
      return TRUE;
    case 'v':
      if ((st=BgtPopUpAcct("View Acct\n\n",view_acct))>=0) {
        StrCpy(view_acct,st);
        BgtRegen;
      }
      return TRUE;
    case 'n':
      if (tmpb1=BgtEntryPmt) {
        BgtIns(tmpb1);
        BgtRegen;
      }
      return TRUE;
    case 't':
      if (tmpt1=BgtTemplatePmt) {
        QueIns(tmpt1,t_head.last);
        BgtTemplateExpand(tmpt1);
        BgtRegen;
      }
      return TRUE;
    case 'c':
      if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
            doc_ce->type_u8==DOCT_MENU_VAL)
        tmpb=doc_ce->user_data;
      else
        tmpb=NULL;
      if (tmpb1=BgtEntryPmt(tmpb)) {
        BgtIns(tmpb1);
        BgtRegen;
      }
      return TRUE;
    case 'p':
      if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
            doc_ce->type_u8==DOCT_MENU_VAL) {
        tmpb=doc_ce->user_data;
        if (tmpt1=BgtTemplatePmt(,tmpb)) {
          BgtTemplateExpand(tmpt1,TRUE);
          BgtTemplateDel(tmpt1);
          BgtRegen;
        }
      }
      return TRUE;
  }
  return FALSE;
}

U0 BgtRegen()
{
  I64 timeout_jiffy,c,color=COLOR_INVALID;
  F64 balance=0;
  CDoc *doc,*pdoc,*ddoc;
  CDocEntry *doc_ce;
  CBgtEntry *tmpb=b_head.next,*tmpb_ce;
  doc=DocNew;
  doc->flags|=DOCF_FORM;
  while (tmpb!=&b_head) {
    if (!StrCmp(view_acct,tmpb->credit))
      balance-=tmpb->amount;
    if (!StrCmp(view_acct,tmpb->debit))
      balance+=tmpb->amount;
    c=BgtAcctColor(tmpb->credit);
    if (c!=color) {
      color=c;
      DocPrint(doc,"$FG,%d$",color);
    }
    tmpb->doc_e=DocPrint(doc,
          "$MU-UL,\"%D %8ts %8ts:%8.2f %8.2f:%$Q\",U=0x%X$\n",
          tmpb->date,tmpb->credit,tmpb->debit,balance,
          tmpb->amount,tmpb->desc,tmpb);
    tmpb=tmpb->next;
  }
  DocRecalc(doc);

  if (pdoc=Fs->put_doc) {
    DocLock(pdoc);
//Now, we want to preserve old position in doc, using ugly brute force.
    //It's tricky -- can't use old line num because of editor filters.

    //The price we pay for using the standard document editor is this kludge.
    //When I originally wrote my budget program, I did not have separate budget
    //and line entries, so we never had to resync.

    doc_ce=pdoc->cur_entry;
    timeout_jiffy=cnts.jiffies+JIFFY_FREQ; //Max one second.
    while (doc_ce!=pdoc && cnts.jiffies<timeout_jiffy) {
      while (doc_ce->type_u8!=DOCT_MENU_VAL || !(tmpb_ce=doc_ce->user_data)) {
        doc_ce=doc_ce->next;
        if (doc_ce==pdoc) goto br_cont;
      }
      tmpb=b_head.next;
      while (tmpb!=&b_head) {
        if (tmpb==tmpb_ce) {
          doc->cur_entry=tmpb->doc_e;
          doc->cur_col=0;
          DocCenter(doc);
          goto br_cont;
        }
        tmpb=tmpb->next;
      }
      doc_ce=doc_ce->next;
    }
  }

  br_cont:
  ddoc=Fs->display_doc;
  Fs->put_doc    =doc;
  Fs->display_doc=doc;
  DocDel(pdoc);
  if (pdoc!=ddoc)
    DocDel(ddoc);
  doc->user_put_key=&BgtPutKey;
}

U0 Budget(U8 *dirname="~/Budget")
{
  CDoc *pdoc,*ddoc,*old_put,*old_display;

  Cd(dirname);
  bgt_string_file       =FileNameAbs("Strs.DD.Z");
  bgt_accts_file        =FileNameAbs("Accts.DD.Z");
  bgt_data_file         =FileNameAbs("Bgt.DATA.Z");

  BgtAcctsRead;
  BgtDataRead;
  CBgtTemplatesExpand;
  SettingsPush; //See SettingsPush
  AutoComplete;
  WinBorder;
  WinMax;
  MenuPush(
        "File {"
        "  Abort(,CH_SHIFT_ESC);"
        "  Exit(,CH_ESC);"
        "}"
        "Edit {"
        "  NewEntry(,'n');"
        "  CopyEntry(,'c');"
        "  PeriodicEntry(,'p');"
        "  EditEntry(,'\n');"
        "  DeleteEntry(,CH_CTRLY);"
        "  NewTemplate(,'t');"
        "  AcctsFile(,'a');"
        "}"
        "View {"
        "  ViewAcct(,'v');"
        "}"
        );
  StrCpy(view_acct,"BANK");
  DocMax;
  old_put        =Fs->put_doc;
  old_display    =Fs->display_doc;
  Fs->put_doc    =NULL;
  Fs->display_doc=NULL;
  BgtRegen;
  try
    if (View) {
      BgtDataWrite;
      BgtAcctsWrite;
    }
  catch
    PutExcept;

  pdoc=Fs->put_doc;
  ddoc=Fs->display_doc;
  Fs->put_doc    =old_put;
  Fs->display_doc=old_display;
  DocDel(pdoc);
  if (pdoc!=ddoc)
    DocDel(ddoc);

  SettingsPop;
  BgtDel;
  MenuPop;
}


// Source: D:\TempleOS-Projects\html\Dbg16-Sup1-Sup1CodeScraps-Home.html
// Date: unknown-date
// Language: HolyC

DBG16_PUT_CHAR::
        MOV     AH,0xE
        MOV     BL,7 //Might be foreground color on some BIOS's
        MOV     BH,U8 [DBG16_PAGE]
        INT     0x10
DBG16_RET:
        RET

DBG16_PUTS::
@@1:    LODSB
        TEST    AL,AL
        JZ      DBG16_RET
        CALL    DBG16_PUT_CHAR
        JMP     @@1

DBG16_PAGE:
        DU8     0;
DBG16_INIT::
        MOV     AH,0xF
        INT     0x10
        MOV     U8 [DBG16_PAGE],BH //Video page
        RET

DBG16_NUM:
        DU8     '0';
DBG16_PT::
        MOV     AL,U8 [DBG16_NUM]
        INC     U8 [DBG16_NUM]
        CALL    DBG16_PUT_CHAR
        XOR     EAX,EAX
@@1:    DEC     EAX
        JNZ     @@1
        RET

[System] You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style.

[User] Please write some HolyC code.

[Assistant]
// Source: D:\TempleOS-Projects\html\Dbg16-Sup1-Sup1CodeScraps-Home.html
// Date: unknown-date
// Language: HolyC

DBG16_PUT_CHAR::
        MOV     AH,0xE
        MOV     BL,7 //Might be foreground color on some BIOS's
        MOV     BH,U8 [DBG16_PAGE]
        INT     0x10
DBG16_RET:
        RET

DBG16_PUTS::
@@1:    LODSB
        TEST    AL,AL
        JZ      DBG16_RET
        CALL    DBG16_PUT_CHAR
        JMP     @@1

DBG16_PAGE:
        DU8     0;
DBG16_INIT::
        MOV     AH,0xF
        INT     0x10
        MOV     U8 [DBG16_PAGE],BH //Video page
        RET

DBG16_NUM:
        DU8     '0';
DBG16_PT::
        MOV     AL,U8 [DBG16_NUM]
        INC     U8 [DBG16_NUM]
        CALL    DBG16_PUT_CHAR
        XOR     EAX,EAX
@@1:    DEC     EAX
        JNZ     @@1
        RET


// Source: D:\TempleOS-Projects\html\FillTri-Sup1-Sup1Videos-Home.html
// Date: unknown-date
// Language: HolyC

U0 FillTriF64(F64 x1,F64 y1,F64 x2,F64 y2,F64 x3,F64 y3)
{
  F64 x,y,x_left,x_right,inverse_slope_left,inverse_slope_right;

  x_left =x1;
  x_right=x1;
  inverse_slope_left =(x3-x1)/(y3-y1);
  inverse_slope_right=(x2-x1)/(y2-y1);
  for (y=y1;y<=y2;y++) {
    for (x=x_left;x<=x_right;x++)
      GrPlot(,x,y);
    x_left +=inverse_slope_left;
    x_right+=inverse_slope_right;
  }

  inverse_slope_right=(x3-x2)/(y3-y2);
  for (;y<=y3;y++) {
    for (x=x_left;x<=x_right;x++)
      GrPlot(,x,y);
    x_left +=inverse_slope_left;
    x_right+=inverse_slope_right;
  }
}

U0 FillTriI64(I64 x1,I64 y1,I64 x2,I64 y2,I64 x3,I64 y3)
{ //Fixed radix point
  I64 x,y,x_left,x_right,inverse_slope_left,inverse_slope_right;

  x_left =x1<<32;
  x_right=x1<<32;
  inverse_slope_left =(x3-x1)<<32/(y3-y1);
  inverse_slope_right=(x2-x1)<<32/(y2-y1);
  for (y=y1;y<=y2;y++) {
    for (x=x_left>>32;x<=x_right>>32;x++)
      GrPlot(,x,y);
    x_left +=inverse_slope_left;
    x_right+=inverse_slope_right;
  }

  inverse_slope_right=(x3-x2)<<32/(y3-y2);
  for (;y<=y3;y++) {
    for (x=x_left>>32;x<=x_right>>32;x++)
      GrPlot(,x,y);
    x_left +=inverse_slope_left;
    x_right+=inverse_slope_right;
  }
}

U0 Main()
{
  F64 t0,tf;
  I64 i,x1,y1,x2,y2,x3,y3;

  SettingsPush;
  WinMax;
  WinBorder;
  DocClear;

  while (!ms.lb)
    Yield;
  x1=ms.pos.x;
  y1=ms.pos.y;
  while (ms.lb)
    Yield;
  GrCircle(,x1,y1,10);

  while (!ms.lb)
    Yield;
  x2=ms.pos.x;
  y2=ms.pos.y;
  while (ms.lb)
    Yield;
  GrCircle(,x2,y2,10);

  while (!ms.lb)
    Yield;
  x3=ms.pos.x;
  y3=ms.pos.y;
  while (ms.lb)
    Yield;
  GrCircle(,x3,y3,10);

  t0=tS;
  for (i=0;i<10000;i++)
    FillTriF64(x1,y1,x2,y2,x3,y3);
  tf=tS;
  "Time:%12.6f\n",tf-t0;

  t0=tS;
  for (i=0;i<10000;i++)
    FillTriI64(x1,y1,x2,y2,x3,y3);
  tf=tS;
  "Time:%12.6f\n",tf-t0;

  t0=tS;
  for (i=0;i<10000;i++)
    FillTriF64(x1,y1,x2,y2,x3,y3);
  tf=tS;
  "Time:%12.6f\n",tf-t0;

  t0=tS;
  for (i=0;i<10000;i++)
    FillTriI64(x1,y1,x2,y2,x3,y3);
  tf=tS;
  "Time:%12.6f\n",tf-t0;

  PressAKey;
  DCFill;

  SettingsPop;
}

Main;

[System] You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style.

[User] Please write some HolyC code.

[Assistant]
// Source: D:\TempleOS-Projects\html\FillTri-Sup1-Sup1Videos-Home.html
// Date: unknown-date
// Language: HolyC

U0 FillTriF64(F64 x1,F64 y1,F64 x2,F64 y2,F64 x3,F64 y3)
{
  F64 x,y,x_left,x_right,inverse_slope_left,inverse_slope_right;

  x_left =x1;
  x_right=x1;
  inverse_slope_left =(x3-x1)/(y3-y1);
  inverse_slope_right=(x2-x1)/(y2-y1);
  for (y=y1;y<=y2;y++) {
    for (x=x_left;x<=x_right;x++)
      GrPlot(,x,y);
    x_left +=inverse_slope_left;
    x_right+=inverse_slope_right;
  }

  inverse_slope_right=(x3-x2)/(y3-y2);
  for (;y<=y3;y++) {
    for (x=x_left;x<=x_right;x++)
      GrPlot(,x,y);
    x_left +=inverse_slope_left;
    x_right+=inverse_slope_right;
  }
}

U0 FillTriI64(I64 x1,I64 y1,I64 x2,I64 y2,I64 x3,I64 y3)
{ //Fixed radix point
  I64 x,y,x_left,x_right,inverse_slope_left,inverse_slope_right;

  x_left =x1<<32;
  x_right=x1<<32;
  inverse_slope_left =(x3-x1)<<32/(y3-y1);
  inverse_slope_right=(x2-x1)<<32/(y2-y1);
  for (y=y1;y<=y2;y++) {
    for (x=x_left>>32;x<=x_right>>32;x++)
      GrPlot(,x,y);
    x_left +=inverse_slope_left;
    x_right+=inverse_slope_right;
  }

  inverse_slope_right=(x3-x2)<<32/(y3-y2);
  for (;y<=y3;y++) {
    for (x=x_left>>32;x<=x_right>>32;x++)
      GrPlot(,x,y);
    x_left +=inverse_slope_left;
    x_right+=inverse_slope_right;
  }
}

U0 Main()
{
  F64 t0,tf;
  I64 i,x1,y1,x2,y2,x3,y3;

  SettingsPush;
  WinMax;
  WinBorder;
  DocClear;

  while (!ms.lb)
    Yield;
  x1=ms.pos.x;
  y1=ms.pos.y;
  while (ms.lb)
    Yield;
  GrCircle(,x1,y1,10);

  while (!ms.lb)
    Yield;
  x2=ms.pos.x;
  y2=ms.pos.y;
  while (ms.lb)
    Yield;
  GrCircle(,x2,y2,10);

  while (!ms.lb)
    Yield;
  x3=ms.pos.x;
  y3=ms.pos.y;
  while (ms.lb)
    Yield;
  GrCircle(,x3,y3,10);

  t0=tS;
  for (i=0;i<10000;i++)
    FillTriF64(x1,y1,x2,y2,x3,y3);
  tf=tS;
  "Time:%12.6f\n",tf-t0;

  t0=tS;
  for (i=0;i<10000;i++)
    FillTriI64(x1,y1,x2,y2,x3,y3);
  tf=tS;
  "Time:%12.6f\n",tf-t0;

  t0=tS;
  for (i=0;i<10000;i++)
    FillTriF64(x1,y1,x2,y2,x3,y3);
  tf=tS;
  "Time:%12.6f\n",tf-t0;

  t0=tS;
  for (i=0;i<10000;i++)
    FillTriI64(x1,y1,x2,y2,x3,y3);
  tf=tS;
  "Time:%12.6f\n",tf-t0;

  PressAKey;
  DCFill;

  SettingsPop;
}

Main;


// Source: D:\TempleOS-Projects\html\MemRep-Opt-Utils-Adam.html
// Date: unknown-date
// Language: HolyC

#help_index "Info;Memory/Info;Cmd Line (Typically)"

I64 TSSSize(CTSS *tss)
{
  return MSize2(tss)+MSize2(tss->st0)+MSize2(tss->st1)+MSize2(tss->st2);
}

I64 PenBrushesSize()
{
  I64 res=0,i;
  for (i=0;i<GR_PEN_BRUSHES_NUM;i++)
    res+=DCSize(gr.pen_brushes[i])+DCSize(gr.collision_pen_brushes[i])+
          DCSize(gr.even_pen_brushes[i])+DCSize(gr.odd_pen_brushes[i]);
  return res;
}

I64 ScrnZoomTablesSize()
{
  I64 res=0,i;
  for (i=1;i<=GR_SCRN_ZOOM_MAX;i++)
    res+=MSize2(gr.scrn_zoom_tables[i]);
  return res;
}

I64 TaskStkSize(CTask *task)
{
  CTaskStk *tmps=task->stk;
  I64 res=0;
  while (tmps) {
    res+=MSize2(tmps);
    tmps=tmps->next_stk;
  }
  return res;
}

I64 TaskQueSize(CTask *task)
{
  CJob *tmpc,*tmpc1;
  I64 res=0;
  PUSHFD
  CLI
  while (LBts(&task->srv_ctrl.flags,JOBCf_LOCKED))
    PAUSE

  tmpc1=&task->srv_ctrl.next_waiting;
  tmpc=tmpc1->next;
  while (tmpc!=tmpc1) {
    res+=MSize2(tmpc)+MSize2(tmpc->aux_str);
    tmpc=tmpc->next;
  }

  tmpc1=&task->srv_ctrl.next_done;
  tmpc=tmpc1->next;
  while (tmpc!=tmpc1) {
    res+=MSize2(tmpc)+MSize2(tmpc->aux_str);
    tmpc=tmpc->next;
  }

  LBtr(&task->srv_ctrl.flags,JOBCf_LOCKED);
  POPFD
  return res;
}

I64 BlkDevsSize()
{
  I64 i,j,res=MSize2(blkdev.blkdevs);
  CBlkDev *bd;
  for (i=0;i<BLKDEVS_NUM;i++) {
    bd=&blkdev.blkdevs[i];
    if (bd->bd_signature==BD_SIGNATURE_VAL) {
      j=(bd->max_blk+1)<<BLK_SIZE_BITS;
      if (bd->type==BDT_RAM)
        "RAMDsk %C\t:%010X/%010X\n",
              bd->first_drv_let,j-DrvUnused(bd->first_drv_let),j;
      res+=MSize2(bd->dev_id_record);
    }
  }
  return res;
}

I64 DrvsSize()
{
  I64 i,res=MSize2(blkdev.drvs);
  for (i=0;i<DRVS_NUM;i++)
    res+=MSize2(blkdev.drvs[i].cur_fat_blk)+MSize2(blkdev.drvs[i].fis);
  return res;
}

Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
{
  I64 i,j,k,m,n;
  CDoc *pdoc,*ddoc,*bdoc;
  CCmpCtrl *cc;
  CMathODE *o;
  CCPU *c;
  CTask *task1;

  if (!override_validate && !TaskValidate(task))
    return FALSE;
  if (task==Fs)
    task->rsp=GetRSP;
  "$BLACK$%-27t$Q#%08X$FG$\n",task->task_title,task;
  "$ID,2$Heap\t:%010X/%010X\n",TaskMemUsed(task,override_validate),
        TaskMemAlloced(task,override_validate);

  i=UnusedStk(task);
  j=TaskStkSize(task);
  if (0<=i<=task->stk->stk_size)
    "Stk\t\t:%010X/%010X\n",j-i,j;
  else
    "Stk\t\t:$RED$$BK,1$Overflow$BK,0$$FG$/%010X\n",j;

  "HashTable\t:%010X\n",HashTableSize2(task->hash_table);
  "FPU\t\t:%010X\n",MSize2(task->fpu_mmx);
  "DirCur\t:%010X\n",MSize2(task->cur_dir);

  if (pdoc=DocPut(task))
    "PutDoc\t:%010X\n",DocSize(pdoc);
  if ((ddoc=DocDisplay(task)) && pdoc!=ddoc)
    "DisplayDoc\t:%010X\n",DocSize(ddoc);
  if (bdoc=DocBorder(task))
    "BorderDoc\t:%010X\n",DocSize(bdoc);

  cc=task->next_cc;
  while (cc!=&task->next_cc) {
    "CmpCtrl\t:%010X\n",CmpCtrlSize(cc);
    cc=cc->next;
  }

  o=task->next_ode;
  while (o!=&task->next_ode) {
    "CMathODE\t:%010X\n",ODESize(o);
    o=o->next;
  }

  if (task==sys_winmgr_task) {
    "gr.pen_brushes\t:%010X\n",PenBrushesSize;
    "gr.scrn_zoom_tbles\t:%010X\n",ScrnZoomTablesSize;
  } else if (task==adam_task) {
    j=0;k=0;m=0;n=0;
    for (i=0;i<mp_cnt;i++) {
      c=&cpu_structs[i];
      k+=TSSSize(c->tss);
      task1=c->seth_task;
      do {
        if (task1!=adam_task) {//adam task located in Kernel mem
          j+=MSize2(task1);
          m+=MSize2(task1->code_heap);
          if (task1->data_heap!=task1->code_heap)
            m+=MSize2(task1->code_heap);
        }
        n+=TaskQueSize(task1);
        task1=task1->next_task;
      } while (task1!=c->seth_task);
      task1=c->idle_task;
      j+=MSize2(task1);
      m+=MSize2(task1->code_heap);
      if (task1->data_heap!=task1->code_heap)
        m+=MSize2(task1->code_heap);
    }
    "TaskStructs\t:%010X\n",j;
    "TSSes\t:%010X\n",k;
    "HeapCtrls\t:%010X\n",m;
    if (n)
      "TaskQues\t:%010X\n",n;
    "BlkDevs\t:%010X\n",BlkDevsSize;
    "Drvs\t:%010X\n",DrvsSize;
    if (blkdev.cache_base)
      "DskCache\t:%010X\n",
            MSize2(blkdev.cache_base)+MSize2(blkdev.cache_hash_table)+
            MSize2(blkdev.cache_ctrl);
    "Clip\t:%010X\n",DocSize(sys_clip_doc);
    "AutoComplete:%010X\n",CallExtStr("AutoCompleteSize");
    "gr.to_8_bits\t:%010X\n",MSize2(gr.to_8_bits);
    "gr.to_8_colors\t:%010X\n",MSize2(gr.to_8_colors);
    "gr.text_base\t:%010X\n",MSize2(gr.text_base);
    "gr.vga_text_cache\t:%010X\n",MSize2(gr.vga_text_cache);
    "gr.win_z_buf\t:%010X\n",MSize2(gr.win_z_buf)+
          MSize2(gr.win_uncovered_bitmap);
    "gr.dc\t\t:%010X\n",DCSize(gr.dc);
    "gr.dc1\t\t:%010X\n",DCSize(gr.dc1);
    "gr.dc2\t\t:%010X\n",DCSize(gr.dc2);
    "gr.dc_cache\t\t:%010X\n",DCSize(gr.dc_cache);
    "gr.scrn_image\t:%010X\n",DCSize(gr.scrn_image);
    "gr.zoomed_dc\t:%010X\n",DCSize(gr.zoomed_dc);
  }
  "$ID,-2$";
  return TRUE;
}

public U0 MemRep()
{//Memory usage report.
  I64 i;
  CTask *task;
  CCPU *c;
  CBinFile *bfh=mem_boot_base-sizeof(CBinFile);
  bfh(I64)+=bfh->file_size-1;

  "$BLACK$Low Memory\t:0000100000$FG$\n$ID,2$";
  "Kernel\t:%010X-%010X\n",mem_boot_base-sizeof(CBinFile),bfh;

  "VGA\t\t:00000A0000-00000BFFFF\n";
  "$ID,-2$$BLACK$High Memory\t:0000100000-%010X$FG$\n",
        mem_heap_limit;
  "SYS_FIXED_AREA\t:%010X-%010X\n",
        SYS_FIXED_AREA,SYS_FIXED_AREA+sizeof(CSysFixedArea)-1;

  if (sys_data_bp) {
    "$BLACK$Code Heap\t:%010X/%010X$FG$\n",
          sys_code_bp->used_u8s,sys_code_bp->alloced_u8s;
    "$BLACK$Data Heap\t:%010X/%010X$FG$\n",
          sys_data_bp->used_u8s,sys_data_bp->alloced_u8s;
  } else
    "$BLACK$Code/Data Heap\t:%010X/%010X$FG$\n",
          sys_code_bp->used_u8s,sys_code_bp->alloced_u8s;

  for (i=0;i<mp_cnt;i++) {
    c=&cpu_structs[i];
    "$PURPLE$CPU%d$FG$\n$ID,2$",i;
    task=c->seth_task;
    do {
      if (!MemRepTask(task))
        break;
      task=task->next_task;
    } while (task!=c->seth_task);
    MemRepTask(c->idle_task,TRUE);
    "$ID,-2$";
  }
}

[System] You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style.

[User] Please write some HolyC code.

[Assistant]
// Source: D:\TempleOS-Projects\html\MemRep-Opt-Utils-Adam.html
// Date: unknown-date
// Language: HolyC

#help_index "Info;Memory/Info;Cmd Line (Typically)"

I64 TSSSize(CTSS *tss)
{
  return MSize2(tss)+MSize2(tss->st0)+MSize2(tss->st1)+MSize2(tss->st2);
}

I64 PenBrushesSize()
{
  I64 res=0,i;
  for (i=0;i<GR_PEN_BRUSHES_NUM;i++)
    res+=DCSize(gr.pen_brushes[i])+DCSize(gr.collision_pen_brushes[i])+
          DCSize(gr.even_pen_brushes[i])+DCSize(gr.odd_pen_brushes[i]);
  return res;
}

I64 ScrnZoomTablesSize()
{
  I64 res=0,i;
  for (i=1;i<=GR_SCRN_ZOOM_MAX;i++)
    res+=MSize2(gr.scrn_zoom_tables[i]);
  return res;
}

I64 TaskStkSize(CTask *task)
{
  CTaskStk *tmps=task->stk;
  I64 res=0;
  while (tmps) {
    res+=MSize2(tmps);
    tmps=tmps->next_stk;
  }
  return res;
}

I64 TaskQueSize(CTask *task)
{
  CJob *tmpc,*tmpc1;
  I64 res=0;
  PUSHFD
  CLI
  while (LBts(&task->srv_ctrl.flags,JOBCf_LOCKED))
    PAUSE

  tmpc1=&task->srv_ctrl.next_waiting;
  tmpc=tmpc1->next;
  while (tmpc!=tmpc1) {
    res+=MSize2(tmpc)+MSize2(tmpc->aux_str);
    tmpc=tmpc->next;
  }

  tmpc1=&task->srv_ctrl.next_done;
  tmpc=tmpc1->next;
  while (tmpc!=tmpc1) {
    res+=MSize2(tmpc)+MSize2(tmpc->aux_str);
    tmpc=tmpc->next;
  }

  LBtr(&task->srv_ctrl.flags,JOBCf_LOCKED);
  POPFD
  return res;
}

I64 BlkDevsSize()
{
  I64 i,j,res=MSize2(blkdev.blkdevs);
  CBlkDev *bd;
  for (i=0;i<BLKDEVS_NUM;i++) {
    bd=&blkdev.blkdevs[i];
    if (bd->bd_signature==BD_SIGNATURE_VAL) {
      j=(bd->max_blk+1)<<BLK_SIZE_BITS;
      if (bd->type==BDT_RAM)
        "RAMDsk %C\t:%010X/%010X\n",
              bd->first_drv_let,j-DrvUnused(bd->first_drv_let),j;
      res+=MSize2(bd->dev_id_record);
    }
  }
  return res;
}

I64 DrvsSize()
{
  I64 i,res=MSize2(blkdev.drvs);
  for (i=0;i<DRVS_NUM;i++)
    res+=MSize2(blkdev.drvs[i].cur_fat_blk)+MSize2(blkdev.drvs[i].fis);
  return res;
}

Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
{
  I64 i,j,k,m,n;
  CDoc *pdoc,*ddoc,*bdoc;
  CCmpCtrl *cc;
  CMathODE *o;
  CCPU *c;
  CTask *task1;

  if (!override_validate && !TaskValidate(task))
    return FALSE;
  if (task==Fs)
    task->rsp=GetRSP;
  "$BLACK$%-27t$Q#%08X$FG$\n",task->task_title,task;
  "$ID,2$Heap\t:%010X/%010X\n",TaskMemUsed(task,override_validate),
        TaskMemAlloced(task,override_validate);

  i=UnusedStk(task);
  j=TaskStkSize(task);
  if (0<=i<=task->stk->stk_size)
    "Stk\t\t:%010X/%010X\n",j-i,j;
  else
    "Stk\t\t:$RED$$BK,1$Overflow$BK,0$$FG$/%010X\n",j;

  "HashTable\t:%010X\n",HashTableSize2(task->hash_table);
  "FPU\t\t:%010X\n",MSize2(task->fpu_mmx);
  "DirCur\t:%010X\n",MSize2(task->cur_dir);

  if (pdoc=DocPut(task))
    "PutDoc\t:%010X\n",DocSize(pdoc);
  if ((ddoc=DocDisplay(task)) && pdoc!=ddoc)
    "DisplayDoc\t:%010X\n",DocSize(ddoc);
  if (bdoc=DocBorder(task))
    "BorderDoc\t:%010X\n",DocSize(bdoc);

  cc=task->next_cc;
  while (cc!=&task->next_cc) {
    "CmpCtrl\t:%010X\n",CmpCtrlSize(cc);
    cc=cc->next;
  }

  o=task->next_ode;
  while (o!=&task->next_ode) {
    "CMathODE\t:%010X\n",ODESize(o);
    o=o->next;
  }

  if (task==sys_winmgr_task) {
    "gr.pen_brushes\t:%010X\n",PenBrushesSize;
    "gr.scrn_zoom_tbles\t:%010X\n",ScrnZoomTablesSize;
  } else if (task==adam_task) {
    j=0;k=0;m=0;n=0;
    for (i=0;i<mp_cnt;i++) {
      c=&cpu_structs[i];
      k+=TSSSize(c->tss);
      task1=c->seth_task;
      do {
        if (task1!=adam_task) {//adam task located in Kernel mem
          j+=MSize2(task1);
          m+=MSize2(task1->code_heap);
          if (task1->data_heap!=task1->code_heap)
            m+=MSize2(task1->code_heap);
        }
        n+=TaskQueSize(task1);
        task1=task1->next_task;
      } while (task1!=c->seth_task);
      task1=c->idle_task;
      j+=MSize2(task1);
      m+=MSize2(task1->code_heap);
      if (task1->data_heap!=task1->code_heap)
        m+=MSize2(task1->code_heap);
    }
    "TaskStructs\t:%010X\n",j;
    "TSSes\t:%010X\n",k;
    "HeapCtrls\t:%010X\n",m;
    if (n)
      "TaskQues\t:%010X\n",n;
    "BlkDevs\t:%010X\n",BlkDevsSize;
    "Drvs\t:%010X\n",DrvsSize;
    if (blkdev.cache_base)
      "DskCache\t:%010X\n",
            MSize2(blkdev.cache_base)+MSize2(blkdev.cache_hash_table)+
            MSize2(blkdev.cache_ctrl);
    "Clip\t:%010X\n",DocSize(sys_clip_doc);
    "AutoComplete:%010X\n",CallExtStr("AutoCompleteSize");
    "gr.to_8_bits\t:%010X\n",MSize2(gr.to_8_bits);
    "gr.to_8_colors\t:%010X\n",MSize2(gr.to_8_colors);
    "gr.text_base\t:%010X\n",MSize2(gr.text_base);
    "gr.vga_text_cache\t:%010X\n",MSize2(gr.vga_text_cache);
    "gr.win_z_buf\t:%010X\n",MSize2(gr.win_z_buf)+
          MSize2(gr.win_uncovered_bitmap);
    "gr.dc\t\t:%010X\n",DCSize(gr.dc);
    "gr.dc1\t\t:%010X\n",DCSize(gr.dc1);
    "gr.dc2\t\t:%010X\n",DCSize(gr.dc2);
    "gr.dc_cache\t\t:%010X\n",DCSize(gr.dc_cache);
    "gr.scrn_image\t:%010X\n",DCSize(gr.scrn_image);
    "gr.zoomed_dc\t:%010X\n",DCSize(gr.zoomed_dc);
  }
  "$ID,-2$";
  return TRUE;
}

public U0 MemRep()
{//Memory usage report.
  I64 i;
  CTask *task;
  CCPU *c;
  CBinFile *bfh=mem_boot_base-sizeof(CBinFile);
  bfh(I64)+=bfh->file_size-1;

  "$BLACK$Low Memory\t:0000100000$FG$\n$ID,2$";
  "Kernel\t:%010X-%010X\n",mem_boot_base-sizeof(CBinFile),bfh;

  "VGA\t\t:00000A0000-00000BFFFF\n";
  "$ID,-2$$BLACK$High Memory\t:0000100000-%010X$FG$\n",
        mem_heap_limit;
  "SYS_FIXED_AREA\t:%010X-%010X\n",
        SYS_FIXED_AREA,SYS_FIXED_AREA+sizeof(CSysFixedArea)-1;

  if (sys_data_bp) {
    "$BLACK$Code Heap\t:%010X/%010X$FG$\n",
          sys_code_bp->used_u8s,sys_code_bp->alloced_u8s;
    "$BLACK$Data Heap\t:%010X/%010X$FG$\n",
          sys_data_bp->used_u8s,sys_data_bp->alloced_u8s;
  } else
    "$BLACK$Code/Data Heap\t:%010X/%010X$FG$\n",
          sys_code_bp->used_u8s,sys_code_bp->alloced_u8s;

  for (i=0;i<mp_cnt;i++) {
    c=&cpu_structs[i];
    "$PURPLE$CPU%d$FG$\n$ID,2$",i;
    task=c->seth_task;
    do {
      if (!MemRepTask(task))
        break;
      task=task->next_task;
    } while (task!=c->seth_task);
    MemRepTask(c->idle_task,TRUE);
    "$ID,-2$";
  }
}


// Source: D:\TempleOS-Projects\html\CharDemo-Games-Demo.html
// Date: unknown-date
// Language: HolyC

/*
Char graphics are how games on the C64 were made.  You don't need to do it
this way, unless for fun.  You can just make device context bigger than
the scrn and scroll around.

See  ::/Demo/Games/RawHide.HC or ::/Demo/Games/BigGuns.HC.

The nice thing about character graphics are the animations.
*/

#define MAP_WIDTH       (TEXT_COLS*2)
#define MAP_HEIGHT      (TEXT_ROWS*2)

#define CH_WATER        '^'
#define CH_LAND         CH_SPACE
#define CH_TREE         '*'

U16 map[MAP_HEIGHT][MAP_WIDTH];

I64 scrn_pix_x,scrn_pix_y;

U0 DrawIt(CTask *task,CDC *)
{
  U16 *ptr;
  I64 i,j,y=scrn_pix_y>>3;
  gr.hide_col=gr.hide_row=TRUE;
  gr.pan_text_x=7-scrn_pix_x&7;
  gr.pan_text_y=7-scrn_pix_y&7;
  for (i=0;i<task->win_height;i++) {
    ptr=&map[y++][scrn_pix_x>>3];
    for (j=0;j<task->win_width;j++)
        //By the time you clip to window and handle Fs->scroll_x,Fs->scroll_y,
        //it is too much trouble to do raw access to gr.text_base like we do
        //in ::/Demo/Games/Maze.HC.
      TextChar(task,FALSE,j,i,*ptr++);
  }
}

U8 *old_font=text.font;
U64 waves[4]={
0x0011AA440011AA44,0x0022558800225588,
0x0044AA110044AA11,0x0088552200885522};

U0 AnimateEndCB()
{
  text.font=old_font;
  Exit;
}

U0 AnimateTask(I64)
{
  I64 i;
  U64 *font=MAlloc(256*8);
  Fs->task_end_cb=&AnimateEndCB;
  MemCpy(font,text.font,256*8);
  text.font=font;
  font[CH_TREE]=0x18187E7E3C3C18;
  while (TRUE) {
    font[CH_WATER]=waves[i++&0x3];
    Sleep(200);
    Refresh;
  }
}

U0 ScrollTaskX(I64 sign)
{
  I64 i;
  for (i=0;i<32;i++) {
    scrn_pix_x=ClampI64(scrn_pix_x+sign,0,
          (MAP_WIDTH-TEXT_COLS+1)*FONT_WIDTH);
    Refresh;
  }
}

U0 ScrollTaskY(I64 sign)
{
  I64 i;
  for (i=0;i<32;i++) {
    scrn_pix_y=ClampI64(scrn_pix_y+sign,0,
          (MAP_HEIGHT-TEXT_ROWS+2)*FONT_HEIGHT);
    Refresh;
  }
}

U0 Init()
{
  I64 i,j,x,y;
  scrn_pix_x=(MAP_WIDTH-TEXT_COLS)>>1*FONT_WIDTH;
  scrn_pix_y=(MAP_HEIGHT-TEXT_ROWS)>>1*FONT_HEIGHT;

  MemSetU16(map,CH_WATER+(BLUE<<4+LTBLUE)<<8,MAP_WIDTH*MAP_HEIGHT);
  for (i=1;i<MAP_WIDTH-1;i++)
    map[0][i]=map[MAP_HEIGHT-1][i]='.'+(BLUE<<4+RED)<<8;
  for (i=1;i<MAP_HEIGHT-1;i++)
    map[i][0]=map[i][MAP_WIDTH-1]='.'+(BLUE<<4+RED)<<8;
  map[0][0]                     ='.'+(BLUE<<4+RED)<<8;
  map[0][MAP_WIDTH-1]           ='.'+(BLUE<<4+RED)<<8;
  map[MAP_HEIGHT-1][0]          ='.'+(BLUE<<4+RED)<<8;
  map[MAP_HEIGHT-1][MAP_WIDTH-1]='.'+(BLUE<<4+RED)<<8;

  for (i=0;i<20;i++) {
    x=MAP_WIDTH*Rand;
    y=MAP_HEIGHT*Rand;
    for (j=0;j<1000;j++) {
      map[y][x]=CH_LAND+(YELLOW<<4+BLACK)<<8;
      x=ClampI64(x+RandU16%3-1,0,MAP_WIDTH-1);
      y=ClampI64(y+RandU16%3-1,0,MAP_HEIGHT-1);
    }
  }
  for (i=0;i<100;i++) {
    do {
      x=MAP_WIDTH*Rand;
      y=MAP_HEIGHT*Rand;
    } while (map[y][x].u8[0]!=CH_LAND);
    for (j=0;j<100;j++) {
      map[y][x]=CH_TREE+(YELLOW<<4+GREEN)<<8;
      x=ClampI64(x+RandU16%3-1,0,MAP_WIDTH-1);
      y=ClampI64(y+RandU16%3-1,0,MAP_HEIGHT-1);
    }
  }
}

U0 CleanUp()
{
  gr.pan_text_x=gr.pan_text_y=0;
  gr.hide_col=gr.hide_row=FALSE;
}

U0 CharDemo()
{
  I64 sc;
  SettingsPush; //See SettingsPush
  Fs->text_attr=YELLOW<<4+BLUE;
  AutoComplete;
  WinBorder;
  WinMax;
  DocCursor;

  MenuPush(
        "File {"
        "  Abort(,CH_SHIFT_ESC);"
        "  Exit(,CH_ESC);"
        "}"
        "Play {"
        "  Restart(,'\n');"
        "  Left(,,SC_CURSOR_LEFT);"
        "  Right(,,SC_CURSOR_RIGHT);"
        "  Up(,,SC_CURSOR_UP);"
        "  Down(,,SC_CURSOR_DOWN);"
        "}"
        );
  Init;
  Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
  Fs->draw_it=&DrawIt;
  try {
    while (TRUE) {
      switch (GetKey(&sc)) {
        case 0:
          switch (sc.u8[0]) {
            case SC_CURSOR_LEFT:
              Spawn(&ScrollTaskX,-1,"Scroll",,Fs);
              break;
            case SC_CURSOR_RIGHT:
              Spawn(&ScrollTaskX,1,"Scroll",,Fs);
              break;
            case SC_CURSOR_UP:
              Spawn(&ScrollTaskY,-1,"Scroll",,Fs);
              break;
            case SC_CURSOR_DOWN:
              Spawn(&ScrollTaskY,1,"Scroll",,Fs);
              break;
          }
          break;
        case '\n':
          CleanUp;
          Init;
          break;
        case CH_SHIFT_ESC:
        case CH_ESC:
          goto sq_done;
      }
    }
sq_done: //Don't goto out of try
  } catch
    PutExcept;
  SettingsPop;
  CleanUp;
  MenuPop;
}

CharDemo;

[System] You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style.

[User] Please write some HolyC code.

[Assistant]
// Source: D:\TempleOS-Projects\html\CharDemo-Games-Demo.html
// Date: unknown-date
// Language: HolyC

/*
Char graphics are how games on the C64 were made.  You don't need to do it
this way, unless for fun.  You can just make device context bigger than
the scrn and scroll around.

See  ::/Demo/Games/RawHide.HC or ::/Demo/Games/BigGuns.HC.

The nice thing about character graphics are the animations.
*/

#define MAP_WIDTH       (TEXT_COLS*2)
#define MAP_HEIGHT      (TEXT_ROWS*2)

#define CH_WATER        '^'
#define CH_LAND         CH_SPACE
#define CH_TREE         '*'

U16 map[MAP_HEIGHT][MAP_WIDTH];

I64 scrn_pix_x,scrn_pix_y;

U0 DrawIt(CTask *task,CDC *)
{
  U16 *ptr;
  I64 i,j,y=scrn_pix_y>>3;
  gr.hide_col=gr.hide_row=TRUE;
  gr.pan_text_x=7-scrn_pix_x&7;
  gr.pan_text_y=7-scrn_pix_y&7;
  for (i=0;i<task->win_height;i++) {
    ptr=&map[y++][scrn_pix_x>>3];
    for (j=0;j<task->win_width;j++)
        //By the time you clip to window and handle Fs->scroll_x,Fs->scroll_y,
        //it is too much trouble to do raw access to gr.text_base like we do
        //in ::/Demo/Games/Maze.HC.
      TextChar(task,FALSE,j,i,*ptr++);
  }
}

U8 *old_font=text.font;
U64 waves[4]={
0x0011AA440011AA44,0x0022558800225588,
0x0044AA110044AA11,0x0088552200885522};

U0 AnimateEndCB()
{
  text.font=old_font;
  Exit;
}

U0 AnimateTask(I64)
{
  I64 i;
  U64 *font=MAlloc(256*8);
  Fs->task_end_cb=&AnimateEndCB;
  MemCpy(font,text.font,256*8);
  text.font=font;
  font[CH_TREE]=0x18187E7E3C3C18;
  while (TRUE) {
    font[CH_WATER]=waves[i++&0x3];
    Sleep(200);
    Refresh;
  }
}

U0 ScrollTaskX(I64 sign)
{
  I64 i;
  for (i=0;i<32;i++) {
    scrn_pix_x=ClampI64(scrn_pix_x+sign,0,
          (MAP_WIDTH-TEXT_COLS+1)*FONT_WIDTH);
    Refresh;
  }
}

U0 ScrollTaskY(I64 sign)
{
  I64 i;
  for (i=0;i<32;i++) {
    scrn_pix_y=ClampI64(scrn_pix_y+sign,0,
          (MAP_HEIGHT-TEXT_ROWS+2)*FONT_HEIGHT);
    Refresh;
  }
}

U0 Init()
{
  I64 i,j,x,y;
  scrn_pix_x=(MAP_WIDTH-TEXT_COLS)>>1*FONT_WIDTH;
  scrn_pix_y=(MAP_HEIGHT-TEXT_ROWS)>>1*FONT_HEIGHT;

  MemSetU16(map,CH_WATER+(BLUE<<4+LTBLUE)<<8,MAP_WIDTH*MAP_HEIGHT);
  for (i=1;i<MAP_WIDTH-1;i++)
    map[0][i]=map[MAP_HEIGHT-1][i]='.'+(BLUE<<4+RED)<<8;
  for (i=1;i<MAP_HEIGHT-1;i++)
    map[i][0]=map[i][MAP_WIDTH-1]='.'+(BLUE<<4+RED)<<8;
  map[0][0]                     ='.'+(BLUE<<4+RED)<<8;
  map[0][MAP_WIDTH-1]           ='.'+(BLUE<<4+RED)<<8;
  map[MAP_HEIGHT-1][0]          ='.'+(BLUE<<4+RED)<<8;
  map[MAP_HEIGHT-1][MAP_WIDTH-1]='.'+(BLUE<<4+RED)<<8;

  for (i=0;i<20;i++) {
    x=MAP_WIDTH*Rand;
    y=MAP_HEIGHT*Rand;
    for (j=0;j<1000;j++) {
      map[y][x]=CH_LAND+(YELLOW<<4+BLACK)<<8;
      x=ClampI64(x+RandU16%3-1,0,MAP_WIDTH-1);
      y=ClampI64(y+RandU16%3-1,0,MAP_HEIGHT-1);
    }
  }
  for (i=0;i<100;i++) {
    do {
      x=MAP_WIDTH*Rand;
      y=MAP_HEIGHT*Rand;
    } while (map[y][x].u8[0]!=CH_LAND);
    for (j=0;j<100;j++) {
      map[y][x]=CH_TREE+(YELLOW<<4+GREEN)<<8;
      x=ClampI64(x+RandU16%3-1,0,MAP_WIDTH-1);
      y=ClampI64(y+RandU16%3-1,0,MAP_HEIGHT-1);
    }
  }
}

U0 CleanUp()
{
  gr.pan_text_x=gr.pan_text_y=0;
  gr.hide_col=gr.hide_row=FALSE;
}

U0 CharDemo()
{
  I64 sc;
  SettingsPush; //See SettingsPush
  Fs->text_attr=YELLOW<<4+BLUE;
  AutoComplete;
  WinBorder;
  WinMax;
  DocCursor;

  MenuPush(
        "File {"
        "  Abort(,CH_SHIFT_ESC);"
        "  Exit(,CH_ESC);"
        "}"
        "Play {"
        "  Restart(,'\n');"
        "  Left(,,SC_CURSOR_LEFT);"
        "  Right(,,SC_CURSOR_RIGHT);"
        "  Up(,,SC_CURSOR_UP);"
        "  Down(,,SC_CURSOR_DOWN);"
        "}"
        );
  Init;
  Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
  Fs->draw_it=&DrawIt;
  try {
    while (TRUE) {
      switch (GetKey(&sc)) {
        case 0:
          switch (sc.u8[0]) {
            case SC_CURSOR_LEFT:
              Spawn(&ScrollTaskX,-1,"Scroll",,Fs);
              break;
            case SC_CURSOR_RIGHT:
              Spawn(&ScrollTaskX,1,"Scroll",,Fs);
              break;
            case SC_CURSOR_UP:
              Spawn(&ScrollTaskY,-1,"Scroll",,Fs);
              break;
            case SC_CURSOR_DOWN:
              Spawn(&ScrollTaskY,1,"Scroll",,Fs);
              break;
          }
          break;
        case '\n':
          CleanUp;
          Init;
          break;
        case CH_SHIFT_ESC:
        case CH_ESC:
          goto sq_done;
      }
    }
sq_done: //Don't goto out of try
  } catch
    PutExcept;
  SettingsPop;
  CleanUp;
  MenuPop;
}

CharDemo;


// Source: D:\TempleOS-Projects\html\MakeAC-AutoComplete-Adam.html
// Date: unknown-date
// Language: HolyC

//See ::/Doc/AutoComplete.DD
Cd(__DIR__);;
#include "ACFill"
#include "ACTask"
#include "ACInit"
Cd("..");;

[System] You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style.

[User] Please write some HolyC code.

[Assistant]
// Source: D:\TempleOS-Projects\html\MakeAC-AutoComplete-Adam.html
// Date: unknown-date
// Language: HolyC

//See ::/Doc/AutoComplete.DD
Cd(__DIR__);;
#include "ACFill"
#include "ACTask"
#include "ACInit"
Cd("..");;


// Source: D:\TempleOS-Projects\html\Bible-Misc.html
// Date: December 31, 2001
// Language: HolyC

**Welcome To The World of Free Plain Vanilla Electronic Texts**

**Etexts Readable By Both Humans and By Computers, Since 1971**

*These Etexts Prepared By Hundreds of Volunteers and Donations*

August, 1989  [Etext #10]

******The Project Gutenberg Etext of The King James Bible******
******This file should be named kjv10.txt or kjv10.zip*****

Copyright laws are changing all over the world, be sure to check
the copyright laws for your country before posting these files!!

Please take a look at the important information in this header.
We encourage you to keep this file on your own disk, keeping an
electronic path open for the next readers.  Do not remove this.

**Welcome To The World of Free Plain Vanilla Electronic Texts**

**Etexts Readable By Both Humans and By Computers, Since 1971**

*These Etexts Prepared By Hundreds of Volunteers and Donations*

Information on contacting Project Gutenberg to get Etexts, and
further information is included below.  We need your donations.

The King James Bible

August, 1989  [Etext #10]

******The Project Gutenberg Etext of The King James Bible******
******This file should be named kjv10.txt or kjv10.zip*****

Corrected EDITIONS of our etexts get a new NUMBER, kjv11.txt
VERSIONS based on separate sources get new LETTER, kjv10aa.txt

Warning:  also look for our Bible Etext under biblexxx.xxx:  as
well as under kjvxxxxx.xxx.

Project Gutenberg Etexts are usually created from multiple editions,
all of which are in the Public Domain in the United States, unless a
copyright notice is included.  Therefore, we do usually do NOT! keep
these books in compliance with any particular paper edition.

We are now trying to release all our books one month in advance
of the official release dates, leaving time for better editing.

Please note:  neither this list nor its contents are final till
midnight of the last day of the month of any such announcement.
The official release date of all Project Gutenberg Etexts is at
Midnight, Central Time, of the last day of the stated month.  A
preliminary version may often be posted for suggestion, comment
and editing by those who wish to do so.  To be sure you have an
up to date first edition [xxxxx10x.xxx] please check file sizes
in the first week of the next month.  Since our ftp program has
a bug in it that scrambles the date [tried to fix and failed] a
look at the file size will have to do, but we will try to see a
new copy has at least one byte more or less.

Information about Project Gutenberg (one page)

We produce about two million dollars for each hour we work.  The
time it takes us, a rather conservative estimate, is fifty hours
to get any etext selected, entered, proofread, edited, copyright
searched and analyzed, the copyright letters written, etc.  This
projected audience is one hundred million readers.  If our value
per text is nominally estimated at one dollar then we produce &2
million dollars per hour this year as we release thirty-six text
files per month, or 432 more Etexts in 1999 for a total of 2000+
If these reach just 10% of the computerized population, then the
total should reach over 200 billion Etexts given away this year.

The Goal of Project Gutenberg is to Give Away One Trillion Etext
Files by December 31, 2001.  [10,000 x 100,000,000 = 1 Trillion]
This is ten thousand titles each to one hundred million readers,
which is only ~5% of the present number of computer users.

At our revised rates of production, we will reach only one-third
of that goal by the end of 2001, or about 3,333 Etexts unless we
manage to get some real funding; currently our funding is mostly
from Michael Hart's salary at Carnegie-Mellon University, and an
assortment of sporadic gifts; this salary is only good for a few
more years, so we are looking for something to replace it, as we
don't want Project Gutenberg to be so dependent on one person.

We need your donations more than ever!

All donations should be made to "Project Gutenberg/CMU": and are
tax deductible to the extent allowable by law.  (CMU = Carnegie-
Mellon University).

For these and other matters, please mail to:

Project Gutenberg
P. O. Box  2782
Champaign, IL 61825

When all other email fails. . .try our Executive Director:
Michael S. Hart <[email protected]>
[email protected] forwards to [email protected] and archive.org
if your mail bounces from archive.org, I will still see it, if
it bounces from prairienet.org, better resend later on. . . .

We would prefer to send you this information by email.

******

To access Project Gutenberg etexts, use any Web browser
to view http://promo.net/pg.  This site lists Etexts by
author and by title, and includes information about how
to get involved with Project Gutenberg.  You could also
download our past Newsletters, or subscribe here.  This
is one of our major sites, please email [email protected],
for a more complete list of our various sites.

To go directly to the etext collections, use FTP or any
Web browser to visit a Project Gutenberg mirror (mirror
sites are available on 7 continents; mirrors are listed
at http://promo.net/pg).

Mac users, do NOT point and click, typing works better.

Example FTP session:

ftp sunsite.unc.edu
login: anonymous
password: [email protected]
cd pub/docs/books/gutenberg
cd etext90 through etext99
dir [to see files]
get or mget [to get files. . .set bin for zip files]
GET GUTINDEX.??  [to get a year's listing of books, e.g., GUTINDEX.99]
GET GUTINDEX.ALL [to get a listing of ALL books]

***

**Information prepared by the Project Gutenberg legal advisor**

(Three Pages)

***START**THE SMALL PRINT!**FOR PUBLIC DOMAIN ETEXTS**START***
Why is this "Small Print!" statement here?  You know: lawyers.
They tell us you might sue us if there is something wrong with
your copy of this etext, even if you got it for free from
someone other than us, and even if what's wrong is not our
fault.  So, among other things, this "Small Print!" statement
disclaims most of our liability to you.  It also tells you how
you can distribute copies

[System] You are Terry Davis, the creator of TempleOS. Write HolyC code in your unique style.

[User] Please write some HolyC code.

[Assistant]
// Source: D:\TempleOS-Projects\html\Bible-Misc.html
// Date: December 31, 2001
// Language: HolyC

**Welcome To The World of Free Plain Vanilla Electronic Texts**

**Etexts Readable By Both Humans and By Computers, Since 1971**

*These Etexts Prepared By Hundreds of Volunteers and Donations*

August, 1989  [Etext #10]

******The Project Gutenberg Etext of The King James Bible******
******This file should be named kjv10.txt or kjv10.zip*****

Copyright laws are changing all over the world, be sure to check
the copyright laws for your country before posting these files!!

Please take a look at the important information in this header.
We encourage you to keep this file on your own disk, keeping an
electronic path open for the next readers.  Do not remove this.

**Welcome To The World of Free Plain Vanilla Electronic Texts**

**Etexts Readable By Both Humans and By Computers, Since 1971**

*These Etexts Prepared By Hundreds of Volunteers and Donations*

Information on contacting Project Gutenberg to get Etexts, and
further information is included below.  We need your donations.

The King James Bible

August, 1989  [Etext #10]

******The Project Gutenberg Etext of The King James Bible******
******This file should be named kjv10.txt or kjv10.zip*****

Corrected EDITIONS of our etexts get a new NUMBER, kjv11.txt
VERSIONS based on separate sources get new LETTER, kjv10aa.txt

Warning:  also look for our Bible Etext under biblexxx.xxx:  as
well as under kjvxxxxx.xxx.

Project Gutenberg Etexts are usually created from multiple editions,
all of which are in the Public Domain in the United States, unless a
copyright notice is included.  Therefore, we do usually do NOT! keep
these books in compliance with any particular paper edition.

We are now trying to release all our books one month in advance
of the official release dates, leaving time for better editing.

Please note:  neither this list nor its contents are final till
midnight of the last day of the month of any such announcement.
The official release date of all Project Gutenberg Etexts is at
Midnight, Central Time, of the last day of the stated month.  A
preliminary version may often be posted for suggestion, comment
and editing by those who wish to do so.  To be sure you have an
up to date first edition [xxxxx10x.xxx] please check file sizes
in the first week of the next month.  Since our ftp program has
a bug in it that scrambles the date [tried to fix and failed] a
look at the file size will have to do, but we will try to see a
new copy has at least one byte more or less.

Information about Project Gutenberg (one page)

We produce about two million dollars for each hour we work.  The
time it takes us, a rather conservative estimate, is fifty hours
to get any etext selected, entered, proofread, edited, copyright
searched and analyzed, the copyright letters written, etc.  This
projected audience is one hundred million readers.  If our value
per text is nominally estimated at one dollar then we produce &2
million dollars per hour this year as we release thirty-six text
files per month, or 432 more Etexts in 1999 for a total of 2000+
If these reach just 10% of the computerized population, then the
total should reach over 200 billion Etexts given away this year.

The Goal of Project Gutenberg is to Give Away One Trillion Etext
Files by December 31, 2001.  [10,000 x 100,000,000 = 1 Trillion]
This is ten thousand titles each to one hundred million readers,
which is only ~5% of the present number of computer users.

At our revised rates of production, we will reach only one-third
of that goal by the end of 2001, or about 3,333 Etexts unless we
manage to get some real funding; currently our funding is mostly
from Michael Hart's salary at Carnegie-Mellon University, and an
assortment of sporadic gifts; this salary is only good for a few
more years, so we are looking for something to replace it, as we
don't want Project Gutenberg to be so dependent on one person.

We need your donations more than ever!

All donations should be made to "Project Gutenberg/CMU": and are
tax deductible to the extent allowable by law.  (CMU = Carnegie-
Mellon University).

For these and other matters, please mail to:

Project Gutenberg
P. O. Box  2782
Champaign, IL 61825

When all other email fails. . .try our Executive Director:
Michael S. Hart <[email protected]>
[email protected] forwards to [email protected] and archive.org
if your mail bounces from archive.org, I will still see it, if
it bounces from prairienet.org, better resend later on. . . .

We would prefer to send you this information by email.

******

To access Project Gutenberg etexts, use any Web browser
to view http://promo.net/pg.  This site lists Etexts by
author and by title, and includes information about how
to get involved with Project Gutenberg.  You could also
download our past Newsletters, or subscribe here.  This
is one of our major sites, please email [email protected],
for a more complete list of our various sites.

To go directly to the etext collections, use FTP or any
Web browser to visit a Project Gutenberg mirror (mirror
sites are available on 7 continents; mirrors are listed
at http://promo.net/pg).

Mac users, do NOT point and click, typing works better.

Example FTP session:

ftp sunsite.unc.edu
login: anonymous
password: [email protected]
cd pub/docs/books/gutenberg
cd etext90 through etext99
dir [to see files]
get or mget [to get files. . .set bin for zip files]
GET GUTINDEX.??  [to get a year's listing of books, e.g., GUTINDEX.99]
GET GUTINDEX.ALL [to get a listing of ALL books]

***

**Information prepared by the Project Gutenberg legal advisor**

(Three Pages)

***START**THE SMALL PRINT!**FOR PUBLIC DOMAIN ETEXTS**START***
Why is this "Small Print!" statement here?  You know: lawyers.
They tell us you might sue us if there is something wrong with
your copy of this etext, even if you got it for free from
someone other than us, and even if what's wrong is not our
fault.  So, among other things, this "Small Print!" statement
disclaims most of our liability to you.  It also tells you how
you can distribute copies