ChrisOS Research ProjectOperating systems · language systems · graphics · machine emulation
DOCUMENTATION ARCHIVEMAIN BRANCH
ChrisOS/Source reference: APPS/BALL/BALL.CC

Source reference: APPS/BALL/BALL.CC

Deterministic source record. The complete textual file is reproduced below; this page does not replace architectural interpretation in the authored chapters.

File identity

Field Value
Path APPS/BALL/BALL.CC
Lines 49
Bytes 748
SHA-256 924e3dc1566bc6b8809c54773e765b2b2cd7e3c72b5664656191b2d2eccfaa00
ChrisOS revision da3df29cb397932c43d32373871fb9380e688ade

Detected syntactic dependencies

Line Include
— No preprocessor include detected.

Detected symbols

Line Symbol
7 main

Complete source

The following block is the complete textual file at the recorded revision. No lines are elided, abbreviated or paraphrased.

int g_x;
int g_y;
int g_vx;
int g_vy;
int g_ready;

void main() {
  int live;
  int bw;
  int bh;
  g_ready = 0;
  while (1) {
    live = win_begin(360, 280, "Ball");
    if (live == 0) {
      return;
    }
    bw = 360;
    bh = 280;
    if (g_ready == 0) {
      g_x = 40;
      g_y = 60;
      g_vx = 3;
      g_vy = 2;
      g_ready = 1;
    }
    g_x = g_x + g_vx;
    g_y = g_y + g_vy;
    if (g_x < 4) {
      g_x = 4;
      g_vx = 0 - g_vx;
    }
    if (g_x > bw - 24) {
      g_x = bw - 24;
      g_vx = 0 - g_vx;
    }
    if (g_y < 24) {
      g_y = 24;
      g_vy = 0 - g_vy;
    }
    if (g_y > bh - 24) {
      g_y = bh - 24;
      g_vy = 0 - g_vy;
    }
    fillrgb(g_x, g_y, 20, 20, 0x0000C060);
    win_end();
    wait(1);
  }
}

Role of this record

The atlas guarantees file-by-file traceability. Responsibility, invariants, ownership, concurrency, security, performance and subsystem interactions belong in authored chapters and must cite this file when applicable.

Document record ID: source-924e3dc1566bc6b8 Reviewed source: da3df29cb397 Class: generated-source-reference