      *> demo_bgi.cob —— 第 3 层：传统图形接口（BGI / Borland Graphics Interface）
      *> demo_bgi.cob -- Layer 3: the classic graphics interface (BGI / Borland Graphics Interface)
      *>
      *> 这一层是固定分辨率 + 16 索引色的老式图形：initgraph 开一块 640×480 的画布，
      *> 坐标写死、SetColor(4) 说的是「4 号色」而不是 RGB。要现代表达请看 ui/demo_ui.cob。
      *> This layer is fixed-resolution + 16 indexed colours: initgraph opens a 640x480
      *> canvas, coordinates are hard-coded, and SetColor(4) means "palette index 4", not RGB.
      *> For the modern layer see ui/demo_ui.cob.
      *>
      *> 跑法 / How to run:
      *>   vml run examples/cobol/bgi/demo_bgi.cob
      *> 桌面出图 / Desktop render:
      *>   vmlcli Examples/cobol/bgi/demo_bgi.cob --frames /tmp/bgi_frames
      *>
      *> ⚠ initgraph(gd, gm, path) 的前两个实参在 C 里是指针（入参+出参）。
      *>    本语言没有指针类型，按约定用 vml_alloc 拿一块地址：WS-GD 与 WS-GD+4
      *>    分别当两格 int；CALL 的实参按「地址整数的值」传进去，正好就是 C 的指针。
      *> ⚠ The first two arguments of initgraph(gd, gm, path) are pointers in C (in/out).
      *>    This language has no pointer type, so vml_alloc supplies two int slots: WS-GD
      *>    and WS-GD+4; the CALL passes those address values by value, which is exactly
      *>    what the C pointer parameter wants.
      *>
      *> BGI 的函数名按 Lib/cobol/vml_ui.cob 的声明写法（PascalCase 别名与全小写都在，
      *> 这里用原版 BGI 的 SetColor / Line 写法）。
      *> The BGI names follow the declarations in Lib/cobol/vml_ui.cob; the original BGI
      *> PascalCase spelling (SetColor, Line) is used here.

       IDENTIFICATION DIVISION.
       PROGRAM-ID. DEMO-BGI.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 WS-GD    PIC S9(9) VALUE 0.
       01 WS-GM    PIC S9(9) VALUE 0.
       01 WS-PATH  PIC X(1) VALUE " ".
       PROCEDURE DIVISION.
       MAIN-PARA.
           CALL "vml_alloc" USING 16 GIVING WS-GD.
           ADD 4 TO WS-GD GIVING WS-GM.

           CALL "initgraph" USING WS-GD WS-GM WS-PATH.

           CALL "setbkcolor" USING 0.
           CALL "cleardevice".

           CALL "setcolor" USING 4.
           CALL "line" USING 20 20 300 200.
           CALL "setcolor" USING 14.
           CALL "circle" USING 320 240 60.
           CALL "setcolor" USING 10.
           CALL "rectangle" USING 40 40 220 160.
           CALL "outtextxy" USING 30 30 "demo_bgi.cob".

                      CALL "ui_2d_present"
CALL "closegraph".
           STOP RUN.
