starkernel: item 4.3.3b -- geometry drawing wordset, fixed Q.TO-INT sign bug
Adds LINE (Bresenham in raster space, endpoints projected once each -- valid because the cavalier projection is linear), CIRCLE/ELLIPSE (36-segment polygon approximation), and ARC (18 segments over a caller radian range) to capsules/fabric.4th (blocks 4903-4912). TO-RASTER factored out of CART-PLOT (same behavior) so LINE can reuse the projection+flip for both endpoints. Found mid-implementation: colon definitions cannot span block boundaries in this capsule loader -- verified with a throwaway test capsule, the continuation lands in a [CAPSULE][DEFER] path that never resolves. LINE's body is split across LINE-SETUP/LINE-DONE?/LINE-STUCK?/LINE-STEP, each self-contained within its block, rather than one long definition. A fourth real bug, serious this time: CIRCLE's first live test rendered only one quadrant, then hung the VM for several minutes on a follow-up call. Root cause: q48_to_u64() (include/q48_16.h and include/starkernel/q48_16.h, backing Q.TO-INT) did an unsigned logical shift, corrupting any negative Q48.16 value into a huge garbage integer instead of sign-extending -- inevitable once Q.SIN/Q.COS leave the first quadrant. That garbage became a bogus LINE target with no bound on LINE-STEP's Bresenham loop. Fixed q48_to_u64 to shift through a signed int64_t intermediate (bit-identical for the non-negative case). Also added LINE-STUCK? (LSTEPS vs FB-WIDTH+FB-HEIGHT, the true worst case for an on-screen line) as a defense-in-depth cap against any future bad target. Verified live on amd64 after both fixes: -65536 Q.TO-INT . now prints -1; LINE/CIRCLE/ARC/ELLIPSE all complete without hanging or erroring, and a combined screendump shows all four rendering correctly and distinctly. All three architectures boot clean to ok> with the DoE completing; dict_hash identical across all three and unchanged from 4.3.3a (expected -- fabric.4th isn't loaded at boot, and the Q.TO-INT fix doesn't change dictionary structure). FABRIC.md item 4.3.3b marked done with full acceptance evidence.
This commit is contained in:
+15
-5
@@ -1,5 +1,5 @@
|
||||
# Capsule Block Manifest — Auto-generated
|
||||
<!-- Generated by mkcapsule --manifest 2026-08-07T17:37:50Z -->
|
||||
<!-- Generated by mkcapsule --manifest 2026-08-07T19:19:40Z -->
|
||||
<!-- DO NOT EDIT — re-run mkcapsule --manifest to refresh. -->
|
||||
<!-- Hand-written justifications and immutability notes live -->
|
||||
<!-- in MANIFEST.md alongside this auto-generated index. -->
|
||||
@@ -13,7 +13,7 @@
|
||||
| `common:msg.4th` | 4055 | `0xa99c5bcd3877f80e` |
|
||||
| `doe-campaign.4th` | 4060, 4061, 4062, 4063, 4064, 4065 | `0x3d4549142d91ec20` |
|
||||
| `doe.4th` | 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107 | `0xb6ecf5374e8ee77c` |
|
||||
| `fabric.4th` | 4900, 4901, 4902 | `0xb7db7380ec4a42a0` |
|
||||
| `fabric.4th` | 4900, 4901, 4902, 4903, 4904, 4905, 4906, 4907, 4908, 4909, 4910, 4911, 4912 | `0x355ccc154aac15b3` |
|
||||
| `hermes:init.4th` | 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4175, 4176 | `0x85c7b311d1e5bf97` |
|
||||
| `init-0.4th` | 2200, 2201 | `0xd0a9550baf786bb3` |
|
||||
| `init-1.4th` | 4406, 4415, 4425, 4435 | `0x63e251adb0a03613` |
|
||||
@@ -225,9 +225,19 @@
|
||||
| 4842 | `init-l8-transition.4th` | `0xbcc1a81976f0a4c9` | ok |
|
||||
| 4851 | `artemis:init.4th` | `0xc9e92cd18f4c7b49` | ok |
|
||||
| 4852 | `artemis:init.4th` | `0xc9e92cd18f4c7b49` | ok |
|
||||
| 4900 | `fabric.4th` | `0xb7db7380ec4a42a0` | ok |
|
||||
| 4901 | `fabric.4th` | `0xb7db7380ec4a42a0` | ok |
|
||||
| 4902 | `fabric.4th` | `0xb7db7380ec4a42a0` | ok |
|
||||
| 4900 | `fabric.4th` | `0x355ccc154aac15b3` | ok |
|
||||
| 4901 | `fabric.4th` | `0x355ccc154aac15b3` | ok |
|
||||
| 4902 | `fabric.4th` | `0x355ccc154aac15b3` | ok |
|
||||
| 4903 | `fabric.4th` | `0x355ccc154aac15b3` | ok |
|
||||
| 4904 | `fabric.4th` | `0x355ccc154aac15b3` | ok |
|
||||
| 4905 | `fabric.4th` | `0x355ccc154aac15b3` | ok |
|
||||
| 4906 | `fabric.4th` | `0x355ccc154aac15b3` | ok |
|
||||
| 4907 | `fabric.4th` | `0x355ccc154aac15b3` | ok |
|
||||
| 4908 | `fabric.4th` | `0x355ccc154aac15b3` | ok |
|
||||
| 4909 | `fabric.4th` | `0x355ccc154aac15b3` | ok |
|
||||
| 4910 | `fabric.4th` | `0x355ccc154aac15b3` | ok |
|
||||
| 4911 | `fabric.4th` | `0x355ccc154aac15b3` | ok |
|
||||
| 4912 | `fabric.4th` | `0x355ccc154aac15b3` | ok |
|
||||
|
||||
## Conflicts
|
||||
|
||||
|
||||
Reference in New Issue
Block a user